Merge branch 'fix_bug_63' of https://github.com/arrase/orbot into arrase-fix_bug_63

Conflicts:
	app/src/main/java/org/torproject/android/OrbotMainActivity.java
This commit is contained in:
Nathan Freitas 2017-01-14 06:45:43 -05:00
commit cb2c5fe661
1 changed files with 14 additions and 5 deletions

View File

@ -114,7 +114,7 @@ public class OrbotMainActivity extends AppCompatActivity
private ActionBarDrawerToggle mDrawerToggle; private ActionBarDrawerToggle mDrawerToggle;
/* Some tracking bits */ /* Some tracking bits */
private String torStatus = TorServiceConstants.STATUS_OFF; //latest status reported from the tor service private String torStatus = null; //latest status reported from the tor service
private Intent lastStatusIntent; // the last ACTION_STATUS Intent received private Intent lastStatusIntent; // the last ACTION_STATUS Intent received
private SharedPreferences mPrefs = null; private SharedPreferences mPrefs = null;
@ -1287,9 +1287,18 @@ public class OrbotMainActivity extends AppCompatActivity
if (autoStartFromIntent) if (autoStartFromIntent)
{ {
autoStartFromIntent = false; autoStartFromIntent = false;
Intent resultIntent = lastStatusIntent; Intent resultIntent = lastStatusIntent;
resultIntent.putExtra(TorServiceConstants.EXTRA_STATUS, torStatus);
setResult(RESULT_OK, resultIntent); if (resultIntent == null)
resultIntent = new Intent(TorServiceConstants.ACTION_START);
resultIntent.putExtra(
TorServiceConstants.EXTRA_STATUS,
torStatus == null?TorServiceConstants.STATUS_OFF:torStatus
);
setResult(RESULT_OK, resultIntent);
finish(); finish();
Log.d(TAG, "autoStartFromIntent finish"); Log.d(TAG, "autoStartFromIntent finish");
} }
@ -1390,7 +1399,7 @@ public class OrbotMainActivity extends AppCompatActivity
String newTorStatus = msg.getData().getString("status"); String newTorStatus = msg.getData().getString("status");
String log = (String)msg.obj; String log = (String)msg.obj;
if (torStatus == null && newTorStatus != null) //first time status if (torStatus == null && newTorStatus != null) //first time status
{ {
torStatus = newTorStatus; torStatus = newTorStatus;