change how we look for processes to kill. fixes tor trac #18502

This commit is contained in:
Nathan Freitas 2016-03-08 13:05:35 -05:00
parent cec82ec0de
commit 2973eaccd8
3 changed files with 5 additions and 15 deletions

View File

@ -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) {

View File

@ -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+");

View File

@ -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();
}
isRestart = false;