auto-restart Tor when config changes

This commit is contained in:
Nathan Freitas 2015-04-08 17:01:09 -04:00
parent 384fe1c21e
commit e6fe25267f
1 changed files with 32 additions and 25 deletions

View File

@ -822,6 +822,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
else if (request == REQUEST_VPN && response == RESULT_OK)
{
startService(TorServiceConstants.CMD_VPN);
restartTor ();
}
IntentResult scanResult = IntentIntegrator.parseActivityResult(request, response, data);
@ -1004,6 +1005,16 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
{
String bridgeList = mPrefs.getString(OrbotConstants.PREF_BRIDGES_LIST,null);
if (bridgeList != null && bridgeList.length() > 0)
{
restartTor ();
}
}
}
private void restartTor ()
{
try
{
@ -1031,11 +1042,6 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
}
}
}
}
public void promptStartVpnService ()
{
LayoutInflater li = LayoutInflater.from(this);
@ -1086,13 +1092,14 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
else
{
startService(TorServiceConstants.CMD_VPN);
restartTor ();
}
}
public void stopVpnService ()
{
startService(TorServiceConstants.CMD_VPN_CLEAR);
restartTor ();
}
private boolean flushTransProxy ()