change how we look for processes to kill. fixes tor trac #18502
This commit is contained in:
parent
cec82ec0de
commit
2973eaccd8
|
@ -488,15 +488,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
cannotKillFile = OrbotApp.fileObfsclient;
|
cannotKillFile = OrbotApp.fileObfsclient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
try {
|
|
||||||
TorServiceUtils.killProcess(OrbotApp.fileMeekclient);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
cannotKillFile = OrbotApp.fileMeekclient;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TorServiceUtils.killProcess(OrbotApp.filePolipo);
|
TorServiceUtils.killProcess(OrbotApp.filePolipo);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -85,9 +85,7 @@ public class TorServiceUtils implements TorServiceConstants {
|
||||||
|
|
||||||
Process procPs = null;
|
Process procPs = null;
|
||||||
|
|
||||||
String processKey = new File(command).getName();
|
procPs = r.exec(SHELL_CMD_PS); // this is the android ps <name> command
|
||||||
|
|
||||||
procPs = r.exec(SHELL_CMD_PS + ' ' + processKey); // this is the android ps <name> command
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream()));
|
||||||
String line = null;
|
String line = null;
|
||||||
|
@ -97,7 +95,7 @@ public class TorServiceUtils implements TorServiceConstants {
|
||||||
if (line.contains("PID"))
|
if (line.contains("PID"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (line.contains('/' + processKey))
|
if (line.contains(command))
|
||||||
{
|
{
|
||||||
|
|
||||||
String[] lineParts = line.split("\\s+");
|
String[] lineParts = line.split("\\s+");
|
||||||
|
|
|
@ -384,12 +384,13 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
||||||
@Override
|
@Override
|
||||||
public void onRevoke() {
|
public void onRevoke() {
|
||||||
|
|
||||||
|
Log.w(TAG,"VPNService REVOKED!");
|
||||||
|
|
||||||
if (!isRestart)
|
if (!isRestart)
|
||||||
{
|
{
|
||||||
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
|
||||||
prefs.edit().putBoolean("pref_vpn", false).commit();
|
prefs.edit().putBoolean("pref_vpn", false).commit();
|
||||||
stopVPN();
|
stopVPN();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isRestart = false;
|
isRestart = false;
|
||||||
|
|
Loading…
Reference in New Issue