Snap for 7803083 from 3bed3a6c9d6c88627831844e0be7e34ea3c38a38 to mainline-tzdata2-release
Change-Id: I70294afe7af087853998870e9e3569b0bf9eca75
diff --git a/stats/OWNERS b/OWNERS
similarity index 78%
rename from stats/OWNERS
rename to OWNERS
index 1d6d2df..f640ae0 100644
--- a/stats/OWNERS
+++ b/OWNERS
@@ -1,6 +1,8 @@
jeffreyhuang@google.com
jtnguyen@google.com
muhammadq@google.com
+rslawik@google.com
+sharaienko@google.com
singhtejinder@google.com
tsaichristine@google.com
yaochen@google.com
diff --git a/stats/Android.bp b/stats/Android.bp
index 1a59ab1..dd0be9c 100644
--- a/stats/Android.bp
+++ b/stats/Android.bp
@@ -17,15 +17,17 @@
// ==========================================================
// Build the library for use on the host
// ==========================================================
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
cc_library_host_shared {
name: "libstats_proto_host",
srcs: [
"atoms.proto",
"atom_field_options.proto",
- ],
-
- shared_libs: [
- "libplatformprotos",
+ "enums/**/*.proto",
+ "message/*.proto",
],
proto: {
@@ -35,27 +37,6 @@
"external/protobuf/src",
],
},
-
- export_shared_lib_headers: [
- "libplatformprotos",
- ]
-
-}
-
-cc_library_static {
- name: "libbt-platform-protos-lite",
- host_supported: true,
- proto: {
- export_proto_headers: true,
- type: "lite",
- },
- srcs: [
- "enums/bluetooth/a2dp/enums.proto",
- "enums/bluetooth/enums.proto",
- "enums/bluetooth/hci/enums.proto",
- "enums/bluetooth/hfp/enums.proto",
- "enums/bluetooth/smp/enums.proto",
- ],
}
filegroup {
@@ -81,4 +62,9 @@
],
}
-
+filegroup {
+ name: "libstats_atom_message_protos",
+ srcs: [
+ "message/*.proto",
+ ],
+}
diff --git a/stats/atoms.proto b/stats/atoms.proto
index bd61f3c..6fbdb92 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -34,14 +34,14 @@
import "frameworks/proto_logging/stats/enums/debug/enums.proto";
import "frameworks/proto_logging/stats/enums/hardware/biometrics/enums.proto";
import "frameworks/proto_logging/stats/enums/hardware/sensor/assist/enums.proto";
-import "frameworks/proto_logging/stats/enums/net/networkcapabilities.proto";
+import "frameworks/proto_logging/stats/enums/net/enums.proto";
import "frameworks/proto_logging/stats/enums/os/enums.proto";
import "frameworks/proto_logging/stats/enums/server/connectivity/data_stall_event.proto";
import "frameworks/proto_logging/stats/enums/server/enums.proto";
import "frameworks/proto_logging/stats/enums/server/job/enums.proto";
import "frameworks/proto_logging/stats/enums/server/location/enums.proto";
+import "frameworks/proto_logging/stats/enums/service/enums.proto";
import "frameworks/proto_logging/stats/enums/service/procstats_enum.proto";
-import "frameworks/proto_logging/stats/enums/service/usb.proto";
import "frameworks/proto_logging/stats/enums/stats/connectivity/network_stack.proto";
import "frameworks/proto_logging/stats/enums/stats/connectivity/tethering.proto";
import "frameworks/proto_logging/stats/enums/stats/dnsresolver/dns_resolver.proto";
@@ -50,6 +50,7 @@
import "frameworks/proto_logging/stats/enums/stats/docsui/docsui_enums.proto";
import "frameworks/proto_logging/stats/enums/stats/accessibility/accessibility_enums.proto";
import "frameworks/proto_logging/stats/enums/stats/enums.proto";
+import "frameworks/proto_logging/stats/enums/stats/hdmi/enums.proto";
import "frameworks/proto_logging/stats/enums/stats/intelligence/enums.proto";
import "frameworks/proto_logging/stats/enums/stats/launcher/launcher.proto";
import "frameworks/proto_logging/stats/enums/stats/location/location_enums.proto";
@@ -58,15 +59,20 @@
import "frameworks/proto_logging/stats/enums/stats/storage/storage_enums.proto";
import "frameworks/proto_logging/stats/enums/stats/style/style_enums.proto";
import "frameworks/proto_logging/stats/enums/stats/sysui/notification_enums.proto";
+import "frameworks/proto_logging/stats/enums/stats/tls/enums.proto";
+import "frameworks/proto_logging/stats/enums/stats/tv/tif_enums.proto";
+import "frameworks/proto_logging/stats/enums/stats/wm/enums.proto";
+import "frameworks/proto_logging/stats/enums/system/security/keystore2/enums.proto";
import "frameworks/proto_logging/stats/enums/telecomm/enums.proto";
import "frameworks/proto_logging/stats/enums/telephony/enums.proto";
import "frameworks/proto_logging/stats/enums/view/enums.proto";
import "frameworks/proto_logging/stats/enums/wifi/enums.proto";
import "frameworks/proto_logging/stats/enums/stats/textclassifier/textclassifier_enums.proto";
import "frameworks/proto_logging/stats/enums/stats/otaupdate/updateengine_enums.proto";
+import "frameworks/proto_logging/stats/message/mediametrics_message.proto";
/**
- * The master atom class. This message defines all of the available
+ * The primary atom class. This message defines all of the available
* raw stats log events from the Android system, also known as "atoms."
*
* This field contains a single oneof with all of the available messages.
@@ -149,14 +155,14 @@
AppStartOccurred app_start_occurred = 48 [(module) = "framework", (module) = "statsdtest"];
AppStartCanceled app_start_canceled = 49 [(module) = "framework"];
AppStartFullyDrawn app_start_fully_drawn = 50 [(module) = "framework"];
- LmkKillOccurred lmk_kill_occurred = 51 [(module) = "lmkd"];
+ LmkKillOccurred lmk_kill_occurred = 51 [(module) = "framework"];
PictureInPictureStateChanged picture_in_picture_state_changed = 52 [(module) = "framework"];
WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53 [(module) = "wifi"];
- LmkStateChanged lmk_state_changed = 54 [(module) = "lmkd"];
+ LmkStateChanged lmk_state_changed = 54 [(module) = "framework"];
AppStartMemoryStateCaptured app_start_memory_state_captured = 55 [(module) = "framework"];
ShutdownSequenceReported shutdown_sequence_reported = 56 [(module) = "framework"];
BootSequenceReported boot_sequence_reported = 57;
- DaveyOccurred davey_occurred = 58 [(module) = "statsd"];
+ DaveyOccurred davey_occurred = 58 [(module) = "statsd", deprecated = true];
OverlayStateChanged overlay_state_changed =
59 [(module) = "framework", (module) = "statsdtest"];
ForegroundServiceStateChanged foreground_service_state_changed
@@ -265,7 +271,7 @@
147 [(module) = "framework", (module) = "statsd"];
BiometricSystemHealthIssueDetected biometric_system_health_issue_detected =
148 [(module) = "framework"];
- BubbleUIChanged bubble_ui_changed = 149 [(module) = "sysui"];
+ BubbleUIChanged bubble_ui_changed = 149 [(module) = "framework"];
ScheduledJobConstraintChanged scheduled_job_constraint_changed =
150 [(module) = "framework"];
BluetoothActiveDeviceChanged bluetooth_active_device_changed =
@@ -415,7 +421,8 @@
SnapshotMergeReported snapshot_merge_reported = 255;
ForegroundServiceAppOpSessionEnded foreground_service_app_op_session_ended =
256 [(module) = "framework"];
- DisplayJankReported display_jank_reported = 257;
+ // DisplayJankReported was deprecated in Android 12+
+ DisplayJankReported display_jank_reported = 257 [deprecated = true];
AppStandbyBucketChanged app_standby_bucket_changed = 258 [(module) = "framework"];
SharesheetStarted sharesheet_started = 259 [(module) = "framework"];
RankingSelected ranking_selected = 260 [(module) = "framework", (module) = "sysui"];
@@ -442,7 +449,7 @@
AudioPowerUsageDataReported audio_power_usage_data_reported = 275;
TvTunerStateChanged tv_tuner_state_changed = 276 [(module) = "framework"];
MediaOutputOpSwitchReported mediaoutput_op_switch_reported =
- 277 [(module) = "settings"];
+ 277 [(module) = "sysui"];
CellBroadcastMessageFiltered cb_message_filtered =
278 [(module) = "cellbroadcast"];
TvTunerDvrStatus tv_tuner_dvr_status = 279 [(module) = "framework"];
@@ -485,17 +492,100 @@
NetworkTetheringReported network_tethering_reported =
303 [(module) = "network_tethering"];
ImeTouchReported ime_touch_reported = 304 [(module) = "sysui"];
-
+ UIInteractionFrameInfoReported ui_interaction_frame_info_reported =
+ 305 [(module) = "framework"];
+ UIActionLatencyReported ui_action_latency_reported = 306 [(module) = "framework"];
+ WifiDisconnectReported wifi_disconnect_reported = 307 [(module) = "wifi"];
+ WifiConnectionStateChanged wifi_connection_state_changed = 308 [(module) = "wifi"];
+ HdmiCecActiveSourceChanged hdmi_cec_active_source_changed = 309 [(module) = "framework"];
+ HdmiCecMessageReported hdmi_cec_message_reported = 310 [(module) = "framework"];
+ AirplaneMode airplane_mode = 311 [(module) = "telephony"];
+ ModemRestart modem_restart = 312 [(module) = "telephony"];
+ CarrierIdMismatchReported carrier_id_mismatch_reported = 313 [(module) = "telephony"];
+ CarrierIdTableUpdated carrier_id_table_updated = 314 [(module) = "telephony"];
+ DataStallRecoveryReported data_stall_recovery_reported = 315 [(module) = "telephony"];
MediametricsMediaParserReported mediametrics_mediaparser_reported = 316;
-
+ TlsHandshakeReported tls_handshake_reported = 317 [(module) = "conscrypt"];
TextClassifierApiUsageReported text_classifier_api_usage_reported = 318 [(module) = "textclassifier"];
+ KilledAppStatsReported killed_app_stats_reported = 319 [(module) = "carwatchdogd"];
+ MediametricsPlaybackReported mediametrics_playback_reported = 320 [(module) = "media_metrics"];
+ MediaNetworkInfoChanged media_network_info_changed = 321 [(module) = "media_metrics"];
+ MediaPlaybackStateChanged media_playback_state_changed = 322 [(module) = "media_metrics"];
+ MediaPlaybackErrorReported media_playback_error_reported = 323 [(module) = "media_metrics"];
+ MediaPlaybackTrackChanged media_playback_track_changed = 324 [(module) = "media_metrics"];
+ WifiScanReported wifi_scan_reported = 325 [(module) = "wifi"];
+ WifiPnoScanReported wifi_pno_scan_reported = 326 [(module) = "wifi"];
+ TifTuneStateChanged tif_tune_changed = 327 [(module) = "framework"];
+ AutoRotateReported auto_rotate_reported = 328 [(module) = "framework"];
+ PerfettoTrigger perfetto_trigger = 329 [(module) = "perfetto"];
+ TranscodingData transcoding_data = 330 [(module) = "mediaprovider"];
+ ImsServiceEntitlementUpdated ims_service_entitlement_updated = 331 [(module) = "imsentitlement"];
+ ArtDatumReported art_datum_reported = 332 [(module) = "art"];
+ DeviceRotated device_rotated = 333 [(module) = "framework"];
+ SimSpecificSettingsRestored sim_specific_settings_restored = 334
+ [(module) = "telephony"];
+ TextClassifierDownloadReported text_classifier_download_reported = 335 [(module) = "textclassifier"];
+ PinStorageEvent pin_storage_event = 336 [(module) = "telephony"];
+ FaceDownReported face_down_reported = 337 [(module) = "framework"];
+ BluetoothHALCrashReasonReported bluetooth_hal_crash_reason_reported =
+ 338 [(module) = "bluetooth"];
+ RebootEscrowPreparationReported reboot_escrow_preparation_reported =
+ 339 [(module) = "framework"];
+ RebootEscrowLskfCaptureReported reboot_escrow_lskf_capture_reported =
+ 340 [(module) = "framework"];
+ RebootEscrowRebootReported reboot_escrow_reboot_reported = 341 [(module) = "framework"];
+ BinderLatencyReported binder_latency_reported = 342 [(module) = "framework"];
+ MediametricsAAudioStreamReported mediametrics_aaudiostream_reported = 343;
+ MediaTranscodingSessionEnded media_transcoding_session_ended = 344
+ [(module) = "media"];
+ MagnificationUsageReported magnification_usage_reported =
+ 345 [(module) = "framework"];
+ MagnificationModeWithImeOnReported magnification_mode_with_ime_on_reported =
+ 346 [(module) = "framework"];
+ AppSearchCallStatsReported app_search_call_stats_reported = 347 [(module) = "appsearch"];
+ AppSearchPutDocumentStatsReported app_search_put_document_stats_reported = 348 [(module) = "appsearch"];
+ DeviceControlChanged device_control_changed = 349 [(module) = "sysui"];
+ DeviceStateChanged device_state_changed = 350 [(module) = "framework"];
+ InputDeviceRegistered inputdevice_registered = 351 [(module) = "framework"];
+ SmartSpaceCardReported smartspace_card_reported = 352 [(module) = "sysui"];
+ AuthPromptAuthenticateInvoked auth_prompt_authenticate_invoked = 353 [(module) = "framework"];
+ AuthManagerCanAuthenticateInvoked auth_manager_can_authenticate_invoked = 354 [(module) = "framework"];
+ AuthEnrollActionInvoked auth_enroll_action_invoked = 355 [(module) = "framework"];
+ AuthDeprecatedAPIUsed auth_deprecated_api_used = 356 [(module) = "framework"];
+ UnattendedRebootOccurred unattended_reboot_occurred = 357 [(module) = "scheduling"];
+ LongRebootBlockingReported long_reboot_blocking_reported = 358 [(module) = "scheduling"];
+ LocationTimeZoneProviderStateChanged location_time_zone_provider_state_changed =
+ 359 [(module) = "framework"];
+ // 360-363 are reserved.
+ FdtrackEventOccurred fdtrack_event_occurred = 364 [(module) = "framework"];
+ TimeoutAutoExtendedReported timeout_auto_extended_reported = 365
+ [(module) = "framework"];
+ OdrefreshReported odrefresh_reported = 366 [(module) = "art"];
+ AlarmBatchDelivered alarm_batch_delivered = 367 [(module) = "framework"];
+ AlarmScheduled alarm_scheduled = 368 [(module) = "framework"];
+ IoOveruseStatsReported io_overuse_stats_reported = 369 [(module) = "carwatchdogd"];
+ UserLevelHibernationStateChanged user_level_hibernation_state_changed = 370 [(module) = "framework"];
+ AppSearchInitializeStatsReported app_search_initialize_stats_reported = 371 [(module) = "appsearch"];
+ AppSearchQueryStatsReported app_search_query_stats_reported = 372 [(module) = "appsearch"];
+ AppProcessDied app_process_died = 373 [(module) = "framework"];
+ NetworkIpReachabilityMonitorReported network_ip_reachability_monitor_reported =
+ 374 [(module) = "network_stack"];
+ SlowInputEventReported slow_input_event_reported = 375 [(module) = "input"];
+ ANROccurredProcessingStarted anr_occurred_processing_started = 376 [(module) = "framework"];
+ AppSearchRemoveStatsReported app_search_remove_stats_reported = 377 [(module) = "appsearch"];
+ MediaCodecReported media_codec_reported = 378 [(module) = "framework"];
+ PermissionUsageFragmentInteraction permission_usage_fragment_interaction = 379 [(module) = "permissioncontroller"];
+ PermissionDetailsInteraction permission_details_interaction = 380 [(module) = "permissioncontroller"];
+ PrivacySensorToggleInteraction privacy_sensor_toggle_interaction = 381 [(module) = "framework"];
+ PrivacyToggleDialogInteraction privacy_toggle_dialog_interaction = 382 [(module) = "framework"];
+ AppSearchOptimizeStatsReported app_search_optimize_stats_reported = 383 [(module) = "appsearch"];
// StatsdStats tracks platform atoms with ids upto 500.
// Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
}
// Pulled events will start at field 10000.
- // Next: 10084
+ // Next: 10118
oneof pulled {
WifiBytesTransfer wifi_bytes_transfer = 10000 [(module) = "framework"];
WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001 [(module) = "framework"];
@@ -505,8 +595,7 @@
10003 [(module) = "framework", (truncate_timestamp) = true];
BluetoothBytesTransfer bluetooth_bytes_transfer = 10006 [(module) = "framework"];
KernelWakelock kernel_wakelock = 10004 [(module) = "framework"];
- SubsystemSleepState subsystem_sleep_state = 10005 [(module) = "statsdtest"];
- CpuTimePerFreq cpu_time_per_freq = 10008 [(module) = "framework"];
+ SubsystemSleepState subsystem_sleep_state = 10005 [(module) = "framework", (module) = "statsdtest"];
CpuTimePerUid cpu_time_per_uid = 10009 [(module) = "framework", (module) = "statsdtest"];
CpuTimePerUidFreq cpu_time_per_uid_freq =
10010 [(module) = "framework", (module) = "statsd"];
@@ -537,7 +626,7 @@
ProcStatsPkgProc proc_stats_pkg_proc = 10034 [(module) = "framework"];
ProcessCpuTime process_cpu_time = 10035 [(module) = "framework"];
CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037 [(module) = "framework"];
- OnDevicePowerMeasurement on_device_power_measurement = 10038;
+ OnDevicePowerMeasurement on_device_power_measurement = 10038 [(module) = "framework"];
DeviceCalculatedPowerUse device_calculated_power_use = 10039 [(module) = "framework"];
DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid =
10040 [(module) = "framework"];
@@ -570,7 +659,7 @@
NotificationRemoteViews notification_remote_views = 10066 [(module) = "framework"];
DangerousPermissionStateSampled dangerous_permission_state_sampled =
10067 [(module) = "framework"];
- GraphicsStats graphics_stats = 10068;
+ GraphicsStats graphics_stats = 10068 [(module) = "hwui"];
RuntimeAppOpAccess runtime_app_op_access = 10069 [(module) = "framework"];
IonHeapSize ion_heap_size = 10070 [(module) = "framework"];
PackageNotificationPreferences package_notification_preferences =
@@ -587,19 +676,69 @@
SupportedRadioAccessFamily supported_radio_access_family = 10079 [(module) = "telephony"];
SettingSnapshot setting_snapshot = 10080 [(module) = "framework"];
BlobInfo blob_info = 10081 [(module) = "framework"];
- DataUsageBytesTransfer data_usage_bytes_transfer = 10082 [(module) = "framework"];
+ DataUsageBytesTransfer data_usage_bytes_transfer =
+ 10082 [(module) = "framework", (truncate_timestamp) = true];
BytesTransferByTagAndMetered bytes_transfer_by_tag_and_metered =
- 10083 [(module) = "framework"];
+ 10083 [(module) = "framework", (truncate_timestamp) = true];
DNDModeProto dnd_mode_rule = 10084 [(module) = "framework"];
GeneralExternalStorageAccessStats general_external_storage_access_stats =
10085 [(module) = "mediaprovider"];
+ IncomingSms incoming_sms = 10086 [(module) = "telephony"];
+ OutgoingSms outgoing_sms = 10087 [(module) = "telephony"];
+ CarrierIdTableVersion carrier_id_table_version = 10088 [(module) = "telephony"];
+ DataCallSession data_call_session = 10089 [(module) = "telephony"];
+ CellularServiceState cellular_service_state = 10090 [(module) = "telephony"];
+ CellularDataServiceSwitch cellular_data_service_switch = 10091 [(module) = "telephony"];
+ SystemMemory system_memory = 10092 [(module) = "framework"];
+ ImsRegistrationTermination ims_registration_termination = 10093 [(module) = "telephony"];
+ ImsRegistrationStats ims_registration_stats = 10094 [(module) = "telephony"];
+ CpuTimePerClusterFreq cpu_time_per_cluster_freq = 10095 [(module) = "framework"];
+ CpuCyclesPerUidCluster cpu_cycles_per_uid_cluster = 10096 [(module) = "framework"];
+ DeviceRotatedData device_rotated_data = 10097 [(module) = "framework"];
+ CpuCyclesPerThreadGroupCluster cpu_cycles_per_thread_group_cluster = 10098 [(module) = "framework"];
+ MediaDrmActivityInfo media_drm_activity_info = 10099;
+ OemManagedBytesTransfer oem_managed_bytes_transfer = 10100 [(module) = "framework"];
+ GnssPowerStats gnss_power_stats = 10101 [(module) = "framework"];
+ TimeZoneDetectorState time_zone_detector_state = 10102 [(module) = "framework"];
+ Keystore2StorageStats keystore2_storage_stats = 10103 [(module) = "framework"];
+ RkpPoolStats rkp_pool_stats = 10104 [(module) = "framework"];
+ ProcessDmabufMemory process_dmabuf_memory = 10105 [(module) = "framework"];
+ PendingAlarmInfo pending_alarm_info = 10106 [(module) = "framework"];
+ UserLevelHibernatedApps user_level_hibernated_apps = 10107 [(module) = "framework"];
+ GlobalHibernatedApps global_hibernated_apps = 10109 [(module) = "framework"];
+ InputEventLatencySketch input_event_latency_sketch = 10110 [(module) = "input"];
+ BatteryUsageStatsBeforeReset battery_usage_stats_before_reset =
+ 10111 [(module) = "framework"];
+ BatteryUsageStatsSinceReset battery_usage_stats_since_reset =
+ 10112 [(module) = "framework"];
+ BatteryUsageStatsSinceResetUsingPowerProfileModel
+ battery_usage_stats_since_reset_using_power_profile_model =
+ 10113 [(module) = "framework"];
+ InstalledIncrementalPackage installed_incremental_package = 10114 [(module) = "framework"];
+ TelephonyNetworkRequests telephony_network_requests = 10115 [(module) = "telephony"];
+ AppSearchStorageInfo app_search_storage_info = 10116 [(module) = "appsearch"];
+ VmStat vmstat = 10117 [(module) = "framework"];
+ Keystore2KeyCreationWithGeneralInfo keystore2_key_creation_with_general_info =
+ 10118 [(module) = "framework"];
+ Keystore2KeyCreationWithAuthInfo keystore2_key_creation_with_auth_info =
+ 10119 [(module) = "framework"];
+ Keystore2KeyCreationWithPurposeAndModesInfo
+ keystore2_key_creation_with_purpose_and_modes_info = 10120 [(module) = "framework"];
+ Keystore2AtomWithOverflow keystore2_atom_with_overflow = 10121 [(module) = "framework"];
+ Keystore2KeyOperationWithPurposeAndModesInfo
+ keystore2_key_operation_with_purpose_and_modes_info =
+ 10122 [(module) = "framework"];
+ Keystore2KeyOperationWithGeneralInfo keystore2_key_operation_with_general_info =
+ 10123 [(module) = "framework"];
+ RkpErrorStats rkp_error_stats = 10124 [(module) = "framework"];
+ Keystore2CrashStats keystore2_crash_stats = 10125 [(module) = "framework"];
}
// DO NOT USE field numbers above 100,000 in AOSP.
// Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
// Field numbers 200,000 and above are reserved for future use; do not use them at all.
- reserved 10036;
+ reserved 10008, 10036;
}
/**
@@ -681,6 +820,61 @@
}
/**
+ * Track transcoding service usage
+ * Logged from:
+ * packages/providers/MediaProvider/src/com/android/providers/media/TranscodeHelper.java
+ * Next Tag: 14
+ */
+message TranscodingData {
+ // Reason that leads to the type of access.
+ enum AccessReason {
+ UNKNOWN = 0;
+ SYSTEM_DEFAULT = 1; // Default option
+ SYSTEM_CONFIG = 2; // Server-side/on-device config
+ APP_MANIFEST = 3; // media_capabilites.xml
+ APP_COMPAT = 4; // App compat framework
+ APP_EXTRA = 5; // ApplicationMediaCapabilities API in open()
+ }
+
+ // Causes that leads to the failure of transcode.
+ enum FailureCause {
+ CAUSE_UNKNOWN = 0;
+ TRANSCODING_SERVICE_ERROR = 1; // Error from transcoding service.
+ TRANSCODING_CLIENT_TIMEOUT = 2; // Timeout from MediaProvider.
+ TRANSCODING_SESSION_CANCELED = 3; // MediaProvider cancels the transcode.
+ }
+
+ enum AccessType {
+ HEVC_WRITE = 1;
+ READ_DIRECT = 2;
+ READ_CACHE = 3;
+ READ_TRANSCODE = 4;
+ WRITE_CACHE = 5; // App trying to write to transcodeid avc file in cache, this is rare.
+ AVC_WRITE = 6;
+ }
+
+ enum Result {
+ SUCCESS = 0;
+ FAIL = 1;
+ UNDEFINED = 2;
+ }
+
+ optional string requestor_package = 1;
+ optional AccessType access_type = 2;
+ optional int64 file_size_bytes = 3;
+ optional Result transcode_result = 4;
+ optional int64 transcode_duration_millis = 5; // The duration of transcoding.
+ optional int64 file_duration_millis = 6; // The duration of the video file.
+ optional int64 file_framerate_fps = 7; // The framerate of the video file.
+ optional AccessReason access_reason = 8;
+ optional int64 width = 9;
+ optional int64 height = 10;
+ optional bool hit_anr = 11;
+ optional FailureCause failure_cause = 12; // This field is valid only when fails.
+ optional int64 transcoding_service_error_code = 13; // Error code from transcoding service.
+}
+
+/**
* Logs when the screen state changes.
*
* Logged from:
@@ -854,10 +1048,10 @@
}
/**
- * Logs whether a wifi connection is successful and reasons for failure if it isn't.
+ * Logs whether a Wifi connection attempt was successful and reasons for failure if it wasn't.
*
* Logged from:
- * frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
+ * frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
*/
message WifiConnectionResultReported {
enum FailureCode {
@@ -869,13 +1063,159 @@
FAILURE_DHCP = 5;
FAILURE_NETWORK_DISCONNECTION = 6;
FAILURE_ROAM_TIMEOUT = 7;
+ FAILURE_WRONG_PASSWORD = 8;
}
- // true represents a successful connection
+
+ enum Trigger {
+ UNKNOWN = 0;
+ // Connection attempt was initiated manually.
+ MANUAL = 1;
+ // Automatic reconnection to the same network as connected previously.
+ RECONNECT_SAME_NETWORK = 2;
+ // Automatic reconnection to a saved network, but not the previous one.
+ AUTOCONNECT_CONFIGURED_NETWORK = 3;
+ // Automatic first connection attempt after device boot.
+ AUTOCONNECT_BOOT = 4;
+ }
+
+ // True represents a successful connection.
optional bool connection_result = 1;
- // reason for the connection failure
+ // Reason for the connection failure.
optional FailureCode failure_code = 2;
- // scan rssi before the connection attempt
+ // Scan RSSI before the connection attempt.
optional int32 rssi = 3;
+ // Time taken by this connection attempt.
+ optional int32 connection_attempt_duration_millis = 4;
+ // Band bucket the connected network is on.
+ optional android.net.wifi.WifiBandBucket band = 5;
+ // Authentication type.
+ optional android.net.wifi.WifiAuthType auth_type = 6;
+ // What triggered this connection attempt.
+ optional Trigger trigger = 7;
+ // Whether this network was used (successfully connected to) previously.
+ optional bool network_used = 8;
+ // Time taken from the last successful connection (or device boot if that's the first one).
+ optional int32 time_since_last_connection_seconds = 9;
+}
+
+/**
+ * Logs when a Wifi connection drops.
+ *
+ * Logged from:
+ * frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
+ */
+message WifiDisconnectReported {
+ enum FailureCode {
+ UNKNOWN = 0;
+
+ // Wifi supplicant failure reason codes (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45).
+ // See ISupplicantStaIfaceCallback.java:ReasonCode
+ UNSPECIFIED = 1;
+ PREV_AUTH_NOT_VALID = 2;
+ DEAUTH_LEAVING = 3;
+ DISASSOC_DUE_TO_INACTIVITY = 4;
+ DISASSOC_AP_BUSY = 5;
+ CLASS2_FRAME_FROM_NONAUTH_STA = 6;
+ CLASS3_FRAME_FROM_NONASSOC_STA = 7;
+ DISASSOC_STA_HAS_LEFT = 8;
+ STA_REQ_ASSOC_WITHOUT_AUTH = 9;
+ PWR_CAPABILITY_NOT_VALID = 10;
+ SUPPORTED_CHANNEL_NOT_VALID = 11;
+ BSS_TRANSITION_DISASSOC = 12;
+ INVALID_IE = 13;
+ MICHAEL_MIC_FAILURE = 14;
+ FOURWAY_HANDSHAKE_TIMEOUT = 15;
+ GROUP_KEY_UPDATE_TIMEOUT = 16;
+ IE_IN_4WAY_DIFFERS = 17;
+ GROUP_CIPHER_NOT_VALID = 18;
+ PAIRWISE_CIPHER_NOT_VALID = 19;
+ AKMP_NOT_VALID = 20;
+ UNSUPPORTED_RSN_IE_VERSION = 21;
+ INVALID_RSN_IE_CAPAB = 22;
+ IEEE_802_1X_AUTH_FAILED = 23;
+ CIPHER_SUITE_REJECTED = 24;
+ TDLS_TEARDOWN_UNREACHABLE = 25;
+ TDLS_TEARDOWN_UNSPECIFIED = 26;
+ SSP_REQUESTED_DISASSOC = 27;
+ NO_SSP_ROAMING_AGREEMENT = 28;
+ BAD_CIPHER_OR_AKM = 29;
+ NOT_AUTHORIZED_THIS_LOCATION = 30;
+ SERVICE_CHANGE_PRECLUDES_TS = 31;
+ UNSPECIFIED_QOS_REASON = 32;
+ NOT_ENOUGH_BANDWIDTH = 33;
+ DISASSOC_LOW_ACK = 34;
+ EXCEEDED_TXOP = 35;
+ STA_LEAVING = 36;
+ END_TS_BA_DLS = 37;
+ UNKNOWN_TS_BA = 38;
+ TIMEOUT = 39;
+ PEERKEY_MISMATCH = 45;
+ AUTHORIZED_ACCESS_LIMIT_REACHED = 46;
+ EXTERNAL_SERVICE_REQUIREMENTS = 47;
+ INVALID_FT_ACTION_FRAME_COUNT = 48;
+ INVALID_PMKID = 49;
+ INVALID_MDE = 50;
+ INVALID_FTE = 51;
+ MESH_PEERING_CANCELLED = 52;
+ MESH_MAX_PEERS = 53;
+ MESH_CONFIG_POLICY_VIOLATION = 54;
+ MESH_CLOSE_RCVD = 55;
+ MESH_MAX_RETRIES = 56;
+ MESH_CONFIRM_TIMEOUT = 57;
+ MESH_INVALID_GTK = 58;
+ MESH_INCONSISTENT_PARAMS = 59;
+ MESH_INVALID_SECURITY_CAP = 60;
+ MESH_PATH_ERROR_NO_PROXY_INFO = 61;
+ MESH_PATH_ERROR_NO_FORWARDING_INFO = 62;
+ MESH_PATH_ERROR_DEST_UNREACHABLE = 63;
+ MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64;
+ MESH_CHANNEL_SWITCH_REGULATORY_REQ = 65;
+ MESH_CHANNEL_SWITCH_UNSPECIFIED = 66;
+
+ // ClientModeImpl error codes
+ // Defined in /frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
+ IFACE_DESTROYED = 10000;
+ WIFI_DISABLED = 10001;
+ SUPPLICANT_DISCONNECTED = 10002;
+ CONNECTING_WATCHDOG_TIMER = 10003;
+ ROAM_WATCHDOG_TIMER = 10004;
+ }
+
+ // How long the session lasted from successful connection to disconnect.
+ optional int32 connected_duration_seconds = 1;
+
+ // Reason for the disconnect.
+ optional FailureCode failure_code = 2;
+
+ // Band bucket the connected network was on.
+ optional android.net.wifi.WifiBandBucket band = 3;
+
+ // Authentication type.
+ optional android.net.wifi.WifiAuthType auth_type = 4;
+
+ // Last seen RSSI before the disconnect.
+ optional int32 last_rssi = 5;
+
+ // Last seen link speed before the disconnect.
+ optional int32 last_link_speed = 6;
+}
+
+/**
+ * Logs when Wifi connection is established or dropped.
+ *
+ * Logged from:
+ * frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
+ */
+message WifiConnectionStateChanged {
+ optional bool is_connected = 1;
+
+ // Band bucket the connected network was on.
+ // Filled for both connected and disconnected cases.
+ optional android.net.wifi.WifiBandBucket band = 2;
+
+ // Authentication type.
+ // Filled for both connected and disconnected cases.
+ optional android.net.wifi.WifiAuthType auth_type = 3;
}
/**
@@ -1057,6 +1397,8 @@
*
* Logged from:
* frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
+ *
+ * Next tag: 18
*/
message ScheduledJobStateChanged {
repeated AttributionNode attribution_node = 1;
@@ -1071,10 +1413,16 @@
}
optional State state = 3;
- // The reason a job has stopped.
+ // The internal reason a job has stopped.
// This is only applicable when the state is FINISHED.
- // The default value is STOP_REASON_UNKNOWN.
- optional android.app.job.StopReasonEnum stop_reason = 4;
+ // The default value is INTERNAL_STOP_REASON_UNKNOWN.
+ optional android.app.job.InternalStopReasonEnum internal_stop_reason = 4;
+
+ // The publicly returned reason onStopJob() was called.
+ // This is only applicable when the state is FINISHED, but may be undefined if
+ // JobService.onStopJob() was never called for the job.
+ // The default value is STOP_REASON_UNDEFINED.
+ optional android.app.job.StopReasonEnum public_stop_reason = 17;
// The standby bucket of the app that scheduled the job. These match the framework constants
// defined in JobSchedulerService.java with the addition of UNKNOWN using -1, as ACTIVE is
@@ -1103,6 +1451,11 @@
optional bool has_idle_constraint = 12;
optional bool has_connectivity_constraint = 13;
optional bool has_content_trigger_constraint = 14;
+
+ // True if the app has requested this run as an expedited job.
+ optional bool is_requested_expedited_job = 15;
+ // True if the job is running as an expedited job. Only valid for STARTED and FINISHED states.
+ optional bool is_running_as_expedited_job = 16;
}
/**
@@ -2778,6 +3131,64 @@
}
/**
+ * Logs when there is a crash in hardware abstraction layer (HAL)
+ *
+ * Logged from:
+ * system/bt
+ *
+ */
+message BluetoothHALCrashReasonReported {
+ // An identifier that can be used to match events for this device.
+ // The incremental identifier is locally generated and guaranteed not derived
+ // from any globally unique hardware id.
+ // For paired devices, it stays consistent between Bluetooth toggling for the
+ // same remote device.
+ // For unpaired devices, it stays consistent within the same Bluetooth adapter
+ // session for the same remote device.
+ // Default: 0 if the device's metric id is unknown.
+ optional int32 metric_id = 1;
+ // An identifier that can be used to match events for this device.
+ // Currently, this is a salted hash of the MAC address of this Bluetooth device.
+ // Salt: Randomly generated 256 bit value
+ // Hash algorithm: HMAC-SHA256
+ // Size: 32 byte
+ // Default: null or empty if the device identifier is not known
+ optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Bluetooth HAL crash reason error code.
+ // Original type: uint8_t
+ // Default: 0x00 (DEFAULT)
+ optional int32 error_code = 3;
+ // Bluetooth HAL crash reason vendor error code.
+ // Original type: uint8_t
+ // Default: 0x00 (DEFAULT)
+ optional int32 vendor_error_code = 4;
+}
+
+/* Logs input device information when input device is registered with Android device.
+ * Reported at when a new input device is found by EventHub.
+ *
+ * Logged from:
+ * frameworks/native/services/inputflinger
+ */
+message InputDeviceRegistered {
+ // The Input Device Name
+ optional string name = 1;
+ // The Input Device Vendor ID
+ optional int32 vendor_id = 2;
+ // The Input Device Product ID
+ optional int32 product_id = 3;
+ // The Input Device Version ID
+ optional int32 version_id = 4;
+ // The Input Device Bus ID
+ optional int32 bus_id = 5;
+ // The Input Device identifier generated from kernel device.
+ // Hash algorithm: HMAC-SHA256
+ optional string obfuscated_id = 6;
+ // The Input Device Classes
+ optional int32 device_classes = 7;
+}
+
+/**
* Logs when something is plugged into or removed from the USB-C connector.
*
* Logged from:
@@ -3040,6 +3451,9 @@
optional int32 end_y = 7; // Y coordinate for ACTION_MOVE event.
optional int32 left_boundary = 8; // left edge width + left inset
optional int32 right_boundary = 9; // screen width - (right edge width + right inset)
+ // The score between 0 and 1 which is the prediction output for the Back Gesture model.
+ optional float ml_model_score = 10;
+ optional string package_name = 11; // The name of the top 100 most used package by all users.
enum WindowHorizontalLocation {
DEFAULT_LOCATION = 0;
@@ -3127,6 +3541,55 @@
// e.g., number of contents inside a container (e.g., icons inside a folder)
optional int32 cardinality = 24;
+
+ // Used to store features of the target (e.g. widget is reconfigurable, etc)
+ optional int32 features = 25;
+}
+
+message SmartSpaceCardReported {
+ // Different SmartSpace cards.
+ enum CardType {
+ UNKNOWN_CARD = 0;
+ COMMUTE = 1;
+ CALENDAR = 2;
+ FLIGHT = 3;
+ WEATHER = 4;
+ WEATHER_ALERT = 5;
+ AT_A_STORE_SHOPPING_LIST = 6;
+ AT_A_STORE_LOYALTY_CARD = 7;
+ HEADPHONE_RESUME_MEDIA = 8;
+ HEADPHONE_MEDIA_RECOMMENDATIONS = 9;
+ TIMER = 10;
+ STOPWATCH = 11;
+ FITNESS_ACTIVITY = 12;
+ UPCOMING_REMINDER = 13;
+ UPCOMING_BEDTIME = 14;
+ TIME_TO_LEAVE = 15;
+ PACKAGE_DELIVERED = 16;
+ TIPS = 17;
+ }
+
+ // The surface that SmartSpace card is shown.
+ enum DisplaySurface {
+ DEFAULT_SURFACE = 0;
+ HOMESCREEN = 1;
+ LOCKSCREEN = 2;
+ AOD = 3;
+ SHADE = 4;
+ }
+
+ // The event id (e.g., impression, click, longpress, dismiss)
+ optional int32 event_id = 1;
+ // Uniquely identifies a card. Should persist through updates.
+ optional int32 instance_id = 2;
+ // Uniquely identifies one of the possible types of the SmartSpace cards.
+ optional CardType card_type = 3;
+ // Location of the card when the event occurred.
+ optional DisplaySurface display_surface = 4;
+ // The position of the card in the carousel when the event occurred.
+ optional int32 rank = 5;
+ // The number of cards shown to the user.
+ optional int32 cardinality = 6;
}
/**
@@ -3175,6 +3638,9 @@
// e.g., (x, y) span of the widget inside homescreen grid system
optional int32 span_x = 17 [default = 1];
optional int32 span_y = 18 [default = 1];
+
+ // Used to store features of the target (e.g. widget is reconfigurable, etc)
+ optional int32 features = 19;
}
/**
@@ -3195,6 +3661,8 @@
optional int32 wallpaper_id_hash = 8;
optional int32 color_preference = 9;
optional android.stats.style.LocationPreference location_preference = 10;
+ optional android.stats.style.DatePreference date_preference = 11;
+ optional android.stats.style.LaunchedPreference launched_preference = 12;
}
/**
@@ -3263,6 +3731,54 @@
}
/**
+ * Logs slow input events.
+ * The reports are rate-limited via a configurable server flag.
+ *
+ * Logged from:
+ * frameworks/native/services/inputflinger
+ */
+message SlowInputEventReported {
+ /**
+ * This is logged when a slow input event occurs. The threshold for what is considered a slow
+ * event is applied to the 'end_to_end' latency number, and is configurable via a server flag.
+ *
+ * The goal of this data is to identify the bottlenecks in processing of input events.
+ * All of the *_micros fields below are durations. The start and end points for each value
+ * are described in the comments.
+ */
+ // Whether or not this is a DOWN event. If false, this is a MOVE event
+ optional bool is_down = 1;
+ // Start: the input event was created (touch events: the touch interrupt received in the driver)
+ // End: the event was read in userspace (in EventHub)
+ optional int32 event_to_read_micros = 2;
+ // Start: the event was read in EventHub
+ // End: the event was send to the app via the InputChannel (written to the socket)
+ optional int32 read_to_deliver_micros = 3;
+ // Start: the input event was sent to the app
+ // End: the app consumed the input event
+ optional int32 deliver_to_consume_micros = 4;
+ // Start: the app consumed the event
+ // End: the app's 'finishInputEvent' call was received in inputflinger
+ // The end point can also be called "the app finished processing input event"
+ optional int32 consume_to_finish_micros = 5;
+ // Start: the app consumed the input event
+ // End: the app produced a buffer
+ optional int32 consume_to_gpu_complete_micros = 6;
+ // Start: the app produced a buffer
+ // End: the frame was shown on the display
+ optional int32 gpu_complete_to_present_micros = 7;
+ // The end-to-end touch latency
+ // Start: the input event was created (touch events: the touch interrupt received in the driver)
+ // End: the frame was presented on the display
+ optional int32 end_to_end_micros = 8;
+ // Since the last time this atom was reported, how many total events occurred?
+ optional int32 num_events_since_last_report = 9;
+ // Since the last time this atom was reported, how many slow events did not get reported
+ // due to rate limiting?
+ optional int32 num_skipped_slow_events_since_last_report = 10;
+}
+
+/**
* Logs gesture classification and timing information for touch events.
*
* Logged from:
@@ -3437,6 +3953,54 @@
optional ForegroundState foreground_state = 7;
optional android.server.ErrorSource error_source = 8;
+
+ optional bool is_incremental = 9;
+
+ optional float loading_progress = 10;
+
+ optional int64 millis_since_oldest_pending_read = 11;
+
+ // Status code to represent the health of the file system backing storage, as defined in
+ // frameworks/base/core/java/android/os/incremental/IStorageHealthListener.aidl.
+ // Value -1 if the app is not installed on Incremental
+ optional int32 storage_health_code = 12;
+
+ // Status code to represent the status of data loader, as defined in
+ // frameworks/base/core/java/android/content/pm/IDataLoaderStatusListener.aidl.
+ // Value -1 if the app is not installed on Incremental
+ optional int32 data_loader_status_code = 13;
+
+ // Whether read logs collection is enabled
+ optional bool read_logs_enabled = 14;
+
+ // Duration since last attempt to bind data loader. 0 means did not attempt to bind.
+ // -1 means the app is not installed on Incremental.
+ optional int64 millis_since_last_data_loader_bind = 15;
+
+ // Delay for retrying to bind data loader. If not bound, it shows how soon it will be bound.
+ optional int64 data_loader_bind_delay_millis = 16;
+
+ // Total count of delayed reads, as reported by Incremental File System.
+ optional int32 total_delayed_reads = 17;
+
+ // Total count of failed reads (timeout or hash errors) as reported by Incremental File System.
+ optional int32 total_failed_reads = 18;
+
+ // UID of the process that tried to read a page from the app but failed.
+ // This shows whether the read was initiated by the system, the app itself, or some other apps.
+ // -1 means there was no read error or the app is not installed on Incremental.
+ optional int32 last_read_error_uid = 19;
+
+ // Duration since that last read failure.
+ // -1 means there was no read error or the app is not installed on Incremental.
+ optional int64 last_read_error_millis_since = 20;
+
+ // Error code of last read failure. ETIME (value=62) for timeout, EBADMSG (value=74) for hash
+ // and other positive values for other errors. -1 means app is not installed on Incremental.
+ optional int32 last_read_error_code = 21;
+
+ // Total duration of delayed reads in milliseconds
+ optional int64 total_delayed_reads_duration_millis = 22;
}
/**
@@ -3498,6 +4062,64 @@
optional android.server.ErrorSource error_source = 7;
optional string package_name = 8;
+
+ optional bool is_incremental = 9;
+
+ optional float loading_progress = 10;
+
+ optional int64 millis_since_oldest_pending_read = 11;
+
+ // Status code to represent the health of the file system backing storage, as defined in
+ // frameworks/base/core/java/android/os/incremental/IStorageHealthListener.aidl.
+ // Value -1 if the app is not installed on Incremental
+ optional int32 storage_health_code = 12;
+
+ // Status code to represent the status of data loader, as defined in
+ // frameworks/base/core/java/android/content/pm/IDataLoaderStatusListener.aidl.
+ // Value -1 if the app is not installed on Incremental
+ optional int32 data_loader_status_code = 13;
+
+ // Whether read logs collection is enabled
+ optional bool read_logs_enabled = 14;
+
+ // Duration since last attempt to bind data loader. 0 means did not attempt to bind.
+ // -1 means the app is not installed on Incremental.
+ optional int64 millis_since_last_data_loader_bind = 15;
+
+ // Delay for retrying to bind data loader. If not bound, it shows how soon it will be bound.
+ optional int64 data_loader_bind_delay_millis = 16;
+
+ // Total count of delayed reads, as reported by Incremental File System.
+ optional int32 total_delayed_reads = 17;
+
+ // Total count of failed reads (timeout or hash errors) as reported by Incremental File System.
+ optional int32 total_failed_reads = 18;
+
+ // UID of the process that tried to read a page from the app but failed.
+ // This shows whether the read was initiated by the system, the app itself, or some other apps.
+ // -1 means there was no read error or the app is not installed on Incremental.
+ optional int32 last_read_error_uid = 19;
+
+ // Duration since that last read failure.
+ // -1 means there was no read error or the app is not installed on Incremental.
+ optional int64 last_read_error_millis_since = 20;
+
+ // Error code of last read failure. ETIME (value=62) for timeout, EBADMSG (value=74) for hash
+ // and other positive values for other errors. -1 means app is not installed on Incremental.
+ optional int32 last_read_error_code = 21;
+
+ // Total duration of delayed reads in milliseconds
+ optional int64 total_delayed_reads_duration_millis = 22;
+}
+
+/**
+ * Logs immediately after an app ANR (App Not Responding) occurs. In contrast, ANROccurred (the
+ * atom above) logs some time (not necessarily immediately) after the ANR is detected.
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/am/AppErrors.java
+ */
+message ANROccurredProcessingStarted {
+ optional string process_name = 1;
}
/**
@@ -3583,6 +4205,7 @@
WARM = 1;
HOT = 2;
COLD = 3;
+ RELAUNCH = 4;
}
// The transition type.
optional TransitionType type = 3;
@@ -3596,8 +4219,8 @@
// Whether the app is an instant app.
optional bool is_instant_app = 6;
- // Device uptime when activity started.
- optional int64 activity_start_millis = 7;
+ // Device uptime when activity started. Deprecated: use activity_start_timestamp_millis instead.
+ optional int64 activity_start_millis = 7 [deprecated = true];
optional android.app.AppTransitionReasonEnum reason = 8;
@@ -3611,11 +4234,40 @@
// Empty if not set.
optional string launch_token = 13;
- // The compiler filter used when when the package was optimized.
- optional int32 package_optimization_compilation_filter = 14;
-
// The reason why the package was optimized.
- optional int32 package_optimization_compilation_reason = 15;
+ optional int32 package_optimization_compilation_reason = 14;
+
+ // The compiler filter used when when the package was optimized.
+ optional int32 package_optimization_compilation_filter = 15;
+
+ enum SourceType {
+ UNAVAILABLE = 0;
+ LAUNCHER = 1;
+ NOTIFICATION = 2;
+ LOCKSCREEN = 3;
+ RECENTS_ANIMATION = 4;
+ }
+ // The type of the startup source.
+ optional SourceType source_type = 16;
+
+ // The time from the startup source to the beginning of handling the startup event.
+ // -1 means not available.
+ optional int32 source_event_delay_millis = 17;
+
+ // Whether the app is hibernating when it started
+ optional bool is_hibernating = 18;
+
+ // Whether the app is installed on Incremental File System.
+ optional bool is_incremental = 19;
+
+ // Whether the app is still being streamed.
+ optional bool is_loading = 20;
+
+ // The hash value of the activity name.
+ optional int32 activity_name_hash = 21;
+
+ // The timestamp(SystemClock#elapsedRealtime()) when starting activity.
+ optional int64 activity_start_timestamp_millis = 22;
}
message AppStartCanceled {
@@ -3630,6 +4282,7 @@
WARM = 1;
HOT = 2;
COLD = 3;
+ RELAUNCH = 4;
}
// The transition type.
optional TransitionType type = 3;
@@ -3660,6 +4313,34 @@
// App startup time (until call to Activity#reportFullyDrawn()).
optional int64 app_startup_time_millis = 6;
+
+ // The reason why the package was optimized.
+ optional int32 package_optimization_compilation_reason = 7;
+
+ // The compiler filter used when when the package was optimized.
+ optional int32 package_optimization_compilation_filter = 8;
+
+ enum SourceType {
+ UNAVAILABLE = 0;
+ LAUNCHER = 1;
+ NOTIFICATION = 2;
+ LOCKSCREEN = 3;
+ }
+ // The type of the startup source.
+ optional SourceType source_type = 9;
+
+ // The time from the startup source to the beginning of handling the startup event.
+ // -1 means not available.
+ optional int32 source_event_delay_millis = 10;
+
+ // Whether the app is installed on Incremental File System.
+ optional bool is_incremental = 11;
+
+ // Whether the app is still being streamed.
+ optional bool is_loading = 12;
+
+ // The hash value of the activity name.
+ optional int32 activity_name_hash = 13;
}
/**
@@ -3719,12 +4400,35 @@
enum State {
ENTER = 1;
EXIT = 2;
+ DENIED = 3;
}
optional State state = 3;
// Whether the fgs is allowed while-in-use permissions, i.e. is considered 'in-use' to the user.
// (If the fgs was started while the app wasn't TOP it usually will be denied these permissions)
optional bool allow_while_in_use_permission = 4;
+ // the reason why FGS is allowed or denied to start. The reason code is defined as
+ // PowerExemptionManager#ReasonCode.
+ optional int32 fgs_start_reason_code = 5;
+ // FGS service's targetSdkVersion.
+ optional int32 target_sdk_version = 6;
+ // uid of the app that start/bind this service.
+ optional int32 calling_uid = 7;
+ // targetSdkVersion of the app that start/bind this service.
+ optional int32 caller_target_sdk_version = 8;
+ // uid of the app that set the temp-allowlist, INVALID_UID (-1) if not in any
+ // temp-allowlist.
+ optional int32 temp_allow_list_calling_uid = 9;
+ // FGS notification was deferred.
+ optional bool fgs_notification_deferred = 10;
+ // FGS notification was shown before the FGS finishes, or it wasn't deferred in the first place.
+ optional bool fgs_notification_shown = 11;
+ // The duration from state ENTER to state EXIT. Only meaningful when the state is EXIT.
+ optional int32 fgs_duration_ms = 12;
+ // Number of times startForeground() is called on this service.
+ optional int32 fgs_start_count = 13;
+ // SHA-1 hashed short_name combined with ANDROID_ID.
+ optional int32 short_name_hash = 14;
}
/**
@@ -3867,6 +4571,18 @@
* system/core/lmkd/lmkd.c
*/
message LmkKillOccurred {
+ enum Reason {
+ UNKNOWN = 0;
+ PRESSURE_AFTER_KILL = 1;
+ NOT_RESPONDING = 2;
+ LOW_SWAP_AND_THRASHING = 3;
+ LOW_MEM_AND_SWAP = 4;
+ LOW_MEM_AND_THRASHING = 5;
+ DIRECT_RECL_AND_THRASHING = 6;
+ LOW_MEM_AND_SWAP_UTIL = 7;
+ LOW_FILECACHE_AFTER_THRASHING = 8;
+ }
+
// The uid if available. -1 means not available.
optional int32 uid = 1 [(is_uid) = true];
@@ -3896,6 +4612,21 @@
// Min oom adj score considered by lmkd.
optional int32 min_oom_score = 10;
+
+ // Free physical memory on device at LMK time.
+ optional int32 free_mem_kb = 11;
+
+ // Free swap on device at LMK time.
+ optional int32 free_swap_kb = 12;
+
+ // What triggered the LMK event.
+ optional Reason reason = 13;
+
+ // Current thrashing levels (workingset_refaults/filecache in %).
+ optional int32 thrashing = 14;
+
+ // Max thrashing levels (workingset_refaults/filecache in %).
+ optional int32 max_thrashing = 15;
}
/*
@@ -4007,7 +4738,7 @@
optional bool is_group_summary = 5;
// The section of the shade that the notification is in.
- // See NotificationSectionsManager.PriorityBucket.
+ // See SystemUI Notifications.proto.
enum NotificationSection {
SECTION_UNKNOWN = 0;
SECTION_HEADS_UP = 1;
@@ -4015,6 +4746,7 @@
SECTION_PEOPLE = 3;
SECTION_ALERTING = 4;
SECTION_SILENT = 5;
+ SECTION_FOREGROUND_SERVICE = 6;
}
optional NotificationSection section = 6;
}
@@ -4055,9 +4787,16 @@
optional android.stats.sysui.NotificationImportance old_importance = 5;
// New importance setting
optional android.stats.sysui.NotificationImportance importance = 6;
+ // whether or not this channel represents a conversation
+ optional bool is_conversation = 7;
+ // Hash of app-assigned notification conversation id
+ optional int32 conversation_id_hash = 8;
+ // whether or not the user demoted this channel out of the conversation space
+ optional bool is_conversation_demoted = 9;
+ // whether this conversation is marked as being a priority
+ optional bool is_conversation_priority = 10;
}
-
/**
* Logs when a biometric acquire event occurs.
*
@@ -4082,6 +4821,8 @@
optional int32 acquire_info_vendor = 7;
// Dictates if this message should trigger additional debugging.
optional bool debug = 8;
+ // The ID of the biometric sensor associated with this action.
+ optional int32 sensor_id = 9;
}
/**
@@ -4120,6 +4861,10 @@
optional int64 latency_millis = 7;
// Dictates if this message should trigger additional debugging.
optional bool debug = 8;
+ // The ID of the biometric sensor associated with this action.
+ optional int32 sensor_id = 9;
+ // The ambient light lux when authenticated.
+ optional float ambient_light_lux = 10;
}
/**
@@ -4149,6 +4894,8 @@
optional bool debug = 8;
// Time spent during the authentication attempt.
optional int64 latency_millis = 9;
+ // The ID of the biometric sensor associated with this action.
+ optional int32 sensor_id = 10;
}
/**
@@ -4163,6 +4910,8 @@
optional android.hardware.biometrics.IssueEnum issue = 2;
// Dictates if this message should trigger additional debugging.
optional bool debug = 3;
+ // The ID of the biometric sensor associated with this action.
+ optional int32 sensor_id = 4;
}
/**
@@ -4180,9 +4929,97 @@
optional int64 latency_millis = 3;
// Whether or not the enrollment was successful.
optional bool success = 4;
+ // The ID of the biometric sensor associated with this action.
+ optional int32 sensor_id = 5;
+ // The ambient light lux when the user enrolled.
+ optional float ambient_light_lux = 6;
}
/*
+ * Logs when one of the BiometricPrompt#authenticate() method variants is called.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/biometrics
+ *
+ */
+ message AuthPromptAuthenticateInvoked {
+ // Whether an explicit CryptoObject was passed to the biometric prompt.
+ optional bool is_crypto = 1;
+ // The value passed to setConfirmationRequired(boolean), or true if not set.
+ optional bool is_confirmation_required = 2;
+ // The value passed to setDeviceCredentialAllowed(boolean), or false if not set.
+ optional bool is_credential_allowed = 3;
+ // Whether a value was passed to setAllowedAuthenticators(int).
+ optional bool is_allowed_authenticators_set = 4;
+ // The value passed to setAllowedAuthenticators(int), if any.
+ optional int32 allowed_authenticators = 5;
+}
+
+/*
+ * Logs when one of the BiometricPrompt#canAuthenticate() method variants is called.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/biometrics
+ *
+ */
+message AuthManagerCanAuthenticateInvoked {
+ // Whether a bit field of allowed authenticator types was provided as an argument.
+ optional bool is_allowed_authenticators_set = 1;
+ // The bit field of allowed authenticator types provided, if any.
+ optional int32 allowed_authenticators = 2;
+ // The authentication status code that was returned.
+ optional int32 result_code = 3;
+}
+
+/*
+ * Logs when Biometric enrollment is requested via the ACTION_BIOMETRIC_ENROLL intent action.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/biometrics
+ *
+ */
+message AuthEnrollActionInvoked {
+ // Whether a Class 3 (strong) biometric was previously enrolled on this device.
+ optional bool is_strong_biometric_enrolled = 1;
+ // Whether a Class 2 (weak) biometric was previously enrolled on this device.
+ optional bool is_weak_biometric_enrolled = 2;
+ // Whether a PIN/pattern/password was previously enrolled on this device.
+ optional bool is_device_credential_enrolled = 3;
+ // Whether a bit field of allowed authenticator types was provided as an extra.
+ optional bool is_allowed_authenticators_set = 4;
+ // The bit field of allowed authenticator types provided, if any.
+ optional int32 allowed_authenticators = 5;
+}
+
+/*
+ * Logs when an application uses a deprecated biometric or authentication API feature.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/biometrics
+ */
+ message AuthDeprecatedAPIUsed {
+ enum APIEnum {
+ API_UNKNOWN = 0;
+ // android.hardware.fingerprint.FingerprintManager#authenticate(CryptoObject,
+ // CancellationSignal, int, AuthenticationCallback, Handler)
+ API_FINGERPRINT_MANAGER_AUTHENTICATE = 1;
+ // android.hardware.fingerprint.FingerprintManager#hasEnrolledFingerprints()
+ API_FINGERPRINT_MANAGER_HAS_ENROLLED_FINGERPRINTS = 2;
+ // android.hardware.fingerprint.FingerprintManager#isHardwareDetected()
+ API_FINGERPRINT_MANAGER_IS_HARDWARE_DETECTED = 3;
+ // android.hardware.biometrics.BiometricManager#canAuthenticate()
+ API_BIOMETRIC_MANAGER_CAN_AUTHENTICATE = 4;
+ }
+
+ // The deprecated API feature that was used.
+ optional APIEnum deprecated_api = 1;
+ // The UID of the application that used the deprecated API.
+ optional int32 app_uid = 2;
+ // The target SDK version (API level) of the application that used the deprecated API.
+ optional int32 target_sdk = 3;
+ }
+
+/*
* Logs when a flag flip update occurrs. Used for mainline modules that update via flag flips.
*/
message FlagFlipUpdateOccurred {
@@ -4248,6 +5085,20 @@
INSTALL_FAILURE_STATE_MISMATCH = 24;
INSTALL_FAILURE_COMMIT = 25;
REBOOT_TRIGGERED = 26;
+ // Logged after INSTALL_REQUESTED for devices installing a train that
+ // contains no module requiring reboot.
+ REBOOT_NOT_REQUIRED = 27;
+ // Logged after INSTALL_REQUESTED for devices that are installing a train
+ // which requires reboot and eligible for soft restart.
+ SOFT_RESTART_ELIGIBLE = 28;
+ // Logged after INSTALL_REQUESTED for devices that are installing a train
+ // which requires reboot and eligible for notification restart.
+ NOTIFICATION_RESTART_ELIGIBLE = 29;
+ // Logged after INSTALL_REQUESTED for devices that are installing a train
+ // which requires reboot and not eligible for any reboot promotion strategy
+ // (e.g. soft restart, notification restart).
+ NO_REBOOT_PROMOTION_STRATEGY_ELIGIBLE = 30;
+ REBOOT_TRIGGER_FAILURE = 31;
}
optional State state = 6;
// Possible experiment ids for monitoring this push.
@@ -4424,15 +5275,12 @@
UNKNOWN = 0;
CHIP_VIEWED = 1;
CHIP_CLICKED = 2;
- DIALOG_PRIVACY_SETTINGS = 3;
+ reserved 3; // Used only in beta builds, never shipped
DIALOG_DISMISS = 4;
DIALOG_LINE_ITEM = 5;
}
optional Type type = 1 [(state_field_option).exclusive_state = true];
-
- // Used if the type is LINE_ITEM
- optional string package_name = 2;
}
/**
@@ -4581,7 +5429,7 @@
// Includes file path and ContentResolver accesses
optional uint32 secondary_storage_accesses = 4;
// Comma-separated list of mime types that were accessed.
- optional MimeTypes mime_types_accessed = 5;
+ optional MimeTypes mime_types_accessed = 5 [(log_mode) = MODE_BYTES];
}
/**
@@ -4933,6 +5781,28 @@
CANCELLED = 7;
};
+ // Status codes correspond to specific failure conditions in
+ // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.cpp
+ //
+ // Keep in sync with
+ // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
+ enum MergeFailureCode {
+ OK = 0;
+ READ_STATUS = 1;
+ GET_TABLE_INFO = 2;
+ UNKNOWN_TABLE = 3;
+ GET_TABLE_PARAMS = 4;
+ ACTIVATE_NEW_TABLE = 5;
+ ACQUIRE_LOCK = 6;
+ LIST_SNAPSHOTS = 7;
+ WRITE_STATUS = 8;
+ UNKNOWN_TARGET_TYPE = 9;
+ QUERY_SNAPSHOT_STATUS = 10;
+ EXPECTED_MERGE_TARGET = 11;
+ UNMERGED_SECTORS_AFTER_COMPLETION = 12;
+ UNEXPECTED_MERGE_STATE = 13;
+ };
+
// Status of the update after the merge attempts.
optional UpdateState final_state = 1;
@@ -4953,6 +5823,32 @@
// containing the dm-snapshot's copy-on-write data generated during a
// Virtual A/B update.
optional int64 cow_file_size_bytes = 5;
+
+ // Whether the device enables Virtual A/B compression.
+ optional bool vab_compression_enabled = 6;
+
+ // Whether this update attempt uses Virtual A/B compression.
+ optional bool vab_compression_used = 7;
+
+ // Total size used by COWs, including /data and the super partition.
+ optional int64 total_cow_size_bytes = 8;
+
+ // Sum of the estimated COW fields in the OTA manifest.
+ optional int64 estimated_cow_size_bytes = 9;
+
+ // Time from boot to sys.boot_completed, in milliseconds.
+ optional int32 boot_complete_time_millis = 10;
+
+ // Time from sys.boot_completed to merge start, in milliseconds.
+ optional int32 boot_complete_to_merge_start_time_millis = 11;
+
+ optional MergeFailureCode merge_failure_code = 12;
+
+ // Build fingerprint at the time the OTA was downloaded.
+ optional string source_build_fingerprint = 13;
+
+ // Build fingerprint at the time the merge was initiated.
+ optional string target_build_fingerprint = 14;
}
/**
@@ -5047,6 +5943,100 @@
optional Result result = 4;
}
+/**
+ * Event to track Jank for various system interactions.
+ *
+ * Logged from:
+ * frameworks/base/core/java/com/android/internal/jank/FrameTracker.java
+ *
+ * Next Tag: 31
+ */
+message UIInteractionFrameInfoReported {
+ enum InteractionType {
+ UNKNOWN = 0;
+ NOTIFICATION_SHADE_SWIPE = 1;
+ SHADE_EXPAND_COLLAPSE_LOCK = 2;
+ SHADE_SCROLL_FLING = 3;
+ SHADE_ROW_EXPAND = 4;
+ SHADE_ROW_SWIPE = 5;
+ SHADE_QS_EXPAND_COLLAPSE = 6;
+ SHADE_QS_SCROLL_SWIPE = 7;
+ LAUNCHER_APP_LAUNCH_FROM_RECENTS = 8;
+ LAUNCHER_APP_LAUNCH_FROM_ICON = 9;
+ LAUNCHER_APP_CLOSE_TO_HOME = 10;
+ LAUNCHER_APP_CLOSE_TO_PIP = 11;
+ LAUNCHER_QUICK_SWITCH = 12;
+ SHADE_HEADS_UP_APPEAR = 13;
+ SHADE_HEADS_UP_DISAPPEAR = 14;
+ SHADE_NOTIFICATION_ADD = 15;
+ SHADE_NOTIFICATION_REMOVE = 16;
+ SHADE_APP_LAUNCH = 17;
+ LOCKSCREEN_PASSWORD_APPEAR = 18;
+ LOCKSCREEN_PATTERN_APPEAR = 19;
+ LOCKSCREEN_PIN_APPEAR = 20;
+ LOCKSCREEN_PASSWORD_DISAPPEAR = 21;
+ LOCKSCREEN_PATTERN_DISAPPEAR = 22;
+ LOCKSCREEN_PIN_DISAPPEAR = 23;
+ LOCKSCREEN_TRANSITION_FROM_AOD = 24;
+ LOCKSCREEN_TRANSITION_TO_AOD = 25;
+ LAUNCHER_OPEN_ALL_APPS = 26;
+ LAUNCHER_ALL_APPS_SCROLL = 27;
+ LAUNCHER_APP_LAUNCH_FROM_WIDGET = 28;
+ SETTINGS_PAGE_SCROLL = 29;
+ LOCKSCREEN_UNLOCK_ANIMATION = 30;
+ SHADE_APP_LAUNCH_FROM_HISTORY_BUTTON = 31;
+ SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER = 32;
+ SHADE_APP_LAUNCH_FROM_QS_TILE = 33;
+ SHADE_APP_LAUNCH_FROM_SETTINGS_BUTTON = 34;
+ STATUS_BAR_APP_LAUNCH_FROM_CALL_CHIP = 35;
+ }
+
+ optional InteractionType interaction_type = 1;
+
+ // Number of frames rendered during the interaction.
+ optional int64 total_frames = 2;
+
+ // Number of frames that were skipped in rendering during the interaction.
+ optional int64 missed_frames = 3;
+
+ // Number of frames that were missed in Surface Flinger during the interaction.
+ optional int64 sf_missed_frames = 5;
+
+ // Number of frames that were missed in the app during the interaction.
+ optional int64 app_missed_frames = 6;
+
+ // Maximum time it took to render a single frame during the interaction.
+ optional int64 max_frame_time_nanos = 4;
+}
+
+/**
+ * Event to track various latencies in SystemUI.
+ *
+ * Logged from:
+ * frameworks/base/core/java/com/android/internal/util/LatencyTracker.java
+ */
+message UIActionLatencyReported {
+ enum ActionType {
+ UNKNOWN = 0;
+ ACTION_EXPAND_PANEL = 1;
+ ACTION_TOGGLE_RECENTS = 2;
+ ACTION_FINGERPRINT_WAKE_AND_UNLOCK = 3;
+ ACTION_CHECK_CREDENTIAL = 4;
+ ACTION_CHECK_CREDENTIAL_UNLOCKED = 5;
+ ACTION_TURN_ON_SCREEN = 6;
+ ACTION_ROTATE_SCREEN = 7;
+ ACTION_FACE_WAKE_AND_UNLOCK = 8;
+ ACTION_START_RECENTS_ANIMATION = 9;
+ ACTION_ROTATE_SCREEN_CAMERA_CHECK = 10;
+ ACTION_ROTATE_SCREEN_SENSOR = 11;
+ ACTION_LOCKSCREEN_UNLOCK = 12;
+ }
+
+ optional ActionType action = 1;
+
+ optional int64 latency_millis = 2;
+}
+
//////////////////////////////////////////////////////////////////////
// Pulled atoms below this line //
//////////////////////////////////////////////////////////////////////
@@ -5191,6 +6181,39 @@
}
/**
+ * Pulls bytes transferred via OEM managed networks. Data is split up by which
+ * type of OEM managed network it is, what transport it went over, and if it was
+ * in the foreground or background.
+ *
+ * Pulled from:
+ * StatsPullAtomService
+ */
+ message OemManagedBytesTransfer {
+ optional int32 uid = 1 [(is_uid) = true];
+
+ // 1 denotes foreground and 0 denotes background. This is called Set in
+ // NetworkStats.
+ optional bool is_foreground = 2;
+
+ // Corresponds to the type of OEM managed network, see
+ // {@link NetworkTemplate#OEM_MANAGED_ANY} and {@code NetworkIdentity#OEM_*}.
+ optional int32 oem_managed_type = 3;
+
+ // Corresponds to the type of transport the bytes were transferred over, see
+ // {@link NetworkTemplate#transportToMatchRule} and
+ // {@code NetworkCapabilities#TRANSPORT_*}
+ optional int32 transport_type = 4;
+
+ optional int64 rx_bytes = 5;
+
+ optional int64 rx_packets = 6;
+
+ optional int64 tx_bytes = 7;
+
+ optional int64 tx_packets = 8;
+ }
+
+/**
* Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
*
* Pulled from:
@@ -5222,15 +6245,9 @@
}
/**
- * Pulls low power state information. If power.stats HAL is not available, this
- * includes platform and subsystem sleep state information,
- * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState
- * as defined in:
- * hardware/interfaces/power/1.0/types.hal
- * hardware/interfaces/power/1.1/types.hal
- * If power.stats HAL is available, this includes PowerEntityStateResidencyResult
- * as defined in:
- * hardware/interfaces/power/stats/1.0/types.hal
+ * Pulls power state information.
+ * Pulled from:
+ * frameworks/base/services/core/java/com/android/server/powerstats/StatsPullAtomCallbackImpl.java
*/
message SubsystemSleepState {
// Subsystem name
@@ -5248,9 +6265,8 @@
/**
* Pulls on-device power measurement information.
- * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
* Pulled from:
- * frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
+ * frameworks/base/services/core/java/com/android/server/powerstats/StatsPullAtomCallbackImpl.java
*/
message OnDevicePowerMeasurement {
// Name of the subsystem (to which the rail belongs).
@@ -5268,15 +6284,13 @@
}
/**
- * Pulls Cpu time per frequency.
- * Pulls the time the cpu spend on the frequency index. Frequency index
- * starts from highest to lowest. The value should be monotonically
- * increasing since boot. However, if there is a cpu
- * hotplug event, the value would be reset as well.
+ * Pulls Cpu time per cluster per frequency.
+ * This is tracked by the time_in_state eBPF program.
*/
-message CpuTimePerFreq {
+message CpuTimePerClusterFreq {
optional uint32 cluster = 1;
- optional uint32 freq_index = 2;
+ optional uint32 freq_khz = 2;
+ // Time spent at this frequency excluding sleep since tracking started.
optional uint64 time_millis = 3;
}
@@ -5291,9 +6305,29 @@
}
/**
+ * Pulls Cpu Cycles Per Uid Per Cluster.
+ * Note that uids are transformed to reduce the number of uploaded entries. Shared GIDs are
+ * combined under single uid LAST_SHARED_APPLICATION_GID. Individual isolated uids are excluded
+ * because they are recycled and removed from the underlying data source. All uids are normalized
+ * to their base uids.
+ */
+message CpuCyclesPerUidCluster {
+ optional int32 uid = 1 [(is_uid) = true];
+ optional int32 cluster = 2;
+ // Megacycles, i.e. millions of cycles.
+ optional int64 mcycles = 3;
+ // Time excluding sleep since tracking started.
+ optional int64 time_millis = 4;
+ // Power estimate: time * average power for frequency / 1000.
+ optional int64 power_profile_estimate = 5;
+}
+
+/**
* Pulls Cpu Time Per Uid per frequency.
- * Note that isolated process uid time should be attributed to host uids.
- * For each uid, we order the time by descending frequencies.
+ * Note that uids are transformed to reduce the number of uploaded entries. Shared GIDs are
+ * combined under single uid LAST_SHARED_APPLICATION_GID. Individual isolated uids are excluded
+ * because they are recycled and removed from the underlying data source. All uids are normalized
+ * to their base uids.
*/
message CpuTimePerUidFreq {
optional int32 uid = 1 [(is_uid) = true];
@@ -5302,6 +6336,33 @@
}
/**
+ * Pulls Cpu Cycles Per ThreadGroup Per Cluster.
+ * This is tracked by the time_in_state eBPF program.
+ */
+message CpuCyclesPerThreadGroupCluster {
+ enum ThreadGroup {
+ UNKNOWN_THREAD_GROUP = 0;
+
+ // System server threads serving Binder calls.
+ SYSTEM_SERVER_BINDER = 1;
+
+ // All system server threads.
+ SYSTEM_SERVER = 2;
+
+ // All surface flinger threads.
+ SURFACE_FLINGER = 3;
+ }
+ optional ThreadGroup thread_group = 1;
+
+ optional int32 cluster = 2;
+
+ // Megacycles, i.e. millions of cycles.
+ optional int64 mcycles = 3;
+ // Time excluding sleep since tracking started.
+ optional int64 time_millis = 4;
+}
+
+/**
* Pulls Wifi Controller Activity Energy Info
*/
message WifiActivityInfo {
@@ -6171,7 +7232,7 @@
* Pulled from ProcessStatsService.java
*/
message ProcStats {
- optional ProcessStatsSectionProto proc_stats_section = 1;
+ optional ProcessStatsSectionProto proc_stats_section = 1 [(log_mode) = MODE_BYTES];
// Data pulled from device into this is sometimes sharded across multiple atoms to work around
// a size limit. When this happens, this shard ID will contain an increasing 1-indexed integer
// with the number of this shard.
@@ -6182,7 +7243,7 @@
* Pulled from ProcessStatsService.java
*/
message ProcStatsPkgProc {
- optional ProcessStatsSectionProto proc_stats_section = 1;
+ optional ProcessStatsSectionProto proc_stats_section = 1 [(log_mode) = MODE_BYTES];
}
// Next Tag: 2
@@ -6200,7 +7261,7 @@
* Pulled from NotificationManagerService.java
*/
message NotificationRemoteViews {
- optional NotificationRemoteViewsProto notification_remote_views = 1;
+ optional NotificationRemoteViewsProto notification_remote_views = 1 [(log_mode) = MODE_BYTES];
}
/**
@@ -6268,7 +7329,7 @@
// May also be "MANUAL_RULE" to indicate app-activation of the manual rule.
optional string id = 5;
optional int32 uid = 6 [(is_uid) = true]; // currently only SYSTEM_UID or 0 for other
- optional DNDPolicyProto policy = 7;
+ optional DNDPolicyProto policy = 7 [(log_mode) = MODE_BYTES];
}
/**
@@ -6433,7 +7494,7 @@
* Pulled from PowerProfile.java
*/
message PowerProfile {
- optional PowerProfileProto power_profile = 1;
+ optional PowerProfileProto power_profile = 1 [(log_mode) = MODE_BYTES];
}
/**
@@ -6702,6 +7763,104 @@
optional int64 power_nano_amp_secs = 2;
}
+// Keep in sync with frameworks/base/core/proto/android/os/batteryusagestats.proto
+/**
+ * Represents a device's BatteryUsageStats, with power usage information about the device
+ * and each app.
+ */
+message BatteryUsageStatsAtomsProto {
+
+ // The session start timestamp in UTC milliseconds since January 1, 1970, per Date#getTime().
+ // All data is no older than this time.
+ optional int64 session_start_millis = 1;
+
+ // The session end timestamp in UTC milliseconds since January 1, 1970, per Date#getTime().
+ // All data is no more recent than this time.
+ optional int64 session_end_millis = 2;
+
+ // Length that the reported data covered. This usually will be equal to the entire session,
+ // session_end_millis - session_start_millis, but may not be if some data during this time frame
+ // is missing.
+ optional int64 session_duration_millis = 3;
+
+ // Represents usage of a consumer, storing all of its power component usage.
+ message BatteryConsumerData {
+ // Total power consumed by this BatteryConsumer (including all of its PowerComponents).
+ // May not equal the sum of the PowerComponentUsage due to under- or over-estimations.
+ // Multiply by 1/36 to obtain mAh.
+ optional int64 total_consumed_power_deci_coulombs = 1;
+
+ // Represents power and time usage of a particular power component.
+ message PowerComponentUsage {
+ // Holds android.os.PowerComponentEnum, or custom component value between 1000 and 9999.
+ // Evidently, if one attempts to write an int to an enum field that is out of range, it
+ // is treated as 0, so we must make this an int32.
+ optional int32 component = 1;
+
+ // Power consumed by this component. Multiply by 1/36 to obtain mAh.
+ optional int64 power_deci_coulombs = 2;
+
+ optional int64 duration_millis = 3;
+ }
+ repeated PowerComponentUsage power_components = 2;
+ }
+
+ // Total power usage for the device during this session.
+ optional BatteryConsumerData device_battery_consumer = 4;
+
+ // Power usage by a uid during this session.
+ message UidBatteryConsumer {
+ optional int32 uid = 1 [(is_uid) = true];
+ optional BatteryConsumerData battery_consumer_data = 2;
+ optional int64 time_in_foreground_millis = 3;
+ optional int64 time_in_background_millis = 4;
+ }
+ repeated UidBatteryConsumer uid_battery_consumers = 5;
+
+ // Sum of all discharge percentage point drops during the reported session.
+ optional int32 session_discharge_percentage = 6;
+}
+
+/**
+ * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
+ * using the best data available.
+ *
+ * Includes the data since the last time statsd pulled this atom (i.e. since the
+ * last-BatteryStats-reset-prior-to-last-statsd-pull) until the most recent BatteryStats reset.
+ *
+ * Does NOT include data after the most recent reset (use BatteryUsageStatsSinceReset too for that).
+ *
+ * Pulled from BatteryManager.getBatteryUsageStats().
+ */
+message BatteryUsageStatsBeforeReset {
+ optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
+}
+
+/**
+ * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
+ * using the best data available.
+ *
+ * Includes all data since the most recent BatteryStats reset event, but none prior to it.
+ *
+ * Pulled from BatteryManager.getBatteryUsageStats().
+ */
+message BatteryUsageStatsSinceReset {
+ optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
+}
+
+/**
+ * Pulls on-device BatteryStats on-battery power use calculations, in the form of BatteryUsageStats,
+ * using only PowerProfile Model data (even if better data is available).
+ *
+ * Includes all data since the most recent BatteryStats reset event, but none prior to it.
+ *
+ * @see android.os.BatteryUsageStatsQuery#FLAG_BATTERY_USAGE_STATS_POWER_PROFILE_MODEL
+ * Pulled from BatteryManager.getBatteryUsageStats().
+ */
+message BatteryUsageStatsSinceResetUsingPowerProfileModel {
+ optional BatteryUsageStatsAtomsProto battery_usage_stats = 1 [(log_mode) = MODE_BYTES];
+}
+
/**
* Logs device policy features.
*
@@ -7171,6 +8330,22 @@
}
/**
+ * Logs Neighbor Unreachability Detection event
+ * Logged from:
+ * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpReachabilityMonitorMetrics.java
+ */
+message NetworkIpReachabilityMonitorReported {
+ // Neighbor Unreachability Detection event.
+ optional android.stats.connectivity.NudEventType event_type = 1;
+
+ // NUD probe based on IPv4 ARP or IPv6 ND packet.
+ optional android.stats.connectivity.IpType ip_type = 2;
+
+ // NUD neighbor type, default gateway, DNS server or both.
+ optional android.stats.connectivity.NudNeighborType neighbor_type = 3;
+}
+
+/**
* Logs when a data stall event occurs.
*
* Log from:
@@ -7184,7 +8359,7 @@
// See definition in data_stall_event.proto.
optional com.android.server.connectivity.ProbeResult validation_result = 2;
// See definition in data_stall_event.proto.
- optional android.net.NetworkCapabilitiesProto.Transport network_type = 3;
+ optional android.net.Transport network_type = 3;
// See definition in data_stall_event.proto.
optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
// See definition in data_stall_event.proto.
@@ -7667,7 +8842,7 @@
*/
message UsbContaminantReported {
optional string id = 1;
- optional android.service.usb.ContaminantPresenceStatus status = 2;
+ optional android.service.ContaminantPresenceStatus status = 2;
}
/**
@@ -7876,7 +9051,10 @@
}
/**
- * Track Media Codec usage
+ * Track Media Codec usage (nested proto version)
+ * This atom is being deprecated in favor of MediaCodecReported which has a
+ * flattened CodecData to enable field filtering. The data is identical
+ * except MediaCodecReported also has the playback_duration field.
* Logged from:
* frameworks/av/media/libstagefright/MediaCodec.cpp
* frameworks/av/services/mediaanalytics/statsd_codec.cpp
@@ -7887,7 +9065,85 @@
optional int64 package_version_code = 3;
optional int64 media_apex_version = 4;
- optional android.stats.mediametrics.CodecData codec_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+ optional android.stats.mediametrics_message.CodecData codec_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+}
+
+/**
+ * Track Media Codec usage
+ * This atom is the new version of MediametricsCodecReported and has a
+ * flattened CodecData to enable field filtering. The data is identical
+ * except for the addition of the playback_duration field.
+ * Logged from:
+ * frameworks/av/media/libstagefright/MediaCodec.cpp
+ * frameworks/av/services/mediaanalytics/statsd_codec.cpp
+ */
+message MediaCodecReported {
+ optional int64 timestamp_nanos = 1;
+ // The inclusion of package name in a metric should be carefully analyzed to
+ // determine if it is absolutely necessary for system health. It is strongly
+ // discouraged to collect the package name along with other metrics (e.g.
+ // playback duration).
+ optional string package_name = 2;
+ optional int64 package_version_code = 3;
+ optional int64 media_apex_version = 4;
+ optional string codec = 5;
+ optional string mime = 6;
+ optional string mode = 7;
+ optional int32 encoder = 8;
+ optional int32 secure = 9;
+ optional int32 width = 10;
+ optional int32 height = 11;
+ optional int32 rotation = 12;
+ optional int32 crypto = 13;
+ optional int32 profile = 14;
+ optional int32 level = 15;
+ optional int32 max_width = 16;
+ optional int32 max_height = 17;
+ optional int32 error_code = 18;
+ optional string error_state = 19;
+ optional int64 latency_max = 20;
+ optional int64 latency_min = 21;
+ optional int64 latency_avg = 22;
+ optional int64 latency_count = 23;
+ optional int64 latency_unknown = 24;
+ optional int32 queue_input_buffer_error = 25;
+ optional int32 queue_secure_input_buffer_error = 26;
+ optional string bitrate_mode = 27;
+ optional int32 bitrate = 28;
+ optional int64 lifetime_millis = 29;
+ optional int64 playback_duration_seconds = 30;
+ optional string log_session_id = 31;
+ optional int32 channel_count = 32;
+ optional int32 sample_rate = 33;
+ optional int64 video_encode_bytes = 34;
+ optional int64 video_encode_frames = 35;
+ optional int64 video_input_bytes = 36;
+ optional int64 video_input_frames = 37;
+ optional int64 video_encode_duration_us = 38;
+ optional int32 color_format = 39;
+ optional float frame_rate = 40;
+ optional float capture_rate = 41;
+ optional float operating_rate = 42;
+ optional int32 priority = 43;
+ optional int32 video_qp_i_min = 44;
+ optional int32 video_qp_i_max = 45;
+ optional int32 video_qp_p_min = 46;
+ optional int32 video_qp_p_max = 47;
+ optional int32 video_qp_b_min = 48;
+ optional int32 video_qp_b_max = 49;
+ optional int32 original_bitrate = 50;
+ optional int32 shaping_enhanced = 51;
+ optional int32 original_video_qp_i_min = 52;
+ optional int32 original_video_qp_i_max = 53;
+ optional int32 original_video_qp_p_min = 54;
+ optional int32 original_video_qp_p_max = 55;
+ optional int32 original_video_qp_b_min = 56;
+ optional int32 original_video_qp_b_max = 57;
+ // !!! WARNING
+ // Keep synchronized with MediametricsCodecReported.CodecData in
+ // mediametrics_message.proto.
+ // Also keep AStatsEvent serialization synchronized in statsd_codec.cpp
+ // !!! WARNING
}
/**
@@ -7902,7 +9158,7 @@
optional int64 package_version_code = 3;
optional int64 media_apex_version = 4;
- optional android.stats.mediametrics.ExtractorData extractor_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+ optional android.stats.mediametrics_message.ExtractorData extractor_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}
/**
@@ -7969,6 +9225,10 @@
* The video height in pixels, or -1 if unknown or not applicable.
*/
optional int32 video_height = 14;
+ /**
+ * Session id for correlating playback metrics.
+ */
+ optional string log_session_id = 15;
}
/**
@@ -7983,7 +9243,7 @@
optional int64 package_version_code = 3;
optional int64 media_apex_version = 4;
- optional android.stats.mediametrics.AudioPolicyData audiopolicy_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+ optional android.stats.mediametrics_message.AudioPolicyData audiopolicy_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}
/**
@@ -7998,7 +9258,12 @@
optional int64 package_version_code = 3;
optional int64 media_apex_version = 4;
- optional android.stats.mediametrics.AudioRecordData audiorecord_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+ optional android.stats.mediametrics_message.AudioRecordData audiorecord_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+
+ // Android S
+ // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
+ // An empty string means no session id is set.
+ optional string log_session_id = 6;
}
/**
@@ -8013,7 +9278,7 @@
optional int64 package_version_code = 3;
optional int64 media_apex_version = 4;
- optional android.stats.mediametrics.AudioThreadData audiothread_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+ optional android.stats.mediametrics_message.AudioThreadData audiothread_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}
/**
@@ -8028,7 +9293,12 @@
optional int64 package_version_code = 3;
optional int64 media_apex_version = 4;
- optional android.stats.mediametrics.AudioTrackData audiotrack_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+ optional android.stats.mediametrics_message.AudioTrackData audiotrack_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+
+ // Android S
+ // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
+ // An empty string means no session id is set.
+ optional string log_session_id = 6;
}
/**
@@ -8055,6 +9325,9 @@
* Logged from
* vendor/widevine/libwvdrmengine/cdm/metrics
* frameworks/av/services/mediaanalytics/statsd_drm.cpp
+ *
+ * TODO b/182382094 -remove after migrated mediadrm metrics
+ * reporting to statsd.
*/
message MediametricsDrmWidevineReported {
optional int64 timestamp_nanos = 1;
@@ -8077,7 +9350,7 @@
optional int64 package_version_code = 3;
optional int64 media_apex_version = 4;
- optional android.stats.mediametrics.RecorderData recorder_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+ optional android.stats.mediametrics_message.RecorderData recorder_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}
/**
@@ -8092,7 +9365,7 @@
optional int64 package_version_code = 3;
optional int64 media_apex_version = 4;
- optional android.stats.mediametrics.NuPlayerData nuplayer_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+ optional android.stats.mediametrics_message.NuPlayerData nuplayer_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}
/**
@@ -8145,7 +9418,7 @@
}
/**
- * State of a dangerous permission requested by a package
+ * State of a all permission requested by a all package
* Pulled from: StatsCompanionService
*/
message DangerousPermissionState {
@@ -8163,6 +9436,9 @@
// Permission flags as per android.content.pm.PermissionFlags
optional int32 permission_flags = 5;
+
+ // Permission protection flags as per android.content.pm.PermissionInfo.ProtectionFlags
+ optional int32 protection_flags = 6;
}
/**
@@ -8194,7 +9470,7 @@
message TrainInfo {
optional int64 train_version_code = 1;
- optional TrainExperimentIds train_experiment_id = 2;
+ optional TrainExperimentIds train_experiment_id = 2 [(log_mode) = MODE_BYTES];
optional string train_name = 3;
@@ -8413,6 +9689,83 @@
optional int32 max_size_in_kilobytes = 5;
}
+/*
+ * Logs system-wide (primarily kernel) memory stats. Sourced from
+ * /proc/meminfo unless explicitly stated otherwise.
+ *
+ * Pulled from StatsCompanionService.
+ */
+message SystemMemory {
+ // /proc/meminfo SUnreclaim
+ optional int32 unreclaimable_slab_kb = 1;
+
+ // /proc/meminfo VmallocUsed
+ optional int32 vmalloc_used_kb = 2;
+
+ // /proc/meminfo PageTables
+ optional int32 page_tables_kb = 3;
+
+ // /proc/meminfo KernelStack
+ optional int32 kernel_stack_kb = 4;
+
+ // Total unreclaimable ion.
+ // Reported from os.Debug.getIonHeapsSizeKb (R+)
+ optional int32 total_ion_kb = 5;
+
+ // Measures for the amount of memory we could not account for.
+ // Essentially points to kernel allocations (as all userspace allocs are
+ // already tracked).
+ // Device-specific.
+ optional int32 unaccounted_kb = 6;
+
+ // GPU kernel driver allocations.
+ // Can overlap with ion memory.
+ // Reported from os.Debug.getGpuTotalUsageKb (S+)
+ optional int32 gpu_total_usage_kb = 7;
+
+ // GPU kernel driver private allocations.
+ // Does not overlap with ion memory
+ // Computed as total usage - Debug.getGpuDmaBufUsageKb()
+ // Only available on supported kernel versions (5.4+)
+ optional int32 gpu_private_usage_kb = 8;
+
+ // Total DMABUF memory allocations
+ // Reported from os.Debug.getDmabufTotalExportedKb (S+)
+ optional int32 dmabuf_total_exported_kb = 9;
+}
+
+/*
+ * Log dmabuf memory retained by userspace processes.
+ * Pulled from StatsPullAtomService.
+ */
+ message ProcessDmabufMemory {
+ // The uid if available. -1 means not available.
+ optional int32 uid = 1 [(is_uid) = true];
+
+ // The process name (from ActivityManager).
+ optional string process_name = 2;
+
+ // OOM adj score.
+ optional int32 oom_adj_score = 3;
+
+ // Size of dmabufs retained by the process. The buffers are either mapped,
+ // retained via an fd, or both.
+ // Only available on supported kernel versions (5.4+). When unavailable, set
+ // to -1.
+ optional int32 retained_dmabuf_kb = 4;
+
+ // Number of buffers retained by the process (mapped / fd).
+ // Only available on supported kernel versions (5.4+). When unavailable, set
+ // to -1.
+ optional int32 retained_dmabuf_count = 5;
+
+ // Size of dmabufs mapped to the process address space.
+ optional int32 mapped_dmabuf_kb = 6;
+
+ // Number of dmabufs mapped to the process address space.
+ optional int32 mapped_dmabuf_count = 7;
+}
+
/**
* Push network stack events.
*
@@ -8906,6 +10259,9 @@
// Activity Importance of API caller.
// Categorized to 3 types that are interesting from location's perspective.
optional android.stats.location.ActivityImportance activiy_importance = 12;
+
+ // Attribution tag passed to this API.
+ optional string attribution_tag = 13;
}
/**
@@ -8966,6 +10322,13 @@
// id which identifies single session of user interacting with permission controller
optional int64 session_id = 6;
+
+ // Target SDK of the package
+ optional int32 target_sdk = 7;
+
+ // Selected precision of the location permission - bit flags indicate which
+ // locations were chosen
+ optional int32 selected_precision = 8;
}
/**
@@ -9036,6 +10399,10 @@
ALLOW_FOREGROUND = 5;
// Same is Deny button but shown in while in use dialog
DENY_FOREGROUND = 6;
+ // Switch button set to ON for location accuracy
+ GRANT_FINE_LOCATION = 7;
+ // Switch button set to OFF for location accuracy
+ REVOKE_FINE_LOCATION = 8;
}
// Button pressed in the dialog
@@ -9413,6 +10780,12 @@
// Free space available in the super partition.
optional int64 super_free_space_bytes = 11;
+
+ // Whether the device enables Virtual A/B compression.
+ optional bool vab_compression_enabled = 12;
+
+ // Whether this update attempt uses Virtual A/B compression.
+ optional bool vab_compression_used = 13;
}
/**
@@ -9444,6 +10817,583 @@
// The number of reboot of the device during a successful update.
optional int32 reboot_count = 7;
+
+ // Whether on device verity computation is enabled
+ optional bool fec_enabled = 8;
+
+ // Whether on device hash tree computation is enabled
+ optional bool hash_tree_enabled = 9;
+
+}
+
+/**
+ * Reported when a client requests to prepare for resume on reboot.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
+ */
+message RebootEscrowPreparationReported {
+ enum Result {
+ ROR_NEED_PREPARATION = 0;
+ ROR_SKIP_PREPARATION_AND_NOTIFY = 1;
+ ROR_SKIP_PREPARATION_NOT_NOTIFY = 2;
+ }
+
+ // The uid of the client who requests ror.
+ optional int32 requesting_uid = 1 [(is_uid) = true];
+
+ optional Result result = 2;
+
+ // The number of clients who has requested ror, including the current caller.
+ optional int32 requested_client_count = 3;
+}
+
+/**
+ * Reported when the lock screen knowledge factor is captured, while there are clients of
+ * resume on reboot to notify.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
+ */
+message RebootEscrowLskfCaptureReported {
+ // The uid of the client to notify about the Lskf capture.
+ optional int32 uid_to_notify = 1 [(is_uid) = true];
+
+ // The total number of clients who have requested ror.
+ optional int32 requested_client_count = 2;
+
+ // The duration between RoR request - current LSKF capture event.
+ optional int32 duration_ror_requested_to_lskf_captured_seconds = 3;
+}
+
+/* Reported when a client (e.g. gmscore) requests to reboot with Resume on Reboot.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/recoverysystem/RecoverySystemService.java
+ */
+message RebootEscrowRebootReported {
+ optional int32 error_code = 1;
+
+ // The uid of clients who requested the reboot
+ optional int32 request_uid = 2 [(is_uid) = true];
+
+ // All clients that have prepared for RoR before this reboot
+ optional int32 prepared_clients_count = 3;
+
+ // The RoR request count for the client who requests reboot.
+ optional int32 request_count = 4;
+
+ // Whether the reboot request assumes a slot switch on a/b devices.
+ optional bool slot_switch = 5;
+
+ // True if the DeviceConfig shows the device is using server based RoR.
+ optional bool server_based = 6;
+
+ // The duration between last LSKF captured - reboot requests
+ optional int32 duration_lskf_captured_to_reboot_seconds = 7;
+
+ // The count of LSKF captured since preparation
+ optional int32 lskf_captured_counts = 8;
+}
+
+/**
+ * Logs stats for AppSearch function calls
+ */
+message AppSearchCallStatsReported {
+ // The sampling interval for this specific type of stats
+ // For example, sampling_interval=10 means that one out of every 10 stats was logged.
+ optional int32 sampling_interval = 1;
+
+ // # of previous skipped sample for this specific type of stats
+ // We can't push atoms too closely, so some samples might be skipped
+ // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
+ // For example, the true count of an event could be estimated as:
+ // SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
+ optional int32 num_skipped_sample = 2;
+
+ // Package UID of the application.
+ optional int32 uid = 3 [(is_uid) = true];
+
+ // Hash of the database name within AppSearch
+ optional int32 database = 4;
+
+ // The status code for the call or internal state.
+ // Needs to be sync with AppSearchResult#ResultCode in
+ // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
+ optional int32 status_code = 5;
+
+ // Overall time used for the end-to-end function call in AppSearch.
+ // It doesn't include binder latency
+ optional int32 total_latency_millis = 6;
+
+ // Type of the function call value is in sync with
+ // frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/stats/CallStats.java
+ optional int32 call_type = 7;
+
+ // Estimated binder latency (estimated as single-trip time * 2)
+ optional int32 estimated_binder_latency_millis = 8;
+
+ // Number of operations succeeded for batch operations.
+ optional int32 num_operations_succeeded = 9;
+
+ // Number of operations failed for batch operations.
+ optional int32 num_operations_failed = 10;
+}
+
+/**
+ * Logs detailed stats for putting a single document in AppSearch
+ */
+message AppSearchPutDocumentStatsReported {
+ // The sampling interval for this specific type of stats
+ // For example, sampling_interval=10 means that one out of every 10 stats was logged.
+ optional int32 sampling_interval = 1;
+
+ // # of previous skipped sample for this specific type of stats
+ // We can't push atoms too closely, so some samples might be skipped
+ // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
+ // For example, the true count of an event could be estimated as:
+ // SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
+ optional int32 num_skipped_sample = 2;
+
+ // Package UID of the application.
+ optional int32 uid = 3 [(is_uid) = true];
+
+ // Hash of the database name within AppSearch
+ optional int32 database = 4;
+
+ // Needs to be sync with AppSearchResult#ResultCode in
+ // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
+ optional int32 status_code = 5;
+
+ // Overall time used for a put_document
+ optional int32 total_latency_millis = 6;
+
+ // Time used to generate a document proto from a Bundle.
+ optional int32 generate_document_proto_latency_millis = 7;
+
+ // Time used to rewrite types and namespaces in the document.
+ optional int32 rewrite_document_types_latency_millis = 8;
+
+ // Overall time used for the native function call.
+ optional int32 native_latency_millis = 9;
+
+ // Time used to store the document.
+ optional int32 native_document_store_latency_millis = 10;
+
+ // Time used to index the document. It doesn't include the time to
+ // merge indices.
+ optional int32 native_index_latency_millis = 11;
+
+ // Time used to merge the indices.
+ optional int32 native_index_merge_latency_millis = 12;
+
+ // Document size in bytes.
+ optional int32 native_document_size_bytes = 13;
+
+ // Number of tokens added to the index.
+ optional int32 native_num_tokens_indexed = 14;
+
+ // Whether the max number of tokens exceeded.
+ optional bool native_exceeded_max_num_tokens = 15;
+}
+
+/**
+ * Logs detailed stats for AppSearch Initialize
+ */
+message AppSearchInitializeStatsReported {
+ // The sampling interval for this specific type of stats
+ // For example, sampling_interval=10 means that one out of every 10 stats was logged.
+ optional int32 sampling_interval = 1;
+
+ // # of previous skipped sample for this specific type of stats
+ // We can't push atoms too closely, so some samples might be skipped
+ // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
+ // For example, the true count of an event could be estimated as:
+ // SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
+ optional int32 num_skipped_sample = 2;
+
+ // Package UID of the application.
+ optional int32 uid = 3 [(is_uid) = true];
+
+ // Initialize status code
+ // Needs to be sync with AppSearchResult#ResultCode in
+ // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
+ optional int32 status_code = 4;
+
+ // Overall time used for initialization, not including binder latency.
+ optional int32 total_latency_millis = 5;
+
+ // Whether the initialize() detects desyncs.
+ // Desync happens if we lose the visibility doc.
+ optional bool has_desync = 6;
+
+ // Time used to read and process the schema and namespaces.
+ optional int32 prepare_schema_and_namespaces_latency_millis = 7;
+
+ // Time used to read and process the visibility file.
+ optional int32 prepare_visibility_file_latency_millis = 8;
+
+ // Overall time used for the native function call.
+ optional int32 native_latency_millis = 9;
+
+ // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
+ optional int32 native_document_store_recovery_cause = 10;
+
+ // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
+ optional int32 native_index_restoration_cause = 11;
+
+ // Needs to be sync with RecoveryCause in google3/third_party/icing/proto/logging.proto
+ optional int32 native_schema_store_recovery_cause = 12;
+
+ // Time used to recover the document store.
+ optional int32 native_document_store_recovery_latency_millis = 13;
+
+ // Time used to restore the index.
+ optional int32 native_index_restoration_latency_millis = 14;
+
+ // Time used to recover the schema store.
+ optional int32 native_schema_store_recovery_latency_millis = 15;
+
+ // Needs to be sync with DocumentStoreDataStatus in google3/third_party/icing/proto/logging.proto
+ optional int32 native_document_store_data_status = 16;
+
+ // Number of documents currently in document store. Those may
+ // include alive, deleted, and expired documents.
+ optional int32 native_num_documents = 17;
+
+ // Number of schema types currently in the schema store.
+ optional int32 native_num_schema_types = 18;
+
+ // Whether we had to reset the index, losing all data, during initialization.
+ optional bool has_reset = 19;
+
+ // The status code of the reset operation if has_reset is true.
+ // Needs to be sync with AppSearchResult#ResultCode in
+ // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
+ optional int32 reset_status_code = 20;
+}
+
+/**
+ * Logs detailed stats for querying in AppSearch
+ */
+message AppSearchQueryStatsReported {
+ // The sampling interval for this specific type of stats
+ // For example, sampling_interval=10 means that one out of every 10 stats was logged.
+ optional int32 sampling_interval = 1;
+
+ // # of previous skipped sample for this specific type of stats
+ // We can't push atoms too closely, so some samples might be skipped
+ // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
+ // For example, the true count of an event could be estimated as:
+ // SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
+ optional int32 num_skipped_sample = 2;
+
+ // Package UID of the application.
+ optional int32 uid = 3 [(is_uid) = true];
+
+ // Hash of the database name within AppSearch
+ optional int32 database = 4;
+
+ // Needs to be sync with AppSearchResult#ResultCode in
+ // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
+ optional int32 status_code = 5;
+
+ // Overall time used for query including estimated binder latency
+ optional int32 total_latency_millis = 6;
+
+ // Time used to rewrite the search spec.
+ optional int32 rewrite_search_spec_latency_millis = 7;
+
+ // Time used to rewrite the search results.
+ optional int32 rewrite_search_result_latency_millis = 8;
+
+ // Whether it is a global query.
+ // Needs to be sync with QueryStats#VisibilityScope in
+ // frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/stats/QueryStats.java
+ optional int32 visibility_scope = 9;
+
+ // Overall time used for the native function call.
+ optional int32 native_latency_millis = 10;
+
+ // Number of terms in the query string.
+ optional int32 native_num_terms = 11;
+
+ // Length of the query string.
+ optional int32 native_query_length = 12;
+
+ // Number of namespaces filtered.
+ optional int32 native_num_namespaces_filtered = 13;
+
+ // Number of schema types filtered.
+ optional int32 native_num_schema_types_filtered = 14;
+
+ // The requested number of results in one page.
+ optional int32 native_requested_page_size = 15;
+
+ // The actual number of results returned in the current page.
+ optional int32 native_num_results_returned_current_page = 16;
+
+ // Whether the function call is querying the first page. If it's
+ // not, Icing will fetch the results from cache so that some steps
+ // may be skipped.
+ optional bool native_is_first_page = 17;
+
+ // Time used to parse the query, including 2 parts: tokenizing and
+ // transforming tokens into an iterator tree.
+ optional int32 native_parse_query_latency_millis = 18;
+
+ // Strategy of scoring and ranking.
+ // Needs to be sync with RankingStrategy.Code in google3/third_party/icing/proto/scoring.proto
+ optional int32 native_ranking_strategy = 19;
+
+ // Number of documents scored.
+ optional int32 native_num_documents_scored = 20;
+
+ // Time used to score the raw results.
+ optional int32 native_scoring_latency_millis = 21;
+
+ // Time used to rank the scored results.
+ optional int32 native_ranking_latency_millis = 22;
+
+ // Time used to fetch the document protos. Note that it includes the
+ // time to snippet if "native_num_results_with_snippets" is NOT zero.
+ optional int32 native_document_retrieval_latency_millis = 23;
+
+ // How many snippets are calculated.
+ optional int32 native_num_results_with_snippets = 24;
+}
+
+/**
+ * Logs detailed stats for remove in AppSearch
+ */
+message AppSearchRemoveStatsReported {
+ // The sampling interval for this specific type of stats
+ // For example, sampling_interval=10 means that one out of every 10 stats was logged.
+ optional int32 sampling_interval = 1;
+
+ // # of previous skipped sample for this specific type of stats
+ // We can't push atoms too closely, so some samples might be skipped
+ // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
+ // For example, the true count of an event could be estimated as:
+ // SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
+ optional int32 num_previous_skipped_sample = 2;
+
+ // Package UID of the application.
+ optional int32 uid = 3 [(is_uid) = true];
+
+ // Hash of the database name within AppSearch
+ optional int32 database = 4;
+
+ // Needs to be sync with AppSearchResult#ResultCode in
+ // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
+ optional int32 status_code = 5;
+
+ // Overall time used for remove including the binder latency
+ optional int32 total_latency_millis = 6;
+
+ // Overall time used for the native function call.
+ optional int32 native_latency_millis = 7;
+
+ // Used to indicate what kind of delete(namespace, schemaType etc) calls deleteByQuery here.
+ // Needs to be sync with external/icing/proto/icing/proto/logging.proto#DeleteStatsProto
+ optional int32 native_delete_type = 8;
+
+ // Number of documents deleted by this call.
+ optional int32 native_num_documents_deleted = 9;
+}
+
+/**
+ * Logs detailed stats for optimization in AppSearch.
+ *
+ * stats pushed from:
+ * frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
+ *
+ * Next tag: 14
+ */
+message AppSearchOptimizeStatsReported {
+ // The sampling interval for this specific type of stats
+ // For example, sampling_interval=10 means that one out of every 10 stats was logged.
+ optional int32 sampling_interval = 1;
+
+ // # of previous skipped sample for this specific type of stats
+ // We can't push atoms too closely, so some samples might be skipped
+ // In order to extrapolate the counts, we need to save the number of skipped stats and add it back
+ // For example, the true count of an event could be estimated as:
+ // SUM(sampling_interval * (num_skipped_sample + 1)) as est_count
+ optional int32 num_previous_skipped_sample = 2;
+
+ // Needs to be sync with AppSearchResult#ResultCode in
+ // frameworks/base/apex/appsearch/framework/java/android/app/appsearch/AppSearchResult.java
+ optional int32 status_code = 3;
+
+ // Overall time used for remove including the binder latency
+ optional int32 total_latency_millis = 4;
+
+ // Overall time used for the native function call.
+ optional int32 native_latency_millis = 5;
+
+ // Time used to optimize the document store in millis.
+ optional int32 native_document_store_optimize_latency_millis = 6;
+
+ // Time used to restore the index in millis.
+ optional int32 native_index_restoration_latency_millis = 7;
+
+ // Number of documents before the optimization.
+ optional int32 native_num_original_documents = 8;
+
+ // Number of documents deleted during the optimization.
+ optional int32 native_num_deleted_documents = 9;
+
+ // Number of documents expired during the optimization.
+ optional int32 native_num_expired_documents = 10;
+
+ // Size of storage in bytes before the optimization.
+ optional int64 native_storage_size_before_bytes = 11;
+
+ // Size of storage in bytes after the optimization.
+ optional int64 native_storage_size_after_bytes = 12;
+
+ // The amount of time in millis since the last optimization ran.
+ optional int64 native_time_since_last_optimize_millis = 13;
+}
+
+// Reports information in external/icing/proto/icing/proto/storage.proto#DocumentStorageInfoProto
+// Next tag: 15
+message AppSearchDocumentStorageInfo {
+ // Total number of alive documents.
+ optional int32 num_alive_documents = 1;
+
+ // Total number of deleted documents.
+ optional int32 num_deleted_documents = 2;
+
+ // Total number of expired documents.
+ optional int32 num_expired_documents = 3;
+
+ // Total size of the document store in bytes. Will be set to -1 if an IO error
+ // is encountered while calculating this field.
+ optional int64 document_store_size_bytes = 4;
+
+ // Total size of the ground truth in bytes. The ground truth may
+ // include deleted or expired documents. Will be set to -1 if an IO error is
+ // encountered while calculating this field.
+ optional int64 document_log_size_bytes = 5;
+
+ // Size of the key mapper in bytes. Will be set to -1 if an IO error is
+ // encountered while calculating this field.
+ optional int64 key_mapper_size_bytes = 6;
+
+ // Size of the document id mapper in bytes. Will be set to -1 if an IO error
+ // is encountered while calculating this field.
+ optional int64 document_id_mapper_size_bytes = 7;
+
+ // Size of the score cache in bytes. Will be set to -1 if an IO error is
+ // encountered while calculating this field.
+ optional int64 score_cache_size_bytes = 8;
+
+ // Size of the filter cache in bytes. Will be set to -1 if an IO error is
+ // encountered while calculating this field.
+ optional int64 filter_cache_size_bytes = 9;
+
+ // Size of the corpus mapper in bytes. Will be set to -1 if an IO error is
+ // encountered while calculating this field.
+ optional int64 corpus_mapper_size_bytes = 10;
+
+ // Size of the corpus score cache in bytes. Will be set to -1 if an IO error
+ // is encountered while calculating this field.
+ optional int64 corpus_score_cache_size_bytes = 11;
+
+ // Size of the namespace id mapper in bytes. Will be set to -1 if an IO error
+ // is encountered while calculating this field.
+ optional int64 namespace_id_mapper_size_bytes = 12;
+
+ // Number of namespaces seen from the current documents.
+ optional int32 num_namespaces = 13;
+
+ // Storage information of each namespace is not included due to that it has string field.
+
+ reserved 14;
+}
+
+// Reports information in external/icing/proto/icing/proto/storage.proto#SchemaStoreStorageInfoProto
+// Next tag: 5
+message AppSearchSchemaStoreStorageInfo {
+ // Size of the schema store in bytes. Will be set to -1 if an IO error is
+ // encountered while calculating this field.
+ optional int64 schema_store_size_bytes = 1;
+
+ // Total number of schema types.
+ optional int32 num_schema_types = 2;
+
+ // Total number of all sections across all types
+ optional int32 num_total_sections = 3;
+
+ // Total number of types at the current section limit.
+ optional int32 num_schema_types_sections_exhausted = 4;
+}
+
+// Reports information in external/icing/proto/icing/proto/storage.proto#IndexStorageInfoProto
+// Next tag: 9
+message AppSearchIndexStorageInfo {
+ // Total size of the index in bytes. Will be set to -1 if an IO error is
+ // encountered while calculating this field.
+ optional int64 index_size_bytes = 1;
+
+ // Size of the lite index lexicon in bytes. Will be set to -1 if an IO error
+ // is encountered while calculating this field.
+ optional int64 lite_index_lexicon_size_bytes = 2;
+
+ // Size of the lite index hit buffer in bytes. Will be set to -1 if an IO
+ // error is encountered while calculating this field.
+ optional int64 lite_index_hit_buffer_size_bytes = 3;
+
+ // Size of the main index lexicon in bytes. Will be set to -1 if an IO error
+ // is encountered while calculating this field.
+ optional int64 main_index_lexicon_size_bytes = 4;
+
+ // Size of the main index storage in bytes. Will be set to -1 if an IO error
+ // is encountered while calculating this field.
+ optional int64 main_index_storage_size_bytes = 5;
+
+ // Size of one main index block in bytes.
+ optional int64 main_index_block_size_bytes = 6;
+
+ // Number of main index blocks.
+ optional int32 num_blocks = 7;
+
+ // Percentage of the main index blocks that are free, assuming
+ // allocated blocks are fully used.
+ optional float min_free_fraction = 8;
+}
+
+/**
+ * Pulls information about storage information per user from AppSearch
+ *
+ * Pulled from:
+ * frameworks/base/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
+ *
+ * Next tag: 6
+ */
+message AppSearchStorageInfo {
+ // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
+ // This is mainly used as a dimension for the metric, but it can also tell us if
+ // the StorageInfo is for a primary user or secondary user.
+ optional int32 user = 1;
+
+ // Total size of Icing’s storage in bytes. Will be set to -1 if an IO error is
+ // encountered while calculating this field.
+ optional int64 total_storage_size_bytes = 2;
+
+ // Storage information of the document store.
+ optional AppSearchDocumentStorageInfo document_storage_info = 3
+ [(android.os.statsd.log_mode) = MODE_BYTES];
+
+ // Storage information of the schema store.
+ optional AppSearchSchemaStoreStorageInfo schema_store_storage_info = 4
+ [(android.os.statsd.log_mode) = MODE_BYTES];
+
+ // Storage information of the index.
+ optional AppSearchIndexStorageInfo index_storage_info = 5
+ [(android.os.statsd.log_mode) = MODE_BYTES];
}
/**
@@ -9454,54 +11404,204 @@
* frameworks/base/services/core/java/com/android/server/locksettings/RebootEscrowManager.java
*/
message RebootEscrowRecoveryReported {
+ // Type of the resume on reboot backend provider.
+ enum ServiceType {
+ UNKNOWN = 0;
+ HAL = 1;
+ SERVER_BASED = 2;
+ }
+
+ // Whether the vbmeta digest of the current slot matches a precomputed value before reboot.
+ enum VbmetaDigestStatus {
+ MATCH_EXPECTED_SLOT = 0;
+ MATCH_FALLBACK_SLOT = 1;
+ MISMATCH = 2;
+ }
+
optional bool successful = 1;
+ // The error code for escrow data recovery failure
+ optional int32 error_code = 2;
+
+ optional ServiceType type = 3;
+
+ // Number of retries to unwrap the escrow key asynchronously.
+ optional int32 get_escrow_key_retry_count = 4;
+
+ // The duration between storing of reboot escrow key ->
+ // use of reboot escrow key to unlock CE after reboot
+ optional int32 duration_escrow_key_storage_to_unlock_seconds = 5;
+
+ optional VbmetaDigestStatus vbmeta_digest_status = 6;
+
+ // The duration between boot complete -> CE unlock
+ optional int32 duration_boot_complete_to_unlock_seconds = 7;
}
/**
* Global display pipeline metrics reported by SurfaceFlinger.
+ * Metrics exist beginning in Android 11.
+ * There is a copy of this proto in timestats_atoms.proto in SurfaceFlinger.
+ * That proto must be updated if this atom is updated.
+ *
* Pulled from:
* frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
*/
message SurfaceflingerStatsGlobalInfo {
+ // Aggregated refresh rate buckets that layers were presenting at. Buckets
+ // are defined in SurfaceFlinger and are tracked per device.
+ // Introduced in Android 12.
+ // This is intended to be used as a dimenstion in collecting per-refresh rate
+ // jank statistics.
+ optional int32 display_refresh_rate_bucket = 18;
+ // Aggregated render rate buckets that layers were overridden to run at.
+ // Buckets are defined in SurfaceFlinger and are tracked per device.
+ // Introduced in Android 12.
+ // This is intended to be used as a dimension in collecting per-render rate
+ // jank statistics.
+ optional int32 render_rate_bucket = 21;
// Total number of frames presented during the tracing period
+ // Note: This stat is not sliced by dimension. It will be duplicated for metrics
+ // using render_rate_bucket as a dimension.
optional int64 total_frames = 1;
// Total number of frames missed
+ // Note: This stat is not sliced by dimension. It will be duplicated for metrics
+ // using render_rate_bucket as a dimension.
optional int64 missed_frames = 2;
// Total number of frames that fell back to client composition
+ // Note: This stat is not sliced by dimension. It will be duplicated for metrics
+ // using render_rate_bucket as a dimension.
optional int64 client_composition_frames = 3;
// Total time the display was turned on
+ // Note: This stat is not sliced by dimension. It will be duplicated for metrics
+ // using render_rate_bucket as a dimension.
optional int64 display_on_millis = 4;
// Total time that was spent performing animations.
- // This is derived from the present-to-present layer histogram
+ // This is derived from the present-to-present layer histogram.
+ // Note: This stat is not sliced by dimension. It will be duplicated for metrics
+ // using render_rate_bucket as a dimension.
optional int64 animation_millis = 5;
// Total number of event connections tracked by SurfaceFlinger at the time
// of this pull. If this number grows prohibitively large, then this can
// cause jank due to resource contention.
+ // Note: This stat is not sliced by dimension. It will be duplicated for metrics
+ // using render_rate_bucket as a dimension.
optional int32 event_connection_count = 6;
// Set of timings measured from when SurfaceFlinger began compositing a
// frame, until the frame was requested to be presented to the display. This
// measures SurfaceFlinger's total CPU walltime on the critical path per
// frame.
+ // Note: This stat is not sliced by dimension. It will be duplicated for metrics
+ // using render_rate_bucket as a dimension.
optional FrameTimingHistogram frame_duration = 7
[(android.os.statsd.log_mode) = MODE_BYTES];
// Set of timings measured from when SurfaceFlinger first began using the
// GPU to composite a frame, until the GPU has finished compositing that
// frame. This measures the total additional time SurfaceFlinger needed to
// perform due to falling back into GPU composition.
+ // Note: This stat is not sliced by dimension. It will be duplicated for metrics
+ // using render_rate_bucket as a dimension.
optional FrameTimingHistogram render_engine_timing = 8
[(android.os.statsd.log_mode) = MODE_BYTES];
+ // Number of frames where SF saw a frame, based on its frame timeline.
+ // Frame timelines may include transactions without updating buffer contents.
+ // Introduced in Android 12.
+ optional int32 total_timeline_frames = 9;
+ // Number of frames where SF saw a janky frame.
+ // Introduced in Android 12.
+ optional int32 total_janky_frames = 10;
+ // Number of janky frames where SF spent a long time on the CPU.
+ // Introduced in Android 12.
+ optional int32 total_janky_frames_with_long_cpu = 11;
+ // Number of janky frames where SF spent a long time on the GPU.
+ // Introduced in Android 12.
+ optional int32 total_janky_frames_with_long_gpu = 12;
+ // Number of janky frames where SF missed the frame deadline, but there
+ // was not an attributed reason (e.g., maybe HWC missed?)
+ // Introduced in Android 12.
+ optional int32 total_janky_frames_sf_unattributed = 13;
+ // Number of janky frames where the app missed the frame deadline, but
+ // there was not an attributed reason
+ // Introduced in Android 12.
+ optional int32 total_janky_frames_app_unattributed = 14;
+ // Number of janky frames that were caused because of scheduling errors in
+ // SF that resulted in early present (e.g., SF sending a buffer to the
+ // composition engine earlier than expected, resulting in a present that is
+ // one vsync early)
+ // Introduced in Android 12.
+ optional int32 total_janky_frames_sf_scheduling = 15;
+ // Number of frames that were classified as jank because of possible drift in
+ // vsync predictions.
+ // Introduced in Android 12.
+ optional int32 total_jank_frames_sf_prediction_error = 16;
+ // Number of janky frames where the app was in a buffer stuffed state (more
+ // than one buffer ready to be presented at the same vsync). Usually caused
+ // when the first frame is unusually long, the following frames enter into a
+ // stuffed state.
+ // Introduced in Android 12.
+ optional int32 total_jank_frames_app_buffer_stuffing = 17;
+ // Buckets of timings in ms by which SurfaceFlinger's deadline was missed
+ // while latching and presenting frames.
+ // Introduced in Android 12.
+ optional FrameTimingHistogram sf_deadline_misses = 19
+ [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Buckets of timings in ms by which the Vsync prediction drifted, when
+ // compared to the actual hardware vsync.
+ // Introduced in Android 12.
+ optional FrameTimingHistogram sf_prediction_errors = 20
+ [(android.os.statsd.log_mode) = MODE_BYTES];
+
+ // Next ID: 22
}
/**
* Per-layer display pipeline metrics reported by SurfaceFlinger.
- * The number of layers uploaded will be restricted due to size limitations.
+ * Metrics exist beginning in Android 11.
+ * The number of layers uploaded may be restricted due to size limitations.
+ * There is a copy of this proto in timestats_atoms.proto in SurfaceFlinger.
+ * That proto must be updated if this atom is updated.
+ *
* Pulled from:
* frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
*/
message SurfaceflingerStatsLayerInfo {
+ // UID of the application who submitted this layer for presentation
+ // This is intended to be used as a dimension for surfacing rendering
+ // statistics to applications.
+ // Introduced in Android 12.
+ optional int32 uid = 12 [(is_uid) = true];
+ // Refresh rate bucket that the layer was presenting at. Buckets are
+ // defined in SurfaceFlinger and are tracked per device.
+ // Introduced in Android 12.
+ // This is intended to be used as a dimension in collecting per-refresh rate
+ // jank statistics
+ optional int32 display_refresh_rate_bucket = 22;
+ // Render rate bucket that the layer was submitting frames at. Buckets are
+ // defined in SurfaceFlinger and are tracked per device.
+ // Introduced in Android 12.
+ // This is intended to be used as a dimension in collecting per-render rate
+ // jank statistics.
+ optional int32 render_rate_bucket = 23;
+
+ // Game modes are used only for integrating with GameManager.
+ enum GameMode {
+ GAME_MODE_UNSPECIFIED = 0;
+ GAME_MODE_UNSUPPORTED = 1;
+ GAME_MODE_STANDARD = 2;
+ GAME_MODE_PERFORMANCE = 3;
+ GAME_MODE_BATTERY = 4;
+ }
+
+ // Game mode that the layer was running at. Used to track user engagement
+ // in different modes. The modes are defined in GameManager.java
+ // All non-game layers will have this field set to UNSUPPORTED.
+ // Introduced in Android 12
+ // This is intended to be used as a dimension in collecting per-game mode
+ // fps and frame related metrics.
+ optional GameMode game_mode = 26;
// The layer for this set of metrics
- // For now we can infer that the package name is included in the layer
- // name.
+ // In many scenarios the package name is included in the layer name, e.g.,
+ // layers created by Window Manager. But this is not a guarantee - in the
+ // general case layer names are arbitrary debug names.
optional string layer_name = 1;
// Total number of frames presented
optional int64 total_frames = 2;
@@ -9535,6 +11635,83 @@
optional int64 late_acquire_frames = 10;
// Frames latched early because the desired present time was bad
optional int64 bad_desired_present_frames = 11;
+ // Number of frames where SF saw a frame, based on its frame timeline.
+ // Frame timelines may include transactions without updating buffer contents.
+ // Introduced in Android 12.
+ optional int32 total_timeline_frames = 13;
+ // Number of frames where SF saw a janky frame.
+ // Introduced in Android 12.
+ optional int32 total_janky_frames = 14;
+ // Number of janky frames where SF spent a long time on the CPU.
+ // Introduced in Android 12.
+ optional int32 total_janky_frames_with_long_cpu = 15;
+ // Number of janky frames where SF spent a long time on the GPU.
+ // Introduced in Android 12.
+ optional int32 total_janky_frames_with_long_gpu = 16;
+ // Number of janky frames where SF missed the frame deadline, but there
+ // was not an attributed reason (e.g., maybe HWC missed?)
+ // Introduced in Android 12.
+ optional int32 total_janky_frames_sf_unattributed = 17;
+ // Number of janky frames where the app missed the frame deadline, but
+ // there was not an attributed reason
+ // Introduced in Android 12.
+ optional int32 total_janky_frames_app_unattributed = 18;
+ // Number of janky frames that were caused because of scheduling errors in
+ // SF that resulted in early present (e.g., SF sending a buffer to the
+ // composition engine earlier than expected, resulting in a present that is
+ // one vsync early)
+ // Introduced in Android 12.
+ optional int32 total_janky_frames_sf_scheduling = 19;
+ // Number of frames that were classified as jank because of possible drift in
+ // vsync predictions.
+ // Introduced in Android 12.
+ optional int32 total_jank_frames_sf_prediction_error = 20;
+ // Number of janky frames where the app was in a buffer stuffed state (more
+ // than one buffer ready to be presented at the same vsync). Usually caused
+ // when the first frame is unusually long, the following frames enter into a
+ // stuffed state.
+ // Introduced in Android 12.
+ optional int32 total_jank_frames_app_buffer_stuffing = 21;
+
+ /**
+ * Encapsulates the FrameRateVote information sent by the application while
+ * calling setFrameRate.
+ * Metrics exist beginning in Android 12.
+ */
+ message SetFrameRateVote {
+ // The desired frame rate the application wishes to run on.
+ optional float frame_rate = 1;
+
+ enum FrameRateCompatibility {
+ FRAME_RATE_UNDEFINED = 0;
+ FRAME_RATE_DEFAULT = 1;
+ FRAME_RATE_EXACT_OR_MULTIPLE = 2;
+ }
+
+ // Specifies how to interpret the frame rate associated with the layer.
+ // Defined in Layer.h
+ optional FrameRateCompatibility frame_rate_compatibility = 2;
+
+ enum Seamlessness {
+ SEAMLESS_UNDEFINED = 0;
+ SEAMLESS_SHOULD_BE_SEAMLESS = 1;
+ SEAMLESS_NOT_REQUIRED = 2;
+ }
+ // Indicates whether seamless refresh rate switch is required or not.
+ optional Seamlessness seamlessness = 3;
+ }
+
+ // The last frame rate vote set by the application.
+ // Introduced in Android 12.
+ optional SetFrameRateVote set_frame_rate_vote = 24
+ [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Buckets of timings in ms by which the app deadline was missed while
+ // submitting work for a frame.
+ // Introduced in Android 12.
+ optional FrameTimingHistogram app_deadline_misses = 25
+ [(android.os.statsd.log_mode) = MODE_BYTES];
+
+ // Next ID: 27
}
/**
@@ -9567,16 +11744,57 @@
optional int32 present_deadlines_missed = 2;
}
+message CameraStreamProto {
+ // The stream width (in pixels)
+ optional int32 width = 1;
+ // The stream height (in pixels)
+ optional int32 height = 2;
+ // The format of the stream
+ optional int32 format = 3;
+ // The dataspace of the stream
+ optional int32 data_space = 4;
+ // The usage flag of the stream
+ optional int64 usage = 5;
+
+ // The number of requests for this stream
+ optional int64 request_count = 6;
+ // The number of buffer error for this stream
+ optional int64 error_count = 7;
+ // The capture latency of first request for this stream
+ optional int32 first_capture_latency_millis = 8;
+
+ // The maximum number of hal buffers
+ optional int32 max_hal_buffers = 9;
+ // The maximum number of app buffers
+ optional int32 max_app_buffers = 10;
+
+ // Type of stream histogram
+ // 1: Capture latency: bin size in milliseconds
+ enum HistogramType {
+ UNKNOWN = 0;
+ CAPTURE_LATENCY = 1;
+ }
+ optional HistogramType histogram_type = 11;
+ // The boundary values between histogram bins
+ // Expected number of fields: 9
+ repeated float histogram_bins = 12;
+ // The frame counts for each histogram bins
+ // Expected number of fields: 10
+ repeated int64 histogram_counts = 13;
+}
+
/**
* Information about camera facing and API level usage.
* Logged from:
* frameworks/base/services/core/java/com/android/server/camera/CameraServiceProxy.java
*/
message CameraActionEvent {
- // Camera session duration
+ // Camera session duration in milliseconds if action is SESSION.
+ // 0 if action is OPEN or CLOSE.
optional int64 duration_millis = 1;
- // Camera API level used
+ // Camera API level used.
+ // 1 for camera1 API, and 2 for camera2 API.
optional int32 api_level = 2;
// Name of client package
@@ -9590,6 +11808,51 @@
EXTERNAL = 3;
}
optional Facing facing = 4;
+
+ // Camera ID
+ optional string camera_id = 5;
+
+ // Camera action type
+ enum Action {
+ UNKNOWN_ACTION = 0;
+ OPEN = 1;
+ CLOSE = 2;
+ SESSION = 3;
+ }
+ optional Action action = 6;
+
+ // Whether the client is accessing camera using ndk
+ optional bool is_ndk = 7;
+
+ // Action OPEN: Open latency
+ // Action CLOSE: Close latency
+ // Action SESSION: Camera session creation duration.
+ // If this entry is reusing an existing session, the value is -1.
+ optional int32 latency_millis = 8;
+
+ // session type: 0 for normal mode, 1 for constrained high speed mode
+ optional int32 operating_mode = 9;
+
+ // If actioh is SESSION: number of internal reconfigurations
+ // Else: 0
+ optional int32 internal_reconfig = 10;
+
+ // Number of requests for this capture session. Only applicable to SESSION
+ // action.
+ optional int64 request_count = 11;
+ // Number of result errors. Only applicable to SESSION action.
+ optional int64 result_error_count = 12;
+ // Whether the device runs into error state.
+ optional bool device_error = 13;
+
+ // If action is SESSION: Stream states
+ // Else: stream_count = 0
+ optional int32 stream_count = 14;
+ optional CameraStreamProto stream_1 = 15 [(log_mode) = MODE_BYTES];
+ optional CameraStreamProto stream_2 = 16 [(log_mode) = MODE_BYTES];
+ optional CameraStreamProto stream_3 = 17 [(log_mode) = MODE_BYTES];
+ optional CameraStreamProto stream_4 = 18 [(log_mode) = MODE_BYTES];
+ optional CameraStreamProto stream_5 = 19 [(log_mode) = MODE_BYTES];
}
/**
@@ -9631,27 +11894,90 @@
/**
* Logged from
* external/perfetto/src/perfetto_cmd/perfetto_cmd.cc
+ * external/perfetto/src/tracing/service/tracing_service_impl.cc
*/
message PerfettoUploaded {
+ // TODO(lalitm): many of the atoms below should be renamed to have a
+ // "PERFETTO_CMD" prefix to make clear they are specific to perfetto_cmd.
+ // This will be done after the server side is ready for this change.
+ // Next id: 48.
enum Event {
PERFETTO_UNDEFINED = 0;
+
+ // Checkpoints inside perfetto_cmd before tracing is finished.
PERFETTO_TRACE_BEGIN = 1;
PERFETTO_BACKGROUND_TRACE_BEGIN = 2;
PERFETTO_ON_CONNECT = 3;
- PERFETTO_ON_TRACING_DISABLED = 4;
- PERFETTO_UPLOAD_DROPBOX_BEGIN = 5;
- PERFETTO_UPLOAD_DROPBOX_SUCCESS = 6;
- PERFETTO_UPLOAD_DROPBOX_FAILURE = 7;
- PERFETTO_UPLOAD_INCIDENT_BEGIN = 8;
- PERFETTO_UPLOAD_INCIDENT_SUCCESS = 9;
- PERFETTO_UPLOAD_INCIDENT_FAILURE = 10;
- PERFETTO_FINALIZE_TRACE_AND_EXIT = 11;
- PERFETTO_TRIGGER_BEGIN = 12;
- PERFETTO_TRIGGER_SUCCESS = 13;
- PERFETTO_TRIGGER_FAILURE = 14;
- PERFETTO_HIT_GUARDRAILS = 15;
+
+ // Guardrails inside perfetto_cmd before tracing is finished.
PERFETTO_ON_TIMEOUT = 16;
+ PERFETTO_CMD_USER_BUILD_TRACING_NOT_ALLOWED = 43;
+ PERFETTO_CMD_FAILED_TO_INIT_GUARDRAIL_STATE = 44;
+ PERFETTO_CMD_INVALID_GUARDRAIL_STATE = 45;
+ PERFETTO_CMD_HIT_UPLOAD_LIMIT = 46;
+
+ // Checkpoints inside traced.
+ PERFETTO_TRACED_ENABLE_TRACING = 37;
+ PERFETTO_TRACED_START_TRACING = 38;
+ PERFETTO_TRACED_DISABLE_TRACING = 39;
+ PERFETTO_TRACED_NOTIFY_TRACING_DISABLED = 40;
+
+ // Trigger checkpoints inside traced.
+ // These atoms are special because, along with the UUID,
+ // they log the trigger name.
+ PERFETTO_TRACED_TRIGGER_START_TRACING = 41;
+ PERFETTO_TRACED_TRIGGER_STOP_TRACING = 42;
+
+ // Guardrails inside traced.
+ PERFETTO_TRACED_ENABLE_TRACING_EXISTING_TRACE_SESSION = 18;
+ PERFETTO_TRACED_ENABLE_TRACING_TOO_LONG_TRACE = 19;
+ PERFETTO_TRACED_ENABLE_TRACING_INVALID_TRIGGER_TIMEOUT = 20;
+ PERFETTO_TRACED_ENABLE_TRACING_DURATION_WITH_TRIGGER = 21;
+ PERFETTO_TRACED_ENABLE_TRACING_STOP_TRACING_WRITE_INTO_FILE = 22;
+ PERFETTO_TRACED_ENABLE_TRACING_DUPLICATE_TRIGGER_NAME = 23;
+ PERFETTO_TRACED_ENABLE_TRACING_INVALID_DEFERRED_START = 24;
+ PERFETTO_TRACED_ENABLE_TRACING_INVALID_BUFFER_SIZE = 25;
+ PERFETTO_TRACED_ENABLE_TRACING_BUFFER_SIZE_TOO_LARGE = 26;
+ PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_BUFFERS = 27;
+ PERFETTO_TRACED_ENABLE_TRACING_DUPLICATE_SESSION_NAME = 28;
+ PERFETTO_TRACED_ENABLE_TRACING_SESSION_NAME_TOO_RECENT = 29;
+ PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_SESSIONS_FOR_UID = 30;
+ PERFETTO_TRACED_ENABLE_TRACING_TOO_MANY_CONCURRENT_SESSIONS = 31;
+ PERFETTO_TRACED_ENABLE_TRACING_INVALID_FD_OUTPUT_FILE = 32;
+ PERFETTO_TRACED_ENABLE_TRACING_FAILED_TO_CREATE_FILE = 33;
+ PERFETTO_TRACED_ENABLE_TRACING_OOM = 34;
+ PERFETTO_TRACED_ENABLE_TRACING_UNKNOWN_ERROR = 35;
+ PERFETTO_TRACED_START_TRACING_INVALID_SESSION_STATE = 36;
+ PERFETTO_TRACED_ENABLE_TRACING_INVALID_FILTER = 47;
+
+ // Checkpoints inside perfetto_cmd after tracing has finished.
+ PERFETTO_ON_TRACING_DISABLED = 4;
+ PERFETTO_UPLOAD_INCIDENT_BEGIN = 8;
+ PERFETTO_FINALIZE_TRACE_AND_EXIT = 11;
PERFETTO_NOT_UPLOADING_EMPTY_TRACE = 17;
+
+ // Guardrails inside perfetto_cmd after tracing has finished.
+ PERFETTO_UPLOAD_INCIDENT_FAILURE = 10;
+
+ // Deprecated as "success" is misleading; it simply means we were
+ // able to communicate with incidentd. Will be removed once
+ // incidentd is properly instrumented.
+ PERFETTO_UPLOAD_INCIDENT_SUCCESS = 9 [deprecated = true];
+
+ // Deprecated as has the potential to be too spammy. Will be
+ // replaced with a whole new atom proto which uses a count metric
+ // instead of the event metric used for this proto.
+ PERFETTO_TRIGGER_BEGIN = 12 [deprecated = true];
+ PERFETTO_TRIGGER_SUCCESS = 13 [deprecated = true];
+ PERFETTO_TRIGGER_FAILURE = 14 [deprecated = true];
+
+ // Deprecated as too coarse grained to be useful. Will be replaced
+ // with better broken down atoms as we do with traced.
+ PERFETTO_HIT_GUARDRAILS = 15 [deprecated = true];
+
+ // Contained status of Dropbox uploads. Removed as Perfetto no
+ // longer supports uploading traces using Dropbox.
+ reserved 5, 6, 7;
}
// Which stage of the pipeline we are reporting from.
@@ -9660,6 +11986,38 @@
// UUID matching the one set inside the SystemInfo trace packet.
optional int64 trace_uuid_lsb = 2;
optional int64 trace_uuid_msb = 3;
+
+ // For trigger checkpoints inside traced, contains the trigger name
+ // associated with this trace UUID.
+ optional string trigger_name = 4;
+}
+
+/**
+ * Logged from
+ * external/perfetto/src/tracing/service/tracing_service_impl.cc
+ */
+message PerfettoTrigger {
+ enum Event {
+ PERFETTO_UNDEFINED = 0;
+
+ PERFETTO_CMD_TRIGGER = 1;
+ PERFETTO_CMD_TRIGGER_FAIL = 2;
+
+ PERFETTO_TRIGGER_PERFETTO_TRIGGER = 3;
+ PERFETTO_TRIGGER_PERFETTO_TRIGGER_FAIL = 4;
+
+ PERFETTO_TRACED_LIMIT_PROBABILITY = 5;
+ PERFETTO_TRACED_LIMIT_MAX_PER_24_H = 6;
+
+ PERFETTO_PROBES_PRODUCER_TRIGGER = 7;
+ PERFETTO_PROBES_PRODUCER_TRIGGER_FAIL = 8;
+ }
+
+ // The event which fired.
+ optional Event event = 1;
+
+ // The name of the trigger which fired.
+ optional string trigger_name = 2;
}
/**
@@ -9692,7 +12050,7 @@
}
/**
- * State of a dangerous permission requested by a package - sampled
+ * State of a all permission requested by a package - sampled
* Pulled from: StatsCompanionService.java with data obtained from PackageManager API
*/
message DangerousPermissionStateSampled {
@@ -9707,6 +12065,9 @@
// Permission flags as per android.content.pm.PermissionFlags
optional int32 permission_flags = 4;
+
+ // Permission protection flags as per android.content.pm.PermissionInfo.ProtectionFlags
+ optional int32 protection_flags = 5;
}
/**
@@ -9935,6 +12296,7 @@
DUPLICATE_MESSAGE = 1;
GEOFENCED_MESSAGE = 2;
AREA_INFO_MESSAGE = 3;
+ DISABLED_BY_OEM = 4;
}
// GSM, CDMA, CDMA-SCP
@@ -9979,6 +12341,47 @@
}
/**
+ * Logs when a TV Input Service Session changes tune state
+ * This is atom ID 327.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/tv/TvInputManagerService.java
+ */
+message TifTuneStateChanged {
+
+ // Tv Input Service uid, TV Player uid
+ repeated AttributionNode attribution_node = 1 [
+ (state_field_option).primary_field_first_uid = true
+ ];
+ optional android.stats.tv.TifTuneState state = 2 [
+ (state_field_option).exclusive_state = true,
+ (state_field_option).default_state_value = 0,
+ (state_field_option).nested = false
+ ];
+ // This a globally unique 128 bit random number created by TvInputManagerService when
+ // android.media.tv.TvInputManager#createSession is called.
+ // It is has no device or user association.
+ // See android.media.tv.TvInputService.onCreateSession(java.lang.String, java.lang.String)
+ // WARNING: Any changes to this field should be carefully reviewed for privacy.
+ // Inspect the code at
+ // framework/base/cmds/statsd/src/atoms.proto
+ // TifTuneState
+ // frameworks/base/services/core/java/com/android/server/tv/TvInputManagerService.java
+ // logTuneStateChanged
+ // BinderService.createSession
+ // SessionState.sessionId
+ optional string tif_session_id = 3 [(state_field_option).primary_field = true];
+ optional android.stats.tv.TifInputType type = 4;
+ // The id of this TV Input, only unique to a given TV Input Service.
+ // This is specifically NOT android.media.tv.TvInputInfo.getId()
+ // which is a string that contains the package name of its TvInputService.
+ optional int32 input_id = 5 [(state_field_option).primary_field = true];
+ // The HDMI port id
+ // Only valid when type == HDMI
+ optional int32 hdmi_port = 6 [(state_field_option).primary_field = true];
+}
+
+/**
* Logs when a tune occurs through device's Frontend.
* This is atom ID 276.
*
@@ -10068,6 +12471,15 @@
// UPDATE and DELETE includes update/delete and the ones triggered by applyBatch.
UPDATE = 3;
DELETE = 4;
+ CALL = 5;
+ }
+
+ // Method called for ApiType.CALL
+ enum MethodCall {
+ UNKNOWN_METHOD = 0;
+ ADD_SIM_ACCOUNTS = 1;
+ REMOVE_SIM_ACCOUNTS = 2;
+ GET_SIM_ACCOUNTS = 3;
}
enum ResultType {
@@ -10084,6 +12496,11 @@
CALLER_IS_NOT_SYNC_ADAPTER = 2;
}
+ enum TaskType {
+ UNKNOWN_TASK = 0;
+ DANGLING_CONTACTS_CLEANUP_TASK = 1;
+ }
+
optional ApiType api_type = 1;
// Defined in
// packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
@@ -10092,6 +12509,9 @@
optional ResultType result_type = 4;
optional int32 result_count = 5;
optional int64 latency_micros = 6;
+ optional TaskType task_type = 7;
+ // Set when api_type == CALL
+ optional MethodCall method_called = 8;
}
/**
@@ -10176,7 +12596,7 @@
// Number of other calls going on during call termination, for the same SIM slot.
optional int32 concurrent_call_count_at_end = 14;
- // Index of the SIM is used, 0 for single-SIM devices.
+ // Index of the SIM used, 0 for single-SIM devices.
optional int32 sim_slot_index = 15;
// Whether the device was in multi-SIM mode (with multiple active SIM profiles).
@@ -10210,6 +12630,32 @@
// A random number used as the dimension field to pull multiple atoms.
optional int32 dimension = 25;
+
+ // Signal strength at the end of the call. This value is applicable to both cellular and WiFi.
+ optional android.telephony.SignalStrengthEnum signal_strength_at_end = 26;
+
+ // Band at the end of the call. Value 0 is used if the band is unknown.
+ // See GeranBands, UtranBands and EutranBands in IRadio interface, depending on the RAT at
+ // the end of the call.
+ optional int32 band_at_end = 27;
+
+ // Time spent setting up the call in milliseconds.
+ // The time is measured from dial to ringing for outgoing calls, and from answer to connected
+ // for incoming calls.
+ optional int32 setup_duration_millis = 28;
+
+ // Main codec quality. The codec quality was equal to or greater than this value for at least
+ // 70% of the call.
+ optional android.telephony.CodecQuality main_codec_quality = 29;
+
+ // Whether video was enabled at any point during the call.
+ optional bool video_enabled = 30;
+
+ // Radio access technology (RAT) used when call is connected.
+ optional android.telephony.NetworkTypeEnum rat_at_connected = 31;
+
+ // Whether the call was a conference call (applicable only for calls over IMS).
+ optional bool is_multiparty = 32;
}
/**
@@ -10228,7 +12674,7 @@
// Radio access technology.
optional android.telephony.NetworkTypeEnum rat = 2;
- // Total duration that voice calls spent on this carrier and RAT.
+ // Total duration that voice calls spent on this carrier and RAT, rounded to 5 minutes.
optional int64 total_duration_seconds = 3;
// Total number of calls using this carrier and RAT.
@@ -10237,6 +12683,82 @@
}
/**
+ * Pulls amount of time spend in each cellular service state.
+ *
+ * Each pull creates multiple atoms, one for each SIM slot/carrier/RAT(including ENDC), the order of
+ * which is irrelevant to time. If multi SIM settings changes during the period, durations will be
+ * counted separately before and after the change. Airplane mode does not count towards durations.
+ *
+ * Pulled from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
+ */
+message CellularServiceState {
+ // Radio access technology (RAT) for voice.
+ // NETWORK_TYPE_UNKNOWN when the device is out of service.
+ // NETWORK_TYPE_IWLAN when the device is using VoWiFi.
+ optional android.telephony.NetworkTypeEnum voice_rat = 1;
+
+ // Radio access technology (RAT) for data.
+ // NETWORK_TYPE_UNKNOWN when the device is out of service.
+ // Only cellular RATs are valid and show where the device is camped.
+ optional android.telephony.NetworkTypeEnum data_rat = 2;
+
+ // Whether the device was in roaming (domestic or international) for voice.
+ optional android.telephony.RoamingTypeEnum voice_roaming_type = 3;
+
+ // Whether the device was in roaming (domestic or international) for data.
+ optional android.telephony.RoamingTypeEnum data_roaming_type = 4;
+
+ // Whether the device is on LTE and has access to NR NSA, i.e. cell supports 5G (ENDC) and UE
+ // registration (attach/TAU) indicates ENDC is not restricted.
+ optional bool is_endc = 5;
+
+ // Index of the SIM used, 0 for single-SIM devices.
+ optional int32 sim_slot_index = 6;
+
+ // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
+ optional bool is_multi_sim = 7;
+
+ // Carrier ID of the SIM card.
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 8;
+
+ // Total time spent in this service state, rounded to 5 minutes.
+ optional int32 total_time_seconds = 9;
+}
+
+/**
+ * Pulls the number of times cellular data service state switches.
+ *
+ * Each pull creates multiple atoms, one for each RAT combination, the order of which is irrelevant
+ * to time. Switches for different SIM slots, carrier IDs, or multi-SIM settings are counted
+ * separately.
+ *
+ * Pulled from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
+ */
+message CellularDataServiceSwitch {
+ // Cellular RAT of the DATA domain from where the switch occurred.
+ optional android.telephony.NetworkTypeEnum rat_from = 1;
+
+ // Cellular RAT of the DATA domain to where the switch occurred.
+ optional android.telephony.NetworkTypeEnum rat_to = 2;
+
+ // Index of the SIM used, 0 for single-SIM devices.
+ optional int32 sim_slot_index = 3;
+
+ // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
+ optional bool is_multi_sim = 4;
+
+ // Carrier ID of the SIM card.
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 5;
+
+ // Number of switches from rat_from to rat_to.
+ optional int32 switch_count = 6;
+}
+
+/**
* Pulls the number of active SIM slots and SIMs/eSIM profiles.
*
* Pulled from:
@@ -10270,12 +12792,505 @@
}
/**
+ * Pulls information about network requests.
+ *
+ * Pulled from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
+ */
+message TelephonyNetworkRequests {
+ // Carrier ID of the SIM card.
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 1;
+ // Number of times the enterprise capability was requested.
+ optional int32 enterprise_request_count = 2;
+ // Number of times the enterprise capability was released.
+ optional int32 enterprise_release_count = 3;
+}
+
+/**
+ * Pulls information for a single incoming SMS.
+ *
+ * Each pull creates multiple atoms, one for each SMS. The sequence is randomized when pulled.
+ *
+ * Pulled from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
+ */
+message IncomingSms {
+ // Format of the SMS (3GPP or 3GPP2).
+ optional android.telephony.SmsFormatEnum sms_format = 1;
+
+ // Technology of the SMS (CS or IMS).
+ optional android.telephony.SmsTechEnum sms_tech = 2;
+
+ // Radio access technology (RAT) used for the SMS. It can be IWLAN in case of IMS.
+ optional android.telephony.NetworkTypeEnum rat = 3;
+
+ // Type the SMS.
+ optional android.telephony.SmsTypeEnum sms_type = 4;
+
+ // Number of total parts.
+ optional int32 total_parts = 5;
+
+ // Number of received parts (if smaller than total parts, the SMS was dropped).
+ optional int32 received_parts = 6;
+
+ // Indicates if the incoming SMS was blocked.
+ optional bool blocked = 7;
+
+ // Indicate a specific error handling the SMS
+ optional android.telephony.SmsIncomingErrorEnum error = 8;
+
+ // Whether the SMS was received while roaming.
+ optional bool is_roaming = 9;
+
+ // Index of the SIM used, 0 for single-SIM devices.
+ optional int32 sim_slot_index = 10;
+
+ // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
+ optional bool is_multi_sim = 11;
+
+ // Whether the message was received with an eSIM profile.
+ optional bool is_esim = 12;
+
+ // Carrier ID of the SIM card used for the SMS.
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 13;
+
+ // Random message ID.
+ optional int64 message_id = 14;
+}
+
+/**
+ * Pulls information for a single outgoing SMS.
+ *
+ * Each pull creates multiple atoms, one for each SMS. The sequence is randomized when pulled.
+ *
+ * Pulled from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
+ */
+message OutgoingSms {
+ // Format of the SMS (3GPP or 3GPP2).
+ optional android.telephony.SmsFormatEnum sms_format = 1;
+
+ // Technology of the SMS (CS or IMS).
+ optional android.telephony.SmsTechEnum sms_tech = 2;
+
+ // Radio access technology (RAT) used for the SMS. It can be IWLAN in case of IMS.
+ optional android.telephony.NetworkTypeEnum rat = 3;
+
+ // Result of the SMS sending.
+ optional android.telephony.SmsSendResultEnum send_result = 4;
+
+ // Error code
+ // For IMS technology, see @SmsManager.Result in
+ // http://cs/android/frameworks/base/telephony/java/android/telephony/SmsManager.java
+ // For CS technology:
+ // - GSM format: see GsmSmsErrorCode (3GPP 27.005 clause 3.2.5)
+ // - CDMA format: see CdmaSmsErrorCode (3GPP2 N.S0005 (IS-41-C) Table 171)
+ optional int32 error_code = 5;
+
+ // Whether the SMS was sent while roaming.
+ optional bool is_roaming = 6;
+
+ // Whether the default SMS application generated the SMS (regardless of which application).
+ optional bool is_from_default_app = 7;
+
+ // Index of the SIM used, 0 for single-SIM devices.
+ optional int32 sim_slot_index = 8;
+
+ // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
+ optional bool is_multi_sim = 9;
+
+ // Whether the message was sent with an eSIM profile.
+ optional bool is_esim = 10;
+
+ // Carrier ID of the SIM card used for the SMS.
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 11;
+
+ // Random message ID.
+ optional int64 message_id = 12;
+
+ // Retry count: 0 for the first attempt and then increasing for each attempt.
+ optional int32 retry_id = 13;
+}
+
+/**
+ * Logs information about usage of airplane mode.
+ *
+ * Logged from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/AirplaneModeStats.java
+ */
+message AirplaneMode {
+ // Status of airplane mode
+ optional bool is_enabled = 1;
+
+ // When is_enabled is false, indicates if this was a very short airplane mode toggle
+ // (i.e. airplane mode was disabled after less than 10 seconds from enablement).
+ optional bool short_toggle = 2;
+
+ // Carrier ID of the SIM card.
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 3;
+}
+
+/**
+ * Logs information about modem restarts.
+ *
+ * Logged from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/ModemRestartStats.java
+ */
+message ModemRestart {
+ // Software version of the modem, as provided by android.os.Build.getRadioVersion().
+ optional string baseband_version = 1;
+
+ // Reason of the modem restart, as provided in the modemReset indication of IRadio HAL.
+ optional string reason = 2;
+
+ // Carrier ID of the first SIM card.
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 3;
+}
+
+/**
+ * Logs the SIM card details when the carrier ID match is not complete.
+ *
+ * The atom is pushed when a SIM card is initialized and the MCC/MNC is not present in the
+ * carrier ID table, or the SIM card contains a GID1 value that is not present in the carrier ID
+ * table. This atom is pushed only once for each type of SIM card.
+ *
+ * Logged from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/CarrierIdMatchStats.java
+ */
+message CarrierIdMismatchReported {
+ // Matched carrier ID. The value -1 is used if no match is found.
+ optional int32 carrier_id = 1;
+
+ // MCC/MNC of the SIM card.
+ optional string mcc_mnc = 2;
+
+ // Group identifier (level 1) of the SIM card.
+ optional string gid1 = 3;
+
+ // SPN value of the SIM card.
+ optional string spn = 4;
+
+ // First record of the PNN in the SIM card. This field is populated only if the SPN is missing
+ // or empty.
+ optional string pnn = 5;
+}
+
+/**
+ * Logs the version of the carrier ID matching table at first power up and when it is updated.
+ *
+ * Logged from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/CarrierIdMatchStats.java
+ */
+message CarrierIdTableUpdated {
+ // Version of the CarrierId matching table.
+ optional int32 table_version = 1;
+}
+
+/**
+ * Pulls the version of the carrier ID matching table.
+ *
+ * Logged from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
+ */
+message CarrierIdTableVersion {
+ // Version of the CarrierId matching table.
+ optional int32 table_version = 1;
+}
+
+/**
+ * Pulls information for a single data call session
+ *
+ * Each pull creates multiple atoms, one for each data call session.
+ * The sequence is randomized when pulled.
+ *
+ * Pulled from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
+ */
+message DataCallSession {
+ // A random number to be used as dimension to capture multiple atoms
+ optional int32 dimension = 1;
+
+ // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
+ optional bool is_multi_sim = 2;
+
+ // Whether the call was made with an eSIM profile.
+ optional bool is_esim = 3;
+
+ // Data profile of this call (for what purpose this call was made)
+ optional android.telephony.DataProfileEnum profile = 4 [deprecated = true];
+
+ // APN type bitmask of the APN used:
+ // @ApnType in frameworks/base/telephony/java/android/telephony/Annotation.java.
+ optional int32 apn_type_bitmask = 5;
+
+ // Carrier ID of the SIM
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 6;
+
+ // Whether the subscription is roaming
+ optional bool is_roaming = 7;
+
+ // Data RAT when the call ended, can be IWLAN for IMS/MMS, otherwise should be WWAN PS RAT.
+ // In the case that the connection hasn't ended yet, this field holds the current RAT.
+ // In the case the call ended due to Out Of Service (OOS),
+ // this field should be the last known RAT.
+ optional android.telephony.NetworkTypeEnum rat_at_end = 8;
+
+ // Was the data call ended due to OOS
+ optional bool oos_at_end = 9;
+
+ // Number of RAT switches during the data call
+ optional int64 rat_switch_count = 10;
+
+ // Whether the call is on an opportunistic subscription
+ optional bool is_opportunistic = 11;
+
+ // Packet data protocol used
+ optional android.telephony.ApnProtocolEnum ip_type = 12;
+
+ // Whether the data call terminated before being established
+ optional bool setup_failed = 13;
+
+ // Reason why the data call terminated, as in RIL_DataCallFailCause from ril.h
+ optional int32 failure_cause = 14;
+
+ // Suggested retry back-off timer value from RIL
+ optional int32 suggested_retry_millis = 15;
+
+ // Why the data call was deactivated
+ // Set by telephony for MO deactivations (unrelated to failure_cause)
+ optional android.telephony.DataDeactivateReasonEnum deactivate_reason = 16;
+
+ // Duration of the data call, rounded into the closest 5 minutes.
+ optional int64 duration_minutes = 17;
+
+ // Whether the data call is still connected when the atom is collected.
+ optional bool ongoing = 18;
+
+ // Band at the end of the data call. Value 0 is used if the band is unknown.
+ // See GeranBands, UtranBands and EutranBands in IRadio interface, depending
+ // on the RAT at the end of the data call.
+ optional int32 band_at_end = 19;
+}
+
+/**
+ * Logs data stall recovery event
+ *
+ * Logged from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
+ */
+message DataStallRecoveryReported {
+ // Carrier ID of the SIM
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 1;
+
+ // Data RAT when the stall happened
+ optional android.telephony.NetworkTypeEnum rat = 2;
+
+ // Signal strength when stall happened
+ optional android.telephony.SignalStrengthEnum signal_strength = 3;
+
+ // Action taken to recover
+ optional android.telephony.DataStallRecoveryActionEnum action = 4;
+
+ // Whether the subscription is opportunistic
+ optional bool is_opportunistic = 5;
+
+ // Whether the device is in multi-SIM mode
+ optional bool is_multi_sim = 6;
+
+ // Band used when the stall/recovery took place.
+ // Value 0 is used if the band is unknown.
+ // See GeranBands, UtranBands and EutranBands in IRadio interface, depending
+ // on the RAT used at the time.
+ optional int32 band = 7;
+
+ // Whether the data stall is recovered.
+ optional bool recovered = 8;
+
+ // The elapsed time between start of the data stall and result of current action.
+ optional int32 duration_millis = 9;
+}
+
+/**
+ * Pulls IMS registration terminations.
+ *
+ * Each pull generates multiple atoms, one for each termination condition happened during the day.
+ *
+ * Pulled from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
+ */
+message ImsRegistrationTermination {
+ // Carrier ID of the SIM used for IMS registration.
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 1;
+
+ // Whether the device is in multi-SIM mode when the registration terminated.
+ optional bool is_multi_sim = 2;
+
+ // Radio access technology (RAT) used by the registration when it terminated.
+ // This can be IWLAN if IMS was registered over Wifi.
+ optional android.telephony.NetworkTypeEnum rat_at_end = 3;
+
+ // Whether the IMS registration failed before it was established.
+ optional bool setup_failed = 4;
+
+ // IMS reason code indicating the termination reason.
+ // See: frameworks/base/telephony/java/android/telephony/ims/ImsReasonInfo.java
+ optional int32 reason_code = 5;
+
+ // IMS extra code indicating the termination reason.
+ optional int32 extra_code = 6;
+
+ // IMS extra message indicating the termination reason.
+ // This string is truncated to 128 characters if its length exceeds the limit.
+ optional string extra_message = 7;
+
+ // Total number of instances of registration termination that matches the above conditions.
+ optional int32 count = 8;
+}
+
+/**
+ * Pulls IMS registration statistics.
+ *
+ * Each pull generates multiple atoms, one for each carrier, SIM slot, and radio access technology
+ * (RAT) combination. Durations are aggregated from all registrations with matching criteria,
+ * including ones that are currently active.
+ *
+ * Pulled from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
+ */
+message ImsRegistrationStats {
+ // Carrier ID of the SIM used for IMS registration.
+ // See https://source.android.com/devices/tech/config/carrierid.
+ optional int32 carrier_id = 1;
+
+ // Index of the SIM used, 0 for single-SIM devices.
+ optional int32 sim_slot_index = 2;
+
+ // Radio access technology (RAT) used by the registration.
+ // This can be IWLAN if IMS was registered over Wifi.
+ optional android.telephony.NetworkTypeEnum rat = 3;
+
+ // Total time IMS was registered (connected time), rounded to 5 minutes.
+ optional int32 registered_seconds = 4;
+
+ // Durations that each feature (Voice, Video, UT, SMS) is capable (supported/enabled by the
+ // network/device) and available (registered and ready to use).
+ // All durations are rounded to 5 minutes and should be equal to or shorter than
+ // registered_seconds.
+ optional int32 voice_capable_seconds = 5;
+ optional int32 voice_available_seconds = 6;
+ optional int32 sms_capable_seconds = 7;
+ optional int32 sms_available_seconds = 8;
+ optional int32 video_capable_seconds = 9;
+ optional int32 video_available_seconds = 10;
+ optional int32 ut_capable_seconds = 11;
+ optional int32 ut_available_seconds = 12;
+}
+
+/*
+ * Logs information related to PIN storage and automatic PIN operations.
+ *
+ * Logged from:
+ * frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/PinStorage.java
+ */
+message PinStorageEvent {
+ // The type of event.
+ enum Event {
+ UNKNOWN = 0;
+ // The PIN was verified automatically successfully.
+ PIN_VERIFICATION_SUCCESS = 1;
+ // The PIN was verified automatically unsuccessfully.
+ PIN_VERIFICATION_FAILURE = 2;
+ // The PIN(s) was cached, but discarded after reboot (e.g. SIM not present after reboot).
+ CACHED_PIN_DISCARDED = 3;
+ // The PIN(s) was stored to be used after unattended reboot.
+ PIN_STORED_FOR_VERIFICATION = 4;
+ // The PIN(s) is not available for storage and will be required after unattended reboot.
+ PIN_REQUIRED_AFTER_REBOOT = 5;
+ // The PIN was not verified automatically because the SIM card did not match.
+ PIN_VERIFICATION_SKIPPED_SIM_CARD_MISMATCH = 6;
+ // The available PINs after reboot does not match the number of stored PINs before reboot.
+ PIN_COUNT_NOT_MATCHING_AFTER_REBOOT = 7;
+ // Error while decrypting the PIN
+ PIN_DECRYPTION_ERROR = 8;
+ // Error while encrypting the PIN
+ PIN_ENCRYPTION_ERROR = 9;
+ }
+ optional Event event = 1;
+
+ // Number of PINs stored or discarded.
+ optional int32 number_of_pins = 2;
+}
+
+/**
+ * Logs flip to screen off events.
+ *
+ * Logged from:
+ * frameworks/opt/telephony/src/java/com/android/server/power/FaceDownDetector.java
+ */
+message FaceDownReported {
+ enum Response{
+ UNKNOWN = 1;
+ // The phone was flipped before the screen turns off.
+ UNFLIP = 2;
+ // User interacts with the screen after a face down is detected.
+ USER_INTERACTION = 3;
+ // A flip leads to screen turning off. This is the expected outcome.
+ SCREEN_OFF = 4;
+ }
+
+ // Logs the action that occurs from a flip event, whether by user or system
+ // action.
+ optional Response face_down_response = 1;
+
+ // After a flip is detected, how long until a system or user action occurs.
+ optional int64 millis_since_flip = 2;
+
+ // Difference between the flip time and when the timeout would otherwise
+ // occur.
+ optional int64 millis_until_normal_timeout = 3;
+
+ // How quickly the user turns the screen back on after a flip event.
+ // A low value may indicate a false negative. Logged only when Response is
+ // SCREEN_OFF.
+ optional int64 millis_until_next_screen_on = 4;
+}
+
+/**
+ * Logs timeout extended events which occur from consecutive undims.
+ *
+ * Logged from:
+ * frameworks/opt/telephony/src/java/com/android/server/power/ScreenUndimDetector.java
+ */
+message TimeoutAutoExtendedReported {
+ enum Outcome {
+ UNKNOWN = 0;
+ POWER_BUTTON = 1;
+ TIMEOUT = 2;
+ }
+
+ // Logs the action that occurs after timeout is extended from undim.
+ optional Outcome outcome = 1;
+ // Time from timeout extension to the outcome.
+ optional int64 time_to_outcome_millis = 2;
+ // Time of first interaction after undim if an interaction occurs.
+ // -1 if no interaction occurs before screen turns off.
+ optional int64 time_to_first_interaction_millis = 3;
+}
+
+/**
* Logs gnss stats from location service provider
*
* Pulled from:
* frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
*/
-
message GnssStats {
// Number of location reports since boot
optional int64 location_reports = 1;
@@ -10321,6 +13336,76 @@
}
/**
+ * Logs power usage data from GNSS subsystem.
+ *
+ * Logged from:
+ * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
+ */
+message GnssPowerStats {
+ // Relative precision of the alignment of the reported power stats measurement.
+ optional int64 elapsed_realtime_uncertainty_nanos = 1;
+
+ // Total GNSS energy consumption in micro-joules (or micro Watt-seconds).
+ optional int64 total_energy_micro_joule = 2;
+
+ // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
+ // tracking signals of a single frequency band.
+ optional int64 singleband_tracking_mode_energy_micro_joule = 3;
+
+ // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
+ // tracking signals of multiple frequency bands.
+ optional int64 multiband_tracking_mode_energy_micro_joule = 4;
+
+ // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
+ // acquiring signals of a single frequency band.
+ optional int64 singleband_acquisition_mode_energy_micro_joule = 5;
+
+ // Total energy consumption in micro-joules (or micro Watt-seconds) for which the GNSS engine is
+ // acquiring signals of multiple frequency bands.
+ optional int64 multiband_acquisition_mode_energy_micro_joule = 6;
+
+ // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
+ // operating in each of the vendor-specific power modes. (Index 0)
+ optional int64 vendor_specific_power_modes_energy_micro_joule_0 = 7;
+
+ // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
+ // operating in each of the vendor-specific power modes. (Index 1)
+ optional int64 vendor_specific_power_modes_energy_micro_joule_1 = 8;
+
+ // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
+ // operating in each of the vendor-specific power modes. (Index 2)
+ optional int64 vendor_specific_power_modes_energy_micro_joule_2 = 9;
+
+ // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
+ // operating in each of the vendor-specific power modes. (Index 3)
+ optional int64 vendor_specific_power_modes_energy_micro_joule_3 = 10;
+
+ // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
+ // operating in each of the vendor-specific power modes. (Index 4)
+ optional int64 vendor_specific_power_modes_energy_micro_joule_4 = 11;
+
+ // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
+ // operating in each of the vendor-specific power modes. (Index 5)
+ optional int64 vendor_specific_power_modes_energy_micro_joule_5 = 12;
+
+ // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
+ // operating in each of the vendor-specific power modes. (Index 6)
+ optional int64 vendor_specific_power_modes_energy_micro_joule_6 = 13;
+
+ // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
+ // operating in each of the vendor-specific power modes. (Index 7)
+ optional int64 vendor_specific_power_modes_energy_micro_joule_7 = 14;
+
+ // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
+ // operating in each of the vendor-specific power modes. (Index 8)
+ optional int64 vendor_specific_power_modes_energy_micro_joule_8 = 15;
+
+ // Total energy consumption in micro-joules (microWatt-seconds) for which the GNSS engine is
+ // operating in each of the vendor-specific power modes. (Index 9)
+ optional int64 vendor_specific_power_modes_energy_micro_joule_9 = 16;
+}
+
+/**
* Logs when an app is moved to a different standby bucket.
*
* Logged from:
@@ -10457,6 +13542,8 @@
optional int32 return_code = 4;
// Total size of the APKs installed for this package
optional int64 apks_size_bytes = 5;
+ // UID of the package. -1 if the installation failed.
+ optional int32 uid = 6 [(is_uid) = true];
}
/**
@@ -10534,6 +13621,7 @@
FULL_RESTRICTED = 5;
PROFILE_MANAGED = 6;
SYSTEM_HEADLESS = 7;
+ PROFILE_CLONE = 8;
}
optional UserType user_type = 5;
// What are the flags attached to the target user
@@ -10765,7 +13853,7 @@
* Logs when the Media Output Switcher finishes a media switch operation.
*
* Logged from:
- * packages/apps/Settings/src/com/android/settings/media/MediaOutputSliceWorker.java
+ * packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputMetricLogger.java
*/
message MediaOutputOpSwitchReported {
// Source medium type before switching.
@@ -10892,6 +13980,11 @@
// The audio source for AudioRecord.
// An enumeration from system/media/audio/include/system/audio-base.h audio_source_t
optional string source = 12;
+
+ // Android S
+ // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
+ // An empty string means no session id is set.
+ optional string log_session_id = 13;
}
/**
@@ -11032,6 +14125,11 @@
// Only "static" is supported for R.
// See lookup<TRACK_TRAITS>() in frameworks/av/services/mediametrics/AudioTypes.cpp
optional string traits = 19;
+
+ // Android S
+ // Metric log session id, a Base64Url encoded string of a randomly generated 128-bit integer.
+ // An empty string means no session id is set.
+ optional string log_session_id = 20;
}
/**
@@ -11179,6 +14277,340 @@
optional int32 error_code = 14;
}
+/**
+ * Logs: key creation events with Algorithm, Origin, Error and Attestation info.
+ * Logged from: system/security/keystore2/metrics.rs
+ */
+message Keystore2KeyCreationWithGeneralInfo {
+
+ // Algorithm associated with the key
+ optional android.system.security.keystore2.Algorithm algorithm = 1;
+
+ // Size of the key, based on the algorithm used.
+ optional int32 key_size = 2;
+
+ enum EcCurve {
+ // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
+ EC_CURVE_UNSPECIFIED = 0;
+ P_224 = 1;
+ P_256 = 2;
+ P_384 = 3;
+ P_521 = 4;
+ };
+ // Which ec curve was selected if elliptic curve cryptography is in use
+ optional EcCurve ec_curve = 3;
+
+ enum KeyOrigin {
+ // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
+ ORIGIN_UNSPECIFIED = 0;
+ // Generated in keymaster. Should not exist outside the TEE.
+ GENERATED = 1;
+ // Derived inside keymaster. Likely exists off-device.
+ DERIVED = 2;
+ // Imported into keymaster. Existed as cleartext in Android.
+ IMPORTED = 3;
+ // Previously used for another purpose that is now obsolete.
+ RESERVED = 4;
+ // Securely imported into Keymaster.
+ SECURELY_IMPORTED = 5;
+ };
+ // Logs whether the key was generated, imported, securely imported, or derived.
+ optional KeyOrigin key_origin = 4;
+
+ /**
+ * Response code (system/hardware/interfaces/keystore2/aidl/../ResponseCode.aidl)
+ * or
+ * error code (hardware/interfaces/security/keymint/aidl/../ErrorCode.aidl)
+ */
+ optional int32 error_code = 5;
+
+ // Indicates whether key attestation is requested in creation
+ optional bool attestation_requested = 6;
+
+ // Count of a particular combination of field values of this atom
+ optional int32 count = 7;
+}
+
+/**
+ * Logs: key creation events with authentication info.
+ * Logged from: system/security/keystore2/metrics.rs
+ */
+message Keystore2KeyCreationWithAuthInfo {
+
+ enum HardwareAuthenticatorType {
+ // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
+ AUTH_TYPE_UNSPECIFIED = 0;
+ NONE = 1;
+ PASSWORD = 2;
+ FINGERPRINT = 3;
+ ANY = 5;
+ };
+ /**
+ * What auth types does this key require? If none,
+ * then no auth required.
+ */
+ optional HardwareAuthenticatorType user_auth_type = 1;
+
+ /**
+ * If user authentication is required, is the requirement time based? If it
+ * is time based then this field indicates the base 10 logarithm of time out in seconds.
+ * Logarithm is taken in order to reduce the cardinaltiy.
+ */
+ optional int32 log_auth_timeout_seconds = 2;
+
+ // Security level of the Keymint instance which creates the key.
+ optional android.system.security.keystore2.SecurityLevelEnum security_level = 3;
+
+ // Count of a particular combination of field values of this atom
+ optional int32 count = 4;
+}
+
+/**
+ * Logs: key creation events with purpose and modes info.
+ * Logged from: system/security/keystore2/metrics.rs
+ */
+message Keystore2KeyCreationWithPurposeAndModesInfo {
+ // Algorithm associated with the key
+ optional android.system.security.keystore2.Algorithm algorithm = 1;
+
+ /**
+ * Track which purpose is being used.
+ * Bitmap composition is given by KeyPurposeBitPosition enum
+ * defined in system/security/keystore2/metrics.rs.
+ */
+ optional int32 purpose_bitmap = 2;
+
+ /**
+ * Track which padding mode is being used.
+ * Bitmap composition is given by PaddingModeBitPosition enum
+ * defined in system/security/keystore2/metrics.rs.
+ */
+ optional int32 padding_mode_bitmap = 3;
+
+ /**
+ * Track which digest is being used.
+ * Bitmap composition is given by DigestBitPosition enum
+ * defined in system/security/keystore2/metrics.rs.
+ */
+ optional int32 digest_bitmap = 4;
+
+ /**
+ * Track which block mode is being used.
+ * Bitmap composition is given by BlockModeBitPosition enum
+ * defined in system/security/keystore2/metrics.rs.
+ */
+ optional int32 block_mode_bitmap = 5;
+
+ // Count of a particular combination of field values of this atom
+ optional int32 count = 6;
+}
+
+/**
+ * Logs the atom id of the atoms associated with key creation/operation events, that have reached
+ * the maximum storage limit allocated for different atom objects of that atom,
+ * in keystore in-memory store.
+ *
+ * Size of the storage bucket for each atom is limited considering their expected cardinaltity.
+ * This limit may exceed if the dimensions of the atoms take a large number of unexpected
+ * combinations. This atom is used to track such cases.
+ */
+message Keystore2AtomWithOverflow {
+
+ // Atom id as defined in atoms.proto
+ optional int32 atom_id = 1;
+
+ // Count of the objects of this atom type that have overflowed.
+ optional int32 count = 2;
+}
+
+/**
+ * Logs: key operations events with purpose and modes info.
+ * Logged from: system/security/keystore2/metrics.rs
+ */
+message Keystore2KeyOperationWithPurposeAndModesInfo {
+
+ enum KeyPurpose {
+ // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
+ KEY_PURPOSE_UNSPECIFIED = 0;
+
+ // Usable with RSA, 3DES and AES keys.
+ ENCRYPT = 1;
+
+ // Usable with RSA, 3DES and AES keys.
+ DECRYPT = 2;
+
+ // Usable with RSA, EC and HMAC keys.
+ SIGN = 3;
+
+ // Usable with RSA, EC and HMAC keys.
+ VERIFY = 4;
+
+ // 5 is reserved
+ // Usable with RSA keys.
+ WRAP_KEY = 6;
+
+ // Key Agreement, usable with EC keys.
+ AGREE_KEY = 7;
+
+ // Usable as an attestation signing key.
+ ATTEST_KEY = 8;
+ }
+ // Purpose of the key operation
+ optional KeyPurpose purpose = 1;
+
+ /**
+ * Track which padding mode is being used.
+ * Bitmap composition is given by PaddingModeBitPosition enum
+ * defined in system/security/keystore2/metrics.rs.
+ */
+ optional int32 padding_mode_bitmap = 2;
+
+ /**
+ * Track which digest is being used.
+ * Bitmap composition is given by DigestBitPosition enum
+ * defined in system/security/keystore2/metrics.rs.
+ */
+ optional int32 digest_bitmap = 3;
+
+ /**
+ * Track which block mode is being used.
+ * Bitmap composition is given by BlockModeBitPosition enum
+ * defined in system/security/keystore2/metrics.rs.
+ */
+ optional int32 block_mode_bitmap = 4;
+
+ // Count of a particular combination of field values of this atom
+ optional int32 count = 5;
+}
+
+/**
+ * Logs key operations events with outcome, error_code, security level and whether the key is
+ * upgraded during the operation.
+ * Logged from: system/security/keystore2/metrics.rs
+ */
+message Keystore2KeyOperationWithGeneralInfo {
+
+ enum Outcome {
+ OUTCOME_UNSPECIFIED = 0;
+ DROPPED = 1;
+ SUCCESS = 2;
+ ABORT = 3;
+ PRUNED = 4;
+ ERROR = 5;
+ }
+ // Outcome of the operation
+ optional Outcome outcome = 1;
+
+ // Response code or error code in case of error outcome
+ optional int32 error_code = 2;
+
+ // Indicates whether the key was upgraded during the operation
+ optional bool key_upgraded = 3;
+
+ // Security level of the Keymint instance which performs the operation.
+ optional android.system.security.keystore2.SecurityLevelEnum security_level = 4;
+
+ // Count of a particular combination of field values of this atom
+ optional int32 count = 5;
+}
+
+/**
+ * Logs: Keystore 2 storage statistics.
+ * Logged from: system/security/keystore2
+ */
+message Keystore2StorageStats {
+ enum Storage {
+ STORAGE_UNSPECIFIED = 0;
+ KEY_ENTRY = 1;
+ KEY_ENTRY_ID_INDEX = 2;
+ KEY_ENTRY_DOMAIN_NAMESPACE_INDEX = 3;
+ BLOB_ENTRY = 4;
+ BLOB_ENTRY_KEY_ENTRY_ID_INDEX = 5;
+ KEY_PARAMETER = 6;
+ KEY_PARAMETER_KEY_ENTRY_ID_INDEX = 7;
+ KEY_METADATA = 8;
+ KEY_METADATA_KEY_ENTRY_ID_INDEX = 9;
+ GRANT = 10;
+ AUTH_TOKEN = 11;
+ BLOB_METADATA = 12;
+ BLOB_METADATA_BLOB_ENTRY_ID_INDEX =13;
+ METADATA = 14;
+ DATABASE = 15;
+ LEGACY_STORAGE = 16;
+ }
+ // Type of the storage (database table or legacy storage) of which the size is reported.
+ optional Storage storage_type = 1;
+ // Storage size in bytes
+ optional int64 size = 2;
+ // Unused space, in bytes. The total storage size may be larger, indicating
+ // inefficiencies in the packing of data in the database.
+ optional int64 unused_size = 3;
+}
+
+/**
+ * Logs Remote Key Provisioning (RKP) related error events.
+ * Logged from: system/security/keystore2
+ */
+message RkpErrorStats {
+
+ enum RkpError {
+ RKP_ERROR_UNSPECIFIED = 0;
+ // The key pool is out of keys.
+ OUT_OF_KEYS = 1;
+ // Falling back to factory provisioned keys during hybrid mode.
+ FALL_BACK_DURING_HYBRID = 2;
+ }
+ // Type of the error event
+ optional RkpError rkp_error = 1;
+
+ // Count of a particular error occurred.
+ optional int32 count = 2;
+}
+
+/**
+ * Logs: Status of the attestation key pool related to
+ * Remote Key Provisioning (RKP).
+ * Logged from: system/security/keystore2
+ */
+message RkpPoolStats {
+ /**
+ * Security level of the Keymint instance associated with the
+ * attestation pool status.
+ */
+ optional android.system.security.keystore2.SecurityLevelEnum security_level = 1;
+
+ /**
+ * The number of signed attestation certificate chains which are
+ * expired.
+ */
+ optional int32 expiring = 2;
+
+ /**
+ * The number of signed attestation certificate chains which have
+ * not yet been assigned to an app.
+ */
+ optional int32 unassigned = 3;
+
+ /**
+ * The number of signed attestation keys.
+ */
+ optional int32 attested = 4;
+
+ /**
+ * The total number of attestation keys.
+ */
+ optional int32 total = 5;
+
+}
+
+/**
+ * Logs: Number of keystore2 crashes per-boot cycle.
+ * Logged from: system/security/keystore2
+ */
+message Keystore2CrashStats {
+ optional int32 count_of_crash_events = 1;
+}
+
// Blob Committer stats
// Keep in sync between:
// frameworks/proto_logging/stats/enums/server/blobstoremanagerservice.proto
@@ -11242,10 +14674,181 @@
optional int64 expiry_timestamp_millis = 3;
// List of committers of this Blob
- optional BlobCommitterListProto committers = 4;
+ optional BlobCommitterListProto committers = 4 [(log_mode) = MODE_BYTES];
// List of leasees of this Blob
- optional BlobLeaseeListProto leasees = 5;
+ optional BlobLeaseeListProto leasees = 5 [(log_mode) = MODE_BYTES];
+}
+
+/**
+ * Logs when the HDMI CEC active source changes.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
+ */
+message HdmiCecActiveSourceChanged {
+ // The logical address of the active source.
+ optional android.stats.hdmi.LogicalAddress active_source_logical_address = 1;
+
+ // The physical address of the active source. Consists of four hexadecimal nibbles.
+ // Examples: 0x1234, 0x0000 (root device). 0xFFFF represents an unknown or invalid address.
+ // See section 8.7 in the HDMI 1.4b spec for details.
+ optional int32 active_source_physical_address = 2;
+
+ // The relationship between this device and the active source.
+ optional android.stats.hdmi.PathRelationship local_relationship = 3;
+}
+
+/**
+ * Logs when an HDMI CEC message is sent or received.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
+ */
+message HdmiCecMessageReported {
+ // The calling uid of the application that caused this atom to be written.
+ optional int32 uid = 1 [(is_uid) = true];
+
+ // Whether a HDMI CEC message is sent from this device, to this device, or neither.
+ optional android.stats.hdmi.MessageDirection direction = 2;
+
+ // The HDMI CEC logical address of the initiator.
+ optional android.stats.hdmi.LogicalAddress initiator_logical_address = 3;
+
+ // The HDMI CEC logical address of the destination.
+ optional android.stats.hdmi.LogicalAddress destination_logical_address = 4;
+
+ // The opcode of the message. Ranges from 0x00 to 0xFF.
+ // For all values, see section "CEC 15 Message Descriptions" in the HDMI CEC 1.4b spec.
+ optional int32 opcode = 5;
+
+ // The result of attempting to send the message on its final retransmission attempt.
+ // Only applicable to outgoing messages; set to SEND_MESSAGE_RESULT_UNKNOWN otherwise.
+ optional android.stats.hdmi.SendMessageResult send_message_result = 6;
+
+ // Fields specific to <User Control Pressed> messages
+
+ // The user control command that was received.
+ optional android.stats.hdmi.UserControlPressedCommand user_control_pressed_command = 7;
+
+ // Fields specific to <Feature Abort> messages
+
+ // The opcode of the message that was feature aborted.
+ // Set to 0x100 when unknown or not applicable.
+ optional int32 feature_abort_opcode = 8;
+
+ // The reason for the feature abort.
+ optional android.stats.hdmi.FeatureAbortReason feature_abort_reason = 9;
+}
+
+/**
+ * Logs when an auto rotate event occurs while smart auto rotate is enabled.
+ */
+message AutoRotateReported {
+ enum Orientation {
+ UNKNOWN = 0;
+ DEPRECATED = 1;
+ ROTATION_0 = 2;
+ ROTATION_90 = 3;
+ ROTATION_180 = 4;
+ ROTATION_270 = 5;
+ DISABLED = 6;
+ UNAVAILABLE = 7;
+ FAILURE = 8;
+ }
+
+ // Orientation of the device when a rotation was detected.
+ optional Orientation current_orientation = 1;
+ // The orientation of the phone after rotation before going through the recommendation service.
+ optional Orientation proposed_orientation = 2;
+ // Orientation recommended by the smart autorotate service component outside of the platform. It
+ // may or may not match the proposed_orientation. Can be disabled or unavailable if the
+ // recommendation service is disabled or unavailable. Will be unknown if the service failed.
+ optional Orientation recommended_orientation = 3;
+ // Time taken to calculate the rotation recommendation.
+ optional int64 recommendation_process_duration_millis = 4;
+}
+
+/**
+ * Logs when sensors only autorotate is triggered. Associated event can be a rotation preindication,
+ * actual event or a "data ready to be pulled" indication. More info: go/autorotate-logging.
+ *
+ * Logged from:
+ * platform/vendor/unbundled_google/packages/SystemUIGoogle/src/com/google/android/systemui/autorotate/DataLogger.java
+ */
+
+message DeviceRotated {
+ // Timestamp of the event in millis. We log the timestamp explicitly since
+ // data logging will follow the event logging and all these
+ // will be joined with other logs such as rotation button clicked.
+ optional int64 timestamp_millis = 1;
+ // Device orientation
+ optional android.stats.wm.Orientation proposed_orientation = 2;
+
+ enum RotationEventType{
+ UNKNOWN = 0;
+ // An early indication of device might be rotated.
+ PREINDICATION = 1;
+ // Device rotation is detected.
+ ACTUAL_EVENT = 2;
+ // Device rotated and the data associated with it is ready to be pulled.
+ // This happens after the ACTUAL_EVENT since some data after the event is
+ // also useful.
+ DATA_READY = 3;
+ }
+ optional RotationEventType rotation_event_type = 3;
+}
+
+/**
+ * Records the raw sensor data published by the device orientation debug sensor. The pull will be
+ * configured to be conditioned on the {@code DeviceRotated} atom.
+ *
+ * Logged from:
+ * platform/vendor/unbundled_google/packages/SystemUIGoogle/src/com/google/android/systemui/autorotate/DataLogger.java
+ */
+message DeviceRotatedData {
+ // All the sensor data and timestamps used to calculate the orientation
+ optional DeviceRotatedSensorData snapshot = 1 [(log_mode) = MODE_BYTES];
+ // Resulting orientation
+ optional android.stats.wm.Orientation proposed_orientation = 2;
+}
+
+message DeviceRotatedSensorData {
+ optional DeviceRotatedSensorHeader header = 1 [(log_mode) = MODE_BYTES];
+ repeated DeviceRotatedSensorSample sample = 2 [(log_mode) = MODE_BYTES];
+}
+
+message DeviceRotatedSensorHeader {
+ optional int64 timestamp_base_millis = 1;
+}
+
+message DeviceRotatedSensorSample{
+ optional int32 timestamp_offset_millis = 1;
+ enum SensorType {
+ UNKNOWN = 0;
+ ACCEL = 1;
+ GYRO = 2;
+ }
+ optional SensorType sensor_type = 2;
+ optional float x_value = 3;
+ optional float y_value = 4;
+ optional float z_value = 5;
+}
+
+/**
+ * Pushes TLS handshake counters from Conscrypt.
+ * Pulled from:
+ * external/conscrypt/common/src/main/java/org/conscrypt/ConscryptEngineSocket.java
+ * external/conscrypt/common/src/main/java/org/conscrypt/ConscryptFileDescriptorSocket.java
+ */
+message TlsHandshakeReported {
+ optional bool success = 1;
+
+ optional android.stats.tls.Protocol protocol = 2;
+
+ optional android.stats.tls.CipherSuite cipher_suite = 3;
+
+ optional int32 handshake_duration_millis = 4;
}
/**
@@ -11274,3 +14877,1755 @@
optional int64 latency_millis = 3;
optional string session_id = 4;
}
+
+/**
+ * Logs when TextClassifier Model Downloader schedule/finish a task.
+ *
+ * Logged from: external/libtextclassifier/java/
+ */
+message TextClassifierDownloadReported {
+ // The model type to download
+ enum ModelType {
+ UNKNOWN_MODEL_TYPE = 0;
+ ANNOTATOR = 1;
+ LANG_ID = 2;
+ ACTIONS_SUGGESTIONS = 3;
+ }
+ optional ModelType model_type = 1;
+ // The file type to download
+ enum FileType {
+ UNKNOWN_FILE_TYPE = 0;
+ MANIFEST = 1;
+ MODEL = 2;
+ }
+ optional FileType file_type = 2;
+ // The status of the download
+ enum DownloadStatus {
+ UNKNOWN_STATUS = 0;
+ SCHEDULED = 1;
+ SUCCEEDED = 2;
+ FAILED_AND_RETRY = 3;
+ FAILED_AND_ABORT = 4;
+ }
+ optional DownloadStatus download_status = 3;
+ // The suffix of the url (without namespace) to download from, which contains model version and
+ // locale info (e.g. 'r/v803/en.fb'). We use this to uniquely identify a model/manifest file.
+ optional string url_suffix = 4;
+ // Failure reason, only set if this is for a failure status
+ enum FailureReason {
+ UNKNOWN_FAILURE_REASON = 0;
+ FAILED_TO_SCHEDULE = 1;
+ FAILED_TO_DOWNLOAD_SERVICE_CONN_BROKEN = 2;
+ FAILED_TO_DOWNLOAD_404_ERROR = 3;
+ FAILED_TO_DOWNLOAD_OTHER = 4;
+ DOWNLOADED_FILE_MISSING = 5;
+ FAILED_TO_PARSE_MANIFEST = 6;
+ FAILED_TO_VALIDATE_MODEL = 7;
+ FAILED_TO_MOVE_MODEL = 8;
+ WORKER_STOPPED = 9;
+ }
+ optional FailureReason failure_reason = 5;
+ // How many attempts we have tried for the same task at a terminal status (i.e. SUCCEEDED or
+ // FAILED_AND_ABORT).
+ optional int32 run_attempt_count = 6;
+}
+
+/**
+ * Logs the current state of an application before it is killed.
+ *
+ * Pushed from:
+ * packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
+ */
+message KilledAppStatsReported {
+ // Linux process uid for the package.
+ optional int32 uid = 1 [(is_uid) = true];
+
+ // Name of the package that was killed.
+ optional string package_name = 2;
+
+ // State of the application when it was killed.
+ enum AppState {
+ UNKNOWN_APP_STATE = 0;
+ BACKGROUND = 1;
+ FOREGROUND = 2;
+ }
+ optional AppState app_state = 3;
+
+ // System state indicating whether the system was in normal mode or garage mode.
+ enum SystemState {
+ UNKNOWN_SYSTEM_STATE = 0;
+ USER_INTERACTION_MODE = 1;
+ NO_USER_INTERACTION_MODE = 2;
+ }
+ optional SystemState system_state = 4;
+
+ // Reason for killing the application.
+ // Keep in sync between:
+ // packages/services/Car/watchdog/server/src/ApplicationTerminator.h
+ // frameworks/base/cmds/statsd/src/atoms.proto
+ enum KillReason {
+ UNKNOWN_KILL_REASON = 0;
+ KILLED_ON_ANR = 1;
+ KILLED_ON_IO_OVERUSE = 2;
+ KILLED_ON_MEMORY_OVERUSE = 3;
+ }
+ optional KillReason kill_reason = 5;
+
+ // Stats of the processes owned by the application when the application was killed.
+ // The process stack traces are not collected when the application was killed due to IO_OVERUSE.
+ optional ProcessStats process_stat = 6 [(log_mode) = MODE_BYTES];
+
+ // The application's I/O overuse stats logged only when the kill reason is KILLED_ON_IO_OVERUSE.
+ optional IoOveruseStats io_overuse_stats = 7 [(log_mode) = MODE_BYTES];
+}
+
+/**
+ * Logs the I/O overuse stats for an application on detecting I/O overuse.
+ *
+ * Pushed from:
+ * packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
+ */
+message IoOveruseStatsReported {
+ // Linux process uid for the package.
+ optional int32 uid = 1 [(is_uid) = true];
+
+ // The application's I/O overuse stats.
+ optional IoOveruseStats io_overuse_stats = 2 [(log_mode) = MODE_BYTES];
+}
+
+/**
+ * Logs I/O overuse stats for a package.
+ *
+ * Keep in sync between:
+ * packages/services/Car/cpp/watchdog/server/src/proto/statsd.proto
+ * frameworks/base/cmds/statsd/src/atoms.proto
+ *
+ * Logged from:
+ * packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
+ */
+message IoOveruseStats {
+ enum Period {
+ DAILY = 0;
+ WEEKLY = 1;
+ }
+
+ // Threshold and usage stats period.
+ optional Period period = 1;
+
+ // Threshold in-terms of write bytes defined for the package.
+ optional PerStateBytes threshold = 2;
+
+ // Number of write bytes in each state for the specified period.
+ optional PerStateBytes written_bytes = 3;
+};
+
+/**
+ * Logs bytes attributed to each application and system states.
+ *
+ * Keep in sync between:
+ * packages/services/Car/watchdog/server/src/proto/statsd.proto
+ * frameworks/base/cmds/statsd/src/atoms.proto
+ *
+ * Logged from:
+ * packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
+ */
+message PerStateBytes {
+ // Number of bytes attributed to the application foreground.
+ optional int64 foreground_bytes = 1;
+
+ // Number of bytes attributed to the application background.
+ optional int64 background_bytes = 2;
+
+ // Number of bytes attributed to the garage mode.
+ optional int64 garage_mode_bytes = 3;
+}
+
+/**
+ * Logs each ProcessStat in ProcessStats.
+ *
+ * Keep in sync between:
+ * packages/services/Car/watchdog/server/src/proto/statsd.proto
+ * frameworks/base/cmds/statsd/src/atoms.proto
+ *
+ * Logged from:
+ * packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
+ */
+message ProcessStats {
+ // Records the stats of the processes owned by an application.
+ repeated ProcessStat process_stat = 1;
+}
+
+/**
+ * Logs a process's stats.
+ *
+ * Keep in sync between:
+ * packages/services/Car/watchdog/server/src/proto/statsd.proto
+ * frameworks/base/cmds/statsd/src/atoms.proto
+ *
+ * Logged from:
+ * packages/services/Car/cpp/watchdog/server/src/StatsReporter.cpp
+ */
+message ProcessStat {
+ // Command name of the process.
+ optional string process_name = 1;
+
+ // Process uptime.
+ optional uint64 uptime_milliseconds = 2;
+
+ // Number of major page faults caused by the process and its children.
+ optional uint64 major_page_faults = 3;
+
+ // Peak virtual memory size in kb.
+ optional uint64 vm_peak_kb = 4;
+
+ // Virtual memory size in kb.
+ optional uint64 vm_size_kb = 5;
+
+ // Peak resident set size (high water mark) in kb.
+ optional uint64 vm_hwm_kb = 6;
+
+ // Resident set size in kb.
+ optional uint64 vm_rss_kb = 7;
+}
+
+/*
+ * pushes Media playback information.
+ * Logged from
+ * frameworks/base/services/core/java/com/android/server/media/metrics/
+ * MediaMetricsManagerService.java
+ */
+message MediametricsPlaybackReported {
+ optional int32 uid = 1 [(is_uid) = true];
+
+ // Randomly generated log session ID. A Base64 encoded hex string representing a
+ // 128-bit integer.
+ optional string log_session_id = 2;
+ // The total length of the media in milliseconds. 0 for live contents.
+ optional int64 media_duration_millis = 3;
+ // Network, device, or mixed.
+ optional android.stats.mediametrics.StreamSourceType stream_source = 4;
+ // Stream type. DASH, HLS, etc
+ optional android.stats.mediametrics.StreamType stream_type = 5;
+ // Live, VOD, others
+ optional android.stats.mediametrics.PlaybackType playback_type = 6;
+ // DRM type
+ optional android.stats.mediametrics.DrmType drm_type = 7;
+ // Main, AD, others
+ optional android.stats.mediametrics.ContentType content_type = 8;
+ // Player name. E.g. ExoPlayer
+ optional string player_name = 9;
+ // Player version. E.g. 1.10.3e
+ optional string player_version = 10;
+ // Player related experiment IDs
+ optional Experiments experiment_ids = 11 [(log_mode) = MODE_BYTES];
+ // Number of frames played. Dropped frames included. -1 means unknown.
+ optional int32 video_frames_played = 12;
+ // Number of frames dropped. -1 means unknown.
+ optional int32 video_frames_dropped = 13;
+ // Number of audio underruns. -1 means unknown.
+ optional int32 audio_underrun_count = 14;
+ // Total number of bytes read from the network
+ optional int64 network_bytes_read = 15;
+ // Total number of bytes read from on-device sources
+ optional int64 local_bytes_read = 16;
+ // Total transfer spent reading from the network in ms.
+ // For parallel requests, the overlapping time intervals are counted only once.
+ optional int64 network_transfer_duration_millis = 17;
+ // A session ID generated from DRM to distinguish different DRM sessions.
+ optional string drm_session_id = 18;
+}
+
+message MediaNetworkInfoChanged {
+ // Randomly generated log session ID. A Base64 encoded hex string representing a
+ // 128-bit integer.
+ optional string log_session_id = 1;
+ // New network type
+ optional android.stats.mediametrics.NetworkType type = 2;
+ // Network Start time, relative to playback creation time in millisecond.
+ // It's in absolute time (e.g. always ticks even if the playback is paused).
+ optional int64 time_since_playback_created_millis = 3;
+}
+
+message MediaPlaybackStateChanged {
+ // Randomly generated log session ID. A Base64 encoded hex string representing a
+ // 128-bit integer.
+ optional string log_session_id = 1;
+ // New playback state
+ optional android.stats.mediametrics.PlaybackState playback_state = 2;
+ // State change time, relative to playback creation time in millisecond.
+ // It's in absolute time (e.g. always ticks even if the playback is paused).
+ optional int64 time_since_playback_created_millis = 3;
+}
+
+message MediaPlaybackErrorReported {
+ // Randomly generated log session ID. A Base64 encoded hex string representing a
+ // 128-bit integer.
+ optional string log_session_id = 1;
+ // A shortened call stack of the error
+ optional string exception_stack = 2;
+ // Error code
+ optional android.stats.mediametrics.PlaybackErrorCode error_code = 3;
+ // Sub-code of error type specified by the error code.
+ optional int32 sub_error_code = 4;
+ // Error time, relative to playback creation time in millisecond.
+ // It's in absolute time (e.g. always ticks even if the playback is paused).
+ optional int64 time_since_playback_created_millis = 5;
+}
+
+message MediaPlaybackTrackChanged {
+ // Randomly generated log session ID. A Base64 encoded hex string representing a
+ // 128-bit integer.
+ optional string log_session_id = 1;
+ // The track is on or off after the change
+ optional android.stats.mediametrics.TrackState state = 2;
+ // The reason of the track change
+ optional android.stats.mediametrics.TrackChangeReason reason = 3;
+ // The MIME type of the container. E.g. video/mp4
+ optional string container_mime_type = 4;
+ // The sample MIME type of the track. E.g. video/avc
+ optional string sample_mime_type = 5;
+
+ // Codec name
+ optional string codec_name = 6;
+ // Bits per second. 0 means unknown.
+ optional int32 bitrate = 7;
+
+ // Track change time, relative to playback creation time in millisecond.
+ // It's in absolute time (e.g. always ticks even if the playback is paused).
+ optional int64 time_since_playback_created_millis = 8;
+
+ // Track type. Audio, Video, Text
+ optional android.stats.mediametrics.TrackType type = 9;
+ // 2-letter ISO 639-1 language code.
+ optional string language = 10;
+ // IETF BCP 47 optional language region subtag based on a two-letter country code
+ optional string language_region = 11;
+ // Number of channels
+ optional int32 channel_count = 12;
+ // Samples per second
+ optional int32 sample_rate = 13;
+ // The width of the video in pixels.
+ optional int32 width = 14;
+ // The height of the video in pixels.
+ optional int32 height = 15;
+ // Video frame rate in frames per second.
+ optional float video_frame_rate = 16;
+}
+
+message Experiments {
+ // Experiment IDs sent by the player.
+ repeated int64 experiments = 1;
+}
+
+/**
+ * Logs when a Wifi network scan happens.
+ *
+ * Logged from:
+ * frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
+ */
+message WifiScanReported {
+ enum Type {
+ TYPE_UNKNOWN = 0;
+
+ // Single scan.
+ TYPE_SINGLE = 1;
+
+ // Background scan (deprecated, should not happen).
+ TYPE_BACKGROUND = 2;
+ }
+
+ enum Result {
+ RESULT_UNKNOWN = 0;
+
+ // Failed to start scan.
+ RESULT_FAILED_TO_START = 1;
+
+ // The HAL reported a scan failure after the scan was started.
+ RESULT_FAILED_TO_SCAN = 2;
+
+ // Scan succeeded.
+ RESULT_SUCCESS = 3;
+ }
+
+ enum Source {
+ SOURCE_UNKNOWN = 0;
+
+ // No work source set - not possible to determine the origin.
+ SOURCE_NO_WORK_SOURCE = 1;
+
+ // The Wifi stack.
+ SOURCE_WIFI_STACK = 2;
+
+ // GMS on behalf of some other app.
+ SOURCE_GMS = 3;
+
+ // Settings app.
+ SOURCE_SETTINGS_APP = 4;
+
+ // Other app directly.
+ SOURCE_OTHER_APP = 5;
+ }
+
+ enum Importance {
+ IMPORTANCE_UNKNOWN = 0;
+
+ // Foreground app. Corresponds to the value of
+ // ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND or less.
+ IMPORTANCE_FOREGROUND = 1;
+
+ // Foreground service. Corresponds to the value of
+ // ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE
+ IMPORTANCE_FOREGROUND_SERVICE = 2;
+
+ // Everything else.
+ IMPORTANCE_BACKGROUND = 3;
+ }
+
+ // Scan type
+ optional Type type = 1;
+
+ // Outcome: success/failure
+ optional Result result = 2;
+
+ // What initiated a scan.
+ optional Source source = 3;
+
+ // Process importance of the initiator.
+ // This is only available for non-system calls.
+ optional Importance importance = 4;
+
+ // Time taken for the scan.
+ optional int32 scan_duration_millis = 5;
+
+ // Count of found networks.
+ optional int32 count_networks_found = 6;
+}
+
+/**
+ * Logs when a Wifi PNO (Preferred Network Offload) scan happens.
+ *
+ * Logged from:
+ * frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMetrics.java
+ */
+message WifiPnoScanReported {
+ enum State {
+ UNKNOWN = 0;
+
+ // Scan started.
+ STARTED = 1;
+
+ // Scan failed to start (e.g. bad request, unsupported by hardware, etc).
+ FAILED_TO_START = 2;
+
+ // Scan completed and a network was found.
+ // Note - due to implementation constraints, nothing is reported when a scan completes but
+ // doesn't find any networks.
+ FINISHED_NETWORKS_FOUND = 3;
+
+ // Scan failed.
+ FAILED = 4;
+ }
+
+ optional State state = 1;
+}
+
+/**
+ * Logs when the entitlement configuration of an IMS service is queried/updated.
+ *
+ * Logged from: ImsServiceEntitlement app
+ */
+message ImsServiceEntitlementUpdated {
+ // The purpose of entitlement query/update
+ enum Purpose {
+ UNKNOWN_PURPOSE = 0;
+
+ // Initial service activation in foreground
+ ACTIVATION = 1;
+
+ // Updating service configuration in foreground
+ UPDATE = 2;
+
+ // Background polling for querying service entitlement
+ POLLING = 3;
+ }
+
+ // The IMS services
+ enum ServiceType {
+ UNKNOWN_SERVICE = 0;
+ VOWIFI = 1;
+ VOLTE = 2;
+ SMSOIP = 3;
+ }
+
+ // The result of activation
+ enum AppResult {
+ UNKNOWN_RESULT = 0;
+ ENABLED = 1;
+ DISABLED = 2;
+ INCOMPATIBLE = 3;
+ PROVISIONING = 4;
+ SUCCESSFUL = 5;
+ FAILED = 6;
+ CANCELED = 7;
+ TIMEOUT = 8;
+ UNEXPECTED_RESULT = 9;
+ }
+
+ // The Android carrier ID for the carrier providing the IMS service.
+ // This may not be the actual carrier of the device, e.g. a MVNO
+ // may use the IMS service of its MNO.
+ optional int64 carrier_id = 1;
+
+ // The Android carrier ID of the actual carrier.
+ // E.g. a MVNO may use its MNO's IMS service. In this case,
+ // actual_carrier_id is the MVNO and carrier_id is the MNO.
+ optional int64 actual_carrier_id = 2;
+
+ // The purpose of this query/update.
+ optional Purpose purpose = 3;
+
+ // Which IMS service's entitlement status were queried/updated.
+ optional ServiceType service_type = 4;
+
+ // Result of this query/update.
+ optional AppResult app_result = 5;
+
+ // How long (in milliseconds) this query/update took.
+ optional int64 duration_millis = 6;
+}
+
+// Indicates which compile filter was used for the package being loaded in an ART session.
+enum ArtCompileFilter {
+ ART_COMPILATION_FILTER_ERROR = 1;
+ ART_COMPILATION_FILTER_UNKNOWN = 2;
+ ART_COMPILATION_FILTER_ASSUMED_VERIFIED = 3;
+ ART_COMPILATION_FILTER_EXTRACT = 4;
+ ART_COMPILATION_FILTER_VERIFY = 5;
+ ART_COMPILATION_FILTER_QUICKEN = 6;
+ ART_COMPILATION_FILTER_SPACE_PROFILE = 7;
+ ART_COMPILATION_FILTER_SPACE = 8;
+ ART_COMPILATION_FILTER_SPEED_PROFILE = 9;
+ ART_COMPILATION_FILTER_SPEED = 10;
+ ART_COMPILATION_FILTER_EVERYTHING_PROFILE = 11;
+ ART_COMPILATION_FILTER_EVERYTHING = 12;
+ ART_COMPILATION_FILTER_FAKE_RUN_FROM_APK = 13;
+ ART_COMPILATION_FILTER_FAKE_RUN_FROM_APK_FALLBACK = 14;
+ ART_COMPILATION_FILTER_FAKE_RUN_FROM_VDEX_FALLBACK = 15;
+}
+
+enum ArtCompilationReason {
+ ART_COMPILATION_REASON_ERROR = 1;
+ ART_COMPILATION_REASON_UNKNOWN = 2;
+ ART_COMPILATION_REASON_FIRST_BOOT = 3;
+ ART_COMPILATION_REASON_BOOT = 4;
+ ART_COMPILATION_REASON_INSTALL = 5;
+ ART_COMPILATION_REASON_BG_DEXOPT = 6;
+ ART_COMPILATION_REASON_AB_OTA = 7;
+ ART_COMPILATION_REASON_INACTIVE = 8;
+ ART_COMPILATION_REASON_SHARED = 9;
+ ART_COMPILATION_REASON_INSTALL_WITH_DEX_METADATA = 10;
+ ART_COMPILATION_REASON_POST_BOOT = 11;
+ ART_COMPILATION_REASON_INSTALL_FAST = 12;
+ ART_COMPILATION_REASON_INSTALL_BULK = 13;
+ ART_COMPILATION_REASON_INSTALL_BULK_SECONDARY = 14;
+ ART_COMPILATION_REASON_INSTALL_BULK_DOWNGRADED = 15;
+ ART_COMPILATION_REASON_INSTALL_BULK_SECONDARY_DOWNGRADED = 16;
+ ART_COMPILATION_REASON_BOOT_AFTER_OTA = 17;
+ ART_COMPILATION_REASON_PREBUILT = 18;
+ ART_COMPILATION_REASON_CMDLINE = 19;
+}
+
+// Indicates which kind of measurement ART is reporting.
+//
+// Where it makes sense, the datum ID ends with the type of datum (counter or histogram) and the
+// units.
+// Note: Histograms are not yet reported by statsd.
+enum ArtDatumId {
+ ART_DATUM_INVALID = 0;
+ ART_DATUM_GC_WORLD_STOP_TIME_AVG_MICROS = 1;
+ ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_TIME_HISTO_MILLIS = 2;
+ ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_COUNT = 3;
+ ART_DATUM_GC_FULL_HEAP_COLLECTION_TIME_HISTO_MILLIS = 4;
+ ART_DATUM_GC_FULL_HEAP_COLLECTION_COUNT = 5;
+ ART_DATUM_JIT_METHOD_COMPILE_TIME_MICROS = 6;
+ ART_DATUM_AOT_COMPILE_TIME = 7;
+ ART_DATUM_CLASS_VERIFICATION_TIME_COUNTER_MICROS = 8;
+ ART_DATUM_CLASS_LOADING_TIME_COUNTER_MICROS = 9;
+
+ // Metrics IDs for dex2oat.
+ ART_DATUM_DEX2OAT_RESULT_CODE = 10;
+ ART_DATUM_DEX2OAT_DEX_CODE_COUNTER_BYTES = 11;
+ ART_DATUM_DEX2OAT_TOTAL_TIME_COUNTER_MILLIS = 12;
+ ART_DATUM_DEX2OAT_VERIFY_DEX_FILE_TIME_COUNTER_MILLIS = 13;
+ ART_DATUM_DEX2OAT_FAST_VERIFY_TIME_COUNTER_MILLIS = 14;
+ ART_DATUM_DEX2OAT_RESOLVE_METHODS_AND_FIELDS_TIME_COUNTER_MILLIS = 15;
+
+ ART_DATUM_CLASS_VERIFICATION_COUNT = 16;
+ ART_DATUM_GC_TOTAL_BYTES_ALLOCATED = 17;
+ ART_DATUM_GC_TOTAL_METADATA_SIZE_BYTES = 18 [deprecated=true];
+ ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_THROUGHPUT_HISTO_MB_PER_SEC = 19;
+ ART_DATUM_GC_FULL_HEAP_COLLECTION_THROUGHPUT_HISTO_MB_PER_SEC = 20;
+ ART_DATUM_JIT_METHOD_COMPILE_COUNT = 21;
+ ART_DATUM_GC_YOUNG_GENERATION_TRACING_THROUGHPUT_HISTO_MB_PER_SEC = 22;
+ ART_DATUM_GC_FULL_HEAP_TRACING_THROUGHPUT_HISTO_MB_PER_SEC = 23;
+ ART_DATUM_GC_YOUNG_GENERATION_COLLECTION_THROUGHPUT_AVG_MB_PER_SEC = 24;
+ ART_DATUM_GC_FULL_HEAP_COLLECTION_THROUGHPUT_AVG_MB_PER_SEC = 25;
+ ART_DATUM_GC_YOUNG_GENERATION_TRACING_THROUGHPUT_AVG_MB_PER_SEC = 26;
+ ART_DATUM_GC_FULL_HEAP_TRACING_THROUGHPUT_AVG_MB_PER_SEC = 27;
+ ART_DATUM_GC_TOTAL_COLLECTION_TIME_MS = 28;
+}
+
+// Indicates what class of thread the reported values apply to.
+enum ArtThreadType {
+ ART_THREAD_MAIN = 1;
+ ART_THREAD_BACKGROUND = 2;
+}
+
+// Indicates the type of dex metadata.
+enum ArtDexMetadataType {
+ ART_DEX_METADATA_TYPE_UNKNOWN = 0;
+ ART_DEX_METADATA_TYPE_PROFILE = 1;
+ ART_DEX_METADATA_TYPE_VDEX = 2;
+ ART_DEX_METADATA_TYPE_PROFILE_AND_VDEX = 3;
+ ART_DEX_METADATA_TYPE_NONE = 4;
+ ART_DEX_METADATA_TYPE_ERROR = 5;
+}
+
+// Indicates the type of the apk.
+enum ArtApkType {
+ ART_APK_TYPE_UNKNOWN = 0;
+ ART_APK_TYPE_BASE = 1;
+ ART_APK_TYPE_SPLIT = 2;
+}
+
+// Indicates the ISA.
+enum ArtIsa {
+ ART_ISA_UNKNOWN = 0;
+ ART_ISA_ARM = 1;
+ ART_ISA_ARM64 = 2;
+ ART_ISA_X86 = 3;
+ ART_ISA_X86_64 = 4;
+ ART_ISA_MIPS = 5;
+ ART_ISA_MIPS64 = 6;
+}
+
+message ArtDatumReported {
+ // The session ID is used to correlate this report with others from the same ART instance.
+ optional int64 session_id = 1;
+
+ // The UID of the app that ART is running on behalf of.
+ optional int32 uid = 2 [(is_uid) = true];
+
+ // What compiler filter the APK or DEX file was compiled with.
+ optional ArtCompileFilter compile_filter = 3;
+
+ // Why the package was compiled the way it was.
+ optional ArtCompilationReason compilation_reason = 4;
+
+ // The number of milliseconds since the ART runtime instance was started.
+ optional int64 timestamp_millis = 5;
+
+ // What kind of thread (UI or background) this metric corresponds to.
+ optional ArtThreadType thread_type = 6;
+
+ // Which counter this is that is being reported.
+ optional ArtDatumId kind = 7;
+
+ // The value of the counter.
+ optional int64 value = 8;
+
+ // The type of dex metadata
+ optional ArtDexMetadataType dex_metadata_type = 9;
+
+ // The type of the APK file.
+ optional ArtApkType apk_type = 10;
+
+ // The ISA of the device.
+ optional ArtIsa isa = 11;
+}
+
+/**
+ * Logged when a SIM-specific settings restore was attempted.
+ *
+ * Logged from:
+ * packages/providers/TelephonyProvider/src/com/android/providers/telephony/TelephonyProvider.java
+ */
+message SimSpecificSettingsRestored {
+ optional android.telephony.SimSpecfifcSettingsRestoreResult result = 1;
+
+ // Indicates which restore flow was followed.
+ optional android.telephony.SimSpecificSettingsRestoreCase restored_from_suw = 2;
+
+ // Indicates which criteria was used to match the inserted SIM to backed up
+ // SIM. Only relevant when result is SUCCESS
+ optional android.telephony.SimSpecificSettingsRestoreMatchingCriteria matching_criteria = 3;
+}
+
+/**
+ * The latency of Binder calls broken down by calling API and method name.
+ * This is different from BinderCalls as it collects a histogram of the
+ * latencies (to get more detailed data) not just the count, sum, and maximum.
+ *
+ * Logged from:
+ * frameworks/base/core/java/com/android/internal/os/BinderLatencyObserver.java
+ */
+message BinderLatencyReported {
+ message Dims {
+ enum ProcessSource {
+ UNKNOWN_PROCESS_SOURCE = 0;
+ SYSTEM_SERVER = 1;
+ TELEPHONY = 2;
+ BLUETOOTH = 3;
+ }
+ enum ServiceClassName {
+ UNKNOWN_CLASS = 0;
+ }
+ enum ServiceMethodName {
+ UNKNOWN_METHOD = 0;
+ }
+
+ // Required.
+ optional ProcessSource process_source = 1;
+
+ // The class name of the API making the call to Binder. Enum value
+ // is preferred as uses much less data to store.
+ // This field does not contain PII.
+ oneof service_class {
+ ServiceClassName service_class_name_as_enum = 2;
+ string service_class_name = 3;
+ }
+
+ // Method name of the API call. It can also be a transaction code if we
+ // cannot resolve it to a name. See Binder#getTransactionName. Enum value
+ // is preferred as uses much less data to store.
+ // This field does not contain PII.
+ oneof service_method {
+ ServiceMethodName service_method_name_as_enum = 4;
+ string service_method_name = 5;
+ }
+ }
+
+ message ApiStats {
+ // required.
+ optional Dims dims = 1;
+
+ // Indicates the first bucket that had any data. Allows omitting any empty
+ // buckets at the start of the bucket list and thus save on data size.
+ optional int32 first_bucket_index = 2;
+ // Stores the count of samples for each bucket. The number of buckets and
+ // their sizes are controlled server side with a flag.
+ repeated int32 buckets = 3;
+ }
+
+ message RepeatedApiStats {
+ repeated ApiStats api_stats = 1;
+ }
+
+ // The binder latency data broken down by the dimensions specified above.
+ // The message wrapper is used for the repeated field as top level repeated
+ // fields are not allowed.
+ // MODE_BYTES is used as nested messages are not allowed otherwise.
+ // Required.
+ optional RepeatedApiStats repeated_api_stats = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
+
+ // The fraction of samples that are recorded in the histogram.
+ // Required.
+ optional float sampling_rate = 2;
+
+ // Indicates how many shards the APIs are divided in - e.g. for 3 every
+ // 3rd API will be included in the data for this shard.
+ // Required.
+ optional int32 sharding_modulo = 3;
+
+ // Params for histogram buckets.
+ // The number of buckets the histogram should have.
+ optional int32 bucket_count = 4;
+
+ // The size (upper bound) of the first bucket (used to avoid creating an
+ // excessive amount of small buckets). E.g. for first_bucket_size of 5, the
+ // first bucket will be [0, 5) and the second will be [5, 5 * scaleFactor).
+ optional int32 first_bucket_size = 5;
+
+ // The rate in which each consecutive bucket increases (before rounding).
+ // Implemented in: com.android.internal.os.BinderLatencyBuckets.
+ optional float scale_factor = 6;
+}
+
+/**
+ * Log audio device types that are used for input/output.
+ * Next Tag: 2
+ */
+message AudioDevice {
+ // See audio_devices_t in system/media/audio/include/system/audio-hal-enums.h
+ repeated int32 type = 1;
+}
+
+/**
+ * Track information about AAudio Stream
+ * Logged from
+ * frameworks/av/services/mediametrics/AudioAnalytics.cpp
+ */
+message MediametricsAAudioStreamReported {
+ // The implementation of aaudio.
+ enum CallerPath {
+ CALLER_PATH_UNKNOWN = 0;
+ CALLER_PATH_LEGACY = 1;
+ CALLER_PATH_MMAP = 2;
+ }
+ optional CallerPath path = 1;
+
+ // The direction of the stream.
+ // See aaudio_direction_t in frameworks/av/media/libaaudio/include/aaudio/AAudio.h
+ // The Direction values are different from aaudio_direction_t to avoid having 0 at the first
+ // value since first value will be used as default value.
+ // See lookup<AAUDIO_DIRECTION> in frameworks/av/services/mediametrics/AudioTypes.cpp
+ // for conversion from aaudio_direction_t to Direction.
+ enum Direction {
+ // The direction is unknown.
+ DIRECTION_UNKNOWN = 0;
+ // Audio data will travel out of the device.
+ DIRECTION_OUTPUT = 1;
+ // Audio data will travel into the device.
+ DIRECTION_INPUT = 2;
+ }
+ optional Direction direction = 2;
+
+ // The amount read or written in one shot by the Mixer or DSP.
+ optional int32 frames_per_burst = 3;
+ // The number of frames that the buffer is used.
+ optional int32 buffer_size = 4;
+ // The allocated number of frames for the buffer.
+ optional int32 buffer_capacity = 5;
+ // The channel count of the aaudio stream.
+ optional int32 channel_count = 6;
+ // Total frames transferred (written or read)
+ optional int64 total_frames_transferred = 7;
+
+ // The performance mode.
+ // See aaudio_performance_mode_t in frameworks/av/media/libaaudio/include/aaudio/AAudio.h
+ enum PerformanceMode {
+ // The performance mode is unknown.
+ PERFORMANCE_MODE_UNKNOWN = 0;
+ // No particular performance mode needs. Default.
+ PERFORMANCE_MODE_NONE = 10;
+ // Extending battery life is more important than low latency.
+ PERFORMANCE_MODE_POWER_SAVING = 11;
+ // Reducing latency is more important than battery life.
+ PERFORMANCE_MODE_LOW_LATENCY = 12;
+ }
+ // The performance mode requested by the applications.
+ optional PerformanceMode perf_mode_requested = 8;
+ // The actual performance mode used by aaudio.
+ optional PerformanceMode perf_mode_actual = 9;
+
+ // The mode requested for sharing the device
+ // See aaudio_sharing_mode_t in frameworks/av/media/libaaudio/include/aaudio/AAudio.h
+ // The SharingMode values are different from aaudio_direction_t to avoid having 0 at the first
+ // value since first value will be used as default value.
+ // See lookup<AAUDIO_SHARING_MODE> in frameworks/av/services/mediametrics/AudioTypes.cpp
+ // for conversion from aaudio_sharing_mode_t to SharingMode.
+ enum SharingMode {
+ // The sharing mode is unknown
+ SHARING_MODE_UNKNOWN = 0;
+ // This will be the only stream using a particular source or sink.
+ SHARING_MODE_EXCLUSIVE = 1;
+ // Multiple application will be mixed by the AAudio server.
+ SHARING_MODE_SHARED = 2;
+ }
+ optional SharingMode sharing = 10;
+
+ // Approximate number of glitches.
+ // Underrun on output stream. Overrun on input stream.
+ optional int32 xrun_count = 11;
+ // Devices that are used by the aaudio stream.
+ optional AudioDevice types = 12 [(log_mode) = MODE_BYTES];
+
+ // Format request by the applications
+ optional int32 format_app = 13;
+ // Format processed by the framework
+ optional int32 format_device = 14;
+
+ // Android S metric log session id, a Base64Url encoded string representing a 128-bit integer.
+ optional string log_session_id = 15;
+
+ // The sample rate of the aaudio stream.
+ optional int32 sample_rate = 16;
+
+ // The content type of the aaudio stream.
+ // An enumeration from system/media/audio/include/system/audio-hal-enums.h audio_content_type_t
+ enum ContentType {
+ CONTENT_TYPE_UNKNOWN = 0;
+ CONTENT_TYPE_SPEECH = 1;
+ CONTENT_TYPE_MUSIC = 2;
+ CONTENT_TYPE_MOVIE = 3;
+ CONTENT_TYPE_SONIFICATION = 4;
+ CONTENT_TYPE_INVALID = -1;
+ }
+ optional ContentType content_type = 17;
+
+ // The mode of sharing the device requested by the client.
+ optional SharingMode sharing_requested = 18;
+}
+
+/**
+ * Logs media transcoding session ended events.
+ *
+ * Logged from:
+ * frameworks/av/media/libmediatranscoding/TranscoderWrapper.cpp
+ */
+message MediaTranscodingSessionEnded {
+
+ enum Reason {
+ UNKNOWN = 0; // Unused.
+ FINISHED = 1; // Transcoding session finished successfully.
+ ERROR = 2; // Transcoding session returned error while running.
+ PAUSED = 3; // Transcoding session was paused, potentially failed.
+ CANCELLED = 4; // Transcoding session was cancelled.
+ START_FAILED = 5; // Transcoding session failed to start.
+ RESUME_FAILED = 6; // Transcoding session failed to resume.
+ CREATE_FAILED = 7; // Transcoder instance failed to crate.
+ CONFIG_SRC_FAILED = 8; // Configure source failed.
+ CONFIG_DST_FAILED = 9; // Configure destination failed.
+ CONFIG_TRACK_FAILED = 10; // Configure track failed.
+ OPEN_SRC_FD_FAILED = 11; // Open source fd failed.
+ OPEN_DST_FD_FAILED = 12; // Open destination fd failed.
+ NO_TRACKS = 13; // No tracks in source file.
+ }
+
+ // Reason for logging the atom.
+ optional Reason reason = 1;
+
+ // UID of client connecting to media transcoding service.
+ optional int32 calling_uid = 2 [(is_uid) = true];
+
+ // Transcode session status flag (media_status_t).
+ optional int32 transcode_status = 3;
+
+ // Transcode speed as framerate, if status is success.
+ optional int32 transcode_fps = 4;
+
+ // Source video dimensions.
+ optional int32 src_width = 5;
+ optional int32 src_height = 6;
+
+ // Source video codec information.
+ optional string src_codec_type = 7;
+ optional int32 src_profile = 8;
+ optional int32 src_level = 9;
+
+ // Source video framerate.
+ optional int32 src_fps = 10;
+
+ // Source video duration.
+ optional int32 src_duration_millis = 11;
+
+ // Whether source video is HDR.
+ optional bool src_is_hdr = 12;
+
+ // Destination video dimensions.
+ optional int32 dst_width = 13;
+ optional int32 dst_height = 14;
+
+ // Destination video codec information.
+ optional string dst_codec_type = 15;
+
+ // Whether destination video is HDR.
+ optional bool dst_is_hdr = 16;
+}
+
+/** Logs information about an unattended reboot that took place. This is logged
+ * after the next boot, when the device is first unlocked.
+ *
+ * Logged from:
+ * packages/modules/Scheduling/service/java/com/android/server/RebootReadinessLogger.java
+ */
+message UnattendedRebootOccurred {
+
+ // Time between the reboot readiness state checks starting, and the device
+ // becoming reboot-ready.
+ optional int64 time_until_reboot_ready_millis= 1;
+
+ // Time taken for the device to be unlocked (i.e. for the keyguard to be
+ // gone) after an unattended reboot took place.
+ optional int64 time_until_first_unlock_millis = 2;
+
+ // Number of times the reboot was blocked by the device being interactive.
+ optional int32 times_blocked_by_interactivity = 3;
+
+ // Number of times the reboot was blocked by a callback registered by a
+ // subsystem or a privileged app.
+ optional int32 times_blocked_by_subsystems = 4;
+
+ // Number of times the reboot was blocked by background app activity.
+ optional int32 times_blocked_by_app_activity = 5;
+
+ // Time until next user interaction with the device.
+ optional int64 time_until_next_interaction_ms = 6;
+}
+
+
+/**
+ * Logs information about an app uid or registered system component that has
+ * been blocking the device from being reboot-ready for a long time.
+ *
+ * Logged from:
+ * packages/modules/Scheduling/service/java/com/android/server/RebootReadinessLogger.java
+ */
+message LongRebootBlockingReported {
+
+ enum RebootBlockReason {
+ SYSTEM_COMPONENT = 1;
+ APP_UID = 2;
+ }
+
+ // The reason why the reboot has been blocked. This is either a system
+ // component that has registered a callback, or an app UID running in the
+ // background.
+ optional RebootBlockReason reboot_block_reason = 1;
+
+ // Only one of the following two fields should be set, depending on the
+ // RebootBlockReason.
+
+ // The name supplied by a system component when it registered a callback
+ // to block the reboot.
+ optional string component_name = 2;
+
+ // The uid of an app that is running in the background.
+ optional int32 uid = 3;
+}
+
+/**
+ * Logs the magnification activated mode and its duration of the usage
+ * when the magnification is disabled.
+ *
+ * Logged from:
+ * frameworks/base/services/accessibility/java/com/android/server/accessibility
+ */
+message MagnificationUsageReported {
+ // The definition of the magnification mode.
+ // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
+ optional android.stats.accessibility.MagnificationMode activated_mode = 1;
+
+ // The duration of this magnification mode activation in milliseconds
+ optional int64 duration_millis = 2;
+}
+
+/**
+ * Logs the magnification activated mode when IME dialog shows on the screen.
+ *
+ * Logged from:
+ * frameworks/base/services/accessibility/java/com/android/server/accessibility
+ */
+message MagnificationModeWithImeOnReported {
+ // The definition of the magnification mode.
+ // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
+ optional android.stats.accessibility.MagnificationMode activated_mode = 1;
+}
+
+/*
+ * Reports a device controls user interaction
+ *
+ * Logged from:
+ * frameworks/base/packages/SystemUI/src/com/android/systemui/controls/ControlsMetricsLoggerImpl.kt
+ */
+message DeviceControlChanged {
+ // The event_id
+ optional int32 event_id = 1;
+ // An identifier to tie together multiple logs relating to the same controls session
+ optional int32 instance_id = 2;
+ // The type of device the user has interacted with (android.service.controls.DeviceTypes)
+ optional int32 device_type = 3;
+ // The service app uid.
+ optional int32 uid = 4 [(is_uid) = true];
+ // Is the device locked while the action started
+ optional bool is_locked = 5;
+}
+
+/**
+ * This metric is collected at the end of playback
+ * as a pulled atom.
+ *
+ * DrmHal::cleanup() {
+ * // ...
+ * reportFrameworkMetrics(reportPluginMetrics());
+ * // ...
+ * }
+ * This proto should be kept in-sync with
+ * frameworks/av/drm/libmediadrm/protos/metrics.proto.
+ */
+message DrmFrameworkMetrics {
+
+ // Attributes are associated with a recorded value. E.g. A counter may
+ // represent a count of an operation returning a specific error code. The
+ // error code will be an attribute.
+ message Attributes {
+ // Reserved for compatibility with logging proto.
+ reserved 2 to 13;
+
+ // A general purpose error code where 0 means OK.
+ optional int32 error_code = 1;
+
+ // Defined at ::android::hardware::drm::V1_0::KeyStatusType;
+ optional uint32 key_status_type = 14;
+
+ // Defined at ::android::hardware::drm::V1_0::EventType;
+ optional uint32 event_type = 15;
+ }
+
+ // The Counter message is used to store a count value with an associated
+ // Attribute.
+ message Counter {
+ optional uint64 count = 1;
+ // Represents the attributes associated with this counter instance.
+ optional Attributes attributes = 2;
+ }
+
+ // The DistributionMetric is meant to capture the moments of a normally
+ // distributed (or approximately normal) value.
+ message DistributionMetric {
+ optional float min = 1;
+ optional float max = 2;
+ optional float mean = 3;
+ optional double variance = 4;
+ optional uint64 operation_count = 5;
+
+ // Represents the attributes associated with this distribution metric
+ // instance.
+ optional Attributes attributes = 6;
+ }
+
+ message SessionLifetime {
+ // Start time of the session in milliseconds since epoch.
+ optional uint64 start_time_millis = 1;
+ // End time of the session in milliseconds since epoch.
+ optional uint64 end_time_millis = 2;
+ }
+
+ // The count of open session operations. Each instance has a specific error
+ // code associated with it.
+ repeated Counter open_session_counter = 1;
+
+ // The count of close session operations. Each instance has a specific error
+ // code associated with it.
+ repeated Counter close_session_counter = 2;
+
+ // Count and execution time of getKeyRequest calls.
+ repeated DistributionMetric get_key_request_time_us = 3;
+
+ // Count and execution time of provideKeyResponse calls.
+ repeated DistributionMetric provide_key_response_time_us = 4;
+
+ // Count of getProvisionRequest calls.
+ repeated Counter get_provisioning_request_counter = 5;
+
+ // Count of provideProvisionResponse calls.
+ repeated Counter provide_provisioning_response_counter = 6;
+
+ // Count of key status events broken out by status type.
+ repeated Counter key_status_change_counter = 7;
+
+ // Count of events broken out by event type
+ repeated Counter event_callback_counter = 8;
+
+ // Count getPropertyByteArray calls to retrieve the device unique id.
+ repeated Counter get_device_unique_id_counter = 9;
+
+ message SessionLifetimeEntry {
+ optional string session_id = 1;
+ optional SessionLifetime session_lifetime = 2;
+ }
+ // Session ids to lifetime (start and end time) map.
+ // Session ids are strings of hex-encoded byte arrays.
+ // This field is equivalent to the map<string, SessionLifetime>
+ // field in frameworks/av/drm/libmediadrm/protos/metrics.proto.
+ repeated SessionLifetimeEntry session_lifetimes = 10;
+}
+
+/**
+ * The metric is collected at the end of playback
+ * as a pulled atom MediaDrmActivityInfo.
+ *
+ * The framework_metrics is defined in
+ * frameworks/av/drm/libmediadrm/protos/metrics.proto.
+ *
+ * The format of vendor_metrics is MediaDrm plugin dependent.
+ *
+ * DrmHal::cleanup() {
+ * // ...
+ * reportFrameworkMetrics(reportPluginMetrics());
+ * // ...
+ * }
+ *
+ * This pulled atom is then collected in
+ * frameworks/av/services/mediametrics/MediaMetricsService.cpp.
+ */
+message MediaDrmActivityInfo {
+ optional string package_name = 1;
+ optional int64 package_version_code = 2;
+
+ // vendor+description tell about which DRM plugin is in use on this device
+ optional string vendor = 3;
+ optional string description = 4;
+
+ optional DrmFrameworkMetrics framework_metrics = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+ optional bytes vendor_metrics = 6 [(android.os.statsd.log_mode) = MODE_BYTES];
+}
+
+/*
+ * Logged when hardware based user-configurable device state changes.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/devicestate/DeviceStateManagerService.java
+ */
+message DeviceStateChanged {
+ optional int32 new_device_state = 1
+ [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
+ optional bool boot_state = 2;
+}
+
+/*
+ * An obfuscated, canonical form time zone suggestion for metrics use.
+ *
+ * The suggestion's time zone IDs (which relate to location) are obfuscated by
+ * mapping them to an ordinal. When the ordinal is assigned consistently across
+ * several objects (i.e. so the same time zone ID is always mapped to the same
+ * ordinal), this allows comparisons between those objects. For example, we can
+ * answer "did these two suggestions agree?", "does the suggestion match the
+ * device's current time zone?", without leaking knowledge of location. Ordinals
+ * are also significantly more compact than full IANA TZDB IDs, albeit highly
+ * unstable and of limited use.
+ */
+message MetricsTimeZoneSuggestion {
+ enum Type {
+ UNKNOWN = 0;
+ CERTAIN = 1;
+ UNCERTAIN = 2;
+ }
+ optional Type type = 1;
+
+ // The ordinals for time zone(s) in the suggestion. Always empty for
+ // UNCERTAIN, and can be empty for CERTAIN, for example when the device is in
+ // a disputed area / on an ocean.
+ repeated int32 time_zone_ordinals = 2;
+}
+
+/*
+ * Logs a snapshot of time zone detector state.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
+ */
+message TimeZoneDetectorState {
+
+ // True if telephony-based time zone detection is supported on the device.
+ optional bool telephony_supported = 1;
+
+ // True if geo-based time zone detection is supported on the device.
+ optional bool geo_supported = 2;
+
+ // The current user's master location setting value.
+ optional bool location_enabled = 3;
+
+ // The current user's auto time zone detection enabled setting value.
+ optional bool auto_detection_setting = 4;
+
+ // The current user's geo detection enabled setting.
+ optional bool geo_detection_setting = 5;
+
+ enum DetectionMode {
+ UNKNOWN = 0;
+ MANUAL = 1;
+ TELEPHONY = 2;
+ GEO = 3;
+ }
+
+ // The functional / behavioral state for how time zones are currently determined on the device.
+ // Avoids needing to duplicate the logic used.
+ optional DetectionMode detection_mode = 6;
+
+ // The device's current time zone ordinal (see MetricsTimeZoneSuggestion).
+ optional int32 device_time_zone_ordinal = 7;
+
+ // The latest suggestion received from the user, e.g. via SettingsUI (non-persistent).
+ optional MetricsTimeZoneSuggestion latest_manual_suggestion = 8
+ [(log_mode) = MODE_BYTES];
+
+ // The latest telephony-derived suggestion (non-persistent).
+ optional MetricsTimeZoneSuggestion latest_telephony_suggestion = 9
+ [(log_mode) = MODE_BYTES];
+
+ // The latest geo-derived suggestion (non-persistent).
+ optional MetricsTimeZoneSuggestion latest_geo_suggestion = 10
+ [(log_mode) = MODE_BYTES];
+}
+
+/*
+ * Logs information about an individual location time zone provider's state.
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/location/timezone/ControllerImpl.java
+ */
+message LocationTimeZoneProviderStateChanged {
+ // The index of the provider (primary = 0, secondary = 1)
+ optional int32 provider_index = 1;
+
+ enum State {
+ // A placeholder for unknown values.
+ UNKNOWN = 0;
+
+ // The provider is initializing.
+ INITIALIZING = 1;
+
+ // The provider is certain of the time zone.
+ CERTAIN = 2;
+
+ // The provider is uncertain of the time zone.
+ UNCERTAIN = 3;
+
+ // The provider has been stopped.
+ STOPPED = 4;
+
+ // The provider has failed.
+ PERM_FAILED = 5;
+
+ // The provider has been destroyed.
+ DESTROYED = 6;
+ }
+
+ // The state of the provider.
+ optional State state = 2;
+}
+
+/*
+ * Reports fdtrack state change.
+ *
+ * Logged from:
+ * frameworks/base/services/java/com/android/server/SystemServer.java
+ */
+message FdtrackEventOccurred {
+ enum FdtrackEventType {
+ DISABLED = 1;
+ ENABLED = 2;
+
+ // Aborting because we're above the abort threshold.
+ ABORTING = 3;
+ }
+
+ optional FdtrackEventType event = 1;
+ optional int32 fd_count = 2;
+}
+
+/**
+ * Pushed when delivering a batch of alarms.
+ *
+ * Logged from:
+ * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
+ */
+message AlarmBatchDelivered {
+ optional int32 num_alarms = 1;
+ optional int32 wakeups = 2;
+}
+
+/**
+ * Pushed when an app schedules an alarm.
+ *
+ * Logged from:
+ * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
+ */
+message AlarmScheduled {
+ optional int32 calling_uid = 1 [(is_uid) = true];
+
+ optional bool is_exact = 2;
+ optional bool is_wakeup = 3;
+ optional bool is_allow_while_idle = 4;
+ optional bool is_alarm_clock = 5;
+ optional bool is_repeating = 6;
+
+ enum ReasonCode {
+ NOT_APPLICABLE = 0;
+ PERMISSION = 1;
+ ALLOW_LIST = 2;
+ CHANGE_DISABLED = 3;
+ }
+ optional ReasonCode exact_alarm_allowed_reason = 7;
+ optional bool is_rtc = 8;
+ // The state of the callingUid, from frameworks/proto_logging/stats/enums/app/enums.proto.
+ optional android.app.ProcessStateEnum calling_process_state = 9;
+}
+
+/**
+ * Logs statistics about pending alarms.
+ *
+ * Pulled from:
+ * frameworks/base/apex/jobscheduler/service/java/com/android/server/alarm/MetricsHelper.java
+ */
+message PendingAlarmInfo {
+ optional int32 num_total = 1;
+ optional int32 num_exact = 2;
+ optional int32 num_wakeup = 3;
+ optional int32 num_allow_while_idle = 4;
+ optional int32 num_prioritized = 5;
+ optional int32 num_foreground_service = 6;
+ optional int32 num_activity = 7;
+ optional int32 num_service = 8;
+ optional int32 num_listener = 9;
+ optional int32 num_indefinite_future = 10;
+ optional int32 num_repeating = 11;
+ optional int32 num_alarm_clock = 12;
+ optional int32 num_rtc = 13;
+}
+
+/*
+ * Logs information about on-device refresh of ART AOT artifacts for boot classpath extensions
+ * and system_server.
+ *
+ * Logged from:
+ * art/odrefresh/odrefresh.cc
+ */
+message OdrefreshReported {
+ optional int64 art_apex_version = 1;
+
+ enum Trigger {
+ // A placeholder for unknown values.
+ TRIGGER_UNKNOWN = 0;
+
+ // ART apex version has changed since time artifacts were generated.
+ TRIGGER_APEX_VERSION_MISMATCH = 1;
+
+ // Dex files on the boot classpath or system_server classpath have changed.
+ TRIGGER_DEX_FILES_CHANGED = 2;
+
+ // Missing artifacts.
+ TRIGGER_MISSING_ARTIFACTS = 3;
+ }
+
+ optional Trigger trigger = 2;
+
+ enum Stage {
+ // A placeholder for unknown values.
+ STAGE_UNKNOWN = 0;
+
+ // Checking stage.
+ STAGE_CHECK = 10;
+
+ // Preparation for compilation.
+ STAGE_PREPARATION = 20;
+
+ // Compilation of primary boot classpath extensions.
+ STAGE_PRIMARY_BOOT_CLASSPATH = 30;
+
+ // Compilation of secondary boot classpath extensions.
+ STAGE_SECONDARY_BOOT_CLASSPATH = 40;
+
+ // Compilation of system_server classpath.
+ STAGE_SYSTEM_SERVER_CLASSPATH = 50;
+
+ // All stages completed.
+ STAGE_COMPLETE = 60;
+ }
+
+ optional Stage stage_reached = 3;
+
+ enum Status {
+ // A placeholder for unknown values.
+ STATUS_UNKNOWN = 0;
+
+ // OK, no problems encountered.
+ STATUS_OK = 1;
+
+ // Insufficient space.
+ STATUS_NO_SPACE = 2;
+
+ // Storage operation failed.
+ STATUS_IO_ERROR = 3;
+
+ // Dex2oat reported an error.
+ STATUS_DEX2OAT_ERROR = 4;
+
+ // Time limit exceeded.
+ STATUS_TIME_LIMIT_EXCEEDED = 5;
+
+ // Failure creating staging area.
+ STATUS_STAGING_FAILED = 6;
+
+ // Installation of artifacts failed.
+ STATUS_INSTALL_FAILED = 7;
+ }
+
+ optional Status status = 4;
+
+ // Compilation time iof primary boot classpath extensions.
+ optional int32 primary_bcp_compilation_seconds = 5;
+
+ // Compilation time of secondary boot classpath extensions.
+ optional int32 secondary_bcp_compilation_seconds = 6;
+
+ // Compilation time of system_server classpath.
+ optional int32 system_server_compilation_seconds = 7;
+
+ // Cache space at start of update.
+ optional int32 cache_space_free_start_mib = 8;
+
+ // Cache space at end of update.
+ optional int32 cache_space_free_end_mib = 9;
+};
+
+/*
+ * Logged when a package's user-level hibernation state changes.
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
+ */
+ message UserLevelHibernationStateChanged {
+ // Name of the package that had its hibernation state change.
+ optional string package_name = 1;
+
+ // Android user id to which this event belongs. This can only be 0, 10, 11 and so on.
+ optional int32 user_id = 2;
+
+ // New hibernation state. True if hibernating, false otherwise
+ optional bool is_hibernating = 3;
+}
+
+/*
+ * Pull atom for the number of hibernated packages on the device for the given user.
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
+ */
+message UserLevelHibernatedApps {
+ // Total number of apps hibernated for the user
+ optional int32 hibernated_app_count = 1;
+
+ // Android user id of the queried user which can only be 0, 10, 11 and so on.
+ optional int32 user_id = 2;
+}
+
+/**
+ * Pull atom for total number of globally hibernated packages on the device and the storage savings
+ * from these apps being hibernated.
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/apphibernation/AppHibernationService.java
+ */
+message GlobalHibernatedApps {
+ // Total number of apps in global hibernation
+ optional int32 hibernated_app_count = 1;
+
+ // Cumulative storage savings from apps being hibernated
+ optional int64 storage_saved_mb = 2;
+}
+
+/*
+ * Report the event of app process kills.
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/am/AppExitInfoTracker.java
+ */
+message AppProcessDied {
+ // Uid of the package of the dying process
+ optional int32 uid = 1 [(is_uid) = true];
+
+ // Name of the dying process, it'll be omitted if the process name and package name are the same
+ optional string process_name = 2;
+
+ // The reason code of why the process dies
+ optional android.app.AppExitReasonCode reason = 3;
+
+ // The supplemental reason code of why the process dies
+ optional android.app.AppExitSubReasonCode sub_reason = 4;
+
+ // The importance of the process when it dies
+ optional android.app.Importance importance = 5;
+
+ // The last known PSS (in kB) of the process before it dies, could be 0.
+ optional int32 pss = 6;
+
+ // The last known RSS (in kB) of the process before it dies, could be 0.
+ optional int32 rss = 7;
+}
+
+/**
+ * Logs input event statistics.
+ * Pulls the statistics.
+ *
+ * Logged from:
+ * frameworks/native/services/inputflinger
+ */
+message InputEventLatencySketch {
+ /**
+ * The 'bytes' field is the serialized KLL sketch. It is to be deserialized into an object of
+ * KLL proto, which would then be converted into a KLL sketch. The KLL sketch is a histogram
+ * of the data.
+ *
+ * The goal of this data is to identify the bottlenecks in processing of input events.
+ * All sketches measure durations in a streaming fashion.
+ * The units are "hundreds of microseconds", or 0.1 ms. They are chosen like this in order
+ * to reduce the occupied space.
+ * The start and end points for each value are described in the comments.
+ *
+ * We distinguish between 'DOWN' event latency (when the pointer first goes down), and 'MOVE'
+ * event latency, which characterizes the scrolling experience.
+ */
+
+ // -------------------------- DOWN event sketches ------ START ---------------------------------
+ // Start: the input event was created (touch events: the touch interrupt received in the driver)
+ // End: the event was read in userspace (in EventHub)
+ optional bytes event_to_read_100micros_down_sketch = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Start: the event was read in EventHub
+ // End: the event was send to the app via the InputChannel (written to the socket)
+ optional bytes read_to_deliver_100micros_down_sketch = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Start: the input event was sent to the app
+ // End: the app consumed the input event
+ optional bytes deliver_to_consume_100micros_down_sketch = 3 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Start: the app consumed the event
+ // End: the app's 'finishInputEvent' call was received in inputflinger
+ // The end point can also be called "the app finished processing input event"
+ optional bytes consume_to_finish_100micros_down_sketch = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Start: the app consumed the input event
+ // End: the app produced a buffer
+ optional bytes consume_to_gpu_complete_100micros_down_sketch = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Start: the app produced a buffer
+ // End: the frame was shown on the display
+ optional bytes gpu_complete_to_present_100micros_down_sketch = 6 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // The end-to-end touch latency
+ // Start: the input event was created (touch events: the touch interrupt received in the driver)
+ // End: the frame was presented on the display
+ optional bytes end_to_end_100micros_down_sketch = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // -------------------------- DOWN event sketches ------ END -----------------------------------
+
+ // -------------------------- MOVE event sketches ------ START ---------------------------------
+ // Start: the input event was created (touch events: the touch interrupt received in the driver)
+ // End: the event was read in userspace (in EventHub)
+ optional bytes event_to_read_100micros_move_sketch = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Start: the event was read in EventHub
+ // End: the event was send to the app via the InputChannel (written to the socket)
+ optional bytes read_to_deliver_100micros_move_sketch = 9 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Start: the input event was sent to the app
+ // End: the app consumed the input event
+ optional bytes deliver_to_consume_100micros_move_sketch = 10 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Start: the app consumed the event
+ // End: the app's 'finishInputEvent' call was received in inputflinger
+ // The end point can also be called "the app finished processing input event"
+ optional bytes consume_to_finish_100micros_move_sketch = 11 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Start: the app consumed the input event
+ // End: the app produced a buffer
+ optional bytes consume_to_gpu_complete_100micros_move_sketch = 12 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // Start: the app produced a buffer
+ // End: the frame was shown on the display
+ optional bytes gpu_complete_to_present_100micros_move_sketch = 13 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // The end-to-end touch latency
+ // Start: the input event was created (touch events: the touch interrupt received in the driver)
+ // End: the frame was presented on the display
+ optional bytes end_to_end_100micros_move_sketch = 14 [(android.os.statsd.log_mode) = MODE_BYTES];
+ // -------------------------- MOVE event sketches ------ END -----------------------------------
+}
+
+// Each pull creates multiple atoms. One for each incremental package.
+message InstalledIncrementalPackage {
+ optional int32 uid = 1 [(is_uid) = true];
+}
+
+/**
+ * Memory management statistics pulled atom based on /proc/vmstat.
+ * Logged from StatsPullAtomService.
+ */
+message VmStat {
+ optional int32 oom_kill_count = 1;
+}
+
+/**
+* Log that the user has interacted with an app on the permission usage
+* fragment.
+* Logged from permission/debug/PermissionUsageV2Frament.kt
+*/
+message PermissionUsageFragmentInteraction {
+ // id which identifies single session of user interacting with permission hub
+ optional int64 session_id = 1;
+
+ enum Action {
+ UNDEFINED = 0;
+ OPEN = 1;
+ LOCATION_ACCESS_TIMELINE_VIEWED = 2;
+ CAMERA_ACCESS_TIMELINE_VIEWED = 3;
+ MICROPHONE_ACCESS_TIMELINE_VIEWED = 4;
+ SHOW_SYSTEM_CLICKED = 5;
+ SEE_OTHER_PERMISSIONS_CLICKED = 6;
+ }
+
+ // The action the user took to interact with the fragment
+ optional Action action = 2;
+}
+
+/**
+* Log that the user has clicked on .
+* Logged from permission/debug/PermissionDetailsFragment.kt
+*/
+message PermissionDetailsInteraction {
+ // id which identifies single session of user interacting with permission details fragment.
+ optional int64 session_id = 1;
+
+ // The name of a permission group whose details are viewed.
+ optional string permission_group_name = 2;
+
+ enum Action {
+ UNDEFINED = 0;
+ SHOW_SYSTEM_CLICKED = 1;
+ INFO_ICON_CLICKED = 2;
+ }
+
+ // Package name for which the info icon was clicked.
+ optional string package_name = 3;
+
+ // The action the user took to interact with the fragment
+ optional Action action = 4;
+}
+
+/**
+* Log that the user has toggled the sensor privacy.
+*/
+message PrivacySensorToggleInteraction {
+
+ enum Sensor {
+ SENSOR_UNKNOWN = 0;
+ MICROPHONE = 1;
+ CAMERA = 2;
+
+ }
+
+ // Sensor for which sensor privacy was toggled.
+ optional Sensor sensor = 1;
+
+ enum Action {
+ ACTION_UNKNOWN = 0;
+ TOGGLE_ON = 1;
+ TOGGLE_OFF = 2;
+ }
+
+ // Action taken on sensor.
+ optional Action action = 2;
+
+ enum Source {
+ SOURCE_UNKNOWN = 0;
+ DIALOG = 1;
+ SETTINGS = 2;
+ QS_TILE = 3;
+ }
+
+ // Source for the toggling.
+ optional Source source = 3;
+
+ // Amount of time a user spent in the previous sensor privacy state in minutes.
+ optional int64 time_in_previous_state_in_mins = 4;
+}
+
+message PrivacyToggleDialogInteraction {
+
+ enum Action {
+ ACTION_UNKNOWN = 0;
+ ENABLE = 1;
+ CANCEL = 2;
+ }
+
+ // Action taken on the toggle dialog.
+ optional Action action = 1;
+
+ // Name of the package for which the dialog was shown.
+ optional string package_name = 2;
+}
diff --git a/stats/enums/app/enums.proto b/stats/enums/app/enums.proto
index bd5cb62..17a9ede 100644
--- a/stats/enums/app/enums.proto
+++ b/stats/enums/app/enums.proto
@@ -207,4 +207,258 @@
APP_OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED = 97;
APP_OP_AUTO_REVOKE_MANAGED_BY_INSTALLER = 98;
APP_OP_NO_ISOLATED_STORAGE = 99;
+ APP_OP_PHONE_CALL_MICROPHONE = 100;
+ APP_OP_PHONE_CALL_CAMERA = 101;
+ APP_OP_RECORD_AUDIO_HOTWORD = 102;
+ APP_OP_MANAGE_ONGOING_CALLS = 103;
+ APP_OP_MANAGE_CREDENTIALS = 104;
+ APP_OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER = 105;
+ APP_OP_RECORD_AUDIO_OUTPUT = 106;
+ APP_OP_SCHEDULE_EXACT_ALARM = 107;
+ APP_OP_FINE_LOCATION_SOURCE = 108;
+ APP_OP_COARSE_LOCATION_SOURCE = 109;
+ APP_OP_MANAGE_MEDIA = 110;
+ APP_OP_BLUETOOTH_CONNECT = 111;
+ APP_OP_UWB_RANGING = 112;
+ APP_OP_ACTIVITY_RECOGNITION_SOURCE = 113;
+ APP_OP_BLUETOOTH_ADVERTISE = 114;
+ APP_OP_RECORD_INCOMING_PHONE_AUDIO = 115;
+}
+
+/**
+ * The reason code that why app process is killed.
+ */
+enum AppExitReasonCode {
+ /**
+ * Application process died due to unknown reason.
+ */
+ REASON_UNKNOWN = 0;
+
+ /**
+ * Application process exit normally by itself, for example,
+ * via {@link android.os.Process#exit}; {@link #status} will specify the exit code.
+ *
+ * <p>Applications should normally not do this, as the system has a better knowledge
+ * in terms of process management.</p>
+ */
+ REASON_EXIT_SELF = 1;
+
+ /**
+ * Application process died due to the result of an OS signal; for example,
+ * {@link android.os.Process#SIGNAL_KILL}; {@link #status} will specify the signum.
+ */
+ REASON_SIGNALED = 2;
+
+ /**
+ * Application process was killed by the system low memory killer, meaning the system was
+ * under memory pressure at the time of kill.
+ */
+ REASON_LOW_MEMORY = 3;
+
+ /**
+ * Application process died because of an unhandled exception in Java code.
+ */
+ REASON_CRASH = 4;
+
+ /**
+ * Application process died because it's crashed due to a native code crash.
+ */
+ REASON_CRASH_NATIVE = 5;
+
+ /**
+ * Application process was killed due to being unresponsive (ANR).
+ */
+ REASON_ANR = 6;
+
+ /**
+ * Application process was killed because it took too long to attach to the system
+ * during the start.
+ */
+ REASON_INITIALIZATION_FAILURE = 7;
+
+ /**
+ * Application process was killed because of initialization failure,
+ * for example, it took too long to attach to the system during the start,
+ * or there was an error during initialization.
+ */
+ REASON_PERMISSION_CHANGE = 8;
+
+ /**
+ * Application process was killed by the activity manager due to excessive resource usage.
+ */
+ REASON_EXCESSIVE_RESOURCE_USAGE = 9;
+
+ /**
+ * Application process was killed because of the user request, for example,
+ * user clicked the "Force stop" button of the application in the Settings,
+ * or swiped away the application from Recents.
+ */
+ REASON_USER_REQUESTED = 10;
+
+ /**
+ * Application process was killed, because the user they are running as on devices
+ * with mutlple users, was stopped.
+ */
+ REASON_USER_STOPPED = 11;
+
+ /**
+ * Application process was killed because its dependency was going away, for example,
+ * a stable content provider connection's client will be killed if the provider is killed.
+ */
+ REASON_DEPENDENCY_DIED = 12;
+
+ /**
+ * Application process was killed by the system for various other reasons,
+ * for example, the application package got disabled by the user;
+ * {@link #description} will specify the cause given by the system.
+ */
+ REASON_OTHER = 13;
+}
+
+/**
+ * The supplemental reason code that why app process is killed
+ */
+enum AppExitSubReasonCode {
+ /**
+ * Application process kills subReason is unknown.
+ */
+ SUBREASON_UNKNOWN = 0;
+
+ /**
+ * Application process was killed because user quit it on the "wait for debugger" dialog.
+ */
+ SUBREASON_WAIT_FOR_DEBUGGER = 1;
+
+ /**
+ * Application process was killed by the activity manager because there were too many cached
+ * processes.
+ */
+ SUBREASON_TOO_MANY_CACHED = 2;
+
+ /**
+ * Application process was killed by the activity manager because there were too many empty
+ * processes.
+ */
+ SUBREASON_TOO_MANY_EMPTY = 3;
+
+ /**
+ * Application process was killed by the activity manager because there were too many cached
+ * processes and this process had been in empty state for a long time.
+ */
+ SUBREASON_TRIM_EMPTY = 4;
+
+ /**
+ * Application process was killed by the activity manager because system was on
+ * memory pressure and this process took large amount of cached memory.
+ */
+ SUBREASON_LARGE_CACHED = 5;
+
+ /**
+ * Application process was killed by the activity manager because the system was on
+ * low memory pressure for a significant amount of time since last idle.
+ */
+ SUBREASON_MEMORY_PRESSURE = 6;
+
+ /**
+ * Application process was killed by the activity manager due to excessive CPU usage.
+ */
+ SUBREASON_EXCESSIVE_CPU = 7;
+
+ /**
+ * System update has done (so the system update process should be killed).
+ */
+ SUBREASON_SYSTEM_UPDATE_DONE = 8;
+
+ /**
+ * Kill all foreground services, for now it only occurs when enabling the quiet
+ * mode for the managed profile.
+ */
+ SUBREASON_KILL_ALL_FG = 9;
+
+ /**
+ * All background processes except certain ones were killed, for now it only occurs
+ * when the density of the default display is changed.
+ */
+ SUBREASON_KILL_ALL_BG_EXCEPT = 10;
+
+ /**
+ * The process associated with the UID was explicitly killed, for example,
+ * it could be because of permission changes.
+ */
+ SUBREASON_KILL_UID = 11;
+
+ /**
+ * The process was explicitly killed with its PID, typically because of
+ * the low memory for surfaces.
+ */
+ SUBREASON_KILL_PID = 12;
+
+ /**
+ * The start of the process was invalid.
+ */
+ SUBREASON_INVALID_START = 13;
+
+ /**
+ * The process was killed because it's in an invalid state, typically
+ * it's triggered from SHELL.
+ */
+ SUBREASON_INVALID_STATE = 14;
+
+ /**
+ * The process was killed when it's imperceptible to user, because it was
+ * in a bad state.
+ */
+ SUBREASON_IMPERCEPTIBLE = 15;
+
+ /**
+ * The process was killed because it's being moved out from LRU list.
+ */
+ SUBREASON_REMOVE_LRU = 16;
+
+ /**
+ * The process was killed because it's isolated and was in a cached state.
+ */
+ SUBREASON_ISOLATED_NOT_NEEDED = 17;
+
+ /**
+ * The process was killed because it's in forced-app-standby state, and it's cached and
+ * its uid state is idle; this would be set only when the reason is {@link #REASON_OTHER}.
+ */
+ SUBREASON_CACHED_IDLE_FORCED_APP_STANDBY = 18;
+
+ /**
+ * The process was killed because it fails to freeze/unfreeze binder
+ * or query binder frozen info while being frozen.
+ */
+ SUBREASON_FREEZER_BINDER_IOCTL = 19;
+
+ /**
+ * The process was killed because it receives sync binder transactions
+ * while being frozen.
+ */
+ SUBREASON_FREEZER_BINDER_TRANSACTION = 20;
+}
+
+/**
+ * The relative importance level that the system places on a process.
+ * Keep sync with the definitions in
+ * {@link android.app.ActivityManager.RunningAppProcessInfo}
+ */
+enum Importance {
+ option allow_alias = true;
+
+ IMPORTANCE_FOREGROUND = 100;
+ IMPORTANCE_FOREGROUND_SERVICE = 125;
+ IMPORTANCE_TOP_SLEEPING_PRE_28 = 150;
+ IMPORTANCE_VISIBLE = 200;
+ IMPORTANCE_PERCEPTIBLE_PRE_26 = 130;
+ IMPORTANCE_PERCEPTIBLE = 230;
+ IMPORTANCE_CANT_SAVE_STATE_PRE_26 = 170;
+ IMPORTANCE_SERVICE = 300;
+ IMPORTANCE_TOP_SLEEPING = 325;
+ IMPORTANCE_CANT_SAVE_STATE = 350;
+ IMPORTANCE_CACHED = 400;
+ IMPORTANCE_BACKGROUND = 400;
+ IMPORTANCE_EMPTY = 500;
+ IMPORTANCE_GONE = 1000;
}
diff --git a/stats/enums/app/job/enums.proto b/stats/enums/app/job/enums.proto
index 41863bb..16f49c1 100644
--- a/stats/enums/app/job/enums.proto
+++ b/stats/enums/app/job/enums.proto
@@ -24,15 +24,38 @@
option java_outer_classname = "JobProtoEnums";
option java_multiple_files = true;
-// Reasons a job is stopped.
+// Internal/debug reasons a job is stopped.
// Primarily used in android.app.job.JobParameters.java.
+enum InternalStopReasonEnum {
+ INTERNAL_STOP_REASON_UNKNOWN = -1;
+ INTERNAL_STOP_REASON_CANCELLED = 0;
+ INTERNAL_STOP_REASON_CONSTRAINTS_NOT_SATISFIED = 1;
+ INTERNAL_STOP_REASON_PREEMPT = 2;
+ INTERNAL_STOP_REASON_TIMEOUT = 3;
+ INTERNAL_STOP_REASON_DEVICE_IDLE = 4;
+ INTERNAL_STOP_REASON_DEVICE_THERMAL = 5;
+ INTERNAL_STOP_REASON_RESTRICTED_BUCKET = 6;
+ INTERNAL_STOP_REASON_UNINSTALL = 7;
+ INTERNAL_STOP_REASON_DATA_CLEARED = 8;
+ INTERNAL_STOP_REASON_RTC_UPDATED = 9;
+ INTERNAL_STOP_REASON_SUCCESSFUL_FINISH = 10;
+}
+
+// Public stop reasons returned through JobParameters.getStopReason()
enum StopReasonEnum {
- STOP_REASON_UNKNOWN = -1;
- STOP_REASON_CANCELLED = 0;
- STOP_REASON_CONSTRAINTS_NOT_SATISFIED = 1;
+ STOP_REASON_UNDEFINED = 0;
+ STOP_REASON_CANCELLED_BY_APP = 1;
STOP_REASON_PREEMPT = 2;
STOP_REASON_TIMEOUT = 3;
- STOP_REASON_DEVICE_IDLE = 4;
- STOP_REASON_DEVICE_THERMAL = 5;
- STOP_REASON_RESTRICTED_BUCKET = 6;
+ STOP_REASON_DEVICE_STATE = 4;
+ STOP_REASON_CONSTRAINT_BATTERY_NOT_LOW = 5;
+ STOP_REASON_CONSTRAINT_CHARGING = 6;
+ STOP_REASON_CONSTRAINT_CONNECTIVITY = 7;
+ STOP_REASON_CONSTRAINT_DEVICE_IDLE = 8;
+ STOP_REASON_CONSTRAINT_STORAGE_NOT_LOW = 9;
+ STOP_REASON_QUOTA = 10;
+ STOP_REASON_BACKGROUND_RESTRICTION = 11;
+ STOP_REASON_APP_STANDBY = 12;
+ STOP_REASON_USER = 13;
+ STOP_REASON_SYSTEM_PROCESSING = 14;
}
diff --git a/stats/enums/app/settings_enums.proto b/stats/enums/app/settings_enums.proto
index 69b32c2..c24608b 100644
--- a/stats/enums/app/settings_enums.proto
+++ b/stats/enums/app/settings_enums.proto
@@ -744,6 +744,243 @@
// CATEGORY: SETTINGS
// OS: R
ACTION_CONFIRM_SIM_DELETION_OFF = 1739;
+
+ // ACTION: Settings > System > Gestures > Double tap > Toggle on Double tap
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_ENABLED = 1740;
+
+ // ACTION: Settings > System > Gestures > Double tap > Toggle off Double tap
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_DISABLED = 1741;
+
+ // ACTION: Settings > System > Gestures > Double tap > Invoke Assistant
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_ACTION_ASSISTANT = 1742;
+
+ // ACTION: Settings > System > Gestures > Double tap > Take screenshot
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_ACTION_SCREENSHOT = 1743;
+
+ // ACTION: Settings > System > Gestures > Double tap > Play and pause
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_ACTION_PLAY_PAUSE = 1744;
+
+ // ACTION: Settings > System > Gestures > Double tap > Open app overview
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_ACTION_OVERVIEW = 1745;
+
+ // ACTION: Settings > System > Gestures > Double tap > Open notification shade
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_ACTION_NOTIFICATION_SHADE = 1746;
+
+ // ACTION: Settings > System > Gestures > Double tap > Require harder taps
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_LOW_SENSITIVITY = 1747;
+
+ // OPEN: Columbus Gesture training intro in Settings
+ // CATEGORY: SETTINGS
+ // OS: S
+ SETTINGS_COLUMBUS_GESTURE_TRAINING_INTRO = 1748;
+
+ // OPEN: Columbus Gesture training enrolling in Settings
+ // CATEGORY: SETTINGS
+ // OS: S
+ SETTINGS_COLUMBUS_GESTURE_TRAINING_ENROLLING = 1749;
+
+ // OPEN: Columbus Gesture training finished in Settings
+ // CATEGORY: SETTINGS
+ // OS: S
+ SETTINGS_COLUMBUS_GESTURE_TRAINING_FINISHED = 1750;
+
+ // ACTION: Settings > Display > Auto-rotate screen > Enable Face Detection
+ // SUBTYPE: 0 is off, 1 is on
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_CAMERA_ROTATE_TOGGLE = 1751;
+
+ // ACTION: Allow or deny an app to set alarms and reminders
+ ACTION_ALARMS_AND_REMINDERS_TOGGLE = 1752;
+
+ // ACTION: Settings > Display > Auto-rotate screen > Use Auto-Rotate
+ // SUBTYPE: 0 is off, 1 is on
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_ROTATE_ROTATE_MASTER_TOGGLE = 1753;
+
+ // ACTION: Settings > Display > Screen timeout > Timeout
+ // SUBTYPE: new timeout in millis
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_SCREEN_TIMEOUT_CHANGED = 1754;
+
+ // ACTION: Settings > Display > Screen timeout > Screen attention
+ // SUBTYPE: 0 is off, 1 is on
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_SCREEN_ATTENTION_CHANGED = 1755;
+
+ // ACTION: Settings > System > Gestures > Back tap > Open app
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_ACTION_OPEN_APP = 1756;
+
+ // ACTION: Settings > System > Gestures > Back tap > Open app (Gear icon) > Any
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_SELECT_APP = 1757;
+
+ // OPEN: Columbus Gesture training action in Settings
+ // CATEGORY: SETTINGS
+ // OS: S
+ SETTINGS_COLUMBUS_GESTURE_TRAINING_ACTION = 1758;
+
+ // OPEN: Columbus Gesture training app selection in Settings
+ // CATEGORY: SETTINGS
+ // OS: S
+ SETTINGS_COLUMBUS_GESTURE_TRAINING_APP = 1759;
+
+ // ACTION: Settings > System > Gestures > Back tap > Open app (Gear icon) > Any app (Gear icon) > Any
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_COLUMBUS_SELECT_APP_SHORTCUT = 1760;
+
+ // ACTION: Mobile network settings > Advanced > Allow 2G > Toggle on/off
+ // Note: Can be re-enabled via carrier-initiated update to
+ // CarrierConfigManager.
+ // VALUE: 1 for 2G enabled, 0 for disabled
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_2G_ENABLED = 1761;
+
+ // ACTION: Allow or deny an app to manage media files
+ // SUBTYPE: 0 is deny, 1 is allow
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_MEDIA_MANAGEMENT_APPS_TOGGLE = 1762;
+
+ // ACTION: Settings > User > Confirm exit guest mode dialog > Delete
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_USER_GUEST_EXIT_CONFIRMED = 1763;
+
+ // ACTION: Settings > User > Add guest
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_USER_GUEST_ADD = 1764;
+
+ // ACTION: Settings > User > Guest > Switch to Guest
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_SWITCH_TO_GUEST = 1765;
+
+ // ACTION: Settings > Battery Usage > Click time slot
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_BATTERY_USAGE_TIME_SLOT = 1766;
+
+ // ACTION: Settings > Battery Usage > Click show all
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_BATTERY_USAGE_SHOW_ALL = 1767;
+
+ // ACTION: Settings > Battery Usage > Click app item
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_BATTERY_USAGE_APP_ITEM = 1768;
+
+ // ACTION: Settings > Battery Usage > Click system item
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_BATTERY_USAGE_SYSTEM_ITEM = 1769;
+
+ // ACTION: Settings > Battery Usage > Click expand item
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_BATTERY_USAGE_EXPAND_ITEM = 1770;
+
+ // ACTION: Settings > Battery settings > Battery tip > Battery defender
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_TIP_BATTERY_DEFENDER = 1771;
+
+ // ACTION: Settings > Battery settings > Battery tip > Defender tip
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_BATTERY_DEFENDER_TIP = 1772;
+
+ // Action: Settings > Apps > AppInfo > Open
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_APP_INFO_OPEN = 1773;
+
+ // Action: Settings > Apps > AppInfo > Disable
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_APP_INFO_DISABLE = 1774;
+
+ // Action: Settings > Apps > AppInfo > Force Stop
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_APP_INFO_FORCE_STOP = 1775;
+
+ // Action: Settings > Apps > AppInfo > Battery > Unrestricted
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_APP_BATTERY_USAGE_UNRESTRICTED = 1776;
+
+ // Action: Settings > Apps > AppInfo > Battery > Optimized
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_APP_BATTERY_USAGE_OPTIMIZED = 1777;
+
+ // Action: Settings > Apps > AppInfo > Battery > Restricted
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_APP_BATTERY_USAGE_RESTRICTED = 1778;
+
+ // Action: Settings > Apps > AppInfo > Battery > Learn More
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_APP_BATTERY_LEARN_MORE = 1779;
+
+ // Action: Settings > Battery > Restricted Apps > Unchecked
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_APP_RESTRICTED_LIST_UNCHECKED = 1780;
+
+ // Action: Settings > Adaptive Preferences > Adaptive Charging
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_ADAPTIVE_CHARGING_TOGGLE = 1781;
+
+ // Action: Settings > Battery Share > toggle
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_REVERSE_CHARGING_TOGGLE = 1782;
+
+ // Action: Settings > Battery Share > threshold
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACTION_REVERSE_CHARGING_THRESHOLD = 1783;
+
+ // FIELD: Custom type for how battery saver is scheduled when enabled.
+ // See BatterySaverScheduledType.
+ // CATEGORY: SETTINGS
+ // OS: S
+ FIELD_BATTERY_SAVER_SCHEDULE_TYPE = 1784;
+
+ // FIELD: Custom type for the %age battery saver is triggered.
+ // CATEGORY: SETTINGS
+ // OS: S
+ FIELD_BATTERY_SAVER_PERCENTAGE_VALUE = 1785;
}
/**
@@ -1161,7 +1398,7 @@
// OPEN: Settings > Location > Scanning
// CATEGORY: SETTINGS
// OS: 6.0
- LOCATION_SCANNING = 131;
+ LOCATION_SCANNING = 131 [deprecated = true];
// OPEN: Settings > Sound & notification > App notifications
// CATEGORY: SETTINGS
@@ -1722,7 +1959,7 @@
// OPEN: Settings > System > Language & Region
SETTINGS_LANGUAGE_CATEGORY = 750;
- // OPEN: Settings > System > Input & Gesture > Swipe to notification gesture
+ // OPEN: Settings > System > Input & Gesture > Swipe fingerprint for notifications
SETTINGS_GESTURE_SWIPE_TO_NOTIFICATION = 751;
// OPEN: Settings > System > Input & Gesture > Double tap power button gesture
@@ -2310,10 +2547,10 @@
// OS: Q
ZEN_CUSTOM_SETTINGS_DIALOG = 1612;
- // OPEN: Settings > Developer Options > Game Driver Preferences
+ // OPEN: Settings > Developer Options > Graphics Driver Preferences
// CATEGORY: SETTINGS
// OS: Q
- SETTINGS_GAME_DRIVER_DASHBOARD = 1613;
+ SETTINGS_GRAPHICS_DRIVER_DASHBOARD = 1613;
// OPEN: Settings > Accessibility > Vibration > Ring vibration
// CATEGORY: SETTINGS
@@ -2335,6 +2572,7 @@
// OPEN: Settings > Display > Adaptive sleep
// OS: Q
+ // Note: Replaced in Android S+ with SCREEN_TIMEOUT
SETTINGS_ADAPTIVE_SLEEP = 1628;
// OPEN: Settings > System > Aware
@@ -2664,6 +2902,11 @@
// OS: R
DND_APPS_BYPASSING = 1840;
+ // OPEN: Settings > System > Gestures > One-Handed
+ // CATEGORY: SETTINGS
+ // OS: R QPR
+ SETTINGS_ONE_HANDED = 1841;
+
// OPEN: Settings > Battery > Advanced battery option
// CATEGORY: SETTINGS
// OS: R
@@ -2683,4 +2926,260 @@
// CATEGORY: SETTINGS
// OS: R
MEDIA_CONTROLS_SETTINGS = 1845;
+
+ // OPEN: Settings > System > Gestures > Swipe for notification
+ // CATEGORY: SETTINGS
+ // OS: R QPR
+ SETTINGS_SWIPE_BOTTOM_TO_NOTIFICATION = 1846;
+
+ // OPEN: Settings > System > Gestures > Emergency SOS Gesture
+ // CATEGORY: SETTINGS
+ // OS: S
+ EMERGENCY_SOS_GESTURE_SETTINGS = 1847;
+
+ // OPEN: Settings > System > Gestures > Double tap
+ // CATEGORY: SETTINGS
+ // OS: S
+ SETTINGS_COLUMBUS = 1848;
+
+ // OPEN: Settings > Accessibility > Magnification > Settings > Magnification area > Magnification switch shortcut dialog
+ // CATEGORY: SETTINGS
+ // OS: S
+ DIALOG_MAGNIFICATION_SWITCH_SHORTCUT = 1849;
+
+ // OPEN: Settings > Network & internet > Adaptive connectivity
+ // CATEGORY: SETTINGS
+ // OS: R QPR
+ ADAPTIVE_CONNECTIVITY_CATEGORY = 1850;
+
+ // OS: R QPR2
+ BLUETOOTH_PAIRING_RECEIVER = 1851;
+
+ // OPEN: Settings > Display > Screen timeout
+ // CATEGORY: SETTINGS
+ // OS: S
+ SCREEN_TIMEOUT = 1852;
+
+ // OPEN: Settings > Accessibility > Reduce Bright Colors
+ // CATEGORY: SETTINGS
+ // OS: S
+ REDUCE_BRIGHT_COLORS_SETTINGS = 1853;
+
+ // OPEN: Settings > Location > Time Zone Detection
+ // CATEGORY: SETTINGS
+ // OS: S
+ LOCATION_TIME_ZONE_DETECTION = 1854;
+
+ // OPEN: Settings > Developer options > Media transcode settings
+ // CATEGORY: SETTINGS
+ // OS: S
+ TRANSCODE_SETTINGS = 1855;
+
+ // OPEN: Settings > Security & screen lock -> Encryption & credentials > Certificate management app
+ // CATEGORY: SETTINGS
+ // OS: S
+ CREDENTIAL_MANAGEMENT_APP = 1856;
+
+ // OPEN: Settings > System -> Reset options > Erase downloaded SIMs
+ // CATEGORY: SETTINGS
+ // OS: S
+ RESET_EUICC = 1857;
+
+ // OPEN: Settings > Accessibility -> Text and display
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACCESSIBILITY_TEXT_AND_DISPLAY = 1858;
+
+ // OPEN: Settings > Emergency settings
+ // CATEGORY: SETTINGS
+ // OS: S
+ EMERGENCY_SETTINGS = 1859;
+
+ // OPEN: Settings -> Apps -> APP -> Extra App Info
+ // CATEGORY: SETTINGS
+ // OS: S
+ SETTINGS_EXTRA_APP_INFO = 1860;
+
+ // OPEN: Settings > Accessibility -> Tap assistance
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACCESSIBILITY_TAP_ASSISTANCE = 1861;
+
+ // OPEN: Settings > Accessibility -> System controls
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACCESSIBILITY_SYSTEM_CONTROLS = 1862;
+
+ // OPEN: Settings > Accessibility -> Audio adjustment
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACCESSIBILITY_AUDIO_ADJUSTMENT = 1863;
+
+ // OPEN: Settings > Accessibility -> Accessibility shortcuts
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACCESSIBILITY_SHORTCUTS_SETTINGS = 1864;
+
+ // Open: Settings > Notifications > notification listeners > a listener > bridged apps
+ // CATEGORY: SETTINGS
+ // OS: S
+ NOTIFICATION_ACCESS_BRIDGED_APPS = 1865;
+
+ // OPEN: Settings > Accessibility -> Text and display > Turn screen darker
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACCESSIBILITY_TURN_SCREEN_DARKER = 1866;
+
+ // OPEN: Settings > Display > Auto-rotate screen
+ // CATEGORY: SETTINGS
+ // OS: S
+ DISPLAY_AUTO_ROTATE_SETTINGS = 1867;
+
+ // OPEN: Settings > Location > Location Services
+ // CATEGORY: SETTINGS
+ // OS: S
+ LOCATION_SERVICES = 1868;
+
+ // OPEN: Settings > Apps > Gear > Special Access > Alarms and Reminders
+ // CATEGORY: SETTINGS
+ // OS: S
+ ALARMS_AND_REMINDERS = 1869;
+
+ // OPEN: Settings > Accessibility -> Accessibility shortcuts -> Accessibility button
+ // CATEGORY: SETTINGS
+ // OS: S
+ ACCESSIBILITY_BUTTON_SETTINGS = 1870;
+
+ // OPEN: Settings > System > Gestures > Back tap > Open app (Gear icon)
+ // CATEGORY: SETTINGS
+ // OS: S
+ SETTINGS_COLUMBUS_APP_SELECT = 1871;
+
+ // OPEN: Settings > System > Gestures > Back tap > Open app (Gear icon) > Any app (Gear icon)
+ // CATEGORY: SETTINGS
+ // OS: S
+ SETTINGS_COLUMBUS_APP_SHORTCUT_SELECT = 1872;
+
+ // OPEN: OPEN: Settings > Accessibility -> Edit shortcut dialog -> Customize accessibility button
+ // CATEGORY: SETTINGS
+ // OS: S
+ SWITCH_SHORTCUT_DIALOG_ACCESSIBILITY_BUTTON_SETTINGS = 1873;
+
+ // OPEN: Settings > Apps > Gear > Special app access > Media management apps
+ // CATEGORY: SETTINGS
+ // OS: S
+ MEDIA_MANAGEMENT_APPS = 1874;
+
+ // OPEN: Settings > Storage > Dialog for emptying trash files
+ // CATEGORY: SETTINGS
+ // OS: S
+ DIALOG_EMPTY_TRASH = 1875;
+
+ // OPEN: Settings > System > Date and time
+ // CATEGORY: SETTINGS
+ // OS: S
+ DIALOG_DATE_TIME_ENABLE_GEOTZ_WITH_DISABLED_LOCATION = 1876;
+
+ // OPEN: Settings > Sound > Work profile sounds
+ // CATEGORY: SETTINGS
+ // OS: S
+ WORK_PROFILE_SOUNDS = 1877;
+
+ // OPEN: Settings > Security > Face and fingerprint unlock
+ // CATEGORY: SETTINGS
+ // OS: S
+ COMBINED_BIOMETRIC = 1878;
+
+ // OPEN: Settings > Security > Face and fingerprint unlock for profile
+ // CATEGORY: SETTINGS
+ // OS: S
+ COMBINED_BIOMETRIC_PROFILE = 1879;
+
+ // OPEN: Settings > Battery > Battery Usage
+ // CATEGORY: SETTINGS
+ // OS: S
+ OPEN_BATTERY_USAGE = 1880;
+
+ // OPEN: Settings > Battery > Battery Saver
+ // CATEGORY: SETTINGS
+ // OS: S
+ OPEN_BATTERY_SAVER = 1881;
+
+ // OPEN: Settings > Battery > Adaptive Preferences
+ // CATEGORY: SETTINGS
+ // OS: S
+ OPEN_BATTERY_ADAPTIVE_PREFERENCES = 1882;
+
+ // OPEN: Settings > Battery > Battery Share
+ // CATEGORY: SETTINGS
+ // OS: S
+ OPEN_BATTERY_SHARE = 1883;
+
+ // OPEN: Settings > Security (if using alternative security settings)
+ // CATEGORY: SETTINGS
+ // OS: S
+ SECURITY_ALTERNATIVE = 1884;
+
+ // OPEN: Settings > Security > Advanced Settings (if using overflow fragment)
+ // CATEGORY: SETTINGS
+ // OS: S
+ SECURITY_ADVANCED = 1885;
+
+ // OPEN: Settings > Apps > Game settings
+ // CATEGORY: SETTINGS
+ // OS: S
+ GAME_SETTINGS = 1886;
+
+ // OPEN: Settings > Security > Warnings (if using alternative security settings).
+ // CATEGORY: SETTINGS
+ // OS: S
+ SECURITY_WARNINGS = 1887;
+
+ // OPEN: Settings > Battery > Battery Percentage
+ // CATEGORY: SETTINGS
+ // OS: S
+ OPEN_BATTERY_PERCENTAGE = 1888;
+
+ // OPEN: Settings > Apps > AppInfo > Battery
+ // CATEGORY: SETTINGS
+ // OS: S
+ OPEN_APP_BATTERY_USAGE = 1889;
+
+ // OPEN: Settings > Battery > Restricted Apps
+ // CATEGORY: SETTINGS
+ // OS: S
+ OPEN_APP_RESTRICTED_LIST = 1890;
+
+ // OPEN: Settings > Security > Warning > Dismiss
+ // CATEGORY: SETTINGS
+ // OS: S
+ SECURITY_CONFIRMATION_DIALOG = 1891;
+
+ // OPEN: Settings > Security > Face and fingerprint unlock (if consent is required)
+ // CATEGORY: SETTINGS
+ // OS: S
+ FINGERPRINT_PARENTAL_CONSENT = 1892;
+
+ // OPEN: Settings > Security > Face and fingerprint unlock (if consent is required)
+ // CATEGORY: SETTINGS
+ // OS: S
+ FACE_PARENTAL_CONSENT = 1893;
+
+ // OPEN: Settings > Security > Face and fingerprint unlock (when consent process ends)
+ // CATEGORY: SETTINGS
+ // OS: S
+ BIOMETRIC_CONSENT_PARENT_TO_CHILD = 1894;
+
+ // OPEN: Settings > Security & screen lock -> Encryption & credentials > Certificate management app > Remove app
+ // CATEGORY: SETTINGS
+ // OS: S
+ CREDENTIAL_MANAGEMENT_APP_REMOVE_APP = 1895;
+}
+
+// Battery Saver schedule types.
+enum BatterySaverScheduleType {
+ BATTERY_SAVER_SCHEDULE_TYPE_UNKNOWN = 0;
+ BATTERY_SAVER_SCHEDULE_TYPE_NO_SCHEDULE = 1;
+ BATTERY_SAVER_SCHEDULE_TYPE_BASED_ON_ROUTINE = 2;
+ BATTERY_SAVER_SCHEDULE_TYPE_BASED_ON_PERCENTAGE = 3;
}
diff --git a/stats/enums/app/tvsettings_enums.proto b/stats/enums/app/tvsettings_enums.proto
index 31c5dd6..f2b0023 100644
--- a/stats/enums/app/tvsettings_enums.proto
+++ b/stats/enums/app/tvsettings_enums.proto
@@ -149,6 +149,34 @@
ACCOUNT_SLICE_REG_ACCOUNT = 0x12100000;
// TvSettings > Account & Sign In (Slice) > [A regular account] >
+ // Services
+ ACCOUNT_SLICE_REG_ACCOUNT_SERVICES = 0x12110000;
+
+ // TvSettings > Account & Sign In (Slice) > [A regular account] >
+ // Payment & Purchases
+ ACCOUNT_SLICE_REG_ACCOUNT_PAYMENT = 0x12120000;
+
+ // TvSettings > Account & Sign In (Slice) > [A regular account] >
+ // Payment & Purchases >
+ // Require authentication for purchases (reauth interval)
+ ACCOUNT_SLICE_REG_ACCOUNT_PAYMENT_REAUTH = 0x12121000;
+
+ // TvSettings > Account & Sign In (Slice) > [A regular account] >
+ // Payment & Purchases >
+ // Require authentication for purchases (reauth interval) > Always
+ ACCOUNT_SLICE_REG_ACCOUNT_PAYMENT_REAUTH_ALWAYS = 0x12121100;
+
+ // TvSettings > Account & Sign In (Slice) > [A regular account] >
+ // Payment & Purchases >
+ // Require authentication for purchases (reauth interval) > Every 30 minutes
+ ACCOUNT_SLICE_REG_ACCOUNT_PAYMENT_REAUTH_30MINS = 0x12121200;
+
+ // TvSettings > Account & Sign In (Slice) > [A regular account] >
+ // Payment & Purchases >
+ // Require authentication for purchases (reauth interval) > Never
+ ACCOUNT_SLICE_REG_ACCOUNT_PAYMENT_REAUTH_NEVER = 0x12121300;
+
+ // TvSettings > Account & Sign In (Slice) > [A regular account] >
// Google Assistant
ACCOUNT_SLICE_REG_ACCOUNT_ASSISTANT = 0x12130000;
@@ -168,7 +196,11 @@
// Google Assistant > Personal results (toggle)
ACCOUNT_SLICE_REG_ACCOUNT_ASSISTANT_PERSONAL_RESULTS = 0x12134000;
- // Reserving [0x12140000, 0x12190000] for possible future settings
+ // TvSettings > Account & Sign In (Slice) > [A regular account] >
+ // Apps only mode (toggle)
+ ACCOUNT_SLICE_REG_ACCOUNT_APPS_ONLY_MODE = 0x12140000;
+
+ // Reserving [0x12150000, 0x12190000] for possible future settings
// TvSettings > Account & Sign In (Slice) > [A regular account] > Remove
ACCOUNT_SLICE_REG_ACCOUNT_REMOVE = 0x121A0000;
@@ -216,6 +248,48 @@
// TvSettings > Account & Sign In (Classic) > Add account
ACCOUNT_CLASSIC_ADD_ACCOUNT = 0x13A00000;
+ // TvSettings > Privacy
+ PRIVACY = 0x14000000;
+
+ // TvSettings > Privacy > Location
+ PRIVACY_LOCATION = 0x14100000;
+
+ // TvSettings > Privacy > Location > Location status (radio button)
+ PRIVACY_LOCATION_STATUS = 0x14110000;
+
+ // TvSettings > Privacy > Location > Location status (radio button) >
+ // Use Wi-Fi to estimate location
+ PRIVACY_LOCATION_STATUS_USE_WIFI = 0x14111000;
+
+ // TvSettings > Privacy > Location > Location status (radio button) > Off
+ PRIVACY_LOCATION_STATUS_OFF = 0x14112000;
+
+ // TvSettings > Privacy > Location > Scanning always available (toggle)
+ PRIVACY_LOCATION_ALWAYS_SCANNING_NETWORKS = 0x14120000;
+
+ // TvSettings > Privacy > Location > [An app that had recent requests]
+ PRIVACY_LOCATION_REQUESTED_APP = 0x14130000;
+
+ // TvSettings > Privacy > Usage & Diagnostics
+ PRIVACY_DIAGNOSTICS = 0x14200000;
+
+ // TvSettings > Privacy > Usage & Diagnostics > On (Toggle)
+ PRIVACY_DIAGNOSTICS_ON_OFF = 0x14210000;
+
+ // TvSettings > Privacy > Ads
+ PRIVACY_ADS = 0x14300000;
+
+ // The following three IDs may not actually be logged as they are within a
+ // GMSCore Activity but we reserve IDs for them.
+ // TvSettings > Privacy > Ads > Reset advertising ID
+ PRIVACY_ADS_RESET_AD_ID = 0x14310000;
+
+ // TvSettings > Privacy > Ads > Opt out of Ads Personalization
+ PRIVACY_ADS_OPT_OUT_PERSONALIZATION = 0x14320000;
+
+ // TvSettings > Privacy > Ads > Ads by Google (WebView)
+ PRIVACY_ADS_ADS_BY_GOOGLE = 0x14330000;
+
// TvSettings > Display & Sound
DISPLAY_SOUND = 0x15000000;
@@ -226,6 +300,34 @@
// Allow game mode (toggle)
DISPLAY_SOUND_ADVANCED_DISPLAY_GAME_MODE = 0x15110000;
+ // TvSettings > Display & Sound > Advanced display settings >
+ // Format Selection
+ DISPLAY_SOUND_ADVANCED_DISPLAY_FORMAT_SELECTION = 0x15120000;
+
+ // TvSettings > Display & Sound > Advanced display settings >
+ // Format Selection > Auto
+ DISPLAY_SOUND_ADVANCED_DISPLAY_FORMAT_SELECTION_AUTO = 0x15121000;
+
+ // TvSettings > Display & Sound > Advanced display settings >
+ // Format Selection > Manual
+ DISPLAY_SOUND_ADVANCED_DISPLAY_FORMAT_SELECTION_MANUAL = 0x15122000;
+
+ // TvSettings > Display & Sound > Advanced display settings >
+ // Format Selection > Dolby Vision
+ DISPLAY_SOUND_ADVANCED_DISPLAY_FORMAT_SELECTION_DOLBY_VISION = 0x15123000;
+
+ // TvSettings > Display & Sound > Advanced display settings >
+ // Format Selection > HDR 10
+ DISPLAY_SOUND_ADVANCED_DISPLAY_FORMAT_SELECTION_HDR10 = 0x15124000;
+
+ // TvSettings > Display & Sound > Advanced display settings >
+ // Format Selection > HLG
+ DISPLAY_SOUND_ADVANCED_DISPLAY_FORMAT_SELECTION_HLG = 0x15125000;
+
+ // TvSettings > Display & Sound > Advanced display settings >
+ // Format Selection > HDR10+
+ DISPLAY_SOUND_ADVANCED_DISPLAY_FORMAT_SELECTION_HDR10_PLUS = 0x15126000;
+
// TvSettings > Display & Sound > System sounds (toggle)
DISPLAY_SOUND_SYSTEM_SOUNDS = 0x15200000;
@@ -266,6 +368,12 @@
// TvSettings > Display & Sound > Advanced sound settings > DTS (toggle)
DISPLAY_SOUND_ADVANCED_SOUNDS_DTS = 0x15360000;
+ // TvSettings > Display & Sound > Advanced sound settings > DTS-UHD (toggle)
+ DISPLAY_SOUND_ADVANCED_SOUNDS_DTSUHD = 0x15361000;
+
+ // TvSettings > Display & Sound > Advanced sound settings > DRA (toggle)
+ DISPLAY_SOUND_ADVANCED_SOUNDS_DRA = 0x15362000;
+
// TvSettings > Display & Sound > Advanced sound settings > DTS-HD (toggle)
DISPLAY_SOUND_ADVANCED_SOUNDS_DTSHD = 0x15370000;
@@ -276,6 +384,21 @@
// Dolby TrueHD (toggle)
DISPLAY_SOUND_ADVANCED_SOUNDS_DTHD = 0x15390000;
+ // TvSettings > Display & Sound > Match content frame rate
+ DISPLAY_SOUND_MATCH_CONTENT_FRAMERATE = 0x15500000;
+
+ // TvSettings > Display & Sound > Match content frame rate >
+ // Seamless (toggle)
+ DISPLAY_SOUND_MATCH_CONTENT_FRAMERATE_SEAMLESS = 0x15510000;
+
+ // TvSettings > Display & Sound > Match content frame rate >
+ // Non-seamless (toggle)
+ DISPLAY_SOUND_MATCH_CONTENT_FRAMERATE_NON_SEAMLESS = 0x15520000;
+
+ // TvSettings > Display & Sound > Match content frame rate >
+ // Never (toggle)
+ DISPLAY_SOUND_MATCH_CONTENT_FRAMERATE_NEVER = 0x15530000;
+
// TvSettings > Apps
APPS = 0x16000000;
@@ -397,6 +520,9 @@
// TvSettings > Apps > Special app access > Picture-in-picture
APPS_SPECIAL_APP_ACCESS_PICTURE_IN_PICTURE = 0x16360000;
+ // TvSettings > Apps > Special app access > Alarms & Reminders
+ APPS_SPECIAL_APP_ACCESS_ALARMS_AND_REMINDERS = 0x16370000;
+
// TvSettings > Apps > Security & restrictions
APPS_SECURITY_RESTRICTIONS = 0x16400000;
@@ -536,6 +662,123 @@
// Cached data (brings up "Clear cached data?" dialog upon click)
SYSTEM_STORAGE_INTERNAL_STORAGE_CACHED = 0x17512000;
+ // TvSettings > System > Ambient mode
+ SYSTEM_AMBIENT = 0x17600000;
+
+ // TvSettings > System > Ambient mode > Start now
+ SYSTEM_AMBIENT_START = 0x17610000;
+
+ // TvSettings > System > Ambient mode > Settings
+ SYSTEM_AMBIENT_SETTINGS = 0x17620000;
+
+ // TvSettings > System > Ambient mode > Settings > Google Photos (Channels)
+ SYSTEM_AMBIENT_SETTINGS_CHANNEL_GP = 0x17621000;
+
+ // TvSettings > System > Ambient mode > Settings > Art gallery (Channels)
+ SYSTEM_AMBIENT_SETTINGS_CHANNEL_AG = 0x17622000;
+
+ // TvSettings > System > Ambient mode > Settings >
+ // Cinematic videos (Channels)
+ SYSTEM_AMBIENT_SETTINGS_CHANNEL_CV = 0x17623000;
+
+ // TvSettings > System > Ambient mode > Settings > Experimental (Channels)
+ SYSTEM_AMBIENT_SETTINGS_CHANNEL_EXP = 0x17624000;
+
+ // TvSettings > System > Ambient mode > Settings > Weather
+ SYSTEM_AMBIENT_SETTINGS_WEATHER = 0x17625000;
+
+ // TvSettings > System > Ambient mode > Settings > Weather > Hide
+ SYSTEM_AMBIENT_SETTINGS_WEATHER_HIDE = 0x17625100;
+
+ // TvSettings > System > Ambient mode > Settings > Weather > Celsius (Unit)
+ SYSTEM_AMBIENT_SETTINGS_WEATHER_UNIT_C = 0x17625200;
+
+ // TvSettings > System > Ambient mode > Settings > Weather >
+ // Fahrenheit (Unit)
+ SYSTEM_AMBIENT_SETTINGS_WEATHER_UNIT_F = 0x17625300;
+
+ // TvSettings > System > Ambient mode > Settings > Weather > Both (Unit)
+ SYSTEM_AMBIENT_SETTINGS_WEATHER_UNIT_BOTH = 0x17625400;
+
+ // TvSettings > System > Ambient mode > Settings > Time
+ SYSTEM_AMBIENT_SETTINGS_TIME = 0x17626000;
+
+ // TvSettings > System > Ambient mode > Settings > Time > Hide
+ SYSTEM_AMBIENT_SETTINGS_TIME_HIDE = 0x17626100;
+
+ // TvSettings > System > Ambient mode > Settings > Time > Show
+ SYSTEM_AMBIENT_SETTINGS_TIME_SHOW = 0x17626200;
+
+ // TvSettings > System > Ambient mode > Settings > Device information
+ SYSTEM_AMBIENT_SETTINGS_DEVICE_INFO = 0x17627000;
+
+ // TvSettings > System > Ambient mode > Settings > Device information > Hide
+ SYSTEM_AMBIENT_SETTINGS_DEVICE_INFO_HIDE = 0x17627100;
+
+ // TvSettings > System > Ambient mode > Settings > Device information > Show
+ SYSTEM_AMBIENT_SETTINGS_DEVICE_INFO_SHOW = 0x17627200;
+
+ // TvSettings > System > Ambient mode > Settings > Personal photo data
+ SYSTEM_AMBIENT_SETTINGS_PPD = 0x17628000;
+
+ // TvSettings > System > Ambient mode > Settings > Personal photo data >
+ // Hide
+ SYSTEM_AMBIENT_SETTINGS_PPD_HIDE = 0x17628100;
+
+ // TvSettings > System > Ambient mode > Settings > Personal photo data >
+ // Show
+ SYSTEM_AMBIENT_SETTINGS_PPD_SHOW = 0x17628200;
+
+ // TvSettings > System > Ambient mode > Settings > Portrait Google Photos
+ SYSTEM_AMBIENT_SETTINGS_PGP = 0x17629000;
+
+ // TvSettings > System > Ambient mode > Settings > Portrait Google Photos >
+ // Hide
+ SYSTEM_AMBIENT_SETTINGS_PGP_HIDE = 0x17629100;
+
+ // TvSettings > System > Ambient mode > Settings > Portrait Google Photos >
+ // Show
+ SYSTEM_AMBIENT_SETTINGS_PGP_SHOW = 0x17629200;
+
+ // TvSettings > System > Ambient mode > Settings > Portrait Google Photos >
+ // Show pairs
+ SYSTEM_AMBIENT_SETTINGS_PGP_SHOW_PAIRS = 0x17629300;
+
+ // TvSettings > System > Ambient mode > Settings > Personal photo curation
+ SYSTEM_AMBIENT_SETTINGS_PPC = 0x1762A000;
+
+ // TvSettings > System > Ambient mode > Settings > Personal photo curation >
+ // All albums
+ SYSTEM_AMBIENT_SETTINGS_PPC_ALL_ALBUMS = 0x1762A100;
+
+ // TvSettings > System > Ambient mode > Settings > Personal photo curation >
+ // Live albums only
+ SYSTEM_AMBIENT_SETTINGS_PPC_LIVE_ALBUMS = 0x1762A200;
+
+ // TvSettings > System > Ambient mode > Settings > Slideshow speed
+ SYSTEM_AMBIENT_SETTINGS_SLIDE_SPEED = 0x1762B000;
+
+ // TvSettings > System > Ambient mode > Settings > Slideshow speed > 5s
+ SYSTEM_AMBIENT_SETTINGS_SLIDE_SPEED_5S = 0x1762B100;
+
+ // TvSettings > System > Ambient mode > Settings > Slideshow speed > 10s
+ SYSTEM_AMBIENT_SETTINGS_SLIDE_SPEED_10S = 0x1762B200;
+
+ // TvSettings > System > Ambient mode > Settings > Slideshow speed > 30s
+ SYSTEM_AMBIENT_SETTINGS_SLIDE_SPEED_30S = 0x1762B300;
+
+ // TvSettings > System > Ambient mode > Settings > Slideshow speed > 1m
+ SYSTEM_AMBIENT_SETTINGS_SLIDE_SPEED_1M = 0x1762B400;
+
+ // TvSettings > System > Ambient mode > Settings > Slideshow speed > 3m
+ SYSTEM_AMBIENT_SETTINGS_SLIDE_SPEED_3M = 0x1762B500;
+
+ // TvSettings > System > Ambient mode > Settings > Slideshow speed > 5m
+ SYSTEM_AMBIENT_SETTINGS_SLIDE_SPEED_5M = 0x1762B600;
+
+ // TvSettings > System > Ambient mode > Settings > Slideshow speed > 10m
+ SYSTEM_AMBIENT_SETTINGS_SLIDE_SPEED_10M = 0x1762B700;
+
// TvSettings > System > Energy saver
SYSTEM_ENERGYSAVER = 0x17700000;
diff --git a/stats/enums/bluetooth/Android.bp b/stats/enums/bluetooth/Android.bp
new file mode 100644
index 0000000..c4edb73
--- /dev/null
+++ b/stats/enums/bluetooth/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_library_static {
+ name: "libbt-platform-protos-lite",
+ host_supported: true,
+ proto: {
+ export_proto_headers: true,
+ type: "lite",
+ },
+ srcs: [
+ "a2dp/enums.proto",
+ "enums.proto",
+ "hci/enums.proto",
+ "hfp/enums.proto",
+ "smp/enums.proto",
+ ],
+}
+
diff --git a/stats/enums/bluetooth/BUILD.gn b/stats/enums/bluetooth/BUILD.gn
new file mode 100644
index 0000000..e1f398e
--- /dev/null
+++ b/stats/enums/bluetooth/BUILD.gn
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2021 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//common-mk/proto_library.gni")
+
+proto_library("libbt-platform-protos-lite") {
+ proto_in_dir = "."
+ proto_out_dir = "frameworks/proto_logging/stats/enums/bluetooth"
+
+ sources = [
+ "a2dp/enums.proto",
+ "enums.proto",
+ "hci/enums.proto",
+ "hfp/enums.proto",
+ "smp/enums.proto",
+ ]
+
+ configs = [ "//common-mk:pic" ]
+}
diff --git a/stats/enums/bluetooth/enums.proto b/stats/enums/bluetooth/enums.proto
index 22f2498..dc60ede 100644
--- a/stats/enums/bluetooth/enums.proto
+++ b/stats/enums/bluetooth/enums.proto
@@ -41,6 +41,7 @@
ENABLE_DISABLE_REASON_USER_SWITCH = 8;
ENABLE_DISABLE_REASON_RESTORE_USER_SETTING = 9;
ENABLE_DISABLE_REASON_FACTORY_RESET = 10;
+ ENABLE_DISABLE_REASON_INIT_FLAGS_CHANGED = 11;
}
enum DirectionEnum {
diff --git a/stats/enums/net/enums.proto b/stats/enums/net/enums.proto
new file mode 100644
index 0000000..fbd5549
--- /dev/null
+++ b/stats/enums/net/enums.proto
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+
+package android.net;
+
+option java_outer_classname = "NetProtoEnums";
+option java_multiple_files = true;
+
+enum Transport {
+ // Indicates this network uses a Cellular transport.
+ TRANSPORT_CELLULAR = 0;
+ // Indicates this network uses a Wi-Fi transport.
+ TRANSPORT_WIFI = 1;
+ // Indicates this network uses a Bluetooth transport.
+ TRANSPORT_BLUETOOTH = 2;
+ // Indicates this network uses an Ethernet transport.
+ TRANSPORT_ETHERNET = 3;
+ // Indicates this network uses a VPN transport.
+ TRANSPORT_VPN = 4;
+ // Indicates this network uses a Wi-Fi Aware transport.
+ TRANSPORT_WIFI_AWARE = 5;
+ // Indicates this network uses a LoWPAN transport.
+ TRANSPORT_LOWPAN = 6;
+}
+
diff --git a/stats/enums/net/networkcapabilities.proto b/stats/enums/net/networkcapabilities.proto
deleted file mode 100644
index be0cad1..0000000
--- a/stats/enums/net/networkcapabilities.proto
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-syntax = "proto2";
-
-package android.net;
-
-option java_multiple_files = true;
-
-import "frameworks/base/core/proto/android/privacy.proto";
-
-/**
- * An android.net.NetworkCapabilities object.
- */
-message NetworkCapabilitiesProto {
- option (.android.msg_privacy).dest = DEST_AUTOMATIC;
-
- enum Transport {
- // Indicates this network uses a Cellular transport.
- TRANSPORT_CELLULAR = 0;
- // Indicates this network uses a Wi-Fi transport.
- TRANSPORT_WIFI = 1;
- // Indicates this network uses a Bluetooth transport.
- TRANSPORT_BLUETOOTH = 2;
- // Indicates this network uses an Ethernet transport.
- TRANSPORT_ETHERNET = 3;
- // Indicates this network uses a VPN transport.
- TRANSPORT_VPN = 4;
- // Indicates this network uses a Wi-Fi Aware transport.
- TRANSPORT_WIFI_AWARE = 5;
- // Indicates this network uses a LoWPAN transport.
- TRANSPORT_LOWPAN = 6;
- }
- repeated Transport transports = 1;
-
- enum NetCapability {
- // Indicates this is a network that has the ability to reach the
- // carrier's MMSC for sending and receiving MMS messages.
- NET_CAPABILITY_MMS = 0;
- // Indicates this is a network that has the ability to reach the
- // carrier's SUPL server, used to retrieve GPS information.
- NET_CAPABILITY_SUPL = 1;
- // Indicates this is a network that has the ability to reach the
- // carrier's DUN or tethering gateway.
- NET_CAPABILITY_DUN = 2;
- // Indicates this is a network that has the ability to reach the
- // carrier's FOTA portal, used for over the air updates.
- NET_CAPABILITY_FOTA = 3;
- // Indicates this is a network that has the ability to reach the
- // carrier's IMS servers, used for network registration and signaling.
- NET_CAPABILITY_IMS = 4;
- // Indicates this is a network that has the ability to reach the
- // carrier's CBS servers, used for carrier specific services.
- NET_CAPABILITY_CBS = 5;
- // Indicates this is a network that has the ability to reach a Wi-Fi
- // direct peer.
- NET_CAPABILITY_WIFI_P2P = 6;
- // Indicates this is a network that has the ability to reach a carrier's
- // Initial Attach servers.
- NET_CAPABILITY_IA = 7;
- // Indicates this is a network that has the ability to reach a carrier's
- // RCS servers, used for Rich Communication Services.
- NET_CAPABILITY_RCS = 8;
- // Indicates this is a network that has the ability to reach a carrier's
- // XCAP servers, used for configuration and control.
- NET_CAPABILITY_XCAP = 9;
- // Indicates this is a network that has the ability to reach a carrier's
- // Emergency IMS servers or other services, used for network signaling
- // during emergency calls.
- NET_CAPABILITY_EIMS = 10;
- // Indicates that this network is unmetered.
- NET_CAPABILITY_NOT_METERED = 11;
- // Indicates that this network should be able to reach the internet.
- NET_CAPABILITY_INTERNET = 12;
- // Indicates that this network is available for general use. If this is
- // not set applications should not attempt to communicate on this
- // network. Note that this is simply informative and not enforcement -
- // enforcement is handled via other means. Set by default.
- NET_CAPABILITY_NOT_RESTRICTED = 13;
- // Indicates that the user has indicated implicit trust of this network.
- // This generally means it's a sim-selected carrier, a plugged in
- // ethernet, a paired BT device or a wifi the user asked to connect to.
- // Untrusted networks are probably limited to unknown wifi AP. Set by
- // default.
- NET_CAPABILITY_TRUSTED = 14;
- // Indicates that this network is not a VPN. This capability is set by
- // default and should be explicitly cleared for VPN networks.
- NET_CAPABILITY_NOT_VPN = 15;
- // Indicates that connectivity on this network was successfully
- // validated. For example, for a network with NET_CAPABILITY_INTERNET,
- // it means that Internet connectivity was successfully detected.
- NET_CAPABILITY_VALIDATED = 16;
- // Indicates that this network was found to have a captive portal in
- // place last time it was probed.
- NET_CAPABILITY_CAPTIVE_PORTAL = 17;
- // Indicates that this network is not roaming.
- NET_CAPABILITY_NOT_ROAMING = 18;
- // Indicates that this network is available for use by apps, and not a
- // network that is being kept up in the background to facilitate fast
- // network switching.
- NET_CAPABILITY_FOREGROUND = 19;
- }
- repeated NetCapability capabilities = 2;
-
- // Passive link bandwidth. This is a rough guide of the expected peak
- // bandwidth for the first hop on the given transport. It is not measured,
- // but may take into account link parameters (Radio technology, allocated
- // channels, etc).
- optional int32 link_up_bandwidth_kbps = 3;
- optional int32 link_down_bandwidth_kbps = 4;
-
- optional string network_specifier = 5 [ (.android.privacy).dest = DEST_EXPLICIT ];
-
- // True if this object specifies a signal strength.
- optional bool can_report_signal_strength = 6;
- // This is a signed integer, and higher values indicate better signal. The
- // exact units are bearer-dependent. For example, Wi-Fi uses RSSI.
- // Only valid if can_report_signal_strength is true.
- optional sint32 signal_strength = 7;
-}
diff --git a/stats/enums/os/enums.proto b/stats/enums/os/enums.proto
index 566861b..1b3ccd0 100644
--- a/stats/enums/os/enums.proto
+++ b/stats/enums/os/enums.proto
@@ -56,6 +56,30 @@
BATTERY_STATUS_FULL = 5;
}
+enum PowerComponentEnum {
+ POWER_COMPONENT_SCREEN = 0;
+ POWER_COMPONENT_CPU = 1;
+ POWER_COMPONENT_BLUETOOTH = 2;
+ POWER_COMPONENT_CAMERA = 3;
+ POWER_COMPONENT_AUDIO = 4;
+ POWER_COMPONENT_VIDEO = 5;
+ POWER_COMPONENT_FLASHLIGHT = 6;
+ POWER_COMPONENT_SYSTEM_SERVICES = 7;
+ POWER_COMPONENT_MOBILE_RADIO = 8;
+ POWER_COMPONENT_SENSORS = 9;
+ POWER_COMPONENT_GNSS = 10;
+ POWER_COMPONENT_WIFI = 11;
+ POWER_COMPONENT_WAKELOCK = 12;
+ POWER_COMPONENT_MEMORY = 13;
+ POWER_COMPONENT_PHONE = 14;
+ POWER_COMPONENT_AMBIENT_DISPLAY = 15;
+ POWER_COMPONENT_IDLE = 16;
+ // Power that is re-attributed to other battery consumers. For example, for System Server
+ // this represents the power attributed to apps requesting system services.
+ // The value should be negative or zero.
+ POWER_COMPONENT_REATTRIBUTED_TO_OTHER_CONSUMERS = 17;
+}
+
// These constants are defined in hardware/interfaces/thermal/1.0/types.hal
// and in hardware/interfaces/thermal/2.0/types.hal
// They are primarily used by android/os/HardwarePropertiesManager.java.
diff --git a/stats/enums/server/connectivity/Android.bp b/stats/enums/server/connectivity/Android.bp
index 50c238b..6d37595 100644
--- a/stats/enums/server/connectivity/Android.bp
+++ b/stats/enums/server/connectivity/Android.bp
@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
java_library_static {
name: "datastallprotosnano",
proto: {
diff --git a/stats/enums/server/job/enums.proto b/stats/enums/server/job/enums.proto
index 50fc031..2ef08a5 100644
--- a/stats/enums/server/job/enums.proto
+++ b/stats/enums/server/job/enums.proto
@@ -40,4 +40,5 @@
CONSTRAINT_DEVICE_NOT_DOZING = 9;
CONSTRAINT_WITHIN_QUOTA = 10;
CONSTRAINT_BACKGROUND_NOT_RESTRICTED = 11;
+ CONSTRAINT_WITHIN_EXPEDITED_JOB_QUOTA = 12;
}
diff --git a/stats/enums/service/enums.proto b/stats/enums/service/enums.proto
new file mode 100644
index 0000000..4116abf
--- /dev/null
+++ b/stats/enums/service/enums.proto
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+package android.service;
+
+option java_outer_classname = "ServiceProtoEnums";
+option java_multiple_files = true;
+
+enum UsbEndPointType {
+ USB_ENDPOINT_TYPE_XFER_CONTROL = 0;
+ USB_ENDPOINT_TYPE_XFER_ISOC = 1;
+ USB_ENDPOINT_TYPE_XFER_BULK = 2;
+ USB_ENDPOINT_TYPE_XFER_INT = 3;
+}
+
+enum UsbEndPointDirection {
+ USB_ENDPOINT_DIR_OUT = 0;
+ USB_ENDPOINT_DIR_IN = 0x80;
+}
+
+enum UsbConnectionRecordMode {
+ USB_CONNECTION_RECORD_MODE_CONNECT = 0;
+ USB_CONNECTION_RECORD_MODE_CONNECT_BADPARSE = 1;
+ USB_CONNECTION_RECORD_MODE_CONNECT_BADDEVICE = 2;
+ USB_CONNECTION_RECORD_MODE_DISCONNECT = -1;
+}
+
+/* Same as android.hardware.usb.V1_2.Constants.ContaminantPresenceStatus */
+enum ContaminantPresenceStatus {
+ CONTAMINANT_STATUS_UNKNOWN = 0;
+ CONTAMINANT_STATUS_NOT_SUPPORTED = 1;
+ CONTAMINANT_STATUS_DISABLED = 2;
+ CONTAMINANT_STATUS_NOT_DETECTED = 3;
+ CONTAMINANT_STATUS_DETECTED = 4;
+}
diff --git a/stats/enums/service/procstats_enum.proto b/stats/enums/service/procstats_enum.proto
index 2abf373..d083f8c 100644
--- a/stats/enums/service/procstats_enum.proto
+++ b/stats/enums/service/procstats_enum.proto
@@ -36,12 +36,17 @@
// this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
// and not frameworks/base/core/java/android/app/ActivityManager.java
+// Next id: 17
enum ProcessState {
PROCESS_STATE_UNKNOWN = 0;
// Persistent system process.
PROCESS_STATE_PERSISTENT = 1;
// Top activity; actually any visible activity.
PROCESS_STATE_TOP = 2;
+ // Process bound by top or a foreground service
+ PROCESS_STATE_BOUND_TOP_OR_FGS = 15;
+ // Processing running a foreground service.
+ PROCESS_STATE_FGS = 16;
// Important foreground process (ime, wallpaper, etc).
PROCESS_STATE_IMPORTANT_FOREGROUND = 3;
// Important background process.
@@ -99,4 +104,4 @@
// Various cached processes; HOME, LAST_ACTIVITY, CACHED_ACTIVITY, CACHED_RECENT,
// CACHED_ACTIVITY_CLIENT, CACHED_EMPTY in ActivityManager
AGGREGATED_PROCESS_STATE_CACHED = 8;
-}
\ No newline at end of file
+}
diff --git a/stats/enums/service/usb.proto b/stats/enums/service/usb.proto
deleted file mode 100644
index 40c5a85..0000000
--- a/stats/enums/service/usb.proto
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-syntax = "proto2";
-package android.service.usb;
-
-option java_multiple_files = true;
-option java_outer_classname = "UsbServiceProto";
-
-import "frameworks/base/core/proto/android/content/component_name.proto";
-import "frameworks/base/core/proto/android/service/enums.proto";
-import "frameworks/base/core/proto/android/privacy.proto";
-
-message UsbServiceDumpProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional UsbDeviceManagerProto device_manager = 1;
- optional UsbHostManagerProto host_manager = 2;
- optional UsbPortManagerProto port_manager = 3;
- optional UsbAlsaManagerProto alsa_manager = 4;
- optional UsbSettingsManagerProto settings_manager = 5;
- optional UsbPermissionsManagerProto permissions_manager = 6;
-}
-
-message UsbDeviceManagerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional UsbHandlerProto handler = 1;
- optional UsbDebuggingManagerProto debugging_manager = 2;
-}
-
-message UsbHandlerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- /* Same as android.hardware.usb.gadget.V1_0.GadgetFunction.* */
- enum Function {
- FUNCTION_ADB = 1;
- FUNCTION_ACCESSORY = 2;
- FUNCTION_MTP = 4;
- FUNCTION_MIDI = 8;
- FUNCTION_PTP = 16;
- FUNCTION_RNDIS = 32;
- FUNCTION_AUDIO_SOURCE = 64;
- }
-
- repeated Function current_functions = 1;
- optional bool current_functions_applied = 2;
- repeated Function screen_unlocked_functions = 3;
- optional bool screen_locked = 4;
- optional bool connected = 5;
- optional bool configured = 6;
- optional UsbAccessoryProto current_accessory = 7;
- optional bool host_connected = 8;
- optional bool source_power = 9;
- optional bool sink_power = 10;
- optional bool usb_charging = 11;
- optional bool hide_usb_notification = 12;
- optional bool audio_accessory_connected = 13;
- optional bool adb_enabled = 14;
- optional string kernel_state = 15;
- optional string kernel_function_list = 16;
-}
-
-message UsbAccessoryProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional string manufacturer = 1;
- optional string model = 2;
- // For "classical" USB-accessories the manufacturer bakes this into the
- // firmware of the device. If an Android phone is configured as accessory, the
- // app that sets up the accessory side of the connection set this. Either way,
- // these are part of the detection protocol, and so they cannot be user set or
- // unique.
- optional string description = 3;
- optional string version = 4;
- optional string uri = 5 [ (android.privacy).dest = DEST_EXPLICIT ];
- // Non-resettable hardware ID.
- optional string serial = 6 [ (android.privacy).dest = DEST_LOCAL ];
-}
-
-message UsbDebuggingManagerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional bool connected_to_adb = 1;
- // A workstation that connects to the phone for debugging is identified by
- // this key.
- optional string last_key_received = 2 [ (android.privacy).dest = DEST_EXPLICIT ];
- optional string user_keys = 3 [ (android.privacy).dest = DEST_LOCAL ];
- optional string system_keys = 4 [ (android.privacy).dest = DEST_LOCAL ];
-}
-
-message UsbHostManagerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional android.content.ComponentNameProto default_usb_host_connection_handler = 1;
- repeated UsbDeviceProto devices = 2;
- optional int32 num_connects = 3;
- repeated UsbConnectionRecordProto connections = 4;
-}
-
-message UsbDeviceProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- // Generic USB name, not user-provided.
- optional string name = 1;
- // ID specific to the vendor, not the device.
- optional int32 vendor_id = 2;
- // ID of this product type: Each vendor gives each product a unique ID. E.g.
- // all mice of the same model would have the same ID.
- optional int32 product_id = 3;
- optional int32 class = 4;
- optional int32 subclass = 5;
- optional int32 protocol = 6;
- optional string manufacturer_name = 7;
- optional string product_name = 8;
- optional string version = 9;
- // Non-resettable hardware ID.
- optional string serial_number = 10 [ (android.privacy).dest = DEST_LOCAL ];
- repeated UsbConfigurationProto configurations = 11;
-}
-
-message UsbConfigurationProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- // A single USB device can have several configurations and the app accessing
- // the USB device can switch between them. At any time only one can be active.
- // Each configuration can present completely different interfaces end
- // endpoints, i.e. a completely different behavior.
- optional int32 id = 1;
- // Hardware-defined name, not set by the user.
- optional string name = 2;
- optional uint32 attributes = 3;
- optional int32 max_power = 4;
- repeated UsbInterfaceProto interfaces = 5;
-}
-
-message UsbInterfaceProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- // Hardware defined. This is the id used by the app to identify the interface.
- optional int32 id = 1;
- optional int32 alternate_settings = 2;
- optional string name = 3;
- optional int32 class = 4;
- optional int32 subclass = 5;
- optional int32 protocol = 6;
- repeated UsbEndPointProto endpoints = 7;
-}
-
-message UsbEndPointProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional int32 endpoint_number = 1;
- optional android.service.UsbEndPointDirection direction = 2;
- // The address of the endpoint. Needed to read and write to the endpoint.
- optional int32 address = 3;
- optional android.service.UsbEndPointType type = 4;
- optional uint32 attributes = 5;
- optional int32 max_packet_size = 6;
- optional int32 interval = 7;
-}
-
-message UsbConnectionRecordProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- // usb device's address, e.g. 001/002, nothing about the phone
- optional string device_address = 1;
- optional android.service.UsbConnectionRecordMode mode = 2;
- optional int64 timestamp = 3;
- optional int32 manufacturer = 4;
- optional int32 product = 5;
- optional UsbIsHeadsetProto is_headset = 6;
-}
-
-message UsbIsHeadsetProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional bool in = 1;
- optional bool out = 2;
-}
-
-message UsbPortManagerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional bool is_simulation_active = 1;
- repeated UsbPortInfoProto usb_ports = 2;
-}
-
-message UsbPortInfoProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional UsbPortProto port = 1;
- optional UsbPortStatusProto status = 2;
- optional bool can_change_mode = 3;
- optional bool can_change_power_role = 4;
- optional bool can_change_data_role = 5;
- optional int64 connected_at_millis = 6;
- optional int64 last_connect_duration_millis = 7;
-}
-
-message UsbPortProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- /* Same as android.hardware.usb.V1_1.Constants.PortMode_1_1 */
- enum Mode {
- MODE_NONE = 0;
- MODE_UFP = 1;
- MODE_DFP = 2;
- MODE_DRP = 3;
- MODE_AUDIO_ACCESSORY = 4;
- MODE_DEBUG_ACCESSORY = 8;
- }
-
- // ID of the port. A device (eg: Chromebooks) might have multiple ports.
- optional string id = 1;
- repeated Mode supported_modes = 2;
-}
-
-/* Same as android.hardware.usb.V1_2.Constants.ContaminantPresenceStatus */
-enum ContaminantPresenceStatus {
- CONTAMINANT_STATUS_UNKNOWN = 0;
- CONTAMINANT_STATUS_NOT_SUPPORTED = 1;
- CONTAMINANT_STATUS_DISABLED = 2;
- CONTAMINANT_STATUS_NOT_DETECTED = 3;
- CONTAMINANT_STATUS_DETECTED = 4;
-}
-
-message UsbPortStatusProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- /* Same as android.hardware.usb.V1_0.Constants.PortPowerRole */
- enum PowerRole {
- POWER_ROLE_NONE = 0;
- POWER_ROLE_SOURCE = 1;
- POWER_ROLE_SINK = 2;
- }
-
- /* Same as android.hardware.usb.V1_0.Constants.PortDataRole */
- enum DataRole {
- DATA_ROLE_NONE = 0;
- DATA_ROLE_HOST = 1;
- DATA_ROLE_DEVICE = 2;
- }
-
- optional bool connected = 1;
- optional UsbPortProto.Mode current_mode = 2;
- optional PowerRole power_role = 3;
- optional DataRole data_role = 4;
- repeated UsbPortStatusRoleCombinationProto role_combinations = 5;
- optional ContaminantPresenceStatus contaminant_presence_status = 6;
-}
-
-message UsbPortStatusRoleCombinationProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional UsbPortStatusProto.PowerRole power_role = 1;
- optional UsbPortStatusProto.DataRole data_role = 2;
-}
-
-message UsbAlsaManagerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional int32 cards_parser = 1;
- repeated UsbAlsaDeviceProto alsa_devices = 2;
- repeated UsbMidiDeviceProto midi_devices = 3;
-}
-
-message UsbAlsaDeviceProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional int32 card = 1;
- optional int32 device = 2;
- optional string name = 3;
- optional bool has_playback = 4;
- optional bool has_capture = 5;
- // usb device's address, e.g. 001/002, nothing about the phone
- optional string address = 6;
-}
-
-message UsbMidiDeviceProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional int32 card = 1;
- optional int32 device = 2;
- // usb device's address, e.g. 001/002, nothing about the phone
- optional string device_address = 3;
-}
-
-message UsbSettingsManagerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- repeated UsbUserSettingsManagerProto user_settings = 1;
- repeated UsbProfileGroupSettingsManagerProto profile_group_settings = 2;
-}
-
-message UsbUserSettingsManagerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional int32 user_id = 1;
- reserved 2; // previously device_permissions, now unused
- reserved 3; // previously accessory_permissions, now unused
- repeated UsbDeviceAttachedActivities device_attached_activities = 4;
- repeated UsbAccessoryAttachedActivities accessory_attached_activities = 5;
-}
-
-message UsbProfileGroupSettingsManagerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- // The user id of the personal profile if the device has a work profile.
- optional int32 parent_user_id = 1;
- repeated UsbSettingsDevicePreferenceProto device_preferences = 2;
- repeated UsbSettingsAccessoryPreferenceProto accessory_preferences = 3;
-}
-
-message UsbSettingsDevicePreferenceProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional UsbDeviceFilterProto filter = 1;
- optional UserPackageProto user_package = 2;
-}
-
-message UsbPermissionsManagerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- repeated UsbUserPermissionsManagerProto user_permissions = 1;
-}
-
-message UsbUserPermissionsManagerProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional int32 user_id = 1;
-
- repeated UsbDevicePermissionProto device_permissions = 2;
- repeated UsbAccessoryPermissionProto accessory_permissions = 3;
-
- repeated UsbDevicePersistentPermissionProto device_persistent_permissions = 4;
- repeated UsbAccessoryPersistentPermissionProto accessory_persistent_permissions = 5;
-}
-
-message UsbDevicePermissionProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- // Name of device set by manufacturer
- // All devices of the same model have the same name
- optional string device_name = 1;
- repeated int32 uids = 2;
-}
-
-message UsbAccessoryPermissionProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- // Description of accessory set by manufacturer
- // All accessories of the same model have the same description
- optional string accessory_description = 1;
- repeated int32 uids = 2;
-}
-
-message UsbDevicePersistentPermissionProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional UsbDeviceFilterProto device_filter = 1;
- repeated UsbUidPermissionProto permission_values = 2;
-}
-
-message UsbAccessoryPersistentPermissionProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional UsbAccessoryFilterProto accessory_filter = 1;
- repeated UsbUidPermissionProto permission_values = 2;
-}
-
-message UsbUidPermissionProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional int32 uid = 1;
- optional bool is_granted = 2;
-}
-
-message UsbDeviceFilterProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- // Mirrors the vendor_id of UsbDeviceProto.
- optional int32 vendor_id = 1;
- optional int32 product_id = 2;
- optional int32 class = 3;
- optional int32 subclass = 4;
- optional int32 protocol = 5;
- optional string manufacturer_name = 6;
- optional string product_name = 7;
- optional string serial_number = 8 [ (android.privacy).dest = DEST_EXPLICIT ];
-}
-
-message UserPackageProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional int32 user_id = 1;
- optional string package_name =2;
-}
-
-message UsbSettingsAccessoryPreferenceProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional UsbAccessoryFilterProto filter = 1;
- optional UserPackageProto user_package = 2;
-}
-
-message UsbAccessoryFilterProto {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional string manufacturer = 1;
- optional string model = 2;
- optional string version = 3;
-}
-
-message UsbDeviceAttachedActivities {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional android.content.ComponentNameProto activity = 1;
- repeated UsbDeviceFilterProto filters = 2;
-}
-
-message UsbAccessoryAttachedActivities {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- optional android.content.ComponentNameProto activity = 1;
- repeated UsbAccessoryFilterProto filters = 2;
-}
diff --git a/stats/enums/stats/accessibility/accessibility_enums.proto b/stats/enums/stats/accessibility/accessibility_enums.proto
index 5118ad5..6b113d0 100644
--- a/stats/enums/stats/accessibility/accessibility_enums.proto
+++ b/stats/enums/stats/accessibility/accessibility_enums.proto
@@ -25,6 +25,7 @@
VOLUME_KEY = 2;
TRIPLE_TAP = 3;
A11Y_BUTTON_LONG_PRESS = 4;
+ A11Y_FLOATING_MENU = 5;
}
// The service status code.
@@ -32,4 +33,12 @@
UNKNOWN = 0;
ENABLED = 1;
DISABLED = 2;
-}
\ No newline at end of file
+}
+
+// The magnification mode.
+enum MagnificationMode {
+ MAGNIFICATION_UNKNOWN_MODE = 0;
+ MAGNIFICATION_FULL_SCREEN = 1;
+ MAGNIFICATION_WINDOW = 2;
+ MAGNIFICATION_ALL = 3;
+}
diff --git a/stats/enums/stats/camera/Android.bp b/stats/enums/stats/camera/Android.bp
deleted file mode 100644
index cc75e57..0000000
--- a/stats/enums/stats/camera/Android.bp
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2020 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-java_library {
- name: "cameraprotosnano",
- proto: {
- type: "nano",
- },
- srcs: [
- "*.proto",
- ],
- java_version: "1.8",
- target: {
- android: {
- jarjar_rules: "jarjar-rules.txt",
- },
- host: {
- static_libs: ["libprotobuf-java-nano"],
- }
- },
- sdk_version: "core_platform",
-}
diff --git a/stats/enums/stats/camera/jarjar-rules.txt b/stats/enums/stats/camera/jarjar-rules.txt
deleted file mode 100644
index 40043a8..0000000
--- a/stats/enums/stats/camera/jarjar-rules.txt
+++ /dev/null
@@ -1 +0,0 @@
-rule com.google.protobuf.nano.** com.android.framework.protobuf.nano.@1
diff --git a/stats/enums/stats/connectivity/Android.bp b/stats/enums/stats/connectivity/Android.bp
index 5e6ac3c..748a7df 100644
--- a/stats/enums/stats/connectivity/Android.bp
+++ b/stats/enums/stats/connectivity/Android.bp
@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
java_library_static {
name: "networkstackprotos",
proto: {
@@ -35,4 +39,5 @@
"com.android.tethering",
],
sdk_version: "system_current",
+ min_sdk_version: "30",
}
diff --git a/stats/enums/stats/connectivity/network_stack.proto b/stats/enums/stats/connectivity/network_stack.proto
index e9726d7..02adebb 100644
--- a/stats/enums/stats/connectivity/network_stack.proto
+++ b/stats/enums/stats/connectivity/network_stack.proto
@@ -174,6 +174,48 @@
QE_IPV6_PROVISIONING_ROUTER_LOST = 1;
}
+enum IpType {
+ // Unknown IP address type;
+ UNKNOWN = 0;
+ // IPv4 address;
+ IPV4 = 4;
+ // IPv6 address;
+ IPV6 = 6;
+}
+
+enum NudEventType {
+ // Unknown event type;
+ NUD_EVENT_UNKNOWN = 0;
+ // Forced nud probe after roaming from IpReachabilityMonitor, neighbor is unreachable;
+ NUD_POST_ROAMING_FAILED = 1;
+ // Forced nud probe after roaming from IpReachabilityMonitor, neighbor is unreachable and
+ // IP provisioning lost;
+ NUD_POST_ROAMING_FAILED_CRITICAL = 2;
+ // Forced nud probe after receiving CMD_CONFIRM from IpReachabilityMonitor, neighbor is
+ // unreachable;
+ NUD_CONFIRM_FAILED = 3;
+ // Forced nud probe after receiving CMD_CONFIRM from IpReachabilityMonitor, neighbor is
+ // unreachable and IP provisioning lost;
+ NUD_CONFIRM_FAILED_CRITICAL = 4;
+ // Neighbor unreachable notification from kernel;
+ NUD_ORGANIC_FAILED = 5;
+ // Neighbor unreachable notification from kernel, and IP provisioning is also lost;
+ NUD_ORGANIC_FAILED_CRITICAL = 6;
+ // NUD probe failure due to neighbor's MAC address has changed.
+ NUD_MAC_ADDRESS_CHANGED = 7;
+}
+
+enum NudNeighborType {
+ // Unknown neighbor type;
+ NUD_NEIGHBOR_UNKNOWN = 0;
+ // Neighbor is default gateway;
+ NUD_NEIGHBOR_GATEWAY = 1;
+ // Neighbor is DNS server;
+ NUD_NEIGHBOR_DNS = 2;
+ // Neighbor is both the default gateway and DNS server;
+ NUD_NEIGHBOR_BOTH = 3;
+}
+
message NetworkStackEventData {
}
diff --git a/stats/enums/stats/devicepolicy/Android.bp b/stats/enums/stats/devicepolicy/Android.bp
index 5fb278a..51b1250 100644
--- a/stats/enums/stats/devicepolicy/Android.bp
+++ b/stats/enums/stats/devicepolicy/Android.bp
@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
java_library_static {
name: "devicepolicyprotosnano",
proto: {
diff --git a/stats/enums/stats/devicepolicy/device_policy_enums.proto b/stats/enums/stats/devicepolicy/device_policy_enums.proto
index 7c1a049..ad74b7b 100644
--- a/stats/enums/stats/devicepolicy/device_policy_enums.proto
+++ b/stats/enums/stats/devicepolicy/device_policy_enums.proto
@@ -201,4 +201,34 @@
DOCSUI_EMPTY_STATE_QUIET_MODE = 174;
DOCSUI_LAUNCH_OTHER_APP = 175;
DOCSUI_PICK_RESULT = 176;
+ SET_PASSWORD_COMPLEXITY = 177;
+ CREDENTIAL_MANAGEMENT_APP_REQUEST_NAME = 178;
+ CREDENTIAL_MANAGEMENT_APP_REQUEST_POLICY = 179;
+ CREDENTIAL_MANAGEMENT_APP_REQUEST_ACCEPTED = 180;
+ CREDENTIAL_MANAGEMENT_APP_REQUEST_DENIED = 181;
+ CREDENTIAL_MANAGEMENT_APP_REQUEST_FAILED = 182;
+ CREDENTIAL_MANAGEMENT_APP_CREDENTIAL_FOUND_IN_POLICY = 183;
+ CREDENTIAL_MANAGEMENT_APP_INSTALL_KEY_PAIR_FAILED = 184;
+ CREDENTIAL_MANAGEMENT_APP_GENERATE_KEY_PAIR_FAILED = 185;
+ CREDENTIAL_MANAGEMENT_APP_POLICY_LOOKUP_FAILED = 186;
+ CREDENTIAL_MANAGEMENT_APP_REMOVED = 187;
+ SET_ORGANIZATION_ID = 188;
+ IS_ACTIVE_PASSWORD_SUFFICIENT_FOR_DEVICE = 189;
+ PLATFORM_PROVISIONING_COPY_ACCOUNT_MS = 190;
+ PLATFORM_PROVISIONING_CREATE_PROFILE_MS = 191;
+ PLATFORM_PROVISIONING_START_PROFILE_MS = 192;
+ PLATFORM_PROVISIONING_COPY_ACCOUNT_STATUS = 193;
+ PLATFORM_PROVISIONING_ERROR = 194;
+ PROVISIONING_PROVISION_MANAGED_PROFILE_TASK_MS = 195;
+ PROVISIONING_PROVISION_FULLY_MANAGED_DEVICE_TASK_MS = 196;
+ PLATFORM_PROVISIONING_PARAM = 197;
+ SET_USB_DATA_SIGNALING = 198;
+ SET_PREFERENTIAL_NETWORK_SERVICE_ENABLED = 199;
+ PROVISIONING_IS_LANDSCAPE = 200;
+ PROVISIONING_IS_NIGHT_MODE = 201;
+ ADD_ACCOUNT = 202;
+ ADD_ACCOUNT_EXPLICITLY = 203;
+ GET_ACCOUNT_AUTH_TOKEN = 204;
+ RESET_PASSWORD = 205;
+ RESET_PASSWORD_WITH_TOKEN = 206;
}
diff --git a/stats/enums/stats/dnsresolver/Android.bp b/stats/enums/stats/dnsresolver/Android.bp
index 1e8c763..b34d33a 100644
--- a/stats/enums/stats/dnsresolver/Android.bp
+++ b/stats/enums/stats/dnsresolver/Android.bp
@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
java_library_static {
name: "dnsresolverprotosnano",
proto: {
diff --git a/stats/enums/stats/dnsresolver/dns_resolver.proto b/stats/enums/stats/dnsresolver/dns_resolver.proto
index b17d12c..ed9df9c 100644
--- a/stats/enums/stats/dnsresolver/dns_resolver.proto
+++ b/stats/enums/stats/dnsresolver/dns_resolver.proto
@@ -158,6 +158,7 @@
PROTO_UDP = 1;
PROTO_TCP = 2;
PROTO_DOT = 3;
+ PROTO_DOH = 4;
}
enum PrivateDnsModes {
diff --git a/stats/enums/stats/hdmi/enums.proto b/stats/enums/stats/hdmi/enums.proto
new file mode 100644
index 0000000..acb8899
--- /dev/null
+++ b/stats/enums/stats/hdmi/enums.proto
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+
+package android.stats.hdmi;
+option java_multiple_files = true;
+option java_outer_classname = "HdmiStatsEnums";
+
+// HDMI CEC logical addresses.
+// Values correspond to "CEC Table 5 Logical Addresses" in the HDMI CEC 1.4b spec.
+enum LogicalAddress {
+ LOGICAL_ADDRESS_UNKNOWN = -1;
+ TV = 0;
+ RECORDING_DEVICE_1 = 1;
+ RECORDING_DEVICE_2 = 2;
+ TUNER_1 = 3;
+ PLAYBACK_DEVICE_1 = 4;
+ AUDIO_SYSTEM = 5;
+ TUNER_2 = 6;
+ TUNER_3 = 7;
+ PLAYBACK_DEVICE_2 = 8;
+ RECORDING_DEVICE_3 = 9;
+ TUNER_4 = 10;
+ PLAYBACK_DEVICE_3 = 11;
+ RESERVED_1 = 12;
+ RESERVED_2 = 13;
+ SPECIFIC_USE = 14;
+ UNREGISTERED_OR_BROADCAST = 15;
+}
+
+// The relationship between two paths.
+// Values correspond exactly to PathRelationship in com.android.server.hdmi.Constants.
+enum PathRelationship {
+ RELATIONSHIP_TO_ACTIVE_SOURCE_UNKNOWN = 0;
+ DIFFERENT_BRANCH = 1;
+ ANCESTOR = 2;
+ DESCENDANT = 3;
+ SIBLING = 4;
+ SAME = 5;
+}
+
+// The result of attempting to send a HDMI CEC message.
+// Values correspond to the constants in android.hardware.tv.cec.V1_0.SendMessageResult,
+// offset by 10.
+enum SendMessageResult {
+ SEND_MESSAGE_RESULT_UNKNOWN = 0;
+ SUCCESS = 10;
+ NACK = 11;
+ BUSY = 12;
+ FAIL = 13;
+}
+
+// Whether a HDMI CEC message is sent from this device, to this device, or neither.
+enum MessageDirection {
+ MESSAGE_DIRECTION_UNKNOWN = 0;
+ MESSAGE_DIRECTION_OTHER = 1; // None of the other options.
+ OUTGOING = 2; // Sent from this device.
+ INCOMING = 3; // Sent to this device.
+ TO_SELF = 4; // Sent from this device, to this device. Indicates a bug.
+}
+
+// User control commands. Each value can represent an individual command, or a set of commands.
+// Values correspond to "CEC Table 30 UI Command Codes" in the HDMI CEC 1.4b spec, offset by 0x100.
+enum UserControlPressedCommand {
+ USER_CONTROL_PRESSED_COMMAND_UNKNOWN = 0;
+
+ // Represents all codes that are not represented by another value.
+ USER_CONTROL_PRESSED_COMMAND_OTHER = 1;
+
+ // Represents all number codes (codes 0x1E through 0x29).
+ NUMBER = 2;
+
+ // Navigation
+ SELECT = 0x100;
+ UP = 0x101;
+ DOWN = 0x102;
+ LEFT = 0x103;
+ RIGHT = 0x104;
+ RIGHT_UP = 0x105;
+ RIGHT_DOWN = 0x106;
+ LEFT_UP = 0x107;
+ LEFT_DOWN = 0x108;
+ EXIT = 0x10D;
+
+ // Volume
+ VOLUME_UP = 0x141;
+ VOLUME_DOWN = 0x142;
+ VOLUME_MUTE = 0x143;
+
+ // Power
+ POWER = 0x140;
+ POWER_TOGGLE = 0x16B;
+ POWER_OFF = 0x16C;
+ POWER_ON = 0x16D;
+}
+
+// Reason parameter of the <Feature Abort> message.
+// Values correspond to "CEC Table 29 Operand Descriptions" in the HDMI CEC 1.4b spec,
+// offset by 10.
+enum FeatureAbortReason {
+ FEATURE_ABORT_REASON_UNKNOWN = 0;
+ UNRECOGNIZED_OPCODE = 10;
+ NOT_IN_CORRECT_MODE_TO_RESPOND = 11;
+ CANNOT_PROVIDE_SOURCE = 12;
+ INVALID_OPERAND = 13;
+ REFUSED = 14;
+ UNABLE_TO_DETERMINE = 15;
+}
\ No newline at end of file
diff --git a/stats/enums/stats/launcher/Android.bp b/stats/enums/stats/launcher/Android.bp
index 976a0b8..592dddd 100644
--- a/stats/enums/stats/launcher/Android.bp
+++ b/stats/enums/stats/launcher/Android.bp
@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
java_library {
name: "launcherprotosnano",
proto: {
diff --git a/stats/enums/stats/mediametrics/mediametrics.proto b/stats/enums/stats/mediametrics/mediametrics.proto
index 9f0ff59..4b843d7 100644
--- a/stats/enums/stats/mediametrics/mediametrics.proto
+++ b/stats/enums/stats/mediametrics/mediametrics.proto
@@ -18,222 +18,137 @@
package android.stats.mediametrics;
-/**
- * Track how we arbitrate between microphone/input requests.
- * Logged from
- * frameworks/av/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
- * frameworks/av/services/mediaanalytics/statsd_audiopolicy.cpp
- * Next Tag: 10
- */
-message AudioPolicyData {
- optional int32 status = 1;
- optional string request_source = 2;
- optional string request_package = 3;
- optional int32 request_session = 4;
- optional string request_device = 5;
- optional string active_source = 6;
- optional string active_package = 7;
- optional int32 active_session = 8;
- optional string active_device = 9;
+enum StreamType {
+ STREAM_TYPE_UNKNOWN = 0;
+ STREAM_TYPE_OTHER = 1;
+ STREAM_TYPE_PROGRESSIVE = 2;
+ STREAM_TYPE_DASH = 3;
+ STREAM_TYPE_HLS = 4;
+ STREAM_TYPE_SS = 5;
}
-/**
- * Track properties of audio recording
- * Logged from
- * frameworks/av/media/libaudioclient/AudioRecord.cpp
- * frameworks/av/services/mediaanalytics/statsd_audiorecord.cpp
- * Next Tag: 16
- */
-message AudioRecordData {
- optional string encoding = 1;
- optional string source = 2;
- optional int32 latency = 3;
- optional int32 samplerate = 4;
- optional int32 channels = 5;
- optional int64 created_millis = 6;
- optional int64 duration_millis = 7;
- optional int32 count = 8;
- optional int32 error_code = 9;
- optional string error_function = 10;
- optional int32 port_id = 11;
- optional int32 frame_count = 12;
- optional string attributes = 13;
- optional int64 channel_mask = 14;
- optional int64 start_count = 15;
-
+enum DrmType {
+ DRM_TYPE_NONE = 0;
+ DRM_TYPE_OTHER = 1;
+ DRM_TYPE_PLAY_READY = 2;
+ DRM_TYPE_WV_L1 = 3;
+ DRM_TYPE_WV_L3 = 4;
}
-/**
- * Track audio thread performance data
- * Logged from
- * frameworks/av/media/libnblog/ReportPerformance.cpp
- * frameworks/av/services/mediaanalytics/statsd_audiothread.cpp
- * Next Tag: 28
- */
-message AudioThreadData {
- optional string type = 1;
- optional int32 framecount = 2;
- optional int32 samplerate = 3;
- optional string work_millis_hist = 4;
- optional string latency_millis_hist = 5;
- optional string warmup_millis_hist = 6;
- optional int64 underruns = 7;
- optional int64 overruns = 8;
- optional int64 active_millis = 9;
- optional int64 duration_millis = 10;
-
- optional int32 id = 11;
- optional int32 port_id = 12;
- optional int32 sample_rate = 13;
- optional int64 channel_mask = 14;
- optional string encoding = 15;
- optional int32 frame_count = 16;
- optional string output_device = 17;
- optional string input_device = 18;
- optional double io_jitter_mean_millis = 19;
- optional double io_jitter_stddev_millis = 20;
- optional double process_time_mean_millis = 21;
- optional double process_time_stddev_millis = 22;
- optional double timestamp_jitter_mean_millis = 23;
- optional double timestamp_jitter_stddev_millis = 24;
- optional double latency_mean_millis = 25;
- optional double latency_stddev_millis = 26;
-
+enum PlaybackType {
+ PLAYBACK_TYPE_UNKNOWN = 0;
+ PLAYBACK_TYPE_VOD = 1;
+ PLAYBACK_TYPE_LIVE = 2;
+ PLAYBACK_TYPE_OTHER = 3;
}
-/**
- * Track audio track playback data
- * Logged from
- * frameworks/av/media/libaudioclient/AudioTrack.cpp
- * frameworks/av/services/mediaanalytics/statsd_audiotrack.cpp
- * Next Tag: 12
- */
-message AudioTrackData {
- optional string stream_type = 1;
- optional string content_type = 2;
- optional string track_usage = 3;
- optional int32 sample_rate = 4;
- optional int64 channel_mask = 5;
-
- optional int32 underrun_frames = 6;
- optional int32 startup_glitch = 7;
-
- optional int32 port_id = 8;
- optional string encoding = 9;
- optional int32 frame_count = 10;
- optional string attributes = 11;
-
-
+enum ContentType {
+ CONTENT_TYPE_UNKNOWN = 0;
+ CONTENT_TYPE_MAIN = 1;
+ CONTENT_TYPE_AD = 2;
+ CONTENT_TYPE_OTHER = 3;
}
-/**
- * Track Media Codec usage
- * Logged from:
- * frameworks/av/media/libstagefright/MediaCodec.cpp
- * frameworks/av/services/mediaanalytics/statsd_codec.cpp
- * Next Tag: 26
- */
-message CodecData {
- optional string codec = 1;
- optional string mime = 2;
- optional string mode = 3;
- optional int32 encoder = 4;
- optional int32 secure = 5;
- optional int32 width = 6;
- optional int32 height = 7;
- optional int32 rotation = 8;
- optional int32 crypto = 9;
- optional int32 profile = 10;
- optional int32 level = 11;
- optional int32 max_width = 12;
- optional int32 max_height = 13;
- optional int32 error_code = 14;
- optional string error_state = 15;
- optional int64 latency_max = 16;
- optional int64 latency_min = 17;
- optional int64 latency_avg = 18;
- optional int64 latency_count = 19;
- optional int64 latency_unknown = 20;
- optional int32 queue_input_buffer_error = 21;
- optional int32 queue_secure_input_buffer_error = 22;
- optional string bitrate_mode = 23;
- optional int32 bitrate = 24;
- optional int64 lifetime_millis = 25;
+enum StreamSourceType {
+ STREAM_SOURCE_UNKNOWN = 0;
+ STREAM_SOURCE_NETWORK = 1;
+ STREAM_SOURCE_DEVICE = 2;
+ STREAM_SOURCE_MIXED = 3;
+}
+enum NetworkType {
+ NETWORK_TYPE_UNKNOWN = 0;
+ NETWORK_TYPE_OTHER = 1;
+ NETWORK_TYPE_WIFI = 2;
+ NETWORK_TYPE_ETHERNET = 3;
+ NETWORK_TYPE_2G = 4;
+ NETWORK_TYPE_3G = 5;
+ NETWORK_TYPE_4G = 6;
+ NETWORK_TYPE_5G_NSA = 7;
+ NETWORK_TYPE_5G_SA = 8;
+ NETWORK_TYPE_OFFLINE = 9;
}
-/**
- * Track Media Extractor (pulling video/audio streams out of containers) usage
- * Logged from:
- * frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
- * frameworks/av/services/mediaanalytics/statsd_extractor.cpp
- * Next Tag: 4
- */
-message ExtractorData {
- optional string format = 1;
- optional string mime = 2;
- optional int32 tracks = 3;
+enum PlaybackState {
+ // Playback has not started (initial state)
+ NOT_STARTED = 0;
+ // Playback is buffering in the background for initial playback start
+ JOINING_BACKGROUND = 1;
+ // Playback is buffering in the foreground for initial playback start
+ JOINING_FOREGROUND = 2;
+ // Playback is actively playing
+ PLAYING = 3;
+ // Playback is paused but ready to play
+ PAUSED = 4;
+ // Playback is handling a seek
+ SEEKING = 5;
+ // Playback is buffering to resume active playback
+ BUFFERING = 6;
+ // Playback is buffering while paused
+ PAUSED_BUFFERING = 7;
+ // Playback is suppressed (e.g. due to audio focus loss)
+ SUPPRESSED = 8;
+ // Playback is suppressed (e.g. due to audio focus loss) while buffering to resume a
+ // playback
+ SUPPRESSED_BUFFERING = 9;
+ // Playback has reached the end of the media
+ ENDED = 10;
+ // Playback is stopped and can be restarted
+ STOPPED = 11;
+ // Playback is stopped due a fatal error and can be retried
+ FAILED = 12;
+ // Playback is interrupted by an ad
+ INTERRUPTED_BY_AD = 13;
+ // Playback is abandoned before reaching the end of the media
+ ABANDONED = 14;
}
-/**
- * Track Media Player usage
- * this handles both nuplayer and nuplayer2
- * Logged from:
- * frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
- * frameworks/av/media/libmediaplayer2/nuplayer2/NuPlayer2Driver.cpp
- * frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
- * Next Tag: 21
- */
-message NuPlayerData {
- optional string whichPlayer = 1;
-
- optional string video_mime = 2;
- optional string video_codec = 3;
- optional int32 width = 4;
- optional int32 height = 5;
- optional int64 frames = 6;
- optional int64 frames_dropped = 7;
- optional double framerate = 8;
- optional string audio_mime = 9;
- optional string audio_codec = 10;
- optional int64 duration_millis = 11;
- optional int64 playing_millis = 12;
- optional int32 error = 13;
- optional int32 error_code = 14;
- optional string error_state = 15;
- optional string data_source_type = 16;
- optional int64 rebuffering_millis = 17;
- optional int32 rebuffers = 18;
- optional int32 rebuffer_at_exit = 19;
- optional int64 frames_dropped_startup = 20;
+enum PlaybackErrorCode {
+ ERROR_CODE_UNKNOWN = 0;
+ ERROR_CODE_OTHER = 1;
+ ERROR_CODE_RUNTIME = 2;
+ ERROR_CODE_NETWORK_OFFLINE = 3;
+ ERROR_CODE_NETWORK_CONNECT = 4;
+ ERROR_CODE_NETWORK_BAD_STATUS = 5;
+ ERROR_CODE_NETWORK_DNS = 6;
+ ERROR_CODE_NETWORK_TIMEOUT = 7;
+ ERROR_CODE_NETWORK_CLOSED = 8;
+ ERROR_CODE_NETWORK_OTHER = 9;
+ ERROR_CODE_MEDIA_MANIFET = 10;
+ ERROR_CODE_MEDIA_PARSER = 11;
+ ERROR_CODE_MEDIA_OTHER = 12;
+ ERROR_CODE_DECODER_INIT = 13;
+ ERROR_CODE_DECODER_DECODE = 14;
+ ERROR_CODE_DECODER_OOM = 15;
+ ERROR_CODE_DECODER_OTHER = 16;
+ ERROR_CODE_AUDIOTRACK_INIT = 17;
+ ERROR_CODE_AUDIOTRACK_WRITE = 18;
+ ERROR_CODE_AUDIOTRACK_OTHER = 19;
+ ERROR_CODE_PLAYER_REMOTE = 20;
+ ERROR_CODE_PLAYER_BEHIND_LIVE_WINDOW = 21;
+ ERROR_CODE_PLAYER_OTHER = 22;
+ ERROR_CODE_DRM_UNAVAILABLE = 23;
+ ERROR_CODE_DRM_PROVISIONING_FAILED = 24;
+ ERROR_CODE_DRM_LICENSE_ERROR = 25;
+ ERROR_CODE_DRM_DISALLOWED = 26;
+ ERROR_CODE_DRM_SYSTEM_ERROR = 27;
+ ERROR_CODE_DRM_CONTENT_ERROR = 28;
+ ERROR_CODE_DRM_REVOKED = 39;
+ ERROR_CODE_DRM_OTHER = 30;
}
-/**
- * Track information about recordings (e.g. camcorder)
- * Logged from
- * frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
- * frameworks/av/services/mediaanalytics/if_statsd.cpp
- * Next Tag: 22
- */
-message RecorderData {
- optional string audio_mime = 1;
- optional string video_mime = 2;
- optional int32 video_profile = 3;
- optional int32 video_level = 4;
- optional int32 width = 5;
- optional int32 height = 6;
- optional int32 rotation = 7;
- optional int32 framerate = 8;
- optional int32 capture_fps = 9;
- optional double capture_fps_enable = 10;
- optional int64 duration_millis = 11;
- optional int64 paused_millis = 12;
- optional int32 paused_count = 13;
- optional int32 audio_bitrate = 14;
- optional int32 audio_channels = 15;
- optional int32 audio_samplerate = 16;
- optional int32 movie_timescale = 17;
- optional int32 audio_timescale = 18;
- optional int32 video_timescale = 19;
- optional int32 video_bitrate = 20;
- optional int32 iframe_interval = 21;
+enum TrackType {
+ AUDIO = 0;
+ VIDEO = 1;
+ TEXT = 2;
+}
+enum TrackState {
+ OFF = 0;
+ ON = 1;
+}
+enum TrackChangeReason {
+ REASON_UNKNOWN = 0;
+ REASON_OTHER = 1;
+ REASON_INITIAL = 2;
+ REASON_MANUAL = 3;
+ REASON_ADAPTIVE = 4;
}
diff --git a/stats/enums/stats/style/Android.bp b/stats/enums/stats/style/Android.bp
index f085a52..100a71c 100644
--- a/stats/enums/stats/style/Android.bp
+++ b/stats/enums/stats/style/Android.bp
@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-java_library {
- name: "styleprotosnano",
- proto: {
- type: "nano",
- output_params: ["store_unknown_fields=true"],
- include_dirs: ["external/protobuf/src"],
- },
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
- sdk_version: "current",
+java_library {
+ name: "styleprotoslite",
+ proto: {
+ type: "lite",
+ },
srcs: [
"*.proto",
],
diff --git a/stats/enums/stats/style/style_enums.proto b/stats/enums/stats/style/style_enums.proto
index f3f491f..2938839 100644
--- a/stats/enums/stats/style/style_enums.proto
+++ b/stats/enums/stats/style/style_enums.proto
@@ -38,6 +38,14 @@
LIVE_WALLPAPER_APPLIED = 16;
LIVE_WALLPAPER_INFO_SELECT = 17;
LIVE_WALLPAPER_CUSTOMIZE_SELECT = 18;
+ LIVE_WALLPAPER_QUESTIONNAIRE_SELECT = 19;
+ LIVE_WALLPAPER_QUESTIONNAIRE_APPLIED = 20;
+ LIVE_WALLPAPER_EFFECT_SHOW = 21;
+ APP_LAUNCHED = 22;
+ COLOR_WALLPAPER_HOME_APPLIED = 23;
+ COLOR_WALLPAPER_LOCK_APPLIED = 24;
+ COLOR_WALLPAPER_HOME_LOCK_APPLIED = 25;
+ COLOR_PRESET_APPLIED = 26;
}
enum LocationPreference {
@@ -46,3 +54,21 @@
LOCATION_CURRENT = 2;
LOCATION_MANUAL = 3;
}
+
+enum DatePreference {
+ DATE_PREFERENCE_UNSPECIFIED = 0;
+ DATE_UNAVAILABLE = 1;
+ DATE_MANUAL = 2;
+}
+
+enum LaunchedPreference {
+ LAUNCHED_PREFERENCE_UNSPECIFIED = 0;
+ LAUNCHED_LAUNCHER = 1;
+ LAUNCHED_SETTINGS = 2;
+ LAUNCHED_SUW = 3;
+ LAUNCHED_TIPS = 4;
+ LAUNCHED_LAUNCH_ICON = 5;
+ LAUNCHED_CROP_AND_SET_ACTION = 6;
+ LAUNCHED_DEEP_LINK = 7;
+ LAUNCHED_SETTINGS_SEARCH = 8;
+}
diff --git a/stats/enums/stats/textclassifier/Android.bp b/stats/enums/stats/textclassifier/Android.bp
index bf90227..1f38680 100644
--- a/stats/enums/stats/textclassifier/Android.bp
+++ b/stats/enums/stats/textclassifier/Android.bp
@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
java_library_static {
name: "textclassifierprotoslite",
proto: {
@@ -20,4 +24,4 @@
srcs: [
"*.proto",
],
-}
\ No newline at end of file
+}
diff --git a/stats/enums/stats/textclassifier/textclassifier_enums.proto b/stats/enums/stats/textclassifier/textclassifier_enums.proto
index 4be7b7c..869ca37 100644
--- a/stats/enums/stats/textclassifier/textclassifier_enums.proto
+++ b/stats/enums/stats/textclassifier/textclassifier_enums.proto
@@ -62,6 +62,8 @@
ACTIONS_GENERATED = 20;
// Some text links were generated
LINKS_GENERATED = 21;
+ // A foreground app read the clipboard.
+ READ_CLIPBOARD = 22;
}
enum WidgetType {
@@ -84,4 +86,6 @@
WIDGET_TYPE_CUSTOM_UNSELECTABLE_TEXTVIEW = 8;
// Notification
WIDGET_TYPE_NOTIFICATION = 9;
+ // ClipBoard
+ WIDGET_TYPE_CLIPBOARD = 10;
}
diff --git a/stats/enums/stats/tls/enums.proto b/stats/enums/stats/tls/enums.proto
new file mode 100644
index 0000000..a64137d
--- /dev/null
+++ b/stats/enums/stats/tls/enums.proto
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+syntax = "proto2";
+package android.stats.tls;
+
+// Keep in sync with
+// external/conscrypt/{android,platform}/src/main/java/org/conscrypt/Platform.java
+enum Protocol {
+ UNKNOWN_PROTO = 0;
+ SSL_V3 = 1;
+ TLS_V1 = 2;
+ TLS_V1_1 = 3;
+ TLS_V1_2 = 4;
+ TLS_V1_3 = 5;
+}
+
+// Cipher suites' ids are based on IANA's database:
+// https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4
+//
+// If you add new cipher suite, make sure id is the same as in IANA's database (see link above)
+//
+// Keep in sync with
+// external/conscrypt/{android,platform}/src/main/java/org/conscrypt/Platform.java
+enum CipherSuite {
+ UNKNOWN_CIPHER_SUITE = 0x0000;
+
+ TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xC00A;
+ TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0xC014;
+ TLS_RSA_WITH_AES_256_CBC_SHA = 0x0035;
+ TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = 0xC009;
+ TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA = 0xC013;
+ TLS_RSA_WITH_AES_128_CBC_SHA = 0x002F;
+ TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x000A;
+
+ // TLSv1.2 cipher suites
+ TLS_RSA_WITH_AES_128_GCM_SHA256 = 0x009C;
+ TLS_RSA_WITH_AES_256_GCM_SHA384 = 0x009D;
+ TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = 0xC02F;
+ TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = 0xC030;
+ TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = 0xC02B;
+ TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = 0xC02C;
+ TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = 0xCCA9;
+ TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = 0xCCA8;
+
+ // Pre-Shared Key (PSK) cipher suites
+ TLS_PSK_WITH_AES_128_CBC_SHA = 0x008C;
+ TLS_PSK_WITH_AES_256_CBC_SHA = 0x008D;
+ TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA = 0xC035;
+ TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA = 0xC036;
+ TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 = 0xCCAC;
+
+ // TLS 1.3 cipher suites
+ TLS_AES_128_GCM_SHA256 = 0x1301;
+ TLS_AES_256_GCM_SHA384 = 0x1302;
+ TLS_CHACHA20_POLY1305_SHA256 = 0x1303;
+}
+
diff --git a/stats/enums/stats/tv/tif_enums.proto b/stats/enums/stats/tv/tif_enums.proto
new file mode 100644
index 0000000..8e0ffa2
--- /dev/null
+++ b/stats/enums/stats/tv/tif_enums.proto
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+
+package android.stats.tv;
+option java_multiple_files = true;
+
+// Enums for TV Input Framework
+option java_outer_classname = "TifStatsEnums";
+
+// Tune State of a TV Input Service Framework
+enum TifTuneState {
+ TIF_TUNE_STATE_UNKNOWN = 0;
+ CREATED = 1;
+ SURFACE_ATTACHED = 2;
+ SURFACE_DETACHED = 3;
+ RELEASED = 4;
+ TUNE_STARTED = 5;
+ VIDEO_AVAILABLE = 6;
+
+ // Keep in sync with TvInputManager
+ // Use the TvInputManager value + 100
+ VIDEO_UNAVAILABLE_REASON_UNKNOWN = 100;
+ VIDEO_UNAVAILABLE_REASON_TUNING = 101;
+ VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL = 102;
+ VIDEO_UNAVAILABLE_REASON_BUFFERING = 103;
+ VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY = 104;
+ VIDEO_UNAVAILABLE_REASON_NOT_CONNECTED = 105;
+ VIDEO_UNAVAILABLE_REASON_INSUFFICIENT_RESOURCE = 106;
+ VIDEO_UNAVAILABLE_REASON_CAS_INSUFFICIENT_OUTPUT_PROTECTION = 107;
+ VIDEO_UNAVAILABLE_REASON_CAS_PVR_RECORDING_NOT_ALLOWED = 108;
+ VIDEO_UNAVAILABLE_REASON_CAS_NO_LICENSE = 109;
+ VIDEO_UNAVAILABLE_REASON_CAS_LICENSE_EXPIRED = 110;
+ VIDEO_UNAVAILABLE_REASON_CAS_NEED_ACTIVATION = 111;
+ VIDEO_UNAVAILABLE_REASON_CAS_NEED_PAIRING = 112;
+ VIDEO_UNAVAILABLE_REASON_CAS_NO_CARD = 113;
+ VIDEO_UNAVAILABLE_REASON_CAS_CARD_MUTE = 114;
+ VIDEO_UNAVAILABLE_REASON_CAS_CARD_INVALID = 115;
+ VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT = 116;
+ VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING = 117;
+ VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN = 118;
+}
+
+// Tv Input Types. Keep in sync with
+// android.media.tv.TvInputInfo.Type
+enum TifInputType {
+
+ TIF_INPUT_TYPE_UNKNOWN = 0;
+
+ // TV input type: the TV input service is a tuner which provides channels.
+ // This is 0 in android.media.tv.TvInputInfo
+ TUNER = 1;
+
+ // TV input type: a generic hardware TV input type.
+ OTHER = 1000;
+
+ // TV input type: the TV input service represents a composite port.
+ COMPOSITE = 1001;
+
+ // TV input type: the TV input service represents a SVIDEO port.
+ SVIDEO = 1002;
+
+ // TV input type: the TV input service represents a SCART port.
+ SCART = 1003;
+
+ // TV input type: the TV input service represents a component port.
+ COMPONENT = 1004;
+
+ // TV input type: the TV input service represents a VGA port.
+ VGA = 1005;
+
+ // TV input type: the TV input service represents a DVI port.
+ DVI = 1006;
+
+ // TV input type: the TV input service is HDMI. (e.g. HDMI 1)
+ HDMI = 1007;
+
+ // TV input type: the TV input service represents a display port.
+ DISPLAY_PORT = 1008;
+}
diff --git a/stats/enums/stats/wm/enums.proto b/stats/enums/stats/wm/enums.proto
new file mode 100644
index 0000000..c6325de
--- /dev/null
+++ b/stats/enums/stats/wm/enums.proto
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+
+package android.stats.wm;
+
+// Orientation of a mobile device
+enum Orientation {
+ UNKNOWN = 0; // undefined during start up
+ ROTATION_0 = 1; // portrait up
+ ROTATION_90 = 2; // landscape on left
+ ROTATION_180 = 3; // portrait down
+ ROTATION_270 = 4; // landscape on right
+}
diff --git a/stats/enums/system/security/keystore2/enums.proto b/stats/enums/system/security/keystore2/enums.proto
new file mode 100644
index 0000000..5716eac
--- /dev/null
+++ b/stats/enums/system/security/keystore2/enums.proto
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+
+package android.system.security.keystore2;
+
+// Logging constants re-used by multiple atoms related to keystore2
+
+enum SecurityLevelEnum {
+ // Unspecified takes 0. Other values are incremented by 1 compared to keymint spec.
+ SECURITY_LEVEL_UNSPECIFIED = 0;
+ SECURITY_LEVEL_SOFTWARE = 1;
+ SECURITY_LEVEL_TRUSTED_ENVIRONMENT = 2;
+ SECURITY_LEVEL_STRONGBOX = 3;
+ SECURITY_LEVEL_KEYSTORE = 4;
+}
+
+enum Algorithm {
+ // ALGORITHM is prepended because UNSPECIFIED exists in other enums as well.
+ ALGORITHM_UNSPECIFIED = 0;
+ // Asymmetric algorithms.
+ RSA = 1;
+ // 2 removed, do not reuse.
+ EC = 3;
+ // Block cipher algorithms
+ AES = 32;
+ TRIPLE_DES = 33;
+ // MAC algorithms
+ HMAC = 128;
+};
diff --git a/stats/enums/telephony/enums.proto b/stats/enums/telephony/enums.proto
index f14e3ed..73c4658 100644
--- a/stats/enums/telephony/enums.proto
+++ b/stats/enums/telephony/enums.proto
@@ -91,7 +91,15 @@
NETWORK_TYPE_NR = 20;
}
-// Signal strength levels, primarily used by android/telephony/SignalStrength.java.
+// Roaming type enums, see android.telephony.ServiceState.RoamingType for definitions.
+enum RoamingTypeEnum {
+ ROAMING_TYPE_NOT_ROAMING = 0;
+ ROAMING_TYPE_ROAMING = 1;
+ ROAMING_TYPE_ROAMING_DOMESTIC = 2;
+ ROAMING_TYPE_ROAMING_INTERNATIONAL = 3;
+}
+
+// Signal strength levels, as defined in android/telephony/SignalStrength.java.
enum SignalStrengthEnum {
SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
SIGNAL_STRENGTH_POOR = 1;
@@ -159,3 +167,157 @@
*/
SIM_STATE_PRESENT = 11;
}
+
+// Format of SMS message
+enum SmsFormatEnum {
+ /** Unknown format */
+ SMS_FORMAT_UNKNOWN = 0;
+ /** Format compliant with 3GPP TS 23.040 */
+ SMS_FORMAT_3GPP = 1;
+ /** Format compliant with 3GPP2 TS C.S0015-B */
+ SMS_FORMAT_3GPP2 = 2;
+}
+
+// Technology used to carry an SMS message
+enum SmsTechEnum {
+ /**
+ * Unknown SMS technology used to carry the SMS.
+ * This value is also used for injected SMS.
+ */
+ SMS_TECH_UNKNOWN = 0;
+ /** The SMS was carried over CS bearer in 3GPP network */
+ SMS_TECH_CS_3GPP = 1;
+ /** The SMS was carried over CS bearer in 3GPP2 network */
+ SMS_TECH_CS_3GPP2 = 2;
+ /** The SMS was carried over IMS */
+ SMS_TECH_IMS = 3;
+}
+
+// Types of SMS message
+enum SmsTypeEnum {
+ /** Normal type. */
+ SMS_TYPE_NORMAL = 0;
+ /** SMS-PP (point-to-point). */
+ SMS_TYPE_SMS_PP = 1;
+ /** Voicemail indication. */
+ SMS_TYPE_VOICEMAIL_INDICATION = 2;
+ /** Type 0 message (3GPP TS 23.040 9.2.3.9). */
+ SMS_TYPE_ZERO = 3;
+ /** WAP-PUSH message. */
+ SMS_TYPE_WAP_PUSH = 4;
+}
+
+// Incoming SMS errors
+enum SmsIncomingErrorEnum {
+ SMS_SUCCESS = 0;
+ SMS_ERROR_GENERIC = 1;
+ SMS_ERROR_NO_MEMORY = 2;
+ SMS_ERROR_NOT_SUPPORTED = 3;
+}
+
+// Outgoing SMS results
+enum SmsSendResultEnum {
+ // Unknown error
+ SMS_SEND_RESULT_UNKNOWN = 0;
+ // Success
+ SMS_SEND_RESULT_SUCCESS = 1;
+ // Permanent error
+ SMS_SEND_RESULT_ERROR = 2;
+ // Temporary error, retry
+ SMS_SEND_RESULT_ERROR_RETRY = 3;
+ // Error over IMS, retry on CS
+ SMS_SEND_RESULT_ERROR_FALLBACK = 4;
+}
+
+// Data profile of the data call. From
+// frameworks/base/telephony/java/com/android/internal/telephony/RILConstants.java
+enum DataProfileEnum {
+ DATA_PROFILE_DEFAULT = 0;
+ DATA_PROFILE_TETHERED = 1;
+ DATA_PROFILE_IMS = 2;
+ DATA_PROFILE_FOTA = 3;
+ DATA_PROFILE_CBS = 4;
+ DATA_PROFILE_OEM_BASE = 1000;
+ DATA_PROFILE_INVALID = -1;
+}
+
+// Reason of data call deactivation. From
+// frameworks/base/telephony/java/android/telephony/data/DataService.java#DeactivateDataReason
+enum DataDeactivateReasonEnum {
+ DEACTIVATE_REASON_UNKNOWN = 0;
+ DEACTIVATE_REASON_NORMAL = 1;
+ DEACTIVATE_REASON_RADIO_OFF = 2;
+ DEACTIVATE_REASON_HANDOVER = 3;
+}
+
+// IP type of the data call
+// see frameworks/base/telephony/java/android/telephony/data/ApnSetting.java#ProtocolType
+enum ApnProtocolEnum {
+ APN_PROTOCOL_IPV4 = 0;
+ APN_PROTOCOL_IPV6 = 1;
+ APN_PROTOCOL_IPV4V6 = 2;
+ APN_PROTOCOL_PPP = 3;
+}
+
+// Action taken to recover a data call that is stalled. From
+// frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
+// #RecoveryAction
+enum DataStallRecoveryActionEnum {
+ RECOVERY_ACTION_GET_DATA_CALL_LIST = 0;
+ RECOVERY_ACTION_CLEANUP = 1;
+ RECOVERY_ACTION_REREGISTER = 2;
+ RECOVERY_ACTION_RADIO_RESTART = 3;
+}
+
+// Codec quality
+enum CodecQuality {
+ /** Codec quality: unknown */
+ CODEC_QUALITY_UNKNOWN = 0;
+
+ /** Codec quality: narrowband */
+ CODEC_QUALITY_NARROWBAND = 1;
+
+ /** Codec quality: wideband */
+ CODEC_QUALITY_WIDEBAND = 2;
+
+ /** Codec quality: super-wideband */
+ CODEC_QUALITY_SUPER_WIDEBAND = 3;
+
+ /** Codec quality: fullband */
+ CODEC_QUALITY_FULLBAND = 4;
+}
+
+
+// Result from restore of sim-specific settings.
+enum SimSpecfifcSettingsRestoreResult {
+ SIM_RESTORE_RESULT_UNKNOWN = 0;
+ // SIM-specific settings were successfully restored.
+ SIM_RESTORE_RESULT_SUCCESS = 1;
+ // SIM-specific settings didn't restore because no matching SIM was
+ // found in backed up data.
+ SIM_RESTORE_RESULT_NONE_MATCH = 2;
+ // No SIM-specific settings were found in backup file
+ SIM_RESTORE_RESULT_ZERO_SIM_IN_BACKUP = 3;
+}
+
+// Case of sim-specific settings restore.
+enum SimSpecificSettingsRestoreCase {
+ SIM_RESTORE_CASE_UNDEFINED_USE_CASE = 0;
+ // Restore was done during SuW.
+ SIM_RESTORE_CASE_SUW = 1;
+ // Restore was done once sim was inserted.
+ SIM_RESTORE_CASE_SIM_INSERTED = 2;
+}
+
+// Matching criteria for sim-specific settings restore.
+enum SimSpecificSettingsRestoreMatchingCriteria {
+ SIM_RESTORE_MATCHING_CRITERIA_UNSET= 0;
+ // No match was found.
+ SIM_RESTORE_MATCHING_CRITERIA_NONE = 1;
+ // Restore was done by matching two sims by ICCID.
+ SIM_RESTORE_MATCHING_CRITERIA_ICCID = 2;
+ // Restore was done by matching carrierId and phoneNumber.
+ SIM_RESTORE_MATCHING_CRITERIA_CARRIER_ID_AND_PHONE_NUMBER = 3;
+ // Restore was done by matching carrierId only.
+ SIM_RESTORE_MATCHING_CRITERIA_CARRIER_ID_ONLY = 4;
+}
\ No newline at end of file
diff --git a/stats/enums/view/enums.proto b/stats/enums/view/enums.proto
index 0172e78..a601abe 100644
--- a/stats/enums/view/enums.proto
+++ b/stats/enums/view/enums.proto
@@ -60,7 +60,7 @@
TRANSIT_TASK_OPEN_BEHIND = 16;
TRANSIT_TASK_IN_PLACE = 17;
TRANSIT_ACTIVITY_RELAUNCH = 18;
- TRANSIT_DOCK_TASK_FROM_RECENTS = 19;
+ TRANSIT_DOCK_TASK_FROM_RECENTS = 19 [deprecated=true];
TRANSIT_KEYGUARD_GOING_AWAY = 20;
TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
TRANSIT_KEYGUARD_OCCLUDE = 22;
diff --git a/stats/enums/wifi/enums.proto b/stats/enums/wifi/enums.proto
index 315c579..e676fef 100644
--- a/stats/enums/wifi/enums.proto
+++ b/stats/enums/wifi/enums.proto
@@ -48,3 +48,65 @@
*/
WIFI_MODE_FULL_LOW_LATENCY = 4;
}
+
+/**
+ * Wifi authentication type.
+ */
+enum WifiAuthType {
+ AUTH_TYPE_NONE = 0;
+
+ // WPA pre-shared key.
+ AUTH_TYPE_WPA_PSK = 1;
+ // WPA using EAP authentication. Generally used with an external authentication server.
+ AUTH_TYPE_WPA_EAP = 2;
+ // IEEE 802.1X using EAP authentication and (optionally) dynamically generated WEP keys.
+ AUTH_TYPE_IEEE8021X = 3;
+ // WPA2 pre-shared key for use with soft access point.
+ AUTH_TYPE_WPA2_PSK = 4;
+ // Hotspot 2.0 r2 OSEN.
+ AUTH_TYPE_OSEN = 5;
+ // IEEE 802.11r Fast BSS Transition with PSK authentication.
+ AUTH_TYPE_FT_PSK = 6;
+ // IEEE 802.11r Fast BSS Transition with EAP authentication.
+ AUTH_TYPE_FT_EAP = 7;
+ // Simultaneous Authentication of Equals.
+ AUTH_TYPE_SAE = 8;
+ // Opportunistic Wireless Encryption.
+ AUTH_TYPE_OWE = 9;
+ // SUITE_B_192 192 bit level
+ AUTH_TYPE_SUITE_B_192 = 10;
+ // WPA pre-shared key with stronger SHA256-based algorithms.
+ AUTH_TYPE_WPA_PSK_SHA256 = 11;
+ // WPA using EAP authentication with stronger SHA256-based algorithms.
+ AUTH_TYPE_WPA_EAP_SHA256 = 12;
+ // WAPI pre-shared key.
+ AUTH_TYPE_WAPI_PSK = 13;
+ // WAPI certificate to be specified.
+ AUTH_TYPE_WAPI_CERT = 14;
+ // IEEE 802.11ai FILS SK with SHA256.
+ AUTH_TYPE_FILS_SHA256 = 15;
+ // IEEE 802.11ai FILS SK with SHA384.
+ AUTH_TYPE_FILS_SHA384 = 16;
+}
+
+/**
+ * Bucketed wifi band.
+ */
+enum WifiBandBucket {
+ BAND_UNKNOWN = 0;
+
+ // All of 2.4GHz band
+ BAND_2G = 1;
+ // Frequencies in the range of [5150, 5250) GHz
+ BAND_5G_LOW = 2;
+ // Frequencies in the range of [5250, 5725) GHz
+ BAND_5G_MIDDLE = 3;
+ // Frequencies in the range of [5725, 5850) GHz
+ BAND_5G_HIGH = 4;
+ // Frequencies in the range of [5925, 6425) GHz
+ BAND_6G_LOW = 5;
+ // Frequencies in the range of [6425, 6875) GHz
+ BAND_6G_MIDDLE = 6;
+ // Frequencies in the range of [6875, 7125) GHz
+ BAND_6G_HIGH = 7;
+}
\ No newline at end of file
diff --git a/stats/message/mediametrics_message.proto b/stats/message/mediametrics_message.proto
new file mode 100644
index 0000000..d88c42f
--- /dev/null
+++ b/stats/message/mediametrics_message.proto
@@ -0,0 +1,284 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+
+package android.stats.mediametrics_message;
+
+/**
+ * Track how we arbitrate between microphone/input requests.
+ * Logged from
+ * frameworks/av/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+ * frameworks/av/services/mediaanalytics/statsd_audiopolicy.cpp
+ * Next Tag: 10
+ */
+message AudioPolicyData {
+ optional int32 status = 1;
+ optional string request_source = 2;
+ optional string request_package = 3;
+ optional int32 request_session = 4;
+ optional string request_device = 5;
+ optional string active_source = 6;
+ optional string active_package = 7;
+ optional int32 active_session = 8;
+ optional string active_device = 9;
+}
+
+/**
+ * Track properties of audio recording
+ * Logged from
+ * frameworks/av/media/libaudioclient/AudioRecord.cpp
+ * frameworks/av/services/mediaanalytics/statsd_audiorecord.cpp
+ * Next Tag: 16
+ */
+message AudioRecordData {
+ optional string encoding = 1;
+ optional string source = 2;
+ optional int32 latency = 3;
+ optional int32 samplerate = 4;
+ optional int32 channels = 5;
+ optional int64 created_millis = 6;
+ optional int64 duration_millis = 7;
+ optional int32 count = 8;
+ optional int32 error_code = 9;
+ optional string error_function = 10;
+ optional int32 port_id = 11;
+ optional int32 frame_count = 12;
+ optional string attributes = 13;
+ optional int64 channel_mask = 14;
+ optional int64 start_count = 15;
+
+}
+
+/**
+ * Track audio thread performance data
+ * Logged from
+ * frameworks/av/media/libnblog/ReportPerformance.cpp
+ * frameworks/av/services/mediaanalytics/statsd_audiothread.cpp
+ * Next Tag: 28
+ */
+message AudioThreadData {
+ optional string type = 1;
+ optional int32 framecount = 2;
+ optional int32 samplerate = 3;
+ optional string work_millis_hist = 4;
+ optional string latency_millis_hist = 5;
+ optional string warmup_millis_hist = 6;
+ optional int64 underruns = 7;
+ optional int64 overruns = 8;
+ optional int64 active_millis = 9;
+ optional int64 duration_millis = 10;
+
+ optional int32 id = 11;
+ optional int32 port_id = 12;
+ optional int32 sample_rate = 13;
+ optional int64 channel_mask = 14;
+ optional string encoding = 15;
+ optional int32 frame_count = 16;
+ optional string output_device = 17;
+ optional string input_device = 18;
+ optional double io_jitter_mean_millis = 19;
+ optional double io_jitter_stddev_millis = 20;
+ optional double process_time_mean_millis = 21;
+ optional double process_time_stddev_millis = 22;
+ optional double timestamp_jitter_mean_millis = 23;
+ optional double timestamp_jitter_stddev_millis = 24;
+ optional double latency_mean_millis = 25;
+ optional double latency_stddev_millis = 26;
+
+}
+
+/**
+ * Track audio track playback data
+ * Logged from
+ * frameworks/av/media/libaudioclient/AudioTrack.cpp
+ * frameworks/av/services/mediaanalytics/statsd_audiotrack.cpp
+ * Next Tag: 12
+ */
+message AudioTrackData {
+ optional string stream_type = 1;
+ optional string content_type = 2;
+ optional string track_usage = 3;
+ optional int32 sample_rate = 4;
+ optional int64 channel_mask = 5;
+
+ optional int32 underrun_frames = 6;
+ optional int32 startup_glitch = 7;
+
+ optional int32 port_id = 8;
+ optional string encoding = 9;
+ optional int32 frame_count = 10;
+ optional string attributes = 11;
+
+
+}
+
+/**
+ * Track Media Codec usage
+ * Logged from:
+ * frameworks/av/media/libstagefright/MediaCodec.cpp
+ * frameworks/av/services/mediaanalytics/statsd_codec.cpp
+ * Next Tag: 53
+ */
+message CodecData {
+ optional string codec = 1;
+ optional string mime = 2;
+ optional string mode = 3;
+ optional int32 encoder = 4;
+ optional int32 secure = 5;
+ optional int32 width = 6;
+ optional int32 height = 7;
+ optional int32 rotation = 8;
+ optional int32 crypto = 9;
+ optional int32 profile = 10;
+ optional int32 level = 11;
+ optional int32 max_width = 12;
+ optional int32 max_height = 13;
+ optional int32 error_code = 14;
+ optional string error_state = 15;
+ optional int64 latency_max = 16;
+ optional int64 latency_min = 17;
+ optional int64 latency_avg = 18;
+ optional int64 latency_count = 19;
+ optional int64 latency_unknown = 20;
+ optional int32 queue_input_buffer_error = 21;
+ optional int32 queue_secure_input_buffer_error = 22;
+ optional string bitrate_mode = 23;
+ optional int32 bitrate = 24;
+ optional int64 lifetime_millis = 25;
+ optional string log_session_id = 26;
+ optional int32 channel_count = 27;
+ optional int32 sample_rate = 28;
+ optional int64 video_encode_bytes = 29;
+ optional int64 video_encode_frames = 30;
+ optional int64 video_input_bytes = 31;
+ optional int64 video_input_frames = 32;
+ optional int64 video_encode_duration_us = 33;
+ optional int32 color_format = 34;
+ optional double frame_rate = 35;
+ optional double capture_rate = 36;
+ optional double operating_rate = 37;
+ optional int32 priority = 38;
+ optional int32 video_qp_i_min = 39;
+ optional int32 video_qp_i_max = 40;
+ optional int32 video_qp_p_min = 41;
+ optional int32 video_qp_p_max = 42;
+ optional int32 video_qp_b_min = 43;
+ optional int32 video_qp_b_max = 44;
+ optional int32 original_bitrate = 45;
+ optional int32 shaping_enhanced = 46;
+ optional int32 original_video_qp_i_min = 47;
+ optional int32 original_video_qp_i_max = 48;
+ optional int32 original_video_qp_p_min = 49;
+ optional int32 original_video_qp_p_max = 50;
+ optional int32 original_video_qp_b_min = 51;
+ optional int32 original_video_qp_b_max = 52;
+ // !!!WARNING!!!
+ // Keep synchronized with MediaCodecReported in atoms.proto
+ // Also keep AStatsEvent serialization synchronized in statsd_codec.cpp
+ // !!!WARNING!!!
+}
+
+/**
+ * Track Media Extractor (pulling video/audio streams out of containers) usage
+ * Logged from:
+ * frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
+ * frameworks/av/services/mediaanalytics/statsd_extractor.cpp
+ * Next Tag: 6
+ */
+message ExtractorData {
+ optional string format = 1;
+ optional string mime = 2;
+ optional int32 tracks = 3;
+
+ enum EntryPoint {
+ UNSET = 0; // For backwards compatibility with clients that don't
+ // collect the entry point.
+ SDK = 1;
+ NDK_WITH_JVM = 2;
+ NDK_NO_JVM = 3;
+ OTHER = 4; // For extractor users that don't make use of the APIs.
+ }
+
+ optional EntryPoint entry_point = 4 [default = UNSET];
+ optional string log_session_id = 5;
+}
+
+/**
+ * Track Media Player usage
+ * this handles both nuplayer and nuplayer2
+ * Logged from:
+ * frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
+ * frameworks/av/media/libmediaplayer2/nuplayer2/NuPlayer2Driver.cpp
+ * frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
+ * Next Tag: 21
+ */
+message NuPlayerData {
+ optional string whichPlayer = 1;
+
+ optional string video_mime = 2;
+ optional string video_codec = 3;
+ optional int32 width = 4;
+ optional int32 height = 5;
+ optional int64 frames = 6;
+ optional int64 frames_dropped = 7;
+ optional double framerate = 8;
+ optional string audio_mime = 9;
+ optional string audio_codec = 10;
+ optional int64 duration_millis = 11;
+ optional int64 playing_millis = 12;
+ optional int32 error = 13;
+ optional int32 error_code = 14;
+ optional string error_state = 15;
+ optional string data_source_type = 16;
+ optional int64 rebuffering_millis = 17;
+ optional int32 rebuffers = 18;
+ optional int32 rebuffer_at_exit = 19;
+ optional int64 frames_dropped_startup = 20;
+}
+
+/**
+ * Track information about recordings (e.g. camcorder)
+ * Logged from
+ * frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
+ * frameworks/av/services/mediaanalytics/if_statsd.cpp
+ * Next Tag: 23
+ */
+message RecorderData {
+ optional string audio_mime = 1;
+ optional string video_mime = 2;
+ optional int32 video_profile = 3;
+ optional int32 video_level = 4;
+ optional int32 width = 5;
+ optional int32 height = 6;
+ optional int32 rotation = 7;
+ optional int32 framerate = 8;
+ optional int32 capture_fps = 9;
+ optional double capture_fps_enable = 10;
+ optional int64 duration_millis = 11;
+ optional int64 paused_millis = 12;
+ optional int32 paused_count = 13;
+ optional int32 audio_bitrate = 14;
+ optional int32 audio_channels = 15;
+ optional int32 audio_samplerate = 16;
+ optional int32 movie_timescale = 17;
+ optional int32 audio_timescale = 18;
+ optional int32 video_timescale = 19;
+ optional int32 video_bitrate = 20;
+ optional int32 iframe_interval = 21;
+ optional string log_session_id = 22;
+}
+
diff --git a/stats/stats_log_api_gen/Android.bp b/stats/stats_log_api_gen/Android.bp
index e3b6db0..1e59094 100644
--- a/stats/stats_log_api_gen/Android.bp
+++ b/stats/stats_log_api_gen/Android.bp
@@ -17,6 +17,10 @@
// ==========================================================
// Build the host executable: stats-log-api-gen
// ==========================================================
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
cc_binary_host {
name: "stats-log-api-gen",
srcs: [
@@ -25,6 +29,7 @@
"java_writer_q.cpp",
"main.cpp",
"native_writer.cpp",
+ "rust_writer.cpp",
"utils.cpp",
],
cflags: [
@@ -121,11 +126,77 @@
],
target: {
android: {
- shared_libs: ["libstatssocket"],
+ shared_libs: [
+ "libstatssocket",
+ "libstatspull",
+ ],
+ export_shared_lib_headers: [
+ "libstatssocket",
+ "libstatspull",
+ ],
},
host: {
- static_libs: ["libstatssocket"],
+ static_libs: [
+ "libstatssocket",
+ "libstatspull",
+ "statsd-aidl-ndk_platform",
+ ],
+ shared_libs: ["libbinder_ndk"],
+ export_static_lib_headers: [
+ "libstatssocket",
+ "libstatspull",
+ ],
+ },
+ darwin: {
+ enabled: false,
},
},
}
+// ==========================================================
+// Rust library
+// ==========================================================
+
+genrule {
+ name: "statslog_header.rs",
+ tools: ["stats-log-api-gen"],
+ cmd: "$(location stats-log-api-gen) --rustHeader $(genDir)/statslog_header.rs",
+ out: [
+ "statslog_header.rs",
+ ],
+}
+
+rust_library {
+ name: "libstatslog_rust_header",
+ crate_name: "statslog_rust_header",
+ srcs: [
+ "rust_header_wrapper.rs",
+ ":statslog_header.rs",
+ ],
+ rustlibs: [
+ "libstatspull_bindgen",
+ "libthiserror",
+ ],
+}
+
+genrule {
+ name: "statslog.rs",
+ tools: ["stats-log-api-gen"],
+ cmd: "$(location stats-log-api-gen) --rust $(genDir)/statslog.rs",
+ out: [
+ "statslog.rs",
+ ],
+}
+
+rust_library {
+ name: "libstatslog_rust",
+ crate_name: "statslog_rust",
+ srcs: [
+ "rust_wrapper.rs",
+ ":statslog.rs",
+ ],
+ rustlibs: [
+ "libstatslog_rust_header",
+ "libstatspull_bindgen",
+ ],
+}
diff --git a/stats/stats_log_api_gen/Collation.cpp b/stats/stats_log_api_gen/Collation.cpp
index 2608097..0b5e206 100644
--- a/stats/stats_log_api_gen/Collation.cpp
+++ b/stats/stats_log_api_gen/Collation.cpp
@@ -25,6 +25,7 @@
namespace android {
namespace stats_log_api_gen {
+using google::protobuf::OneofDescriptor;
using google::protobuf::EnumDescriptor;
using google::protobuf::FieldDescriptor;
using google::protobuf::FileDescriptor;
@@ -46,6 +47,7 @@
name(that.name),
message(that.message),
fields(that.fields),
+ oneOfName(that.oneOfName),
fieldNumberToAnnotations(that.fieldNumberToAnnotations),
primaryFields(that.primaryFields),
exclusiveField(that.exclusiveField),
@@ -55,7 +57,8 @@
uidField(that.uidField) {
}
-AtomDecl::AtomDecl(int c, const string& n, const string& m) : code(c), name(n), message(m) {
+AtomDecl::AtomDecl(int c, const string& n, const string& m, const string &o)
+ : code(c), name(n), message(m), oneOfName(o) {
}
AtomDecl::~AtomDecl() {
@@ -71,7 +74,7 @@
SourceLocation loc;
if (field->GetSourceLocation(&loc)) {
- // TODO: this will work if we can figure out how to pass
+ // TODO(b/162454173): this will work if we can figure out how to pass
// --include_source_info to protoc
fprintf(stderr, "%s:%d: ", file->name().c_str(), loc.start_line);
} else {
@@ -110,7 +113,6 @@
case FieldDescriptor::TYPE_GROUP:
return JAVA_TYPE_UNKNOWN;
case FieldDescriptor::TYPE_MESSAGE:
- // TODO: not the final package name
if (field->message_type()->full_name() == "android.os.statsd.AttributionNode") {
return JAVA_TYPE_ATTRIBUTION_CHAIN;
} else if (field->message_type()->full_name() == "android.os.statsd.KeyValuePair") {
@@ -146,7 +148,7 @@
void collate_enums(const EnumDescriptor& enumDescriptor, AtomField* atomField) {
for (int i = 0; i < enumDescriptor.value_count(); i++) {
atomField->enumValues[enumDescriptor.value(i)->number()] =
- enumDescriptor.value(i)->name().c_str();
+ enumDescriptor.value(i)->name();
}
}
@@ -396,16 +398,14 @@
collate_enums(*field->enum_type(), &atField);
}
- // Generate signature for pushed atoms
- if (atomDecl->code < PULL_ATOM_START_ID) {
- if (javaType == JAVA_TYPE_ENUM) {
- // All enums are treated as ints when it comes to function signatures.
- signature->push_back(JAVA_TYPE_INT);
- } else if (javaType == JAVA_TYPE_OBJECT && isBinaryField) {
- signature->push_back(JAVA_TYPE_BYTE_ARRAY);
- } else {
- signature->push_back(javaType);
- }
+ // Generate signature for atom.
+ if (javaType == JAVA_TYPE_ENUM) {
+ // All enums are treated as ints when it comes to function signatures.
+ signature->push_back(JAVA_TYPE_INT);
+ } else if (javaType == JAVA_TYPE_OBJECT && isBinaryField) {
+ signature->push_back(JAVA_TYPE_BYTE_ARRAY);
+ } else {
+ signature->push_back(javaType);
}
atomDecl->fields.push_back(atField);
@@ -514,12 +514,20 @@
continue;
}
+ const OneofDescriptor* oneofAtom = atomField->containing_oneof();
+ if (oneofAtom == nullptr) {
+ print_error(atomField, "Atom is not declared in a `oneof` field: %s\n",
+ atomField->name().c_str());
+ errorCount++;
+ continue;
+ }
+
const Descriptor* atom = atomField->message_type();
shared_ptr<AtomDecl> atomDecl =
- make_shared<AtomDecl>(atomField->number(), atomField->name(), atom->name());
+ make_shared<AtomDecl>(atomField->number(), atomField->name(), atom->name(),
+ oneofAtom->name());
- if (atomDecl->code < PULL_ATOM_START_ID &&
- atomField->options().GetExtension(os::statsd::truncate_timestamp)) {
+ if (atomField->options().GetExtension(os::statsd::truncate_timestamp)) {
addAnnotationToAtomDecl(atomDecl.get(), ATOM_ID_FIELD_NUMBER,
ANNOTATION_ID_TRUNCATE_TIMESTAMP, ANNOTATION_TYPE_BOOL,
AnnotationValue(true));
@@ -530,20 +538,31 @@
vector<java_type_t> signature;
errorCount += collate_atom(atom, atomDecl.get(), &signature);
- if (atomDecl->primaryFields.size() != 0 && atomDecl->exclusiveField == 0) {
+ if (!atomDecl->primaryFields.empty() && atomDecl->exclusiveField == 0) {
print_error(atomField, "Cannot have a primary field without an exclusive field: %s\n",
atomField->name().c_str());
errorCount++;
continue;
}
- FieldNumberToAtomDeclSet& fieldNumberToAtomDeclSet = atoms->signatureInfoMap[signature];
+ if ((oneofAtom->name() != ONEOF_PUSHED_ATOM_NAME) &&
+ (oneofAtom->name() != ONEOF_PULLED_ATOM_NAME)) {
+ print_error(atomField, "Atom is neither a pushed nor pulled atom: %s\n",
+ atomField->name().c_str());
+ errorCount++;
+ continue;
+ }
+
+ FieldNumberToAtomDeclSet& fieldNumberToAtomDeclSet = oneofAtom->name() ==
+ ONEOF_PUSHED_ATOM_NAME ? atoms->signatureInfoMap[signature] :
+ atoms->pulledAtomsSignatureInfoMap[signature];
populateFieldNumberToAtomDeclSet(atomDecl, &fieldNumberToAtomDeclSet);
atoms->decls.insert(atomDecl);
shared_ptr<AtomDecl> nonChainedAtomDecl =
- make_shared<AtomDecl>(atomField->number(), atomField->name(), atom->name());
+ make_shared<AtomDecl>(atomField->number(), atomField->name(), atom->name(),
+ oneofAtom->name());
vector<java_type_t> nonChainedSignature;
if (get_non_chained_node(atom, nonChainedAtomDecl.get(), &nonChainedSignature)) {
FieldNumberToAtomDeclSet& nonChainedFieldNumberToAtomDeclSet =
@@ -556,13 +575,25 @@
}
if (dbg) {
+ // Signatures for pushed atoms.
printf("signatures = [\n");
for (SignatureInfoMap::const_iterator it = atoms->signatureInfoMap.begin();
it != atoms->signatureInfoMap.end(); it++) {
printf(" ");
for (vector<java_type_t>::const_iterator jt = it->first.begin(); jt != it->first.end();
jt++) {
- printf(" %d", (int)*jt);
+ printf(" %d", static_cast<int>(*jt));
+ }
+ printf("\n");
+ }
+
+ // Signatures for pull atoms.
+ for (SignatureInfoMap::const_iterator it = atoms->pulledAtomsSignatureInfoMap.begin();
+ it != atoms->pulledAtomsSignatureInfoMap.end(); it++) {
+ printf(" ");
+ for (vector<java_type_t>::const_iterator jt = it->first.begin(); jt != it->first.end();
+ jt++) {
+ printf(" %d", static_cast<int>(*jt));
}
printf("\n");
}
diff --git a/stats/stats_log_api_gen/Collation.h b/stats/stats_log_api_gen/Collation.h
index 3deb3ae..b78b556 100644
--- a/stats/stats_log_api_gen/Collation.h
+++ b/stats/stats_log_api_gen/Collation.h
@@ -29,6 +29,7 @@
namespace android {
namespace stats_log_api_gen {
+using google::protobuf::OneofDescriptor;
using google::protobuf::Descriptor;
using google::protobuf::FieldDescriptor;
using std::map;
@@ -41,6 +42,14 @@
const int FIRST_UID_IN_CHAIN_ID = 0;
+/**
+ * The types of oneof atoms.
+ *
+ * `OneofDescriptor::name()` returns the name of the oneof.
+ */
+const char ONEOF_PUSHED_ATOM_NAME[] = "pushed";
+const char ONEOF_PULLED_ATOM_NAME[] = "pulled";
+
enum AnnotationId : uint8_t {
ANNOTATION_ID_IS_UID = 1,
ANNOTATION_ID_TRUNCATE_TIMESTAMP = 2,
@@ -54,7 +63,7 @@
const int ATOM_ID_FIELD_NUMBER = -1;
-const string DEFAULT_MODULE_NAME = "DEFAULT";
+const char DEFAULT_MODULE_NAME[] = "DEFAULT";
/**
* The types for atom parameters.
@@ -86,9 +95,9 @@
int intValue;
bool boolValue;
- AnnotationValue(const int value) : intValue(value) {
+ explicit AnnotationValue(const int value) : intValue(value) {
}
- AnnotationValue(const bool value) : boolValue(value) {
+ explicit AnnotationValue(const bool value) : boolValue(value) {
}
};
@@ -154,6 +163,8 @@
string message;
vector<AtomField> fields;
+ string oneOfName;
+
FieldNumberToAnnotations fieldNumberToAnnotations;
vector<int> primaryFields;
@@ -166,7 +177,7 @@
AtomDecl();
AtomDecl(const AtomDecl& that);
- AtomDecl(int code, const string& name, const string& message);
+ AtomDecl(int code, const string& name, const string& message, const string& oneOfName);
~AtomDecl();
inline bool operator<(const AtomDecl& that) const {
@@ -184,6 +195,7 @@
struct Atoms {
SignatureInfoMap signatureInfoMap;
+ SignatureInfoMap pulledAtomsSignatureInfoMap;
AtomDeclSet decls;
AtomDeclSet non_chained_decls;
SignatureInfoMap nonChainedSignatureInfoMap;
diff --git a/stats/stats_log_api_gen/OWNERS b/stats/stats_log_api_gen/OWNERS
new file mode 100644
index 0000000..41a0c95
--- /dev/null
+++ b/stats/stats_log_api_gen/OWNERS
@@ -0,0 +1 @@
+yro@google.com
diff --git a/stats/stats_log_api_gen/java_writer.cpp b/stats/stats_log_api_gen/java_writer.cpp
index f4c937c..a7bd662 100644
--- a/stats/stats_log_api_gen/java_writer.cpp
+++ b/stats/stats_log_api_gen/java_writer.cpp
@@ -39,11 +39,27 @@
return 0;
}
-static void write_java_annotation_constants(FILE* out) {
+static void write_java_annotation_constants(FILE* out, const int minApiLevel,
+ const int compileApiLevel) {
fprintf(out, " // Annotation constants.\n");
- for (const auto& [id, name] : ANNOTATION_ID_CONSTANTS) {
- fprintf(out, " public static final byte %s = %hhu;\n", name.c_str(), id);
+ const map<AnnotationId, string>& ANNOTATION_ID_CONSTANTS = get_annotation_id_constants();
+ if (compileApiLevel <= API_R) {
+ for (const auto& [id, name] : ANNOTATION_ID_CONSTANTS) {
+ fprintf(out, " public static final byte %s = %hhu;\n", name.c_str(), id);
+ }
+ } else if (minApiLevel <= API_R) { // compileApiLevel = S+
+ for (const auto& [id, name] : ANNOTATION_ID_CONSTANTS) {
+ fprintf(out, " public static final byte %s =\n", name.c_str());
+ fprintf(out, " Build.VERSION.SDK_INT <= Build.VERSION_CODES.R ?\n");
+ fprintf(out, " %hhu : StatsLog.%s;\n", id, name.c_str());
+ fprintf(out, "\n");
+ }
+ } else {
+ for (const auto& [id, name] : ANNOTATION_ID_CONSTANTS) {
+ fprintf(out, " public static final byte %s = StatsLog.%s;\n",
+ name.c_str(), name.c_str());
+ }
}
fprintf(out, "\n");
}
@@ -56,6 +72,7 @@
return;
}
const AtomDeclSet& atomDeclSet = fieldNumberToAtomDeclSetIt->second;
+ const map<AnnotationId, string>& ANNOTATION_ID_CONSTANTS = get_annotation_id_constants();
for (const shared_ptr<AtomDecl>& atomDecl : atomDeclSet) {
const string atomConstant = make_constant_name(atomDecl->name);
fprintf(out, " if (%s == code) {\n", atomConstant.c_str());
@@ -96,170 +113,186 @@
}
}
-static int write_java_methods(FILE* out, const SignatureInfoMap& signatureInfoMap,
- const AtomDecl& attributionDecl, const bool supportQ) {
+static void write_method_signature(FILE* out, const vector<java_type_t>& signature,
+ const AtomDecl& attributionDecl) {
+ int argIndex = 1;
+ for (vector<java_type_t>::const_iterator arg = signature.begin(); arg != signature.end();
+ arg++) {
+ if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) {
+ for (const auto& chainField : attributionDecl.fields) {
+ fprintf(out, ", %s[] %s", java_type_name(chainField.javaType),
+ chainField.name.c_str());
+ }
+ } else if (*arg == JAVA_TYPE_KEY_VALUE_PAIR) {
+ fprintf(out, ", android.util.SparseArray<Object> valueMap");
+ } else {
+ fprintf(out, ", %s arg%d", java_type_name(*arg), argIndex);
+ }
+ argIndex++;
+ }
+}
+
+static int write_method_body(FILE* out, const vector<java_type_t>& signature,
+ const FieldNumberToAtomDeclSet& fieldNumberToAtomDeclSet,
+ const AtomDecl& attributionDecl, const string& indent) {
+ // Start StatsEvent.Builder.
+ fprintf(out,
+ "%s final StatsEvent.Builder builder = "
+ "StatsEvent.newBuilder();\n",
+ indent.c_str());
+
+ // Write atom code.
+ fprintf(out, "%s builder.setAtomId(code);\n", indent.c_str());
+ write_annotations(out, ATOM_ID_FIELD_NUMBER, fieldNumberToAtomDeclSet);
+
+ // Write the args.
+ int argIndex = 1;
+ for (vector<java_type_t>::const_iterator arg = signature.begin(); arg != signature.end();
+ arg++) {
+ switch (*arg) {
+ case JAVA_TYPE_BOOLEAN:
+ fprintf(out, "%s builder.writeBoolean(arg%d);\n", indent.c_str(),
+ argIndex);
+ break;
+ case JAVA_TYPE_INT:
+ case JAVA_TYPE_ENUM:
+ fprintf(out, "%s builder.writeInt(arg%d);\n", indent.c_str(), argIndex);
+ break;
+ case JAVA_TYPE_FLOAT:
+ fprintf(out, "%s builder.writeFloat(arg%d);\n", indent.c_str(),
+ argIndex);
+ break;
+ case JAVA_TYPE_LONG:
+ fprintf(out, "%s builder.writeLong(arg%d);\n", indent.c_str(), argIndex);
+ break;
+ case JAVA_TYPE_STRING:
+ fprintf(out, "%s builder.writeString(arg%d);\n", indent.c_str(),
+ argIndex);
+ break;
+ case JAVA_TYPE_BYTE_ARRAY:
+ fprintf(out,
+ "%s builder.writeByteArray(null == arg%d ? new byte[0] : "
+ "arg%d);\n",
+ indent.c_str(), argIndex, argIndex);
+ break;
+ case JAVA_TYPE_ATTRIBUTION_CHAIN: {
+ const char* uidName = attributionDecl.fields.front().name.c_str();
+ const char* tagName = attributionDecl.fields.back().name.c_str();
+
+ fprintf(out, "%s builder.writeAttributionChain(\n", indent.c_str());
+ fprintf(out, "%s null == %s ? new int[0] : %s,\n",
+ indent.c_str(), uidName, uidName);
+ fprintf(out, "%s null == %s ? new String[0] : %s);\n",
+ indent.c_str(), tagName, tagName);
+ break;
+ }
+ case JAVA_TYPE_KEY_VALUE_PAIR:
+ fprintf(out, "\n");
+ fprintf(out, "%s // Write KeyValuePairs.\n", indent.c_str());
+ fprintf(out, "%s final int count = valueMap.size();\n", indent.c_str());
+ fprintf(out, "%s android.util.SparseIntArray intMap = null;\n",
+ indent.c_str());
+ fprintf(out, "%s android.util.SparseLongArray longMap = null;\n",
+ indent.c_str());
+ fprintf(out, "%s android.util.SparseArray<String> stringMap = null;\n",
+ indent.c_str());
+ fprintf(out, "%s android.util.SparseArray<Float> floatMap = null;\n",
+ indent.c_str());
+ fprintf(out, "%s for (int i = 0; i < count; i++) {\n", indent.c_str());
+ fprintf(out, "%s final int key = valueMap.keyAt(i);\n",
+ indent.c_str());
+ fprintf(out, "%s final Object value = valueMap.valueAt(i);\n",
+ indent.c_str());
+ fprintf(out, "%s if (value instanceof Integer) {\n", indent.c_str());
+ fprintf(out, "%s if (null == intMap) {\n", indent.c_str());
+ fprintf(out,
+ "%s intMap = new "
+ "android.util.SparseIntArray();\n",
+ indent.c_str());
+ fprintf(out, "%s }\n", indent.c_str());
+ fprintf(out, "%s intMap.put(key, (Integer) value);\n",
+ indent.c_str());
+ fprintf(out, "%s } else if (value instanceof Long) {\n",
+ indent.c_str());
+ fprintf(out, "%s if (null == longMap) {\n", indent.c_str());
+ fprintf(out,
+ "%s longMap = new "
+ "android.util.SparseLongArray();\n",
+ indent.c_str());
+ fprintf(out, "%s }\n", indent.c_str());
+ fprintf(out, "%s longMap.put(key, (Long) value);\n",
+ indent.c_str());
+ fprintf(out, "%s } else if (value instanceof String) {\n",
+ indent.c_str());
+ fprintf(out, "%s if (null == stringMap) {\n", indent.c_str());
+ fprintf(out,
+ "%s stringMap = new "
+ "android.util.SparseArray<>();\n",
+ indent.c_str());
+ fprintf(out, "%s }\n", indent.c_str());
+ fprintf(out, "%s stringMap.put(key, (String) value);\n",
+ indent.c_str());
+ fprintf(out, "%s } else if (value instanceof Float) {\n",
+ indent.c_str());
+ fprintf(out, "%s if (null == floatMap) {\n", indent.c_str());
+ fprintf(out,
+ "%s floatMap = new "
+ "android.util.SparseArray<>();\n",
+ indent.c_str());
+ fprintf(out, "%s }\n", indent.c_str());
+ fprintf(out, "%s floatMap.put(key, (Float) value);\n",
+ indent.c_str());
+ fprintf(out, "%s }\n", indent.c_str());
+ fprintf(out, "%s }\n", indent.c_str());
+ fprintf(out,
+ "%s builder.writeKeyValuePairs("
+ "intMap, longMap, stringMap, floatMap);\n",
+ indent.c_str());
+ break;
+ default:
+ // Unsupported types: OBJECT, DOUBLE.
+ fprintf(stderr, "Encountered unsupported type.");
+ return 1;
+ }
+ write_annotations(out, argIndex, fieldNumberToAtomDeclSet);
+ argIndex++;
+ }
+ return 0;
+}
+
+static int write_java_pushed_methods(FILE* out, const SignatureInfoMap& signatureInfoMap,
+ const AtomDecl& attributionDecl, const int minApiLevel) {
for (auto signatureInfoMapIt = signatureInfoMap.begin();
signatureInfoMapIt != signatureInfoMap.end(); signatureInfoMapIt++) {
// Print method signature.
fprintf(out, " public static void write(int code");
const vector<java_type_t>& signature = signatureInfoMapIt->first;
const FieldNumberToAtomDeclSet& fieldNumberToAtomDeclSet = signatureInfoMapIt->second;
- int argIndex = 1;
- for (vector<java_type_t>::const_iterator arg = signature.begin(); arg != signature.end();
- arg++) {
- if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) {
- for (auto chainField : attributionDecl.fields) {
- fprintf(out, ", %s[] %s", java_type_name(chainField.javaType),
- chainField.name.c_str());
- }
- } else if (*arg == JAVA_TYPE_KEY_VALUE_PAIR) {
- fprintf(out, ", android.util.SparseArray<Object> valueMap");
- } else {
- fprintf(out, ", %s arg%d", java_type_name(*arg), argIndex);
- }
- argIndex++;
- }
+ write_method_signature(out, signature, attributionDecl);
fprintf(out, ") {\n");
// Print method body.
string indent("");
- if (supportQ) {
+ if (minApiLevel == API_Q) {
fprintf(out, " if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {\n");
indent = " ";
}
- // Start StatsEvent.Builder.
- fprintf(out,
- "%s final StatsEvent.Builder builder = "
- "StatsEvent.newBuilder();\n",
- indent.c_str());
-
- // Write atom code.
- fprintf(out, "%s builder.setAtomId(code);\n", indent.c_str());
- write_annotations(out, ATOM_ID_FIELD_NUMBER, fieldNumberToAtomDeclSet);
-
- // Write the args.
- argIndex = 1;
- for (vector<java_type_t>::const_iterator arg = signature.begin(); arg != signature.end();
- arg++) {
- switch (*arg) {
- case JAVA_TYPE_BOOLEAN:
- fprintf(out, "%s builder.writeBoolean(arg%d);\n", indent.c_str(),
- argIndex);
- break;
- case JAVA_TYPE_INT:
- case JAVA_TYPE_ENUM:
- fprintf(out, "%s builder.writeInt(arg%d);\n", indent.c_str(), argIndex);
- break;
- case JAVA_TYPE_FLOAT:
- fprintf(out, "%s builder.writeFloat(arg%d);\n", indent.c_str(),
- argIndex);
- break;
- case JAVA_TYPE_LONG:
- fprintf(out, "%s builder.writeLong(arg%d);\n", indent.c_str(), argIndex);
- break;
- case JAVA_TYPE_STRING:
- fprintf(out, "%s builder.writeString(arg%d);\n", indent.c_str(),
- argIndex);
- break;
- case JAVA_TYPE_BYTE_ARRAY:
- fprintf(out,
- "%s builder.writeByteArray(null == arg%d ? new byte[0] : "
- "arg%d);\n",
- indent.c_str(), argIndex, argIndex);
- break;
- case JAVA_TYPE_ATTRIBUTION_CHAIN: {
- const char* uidName = attributionDecl.fields.front().name.c_str();
- const char* tagName = attributionDecl.fields.back().name.c_str();
-
- fprintf(out, "%s builder.writeAttributionChain(\n", indent.c_str());
- fprintf(out, "%s null == %s ? new int[0] : %s,\n",
- indent.c_str(), uidName, uidName);
- fprintf(out, "%s null == %s ? new String[0] : %s);\n",
- indent.c_str(), tagName, tagName);
- break;
- }
- case JAVA_TYPE_KEY_VALUE_PAIR:
- fprintf(out, "\n");
- fprintf(out, "%s // Write KeyValuePairs.\n", indent.c_str());
- fprintf(out, "%s final int count = valueMap.size();\n", indent.c_str());
- fprintf(out, "%s android.util.SparseIntArray intMap = null;\n",
- indent.c_str());
- fprintf(out, "%s android.util.SparseLongArray longMap = null;\n",
- indent.c_str());
- fprintf(out, "%s android.util.SparseArray<String> stringMap = null;\n",
- indent.c_str());
- fprintf(out, "%s android.util.SparseArray<Float> floatMap = null;\n",
- indent.c_str());
- fprintf(out, "%s for (int i = 0; i < count; i++) {\n", indent.c_str());
- fprintf(out, "%s final int key = valueMap.keyAt(i);\n",
- indent.c_str());
- fprintf(out, "%s final Object value = valueMap.valueAt(i);\n",
- indent.c_str());
- fprintf(out, "%s if (value instanceof Integer) {\n", indent.c_str());
- fprintf(out, "%s if (null == intMap) {\n", indent.c_str());
- fprintf(out,
- "%s intMap = new "
- "android.util.SparseIntArray();\n",
- indent.c_str());
- fprintf(out, "%s }\n", indent.c_str());
- fprintf(out, "%s intMap.put(key, (Integer) value);\n",
- indent.c_str());
- fprintf(out, "%s } else if (value instanceof Long) {\n",
- indent.c_str());
- fprintf(out, "%s if (null == longMap) {\n", indent.c_str());
- fprintf(out,
- "%s longMap = new "
- "android.util.SparseLongArray();\n",
- indent.c_str());
- fprintf(out, "%s }\n", indent.c_str());
- fprintf(out, "%s longMap.put(key, (Long) value);\n",
- indent.c_str());
- fprintf(out, "%s } else if (value instanceof String) {\n",
- indent.c_str());
- fprintf(out, "%s if (null == stringMap) {\n", indent.c_str());
- fprintf(out,
- "%s stringMap = new "
- "android.util.SparseArray<>();\n",
- indent.c_str());
- fprintf(out, "%s }\n", indent.c_str());
- fprintf(out, "%s stringMap.put(key, (String) value);\n",
- indent.c_str());
- fprintf(out, "%s } else if (value instanceof Float) {\n",
- indent.c_str());
- fprintf(out, "%s if (null == floatMap) {\n", indent.c_str());
- fprintf(out,
- "%s floatMap = new "
- "android.util.SparseArray<>();\n",
- indent.c_str());
- fprintf(out, "%s }\n", indent.c_str());
- fprintf(out, "%s floatMap.put(key, (Float) value);\n",
- indent.c_str());
- fprintf(out, "%s }\n", indent.c_str());
- fprintf(out, "%s }\n", indent.c_str());
- fprintf(out,
- "%s builder.writeKeyValuePairs("
- "intMap, longMap, stringMap, floatMap);\n",
- indent.c_str());
- break;
- default:
- // Unsupported types: OBJECT, DOUBLE.
- fprintf(stderr, "Encountered unsupported type.");
- return 1;
- }
- write_annotations(out, argIndex, fieldNumberToAtomDeclSet);
- argIndex++;
+ int ret = write_method_body(out, signature, fieldNumberToAtomDeclSet,
+ attributionDecl, indent);
+ if (ret != 0) {
+ return ret;
}
-
fprintf(out, "\n");
+
fprintf(out, "%s builder.usePooledBuffer();\n", indent.c_str());
fprintf(out, "%s StatsLog.write(builder.build());\n", indent.c_str());
// Add support for writing using Q schema if this is not the default module.
- if (supportQ) {
+ if (minApiLevel == API_Q) {
fprintf(out, " } else {\n");
fprintf(out, " QLogger.write(code");
- argIndex = 1;
+ int argIndex = 1;
for (vector<java_type_t>::const_iterator arg = signature.begin();
arg != signature.end(); arg++) {
if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) {
@@ -285,17 +318,47 @@
return 0;
}
+static int write_java_pulled_methods(FILE* out, const SignatureInfoMap& signatureInfoMap,
+ const AtomDecl& attributionDecl) {
+ for (auto signatureInfoMapIt = signatureInfoMap.begin();
+ signatureInfoMapIt != signatureInfoMap.end(); signatureInfoMapIt++) {
+ // Print method signature.
+ fprintf(out, " public static StatsEvent buildStatsEvent(int code");
+ const vector<java_type_t>& signature = signatureInfoMapIt->first;
+ const FieldNumberToAtomDeclSet& fieldNumberToAtomDeclSet = signatureInfoMapIt->second;
+ write_method_signature(out, signature, attributionDecl);
+ fprintf(out, ") {\n");
+
+ // Print method body.
+ string indent("");
+ int ret = write_method_body(out, signature, fieldNumberToAtomDeclSet,
+ attributionDecl, indent);
+ if (ret != 0) {
+ return ret;
+ }
+ fprintf(out, "\n");
+
+ fprintf(out, "%s return builder.build();\n", indent.c_str());
+
+ fprintf(out, " }\n"); // method
+ fprintf(out, "\n");
+ }
+ return 0;
+}
+
int write_stats_log_java(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl,
- const string& javaClass, const string& javaPackage, const bool supportQ,
- const bool supportWorkSource) {
+ const string& javaClass, const string& javaPackage, const int minApiLevel,
+ const int compileApiLevel, const bool supportWorkSource) {
// Print prelude
fprintf(out, "// This file is autogenerated\n");
fprintf(out, "\n");
fprintf(out, "package %s;\n", javaPackage.c_str());
fprintf(out, "\n");
fprintf(out, "\n");
- if (supportQ) {
+ if (minApiLevel <= API_R) {
fprintf(out, "import android.os.Build;\n");
+ }
+ if (minApiLevel <= API_Q) {
fprintf(out, "import android.os.SystemClock;\n");
}
@@ -311,19 +374,21 @@
write_java_atom_codes(out, atoms);
write_java_enum_values(out, atoms);
- write_java_annotation_constants(out);
+ write_java_annotation_constants(out, minApiLevel, compileApiLevel);
int errors = 0;
// Print write methods.
fprintf(out, " // Write methods\n");
- errors += write_java_methods(out, atoms.signatureInfoMap, attributionDecl, supportQ);
+ errors += write_java_pushed_methods(out, atoms.signatureInfoMap, attributionDecl, minApiLevel);
errors += write_java_non_chained_methods(out, atoms.nonChainedSignatureInfoMap);
+ errors += write_java_pulled_methods(out, atoms.pulledAtomsSignatureInfoMap,
+ attributionDecl);
if (supportWorkSource) {
errors += write_java_work_source_methods(out, atoms.signatureInfoMap);
}
- if (supportQ) {
+ if (minApiLevel == API_Q) {
errors += write_java_q_logger_class(out, atoms.signatureInfoMap, attributionDecl);
}
diff --git a/stats/stats_log_api_gen/java_writer.h b/stats/stats_log_api_gen/java_writer.h
index 8b3b505..f87be53 100644
--- a/stats/stats_log_api_gen/java_writer.h
+++ b/stats/stats_log_api_gen/java_writer.h
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#pragma once
+#ifndef ANDROID_STATS_LOG_API_GEN_JAVA_WRITER_H
+#define ANDROID_STATS_LOG_API_GEN_JAVA_WRITER_H
#include <stdio.h>
#include <string.h>
@@ -28,11 +29,11 @@
namespace android {
namespace stats_log_api_gen {
-using namespace std;
-
int write_stats_log_java(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl,
- const string& javaClass, const string& javaPackage, const bool supportQ,
- const bool supportWorkSource);
+ const string& javaClass, const string& javaPackage, const int minApiLevel,
+ const int compileApiLevel, const bool supportWorkSource);
} // namespace stats_log_api_gen
} // namespace android
+
+#endif // ANDROID_STATS_LOG_API_GEN_JAVA_WRITER_H
diff --git a/stats/stats_log_api_gen/java_writer_q.cpp b/stats/stats_log_api_gen/java_writer_q.cpp
index d21e270..5b526ce 100644
--- a/stats/stats_log_api_gen/java_writer_q.cpp
+++ b/stats/stats_log_api_gen/java_writer_q.cpp
@@ -65,7 +65,7 @@
for (vector<java_type_t>::const_iterator arg = signature.begin(); arg != signature.end();
arg++) {
if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) {
- for (auto chainField : attributionDecl.fields) {
+ for (const auto& chainField : attributionDecl.fields) {
fprintf(out, ", %s[] %s", java_type_name(chainField.javaType),
chainField.name.c_str());
}
@@ -407,7 +407,7 @@
if (requiredHelpers & JAVA_MODULE_REQUIRES_ATTRIBUTION) {
fprintf(out, "%sprivate static void writeAttributionChain(byte[] buff, int pos",
indent.c_str());
- for (auto chainField : attributionDecl.fields) {
+ for (const auto& chainField : attributionDecl.fields) {
fprintf(out, ", %s[] %s", java_type_name(chainField.javaType), chainField.name.c_str());
}
fprintf(out, ") {\n");
@@ -556,46 +556,5 @@
}
}
-// This method is called in main.cpp to generate StatsLog for modules that's
-// compatible with Q at compile-time.
-int write_stats_log_java_q_for_module(FILE* out, const Atoms& atoms,
- const AtomDecl& attributionDecl, const string& javaClass,
- const string& javaPackage, const bool supportWorkSource) {
- // Print prelude
- fprintf(out, "// This file is autogenerated\n");
- fprintf(out, "\n");
- fprintf(out, "package %s;\n", javaPackage.c_str());
- fprintf(out, "\n");
- fprintf(out, "import static java.nio.charset.StandardCharsets.UTF_8;\n");
- fprintf(out, "\n");
- fprintf(out, "import android.util.StatsLog;\n");
- fprintf(out, "import android.os.SystemClock;\n");
- fprintf(out, "\n");
- fprintf(out, "\n");
- fprintf(out, "/**\n");
- fprintf(out, " * Utility class for logging statistics events.\n");
- fprintf(out, " */\n");
- fprintf(out, "public class %s {\n", javaClass.c_str());
-
- write_java_q_logging_constants(out, " ");
-
- write_java_atom_codes(out, atoms);
-
- write_java_enum_values(out, atoms);
-
- int errors = 0;
- // Print write methods
- fprintf(out, " // Write methods\n");
- errors += write_java_methods_q_schema(out, atoms.signatureInfoMap, attributionDecl, " ");
- errors += write_java_non_chained_methods(out, atoms.nonChainedSignatureInfoMap);
- if (supportWorkSource) {
- errors += write_java_work_source_methods(out, atoms.signatureInfoMap);
- }
-
- fprintf(out, "}\n");
-
- return errors;
-}
-
} // namespace stats_log_api_gen
} // namespace android
diff --git a/stats/stats_log_api_gen/java_writer_q.h b/stats/stats_log_api_gen/java_writer_q.h
index c511a84..e7b600d 100644
--- a/stats/stats_log_api_gen/java_writer_q.h
+++ b/stats/stats_log_api_gen/java_writer_q.h
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#pragma once
+#ifndef ANDROID_STATS_LOG_API_GEN_JAVA_WRITER_Q_H
+#define ANDROID_STATS_LOG_API_GEN_JAVA_WRITER_Q_H
#include <stdio.h>
#include <string.h>
@@ -28,8 +29,6 @@
namespace android {
namespace stats_log_api_gen {
-using namespace std;
-
void write_java_q_logging_constants(FILE* out, const string& indent);
int write_java_methods_q_schema(FILE* out, const SignatureInfoMap& signatureInfoMap,
@@ -38,9 +37,7 @@
void write_java_helpers_for_q_schema_methods(FILE* out, const AtomDecl& attributionDecl,
const int requiredHelpers, const string& indent);
-int write_stats_log_java_q_for_module(FILE* out, const Atoms& atoms,
- const AtomDecl& attributionDecl, const string& javaClass,
- const string& javaPackage, const bool supportWorkSource);
-
} // namespace stats_log_api_gen
} // namespace android
+
+#endif // ANDROID_STATS_LOG_API_GEN_JAVA_WRITER_Q_H
diff --git a/stats/stats_log_api_gen/main.cpp b/stats/stats_log_api_gen/main.cpp
index 416dfdd..5258e33 100644
--- a/stats/stats_log_api_gen/main.cpp
+++ b/stats/stats_log_api_gen/main.cpp
@@ -13,11 +13,9 @@
#include "java_writer.h"
#include "java_writer_q.h"
#include "native_writer.h"
+#include "rust_writer.h"
#include "utils.h"
-using namespace google::protobuf;
-using namespace std;
-
namespace android {
namespace stats_log_api_gen {
@@ -31,6 +29,8 @@
fprintf(stderr, " --header FILENAME the cpp file to output for write helpers\n");
fprintf(stderr, " --help this message\n");
fprintf(stderr, " --java FILENAME the java file to output\n");
+ fprintf(stderr, " --rust FILENAME the rust file to output\n");
+ fprintf(stderr, " --rustHeader FILENAME the rust file to output for write helpers\n");
fprintf(stderr, " --module NAME optional, module name to generate outputs for\n");
fprintf(stderr,
" --namespace COMMA,SEP,NAMESPACE required for cpp/header with "
@@ -45,15 +45,16 @@
fprintf(stderr, " --javaPackage PACKAGE the package for the java file.\n");
fprintf(stderr, " required for java with module\n");
fprintf(stderr, " --javaClass CLASS the class name of the java class.\n");
- fprintf(stderr, " Optional for Java with module.\n");
- fprintf(stderr, " Default is \"StatsLogInternal\"\n");
- fprintf(stderr, " --supportQ Include runtime support for Android Q.\n");
+ fprintf(stderr, " --minApiLevel API_LEVEL lowest API level to support.\n");
+ fprintf(stderr, " Default is \"current\".\n");
fprintf(stderr,
" --worksource Include support for logging WorkSource "
"objects.\n");
fprintf(stderr,
- " --compileQ Include compile-time support for Android Q "
- "(Java only).\n");
+ " --compileApiLevel API_LEVEL specify which API level generated code is "
+ "compiled against. (Java only).\n");
+ fprintf(stderr,
+ " Default is \"current\".\n");
}
/**
@@ -65,13 +66,15 @@
string javaFilename;
string javaPackage;
string javaClass;
+ string rustFilename;
+ string rustHeaderFilename;
string moduleName = DEFAULT_MODULE_NAME;
string cppNamespace = DEFAULT_CPP_NAMESPACE;
string cppHeaderImport = DEFAULT_CPP_HEADER_IMPORT;
- bool supportQ = false;
bool supportWorkSource = false;
- bool compileQ = false;
+ int minApiLevel = API_LEVEL_CURRENT;
+ int compileApiLevel = API_LEVEL_CURRENT;
int index = 1;
while (index < argc) {
@@ -99,6 +102,20 @@
return 1;
}
javaFilename = argv[index];
+ } else if (0 == strcmp("--rust", argv[index])) {
+ index++;
+ if (index >= argc) {
+ print_usage();
+ return 1;
+ }
+ rustFilename = argv[index];
+ } else if (0 == strcmp("--rustHeader", argv[index])) {
+ index++;
+ if (index >= argc) {
+ print_usage();
+ return 1;
+ }
+ rustHeaderFilename = argv[index];
} else if (0 == strcmp("--module", argv[index])) {
index++;
if (index >= argc) {
@@ -135,33 +152,72 @@
}
javaClass = argv[index];
} else if (0 == strcmp("--supportQ", argv[index])) {
- supportQ = true;
+ minApiLevel = API_Q;
} else if (0 == strcmp("--worksource", argv[index])) {
supportWorkSource = true;
- } else if (0 == strcmp("--compileQ", argv[index])) {
- compileQ = true;
+ } else if (0 == strcmp("--minApiLevel", argv[index])) {
+ index++;
+ if (index >= argc) {
+ print_usage();
+ return 1;
+ }
+ if (0 != strcmp("current", argv[index])) {
+ minApiLevel = atoi(argv[index]);
+ }
+ } else if (0 == strcmp("--compileApiLevel", argv[index])) {
+ index++;
+ if (index >= argc) {
+ print_usage();
+ return 1;
+ }
+ if (0 != strcmp("current", argv[index])) {
+ compileApiLevel = atoi(argv[index]);
+ }
}
index++;
}
- if (cppFilename.size() == 0 && headerFilename.size() == 0 && javaFilename.size() == 0) {
+ if (cppFilename.empty() && headerFilename.empty()
+ && javaFilename.empty() && rustFilename.empty()
+ && rustHeaderFilename.empty()) {
print_usage();
return 1;
}
-
- if (DEFAULT_MODULE_NAME == moduleName && (supportQ || compileQ)) {
- // Support for Q schema is not needed for default module.
- fprintf(stderr, "%s cannot support Q schema\n", moduleName.c_str());
+ if (DEFAULT_MODULE_NAME == moduleName &&
+ (minApiLevel != API_LEVEL_CURRENT || compileApiLevel != API_LEVEL_CURRENT)) {
+ // Default module only supports current API level.
+ fprintf(stderr, "%s cannot support older API levels\n", moduleName.c_str());
return 1;
}
- if (supportQ && compileQ) {
- // Runtime Q support is redundant if compile-time Q support is required.
- fprintf(stderr, "Cannot specify compileQ and supportQ simultaneously.\n");
+ if (compileApiLevel < API_R) {
+ // Cannot compile against pre-R.
+ fprintf(stderr, "compileApiLevel must be %d or higher.\n", API_R);
return 1;
}
+ if (minApiLevel < API_Q) {
+ // Cannot support pre-Q.
+ fprintf(stderr, "minApiLevel must be %d or higher.\n", API_Q);
+ return 1;
+ }
+
+ if (minApiLevel == API_LEVEL_CURRENT) {
+ if (minApiLevel > compileApiLevel) {
+ // If minApiLevel is not specified, assume it is not higher than compileApiLevel.
+ minApiLevel = compileApiLevel;
+ }
+ } else {
+ if (minApiLevel > compileApiLevel) {
+ // If specified, minApiLevel should always be lower than compileApiLevel.
+ fprintf(stderr, "Invalid minApiLevel or compileApiLevel. If minApiLevel and"
+ " compileApiLevel are specified, minApiLevel should not be higher"
+ " than compileApiLevel.\n");
+ return 1;
+ }
+ }
+
// Collate the parameters
Atoms atoms;
int errorCount = collate_atoms(Atom::descriptor(), moduleName, &atoms);
@@ -175,9 +231,9 @@
&attributionSignature);
// Write the .cpp file
- if (cppFilename.size() != 0) {
+ if (!cppFilename.empty()) {
FILE* out = fopen(cppFilename.c_str(), "w");
- if (out == NULL) {
+ if (out == nullptr) {
fprintf(stderr, "Unable to open file for write: %s\n", cppFilename.c_str());
return 1;
}
@@ -193,14 +249,14 @@
return 1;
}
errorCount = android::stats_log_api_gen::write_stats_log_cpp(
- out, atoms, attributionDecl, cppNamespace, cppHeaderImport, supportQ);
+ out, atoms, attributionDecl, cppNamespace, cppHeaderImport, minApiLevel);
fclose(out);
}
// Write the .h file
- if (headerFilename.size() != 0) {
+ if (!headerFilename.empty()) {
FILE* out = fopen(headerFilename.c_str(), "w");
- if (out == NULL) {
+ if (out == nullptr) {
fprintf(stderr, "Unable to open file for write: %s\n", headerFilename.c_str());
return 1;
}
@@ -209,42 +265,65 @@
fprintf(stderr, "Must supply --namespace if supplying a specific module\n");
}
errorCount = android::stats_log_api_gen::write_stats_log_header(out, atoms, attributionDecl,
- cppNamespace);
+ cppNamespace, minApiLevel);
fclose(out);
}
// Write the .java file
- if (javaFilename.size() != 0) {
- if (javaClass.size() == 0) {
+ if (!javaFilename.empty()) {
+ if (javaClass.empty()) {
fprintf(stderr, "Must supply --javaClass if supplying a Java filename");
return 1;
}
- if (javaPackage.size() == 0) {
+ if (javaPackage.empty()) {
fprintf(stderr, "Must supply --javaPackage if supplying a Java filename");
return 1;
}
- if (moduleName.size() == 0) {
+ if (moduleName.empty()) {
fprintf(stderr, "Must supply --module if supplying a Java filename");
return 1;
}
FILE* out = fopen(javaFilename.c_str(), "w");
- if (out == NULL) {
+ if (out == nullptr) {
fprintf(stderr, "Unable to open file for write: %s\n", javaFilename.c_str());
return 1;
}
- if (compileQ) {
- errorCount = android::stats_log_api_gen::write_stats_log_java_q_for_module(
- out, atoms, attributionDecl, javaClass, javaPackage, supportWorkSource);
- } else {
- errorCount = android::stats_log_api_gen::write_stats_log_java(
- out, atoms, attributionDecl, javaClass, javaPackage, supportQ,
- supportWorkSource);
+ errorCount = android::stats_log_api_gen::write_stats_log_java(
+ out, atoms, attributionDecl, javaClass, javaPackage, minApiLevel, compileApiLevel,
+ supportWorkSource);
+
+ fclose(out);
+ }
+
+ // Write the main .rs file
+ if (!rustFilename.empty()) {
+ FILE* out = fopen(rustFilename.c_str(), "w");
+ if (out == nullptr) {
+ fprintf(stderr, "Unable to open file for write: %s\n", rustFilename.c_str());
+ return 1;
}
+ errorCount += android::stats_log_api_gen::write_stats_log_rust(
+ out, atoms, attributionDecl, minApiLevel);
+
+ fclose(out);
+ }
+
+ // Write the header .rs file
+ if (!rustHeaderFilename.empty()) {
+ FILE* out = fopen(rustHeaderFilename.c_str(), "w");
+ if (out == nullptr) {
+ fprintf(stderr, "Unable to open file for write: %s\n", rustHeaderFilename.c_str());
+ return 1;
+ }
+
+ android::stats_log_api_gen::write_stats_log_rust_header(
+ out, atoms, attributionDecl);
+
fclose(out);
}
diff --git a/stats/stats_log_api_gen/native_writer.cpp b/stats/stats_log_api_gen/native_writer.cpp
index 0c6c009..96dcfec 100644
--- a/stats/stats_log_api_gen/native_writer.cpp
+++ b/stats/stats_log_api_gen/native_writer.cpp
@@ -24,6 +24,7 @@
static void write_native_annotation_constants(FILE* out) {
fprintf(out, "// Annotation constants.\n");
+ const map<AnnotationId, string>& ANNOTATION_ID_CONSTANTS = get_annotation_id_constants();
for (const auto& [id, name] : ANNOTATION_ID_CONSTANTS) {
fprintf(out, "const uint8_t %s = %hhu;\n", name.c_str(), id);
}
@@ -32,13 +33,16 @@
static void write_annotations(FILE* out, int argIndex,
const FieldNumberToAtomDeclSet& fieldNumberToAtomDeclSet,
- const string& methodPrefix, const string& methodSuffix) {
+ const string& methodPrefix, const string& methodSuffix,
+ const int minApiLevel) {
FieldNumberToAtomDeclSet::const_iterator fieldNumberToAtomDeclSetIt =
fieldNumberToAtomDeclSet.find(argIndex);
if (fieldNumberToAtomDeclSet.end() == fieldNumberToAtomDeclSetIt) {
return;
}
const AtomDeclSet& atomDeclSet = fieldNumberToAtomDeclSetIt->second;
+ const map<AnnotationId, string>& ANNOTATION_ID_CONSTANTS = get_annotation_id_constants();
+ const string constantPrefix = minApiLevel > API_R ? "ASTATSLOG_" : "";
for (const shared_ptr<AtomDecl>& atomDecl : atomDeclSet) {
const string atomConstant = make_constant_name(atomDecl->name);
fprintf(out, " if (%s == code) {\n", atomConstant.c_str());
@@ -54,16 +58,16 @@
} else if (ANNOTATION_ID_DEFAULT_STATE == annotation->annotationId) {
defaultState = annotation->value.intValue;
} else {
- fprintf(out, " %saddInt32Annotation(%s%s, %d);\n",
+ fprintf(out, " %saddInt32Annotation(%s%s%s, %d);\n",
methodPrefix.c_str(), methodSuffix.c_str(),
- annotationConstant.c_str(), annotation->value.intValue);
+ constantPrefix.c_str(), annotationConstant.c_str(),
+ annotation->value.intValue);
}
break;
case ANNOTATION_TYPE_BOOL:
- // TODO(b/151786433): Write annotation constant name instead of
- // annotation id literal.
- fprintf(out, " %saddBoolAnnotation(%s%s, %s);\n", methodPrefix.c_str(),
- methodSuffix.c_str(), annotationConstant.c_str(),
+ fprintf(out, " %saddBoolAnnotation(%s%s%s, %s);\n", methodPrefix.c_str(),
+ methodSuffix.c_str(), constantPrefix.c_str(),
+ annotationConstant.c_str(),
annotation->value.boolValue ? "true" : "false");
break;
default:
@@ -74,32 +78,92 @@
const string& annotationConstant =
ANNOTATION_ID_CONSTANTS.at(ANNOTATION_ID_TRIGGER_STATE_RESET);
fprintf(out, " if (arg%d == %d) {\n", argIndex, resetState);
- fprintf(out, " %saddInt32Annotation(%s%s, %d);\n", methodPrefix.c_str(),
- methodSuffix.c_str(), annotationConstant.c_str(), defaultState);
+ fprintf(out, " %saddInt32Annotation(%s%s%s, %d);\n", methodPrefix.c_str(),
+ methodSuffix.c_str(), constantPrefix.c_str(), annotationConstant.c_str(),
+ defaultState);
fprintf(out, " }\n");
}
fprintf(out, " }\n");
}
}
-static int write_native_stats_write_methods(FILE* out, const Atoms& atoms,
- const AtomDecl& attributionDecl, const bool supportQ) {
+static int write_native_method_body(FILE* out, vector<java_type_t>& signature,
+ const FieldNumberToAtomDeclSet& fieldNumberToAtomDeclSet,
+ const AtomDecl& attributionDecl, const int minApiLevel) {
+ int argIndex = 1;
+ fprintf(out, " AStatsEvent_setAtomId(event, code);\n");
+ write_annotations(out, ATOM_ID_FIELD_NUMBER, fieldNumberToAtomDeclSet, "AStatsEvent_",
+ "event, ", minApiLevel);
+ for (vector<java_type_t>::const_iterator arg = signature.begin();
+ arg != signature.end(); arg++) {
+ switch (*arg) {
+ case JAVA_TYPE_ATTRIBUTION_CHAIN: {
+ const char* uidName = attributionDecl.fields.front().name.c_str();
+ const char* tagName = attributionDecl.fields.back().name.c_str();
+ fprintf(out,
+ " AStatsEvent_writeAttributionChain(event, "
+ "reinterpret_cast<const uint32_t*>(%s), %s.data(), "
+ "static_cast<uint8_t>(%s_length));\n",
+ uidName, tagName, uidName);
+ break;
+ }
+ case JAVA_TYPE_BYTE_ARRAY:
+ fprintf(out,
+ " AStatsEvent_writeByteArray(event, "
+ "reinterpret_cast<const uint8_t*>(arg%d.arg), "
+ "arg%d.arg_length);\n",
+ argIndex, argIndex);
+ break;
+ case JAVA_TYPE_BOOLEAN:
+ fprintf(out, " AStatsEvent_writeBool(event, arg%d);\n", argIndex);
+ break;
+ case JAVA_TYPE_INT: // Fall through.
+ case JAVA_TYPE_ENUM:
+ fprintf(out, " AStatsEvent_writeInt32(event, arg%d);\n", argIndex);
+ break;
+ case JAVA_TYPE_FLOAT:
+ fprintf(out, " AStatsEvent_writeFloat(event, arg%d);\n", argIndex);
+ break;
+ case JAVA_TYPE_LONG:
+ fprintf(out, " AStatsEvent_writeInt64(event, arg%d);\n", argIndex);
+ break;
+ case JAVA_TYPE_STRING:
+ fprintf(out, " AStatsEvent_writeString(event, arg%d);\n", argIndex);
+ break;
+ default:
+ // Unsupported types: OBJECT, DOUBLE, KEY_VALUE_PAIRS
+ fprintf(stderr, "Encountered unsupported type.");
+ return 1;
+ }
+ write_annotations(out, argIndex, fieldNumberToAtomDeclSet, "AStatsEvent_",
+ "event, ", minApiLevel);
+ argIndex++;
+ }
+ return 0;
+}
+
+static int write_native_stats_write_methods(FILE* out, const SignatureInfoMap& signatureInfoMap,
+ const AtomDecl& attributionDecl,
+ const int minApiLevel) {
fprintf(out, "\n");
- for (auto signatureInfoMapIt = atoms.signatureInfoMap.begin();
- signatureInfoMapIt != atoms.signatureInfoMap.end(); signatureInfoMapIt++) {
+ for (auto signatureInfoMapIt = signatureInfoMap.begin();
+ signatureInfoMapIt != signatureInfoMap.end(); signatureInfoMapIt++) {
vector<java_type_t> signature = signatureInfoMapIt->first;
const FieldNumberToAtomDeclSet& fieldNumberToAtomDeclSet = signatureInfoMapIt->second;
// Key value pairs not supported in native.
- if (find(signature.begin(), signature.end(), JAVA_TYPE_KEY_VALUE_PAIR) != signature.end()) {
+ if (std::find(signature.begin(), signature.end(), JAVA_TYPE_KEY_VALUE_PAIR) !=
+ signature.end()) {
continue;
}
- write_native_method_signature(out, "int stats_write", signature, attributionDecl, " {");
+ write_native_method_signature(out, "int stats_write(", signature, attributionDecl, " {");
- int argIndex = 1;
- if (supportQ) {
+ // Write method body.
+ if (minApiLevel == API_Q) {
+ int argIndex = 1;
fprintf(out, " StatsEventCompat event;\n");
fprintf(out, " event.setAtomId(code);\n");
- write_annotations(out, ATOM_ID_FIELD_NUMBER, fieldNumberToAtomDeclSet, "event.", "");
+ write_annotations(out, ATOM_ID_FIELD_NUMBER, fieldNumberToAtomDeclSet, "event.", "",
+ minApiLevel);
for (vector<java_type_t>::const_iterator arg = signature.begin();
arg != signature.end(); arg++) {
switch (*arg) {
@@ -135,81 +199,41 @@
fprintf(stderr, "Encountered unsupported type.");
return 1;
}
- write_annotations(out, argIndex, fieldNumberToAtomDeclSet, "event.", "");
+ write_annotations(out, argIndex, fieldNumberToAtomDeclSet, "event.", "",
+ minApiLevel);
argIndex++;
}
- fprintf(out, " return event.writeToSocket();\n");
+ fprintf(out, " return event.writeToSocket();\n"); // end method body.
} else {
fprintf(out, " AStatsEvent* event = AStatsEvent_obtain();\n");
- fprintf(out, " AStatsEvent_setAtomId(event, code);\n");
- write_annotations(out, ATOM_ID_FIELD_NUMBER, fieldNumberToAtomDeclSet, "AStatsEvent_",
- "event, ");
- for (vector<java_type_t>::const_iterator arg = signature.begin();
- arg != signature.end(); arg++) {
- switch (*arg) {
- case JAVA_TYPE_ATTRIBUTION_CHAIN: {
- const char* uidName = attributionDecl.fields.front().name.c_str();
- const char* tagName = attributionDecl.fields.back().name.c_str();
- fprintf(out,
- " AStatsEvent_writeAttributionChain(event, "
- "reinterpret_cast<const uint32_t*>(%s), %s.data(), "
- "static_cast<uint8_t>(%s_length));\n",
- uidName, tagName, uidName);
- break;
- }
- case JAVA_TYPE_BYTE_ARRAY:
- fprintf(out,
- " AStatsEvent_writeByteArray(event, "
- "reinterpret_cast<const uint8_t*>(arg%d.arg), "
- "arg%d.arg_length);\n",
- argIndex, argIndex);
- break;
- case JAVA_TYPE_BOOLEAN:
- fprintf(out, " AStatsEvent_writeBool(event, arg%d);\n", argIndex);
- break;
- case JAVA_TYPE_INT: // Fall through.
- case JAVA_TYPE_ENUM:
- fprintf(out, " AStatsEvent_writeInt32(event, arg%d);\n", argIndex);
- break;
- case JAVA_TYPE_FLOAT:
- fprintf(out, " AStatsEvent_writeFloat(event, arg%d);\n", argIndex);
- break;
- case JAVA_TYPE_LONG:
- fprintf(out, " AStatsEvent_writeInt64(event, arg%d);\n", argIndex);
- break;
- case JAVA_TYPE_STRING:
- fprintf(out, " AStatsEvent_writeString(event, arg%d);\n", argIndex);
- break;
- default:
- // Unsupported types: OBJECT, DOUBLE, KEY_VALUE_PAIRS
- fprintf(stderr, "Encountered unsupported type.");
- return 1;
- }
- write_annotations(out, argIndex, fieldNumberToAtomDeclSet, "AStatsEvent_",
- "event, ");
- argIndex++;
+ int ret = write_native_method_body(out, signature, fieldNumberToAtomDeclSet,
+ attributionDecl, minApiLevel);
+ if (ret != 0) {
+ return ret;
}
fprintf(out, " const int ret = AStatsEvent_write(event);\n");
fprintf(out, " AStatsEvent_release(event);\n");
- fprintf(out, " return ret;\n");
+ fprintf(out, " return ret;\n"); // end method body.
}
- fprintf(out, "}\n\n");
+ fprintf(out, "}\n\n"); // end method.
}
return 0;
}
-static void write_native_stats_write_non_chained_methods(FILE* out, const Atoms& atoms,
+static void write_native_stats_write_non_chained_methods(FILE* out,
+ const SignatureInfoMap& signatureInfoMap,
const AtomDecl& attributionDecl) {
fprintf(out, "\n");
- for (auto signature_it = atoms.nonChainedSignatureInfoMap.begin();
- signature_it != atoms.nonChainedSignatureInfoMap.end(); signature_it++) {
+ for (auto signature_it = signatureInfoMap.begin();
+ signature_it != signatureInfoMap.end(); signature_it++) {
vector<java_type_t> signature = signature_it->first;
// Key value pairs not supported in native.
- if (find(signature.begin(), signature.end(), JAVA_TYPE_KEY_VALUE_PAIR) != signature.end()) {
+ if (std::find(signature.begin(), signature.end(), JAVA_TYPE_KEY_VALUE_PAIR) !=
+ signature.end()) {
continue;
}
- write_native_method_signature(out, "int stats_write_non_chained", signature,
+ write_native_method_signature(out, "int stats_write_non_chained(", signature,
attributionDecl, " {");
vector<java_type_t> newSignature;
@@ -235,6 +259,36 @@
}
}
+static int write_native_build_stats_event_methods(FILE* out,
+ const SignatureInfoMap& signatureInfoMap,
+ const AtomDecl& attributionDecl,
+ const int minApiLevel) {
+ fprintf(out, "\n");
+ for (auto signatureInfoMapIt = signatureInfoMap.begin();
+ signatureInfoMapIt != signatureInfoMap.end(); signatureInfoMapIt++) {
+ vector<java_type_t> signature = signatureInfoMapIt->first;
+ const FieldNumberToAtomDeclSet& fieldNumberToAtomDeclSet = signatureInfoMapIt->second;
+ // Key value pairs not supported in native.
+ if (std::find(signature.begin(), signature.end(), JAVA_TYPE_KEY_VALUE_PAIR) !=
+ signature.end()) {
+ continue;
+ }
+ write_native_method_signature(out, "void addAStatsEvent(AStatsEventList* pulled_data, ",
+ signature, attributionDecl, " {");
+
+ fprintf(out, " AStatsEvent* event = AStatsEventList_addStatsEvent(pulled_data);\n");
+ int ret = write_native_method_body(out, signature, fieldNumberToAtomDeclSet,
+ attributionDecl, minApiLevel);
+ if (ret != 0) {
+ return ret;
+ }
+ fprintf(out, " AStatsEvent_build(event);\n"); // end method body.
+
+ fprintf(out, "}\n\n"); // end method.
+ }
+ return 0;
+}
+
static void write_native_method_header(FILE* out, const string& methodName,
const SignatureInfoMap& signatureInfoMap,
const AtomDecl& attributionDecl) {
@@ -243,7 +297,8 @@
vector<java_type_t> signature = signatureInfoMapIt->first;
// Key value pairs not supported in native.
- if (find(signature.begin(), signature.end(), JAVA_TYPE_KEY_VALUE_PAIR) != signature.end()) {
+ if (std::find(signature.begin(), signature.end(), JAVA_TYPE_KEY_VALUE_PAIR) !=
+ signature.end()) {
continue;
}
write_native_method_signature(out, methodName, signature, attributionDecl, ";");
@@ -252,23 +307,36 @@
int write_stats_log_cpp(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl,
const string& cppNamespace, const string& importHeader,
- const bool supportQ) {
+ const int minApiLevel) {
// Print prelude
fprintf(out, "// This file is autogenerated\n");
fprintf(out, "\n");
fprintf(out, "#include <%s>\n", importHeader.c_str());
- if (supportQ) {
+ if (minApiLevel == API_Q) {
fprintf(out, "#include <StatsEventCompat.h>\n");
} else {
fprintf(out, "#include <stats_event.h>\n");
}
+ if (minApiLevel > API_R) {
+ fprintf(out, "#include <stats_annotations.h>\n");
+ }
+
+ if (minApiLevel > API_Q && !atoms.pulledAtomsSignatureInfoMap.empty()) {
+ fprintf(out, "#include <stats_pull_atom_callback.h>\n");
+ }
+
+
+
fprintf(out, "\n");
write_namespace(out, cppNamespace);
- write_native_stats_write_methods(out, atoms, attributionDecl, supportQ);
- write_native_stats_write_non_chained_methods(out, atoms, attributionDecl);
+ write_native_stats_write_methods(out, atoms.signatureInfoMap, attributionDecl, minApiLevel);
+ write_native_stats_write_non_chained_methods(out, atoms.nonChainedSignatureInfoMap,
+ attributionDecl);
+ write_native_build_stats_event_methods(out, atoms.pulledAtomsSignatureInfoMap,
+ attributionDecl, minApiLevel);
// Print footer
fprintf(out, "\n");
@@ -278,7 +346,7 @@
}
int write_stats_log_header(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl,
- const string& cppNamespace) {
+ const string& cppNamespace, const int minApiLevel) {
// Print prelude
fprintf(out, "// This file is autogenerated\n");
fprintf(out, "\n");
@@ -288,6 +356,9 @@
fprintf(out, "#include <vector>\n");
fprintf(out, "#include <map>\n");
fprintf(out, "#include <set>\n");
+ if (!atoms.pulledAtomsSignatureInfoMap.empty()) {
+ fprintf(out, "#include <stats_pull_atom_callback.h>\n");
+ }
fprintf(out, "\n");
write_namespace(out, cppNamespace);
@@ -322,7 +393,9 @@
}
}
- write_native_annotation_constants(out);
+ if (minApiLevel <= API_R) {
+ write_native_annotation_constants(out);
+ }
fprintf(out, "struct BytesField {\n");
fprintf(out,
@@ -337,12 +410,22 @@
fprintf(out, "//\n");
fprintf(out, "// Write methods\n");
fprintf(out, "//\n");
- write_native_method_header(out, "int stats_write", atoms.signatureInfoMap, attributionDecl);
+ write_native_method_header(out, "int stats_write(", atoms.signatureInfoMap, attributionDecl);
+ fprintf(out, "\n");
fprintf(out, "//\n");
fprintf(out, "// Write flattened methods\n");
fprintf(out, "//\n");
- write_native_method_header(out, "int stats_write_non_chained", atoms.nonChainedSignatureInfoMap,
+ write_native_method_header(out, "int stats_write_non_chained(", atoms.nonChainedSignatureInfoMap,
+ attributionDecl);
+ fprintf(out, "\n");
+
+ // Print pulled atoms methods.
+ fprintf(out, "//\n");
+ fprintf(out, "// Add AStatsEvent methods\n");
+ fprintf(out, "//\n");
+ write_native_method_header(out, "void addAStatsEvent(AStatsEventList* pulled_data, ",
+ atoms.pulledAtomsSignatureInfoMap,
attributionDecl);
fprintf(out, "\n");
diff --git a/stats/stats_log_api_gen/native_writer.h b/stats/stats_log_api_gen/native_writer.h
index 264d4db..271fda1 100644
--- a/stats/stats_log_api_gen/native_writer.h
+++ b/stats/stats_log_api_gen/native_writer.h
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#pragma once
+#ifndef ANDROID_STATS_LOG_API_GEN_NATIVE_WRITER_H
+#define ANDROID_STATS_LOG_API_GEN_NATIVE_WRITER_H
#include <stdio.h>
#include <string.h>
@@ -24,14 +25,14 @@
namespace android {
namespace stats_log_api_gen {
-using namespace std;
-
int write_stats_log_cpp(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl,
const string& cppNamespace, const string& importHeader,
- const bool supportQ);
+ const int minApiLevel);
int write_stats_log_header(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl,
- const string& cppNamespace);
+ const string& cppNamespace, const int minApiLevel);
} // namespace stats_log_api_gen
} // namespace android
+
+#endif // ANDROID_STATS_LOG_API_GEN_NATIVE_WRITER_H
diff --git a/stats/stats_log_api_gen/rust_header_wrapper.rs b/stats/stats_log_api_gen/rust_header_wrapper.rs
new file mode 100644
index 0000000..aa54b19
--- /dev/null
+++ b/stats/stats_log_api_gen/rust_header_wrapper.rs
@@ -0,0 +1,4 @@
+#![allow(clippy::too_many_arguments)]
+#![allow(missing_docs)]
+
+include!(concat!(env!("OUT_DIR"), "/statslog_header.rs"));
diff --git a/stats/stats_log_api_gen/rust_wrapper.rs b/stats/stats_log_api_gen/rust_wrapper.rs
new file mode 100644
index 0000000..44a791e
--- /dev/null
+++ b/stats/stats_log_api_gen/rust_wrapper.rs
@@ -0,0 +1,4 @@
+#![allow(clippy::too_many_arguments)]
+#![allow(missing_docs)]
+
+include!(concat!(env!("OUT_DIR"), "/statslog.rs"));
diff --git a/stats/stats_log_api_gen/rust_writer.cpp b/stats/stats_log_api_gen/rust_writer.cpp
new file mode 100644
index 0000000..fdb54d6
--- /dev/null
+++ b/stats/stats_log_api_gen/rust_writer.cpp
@@ -0,0 +1,594 @@
+/*
+ * Copyright (C) 2021, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "rust_writer.h"
+
+#include "utils.h"
+
+// Note that we prepend _ to variable names to avoid using Rust language keyword.
+// E.g., a variable named "type" would not compile.
+
+namespace android {
+namespace stats_log_api_gen {
+
+const char* rust_type_name(java_type_t type, bool lifetime) {
+ switch (type) {
+ case JAVA_TYPE_BOOLEAN:
+ return "bool";
+ case JAVA_TYPE_INT:
+ case JAVA_TYPE_ENUM:
+ return "i32";
+ case JAVA_TYPE_LONG:
+ return "i64";
+ case JAVA_TYPE_FLOAT:
+ return "f32";
+ case JAVA_TYPE_DOUBLE:
+ return "f64";
+ case JAVA_TYPE_STRING:
+ if (lifetime) {
+ return "&'a str";
+ } else {
+ return "&str";
+ }
+ case JAVA_TYPE_BYTE_ARRAY:
+ if (lifetime) {
+ return "&'a [u8]";
+ } else {
+ return "&[u8]";
+ }
+ default:
+ return "UNKNOWN";
+ }
+}
+
+static string make_camel_case_name(const string& str) {
+ string result;
+ const int N = str.size();
+ bool justSawUnderscore = false;
+ for (int i = 0; i < N; i++) {
+ char c = str[i];
+ if (c == '_') {
+ justSawUnderscore = true;
+ // Don't add the underscore to our result
+ } else if (i == 0 || justSawUnderscore) {
+ result += toupper(c);
+ justSawUnderscore = false;
+ } else {
+ result += tolower(c);
+ }
+ }
+ return result;
+}
+
+static string make_snake_case_name(const string& str) {
+ string result;
+ const int N = str.size();
+ for (int i = 0; i < N; i++) {
+ char c = str[i];
+ if (isupper(c)) {
+ if (i > 0) {
+ result += "_";
+ }
+ result += tolower(c);
+ } else {
+ result += c;
+ }
+ }
+ return result;
+}
+
+static string get_variable_name(const string& str) {
+ // From https://doc.rust-lang.org/reference/identifiers.html.
+ if (str == "crate" || str == "self" || str == "super" || str == "Self") {
+ return make_snake_case_name(str) + "_";
+ } else {
+ return "r#" + make_snake_case_name(str);
+ }
+}
+
+static void write_rust_method_signature(FILE* out, const char* namePrefix,
+ const AtomDecl& atomDecl,
+ const AtomDecl& attributionDecl,
+ bool isCode,
+ bool isNonChained) {
+ // To make the generated code pretty, add newlines between arguments.
+ const char* separator = (isCode ? "\n" : " ");
+ if (isCode) {
+ fprintf(out, " pub fn %s(", namePrefix);
+ } else {
+ fprintf(out, " %s::%s(", atomDecl.name.c_str(), namePrefix);
+ }
+ if (isCode) {
+ fprintf(out, "\n");
+ }
+ if (atomDecl.oneOfName == ONEOF_PULLED_ATOM_NAME) {
+ if (isCode) {
+ fprintf(out, " ");
+ }
+ fprintf(out, "pulled_data_: &mut AStatsEventList,%s", separator);
+ }
+ for (int i = 0; i < atomDecl.fields.size(); i++) {
+ const AtomField &atomField = atomDecl.fields[i];
+ const java_type_t& type = atomField.javaType;
+ if (type == JAVA_TYPE_ATTRIBUTION_CHAIN) {
+ for (int j = 0; j < attributionDecl.fields.size(); j++) {
+ const AtomField& chainField = attributionDecl.fields[j];
+ if (isCode) {
+ fprintf(out, " ");
+ }
+ fprintf(out, "%s_chain_: &[%s],%s", chainField.name.c_str(),
+ rust_type_name(chainField.javaType, false), separator);
+ }
+ } else {
+ if (isCode) {
+ fprintf(out, " ");
+ }
+ // Other arguments can have the same name as these non-chained ones,
+ // so append something.
+ if (isNonChained && i < 2) {
+ fprintf(out, "%s_non_chained_", atomField.name.c_str());
+ } else {
+ fprintf(out, "%s", get_variable_name(atomField.name).c_str());
+ }
+ if (type == JAVA_TYPE_ENUM) {
+ fprintf(out, ": %s,%s", make_camel_case_name(atomField.name).c_str(),
+ separator);
+ } else {
+ fprintf(out, ": %s,%s", rust_type_name(type, false), separator);
+ }
+ }
+ }
+ fprintf(out, " ) -> statslog_rust_header::StatsResult");
+ if (isCode) {
+ fprintf(out, " {");
+ }
+ fprintf(out, "\n");
+}
+
+static bool write_rust_usage(FILE* out, const string& method_name,
+ const shared_ptr<AtomDecl> atom,
+ const AtomDecl& attributionDecl,
+ bool isNonChained) {
+ // Key value pairs not supported in Rust because they're not supported in native.
+ if (std::find_if(atom->fields.begin(), atom->fields.end(),
+ [](const AtomField &atomField) {
+ return atomField.javaType == JAVA_TYPE_KEY_VALUE_PAIR;
+ }) != atom->fields.end()) {
+ fprintf(out, " // Key value pairs are unsupported in Rust.\n");
+ return false;
+ }
+ fprintf(out, " // Definition: ");
+ write_rust_method_signature(out, method_name.c_str(), *atom, attributionDecl,
+ false, isNonChained);
+ return true;
+}
+
+static void write_rust_atom_constants(FILE* out, const Atoms& atoms,
+ const AtomDecl& attributionDecl) {
+ fprintf(out, "// Constants for atom codes.\n");
+ fprintf(out, "#[derive(Clone, Copy)]\n");
+ fprintf(out, "pub enum Atoms {\n");
+
+ std::map<int, AtomDeclSet::const_iterator> atom_code_to_non_chained_decl_map;
+ build_non_chained_decl_map(atoms, &atom_code_to_non_chained_decl_map);
+
+ for (const shared_ptr<AtomDecl>& atomDecl : atoms.decls) {
+ string constant = make_camel_case_name(atomDecl->name);
+ fprintf(out, "\n");
+ fprintf(out, " // %s %s\n", atomDecl->message.c_str(), atomDecl->name.c_str());
+ bool isSupported = write_rust_usage(out, "// stats_write", atomDecl, attributionDecl, false);
+ if (!isSupported) {
+ continue;
+ }
+
+ auto non_chained_decl = atom_code_to_non_chained_decl_map.find(atomDecl->code);
+ if (non_chained_decl != atom_code_to_non_chained_decl_map.end()) {
+ write_rust_usage(out, "stats_write_non_chained", *non_chained_decl->second,
+ attributionDecl, true);
+ }
+ fprintf(out, " %s = %d,\n", constant.c_str(), atomDecl->code);
+ }
+
+ fprintf(out, "\n");
+ fprintf(out, "}\n");
+ fprintf(out, "\n");
+}
+
+static void write_rust_atom_constant_values(FILE* out, const shared_ptr<AtomDecl>& atomDecl) {
+ bool hasConstants = false;
+ for (const AtomField& field : atomDecl->fields) {
+ if (field.javaType == JAVA_TYPE_ENUM) {
+ fprintf(out, " #[repr(i32)]\n");
+ fprintf(out, " #[derive(Clone, Copy)]\n");
+ fprintf(out, " pub enum %s {\n", make_camel_case_name(field.name).c_str());
+ for (map<int, string>::const_iterator value = field.enumValues.begin();
+ value != field.enumValues.end(); value++) {
+ fprintf(out, " %s = %d,\n",
+ make_camel_case_name(value->second).c_str(), value->first);
+ }
+ fprintf(out, " }\n");
+ hasConstants = true;
+ }
+ }
+ if (hasConstants) {
+ fprintf(out, "\n");
+ }
+}
+
+static void write_rust_annotation_constants(FILE* out) {
+ fprintf(out, "// Annotation constants.\n");
+ // The annotation names are all prefixed with AnnotationId.
+ // Ideally that would go into the enum name instead,
+ // but I don't want to modify the actual name strings in case they change in the future.
+ fprintf(out, "#[allow(clippy::enum_variant_names)]\n");
+ fprintf(out, "#[repr(u8)]\n");
+ fprintf(out, "enum Annotations {\n");
+
+ const map<AnnotationId, string>& ANNOTATION_ID_CONSTANTS = get_annotation_id_constants();
+ for (const auto& [id, name] : ANNOTATION_ID_CONSTANTS) {
+ fprintf(out, " %s = %hhu,\n", make_camel_case_name(name).c_str(), id);
+ }
+ fprintf(out, "}\n\n");
+}
+
+// This is mostly copied from the version in native_writer with some minor changes.
+// Note that argIndex is 1 for the first argument.
+static void write_annotations(FILE* out, int argIndex, const AtomDecl& atomDecl,
+ const string& methodPrefix, const string& methodSuffix) {
+ const map<AnnotationId, string>& ANNOTATION_ID_CONSTANTS = get_annotation_id_constants();
+ auto annotationsIt = atomDecl.fieldNumberToAnnotations.find(argIndex);
+ if (annotationsIt == atomDecl.fieldNumberToAnnotations.end()) {
+ return;
+ }
+ int resetState = -1;
+ int defaultState = -1;
+ for (const shared_ptr<Annotation>& annotation : annotationsIt->second) {
+ const string& annotationConstant = ANNOTATION_ID_CONSTANTS.at(annotation->annotationId);
+ switch (annotation->type) {
+ case ANNOTATION_TYPE_INT:
+ if (ANNOTATION_ID_TRIGGER_STATE_RESET == annotation->annotationId) {
+ resetState = annotation->value.intValue;
+ } else if (ANNOTATION_ID_DEFAULT_STATE == annotation->annotationId) {
+ defaultState = annotation->value.intValue;
+ } else {
+ fprintf(out, " %saddInt32Annotation(%scrate::Annotations::%s as u8, %d);\n",
+ methodPrefix.c_str(), methodSuffix.c_str(),
+ make_camel_case_name(annotationConstant).c_str(),
+ annotation->value.intValue);
+ }
+ break;
+ case ANNOTATION_TYPE_BOOL:
+ fprintf(out, " %saddBoolAnnotation(%scrate::Annotations::%s as u8, %s);\n",
+ methodPrefix.c_str(), methodSuffix.c_str(),
+ make_camel_case_name(annotationConstant).c_str(),
+ annotation->value.boolValue ? "true" : "false");
+ break;
+ default:
+ break;
+ }
+ }
+ if (defaultState != -1 && resetState != -1) {
+ const string& annotationConstant =
+ ANNOTATION_ID_CONSTANTS.at(ANNOTATION_ID_TRIGGER_STATE_RESET);
+ const AtomField& field = atomDecl.fields[argIndex - 1];
+ if (field.javaType == JAVA_TYPE_ENUM) {
+ fprintf(out, " if %s as i32 == %d {\n",
+ get_variable_name(field.name).c_str(), resetState);
+ } else {
+ fprintf(out, " if %s == %d {\n",
+ get_variable_name(field.name).c_str(), resetState);
+ }
+ fprintf(out, " %saddInt32Annotation(%scrate::Annotations::%s as u8, %d);\n",
+ methodPrefix.c_str(), methodSuffix.c_str(),
+ make_camel_case_name(annotationConstant).c_str(),
+ defaultState);
+ fprintf(out, " }\n");
+ }
+}
+
+static int write_rust_method_body(FILE* out, const AtomDecl& atomDecl,
+ const AtomDecl& attributionDecl,
+ const int minApiLevel) {
+ fprintf(out, " unsafe {\n");
+ if (minApiLevel == API_Q) {
+ fprintf(stderr, "TODO: Do we need to handle this case?");
+ return 1;
+ }
+ if (atomDecl.oneOfName == ONEOF_PUSHED_ATOM_NAME) {
+ fprintf(out, " let __event = AStatsEvent_obtain();\n");
+ fprintf(out, " let __dropper = crate::AStatsEventDropper(__event);\n");
+ } else {
+ fprintf(out, " let __event = AStatsEventList_addStatsEvent(pulled_data_);\n");
+ }
+ fprintf(out, " AStatsEvent_setAtomId(__event, statslog_rust_header::Atoms::%s as u32);\n",
+ make_camel_case_name(atomDecl.name).c_str());
+ write_annotations(out, ATOM_ID_FIELD_NUMBER, atomDecl, "AStatsEvent_", "__event, ");
+ for (int i = 0; i < atomDecl.fields.size(); i++) {
+ const AtomField& atomField = atomDecl.fields[i];
+ const string& name = get_variable_name(atomField.name);
+ const java_type_t& type = atomField.javaType;
+ switch (type) {
+ case JAVA_TYPE_ATTRIBUTION_CHAIN: {
+ const char* uidName = attributionDecl.fields.front().name.c_str();
+ const char* tagName = attributionDecl.fields.back().name.c_str();
+ fprintf(out,
+ " let uids = %s_chain_.iter().map(|n| (*n).try_into())"
+ ".collect::<std::result::Result<Vec<_>, _>>()?;\n"
+ " let str_arr = %s_chain_.iter().map(|s| std::ffi::CString::new(*s))"
+ ".collect::<std::result::Result<Vec<_>, _>>()?;\n"
+ " let ptr_arr = str_arr.iter().map(|s| s.as_ptr())"
+ ".collect::<std::vec::Vec<_>>();\n"
+ " AStatsEvent_writeAttributionChain(__event, uids.as_ptr(),\n"
+ " ptr_arr.as_ptr(), %s_chain_.len().try_into()?);\n",
+ uidName, tagName, uidName);
+ break;
+ }
+ case JAVA_TYPE_BYTE_ARRAY:
+ fprintf(out,
+ " AStatsEvent_writeByteArray(__event, "
+ "%s.as_ptr(), %s.len());\n",
+ name.c_str(), name.c_str());
+ break;
+ case JAVA_TYPE_BOOLEAN:
+ fprintf(out, " AStatsEvent_writeBool(__event, %s);\n", name.c_str());
+ break;
+ case JAVA_TYPE_ENUM:
+ fprintf(out, " AStatsEvent_writeInt32(__event, %s as i32);\n", name.c_str());
+ break;
+ case JAVA_TYPE_INT:
+ fprintf(out, " AStatsEvent_writeInt32(__event, %s);\n", name.c_str());
+ break;
+ case JAVA_TYPE_FLOAT:
+ fprintf(out, " AStatsEvent_writeFloat(__event, %s);\n", name.c_str());
+ break;
+ case JAVA_TYPE_LONG:
+ fprintf(out, " AStatsEvent_writeInt64(__event, %s);\n", name.c_str());
+ break;
+ case JAVA_TYPE_STRING:
+ fprintf(out, " let str = std::ffi::CString::new(%s)?;\n", name.c_str());
+ fprintf(out, " AStatsEvent_writeString(__event, str.as_ptr());\n");
+ break;
+ default:
+ // Unsupported types: OBJECT, DOUBLE, KEY_VALUE_PAIRS
+ fprintf(stderr, "Encountered unsupported type: %d.", type);
+ return 1;
+ }
+ // write_annotations expects the first argument to have an index of 1.
+ write_annotations(out, i + 1, atomDecl, "AStatsEvent_", "__event, ");
+ }
+ if (atomDecl.oneOfName == ONEOF_PUSHED_ATOM_NAME) {
+ fprintf(out, " let __ret = AStatsEvent_write(__event);\n");
+ fprintf(out, " if __ret >= 0 { statslog_rust_header::StatsResult::Ok(()) }"
+ " else { Err(statslog_rust_header::StatsError::Return(__ret)) }\n");
+ } else {
+ fprintf(out, " AStatsEvent_build(__event);\n");
+ fprintf(out, " statslog_rust_header::StatsResult::Ok(())\n");
+ }
+ fprintf(out, " }\n");
+ return 0;
+}
+
+static int write_rust_stats_write_method(FILE* out, const shared_ptr<AtomDecl>& atomDecl,
+ const AtomDecl& attributionDecl,
+ const int minApiLevel) {
+ if (atomDecl->oneOfName == ONEOF_PUSHED_ATOM_NAME) {
+ write_rust_method_signature(out, "stats_write", *atomDecl, attributionDecl,
+ true, false);
+ } else {
+ write_rust_method_signature(out, "add_astats_event", *atomDecl, attributionDecl,
+ true, false);
+ }
+ int ret = write_rust_method_body(out, *atomDecl, attributionDecl, minApiLevel);
+ if (ret != 0) {
+ return ret;
+ }
+ fprintf(out, " }\n\n");
+ return 0;
+}
+
+static void write_rust_stats_write_non_chained_method(FILE* out,
+ const shared_ptr<AtomDecl>& atomDecl,
+ const AtomDecl& attributionDecl) {
+ write_rust_method_signature(out, "stats_write_non_chained", *atomDecl, attributionDecl,
+ true, true);
+ fprintf(out, " stats_write(");
+ for (int i = 0; i < atomDecl->fields.size(); i++) {
+ if (i != 0) {
+ fprintf(out, ", ");
+ }
+ const AtomField &atomField = atomDecl->fields[i];
+ const java_type_t& type = atomField.javaType;
+ if (i < 2) {
+ // The first two args are attribution chains.
+ fprintf(out, "&[%s_non_chained_]", atomField.name.c_str());
+ } else if (type == JAVA_TYPE_ATTRIBUTION_CHAIN) {
+ for (int j = 0; j < attributionDecl.fields.size(); j++) {
+ const AtomField& chainField = attributionDecl.fields[j];
+ if (i != 0 || j != 0) {
+ fprintf(out, ", ");
+ }
+ fprintf(out, "&[%s_chain_]", chainField.name.c_str());
+ }
+ } else {
+ fprintf(out, "%s", get_variable_name(atomField.name).c_str());
+ }
+ }
+ fprintf(out, ")\n");
+ fprintf(out, " }\n\n");
+}
+
+static bool needs_lifetime(const shared_ptr<AtomDecl>& atomDecl) {
+ for (const AtomField& atomField : atomDecl->fields) {
+ const java_type_t& type = atomField.javaType;
+ if (type == JAVA_TYPE_ATTRIBUTION_CHAIN
+ || type == JAVA_TYPE_STRING || type == JAVA_TYPE_BYTE_ARRAY) {
+ return true;
+ }
+ }
+ return false;
+}
+
+static void write_rust_struct(FILE* out, const shared_ptr<AtomDecl>& atomDecl,
+ const AtomDecl& attributionDecl) {
+ // Write the struct.
+ bool lifetime = needs_lifetime(atomDecl);
+ if (lifetime) {
+ fprintf(out, " pub struct %s<'a> {\n", make_camel_case_name(atomDecl->name).c_str());
+ } else {
+ fprintf(out, " pub struct %s {\n", make_camel_case_name(atomDecl->name).c_str());
+ }
+ for (const AtomField& atomField : atomDecl->fields) {
+ const java_type_t& type = atomField.javaType;
+ if (type == JAVA_TYPE_ATTRIBUTION_CHAIN) {
+ for (const AtomField& chainField : attributionDecl.fields) {
+ fprintf(out, " pub %s_chain_: &'a [%s],\n", chainField.name.c_str(),
+ rust_type_name(chainField.javaType, true));
+ }
+ } else {
+ fprintf(out, " pub %s:", get_variable_name(atomField.name).c_str());
+ if (type == JAVA_TYPE_ENUM) {
+ fprintf(out, " %s,\n", make_camel_case_name(atomField.name).c_str());
+ } else {
+ fprintf(out, " %s,\n", rust_type_name(type, true));
+ }
+ }
+ }
+ fprintf(out, " }\n");
+
+ // Write the impl
+ bool isPush = atomDecl->oneOfName == ONEOF_PUSHED_ATOM_NAME;
+ if (isPush) {
+ if (lifetime) {
+ fprintf(out, " impl<'a> %s<'a> {\n", make_camel_case_name(atomDecl->name).c_str());
+ } else {
+ fprintf(out, " impl %s {\n", make_camel_case_name(atomDecl->name).c_str());
+ }
+ } else {
+ if (lifetime) {
+ fprintf(out, " impl<'a> statslog_rust_header::Stat for %s<'a> {\n",
+ make_camel_case_name(atomDecl->name).c_str());
+ } else {
+ fprintf(out, " impl statslog_rust_header::Stat for %s {\n",
+ make_camel_case_name(atomDecl->name).c_str());
+ }
+ }
+ fprintf(out, " #[inline(always)]\n");
+ if (isPush) {
+ fprintf(out, " pub fn stats_write(&self)"
+ " -> statslog_rust_header::StatsResult {\n");
+ fprintf(out, " stats_write(");
+ } else {
+ fprintf(out, " fn add_astats_event(&self, pulled_data: &mut AStatsEventList)"
+ " -> statslog_rust_header::StatsResult {\n");
+ fprintf(out, " add_astats_event(pulled_data, ");
+ }
+ for (const AtomField& atomField : atomDecl->fields) {
+ const java_type_t& type = atomField.javaType;
+ if (type == JAVA_TYPE_ATTRIBUTION_CHAIN) {
+ for (const AtomField& chainField : attributionDecl.fields) {
+ fprintf(out, "self.%s_chain_, ", chainField.name.c_str());
+ }
+ } else {
+ fprintf(out, "self.%s, ", get_variable_name(atomField.name).c_str());
+ }
+ }
+ fprintf(out, ")\n");
+ fprintf(out, " }\n");
+ fprintf(out, " }\n\n");
+}
+
+static int write_rust_stats_write_atoms(FILE* out, const AtomDeclSet& atomDeclSet,
+ const AtomDecl& attributionDecl,
+ const AtomDeclSet& nonChainedAtomDeclSet,
+ const int minApiLevel) {
+ for (const auto &atomDecl : atomDeclSet) {
+ // Key value pairs not supported in Rust because they're not supported in native.
+ if (std::find_if(atomDecl->fields.begin(), atomDecl->fields.end(),
+ [](const AtomField &atomField) {
+ return atomField.javaType == JAVA_TYPE_KEY_VALUE_PAIR;
+ }) != atomDecl->fields.end()) {
+ continue;
+ }
+ fprintf(out, "pub mod %s {\n", atomDecl->name.c_str());
+ fprintf(out, " use statspull_bindgen::*;\n");
+ fprintf(out, " #[allow(unused)]\n");
+ fprintf(out, " use std::convert::TryInto;\n");
+ fprintf(out, "\n");
+ write_rust_atom_constant_values(out, atomDecl);
+ write_rust_struct(out, atomDecl, attributionDecl);
+ int ret = write_rust_stats_write_method(out, atomDecl, attributionDecl, minApiLevel);
+ if (ret != 0) {
+ return ret;
+ }
+ auto nonChained = nonChainedAtomDeclSet.find(atomDecl);
+ if (nonChained != nonChainedAtomDeclSet.end()) {
+ write_rust_stats_write_non_chained_method(out, *nonChained, attributionDecl);
+ }
+ fprintf(out, "}\n");
+ }
+ return 0;
+}
+
+void write_stats_log_rust_header(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl) {
+ // Print prelude
+ fprintf(out, "// This file is autogenerated.\n");
+ fprintf(out, "\n");
+ fprintf(out, "#[derive(thiserror::Error, Debug)]\n");
+ fprintf(out, "pub enum StatsError {\n");
+ fprintf(out, " #[error(\"Return error {0:?}\")]\n");
+ fprintf(out, " Return(i32),\n");
+ fprintf(out, " #[error(transparent)]\n");
+ fprintf(out, " NullChar(#[from] std::ffi::NulError),\n");
+ fprintf(out, " #[error(transparent)]\n");
+ fprintf(out, " Conversion(#[from] std::num::TryFromIntError),\n");
+ fprintf(out, "}\n");
+ fprintf(out, "\n");
+ fprintf(out, "pub type StatsResult = std::result::Result<(), StatsError>;\n");
+ fprintf(out, "\n");
+ fprintf(out, "pub trait Stat {\n");
+ fprintf(out, " fn add_astats_event(&self,"
+ " pulled_data: &mut statspull_bindgen::AStatsEventList)"
+ " -> StatsResult;\n");
+ fprintf(out, "}\n");
+ fprintf(out, "\n");
+
+ write_rust_atom_constants(out, atoms, attributionDecl);
+}
+
+int write_stats_log_rust(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl,
+ const int minApiLevel) {
+ //Print prelude
+ fprintf(out, "// This file is autogenerated.\n");
+ fprintf(out, "\n");
+ fprintf(out, "struct AStatsEventDropper(*mut statspull_bindgen::AStatsEvent);\n");
+ fprintf(out, "\n");
+ fprintf(out, "impl Drop for AStatsEventDropper {\n");
+ fprintf(out, " fn drop(&mut self) {\n");
+ fprintf(out, " unsafe { statspull_bindgen::AStatsEvent_release(self.0) }\n");
+ fprintf(out, " }\n");
+ fprintf(out, "}\n");
+ fprintf(out, "\n");
+
+ write_rust_annotation_constants(out);
+
+ int errorCount = write_rust_stats_write_atoms(out, atoms.decls, attributionDecl,
+ atoms.non_chained_decls, minApiLevel);
+
+ return errorCount;
+}
+
+} // namespace stats_log_api_gen
+} // namespace android
diff --git a/stats/stats_log_api_gen/rust_writer.h b/stats/stats_log_api_gen/rust_writer.h
new file mode 100644
index 0000000..daaa241
--- /dev/null
+++ b/stats/stats_log_api_gen/rust_writer.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2021, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <stdio.h>
+
+#include "Collation.h"
+
+namespace android {
+namespace stats_log_api_gen {
+
+int write_stats_log_rust(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl,
+ const int minApiLevel);
+
+void write_stats_log_rust_header(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl);
+
+} // namespace stats_log_api_gen
+} // namespace android
diff --git a/stats/stats_log_api_gen/test.proto b/stats/stats_log_api_gen/test.proto
index a3ea785..18c52bf 100644
--- a/stats/stats_log_api_gen/test.proto
+++ b/stats/stats_log_api_gen/test.proto
@@ -58,7 +58,7 @@
}
message Event {
- oneof event {
+ oneof pushed {
OutOfOrderAtom out_of_order_atom = 2;
IntAtom int_atom = 1;
AnotherIntAtom another_int_atom = 3;
@@ -74,7 +74,7 @@
}
message BadTypesEvent {
- oneof event {
+ oneof pushed {
BadTypesAtom bad_types_atom = 1;
}
}
@@ -84,7 +84,7 @@
}
message BadSkippedFieldSingle {
- oneof event {
+ oneof pushed {
BadSkippedFieldSingleAtom bad = 1;
}
}
@@ -96,7 +96,7 @@
}
message BadSkippedFieldMultiple {
- oneof event {
+ oneof pushed {
BadSkippedFieldMultipleAtom bad = 1;
}
}
@@ -107,11 +107,11 @@
}
message BadAttributionNodePosition {
- oneof event { BadAttributionNodePositionAtom bad = 1; }
+ oneof pushed { BadAttributionNodePositionAtom bad = 1; }
}
message GoodEventWithBinaryFieldAtom {
- oneof event { GoodBinaryFieldAtom field1 = 1; }
+ oneof pushed { GoodBinaryFieldAtom field1 = 1; }
}
message ComplexField {
@@ -124,7 +124,7 @@
}
message BadEventWithBinaryFieldAtom {
- oneof event { BadBinaryFieldAtom field1 = 1; }
+ oneof pushed { BadBinaryFieldAtom field1 = 1; }
}
message BadBinaryFieldAtom {
@@ -133,7 +133,7 @@
}
message BadStateAtoms {
- oneof event {
+ oneof pushed {
BadStateAtom1 bad1 = 1;
BadStateAtom2 bad2 = 2;
BadStateAtom3 bad3 = 3;
@@ -141,7 +141,7 @@
}
message GoodStateAtoms {
- oneof event {
+ oneof pushed {
GoodStateAtom1 good1 = 1;
GoodStateAtom2 good2 = 2;
}
@@ -204,7 +204,7 @@
}
message ModuleAtoms {
- oneof event {
+ oneof pushed {
ModuleOneAtom module_one_atom = 1 [(android.os.statsd.module) = "module1"];
ModuleTwoAtom module_two_atom = 2 [(android.os.statsd.module) = "module2"];
ModuleOneAndTwoAtom module_one_and_two_atom = 3 [
@@ -213,3 +213,24 @@
NoModuleAtom no_module_atom = 4;
}
}
+
+message NotAPushNorPullAtom {
+ oneof event {
+ IntAtom int_atom = 1;
+ }
+}
+
+message AtomNotInAOneof {
+ optional IntAtom int_atom = 1;
+}
+
+message PushedAndPulledAtoms {
+ oneof pushed {
+ IntAtom int_atom_1 = 1;
+ }
+
+ oneof pulled {
+ OutOfOrderAtom out_of_order_atom = 11;
+ AnotherIntAtom another_int_atom = 10;
+ }
+}
diff --git a/stats/stats_log_api_gen/test_collation.cpp b/stats/stats_log_api_gen/test_collation.cpp
index d73afe6..3b536a4 100644
--- a/stats/stats_log_api_gen/test_collation.cpp
+++ b/stats/stats_log_api_gen/test_collation.cpp
@@ -24,7 +24,6 @@
namespace stats_log_api_gen {
using std::map;
-using std::set;
using std::vector;
/**
@@ -32,11 +31,11 @@
*/
static bool map_contains_vector(const SignatureInfoMap& s, int count, ...) {
va_list args;
- vector<java_type_t> v;
+ vector<java_type_t> v(count);
va_start(args, count);
for (int i = 0; i < count; i++) {
- v.push_back((java_type_t)va_arg(args, int));
+ v[i] = static_cast<java_type_t>(va_arg(args, int));
}
va_end(args);
@@ -222,7 +221,7 @@
Atoms atoms;
int errorCount =
collate_atoms(BadEventWithBinaryFieldAtom::descriptor(), DEFAULT_MODULE_NAME, &atoms);
- EXPECT_TRUE(errorCount > 0);
+ EXPECT_GT(errorCount, 0);
}
TEST(CollationTest, PassOnLogFromModuleAtom) {
@@ -365,5 +364,69 @@
EXPECT_TRUE(annotation->value.boolValue);
}
+/**
+ * Test that an atom is not a pushed nor pulled atom.
+ */
+TEST(CollationTest, InvalidAtomType) {
+ Atoms atoms;
+ int errorCount = collate_atoms(NotAPushNorPullAtom::descriptor(), DEFAULT_MODULE_NAME, &atoms);
+
+ EXPECT_EQ(1, errorCount);
+}
+
+/**
+ * Test that an atom was not declared in a `oneof` field.
+ */
+TEST(CollationTest, AtomNotDeclaredInAOneof) {
+ Atoms atoms;
+ int errorCount = collate_atoms(AtomNotInAOneof::descriptor(), DEFAULT_MODULE_NAME, &atoms);
+
+ EXPECT_EQ(1, errorCount);
+}
+
+/**
+ * Test a correct collation with pushed and pulled atoms.
+ */
+TEST(CollationTest, CollatePushedAndPulledAtoms) {
+ Atoms atoms;
+ int errorCount = collate_atoms(PushedAndPulledAtoms::descriptor(), DEFAULT_MODULE_NAME, &atoms);
+
+ EXPECT_EQ(0, errorCount);
+ EXPECT_EQ(1ul, atoms.signatureInfoMap.size());
+ EXPECT_EQ(2ul, atoms.pulledAtomsSignatureInfoMap.size());
+
+ // IntAtom
+ EXPECT_MAP_CONTAINS_SIGNATURE(atoms.signatureInfoMap, JAVA_TYPE_INT);
+
+ // AnotherIntAtom
+ EXPECT_MAP_CONTAINS_SIGNATURE(atoms.pulledAtomsSignatureInfoMap, JAVA_TYPE_INT);
+
+ // OutOfOrderAtom
+ EXPECT_MAP_CONTAINS_SIGNATURE(atoms.pulledAtomsSignatureInfoMap, JAVA_TYPE_INT, JAVA_TYPE_INT);
+
+ EXPECT_EQ(3ul, atoms.decls.size());
+
+ AtomDeclSet::const_iterator atomIt = atoms.decls.begin();
+ EXPECT_EQ(1, (*atomIt)->code);
+ EXPECT_EQ("int_atom_1", (*atomIt)->name);
+ EXPECT_EQ("IntAtom", (*atomIt)->message);
+ EXPECT_NO_ENUM_FIELD((*atomIt));
+ atomIt++;
+
+ EXPECT_EQ(10, (*atomIt)->code);
+ EXPECT_EQ("another_int_atom", (*atomIt)->name);
+ EXPECT_EQ("AnotherIntAtom", (*atomIt)->message);
+ EXPECT_NO_ENUM_FIELD((*atomIt));
+ atomIt++;
+
+ EXPECT_EQ(11, (*atomIt)->code);
+ EXPECT_EQ("out_of_order_atom", (*atomIt)->name);
+ EXPECT_EQ("OutOfOrderAtom", (*atomIt)->message);
+ EXPECT_NO_ENUM_FIELD((*atomIt));
+ atomIt++;
+
+ EXPECT_EQ(atoms.decls.end(), atomIt);
+}
+
} // namespace stats_log_api_gen
} // namespace android
diff --git a/stats/stats_log_api_gen/utils.cpp b/stats/stats_log_api_gen/utils.cpp
index abb8913..d3ea80c 100644
--- a/stats/stats_log_api_gen/utils.cpp
+++ b/stats/stats_log_api_gen/utils.cpp
@@ -16,19 +16,52 @@
#include "utils.h"
-#include "android-base/strings.h"
-
namespace android {
namespace stats_log_api_gen {
-static void build_non_chained_decl_map(const Atoms& atoms,
- std::map<int, AtomDeclSet::const_iterator>* decl_map) {
+/**
+ * Inlining this method because "android-base/strings.h" is not available on
+ * google3.
+ */
+static vector<string> Split(const string& s, const string& delimiters) {
+ GOOGLE_CHECK_NE(delimiters.size(), 0U);
+
+ vector<string> result;
+
+ size_t base = 0;
+ size_t found;
+ while (true) {
+ found = s.find_first_of(delimiters, base);
+ result.push_back(s.substr(base, found - base));
+ if (found == s.npos) break;
+ base = found + 1;
+ }
+
+ return result;
+}
+
+void build_non_chained_decl_map(const Atoms& atoms,
+ std::map<int, AtomDeclSet::const_iterator>* decl_map) {
for (AtomDeclSet::const_iterator atomIt = atoms.non_chained_decls.begin();
atomIt != atoms.non_chained_decls.end(); atomIt++) {
decl_map->insert(std::make_pair((*atomIt)->code, atomIt));
}
}
+const map<AnnotationId, string>& get_annotation_id_constants() {
+ static const map<AnnotationId, string>* ANNOTATION_ID_CONSTANTS =
+ new map<AnnotationId, string>{
+ {ANNOTATION_ID_IS_UID, "ANNOTATION_ID_IS_UID"},
+ {ANNOTATION_ID_TRUNCATE_TIMESTAMP, "ANNOTATION_ID_TRUNCATE_TIMESTAMP"},
+ {ANNOTATION_ID_PRIMARY_FIELD, "ANNOTATION_ID_PRIMARY_FIELD"},
+ {ANNOTATION_ID_PRIMARY_FIELD_FIRST_UID, "ANNOTATION_ID_PRIMARY_FIELD_FIRST_UID"},
+ {ANNOTATION_ID_EXCLUSIVE_STATE, "ANNOTATION_ID_EXCLUSIVE_STATE"},
+ {ANNOTATION_ID_TRIGGER_STATE_RESET, "ANNOTATION_ID_TRIGGER_STATE_RESET"},
+ {ANNOTATION_ID_STATE_NESTED, "ANNOTATION_ID_STATE_NESTED"}};
+
+ return *ANNOTATION_ID_CONSTANTS;
+}
+
/**
* Turn lower and camel case into upper case with underscores.
*/
@@ -102,15 +135,15 @@
// Writes namespaces for the cpp and header files, returning the number of
// namespaces written.
void write_namespace(FILE* out, const string& cppNamespaces) {
- vector<string> cppNamespaceVec = android::base::Split(cppNamespaces, ",");
- for (string cppNamespace : cppNamespaceVec) {
+ vector<string> cppNamespaceVec = Split(cppNamespaces, ",");
+ for (const string& cppNamespace : cppNamespaceVec) {
fprintf(out, "namespace %s {\n", cppNamespace.c_str());
}
}
// Writes namespace closing brackets for cpp and header files.
void write_closing_namespace(FILE* out, const string& cppNamespaces) {
- vector<string> cppNamespaceVec = android::base::Split(cppNamespaces, ",");
+ vector<string> cppNamespaceVec = Split(cppNamespaces, ",");
for (auto it = cppNamespaceVec.rbegin(); it != cppNamespaceVec.rend(); ++it) {
fprintf(out, "} // namespace %s\n", it->c_str());
}
@@ -123,7 +156,7 @@
for (vector<AtomField>::const_iterator field = atom->fields.begin();
field != atom->fields.end(); field++) {
if (field->javaType == JAVA_TYPE_ATTRIBUTION_CHAIN) {
- for (auto chainField : attributionDecl.fields) {
+ for (const auto& chainField : attributionDecl.fields) {
if (chainField.javaType == JAVA_TYPE_STRING) {
fprintf(out, ", const std::vector<%s>& %s", cpp_type_name(chainField.javaType),
chainField.name.c_str());
@@ -182,15 +215,15 @@
fprintf(out, "\n");
}
-void write_native_method_signature(FILE* out, const string& methodName,
+void write_native_method_signature(FILE* out, const string& signaturePrefix,
const vector<java_type_t>& signature,
const AtomDecl& attributionDecl, const string& closer) {
- fprintf(out, "%s(int32_t code", methodName.c_str());
+ fprintf(out, "%sint32_t code", signaturePrefix.c_str());
int argIndex = 1;
for (vector<java_type_t>::const_iterator arg = signature.begin(); arg != signature.end();
arg++) {
if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) {
- for (auto chainField : attributionDecl.fields) {
+ for (const auto& chainField : attributionDecl.fields) {
if (chainField.javaType == JAVA_TYPE_STRING) {
fprintf(out, ", const std::vector<%s>& %s", cpp_type_name(chainField.javaType),
chainField.name.c_str());
@@ -222,7 +255,7 @@
for (vector<java_type_t>::const_iterator arg = signature.begin(); arg != signature.end();
arg++) {
if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) {
- for (auto chainField : attributionDecl.fields) {
+ for (const auto& chainField : attributionDecl.fields) {
if (chainField.javaType == JAVA_TYPE_STRING) {
fprintf(out, ", %s", chainField.name.c_str());
} else {
diff --git a/stats/stats_log_api_gen/utils.h b/stats/stats_log_api_gen/utils.h
index 73e0cb8..947e9fe 100644
--- a/stats/stats_log_api_gen/utils.h
+++ b/stats/stats_log_api_gen/utils.h
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#pragma once
+#ifndef ANDROID_STATS_LOG_API_GEN_UTILS_H
+#define ANDROID_STATS_LOG_API_GEN_UTILS_H
#include <stdio.h>
#include <string.h>
@@ -28,23 +29,21 @@
namespace android {
namespace stats_log_api_gen {
-using namespace std;
+const char DEFAULT_CPP_NAMESPACE[] = "android,util";
+const char DEFAULT_CPP_HEADER_IMPORT[] = "statslog.h";
-const string DEFAULT_CPP_NAMESPACE = "android,util";
-const string DEFAULT_CPP_HEADER_IMPORT = "statslog.h";
+const int API_LEVEL_CURRENT = 10000;
+const int API_Q = 29;
+const int API_R = 30;
const int JAVA_MODULE_REQUIRES_FLOAT = 0x01;
const int JAVA_MODULE_REQUIRES_ATTRIBUTION = 0x02;
const int JAVA_MODULE_REQUIRES_KEY_VALUE_PAIRS = 0x04;
-const map<AnnotationId, string> ANNOTATION_ID_CONSTANTS = {
- {ANNOTATION_ID_IS_UID, "ANNOTATION_ID_IS_UID"},
- {ANNOTATION_ID_TRUNCATE_TIMESTAMP, "ANNOTATION_ID_TRUNCATE_TIMESTAMP"},
- {ANNOTATION_ID_PRIMARY_FIELD, "ANNOTATION_ID_PRIMARY_FIELD"},
- {ANNOTATION_ID_PRIMARY_FIELD_FIRST_UID, "ANNOTATION_ID_PRIMARY_FIELD_FIRST_UID"},
- {ANNOTATION_ID_EXCLUSIVE_STATE, "ANNOTATION_ID_EXCLUSIVE_STATE"},
- {ANNOTATION_ID_TRIGGER_STATE_RESET, "ANNOTATION_ID_TRIGGER_STATE_RESET"},
- {ANNOTATION_ID_STATE_NESTED, "ANNOTATION_ID_STATE_NESTED"}};
+void build_non_chained_decl_map(const Atoms& atoms,
+ std::map<int, AtomDeclSet::const_iterator>* decl_map);
+
+const map<AnnotationId, string>& get_annotation_id_constants();
string make_constant_name(const string& str);
@@ -59,7 +58,7 @@
void write_native_atom_constants(FILE* out, const Atoms& atoms, const AtomDecl& attributionDecl);
-void write_native_method_signature(FILE* out, const string& methodName,
+void write_native_method_signature(FILE* out, const string& signaturePrefix,
const vector<java_type_t>& signature,
const AtomDecl& attributionDecl, const string& closer);
@@ -81,3 +80,5 @@
} // namespace stats_log_api_gen
} // namespace android
+
+#endif // ANDROID_STATS_LOG_API_GEN_UTILS_H