From ae83f011b24f4725c9443b75b4b7f7f26ac2f9e6 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 8 Jun 2015 20:22:03 -0400 Subject: [PATCH] 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 -------- .../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 fa176556..2f1e67a9 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 a97091e1..bc667b26 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 012bbef6..4e23e727 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 a269ef01..2a238952 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";