Use Ipv6Utils to build ND packets and options in IpClientIntegrationTest. am: af32144ec2 am: 69661ef02b am: ec454f59e9

Original change: https://android-review.googlesource.com/c/platform/packages/modules/NetworkStack/+/1579843

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I77bf8004c5c05e46c340d3d50b5cd0a154488a6e
diff --git a/Android.bp b/Android.bp
index 997ed97..149245e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -113,7 +113,6 @@
 // integer so if the next SDK release happens to use that integer, we don't need to rename them.
 java_library {
     name: "NetworkStackApi31Shims",
-    enabled: false, // Disabled in mainline-prod
     defaults: ["NetworkStackShimsDefaults"],
     srcs: [
         "apishim/31/**/*.java",
@@ -133,7 +132,6 @@
 // called directly by the networkstack code.
 java_library {
     name: "NetworkStackApiCurrentShims",
-    enabled: false, // Disabled in mainline-prod
     defaults: ["NetworkStackShimsDefaults"],
     static_libs: [
         "NetworkStackShimsCommon",
@@ -199,14 +197,6 @@
     ],
     static_libs: ["NetworkStackApiCurrentShims"],
     manifest: "AndroidManifestBase.xml",
-    enabled: false, // Disabled in mainline-prod
-    visibility: [
-        "//frameworks/base/tests/net/integration",
-        "//packages/modules/Connectivity/Tethering/tests/integration",
-        "//packages/modules/Connectivity/tests/cts/net",
-        "//packages/modules/NetworkStack/tests/unit",
-        "//packages/modules/NetworkStack/tests/integration",
-    ],
 }
 
 android_library {
@@ -218,13 +208,6 @@
     ],
     static_libs: ["NetworkStackApiStableShims"],
     manifest: "AndroidManifestBase.xml",
-    visibility: [
-        "//frameworks/base/tests/net/integration",
-        "//packages/modules/Connectivity/Tethering/tests/integration",
-        "//packages/modules/Connectivity/tests/cts/net",
-        "//packages/modules/NetworkStack/tests/unit",
-        "//packages/modules/NetworkStack/tests/integration",
-    ],
 }
 
 filegroup {
@@ -233,6 +216,7 @@
     visibility: [
         "//packages/modules/NetworkStack/tests/unit",
         "//packages/modules/NetworkStack/tests/integration",
+        "//frameworks/base/packages/Tethering/tests/integration",
         "//packages/modules/Connectivity/Tethering/tests/integration",
     ]
 }
@@ -267,7 +251,6 @@
     // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces
     // the default CaptivePortalLogin.
     required: ["PlatformNetworkPermissionConfig", "PlatformCaptivePortalLogin"],
-    enabled: false, // Disabled in mainline-prod
 }
 
 // Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top
@@ -275,8 +258,7 @@
     name: "NetworkStackNextManifestBase",
     defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"],
     static_libs: ["NetworkStackApiCurrentLib"],
-    manifest: "AndroidManifest.xml",
-    enabled: false, // Disabled in mainline-prod
+    manifest: "AndroidManifest.xml"
 }
 
 // NetworkStack build targeting the current API release, for testing on in-development SDK
@@ -288,7 +270,6 @@
     manifest: "AndroidManifest_Next.xml",
     // The permission configuration *must* be included to ensure security of the device
     required: ["NetworkPermissionConfig"],
-    enabled: false, // Disabled in mainline-prod
 }
 
 // Updatable network stack for finalized API
@@ -303,6 +284,19 @@
     updatable: true,
 }
 
