more fixes for UI disconnect issue
ensure service and status updates occur on new layout updates
This commit is contained in:
parent
7e76162b88
commit
d7f3f1989d
|
@ -110,6 +110,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
{
|
{
|
||||||
Intent torService = new Intent(this, TorService.class);
|
Intent torService = new Intent(this, TorService.class);
|
||||||
|
|
||||||
|
/*
|
||||||
if (Build.VERSION.SDK_INT > 14)
|
if (Build.VERSION.SDK_INT > 14)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -118,10 +119,10 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
*/
|
||||||
bindService(torService,
|
bindService(torService,
|
||||||
mConnection, Context.BIND_AUTO_CREATE);
|
mConnection, Context.BIND_AUTO_CREATE);
|
||||||
}
|
//}
|
||||||
|
|
||||||
startService(torService);
|
startService(torService);
|
||||||
|
|
||||||
|
@ -184,6 +185,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
// Gesture detection
|
// Gesture detection
|
||||||
mGestureDetector = new GestureDetector(this, new MyGestureDetector());
|
mGestureDetector = new GestureDetector(this, new MyGestureDetector());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GestureDetector mGestureDetector;
|
GestureDetector mGestureDetector;
|
||||||
|
@ -535,13 +537,6 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onNewIntent(Intent intent) {
|
|
||||||
|
|
||||||
setIntent(intent);
|
|
||||||
handleIntents();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleIntents ()
|
private void handleIntents ()
|
||||||
{
|
{
|
||||||
if (getIntent() == null)
|
if (getIntent() == null)
|
||||||
|
@ -674,6 +669,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
|
|
||||||
doLayout();
|
doLayout();
|
||||||
|
updateStatus("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -800,18 +796,22 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
if (mService != null)
|
||||||
if (mService != null && torStatus != TorServiceConstants.STATUS_ON)
|
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
mService.processSettings();
|
|
||||||
setLocale();
|
|
||||||
|
|
||||||
|
if (torStatus != TorServiceConstants.STATUS_ON)
|
||||||
|
mService.processSettings();
|
||||||
|
|
||||||
|
setLocale();
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateStatus("");
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertDialog aDialog = null;
|
AlertDialog aDialog = null;
|
||||||
|
@ -901,8 +901,8 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
|
|
||||||
if (newTorStatus == TorServiceConstants.STATUS_ON)
|
if (newTorStatus == TorServiceConstants.STATUS_ON)
|
||||||
{
|
{
|
||||||
if (torStatus != newTorStatus)
|
//if (torStatus != newTorStatus)
|
||||||
{
|
//{
|
||||||
imgStatus.setImageResource(R.drawable.toron);
|
imgStatus.setImageResource(R.drawable.toron);
|
||||||
// mViewMain.setBackgroundResource(R.drawable.onionrootonly);
|
// mViewMain.setBackgroundResource(R.drawable.onionrootonly);
|
||||||
|
|
||||||
|
@ -912,7 +912,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
if (mItemOnOff != null)
|
if (mItemOnOff != null)
|
||||||
mItemOnOff.setTitle(R.string.menu_stop);
|
mItemOnOff.setTitle(R.string.menu_stop);
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (mTorServiceMsg != null && mTorServiceMsg.length() > 0)
|
if (mTorServiceMsg != null && mTorServiceMsg.length() > 0)
|
||||||
{
|
{
|
||||||
|
@ -1193,6 +1193,8 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
// representation of that from the raw service object.
|
// representation of that from the raw service object.
|
||||||
mService = ITorService.Stub.asInterface(service);
|
mService = ITorService.Stub.asInterface(service);
|
||||||
|
|
||||||
|
torStatus = -1;
|
||||||
|
|
||||||
// We want to monitor the service for as long as we are
|
// We want to monitor the service for as long as we are
|
||||||
// connected to it.
|
// connected to it.
|
||||||
try {
|
try {
|
||||||
|
@ -1206,9 +1208,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatus("");
|
|
||||||
handleIntents();
|
handleIntents();
|
||||||
|
|
||||||
|
updateStatus("");
|
||||||
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// In this case the service has crashed before we could even
|
// In this case the service has crashed before we could even
|
||||||
|
@ -1229,7 +1231,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
// This is called when the connection with the service has been
|
// This is called when the connection with the service has been
|
||||||
// unexpectedly disconnected -- that is, its process crashed.
|
// unexpectedly disconnected -- that is, its process crashed.
|
||||||
mService = null;
|
mService = null;
|
||||||
|
Log.d(TAG,"service was disconnected");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1254,6 +1256,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
unbindService(mConnection);
|
unbindService(mConnection);
|
||||||
mIsBound = false;
|
mIsBound = false;
|
||||||
|
|
||||||
|
Log.d(TAG,"service was ubnound");
|
||||||
|
|
||||||
//maybe needs this?
|
//maybe needs this?
|
||||||
mService = null;
|
mService = null;
|
||||||
|
@ -1310,7 +1313,7 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
unbindService();
|
//unbindService();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DataCount {
|
public class DataCount {
|
||||||
|
|
Loading…
Reference in New Issue