Revert "[VCN07.1] Add test for bypassing VCN for non-internet re..."

Revert "[VCN07] Bypass VCN for non-internet app accessible cellu..."

Revert submission 1579872-vcn07

Reason for revert: Possible culprit for b/179768816, broken ConnectivityControllerTest
Reverted Changes:
Id09b19c13:Address comments on aosp/1550755
I245bd69e0:[VCN07.1] Add test for bypassing VCN for non-inter...
I9936894b9:[VCN07] Bypass VCN for non-internet app accessible...

Change-Id: I7902a221c8597427e48d3e32fa5668b9c1a47420
diff --git a/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt b/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt
index 41537a9..122c27f 100644
--- a/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt
+++ b/tests/cts/net/src/android/net/cts/NetworkAgentTest.kt
@@ -35,7 +35,6 @@
 import android.net.NetworkCapabilities.NET_CAPABILITY_NOT_METERED
 import android.net.NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING
 import android.net.NetworkCapabilities.NET_CAPABILITY_NOT_SUSPENDED
-import android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VCN_MANAGED
 import android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VPN
 import android.net.NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED
 import android.net.NetworkCapabilities.NET_CAPABILITY_TRUSTED
@@ -324,7 +323,6 @@
             addCapability(NET_CAPABILITY_NOT_SUSPENDED)
             addCapability(NET_CAPABILITY_NOT_ROAMING)
             addCapability(NET_CAPABILITY_NOT_VPN)
-            addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
             if (null != name) {
                 setNetworkSpecifier(StringNetworkSpecifier(name))
             }
@@ -561,7 +559,6 @@
             addTransportType(TRANSPORT_TEST)
             addTransportType(TRANSPORT_VPN)
             removeCapability(NET_CAPABILITY_NOT_VPN)
-            addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
             setTransportInfo(VpnTransportInfo(VpnManager.TYPE_VPN_SERVICE))
         }
         val defaultNetwork = mCM.activeNetwork
diff --git a/tests/cts/net/src/android/net/cts/NetworkRequestTest.java b/tests/cts/net/src/android/net/cts/NetworkRequestTest.java
index decc706..d118c8a 100644
--- a/tests/cts/net/src/android/net/cts/NetworkRequestTest.java
+++ b/tests/cts/net/src/android/net/cts/NetworkRequestTest.java
@@ -16,13 +16,8 @@
 
 package android.net.cts;
 
-import static android.net.NetworkCapabilities.NET_CAPABILITY_DUN;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_FOTA;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_MMS;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VCN_MANAGED;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_SUPL;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED;
 import static android.net.NetworkCapabilities.TRANSPORT_BLUETOOTH;
 import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
@@ -163,32 +158,23 @@
         final LocalNetworkSpecifier specifier1 = new LocalNetworkSpecifier(1234 /* id */);
         final LocalNetworkSpecifier specifier2 = new LocalNetworkSpecifier(5678 /* id */);
 
-        // Some requests are adding NOT_VCN_MANAGED capability automatically. Add it to the
-        // capabilities below for bypassing the check.
         final NetworkCapabilities capCellularMmsInternet = new NetworkCapabilities()
                 .addTransportType(TRANSPORT_CELLULAR)
                 .addCapability(NET_CAPABILITY_MMS)
-                .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
                 .addCapability(NET_CAPABILITY_INTERNET);
         final NetworkCapabilities capCellularVpnMmsInternet =
-                new NetworkCapabilities(capCellularMmsInternet).addTransportType(TRANSPORT_VPN)
-                        .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED);
+                new NetworkCapabilities(capCellularMmsInternet).addTransportType(TRANSPORT_VPN);
         final NetworkCapabilities capCellularMmsInternetSpecifier1 =
-                new NetworkCapabilities(capCellularMmsInternet).setNetworkSpecifier(specifier1)
-                        .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED);
+                new NetworkCapabilities(capCellularMmsInternet).setNetworkSpecifier(specifier1);
         final NetworkCapabilities capVpnInternetSpecifier1 = new NetworkCapabilities()
                 .addCapability(NET_CAPABILITY_INTERNET)
-                .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
                 .addTransportType(TRANSPORT_VPN)
                 .setNetworkSpecifier(specifier1);
         final NetworkCapabilities capCellularMmsInternetMatchallspecifier =
                 new NetworkCapabilities(capCellularMmsInternet)
-                        .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
-                        .setNetworkSpecifier(new MatchAllNetworkSpecifier());
+                    .setNetworkSpecifier(new MatchAllNetworkSpecifier());
         final NetworkCapabilities capCellularMmsInternetSpecifier2 =
