diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2015-04-27 11:31:55 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2015-05-01 12:36:29 +0900 |
commit | f7058f5d1d9df1c5c49b06d8693a49e36ce358ca (patch) | |
tree | 15aa3c7ef1679559093727b245ef8512275ab2e2 | |
parent | 2ea89e59c35ba49eb0b8a8e6583741539357e71f (diff) | |
download | frameworks_base-f7058f5d1d9df1c5c49b06d8693a49e36ce358ca.zip frameworks_base-f7058f5d1d9df1c5c49b06d8693a49e36ce358ca.tar.gz frameworks_base-f7058f5d1d9df1c5c49b06d8693a49e36ce358ca.tar.bz2 |
Add a hidden method to clear NetworkCapabilities.
Change-Id: Icf7d67e24a09113340e9bff2c72526760914ef48
-rw-r--r-- | core/java/android/net/NetworkCapabilities.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java index 8c8bfab..ab70485 100644 --- a/core/java/android/net/NetworkCapabilities.java +++ b/core/java/android/net/NetworkCapabilities.java @@ -37,6 +37,11 @@ public final class NetworkCapabilities implements Parcelable { * @hide */ public NetworkCapabilities() { + clearAll(); + mNetworkCapabilities = + (1 << NET_CAPABILITY_NOT_RESTRICTED) | + (1 << NET_CAPABILITY_TRUSTED) | + (1 << NET_CAPABILITY_NOT_VPN); } public NetworkCapabilities(NetworkCapabilities nc) { @@ -50,11 +55,21 @@ public final class NetworkCapabilities implements Parcelable { } /** + * Completely clears the contents of this object, removing even the capabilities that are set + * by default when the object is constructed. + * @hide + */ + public void clearAll() { + mNetworkCapabilities = mTransportTypes = 0; + mLinkUpBandwidthKbps = mLinkDownBandwidthKbps = 0; + mNetworkSpecifier = null; + } + + /** * Represents the network's capabilities. If any are specified they will be satisfied * by any Network that matches all of them. */ - private long mNetworkCapabilities = (1 << NET_CAPABILITY_NOT_RESTRICTED) | - (1 << NET_CAPABILITY_TRUSTED) | (1 << NET_CAPABILITY_NOT_VPN); + private long mNetworkCapabilities; /** * Indicates this is a network that has the ability to reach the |