IP connectivity metrics: update ipconnectivity.proto

This patch adds several new fields to ipconnectivity.proto for
improving APF metrics, connect metrics, and link_layer inference.

Test: build, flashed, ran $ adb shell dumpsys connmetrics list proto
      updated metrics unit tests depending on proto schema
Bug: 34901696
Change-Id: I6f68e16f583a6b407f33f8a500133e100f3453c7
diff --git a/tests/net/java/com/android/server/connectivity/IpConnectivityEventBuilderTest.java b/tests/net/java/com/android/server/connectivity/IpConnectivityEventBuilderTest.java
index 415911e..11105d6 100644
--- a/tests/net/java/com/android/server/connectivity/IpConnectivityEventBuilderTest.java
+++ b/tests/net/java/com/android/server/connectivity/IpConnectivityEventBuilderTest.java
@@ -43,6 +43,7 @@
 import java.util.Arrays;
 import junit.framework.TestCase;
 
+// TODO: instead of comparing textpb to textpb, parse textpb and compare proto to proto.
 public class IpConnectivityEventBuilderTest extends TestCase {
 
     @SmallTest
@@ -58,8 +59,11 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  default_network_event <",
                 "    network_id <",
                 "      network_id: 102",
@@ -89,8 +93,11 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  dhcp_event <",
                 "    duration_ms: 192",
                 "    if_name: \"wlan0\"",
@@ -112,8 +119,11 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  dhcp_event <",
                 "    duration_ms: 0",
                 "    if_name: \"wlan0\"",
@@ -137,8 +147,11 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  dns_lookup_batch <",
                 "    event_types: 1",
                 "    event_types: 1",
@@ -185,8 +198,11 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  ip_provisioning_event <",
                 "    event_type: 1",
                 "    if_name: \"wlan0\"",
@@ -208,8 +224,11 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  ip_reachability_event <",
                 "    event_type: 512",
                 "    if_name: \"wlan0\"",
@@ -231,8 +250,11 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  network_event <",
                 "    event_type: 5",
                 "    latency_ms: 20410",
@@ -258,8 +280,11 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  validation_probe_event <",
                 "    latency_ms: 40730",
                 "    network_id <",
@@ -287,11 +312,15 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  apf_program_event <",
                 "    current_ras: 9",
                 "    drop_multicast: true",
+                "    effective_lifetime: 0",
                 "    filtered_ras: 7",
                 "    has_ipv4_addr: true",
                 "    lifetime: 200",
@@ -319,8 +348,11 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  apf_statistics <",
                 "    dropped_ras: 2",
                 "    duration_ms: 45000",
@@ -328,6 +360,8 @@
                 "    max_program_size: 2048",
                 "    parse_errors: 2",
                 "    program_updates: 4",
+                "    program_updates_all: 0",
+                "    program_updates_allowing_multicast: 0",
                 "    received_ras: 10",
                 "    zero_lifetime_ras: 1",
                 "  >",
@@ -351,8 +385,11 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 1",
+                "  transports: 0",
                 "  ra_event <",
                 "    dnssl_lifetime: -1",
                 "    prefix_preferred_lifetime: 300",
diff --git a/tests/net/java/com/android/server/connectivity/IpConnectivityMetricsTest.java b/tests/net/java/com/android/server/connectivity/IpConnectivityMetricsTest.java
index f56f3f8..1f7c5f4 100644
--- a/tests/net/java/com/android/server/connectivity/IpConnectivityMetricsTest.java
+++ b/tests/net/java/com/android/server/connectivity/IpConnectivityMetricsTest.java
@@ -139,6 +139,7 @@
 
     @SmallTest
     public void testEndToEndLogging() {
+        // TODO: instead of comparing textpb to textpb, parse textpb and compare proto to proto.
         IpConnectivityLog logger = new IpConnectivityLog(mService.impl);
 
         Parcelable[] events = {
@@ -158,16 +159,22 @@
         String want = joinLines(
                 "dropped_events: 0",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 100",
+                "  transports: 0",
                 "  ip_reachability_event <",
                 "    event_type: 512",
                 "    if_name: \"wlan0\"",
                 "  >",
                 ">",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 200",
+                "  transports: 0",
                 "  dhcp_event <",
                 "    duration_ms: 192",
                 "    if_name: \"wlan0\"",
@@ -175,8 +182,11 @@
                 "  >",
                 ">",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 300",
+                "  transports: 0",
                 "  default_network_event <",
                 "    network_id <",
                 "      network_id: 102",
@@ -191,8 +201,11 @@
                 "  >",
                 ">",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 400",
+                "  transports: 0",
                 "  ip_provisioning_event <",
                 "    event_type: 1",
                 "    if_name: \"wlan0\"",
@@ -200,8 +213,11 @@
                 "  >",
                 ">",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 500",
+                "  transports: 0",
                 "  validation_probe_event <",
                 "    latency_ms: 40730",
                 "    network_id <",
@@ -212,8 +228,11 @@
                 "  >",
                 ">",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 600",
+                "  transports: 0",
                 "  apf_statistics <",
                 "    dropped_ras: 2",
                 "    duration_ms: 45000",
@@ -221,13 +240,18 @@
                 "    max_program_size: 2048",
                 "    parse_errors: 2",
                 "    program_updates: 4",
+                "    program_updates_all: 0",
+                "    program_updates_allowing_multicast: 0",
                 "    received_ras: 10",
                 "    zero_lifetime_ras: 1",
                 "  >",
                 ">",
                 "events <",
+                "  if_name: \"\"",
                 "  link_layer: 0",
+                "  network_id: 0",
                 "  time_ms: 700",
+                "  transports: 0",
                 "  ra_event <",
                 "    dnssl_lifetime: -1",
                 "    prefix_preferred_lifetime: 300",
diff --git a/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java b/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java
index cfd5598..637eaa3 100644
--- a/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java
+++ b/tests/net/java/com/android/server/connectivity/NetdEventListenerServiceTest.java
@@ -213,9 +213,13 @@
 
         IpConnectivityEvent got = events.get(0);
         String want = String.join("\n",
+                "if_name: \"\"",
                 "link_layer: 0",
+                "network_id: 0",
                 "time_ms: 0",
+                "transports: 0",
                 "connect_statistics <",
+                "  connect_blocking_count: 0",
                 "  connect_count: 12",
                 "  errnos_counters <",
                 "    key: 1",