[tor-commits] [orbot/master] purge CMD_INIT/initialize() from TorService, an IntentService doesn't need it

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


commit ae83f011b24f4725c9443b75b4b7f7f26ac2f9e6
Author: Hans-Christoph Steiner <hans at eds.org>
Date:   Mon Jun 8 20:22:03 2015 -0400

    purge CMD_INIT/initialize() from TorService, an IntentService doesn't need it
    
    when switching to an IntentService, a new Intent will always start the
    Service, and onCreate() can be used to initialize the Service.
---
 src/org/torproject/android/OrbotMainActivity.java           |   10 ----------
 src/org/torproject/android/service/OnBootReceiver.java      |    3 ---
 src/org/torproject/android/service/TorService.java          |    8 --------
 src/org/torproject/android/service/TorServiceConstants.java |    1 -
 4 files changed, 22 deletions(-)

diff --git a/src/org/torproject/android/OrbotMainActivity.java b/src/org/torproject/android/OrbotMainActivity.java
index fa17655..2f1e67a 100644
--- a/src/org/torproject/android/OrbotMainActivity.java
+++ b/src/org/torproject/android/OrbotMainActivity.java
@@ -113,16 +113,6 @@ public class OrbotMainActivity extends Activity implements OrbotConstants, OnLon
   	  
 		LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver,
 			      new IntentFilter(TorServiceConstants.LOCAL_ACTION_LOG));
-
-		mHandler.postDelayed(new Runnable ()
-		{
-		
-			public void run ()
-			{
-				startService(TorServiceConstants.CMD_INIT);
-			}
-		},INIT_DELAY);
-		
 	}
 	
 	
diff --git a/src/org/torproject/android/service/OnBootReceiver.java b/src/org/torproject/android/service/OnBootReceiver.java
index a97091e..bc667b2 100644
--- a/src/org/torproject/android/service/OnBootReceiver.java
+++ b/src/org/torproject/android/service/OnBootReceiver.java
@@ -20,13 +20,10 @@ public class OnBootReceiver extends BroadcastReceiver {
 		
 		if (startOnBoot)
 		{
-			
-			startService(TorServiceConstants.CMD_INIT,context);
 			startService(TorServiceConstants.CMD_START,context);		
 			
 			if (useVPN)
 				startVpnService(context);
-			
 		}
 
 	}
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 012bbef..4e23e72 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -375,9 +375,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
                             setTorProfile(STATUS_ON);
                         }else if (action.equals(CMD_STOP)){
                             setTorProfile(STATUS_OFF);
-                        }else if (action.equals(CMD_INIT)){
-                            initialize();
-                            sendCallbackStatus(mCurrentStatus);
                         }else if (action.equals(CMD_NEWNYM)){
                             newIdentity();
                         }else if (action.equals(CMD_FLUSH)){
@@ -623,11 +620,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
     @Override
     public void onCreate() {
         super.onCreate();
-        initialize();
-    }
-    
-    private void initialize()
-    {
         try
         {
             mNumberFormat = NumberFormat.getInstance(Locale.getDefault()); //localized numbers!
diff --git a/src/org/torproject/android/service/TorServiceConstants.java b/src/org/torproject/android/service/TorServiceConstants.java
index a269ef0..2a23895 100644
--- a/src/org/torproject/android/service/TorServiceConstants.java
+++ b/src/org/torproject/android/service/TorServiceConstants.java
@@ -87,7 +87,6 @@ public interface TorServiceConstants {
     public static final String CMD_STOP = "stop";
     public static final String CMD_FLUSH = "flush";
     public static final String CMD_NEWNYM = "newnym";
-    public static final String CMD_INIT = "init";
     public static final String CMD_VPN = "vpn";
     public static final String CMD_VPN_CLEAR = "vpnclear";
     public static final String CMD_UPDATE = "update";





More information about the tor-commits mailing list