rename startService() to sendIntentToService() to reflect what it does
Even though this method is a wrapper around startService(), it is really used to send various Intents to the Service, not only starting it.
This commit is contained in:
parent
82f82e1c10
commit
4470771c0d
|
@ -116,13 +116,10 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void startService (String action)
|
private void sendIntentToService(String action) {
|
||||||
{
|
|
||||||
|
|
||||||
Intent torService = new Intent(this, TorService.class);
|
Intent torService = new Intent(this, TorService.class);
|
||||||
torService.setAction(action);
|
torService.setAction(action);
|
||||||
startService(torService);
|
startService(torService);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopService ()
|
private void stopService ()
|
||||||
|
@ -790,11 +787,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
}
|
}
|
||||||
else if (request == REQUEST_VPN && response == RESULT_OK)
|
else if (request == REQUEST_VPN && response == RESULT_OK)
|
||||||
{
|
{
|
||||||
startService(TorServiceConstants.CMD_VPN);
|
sendIntentToService(TorServiceConstants.CMD_VPN);
|
||||||
|
|
||||||
// if (torStatus == TorServiceConstants.STATUS_ON)
|
|
||||||
// restartTor ();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IntentResult scanResult = IntentIntegrator.parseActivityResult(request, response, data);
|
IntentResult scanResult = IntentIntegrator.parseActivityResult(request, response, data);
|
||||||
|
@ -1051,28 +1044,24 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
startService(TorServiceConstants.CMD_VPN);
|
sendIntentToService(TorServiceConstants.CMD_VPN);
|
||||||
// if (torStatus == TorServiceConstants.STATUS_ON)
|
|
||||||
// restartTor ();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopVpnService ()
|
public void stopVpnService ()
|
||||||
{
|
{
|
||||||
startService(TorServiceConstants.CMD_VPN_CLEAR);
|
sendIntentToService(TorServiceConstants.CMD_VPN_CLEAR);
|
||||||
// restartTor ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean flushTransProxy ()
|
private boolean flushTransProxy ()
|
||||||
{
|
{
|
||||||
startService(TorServiceConstants.CMD_FLUSH);
|
sendIntentToService(TorServiceConstants.CMD_FLUSH);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean updateTransProxy ()
|
private boolean updateTransProxy ()
|
||||||
{
|
{
|
||||||
startService(TorServiceConstants.CMD_UPDATE_TRANS_PROXY);
|
sendIntentToService(TorServiceConstants.CMD_UPDATE_TRANS_PROXY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1222,9 +1211,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
// to start Tor
|
// to start Tor
|
||||||
private void startTor () throws RemoteException
|
private void startTor () throws RemoteException
|
||||||
{
|
{
|
||||||
|
sendIntentToService (TorServiceConstants.CMD_START);
|
||||||
|
|
||||||
startService (TorServiceConstants.CMD_START);
|
|
||||||
torStatus = TorServiceConstants.STATUS_STARTING;
|
torStatus = TorServiceConstants.STATUS_STARTING;
|
||||||
|
|
||||||
mTxtOrbotLog.setText("");
|
mTxtOrbotLog.setText("");
|
||||||
|
@ -1238,19 +1225,15 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
Message msg = mHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG);
|
Message msg = mHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG);
|
||||||
msg.getData().putString(HANDLER_TOR_MSG, getString(R.string.status_starting_up));
|
msg.getData().putString(HANDLER_TOR_MSG, getString(R.string.status_starting_up));
|
||||||
mHandler.sendMessage(msg);
|
mHandler.sendMessage(msg);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//now we stop Tor! amazing!
|
//now we stop Tor! amazing!
|
||||||
private void stopTor () throws RemoteException
|
private void stopTor () throws RemoteException
|
||||||
{
|
{
|
||||||
|
sendIntentToService (TorServiceConstants.CMD_STOP);
|
||||||
startService (TorServiceConstants.CMD_STOP);
|
|
||||||
torStatus = TorServiceConstants.STATUS_OFF;
|
torStatus = TorServiceConstants.STATUS_OFF;
|
||||||
Message msg = mHandler.obtainMessage(TorServiceConstants.DISABLE_TOR_MSG);
|
Message msg = mHandler.obtainMessage(TorServiceConstants.DISABLE_TOR_MSG);
|
||||||
mHandler.sendMessage(msg);
|
mHandler.sendMessage(msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1409,7 +1392,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
|
||||||
|
|
||||||
public void spinOrbot (float direction)
|
public void spinOrbot (float direction)
|
||||||
{
|
{
|
||||||
startService (TorServiceConstants.CMD_NEWNYM);
|
sendIntentToService (TorServiceConstants.CMD_NEWNYM);
|
||||||
|
|
||||||
|
|
||||||
Toast.makeText(this, R.string.newnym, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.newnym, Toast.LENGTH_SHORT).show();
|
||||||
|
|
Loading…
Reference in New Issue