summaryrefslogtreecommitdiffstats
path: root/core/java/android/net/ConnectivityManager.java
diff options
context:
space:
mode:
authorPaul Jensen <pauljensen@google.com>2015-09-23 11:13:40 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-09-23 11:13:40 +0000
commit96cd7c14b5e4a82727f7b56bbdf6cfafda0f17b6 (patch)
treeb26385559fdf9c69aca9b54d192d3377cf45106a /core/java/android/net/ConnectivityManager.java
parentf8cda08986a5caa14daace69e24c82224ac5a9fc (diff)
parent635f871132449bea7489f6a61276979beeee5591 (diff)
downloadframeworks_base-96cd7c14b5e4a82727f7b56bbdf6cfafda0f17b6.zip
frameworks_base-96cd7c14b5e4a82727f7b56bbdf6cfafda0f17b6.tar.gz
frameworks_base-96cd7c14b5e4a82727f7b56bbdf6cfafda0f17b6.tar.bz2
am 635f8711: am a9e98343: Merge "Fix NOT_RESTRICTED network capability and enforce it." into lmp-dev
* commit '635f871132449bea7489f6a61276979beeee5591': Fix NOT_RESTRICTED network capability and enforce it.
Diffstat (limited to 'core/java/android/net/ConnectivityManager.java')
-rw-r--r--core/java/android/net/ConnectivityManager.java39
1 files changed, 2 insertions, 37 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index eb2df0b..57706da 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -939,41 +939,6 @@ public class ConnectivityManager {
return 1;
}
- /**
- * Removes the NET_CAPABILITY_NOT_RESTRICTED capability from the given
- * NetworkCapabilities object if all the capabilities it provides are
- * typically provided by restricted networks.
- *
- * TODO: consider:
- * - Moving to NetworkCapabilities
- * - Renaming it to guessRestrictedCapability and make it set the
- * restricted capability bit in addition to clearing it.
- * @hide
- */
- public static void maybeMarkCapabilitiesRestricted(NetworkCapabilities nc) {
- for (int capability : nc.getCapabilities()) {
- switch (capability) {
- case NetworkCapabilities.NET_CAPABILITY_CBS:
- case NetworkCapabilities.NET_CAPABILITY_DUN:
- case NetworkCapabilities.NET_CAPABILITY_EIMS:
- case NetworkCapabilities.NET_CAPABILITY_FOTA:
- case NetworkCapabilities.NET_CAPABILITY_IA:
- case NetworkCapabilities.NET_CAPABILITY_IMS:
- case NetworkCapabilities.NET_CAPABILITY_RCS:
- case NetworkCapabilities.NET_CAPABILITY_XCAP:
- case NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED: //there by default
- continue;
- default:
- // At least one capability usually provided by unrestricted
- // networks. Conclude that this network is unrestricted.
- return;
- }
- }
- // All the capabilities are typically provided by restricted networks.
- // Conclude that this network is restricted.
- nc.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED);
- }
-
private NetworkCapabilities networkCapabilitiesForFeature(int networkType, String feature) {
if (networkType == TYPE_MOBILE) {
int cap = -1;
@@ -996,14 +961,14 @@ public class ConnectivityManager {
}
NetworkCapabilities netCap = new NetworkCapabilities();
netCap.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR).addCapability(cap);
- maybeMarkCapabilitiesRestricted(netCap);
+ netCap.maybeMarkCapabilitiesRestricted();
return netCap;
} else if (networkType == TYPE_WIFI) {
if ("p2p".equals(feature)) {
NetworkCapabilities netCap = new NetworkCapabilities();
netCap.addTransportType(NetworkCapabilities.TRANSPORT_WIFI);
netCap.addCapability(NetworkCapabilities.NET_CAPABILITY_WIFI_P2P);
- maybeMarkCapabilitiesRestricted(netCap);
+ netCap.maybeMarkCapabilitiesRestricted();
return netCap;
}
}