mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Terminate the process after handling a panic trigger.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -23,3 +23,4 @@ local.properties
|
||||
.gradle
|
||||
build/
|
||||
*.iml
|
||||
projectFilesBackup/
|
||||
@@ -14,7 +14,7 @@ import android.view.Window;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.controller.BriarController;
|
||||
import org.briarproject.briar.android.controller.DbController;
|
||||
import org.briarproject.briar.android.controller.handler.UiResultHandler;
|
||||
import org.briarproject.briar.android.controller.handler.ResultHandler;
|
||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||
import org.briarproject.briar.android.login.PasswordActivity;
|
||||
import org.briarproject.briar.android.panic.ExitActivity;
|
||||
@@ -116,17 +116,28 @@ public abstract class BriarActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
protected void signOut(final boolean removeFromRecentApps) {
|
||||
briarController.signOut(new UiResultHandler<Void>(this) {
|
||||
@Override
|
||||
public void onResultUi(Void result) {
|
||||
if (removeFromRecentApps) startExitActivity();
|
||||
else finishAndExit();
|
||||
}
|
||||
});
|
||||
if (briarController.hasEncryptionKey()) {
|
||||
// Don't use UiResultHandler because we want the result even if
|
||||
// this activity has been destroyed
|
||||
briarController.signOut(new ResultHandler<Void>() {
|
||||
@Override
|
||||
public void onResult(Void result) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
exit(removeFromRecentApps);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
exit(removeFromRecentApps);
|
||||
}
|
||||
}
|
||||
|
||||
protected void signOut() {
|
||||
signOut(false);
|
||||
private void exit(boolean removeFromRecentApps) {
|
||||
if (removeFromRecentApps) startExitActivity();
|
||||
else finishAndExit();
|
||||
}
|
||||
|
||||
private void startExitActivity() {
|
||||
|
||||
@@ -188,7 +188,7 @@ public class NavDrawerActivity extends BriarActivity implements
|
||||
} else if (getSupportFragmentManager().getBackStackEntryCount() == 0 &&
|
||||
getSupportFragmentManager()
|
||||
.findFragmentByTag(ContactListFragment.TAG) == null) {
|
||||
/**
|
||||
/*
|
||||
* This Makes sure that the first fragment (ContactListFragment) the
|
||||
* user sees is the same as the last fragment the user sees before
|
||||
* exiting. This models the typical Google navigation behaviour such
|
||||
@@ -212,11 +212,10 @@ public class NavDrawerActivity extends BriarActivity implements
|
||||
drawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void signOut() {
|
||||
private void signOut() {
|
||||
drawerLayout.setDrawerLockMode(LOCK_MODE_LOCKED_CLOSED);
|
||||
startFragment(new SignOutFragment());
|
||||
super.signOut();
|
||||
signOut(false);
|
||||
}
|
||||
|
||||
private void startFragment(BaseFragment fragment, int itemId){
|
||||
|
||||
@@ -57,8 +57,7 @@ public class PanicResponderActivity extends BriarActivity {
|
||||
LOG.info("Received Panic Trigger...");
|
||||
|
||||
if (PanicResponder.receivedTriggerFromConnectedApp(this)) {
|
||||
LOG.info("Panic Trigger came from connected app.");
|
||||
LOG.info("Performing destructive responses...");
|
||||
LOG.info("Panic Trigger came from connected app");
|
||||
|
||||
// Performing panic responses
|
||||
if (sharedPref.getBoolean(KEY_UNINSTALL, false)) {
|
||||
@@ -73,21 +72,13 @@ public class PanicResponderActivity extends BriarActivity {
|
||||
} else if (sharedPref.getBoolean(KEY_PURGE, false)) {
|
||||
LOG.info("Purging all data...");
|
||||
deleteAllData();
|
||||
} else if (sharedPref.getBoolean(KEY_LOCK, false)) {
|
||||
} else if (sharedPref.getBoolean(KEY_LOCK, true)) {
|
||||
LOG.info("Signing out...");
|
||||
signOut(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// received intent from non-trusted app
|
||||
else {
|
||||
intent = getIntent();
|
||||
if (intent != null && Panic.isTriggerIntent(intent)) {
|
||||
LOG.info("Signing out...");
|
||||
signOut(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
finishAndRemoveTask();
|
||||
|
||||
Reference in New Issue
Block a user