Fixed enforceMeteredApnPolicy when Data Saver is on.

When enforceMeteredApnPolicy() is called when Data Saver mode is on and
the caller's UID is not whitelisted, it should add a
NET_CAPABILITY_NOT_METERED to the capabilities.

Change-Id: Ieed4f4a7634ee023ec58c91859263655e0ba62d4
Fixes: 28608499 (and https://code.google.com/p/android/issues/detail?id=208478)
This commit is contained in:
Felipe Leme
2016-05-20 18:04:14 -07:00
parent bd4b5327db
commit 5902c444d7

View File

@@ -4066,7 +4066,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
synchronized(mRulesLock) {
uidRules = mUidRules.get(uid, RULE_ALLOW_ALL);
}
if ((uidRules & RULE_ALLOW_ALL) == 0) {
if (mRestrictBackground && (uidRules & RULE_ALLOW_METERED) == 0
&& (uidRules & RULE_TEMPORARY_ALLOW_METERED) == 0) {
// we could silently fail or we can filter the available nets to only give
// them those they have access to. Chose the more useful option.
networkCapabilities.addCapability(NET_CAPABILITY_NOT_METERED);