include proxy config info when returning from START_TOR Intent
The recommended way to send a START_TOR Intent is using startActivityWithResult() so that the sender knows when Tor is actually started. The return includes an Intent that can also include the config info for the proxies that Orbot runs. Right now, this is based on the app defaults, but ultimately, it should dynamically get the port numbers for cases like Samsung devices where there is a port conflict.
This commit is contained in:
parent
d43a6cd2b2
commit
807b51fb43
|
@ -615,20 +615,23 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
else if (action.equals("org.torproject.android.START_TOR"))
|
else if (action.equals("org.torproject.android.START_TOR"))
|
||||||
{
|
{
|
||||||
autoStartFromIntent = true;
|
autoStartFromIntent = true;
|
||||||
|
try {
|
||||||
|
Log.i(TAG, "action equals org.torproject.android.START_TOR");
|
||||||
|
startTor();
|
||||||
|
|
||||||
try {
|
Intent resultIntent = new Intent(intent);
|
||||||
startTor();
|
resultIntent.putExtra("socks_proxy", "socks://127.0.0.1:" + TorServiceConstants.PORT_SOCKS_DEFAULT);
|
||||||
|
resultIntent.putExtra("socks_proxy_host", "127.0.0.1");
|
||||||
Intent nResult = new Intent();
|
resultIntent.putExtra("socks_proxy_port", TorServiceConstants.PORT_SOCKS_DEFAULT);
|
||||||
|
resultIntent.putExtra("http_proxy", "http://127.0.0.1" + TorServiceConstants.PORT_HTTP);
|
||||||
//nResult.putExtra("socks", ); //TODO respond with socks, transport, dns, etc
|
resultIntent.putExtra("http_proxy_host", "127.0.0.1");
|
||||||
|
resultIntent.putExtra("http_proxy_port", TorServiceConstants.PORT_HTTP);
|
||||||
setResult(RESULT_OK,nResult);
|
setResult(RESULT_OK, resultIntent);
|
||||||
|
finish();
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (action.equals(Intent.ACTION_VIEW))
|
else if (action.equals(Intent.ACTION_VIEW))
|
||||||
|
@ -1251,7 +1254,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
|
|
||||||
if (autoStartFromIntent)
|
if (autoStartFromIntent)
|
||||||
{
|
{
|
||||||
setResult(RESULT_OK);
|
autoStartFromIntent = false;
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue