Add IpReachabilityMonitor metrics.

Bug: 162944199
Test: atest NetworkStackTests
Change-Id: I7479fd5bc2b8150a503bdabf627cf11719e58f3b
diff --git a/stats/atoms.proto b/stats/atoms.proto
index 7274418..64504f9 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -570,6 +570,8 @@
         AppSearchInitializeStatsReported app_search_initialize_stats_reported = 371 [(module) = "framework"];
         AppSearchQueryStatsReported app_search_query_stats_reported = 372 [(module) = "framework"];
         AppProcessDied app_process_died = 373 [(module) = "framework"];
+        NetworkIpReachabilityMonitorReported network_ip_reachability_monitor_reported =
+            374 [(module) = "network_stack"];
 
         // StatsdStats tracks platform atoms with ids upto 500.
         // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
@@ -8075,6 +8077,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:
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 {
 
 }