Rename updateFirewallRule to setUidFirewallRule

Bug: 218494748
Test: TH
Change-Id: I0b7427521479271b34aed307f17a6e2225fb3076
This commit is contained in:
markchien
2022-03-22 17:30:04 +08:00
parent c5026d4236
commit c60b36d705

View File

@@ -1528,7 +1528,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
if (updateFirewallUidRuleLocked(chain, uid, rule)) { if (updateFirewallUidRuleLocked(chain, uid, rule)) {
final ConnectivityManager cm = mContext.getSystemService(ConnectivityManager.class); final ConnectivityManager cm = mContext.getSystemService(ConnectivityManager.class);
try { try {
cm.updateFirewallRule(chain, uid, isFirewallRuleAllow(chain, rule)); cm.setUidFirewallRule(chain, uid, rule);
} catch (RuntimeException e) { } catch (RuntimeException e) {
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
@@ -1601,14 +1601,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
} }
} }
// There are only two type of firewall rule: FIREWALL_RULE_ALLOW or FIREWALL_RULE_DENY.
private boolean isFirewallRuleAllow(int chain, int rule) {
if (rule == NetworkPolicyManager.FIREWALL_RULE_DEFAULT) {
return getFirewallType(chain) == FIREWALL_DENYLIST;
}
return rule == INetd.FIREWALL_RULE_ALLOW;
}
private void enforceSystemUid() { private void enforceSystemUid() {
final int uid = mDeps.getCallingUid(); final int uid = mDeps.getCallingUid();
if (uid != Process.SYSTEM_UID) { if (uid != Process.SYSTEM_UID) {