BluetoothMetrics: Add BluetoothDeviceNameReported for extract manufacturer and model info from dogfooders. am: 3b3844a360

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/proto_logging/+/18899719

Change-Id: I4342bb4d5fa3f079ba508e65fe474b25119e7b6c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/stats/atoms.proto b/stats/atoms.proto
index 8a83c9f..67f5e43 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -66,6 +66,7 @@
 import "frameworks/proto_logging/stats/enums/stats/location/location_enums.proto";
 import "frameworks/proto_logging/stats/enums/stats/mediametrics/mediametrics.proto";
 import "frameworks/proto_logging/stats/enums/stats/mediaprovider/mediaprovider_enums.proto";
+import "frameworks/proto_logging/stats/enums/stats/safetycenter/enums.proto";
 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";
@@ -663,7 +664,10 @@
             [(module) = "framework"];
         HotwordDetectorEvents hotword_detector_events = 434
             [(module) = "framework"];
-        // 435, 436 not been used in this branch.
+        AdServicesApiCalled ad_services_api_called =
+            435 [(module) = "adservices", (truncate_timestamp) = true];
+        AdServicesMeasurementReportsUploaded ad_services_mesurement_reports_uploaded =
+            436 [(module) = "adservices", (truncate_timestamp) = true];
         BootCompletedBroadcastCompletionLatencyReported boot_completed_broadcast_completion_latency_reported =
             437 [(module) = "framework"];
         ContactsIndexerUpdateStatsReported contacts_indexer_update_stats_reported = 440
@@ -698,6 +702,9 @@
         BackgroundDexoptJobEnded background_dexopt_job_ended = 467 [(module) = "art"];
         SyncExemptionOccurred sync_exemption_occurred = 468 [(module) = "framework"];
         AutofillPresentationEventReported autofill_presentation_event_reported = 469 [(module) = "framework"];
+        SafetySourceStateCollected safety_source_state_collected = 471 [(module) = "permissioncontroller"];
+        SafetyCenterSystemEventReported safety_center_system_event_reported = 472 [(module) = "permissioncontroller"];
+        SafetyCenterInteractionReported safety_center_interaction_reported = 473 [(module) = "permissioncontroller"];
         BroadcastDeliveryEventReported broadcast_delivery_event_reported =
                 475 [(module) = "framework"];
         ServiceRequestEventReported service_request_event_reported = 476 [(module) = "framework"];
@@ -897,6 +904,7 @@
         TelephonyNetworkRequestsV2 telephony_network_requests_v2 = 10153 [(module) = "telephony"];
         DeviceTelephonyProperties device_telephony_properties = 10154 [(module) = "telephony"];
         RemoteKeyProvisioningErrorCounts remote_key_provisioning_error_counts = 10155 [(module) = "remoteprovisioner"];
+        SafetyState safety_state = 10156 [(module) = "permissioncontroller"];
     }
 
     // DO NOT USE field numbers above 100,000 in AOSP.