-                new NetworkCapabilities(capCellularMmsInternet)
-                        .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
-                        .setNetworkSpecifier(specifier2);
+                new NetworkCapabilities(capCellularMmsInternet).setNetworkSpecifier(specifier2);
 
         final NetworkRequest requestCellularInternetSpecifier1 = new NetworkRequest.Builder()
                 .addTransportType(TRANSPORT_CELLULAR)
@@ -253,8 +239,7 @@
 
         final NetworkCapabilities capCellInternetBWSpecifier1Signal =
                 new NetworkCapabilities.Builder(capCellInternetBWSpecifier1)
-                        .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
-                        .setSignalStrength(-123).build();
+                    .setSignalStrength(-123).build();
         assertCorrectlySatisfies(true, requestCombination,
                 capCellInternetBWSpecifier1Signal);
 
@@ -288,73 +273,4 @@
         assertEquals(Process.INVALID_UID, new NetworkRequest.Builder()
                 .clearCapabilities().build().getRequestorUid());
     }
-
-    @Test @IgnoreUpTo(Build.VERSION_CODES.R)
-    public void testBypassingVcnForNonInternetRequest() {
-        // Make an empty request. Verify the NOT_VCN_MANAGED is added.
-        final NetworkRequest emptyRequest = new NetworkRequest.Builder().build();
-        assertTrue(emptyRequest.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-
-        // Make a request explicitly add NOT_VCN_MANAGED. Verify the NOT_VCN_MANAGED is preserved.
-        final NetworkRequest mmsAddNotVcnRequest = new NetworkRequest.Builder()
-                .addCapability(NET_CAPABILITY_MMS)
-                .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
-                .build();
-        assertTrue(mmsAddNotVcnRequest.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-
-        // Similar to above, but the opposite order.
-        final NetworkRequest mmsAddNotVcnRequest2 = new NetworkRequest.Builder()
-                .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
-                .addCapability(NET_CAPABILITY_MMS)
-                .build();
-        assertTrue(mmsAddNotVcnRequest2.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-
-        // Make a request explicitly remove NOT_VCN_MANAGED. Verify the NOT_VCN_MANAGED is removed.
-        final NetworkRequest removeNotVcnRequest = new NetworkRequest.Builder()
-                .removeCapability(NET_CAPABILITY_NOT_VCN_MANAGED).build();
-        assertFalse(removeNotVcnRequest.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-
-        // Make a request add some capability inside VCN supported capabilities.
-        // Verify the NOT_VCN_MANAGED is added.
-        final NetworkRequest notRoamRequest = new NetworkRequest.Builder()
-                .addCapability(NET_CAPABILITY_NOT_ROAMING).build();
-        assertTrue(notRoamRequest.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-
-        // Make a internet request. Verify the NOT_VCN_MANAGED is added.
-        final NetworkRequest internetRequest = new NetworkRequest.Builder()
-                .addCapability(NET_CAPABILITY_INTERNET).build();
-        assertTrue(internetRequest.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-
-        // Make a internet request which explicitly removed NOT_VCN_MANAGED.
-        // Verify the NOT_VCN_MANAGED is removed.
-        final NetworkRequest internetRemoveNotVcnRequest = new NetworkRequest.Builder()
-                .addCapability(NET_CAPABILITY_INTERNET)
-                .removeCapability(NET_CAPABILITY_NOT_VCN_MANAGED).build();
-        assertFalse(internetRemoveNotVcnRequest.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-
-        // Make a normal MMS request. Verify the request could bypass VCN.
-        final NetworkRequest mmsRequest =
-                new NetworkRequest.Builder().addCapability(NET_CAPABILITY_MMS).build();
-        assertFalse(mmsRequest.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-
-        // Make a SUPL request along with internet. Verify NOT_VCN_MANAGED is not added since
-        // SUPL is not in the supported list.
-        final NetworkRequest suplWithInternetRequest = new NetworkRequest.Builder()
-                        .addCapability(NET_CAPABILITY_SUPL)
-                        .addCapability(NET_CAPABILITY_INTERNET).build();
-        assertFalse(suplWithInternetRequest.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-
-        // Make a FOTA request with explicitly add NOT_VCN_MANAGED capability. Verify
-        // NOT_VCN_MANAGED is preserved.
-        final NetworkRequest fotaRequest = new NetworkRequest.Builder()
-                        .addCapability(NET_CAPABILITY_FOTA)
-                        .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED).build();
-        assertTrue(fotaRequest.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-
-        // Make a DUN request, which is in {@code VCN_SUPPORTED_CAPABILITIES}.
-        // Verify NOT_VCN_MANAGED is preserved.
-        final NetworkRequest dunRequest = new NetworkRequest.Builder()
-                .addCapability(NET_CAPABILITY_DUN).build();
-        assertTrue(dunRequest.hasCapability(NET_CAPABILITY_NOT_VCN_MANAGED));
-    }
 }