use of android.net.NetworkCapabilities in project platform_frameworks_base by android.
the class ConnectivityService method createInternetRequestForTransport.
private NetworkRequest createInternetRequestForTransport(int transportType, NetworkRequest.Type type) {
NetworkCapabilities netCap = new NetworkCapabilities();
netCap.addCapability(NET_CAPABILITY_INTERNET);
netCap.addCapability(NET_CAPABILITY_NOT_RESTRICTED);
if (transportType > -1) {
netCap.addTransportType(transportType);
}
return new NetworkRequest(netCap, TYPE_NONE, nextNetworkRequestId(), type);
}
use of android.net.NetworkCapabilities in project platform_frameworks_base by android.
the class ConnectivityManagerTest method verifyNetworkCapabilities.
static NetworkCapabilities verifyNetworkCapabilities(int legacyType, int transportType, int... capabilities) {
final NetworkCapabilities nc = ConnectivityManager.networkCapabilitiesForType(legacyType);
assertNotNull(nc);
assertTrue(nc.hasTransport(transportType));
for (int capability : capabilities) {
assertTrue(nc.hasCapability(capability));
}
return nc;
}
use of android.net.NetworkCapabilities in project platform_frameworks_base by android.
the class ConnectivityManagerTest method testNetworkCapabilitiesForTypeWifiP2p.
@Test
public void testNetworkCapabilitiesForTypeWifiP2p() {
final NetworkCapabilities nc = verifyNetworkCapabilities(ConnectivityManager.TYPE_WIFI_P2P, TRANSPORT_WIFI, NET_CAPABILITY_NOT_RESTRICTED, NET_CAPABILITY_NOT_VPN, NET_CAPABILITY_TRUSTED, NET_CAPABILITY_WIFI_P2P);
assertFalse(nc.hasCapability(NET_CAPABILITY_INTERNET));
}
use of android.net.NetworkCapabilities in project platform_frameworks_base by android.
the class ConnectivityManagerTest method testNetworkCapabilitiesForTypeMobileMms.
@Test
public void testNetworkCapabilitiesForTypeMobileMms() {
final NetworkCapabilities nc = verifyNetworkCapabilities(ConnectivityManager.TYPE_MOBILE_MMS, TRANSPORT_CELLULAR, NET_CAPABILITY_MMS, NET_CAPABILITY_NOT_VPN, NET_CAPABILITY_TRUSTED);
assertFalse(nc.hasCapability(NET_CAPABILITY_INTERNET));
}
use of android.net.NetworkCapabilities in project platform_frameworks_base by android.
the class LingerMonitorTest method nai.
NetworkAgentInfo nai(int netId, int transport, int networkType, String networkTypeName) {
NetworkInfo info = new NetworkInfo(networkType, 0, networkTypeName, "");
NetworkCapabilities caps = new NetworkCapabilities();
caps.addCapability(0);
caps.addTransportType(transport);
NetworkAgentInfo nai = new NetworkAgentInfo(null, null, new Network(netId), info, null, caps, 50, mCtx, null, mMisc, null, mConnService);
nai.everValidated = true;
return nai;
}
Aggregations