Add IpReachabilityMonitor metrics proto.

Bug: 162944199
Test: atest NetworkStackTests
Merged-In: I7479fd5bc2b8150a503bdabf627cf11719e58f3b
Change-Id: I455d8c1fe175946eb72591940a5a55cb21f5819e
diff --git a/stats/atoms.proto b/stats/atoms.proto
index efb3837..b12aff9 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -512,6 +512,9 @@
         Keystore2CrashEventReported keystore2_crash_event_reported = 362;
         RkpErrorReported rkp_error_reported = 363;
         OdrefreshReported odrefresh_reported = 366 [(module) = "art"];
+        NetworkIpReachabilityMonitorReported network_ip_reachability_monitor_reported =
+            367 [(module) = "network_stack"];
+
         // StatsdStats tracks platform atoms with ids upto 500.
         // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
     }
@@ -7305,6 +7308,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 {
 
 }