clean up unbind process and service shutdown
This commit is contained in:
parent
8a59cfb6d2
commit
156ed574e8
|
@ -83,9 +83,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
/* The primary interface we will be calling on the service. */
|
/* The primary interface we will be calling on the service. */
|
||||||
ITorService mService = null;
|
ITorService mService = null;
|
||||||
|
|
||||||
//should move this up with all the other class variables
|
|
||||||
private boolean mIsBound = false;
|
|
||||||
|
|
||||||
private SharedPreferences mPrefs = null;
|
private SharedPreferences mPrefs = null;
|
||||||
|
|
||||||
private boolean autoStartFromIntent = false;
|
private boolean autoStartFromIntent = false;
|
||||||
|
@ -431,6 +428,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
//terminology but also making sure there are clear distinctions in control
|
//terminology but also making sure there are clear distinctions in control
|
||||||
stopTor();
|
stopTor();
|
||||||
|
|
||||||
|
if (mConnection != null)
|
||||||
|
unbindService(mConnection);
|
||||||
|
|
||||||
//perhaps this should be referenced as INTENT_TOR_SERVICE as in startService
|
//perhaps this should be referenced as INTENT_TOR_SERVICE as in startService
|
||||||
stopService(new Intent(this,TorService.class));
|
stopService(new Intent(this,TorService.class));
|
||||||
|
|
||||||
|
@ -1164,8 +1164,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
public void onServiceConnected(ComponentName className,
|
public void onServiceConnected(ComponentName className,
|
||||||
IBinder service) {
|
IBinder service) {
|
||||||
|
|
||||||
mIsBound = true;
|
|
||||||
|
|
||||||
// This is called when the connection with the service has been
|
// This is called when the connection with the service has been
|
||||||
// established, giving us the service object we can use to
|
// established, giving us the service object we can use to
|
||||||
// interact with the service. We are communicating with our
|
// interact with the service. We are communicating with our
|
||||||
|
@ -1215,35 +1213,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//unbind removes the callback, and unbinds the service
|
|
||||||
private void unbindService ()
|
|
||||||
{
|
|
||||||
if (mIsBound) {
|
|
||||||
// If we have received the service, and hence registered with
|
|
||||||
// it, then now is the time to unregister.
|
|
||||||
if (mService != null) {
|
|
||||||
try {
|
|
||||||
mService.unregisterCallback(mCallback);
|
|
||||||
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
// There is nothing special we need to do if the service
|
|
||||||
// has crashed.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detach our existing connection.
|
|
||||||
unbindService(mConnection);
|
|
||||||
mIsBound = false;
|
|
||||||
|
|
||||||
Log.d(TAG,"service was ubnound");
|
|
||||||
|
|
||||||
//maybe needs this?
|
|
||||||
mService = null;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
private void createProgressDialog (String msg)
|
private void createProgressDialog (String msg)
|
||||||
|
|
Loading…
Reference in New Issue