commit 4470771c0dd4b9966ba53e5aa4d0539a8901c6bd Author: Hans-Christoph Steiner hans@eds.org Date: Tue Jun 9 13:14:23 2015 -0400
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. --- src/org/torproject/android/OrbotMainActivity.java | 35 ++++++--------------- 1 file changed, 9 insertions(+), 26 deletions(-)
diff --git a/src/org/torproject/android/OrbotMainActivity.java b/src/org/torproject/android/OrbotMainActivity.java index 417e866..e010e85 100644 --- a/src/org/torproject/android/OrbotMainActivity.java +++ b/src/org/torproject/android/OrbotMainActivity.java @@ -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); torService.setAction(action); startService(torService); - } private void stopService () @@ -790,11 +787,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon } else if (request == REQUEST_VPN && response == RESULT_OK) { - startService(TorServiceConstants.CMD_VPN); - - // if (torStatus == TorServiceConstants.STATUS_ON) - // restartTor (); - + sendIntentToService(TorServiceConstants.CMD_VPN); }
IntentResult scanResult = IntentIntegrator.parseActivityResult(request, response, data); @@ -1051,28 +1044,24 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon } else { - startService(TorServiceConstants.CMD_VPN); - // if (torStatus == TorServiceConstants.STATUS_ON) - // restartTor (); - + sendIntentToService(TorServiceConstants.CMD_VPN); } }
public void stopVpnService () { - startService(TorServiceConstants.CMD_VPN_CLEAR); - // restartTor (); + sendIntentToService(TorServiceConstants.CMD_VPN_CLEAR); }
private boolean flushTransProxy () { - startService(TorServiceConstants.CMD_FLUSH); + sendIntentToService(TorServiceConstants.CMD_FLUSH); return true; }
private boolean updateTransProxy () { - startService(TorServiceConstants.CMD_UPDATE_TRANS_PROXY); + sendIntentToService(TorServiceConstants.CMD_UPDATE_TRANS_PROXY); return true; }
@@ -1222,9 +1211,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon // to start Tor private void startTor () throws RemoteException { - - - startService (TorServiceConstants.CMD_START); + sendIntentToService (TorServiceConstants.CMD_START); torStatus = TorServiceConstants.STATUS_STARTING; mTxtOrbotLog.setText(""); @@ -1238,19 +1225,15 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon Message msg = mHandler.obtainMessage(TorServiceConstants.ENABLE_TOR_MSG); msg.getData().putString(HANDLER_TOR_MSG, getString(R.string.status_starting_up)); mHandler.sendMessage(msg); - - }
//now we stop Tor! amazing! private void stopTor () throws RemoteException { - - startService (TorServiceConstants.CMD_STOP); + sendIntentToService (TorServiceConstants.CMD_STOP); torStatus = TorServiceConstants.STATUS_OFF; Message msg = mHandler.obtainMessage(TorServiceConstants.DISABLE_TOR_MSG); mHandler.sendMessage(msg); - }
/* @@ -1409,7 +1392,7 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
public void spinOrbot (float direction) { - startService (TorServiceConstants.CMD_NEWNYM); + sendIntentToService (TorServiceConstants.CMD_NEWNYM);
Toast.makeText(this, R.string.newnym, Toast.LENGTH_SHORT).show();