Remove unused 'stateless' support code from AuthActivity

This commit is contained in:
Alexander Bakker 2021-02-13 19:15:30 +01:00
parent 2242dbc6cd
commit 158eb4609c

View file

@ -65,7 +65,6 @@ public class AuthActivity extends AegisActivity {
private boolean _inhibitBioPrompt; private boolean _inhibitBioPrompt;
private Preferences _prefs; private Preferences _prefs;
private boolean _stateless;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -94,19 +93,14 @@ public class AuthActivity extends AegisActivity {
} else { } else {
_inhibitBioPrompt = savedInstanceState.getBoolean("inhibitBioPrompt", false); _inhibitBioPrompt = savedInstanceState.getBoolean("inhibitBioPrompt", false);
} }
_slots = (SlotList) intent.getSerializableExtra("slots");
_stateless = _slots != null;
if (!_stateless) {
VaultFile vaultFile;
try {
vaultFile = getApp().loadVaultFile();
} catch (VaultManagerException e) {
e.printStackTrace();
Dialogs.showErrorDialog(this, R.string.vault_load_error, e, (dialog, which) -> onBackPressed());
return;
}
try {
VaultFile vaultFile = getApp().loadVaultFile();
_slots = vaultFile.getHeader().getSlots(); _slots = vaultFile.getHeader().getSlots();
} catch (VaultManagerException e) {
e.printStackTrace();
Dialogs.showErrorDialog(this, R.string.vault_load_error, e, (dialog, which) -> onBackPressed());
return;
} }
// only show the biometric prompt if the api version is new enough, permission is granted, a scanner is found and a biometric slot is found // only show the biometric prompt if the api version is new enough, permission is granted, a scanner is found and a biometric slot is found
@ -181,11 +175,7 @@ public class AuthActivity extends AegisActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (_stateless) { finishAffinity();
super.onBackPressed();
} else {
finishAffinity();
}
} }
@Override @Override
@ -221,11 +211,6 @@ public class AuthActivity extends AegisActivity {
} }
} }
@Override
protected boolean isOrphan() {
return _stateless && super.isOrphan();
}
private void focusPasswordField() { private void focusPasswordField() {
_textPassword.requestFocus(); _textPassword.requestFocus();
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
@ -280,27 +265,19 @@ public class AuthActivity extends AegisActivity {
private void finish(MasterKey key, boolean isSlotRepaired) { private void finish(MasterKey key, boolean isSlotRepaired) {
VaultFileCredentials creds = new VaultFileCredentials(key, _slots); VaultFileCredentials creds = new VaultFileCredentials(key, _slots);
if (_stateless) { try {
// send the master key back to the calling activity AegisApplication app = getApp();
Intent intent = new Intent(); app.initVaultManager(app.loadVaultFile(), creds);
intent.putExtra("creds", creds); if (isSlotRepaired) {
setResult(RESULT_OK, intent); saveVault(true);
} else {
try {
AegisApplication app = getApp();
app.initVaultManager(app.loadVaultFile(), creds);
if (isSlotRepaired) {
saveVault(true);
}
} catch (VaultManagerException e) {
e.printStackTrace();
Dialogs.showErrorDialog(this, R.string.decryption_corrupt_error, e);
return;
} }
} catch (VaultManagerException e) {
setResult(RESULT_OK); e.printStackTrace();
Dialogs.showErrorDialog(this, R.string.decryption_corrupt_error, e);
return;
} }
setResult(RESULT_OK);
finish(); finish();
} }