Fix the case where restricted mode allowed reasons are ignored

Restricted mode allowed reasons are not considered in power and data usage restriction rule updates.
This could result in sending the wrong network state to apps.

Bug: https://issuetracker.google.com/issues/206947902
Change-Id: I5e616fd1e9a916ad9a367b4391c85c1febbf1f6b
This commit is contained in:
Oliver Scott
2021-11-26 12:45:53 -05:00
parent 67bf96eac9
commit 0b4cafdae8

View File

@@ -4759,6 +4759,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
? ALLOWED_REASON_POWER_SAVE_ALLOWLIST : 0);
newAllowedReasons |= (isWhitelistedFromPowerSaveExceptIdleUL(uid)
? ALLOWED_REASON_POWER_SAVE_EXCEPT_IDLE_ALLOWLIST : 0);
newAllowedReasons |= (uidBlockedState.allowedReasons
& ALLOWED_REASON_RESTRICTED_MODE_PERMISSIONS);
uidBlockedState.blockedReasons = (uidBlockedState.blockedReasons
& BLOCKED_METERED_REASON_MASK) | newBlockedReasons;