+// Android library to derive test APKs for integration tests
+android_library {
+    name: "TestNetworkStackLib",
+    defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"],
+    static_libs: ["NetworkStackApiStableLib"],
+    manifest: "AndroidManifestBase.xml",
+    visibility: [
+        "//frameworks/base/tests/net/integration",
+        "//cts/tests/tests/net",
+        "//packages/modules/Connectivity/tests/cts/net",
+    ],
+}
+
 cc_library_shared {
     name: "libnetworkstackutilsjni",
     srcs: [
diff --git a/AndroidManifest_Next.xml b/AndroidManifest_Next.xml
index 02fcb64..c8fdcac 100644
--- a/AndroidManifest_Next.xml
+++ b/AndroidManifest_Next.xml
@@ -17,6 +17,6 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.android.networkstack"
           android:sharedUserId="android.uid.networkstack"
-          android:versionCode="300000000"
-          android:versionName="R-next">
+          android:versionCode="310000000"
+          android:versionName="S-next">
 </manifest>
diff --git a/TEST_MAPPING b/TEST_MAPPING
index a2ed850..1b6ae19 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -20,7 +20,8 @@
     // We must specify at least one module here or the tests won't run. Use the same set as CTS
     // so in theory the infra would not need to reinstall/reboot devices to run both.
     {
-      "name": "NetworkStackTests[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex]"
+      // TODO: add back tethering when it is updatable in this branch
+      "name": "NetworkStackTests[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex]"
     }
   ],
   "imports": [
diff --git a/apishim/29/com/android/networkstack/apishim/api29/ConstantsShim.java b/apishim/29/com/android/networkstack/apishim/api29/ConstantsShim.java
index 0b000a9..79b206f 100644
--- a/apishim/29/com/android/networkstack/apishim/api29/ConstantsShim.java
+++ b/apishim/29/com/android/networkstack/apishim/api29/ConstantsShim.java
@@ -38,8 +38,4 @@
     // Constants defined in android.net.CaptivePortalData.
     public static final int CAPTIVE_PORTAL_DATA_SOURCE_OTHER = 0;
     public static final int CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT = 1;
-
-    // Constants defined in android.net.NetworkCapabilities.
-    public static final int NET_CAPABILITY_NOT_VCN_MANAGED = 28;
-
 }
diff --git a/apishim/30/com/android/networkstack/apishim/api30/ConstantsShim.java b/apishim/30/com/android/networkstack/apishim/api30/ConstantsShim.java
index d5012f8..27fd745 100644
--- a/apishim/30/com/android/networkstack/apishim/api30/ConstantsShim.java
+++ b/apishim/30/com/android/networkstack/apishim/api30/ConstantsShim.java
@@ -38,8 +38,8 @@
     public static final int DETECTION_METHOD_TCP_METRICS =
             DataStallReport.DETECTION_METHOD_TCP_METRICS;
 
-    // Constants defined in android.net.NetworkCapabilities.
-    public static final int NET_CAPABILITY_NOT_VCN_MANAGED = 28;
+    /**
+     * @see android.net.NetworkCapabilities
+     */
     public static final int TRANSPORT_TEST = 7;
-
 }
diff --git a/tests/integration/Android.bp b/tests/integration/Android.bp
index 2cffc3d..875b089 100644
--- a/tests/integration/Android.bp
+++ b/tests/integration/Android.bp
@@ -87,7 +87,6 @@
     certificate: "networkstack",
     platform_apis: true,
     test_suites: ["device-tests"],
-    enabled: false, // Disabled in mainline-prod
 }
 
 // The static lib needs to be jarjared by each module so they do not conflict with each other
diff --git a/tests/unit/Android.bp b/tests/unit/Android.bp
index e308b96..e673c5a 100644
--- a/tests/unit/Android.bp
+++ b/tests/unit/Android.bp
@@ -54,11 +54,13 @@
     min_sdk_version: "29",
     srcs: [], // TODO: tests that only apply to the current, non-stable API can be added here
     test_suites: ["general-tests"],
-    test_mainline_modules: ["CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex"],
+    test_mainline_modules: [
+        "CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex",
+        "CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex"
+    ],
     defaults: ["NetworkStackTestsDefaults"],
     static_libs: ["NetworkStackApiCurrentLib"],
     compile_multilib: "both", // Workaround for b/147785146 for mainline-presubmit
-    enabled: false, // Disabled in mainline-prod
 }
 
 // Library containing the unit tests. This is used by the coverage test target to pull in the
@@ -81,7 +83,10 @@
     min_sdk_version: "29",
     target_sdk_version: "30",
     test_suites: ["general-tests", "mts"],
-    test_mainline_modules: ["CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex"],
+    test_mainline_modules: [
+        "CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex",
+        "CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex"
+    ],
     defaults: ["NetworkStackTestsDefaults"],
     static_libs: ["NetworkStackApiStableLib"],
     compile_multilib: "both",