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
This commit is contained in:
Benedict Wong
2018-11-14 17:40:55 -08:00
parent 641c68cfdb
commit 8015602ac9
2 changed files with 24 additions and 5 deletions

View File

@@ -678,11 +678,20 @@ public class ConnectivityManager {
@Deprecated
public static final int TYPE_VPN = 17;
/** {@hide} */
public static final int MAX_RADIO_TYPE = TYPE_VPN;
/**
* 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_NETWORK_TYPE = TYPE_VPN;
public static final int MAX_RADIO_TYPE = TYPE_TEST;
/** {@hide} */
public static final int MAX_NETWORK_TYPE = TYPE_TEST;
private static final int MIN_NETWORK_TYPE = TYPE_MOBILE;

View File

@@ -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"
};
/**