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

Commit 02687ec9 authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

/e/ make appList a bypassTor list.

parent 4bfa8c82
Loading
Loading
Loading
Loading
+6 −15
Original line number Diff line number Diff line
@@ -336,28 +336,19 @@ public class OrbotVpnManager implements Handler.Callback {
    private void doLollipopAppRouting(VpnService.Builder builder) throws NameNotFoundException {
        ArrayList<TorifiedApp> apps = TorifiedApp.getApps(mService, prefs);


        boolean perAppEnabled = false;

        for (TorifiedApp app : apps) {
            if (app.isTorified() && (!app.getPackageName().equals(mService.getPackageName()))) {
                if (prefs.getBoolean(app.getPackageName() + OrbotConstants.APP_TOR_KEY, true)) {
                    builder.addAllowedApplication(app.getPackageName());
                }

                perAppEnabled = true;

            if (app.isBypassTor()) {
                builder.addDisallowedApplication(app.getPackageName());
            }
        }

        if (!perAppEnabled) {
        builder.addDisallowedApplication(mService.getPackageName());
            for (String packageName : VpnPrefs.BYPASS_VPN_PACKAGES)
        for (String packageName : VpnPrefs.BYPASS_VPN_PACKAGES) {
            builder.addDisallowedApplication(packageName);
        }

    }


    private void startDNS(String pdnsPath, String torDnsHost, int torDnsPort, String pdnsdHost, int pdnsdPort) throws IOException, TimeoutException {
        String debugEnabledConf = "off";
        if (Prefs.useDebugLogging()) {
+10 −10
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ public class TorifiedApp implements Comparable {
    private Drawable icon;
    private String packageName;

    private boolean torified = false;
    private boolean bypassTor = false;
    private boolean usesInternet = false;
    private int[] enabledPorts;

@@ -112,9 +112,9 @@ public class TorifiedApp implements Comparable {

            // check if this application is allowed
            if (Arrays.binarySearch(tordApps, app.getPackageName()) >= 0) {
                app.setTorified(true);
                app.setBypassTor(true);
            } else {
                app.setTorified(false);
                app.setBypassTor(false);
            }
        }

@@ -129,9 +129,9 @@ public class TorifiedApp implements Comparable {
               insensitive they'd appear at the end of the grid of apps, a position where users
               would likely not expect to find them.
             */
            if (o1.isTorified() == o2.isTorified())
            if (o1.isBypassTor() == o2.isBypassTor())
                return o1.getName().compareToIgnoreCase(o2.getName());
            if (o1.isTorified()) return -1;
            if (o1.isBypassTor()) return -1;
            return 1;
        });
    }
@@ -147,15 +147,15 @@ public class TorifiedApp implements Comparable {
    /**
     * @return the torified
     */
    public boolean isTorified() {
        return torified;
    public boolean isBypassTor() {
        return bypassTor;
    }

    /**
     * @param torified the torified to set
     * @param bypassTor the torified to set
     */
    public void setTorified(boolean torified) {
        this.torified = torified;
    public void setBypassTor(boolean bypassTor) {
        this.bypassTor = bypassTor;
    }

    /**