commit 39244a613ab5e39036a479234904216d3f6b9878 Author: Nathan Freitas nathan@freitas.net Date: Mon Jan 11 17:11:58 2016 -0500
fix the ability to select per app VPN routing --- src/org/torproject/android/OrbotMainActivity.java | 2 +- src/org/torproject/android/settings/AppManager.java | 1 + src/org/torproject/android/settings/TorifiedApp.java | 9 +++++++++ src/org/torproject/android/vpn/OrbotVpnService.java | 4 ++-- 4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/org/torproject/android/OrbotMainActivity.java b/src/org/torproject/android/OrbotMainActivity.java index 7b7ca07..0b292d2 100644 --- a/src/org/torproject/android/OrbotMainActivity.java +++ b/src/org/torproject/android/OrbotMainActivity.java @@ -809,7 +809,7 @@ public class OrbotMainActivity extends Activity else if (torStatus == TorServiceConstants.STATUS_ON) { updateTransProxy(); - Toast.makeText(this, R.string.you_may_need_to_stop_and_start_orbot_for_settings_change_to_be_enabled_, Toast.LENGTH_SHORT).show(); + // Toast.makeText(this, R.string.you_may_need_to_stop_and_start_orbot_for_settings_change_to_be_enabled_, Toast.LENGTH_SHORT).show();
} } diff --git a/src/org/torproject/android/settings/AppManager.java b/src/org/torproject/android/settings/AppManager.java index 19dff0a..6bb1437 100644 --- a/src/org/torproject/android/settings/AppManager.java +++ b/src/org/torproject/android/settings/AppManager.java @@ -300,6 +300,7 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC app.setUid(aInfo.uid); app.setUsername(pMgr.getNameForUid(app.getUid())); app.setProcname(aInfo.processName); + app.setPackageName(aInfo.packageName);
try { diff --git a/src/org/torproject/android/settings/TorifiedApp.java b/src/org/torproject/android/settings/TorifiedApp.java index a786800..ceada4d 100644 --- a/src/org/torproject/android/settings/TorifiedApp.java +++ b/src/org/torproject/android/settings/TorifiedApp.java @@ -10,6 +10,7 @@ public class TorifiedApp implements Comparable { private String procname; private String name; private Drawable icon; + private String packageName; private boolean torified = false; private boolean usesInternet = false; @@ -127,4 +128,12 @@ public class TorifiedApp implements Comparable { { return getName(); } + + + public String getPackageName() { + return packageName; + } + public void setPackageName(String packageName) { + this.packageName = packageName; + } } diff --git a/src/org/torproject/android/vpn/OrbotVpnService.java b/src/org/torproject/android/vpn/OrbotVpnService.java index f4dff74..6cc718c 100644 --- a/src/org/torproject/android/vpn/OrbotVpnService.java +++ b/src/org/torproject/android/vpn/OrbotVpnService.java @@ -343,9 +343,9 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
for (TorifiedApp app : apps) { - if (app.isTorified()) + if (app.isTorified() && (!app.getPackageName().equals(getPackageName()))) { - builder.addAllowedApplication(app.getUsername()); + builder.addAllowedApplication(app.getPackageName()); perAppEnabled = true; }
tor-commits@lists.torproject.org