diff options
| author | Paul Jensen <pauljensen@google.com> | 2015-09-23 10:58:57 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-09-23 10:58:57 +0000 |
| commit | a9e98343146244b71e236d82c95a8d0fa30a41c1 (patch) | |
| tree | 379be282322e31fbaa50bb47c58354063925c2c2 /core/java/android/net/ConnectivityManager.java | |
| parent | 7b5bf993e4cc9f333a9adb3a00672c668a0f3fdb (diff) | |
| parent | a12044215b1148826ea9a88d5d1102378b13922f (diff) | |
| download | frameworks_base-a9e98343146244b71e236d82c95a8d0fa30a41c1.zip frameworks_base-a9e98343146244b71e236d82c95a8d0fa30a41c1.tar.gz frameworks_base-a9e98343146244b71e236d82c95a8d0fa30a41c1.tar.bz2 | |
Merge "Fix NOT_RESTRICTED network capability and enforce it." into lmp-dev
Diffstat (limited to 'core/java/android/net/ConnectivityManager.java')
| -rw-r--r-- | core/java/android/net/ConnectivityManager.java | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 9194ca8..7cde005 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -941,41 +941,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; @@ -998,14 +963,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; } } |
