make start and stop of Tor service all hanlded through executor
This commit is contained in:
parent
d8648a5864
commit
2125db1504
|
@ -41,8 +41,7 @@ public class OnBootReceiver extends BroadcastReceiver {
|
||||||
Intent torService = new Intent(context, TorService.class);
|
Intent torService = new Intent(context, TorService.class);
|
||||||
torService.setAction(action);
|
torService.setAction(action);
|
||||||
context.startService(torService);
|
context.startService(torService);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
|
|
||||||
boolean mIsLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
boolean mIsLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
||||||
|
|
||||||
private ExecutorService mExecutor = Executors.newFixedThreadPool(1);
|
private ExecutorService mExecutor = Executors.newFixedThreadPool(3);
|
||||||
|
|
||||||
|
|
||||||
TorEventHandler mEventHandler;
|
TorEventHandler mEventHandler;
|
||||||
|
|
||||||
|
@ -296,7 +295,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
*/
|
*/
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
if (intent != null)
|
if (intent != null)
|
||||||
new Thread (new IncomingIntentRouter(intent)).start();
|
exec (new IncomingIntentRouter(intent));
|
||||||
else
|
else
|
||||||
Log.d(OrbotConstants.TAG, "Got null onStartCommand() intent");
|
Log.d(OrbotConstants.TAG, "Got null onStartCommand() intent");
|
||||||
|
|
||||||
|
@ -363,13 +362,14 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
|
|
||||||
private void stopTor ()
|
private void stopTor ()
|
||||||
{
|
{
|
||||||
mExecutor.execute(new Runnable ()
|
exec(new Runnable ()
|
||||||
{
|
{
|
||||||
public void run ()
|
public void run ()
|
||||||
{
|
{
|
||||||
stopTorAsync();
|
stopTorAsync();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopTorAsync () {
|
private void stopTorAsync () {
|
||||||
|
|
Loading…
Reference in New Issue