diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2015-08-19 20:48:31 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-08-19 20:48:31 +0000 |
commit | 11e84bde9e98cb4b777a67208989d259883e9375 (patch) | |
tree | 17955cf7284fc4762f792c4be442698d37c6febd | |
parent | e3de6c5df5a94e627c5ee0f188cbb066233a3dd0 (diff) | |
parent | aae613d96134245af7c55976731a49fa59e77470 (diff) | |
download | frameworks_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
-rw-r--r-- | core/java/android/net/NetworkCapabilities.java | 6 | ||||
-rw-r--r-- | services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java | 3 |
2 files changed, 6 insertions, 3 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); + } } /** diff --git a/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java b/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java index 696f106..b4c76b7 100644 --- a/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java @@ -943,8 +943,7 @@ public class ConnectivityServiceTest extends AndroidTestCase { if (capability == NET_CAPABILITY_CBS || capability == NET_CAPABILITY_DUN || capability == NET_CAPABILITY_EIMS || capability == NET_CAPABILITY_FOTA || capability == NET_CAPABILITY_IA || capability == NET_CAPABILITY_IMS || - capability == NET_CAPABILITY_RCS || capability == NET_CAPABILITY_XCAP || - capability == NET_CAPABILITY_TRUSTED || capability == NET_CAPABILITY_NOT_VPN) { + capability == NET_CAPABILITY_RCS || capability == NET_CAPABILITY_XCAP) { assertFalse(nc.hasCapability(NET_CAPABILITY_NOT_RESTRICTED)); } else { assertTrue(nc.hasCapability(NET_CAPABILITY_NOT_RESTRICTED)); |