am 278886d5: am 3184b286: am fa4eda44: Merge "Remove network access for idle apps" into mnc-dev
* commit '278886d50a66689529320f9bd735177c068e210d':
Remove network access for idle apps
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 12a99b0..1a75b8a 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -24,6 +24,7 @@
import static android.net.ConnectivityManager.getNetworkTypeName;
import static android.net.ConnectivityManager.isNetworkTypeValid;
import static android.net.NetworkPolicyManager.RULE_ALLOW_ALL;
+import static android.net.NetworkPolicyManager.RULE_REJECT_ALL;
import static android.net.NetworkPolicyManager.RULE_REJECT_METERED;
import android.annotation.Nullable;
@@ -832,7 +833,8 @@
uidRules = mUidRules.get(uid, RULE_ALLOW_ALL);
}
- if (networkCostly && (uidRules & RULE_REJECT_METERED) != 0) {
+ if ((uidRules & RULE_REJECT_ALL) != 0
+ || (networkCostly && (uidRules & RULE_REJECT_METERED) != 0)) {
return true;
}
@@ -3490,7 +3492,7 @@
synchronized(mRulesLock) {
uidRules = mUidRules.get(uid, RULE_ALLOW_ALL);
}
- if ((uidRules & RULE_REJECT_METERED) != 0) {
+ if ((uidRules & (RULE_REJECT_METERED | RULE_REJECT_ALL)) != 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
networkCapabilities.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);