Skip to content
Snippets Groups Projects

Launch SetupActivity in same task to prevent relaunching from recent apps

Merged akwizgran requested to merge 1189-setup-activity into master
1 unresolved thread
2 files
+ 14
15
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -62,11 +62,10 @@ public abstract class BriarActivity extends BaseActivity {
@@ -62,11 +62,10 @@ public abstract class BriarActivity extends BaseActivity {
@Override
@Override
protected void onActivityResult(int request, int result, Intent data) {
protected void onActivityResult(int request, int result, Intent data) {
super.onActivityResult(request, result, data);
super.onActivityResult(request, result, data);
if (request == REQUEST_PASSWORD && result == RESULT_OK) {
if (request == REQUEST_PASSWORD) {
// PasswordActivity finishes when password was entered correctly.
// The result can be RESULT_CANCELED if there's no account
// When back button is pressed there, it will bring itself back,
if (result == RESULT_OK) briarController.startAndBindService();
// so that we never arrive here with a result that is not OK.
else finish();
briarController.startAndBindService();
} else if (request == REQUEST_UNLOCK && result != RESULT_OK) {
} else if (request == REQUEST_UNLOCK && result != RESULT_OK) {
// We arrive here, if the user presses 'back'
// We arrive here, if the user presses 'back'
// in the Keyguard unlock screen, because UnlockActivity finishes.
// in the Keyguard unlock screen, because UnlockActivity finishes.
@@ -81,13 +80,16 @@ public abstract class BriarActivity extends BaseActivity {
@@ -81,13 +80,16 @@ public abstract class BriarActivity extends BaseActivity {
@Override
@Override
public void onResume() {
public void onResume() {
super.onResume();
super.onResume();
if (!briarController.accountSignedIn()) {
if (!briarController.accountSignedIn() && !isFinishing()) {
 
// Also check that the activity isn't finishing already.
 
// This is possible if we finished in onActivityResult().
 
// Launching another PasswordActivity would cause a loop.
Intent i = new Intent(this, PasswordActivity.class);
Intent i = new Intent(this, PasswordActivity.class);
startActivityForResult(i, REQUEST_PASSWORD);
startActivityForResult(i, REQUEST_PASSWORD);
} else if (lockManager.isLocked() && !isFinishing()) {
} else if (lockManager.isLocked() && !isFinishing()) {
// Also check that the activity isn't finishing already.
// Also check that the activity isn't finishing already.
// This is possible if finishing in onActivityResult().
// This is possible if we finished in onActivityResult().
// Failure to do this check would cause an UnlockActivity loop.
// Lauching another UnlockActivity would cause a loop.
Intent i = new Intent(this, UnlockActivity.class);
Intent i = new Intent(this, UnlockActivity.class);
startActivityForResult(i, REQUEST_UNLOCK);
startActivityForResult(i, REQUEST_UNLOCK);
} else if (SDK_INT >= 23) {
} else if (SDK_INT >= 23) {
Loading