diff options
| author | Robert Greenwalt <rgreenwalt@google.com> | 2014-06-08 16:42:59 -0700 |
|---|---|---|
| committer | Robert Greenwalt <rgreenwalt@google.com> | 2014-06-11 23:29:39 +0000 |
| commit | 7569f1811f6061b2a6605c69bca1bb7af72ae1a0 (patch) | |
| tree | b766680f9f3fbce48a406ff49588ec494362d754 /core/java/android/net/ConnectivityManager.java | |
| parent | 52769be3ea1fd005ea66b7b08888b3009ac0dadf (diff) | |
| download | frameworks_base-7569f1811f6061b2a6605c69bca1bb7af72ae1a0.zip frameworks_base-7569f1811f6061b2a6605c69bca1bb7af72ae1a0.tar.gz frameworks_base-7569f1811f6061b2a6605c69bca1bb7af72ae1a0.tar.bz2 | |
Make NetworkCapabilities publicly immutable.
Applying API council comments.
bug: 15142362
(cherry picked from commit Ie0bde68b72656a676d90c0343b9756fe9268d8d6)
Change-Id: Ie0bde68b72656a676d90c0343b9756fe9268d8d6
Diffstat (limited to 'core/java/android/net/ConnectivityManager.java')
| -rw-r--r-- | core/java/android/net/ConnectivityManager.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 60e76e0..65d4726 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -429,6 +429,11 @@ public class ConnectivityManager { */ public final static int INVALID_NET_ID = 0; + /** + * @hide + */ + public final static int REQUEST_ID_UNSET = 0; + private final IConnectivityManager mService; private final String mPackageName; @@ -883,8 +888,8 @@ public class ConnectivityManager { * @hide */ public static void maybeMarkCapabilitiesRestricted(NetworkCapabilities nc) { - for (Integer capability : nc.getNetworkCapabilities()) { - switch (capability.intValue()) { + for (int capability : nc.getCapabilities()) { + switch (capability) { case NetworkCapabilities.NET_CAPABILITY_CBS: case NetworkCapabilities.NET_CAPABILITY_DUN: case NetworkCapabilities.NET_CAPABILITY_EIMS: @@ -902,7 +907,7 @@ public class ConnectivityManager { } // All the capabilities are typically provided by restricted networks. // Conclude that this network is restricted. - nc.removeNetworkCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED); + nc.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED); } private NetworkCapabilities networkCapabilitiesForFeature(int networkType, String feature) { @@ -926,15 +931,14 @@ public class ConnectivityManager { return null; } NetworkCapabilities netCap = new NetworkCapabilities(); - netCap.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR); - netCap.addNetworkCapability(cap); + netCap.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR).addCapability(cap); maybeMarkCapabilitiesRestricted(netCap); return netCap; } else if (networkType == TYPE_WIFI) { if ("p2p".equals(feature)) { NetworkCapabilities netCap = new NetworkCapabilities(); netCap.addTransportType(NetworkCapabilities.TRANSPORT_WIFI); - netCap.addNetworkCapability(NetworkCapabilities.NET_CAPABILITY_WIFI_P2P); + netCap.addCapability(NetworkCapabilities.NET_CAPABILITY_WIFI_P2P); maybeMarkCapabilitiesRestricted(netCap); return netCap; } |
