fix temp white list update in device idle

It appears firewall rules for temp white list is updated differently
from the non temp one. The non temp one will trigger a global update
but the temp one is updating only the uids in the list one by one.
The individual uid firewall rule update does not work well with dozable
chain. This cl moves the dozable chain update logic out and put it where
the white list is updated.

BUG:22094135
Change-Id: I425c82da6231b1ef119664907705d0880365f339
This commit is contained in:
Xiaohui Chen
2015-06-26 16:20:48 -07:00
parent 1c3b7a6de6
commit c915eebbf8

View File

@@ -2093,8 +2093,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
for (UserInfo user : users) {
for (int i = mPowerSaveTempWhitelistAppIds.size() - 1; i >= 0; i--) {
int appId = mPowerSaveTempWhitelistAppIds.keyAt(i);
boolean isAllow = mPowerSaveTempWhitelistAppIds.valueAt(i);
int uid = UserHandle.getUid(user.id, appId);
updateRulesForUidLocked(uid);
setUidFirewallRule(FIREWALL_CHAIN_DOZABLE, uid, !isAllow);
}
}
}
@@ -2190,11 +2192,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
final boolean firewallReject = (uidRules & RULE_REJECT_ALL) != 0;
if (oldFirewallReject != firewallReject) {
setUidFirewallRule(FIREWALL_CHAIN_STANDBY, uid, firewallReject);
if (mFirewallChainStates.get(FIREWALL_CHAIN_DOZABLE) && !firewallReject) {
// if the dozable chain is on, and we decide to allow this uid. we need to punch
// a hole in the dozable chain.
setUidFirewallRule(FIREWALL_CHAIN_DOZABLE, uid, false);
}
}
// dispatch changed rule to existing listeners