Add atom for NetworkDnsHandshakeReported

bug: b/195274906
Test: Tested build.
Change-Id: I5a420fc54acc6917f4f00ab444aee249c15fd0e0
diff --git a/stats/atoms.proto b/stats/atoms.proto
index 02b8e1e..564617d 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -584,7 +584,7 @@
         AppCompatStateChanged app_compat_state_changed = 386 [(module) = "framework"];
         SizeCompatRestartButtonEventReported size_compat_restart_button_event_reported = 387 [(module) = "framework"];
         SplitscreenUIChanged splitscreen_ui_changed = 388 [(module) = "framework"];
-
+        NetworkDnsHandshakeReported network_dns_handshake_reported = 389 [(module) = "resolv"];
         // StatsdStats tracks platform atoms with ids upto 500.
         // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
     }
@@ -8345,6 +8345,52 @@
 }
 
 /**
+ * The NetworkDnsHandshakeReported message describes a DoT or DoH handshake operation along with
+ * its result, cause, network latency, TLS version, etc.
+ *
+ */
+message NetworkDnsHandshakeReported {
+  optional android.stats.dnsresolver.Protocol protocol = 1;
+
+  optional android.stats.dnsresolver.HandshakeResult result = 2;
+
+  optional android.stats.dnsresolver.HandshakeCause cause = 3;
+
+  optional android.stats.dnsresolver.NetworkType network_type = 4;
+
+  optional android.stats.dnsresolver.PrivateDnsModes private_dns_mode = 5;
+
+  // The latency in microseconds of the entire handshake operation.
+  optional int32 latency_micros = 6;
+
+  // Sent packets in bytes.
+  optional int32 bytes_sent = 7;
+
+  // Received packets in bytes.
+  optional int32 bytes_received = 8;
+
+  // Number of round-trips.
+  optional int32 round_trips = 9;
+
+  // True if TLS session cache hit.
+  optional bool tls_session_cache_hit = 10;
+
+  // 2 = TLS 1.2, 3 = TLS 1.3
+  optional int32 tls_version = 11;
+
+  // True if the handshake requires verifying the private DNS provider hostname.
+  optional bool hostname_verification = 12;
+
+  // Only present when protocol = PROTO_DOH.
+  optional int32 quic_version = 13;
+
+  optional int32 server_index = 14;
+
+  // The sampling-rate of this event is 1/sampling_rate_denom.
+  optional int32 sampling_rate_denom = 15;
+}
+
+/**
  * logs the CapportApiData info
  * Logged from:
  * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
diff --git a/stats/enums/stats/dnsresolver/dns_resolver.proto b/stats/enums/stats/dnsresolver/dns_resolver.proto
index 080426d..1eef2cd 100644
--- a/stats/enums/stats/dnsresolver/dns_resolver.proto
+++ b/stats/enums/stats/dnsresolver/dns_resolver.proto
@@ -375,3 +375,18 @@
 message DnsQueryEvents {
     repeated DnsQueryEvent dns_query_event = 1;
 }
+
+enum HandshakeResult {
+    HR_UNKNOWN = 0;
+    HR_SUCCESS = 1;
+    HR_TIMEOUT = 2;
+    HR_TLS_FAIL = 3;
+    HR_SERVER_UNREACHABLE = 4;
+}
+
+enum HandshakeCause {
+    HC_UNKNOWN = 0;
+    HC_SERVER_PROBE = 1;
+    HC_RECONNECT_AFTER_IDLE = 2;
+    HC_RETRY_AFTER_ERROR = 3;
+}