From c1cb30d1bb32254e88438d56e634ec3184694dc5 Mon Sep 17 00:00:00 2001 From: Nathan Freitas Date: Sat, 22 Feb 2014 19:16:55 -0500 Subject: [PATCH] remove issue with service launching via explicit intent --- src/org/torproject/android/Orbot.java | 4 ++-- src/org/torproject/android/TorConstants.java | 2 +- src/org/torproject/android/service/TorService.java | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java index ad6e4888..5eb66fd5 100644 --- a/src/org/torproject/android/Orbot.java +++ b/src/org/torproject/android/Orbot.java @@ -298,7 +298,7 @@ public class Orbot extends SherlockActivity implements TorConstants, OnLongClick stopTor(); //perhaps this should be referenced as INTENT_TOR_SERVICE as in startService - stopService(new Intent(ITorService.class.getName())); + stopService(new Intent(this,TorService.class)); //clears all notifications from the status bar NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); @@ -1053,7 +1053,7 @@ public class Orbot extends SherlockActivity implements TorConstants, OnLongClick private void bindService () { - Intent iTorService = new Intent(ITorService.class.getName()); + Intent iTorService = new Intent(this, TorService.class); getApplication().getApplicationContext().startService(iTorService); diff --git a/src/org/torproject/android/TorConstants.java b/src/org/torproject/android/TorConstants.java index 5af1369b..834f20d0 100644 --- a/src/org/torproject/android/TorConstants.java +++ b/src/org/torproject/android/TorConstants.java @@ -25,7 +25,7 @@ public interface TorConstants { + "ControlPort 9051\nCookieAuthentication 1\nRelayBandwidthRate 20 KBytes\nRelayBandwidthBurst 20 KBytes\nAutomapHostsOnResolve 1\nTransPort 9040\n"; */ - public final static String INTENT_TOR_SERVICE = "org.torproject.android.service.TOR_SERVICE"; + // public final static String INTENT_TOR_SERVICE = "org.torproject.android.service.TOR_SERVICE"; public final static String HANDLER_TOR_MSG = "torServiceMsg"; diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java index fd021210..b00b36f7 100644 --- a/src/org/torproject/android/service/TorService.java +++ b/src/org/torproject/android/service/TorService.java @@ -132,6 +132,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst private boolean findExistingProc () { + // android.os.Debug.waitForDebugger(); + if (fileTorLink != null) { try @@ -1190,8 +1192,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst sendCallbackStatusMessage(written, read, mTotalTrafficWritten, mTotalTrafficRead); - if(++notificationCounter%10==0) - startService(new Intent(INTENT_TOR_SERVICE)); + // if(++notificationCounter%10==0) + // startService(new Intent(ITorService.class.getName())); } @@ -1288,6 +1290,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst else return node; } + public IBinder onBind(Intent intent) { @@ -1311,11 +1314,14 @@ public class TorService extends Service implements TorServiceConstants, TorConst }; thread.start(); + return mBinder; + /** if (ITorService.class.getName().equals(intent.getAction())) { return mBinder; } else return null; + */ } /**