Snap for 11034692 from d484d63a89ca0e3070d7e6e6fd12d2ef197a8f46 to mainline-conscrypt-release

Change-Id: I2c338de3011e7006f3e96635ddf2f2ca5e20bcee
diff --git a/stats/atoms.proto b/stats/atoms.proto
index 8513e37..221c45e 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -1051,6 +1051,8 @@
     extensions 722; // WifiIsUnusableReported wifi_is_unusable_reported
     extensions 723; // WifiApCapabilitiesReported wifi_ap_capabilities_reported
     extensions 735; // SandboxActivityEventOccurred sandbox_activity_event_occurred
+    extensions 752; // StatsSocketLossReported stats_socket_loss_reported
+    extensions 756; // AdServicesMeasurementClickVerification ad_services_measurement_click_verification
     extensions 9999; // Atom9999 atom_9999
     // StatsdStats tracks platform atoms with ids up to 900.
     // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
diff --git a/stats/atoms/adservices/adservices_extension_atoms.proto b/stats/atoms/adservices/adservices_extension_atoms.proto
index 7b2773f..6608d36 100644
--- a/stats/atoms/adservices/adservices_extension_atoms.proto
+++ b/stats/atoms/adservices/adservices_extension_atoms.proto
@@ -75,6 +75,9 @@
 
   optional AdServicesEnrollmentFailed ad_services_enrollment_failed = 714
       [(module) = "adservices", (truncate_timestamp) = true];
+
+  optional AdServicesMeasurementClickVerification ad_services_measurement_click_verification = 756
+      [(module) = "adservices", (truncate_timestamp) = true];
 }
 
 /**
@@ -336,3 +339,31 @@
 
 
 }
+
+/**
+ * Logs for AdServices click verification for measurement API calls.
+ */
+ message AdServicesMeasurementClickVerification {
+  //  The final source type of the source.
+  optional android.adservices.service.measurement.SourceType source_type = 1;
+
+  // If an input event was included with the registration.
+  // The calling app wanted a click event if an input event is present.
+  optional bool input_event_present = 2;
+
+  // If the system click verification passed.
+  optional bool system_click_verification_passed = 3;
+
+  // If the flag is set to enable the system click verification check.
+  optional bool system_click_verification_enabled = 4;
+
+  // The delay (in millis) from when the input event was created to when the API was called.
+  optional int64 input_event_delay_millis = 5;
+
+  // The max difference (in millis) between input event creation and API call for the source to not get downgraded.
+  optional int64 valid_delay_window_millis = 6;
+
+  // The package calling the API.
+  optional string app_package_name = 7; // [(datapol.semantic_type) = ST_SOFTWARE_ID, (contains_pii) = false]
+}
+
diff --git a/stats/atoms/healthfitness/api/api_extension_atoms.proto b/stats/atoms/healthfitness/api/api_extension_atoms.proto
index e4e48d5..17167a5 100644
--- a/stats/atoms/healthfitness/api/api_extension_atoms.proto
+++ b/stats/atoms/healthfitness/api/api_extension_atoms.proto
@@ -57,6 +57,9 @@
 
   // Type of rate limiting being used (If any)
   optional android.healthfitness.api.RateLimit rate_limit = 6;
+
+  // The API caller's foreground status
+  optional android.healthfitness.api.ForegroundState caller_foreground_state = 7;
 }
 
 // Track if users are connecting apps with Health Connect
@@ -141,4 +144,4 @@
   optional android.healthfitness.api.DataType data_type_six = 11
   [(field_restriction_option).health_connect = true];
 
-}
\ No newline at end of file
+}
diff --git a/stats/atoms/statsd/statsd_extension_atoms.proto b/stats/atoms/statsd/statsd_extension_atoms.proto
index 64d8558..8e2327c 100644
--- a/stats/atoms/statsd/statsd_extension_atoms.proto
+++ b/stats/atoms/statsd/statsd_extension_atoms.proto
@@ -28,7 +28,9 @@
     optional TestExtensionAtomReported test_extension_atom_reported =
             660 [(module) = "cts", (module) = "statsdtest"];
     optional TestRestrictedAtomReported test_restricted_atom_reported = 672
-    [(module) = "cts", (android.os.statsd.restriction_category) = RESTRICTION_DIAGNOSTIC];
+    [(module) = "cts", (restriction_category) = RESTRICTION_DIAGNOSTIC];
+    optional StatsSocketLossReported stats_socket_loss_reported =
+            752 [(module) = "statsdsocket", (module) = "statsd"];
 }
 
 message TestExtensionAtomNestedMessage {
@@ -67,3 +69,62 @@
     optional string string_field = 4;
     optional bool boolean_field = 5;
 }
