summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2015-08-19 20:48:31 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-08-19 20:48:31 +0000
commit11e84bde9e98cb4b777a67208989d259883e9375 (patch)
tree17955cf7284fc4762f792c4be442698d37c6febd /core
parente3de6c5df5a94e627c5ee0f188cbb066233a3dd0 (diff)
parentaae613d96134245af7c55976731a49fa59e77470 (diff)
downloadframeworks_base-11e84bde9e98cb4b777a67208989d259883e9375.zip
frameworks_base-11e84bde9e98cb4b777a67208989d259883e9375.tar.gz
frameworks_base-11e84bde9e98cb4b777a67208989d259883e9375.tar.bz2
Merge "Don't mark NetworkRequests restricted when they don't have restricted caps" into mnc-dev
Diffstat (limited to 'core')
-rw-r--r--core/java/android/net/NetworkCapabilities.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java
index 29b063a..d0e0cbe 100644
--- a/core/java/android/net/NetworkCapabilities.java
+++ b/core/java/android/net/NetworkCapabilities.java
@@ -299,8 +299,12 @@ public final class NetworkCapabilities implements Parcelable {
public void maybeMarkCapabilitiesRestricted() {
// If all the capabilities are typically provided by restricted networks, conclude that this
// network is restricted.
- if ((mNetworkCapabilities & ~(DEFAULT_CAPABILITIES | RESTRICTED_CAPABILITIES)) == 0)
+ if ((mNetworkCapabilities & ~(DEFAULT_CAPABILITIES | RESTRICTED_CAPABILITIES)) == 0 &&
+ // Must have at least some restricted capabilities, otherwise a request for an
+ // internet-less network will get marked restricted.
+ (mNetworkCapabilities & RESTRICTED_CAPABILITIES) != 0) {
removeCapability(NET_CAPABILITY_NOT_RESTRICTED);
+ }
}
/**