commit 2973eaccd8987070af485e7f8b391404557534d2 Author: Nathan Freitas nathan@freitas.net Date: Tue Mar 8 13:05:35 2016 -0500
change how we look for processes to kill. fixes tor trac #18502 --- src/org/torproject/android/service/TorService.java | 9 --------- src/org/torproject/android/service/TorServiceUtils.java | 6 ++---- src/org/torproject/android/vpn/OrbotVpnService.java | 5 +++-- 3 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java index 06636ed..95192c6 100644 --- a/src/org/torproject/android/service/TorService.java +++ b/src/org/torproject/android/service/TorService.java @@ -488,15 +488,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon cannotKillFile = OrbotApp.fileObfsclient; }
- /** - try { - TorServiceUtils.killProcess(OrbotApp.fileMeekclient); - } catch (IOException e) { - e.printStackTrace(); - cannotKillFile = OrbotApp.fileMeekclient; - } - */ - try { TorServiceUtils.killProcess(OrbotApp.filePolipo); } catch (IOException e) { diff --git a/src/org/torproject/android/service/TorServiceUtils.java b/src/org/torproject/android/service/TorServiceUtils.java index 8549eda..9a072b9 100644 --- a/src/org/torproject/android/service/TorServiceUtils.java +++ b/src/org/torproject/android/service/TorServiceUtils.java @@ -85,9 +85,7 @@ public class TorServiceUtils implements TorServiceConstants { Process procPs = null; - String processKey = new File(command).getName(); - - procPs = r.exec(SHELL_CMD_PS + ' ' + processKey); // this is the android ps <name> command + procPs = r.exec(SHELL_CMD_PS); // this is the android ps <name> command
BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); String line = null; @@ -97,7 +95,7 @@ public class TorServiceUtils implements TorServiceConstants { if (line.contains("PID")) continue; - if (line.contains('/' + processKey)) + if (line.contains(command)) { String[] lineParts = line.split("\s+"); diff --git a/src/org/torproject/android/vpn/OrbotVpnService.java b/src/org/torproject/android/vpn/OrbotVpnService.java index 6540f02..2efab1c 100644 --- a/src/org/torproject/android/vpn/OrbotVpnService.java +++ b/src/org/torproject/android/vpn/OrbotVpnService.java @@ -384,12 +384,13 @@ public class OrbotVpnService extends VpnService implements Handler.Callback { @Override public void onRevoke() {
+ Log.w(TAG,"VPNService REVOKED!"); + if (!isRestart) { SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); prefs.edit().putBoolean("pref_vpn", false).commit(); - stopVPN(); - + stopVPN(); } isRestart = false;
tor-commits@lists.torproject.org