Merge "Add TestableNetworkOfferCallback"
diff --git a/staticlibs/framework/com/android/net/module/util/NetworkStackConstants.java b/staticlibs/framework/com/android/net/module/util/NetworkStackConstants.java
index b7062e7..f7151d7 100644
--- a/staticlibs/framework/com/android/net/module/util/NetworkStackConstants.java
+++ b/staticlibs/framework/com/android/net/module/util/NetworkStackConstants.java
@@ -148,7 +148,10 @@
     public static final int ICMPV6_ND_OPTION_RDNSS = 25;
     public static final int ICMPV6_ND_OPTION_PREF64 = 38;
 
+    public static final int ICMPV6_RS_HEADER_LEN = 8;
     public static final int ICMPV6_RA_HEADER_LEN = 16;
+    public static final int ICMPV6_NS_HEADER_LEN = 24;
+    public static final int ICMPV6_NA_HEADER_LEN = 24;
 
     public static final int NEIGHBOR_ADVERTISEMENT_FLAG_ROUTER    = 1 << 31;
     public static final int NEIGHBOR_ADVERTISEMENT_FLAG_SOLICITED = 1 << 30;
diff --git a/staticlibs/native/bpf_syscall_wrappers/Android.bp b/staticlibs/native/bpf_syscall_wrappers/Android.bp
index fa90655..befb9f8 100644
--- a/staticlibs/native/bpf_syscall_wrappers/Android.bp
+++ b/staticlibs/native/bpf_syscall_wrappers/Android.bp
@@ -35,5 +35,6 @@
     visibility: [
         "//packages/modules/Connectivity/Tethering",
         "//system/bpf/libbpf_android",
+        "//system/memory/lmkd",
     ],
 }
diff --git a/staticlibs/tests/unit/Android.bp b/staticlibs/tests/unit/Android.bp
index 45a89b0..5c5a431 100644
--- a/staticlibs/tests/unit/Android.bp
+++ b/staticlibs/tests/unit/Android.bp
@@ -23,7 +23,8 @@
     ],
     visibility: [
         "//frameworks/base/packages/Tethering/tests/integration",
-        "//packages/modules/Connectivity/Tethering/tests/integration",
+        "//packages/modules/Connectivity/tests:__subpackages__",
+        "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
         "//packages/modules/NetworkStack/tests/integration",
     ]
 }
diff --git a/staticlibs/testutils/devicetests/com/android/testutils/TestHttpServer.kt b/staticlibs/testutils/devicetests/com/android/testutils/TestHttpServer.kt
index 7aae8e3..39ce487 100644
--- a/staticlibs/testutils/devicetests/com/android/testutils/TestHttpServer.kt
+++ b/staticlibs/testutils/devicetests/com/android/testutils/TestHttpServer.kt
@@ -54,12 +54,12 @@
     fun addResponse(
         uri: Uri,
         statusCode: Response.IStatus,
-        locationHeader: String? = null,
+        headers: Map<String, String>? = null,
         content: String = ""
     ) {
         addResponse(Request(uri.path
                 ?: "", Method.GET, uri.query ?: ""),
-                statusCode, locationHeader, content)
+                statusCode, headers, content)
     }
 
     /**
@@ -68,11 +68,13 @@
     fun addResponse(
         request: Request,
         statusCode: Response.IStatus,
-        locationHeader: String? = null,
+        headers: Map<String, String>? = null,
         content: String = ""
     ) {
         val response = newFixedLengthResponse(statusCode, "text/plain", content)
-        locationHeader?.let { response.addHeader("Location", it) }
+        headers?.forEach {
+            (key, value) -> response.addHeader(key, value)
+        }
         responses[request] = response
     }
 
diff --git a/staticlibs/testutils/devicetests/com/android/testutils/TestNetworkTracker.kt b/staticlibs/testutils/devicetests/com/android/testutils/TestNetworkTracker.kt
index 5b97861..d8dd67a 100644
--- a/staticlibs/testutils/devicetests/com/android/testutils/TestNetworkTracker.kt
+++ b/staticlibs/testutils/devicetests/com/android/testutils/TestNetworkTracker.kt
@@ -51,7 +51,7 @@
 class TestNetworkTracker internal constructor(
     val context: Context,
     val iface: TestNetworkInterface,
-    tnm: TestNetworkManager,
+    val tnm: TestNetworkManager,
     setupTimeoutMs: Long
 ) {
     private val cm = context.getSystemService(ConnectivityManager::class.java)
@@ -87,5 +87,6 @@
 
     fun teardown() {
         cm.unregisterNetworkCallback(networkCallback)
+        tnm.teardownTestNetwork(network)
     }
 }
\ No newline at end of file