@@ -20298,6 +20306,92 @@
 }
 
 /**
+ * Logs when an AdServices api is called.
+ */
+message AdServicesApiCalled {
+    // The name of the api that was called.
+    // Can be classified as one of the three:
+    //
+    // Targeting
+    //  * GetTopics()
+    //
+    // FLEDGE
+    //  * joinCustomAudience()
+    //  * leaveCustomAudience()
+    //  * overrideCustomAudienceRemoteInfo()
+    //  * removeCustomAudienceRemoteInfoOverride()
+    //  * resetAllCustomAudienceOverrides()
+    //  * runAdSelection()
+    //  * reportImpression()
+    //  * overrideAdSelectionConfigRemoteInfo()
+    //  * removeAdSelectionConfigRemoteInfoOverride()
+    //  * resetAllAdSelectionConfigRemoteOverrides()
+    //
+    // Measurement - client side
+    //   * register()
+    //   * deleteRegistrations()
+
+
+    enum AdServicesApiClassType {
+        UNKNOWN = 0;
+        TARGETING = 1;
+        FLEDGE = 2;
+        MEASUREMENT = 3;
+    }
+
+    enum AdServicesApiName {
+        API_NAME_UNKNOWN = 0;
+        GET_TOPICS = 1;
+        JOIN_CUSTOM_AUDIENCE = 2;
+        LEAVE_CUSTOM_AUDIENCE = 3;
+        RUN_AD_SELECTION = 4;
+        REGISTER = 5;
+        DELETE_REGISTRATIONS = 6;
+        REPORT_IMPRESSION = 7;
+        OVERRIDE_CUSTOM_AUDIENCE_REMOTE_INFO = 8;
+        REMOVE_CUSTOM_AUDIENCE_REMOTE_INFO_OVERRIDE = 9;
+        RESET_ALL_CUSTOM_AUDIENCE_OVERRIDES = 10;
+        OVERRIDE_AD_SELECTION_CONFIG_REMOTE_INFO = 11;
+        REMOVE_AD_SELECTION_CONFIG_REMOTE_INFO_OVERRIDE = 12;
+        RESET_ALL_AD_SELECTION_CONFIG_REMOTE_OVERRIDES = 13;
+    }
+
+    optional AdServicesApiClassType api_class = 1;
+
+    // The actual name of the api within the 3 classes described above.
+    optional AdServicesApiName  api_name = 2;
+
+    optional string app_package_name = 3;
+    optional string sdk_package_name = 4;
+
+    optional int32 latency_millis = 5;
+
+    // response_code is the error/failure code for the given api.
+    optional int32 response_code = 6;
+}
+
+/**
+ * Logs when an AdServices measurement reports are being uploaded.
+ */
+message AdServicesMeasurementReportsUploaded {
+    enum ReportType {
+        UNKNOWN_REPORT = 0;
+        EVENT = 1;
+        AGGREGATE = 2;
+    }
+
+    optional ReportType type = 1;
+
+    enum ReportUploadStatus {
+        UNKNOWN_STATUS = 0;
+        SUCCESS = 1;
+        FAILURE = 2;
+    }
+
+    optional ReportUploadStatus response_code = 2;
+}
+
+/**
  * Log the duration of executing all receivers of LOCKED_BOOT_COMPLETED or BOOT_COMPLETED broadcast.
  * The dispatch latency is the dispatchTime - enqueueTime.
  * The completion latency is the completeTime - enqueueTime.
@@ -20955,3 +21049,142 @@
     // bytes count against an error budget, so it's important to track.
     optional int32 error_bytes = 3;
 }
+
+// Logs the overall Safety State of the device (as cached by the Safety Center)
+message SafetyState {
+    // The overall severity level of the Safety Center.
+    optional android.stats.safetycenter.SafetySeverityLevel overall_severity_level = 1;
+
+    // The number of open issues in the Safety Center.
+    optional int64 open_issues_count = 2;
+
+    // The number of dismissed issues in the Safety Center.
+    optional int64 dismissed_issues_count = 3;
+}
+
+// Logs the state of an individual Safety Source when overall SafetyState is
+// collected.
+message SafetySourceStateCollected {
+    optional int64 encoded_safety_source_id = 1;
+
+    optional android.stats.safetycenter.SafetySourceProfileType safety_source_profile_type = 2;
+
+    // The severity level of this source.
+    optional android.stats.safetycenter.SafetySeverityLevel severity_level = 3;
+
+    // The number of open issues belonging to this Safety Source.
+    optional int64 open_issues_count = 4;
+
+    // The number of dismissed issues belonging to this Safety Source.
+    optional int64 dismissed_issues_count = 5;
+}
+
+// Logs system-health and performance related events from the Safety Center
+message SafetyCenterSystemEventReported {
+    enum EventType {
+        EVENT_TYPE_UNKNOWN = 0;
+        SINGLE_SOURCE_GET_NEW_DATA = 1;
+        SINGLE_SOURCE_RESCAN = 2;
+        COMPLETE_GET_NEW_DATA = 3;
+        COMPLETE_RESCAN = 4;
+        INLINE_ACTION = 5;
+    }
+    optional EventType event_type = 1;
+
+    // Unset if this event isn't source-specific.
+    optional int64 encoded_safety_source_id = 2;
+
+    // Unset if this event isn't source-specific.
+    optional android.stats.safetycenter.SafetySourceProfileType safety_source_profile_type = 3;
+
+    // Unset if this event isn't specific to an issue.
+    optional int64 encoded_issue_type_id = 4;
+
+    optional int64 duration_millis = 5;
+
+    enum Result {
+        RESULT_UNKNOWN = 0;
+        SUCCESS = 1;
+        TIMEOUT = 2;
+        ERROR = 3;
+    }
+    optional Result result = 6;
+}
+
+// Logs a user interaction with the Safety Center. Various fields may or may not be
+// set depending on the Action reported.
+message SafetyCenterInteractionReported {
+    // ID which identifies single session of user interacting with Safety Center.
+    optional int64 session_id = 1;
+
+    enum Action {
+        ACTION_UNKNOWN = 0;
+
+        SAFETY_CENTER_VIEWED = 1;
+        SAFETY_ISSUE_VIEWED = 2;
+
+        SCAN_INITIATED = 3;
+
+        ISSUE_PRIMARY_ACTION_CLICKED = 4;
+        ISSUE_SECONDARY_ACTION_CLICKED = 5;
+        ISSUE_DISMISS_CLICKED = 6;
+
+        MORE_ISSUES_CLICKED = 7;
+        ENTRY_CLICKED = 8;
+        ENTRY_ICON_ACTION_CLICKED = 9;
+        STATIC_ENTRY_CLICKED = 10;
+
+        PRIVACY_CONTROL_TOGGLE_CLICKED = 11;
+        SENSOR_PERMISSION_REVOKE_CLICKED = 12;
+        SENSOR_PERMISSION_SEE_USAGES_CLICKED = 13;
+        REVIEW_SETTINGS_CLICKED = 14;
+    }
+
+    // Action taken in the Safety Center.
+    optional Action action = 2;
+
+    enum ViewType {
+        VIEW_TYPE_UNKNOWN = 0;
+        FULL = 1;
+        QUICK_SETTINGS = 2;
+    }
+
+    // Which view of the Safety Center this interaction occurred in.
+    optional ViewType view_type = 3;
+
+    enum NavigationSource {
+        SOURCE_UNKNOWN = 0;
+        NOTIFICATION = 1;
+        QUICK_SETTINGS_TILE = 2;
+        SETTINGS = 3;
+        SENSOR_INDICATOR = 4;
+    }
+
+    // Where the session was initiated from.
+    optional NavigationSource navigation_source = 4;
+
+    // Severity level of the particular issue or entry, or the overall Safety
+    // Center this interaction is associated with.
+    optional android.stats.safetycenter.SafetySeverityLevel severity_level = 5;
+
+    // The hashed ID of the Safety Source that this interaction was with performed with,
+    // or nothing if this event isn't source-specific.
+    optional int64 encoded_safety_source_id = 6;
+
+    // The kind of profile that this safety source originated from (sources from
+    // personal and work profiles may have the same source ID)
+    optional android.stats.safetycenter.SafetySourceProfileType safety_source_profile_type = 7;
+
+    // A hash of the loggable issue type ID that this interaction was performed with.
+    optional int64 encoded_issue_type_id = 8;
+
+    enum Sensor {
+        SENSOR_UNKNOWN = 0;
+        MICROPHONE = 1;
+        CAMERA = 2;
+        LOCATION = 3;
+    }
+
+    // Which sensor was associated with this interaction (if any).
+    optional Sensor sensor = 9;
+}
diff --git a/stats/enums/stats/safetycenter/enums.proto b/stats/enums/stats/safetycenter/enums.proto
new file mode 100644
index 0000000..4cf1a60
--- /dev/null
+++ b/stats/enums/stats/safetycenter/enums.proto
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2022 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.safetycenter;
+
+enum SafetySeverityLevel {
+    SAFETY_SEVERITY_LEVEL_UNKNOWN = 0;
+    SAFETY_SEVERITY_UNSPECIFIED = 1;
+    SAFETY_SEVERITY_OK = 2;
+    SAFETY_SEVERITY_RECOMMENDATION = 3;
+    SAFETY_SEVERITY_CRITICAL_WARNING = 4;
+}
+
+enum SafetySourceProfileType {
+    PROFILE_TYPE_UNKNOWN = 0;
+    PROFILE_TYPE_PERSONAL = 1;
+    PROFILE_TYPE_MANAGED = 2;
+}
+