[tor-commits] [orbot/master] tune bind/create service logic

n8fr8 at torproject.org n8fr8 at torproject.org
Thu Jun 12 00:26:26 UTC 2014


commit 328c6af2c68a789ded01c58a2b19b56a4bb7ea9c
Author: Nathan Freitas <nathan at freitas.net>
Date:   Wed Jun 11 20:24:08 2014 -0400

    tune bind/create service logic
---
 src/org/torproject/android/Orbot.java |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index cd7a392..c1e755c 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -106,10 +106,13 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
         
 	}
 
+	Intent torService;
+	
 	private void startService ()
 	{
-		Intent torService = new Intent(this, TorService.class);    	    	
-
+		torService = new Intent(this, TorService.class);    	    	
+		startService(torService);
+		
 		/*
 		if (Build.VERSION.SDK_INT > 14)
 		{
@@ -120,11 +123,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
 		else
 		{
 		*/
-			bindService(torService,
-					mConnection, Context.BIND_AUTO_CREATE);
+			
 		//}
 	
-		startService(torService);
 	
 	}
 	
@@ -463,6 +464,8 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
 
 		if (aDialog != null)
 			aDialog.dismiss();
+		
+		unbindService(mConnection);
 	}
 	
 	private void doTorCheck ()
@@ -796,6 +799,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
 	protected void onResume() {
 		super.onResume();
 
+		bindService(torService,
+				mConnection, 0);
+		
         if (mService != null)
         {
                 try {





More information about the tor-commits mailing list