Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89ce5e3c authored by Benedict Wong's avatar Benedict Wong
Browse files

Add Test Network and Transport types

This change adds new network types for testing purposes, signifying a
network with an extremely limited feature set.

Bug: 72950854
Test: Compiles, CTS tests relying on this work correctly.
Change-Id: I06cade6044afd12e0b69ed3c2f160f27f85d43d0
parent 8a996612
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -668,6 +668,7 @@ package android.net {
    method public int[] getCapabilities();
    method public int[] getTransportTypes();
    method public boolean satisfiedByNetworkCapabilities(android.net.NetworkCapabilities);
    field public static final int TRANSPORT_TEST = 7; // 0x7
  }

  public class NetworkStack {
+11 −2
Original line number Diff line number Diff line
@@ -678,11 +678,20 @@ public class ConnectivityManager {
    @Deprecated
    public static final int TYPE_VPN = 17;

    /**
     * A network that is exclusively meant to be used for testing
     *
     * @deprecated Use {@link NetworkCapabilities} instead.
     * @hide
     */
    @Deprecated
    public static final int TYPE_TEST = 18; // TODO: Remove this once NetworkTypes are unused.

    /** {@hide} */
    public static final int MAX_RADIO_TYPE   = TYPE_VPN;
    public static final int MAX_RADIO_TYPE = TYPE_TEST;

    /** {@hide} */
    public static final int MAX_NETWORK_TYPE = TYPE_VPN;
    public static final int MAX_NETWORK_TYPE = TYPE_TEST;

    private static final int MIN_NETWORK_TYPE = TYPE_MOBILE;

+12 −2
Original line number Diff line number Diff line
@@ -597,6 +597,7 @@ public final class NetworkCapabilities implements Parcelable {
            TRANSPORT_VPN,
            TRANSPORT_WIFI_AWARE,
            TRANSPORT_LOWPAN,
            TRANSPORT_TEST,
    })
    public @interface Transport { }

@@ -635,10 +636,18 @@ public final class NetworkCapabilities implements Parcelable {
     */
    public static final int TRANSPORT_LOWPAN = 6;

    /**
     * Indicates this network uses a Test-only virtual interface as a transport.
     *
     * @hide
     */
    @TestApi
    public static final int TRANSPORT_TEST = 7;

    /** @hide */
    public static final int MIN_TRANSPORT = TRANSPORT_CELLULAR;
    /** @hide */
    public static final int MAX_TRANSPORT = TRANSPORT_LOWPAN;
    public static final int MAX_TRANSPORT = TRANSPORT_TEST;

    /** @hide */
    public static boolean isValidTransport(@Transport int transportType) {
@@ -652,7 +661,8 @@ public final class NetworkCapabilities implements Parcelable {
        "ETHERNET",
        "VPN",
        "WIFI_AWARE",
        "LOWPAN"
        "LOWPAN",
        "TEST"
    };

    /**