+
+/**
+ * Represents the atom loss info from libstatssocket
+ */
+message StatsSocketLossReported {
+
+    /**
+     * initial set of errors defined based on write() API potential codes
+     * and what is observed via statsdstats LogLosStats.last_error
+     */
+    enum SocketLossError {
+        SOCKET_LOSS_ERROR_UNKNOWN = 0;
+
+        // errno based error codes are negated to not overlap with internal codes
+        // Values are aligned with what is reported by StatsdStatsReport::LogLossStats
+        SOCKET_LOSS_ERROR_ON_WRITE_EDQUOT = -122;
+        SOCKET_LOSS_ERROR_ON_WRITE_EDESTADDRREQ = -89;
+        SOCKET_LOSS_ERROR_ON_WRITE_EPIPE = -32;
+        SOCKET_LOSS_ERROR_ON_WRITE_ENOSPC = -28;
+        SOCKET_LOSS_ERROR_ON_WRITE_EFBIG = -27;
+        SOCKET_LOSS_ERROR_ON_WRITE_EINVAL = -22;
+        SOCKET_LOSS_ERROR_ON_WRITE_ENODEV = -19;
+        SOCKET_LOSS_ERROR_ON_WRITE_EFAULT = -14;
+        SOCKET_LOSS_ERROR_ON_WRITE_EAGAIN = -11; // same as EWOULDBLOCK
+        SOCKET_LOSS_ERROR_ON_WRITE_EBADF = -9;
+        SOCKET_LOSS_ERROR_ON_WRITE_EIO = -5;
+        SOCKET_LOSS_ERROR_ON_WRITE_EINTR = -4;
+        SOCKET_LOSS_ERROR_ON_WRITE_EPERM = -1;
+
+        // internal error codes are positive
+        SOCKET_LOSS_ERROR_QUEUE_OVERFLOW = 1;
+    }
+
+    optional int32 uid = 1 [(is_uid) = true];
+
+    /* denotes timestamp when first socket loss event detected */
+    optional int64 first_timestamp_nanos = 2;
+
+    /* denotes timestamp when last socket loss event detected */
+    optional int64 last_timestamp_nanos = 3;
+
+    /* represents number of times loss info container hits guarrail */
+    optional int32 overflow_count = 4;
+
+    /**
+     * below tuples represent number of times atom loss detected for the pair [error, tag],
+     * where for each pair such as [errors[i], tags[i]] there is a matching counts[i] element
+     *
+     * For ex:
+     * errors [EBUSY,ERROR1,EBUSY,ERROR2]
+     * tags   [    5,     6,    6,     5]
+     * counts [    2,     1,    1,     1]
+     */
+    repeated SocketLossError errors = 5;
+
+    repeated int32 tags = 6;
+
+    repeated int32 counts = 7;
+}
diff --git a/stats/enums/adservices/common/adservices_enums.proto b/stats/enums/adservices/common/adservices_enums.proto
index f343618..aeccd4e 100644
--- a/stats/enums/adservices/common/adservices_enums.proto
+++ b/stats/enums/adservices/common/adservices_enums.proto
@@ -303,7 +303,8 @@
   // Adservices entry point failure.
   AD_SERVICES_ENTRY_POINT_FAILURE = 4014;
 
-  // Used to be MEASUREMENT_FOREGROUND_UNKNOWN_FAILURE but renamed in ag/24158741
+  // Used to be MEASUREMENT_FOREGROUND_UNKNOWN_FAILURE but renamed in
+  // commit 94af8756d2f03ff17924721ee1b7c4a4520377ff
   RESERVED_ERROR_CODE_4015 = 4015;
 }
 
@@ -318,6 +319,8 @@
   AD_ID = 4;
   APP_SET_ID = 5;
   UX = 6;
+  // Use COMMON enum when the error happens in the common code path.
+  COMMON = 7;
 }
 
 /**
@@ -367,4 +370,3 @@
   // Non-European Union user (based on isoCountryInfo).
   ROW = 2;
 }
-
diff --git a/stats/enums/adservices/measurement/enums.proto b/stats/enums/adservices/measurement/enums.proto
index f0fb2e0..7cf12e7 100644
--- a/stats/enums/adservices/measurement/enums.proto
+++ b/stats/enums/adservices/measurement/enums.proto
@@ -79,6 +79,7 @@
   SERIALIZATION_ERROR_REPORT_UPLOAD_FAILURE_TYPE = 6;
   ENCRYPTION_ERROR_REPORT_UPLOAD_FAILURE_TYPE = 7;
   UNSUCCESSFUL_HTTP_RESPONSE_CODE_FAILURE_TYPE = 8;
+  REPORT_NOT_FOUND_FAILURE_TYPE = 9;
 }
 
 /**
diff --git a/stats/enums/healthfitness/api/enums.proto b/stats/enums/healthfitness/api/enums.proto
index ae1aa94..a5e269e 100644
--- a/stats/enums/healthfitness/api/enums.proto
+++ b/stats/enums/healthfitness/api/enums.proto
@@ -114,4 +114,11 @@
   VO2_MAX = 32;
   WEIGHT = 33;
   WHEELCHAIR_PUSHES = 34;
-}
\ No newline at end of file
+}
+
+enum ForegroundState {
+  UNSPECIFIED = 0;
+  FOREGROUND = 1;
+  BACKGROUND = 2;
+}
+