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

Commit 39ae5bac authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Rename updateFirewallRule to setUidFirewallRule"

parents 30cbfdba 98dac2f1
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) {