Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98dac2f1 authored by markchien's avatar markchien
Browse files

Rename updateFirewallRule to setUidFirewallRule

Bug: 218494748
Test: TH
Change-Id: I0b7427521479271b34aed307f17a6e2225fb3076
Merged-In: I0b7427521479271b34aed307f17a6e2225fb3076
parent dd1a3bae
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -1528,7 +1528,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
        if (updateFirewallUidRuleLocked(chain, uid, rule)) {
            final ConnectivityManager cm = mContext.getSystemService(ConnectivityManager.class);
            try {
                cm.updateFirewallRule(chain, uid, isFirewallRuleAllow(chain, rule));
                cm.setUidFirewallRule(chain, uid, rule);
            } catch (RuntimeException 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() {
        final int uid = mDeps.getCallingUid();
        if (uid != Process.SYSTEM_UID) {