Merge "Add Test Network and Transport types"

This commit is contained in:
Benedict Wong
2019-02-14 18:37:04 +00:00
committed by Gerrit Code Review
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"
};
/**