[tor-commits] [orbot/master] Merge branch 'the-big-start-stop-makeover' of https://github.com/eighthave/orbot into eighthave-the-big-start-stop-makeover

n8fr8 at torproject.org n8fr8 at torproject.org
Thu Jun 25 14:59:59 UTC 2015


commit e11cae883ee5f850780660f9222f21fbe74e6fee
Merge: a8384bd aa87e67
Author: Nathan Freitas <nathan at freitas.net>
Date:   Mon Jun 22 12:43:42 2015 -0400

    Merge branch 'the-big-start-stop-makeover' of https://github.com/eighthave/orbot into eighthave-the-big-start-stop-makeover
    
    Conflicts:
    	src/org/torproject/android/OrbotMainActivity.java
    	src/org/torproject/android/service/TorService.java

 src/org/torproject/android/OrbotApp.java           |   23 +++
 src/org/torproject/android/OrbotMainActivity.java  |   41 +++--
 src/org/torproject/android/service/TorService.java |  177 +++++++++-----------
 .../android/service/TorServiceConstants.java       |    1 +
 4 files changed, 129 insertions(+), 113 deletions(-)

diff --cc src/org/torproject/android/OrbotMainActivity.java
index 2fd68d3,dd9427e..cf4600b
--- a/src/org/torproject/android/OrbotMainActivity.java
+++ b/src/org/torproject/android/OrbotMainActivity.java
@@@ -1142,32 -1134,32 +1145,42 @@@ public class OrbotMainActivity extends 
       * {@link TorServiceConstants#ACTION_START} {@link Intent} to
       * {@link TorService}
       */
 -    private void startTor() throws RemoteException {
 +    private void startTor() {
          sendIntentToService(TorServiceConstants.ACTION_START);
      }
 +    
 +    /**
 +     * Request tor status without starting it
 +     * {@link TorServiceConstants#ACTION_START} {@link Intent} to
 +     * {@link TorService}
 +     */
 +    private void requestTorStatus() {
 +        sendIntentToService(TorServiceConstants.ACTION_STATUS);
 +    }
  
+     private boolean isTorServiceRunning() {
+         ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
+         for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
+             if (TorService.class.getName().equals(service.service.getClassName())) {
+                 return true;
+             }
+         }
+         return false;
+     }
+ 
      public boolean onLongClick(View view) {
 -        try {
 -            if (torStatus == TorServiceConstants.STATUS_OFF) {
 -                startTor();
 -            } else {
 -                stopTor();
 -            }
 -            return true;
 -        } catch (RemoteException e) {
 -            Log.d(TAG, "error onclick", e);
 +
 +        if (torStatus == TorServiceConstants.STATUS_OFF) {
 +            lblStatus.setText(getString(R.string.status_starting_up));
 +            startTor();
 +        } else {
 +        	lblStatus.setText(getString(R.string.status_shutting_down));
 +        	
 +            stopTor();
          }
 -        return false;
 +        
 +        return true;
 +                
      }
  
  // this is what takes messages or values from the callback threads or other non-mainUI threads
diff --cc src/org/torproject/android/service/TorService.java
index bf065c3,464382e..a515333
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@@ -802,13 -766,9 +769,13 @@@ public class TorService extends Servic
          // make sure there are no stray daemons running
          killAllDaemons();
  
 +        sendCallbackStatus(STATUS_STARTING);
 +        sendCallbackLogMessage(getString(R.string.status_starting_up));
 +        logNotice(getString(R.string.status_starting_up));
 +        
          try {
-         if (fileTor == null)
-             initBinariesAndDirectories();
+         if (!isTorUpgradeAndConfigComplete)
+             torUpgradeAndConfig();
          
          ArrayList<String> customEnv = new ArrayList<String>();
  





More information about the tor-commits mailing list