mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-06-06 14:50:17 +00:00
Remove unused 'stateless' support code from AuthActivity
This commit is contained in:
parent
2242dbc6cd
commit
158eb4609c
1 changed files with 17 additions and 40 deletions
|
@ -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,21 +93,16 @@ 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 {
|
try {
|
||||||
vaultFile = getApp().loadVaultFile();
|
VaultFile vaultFile = getApp().loadVaultFile();
|
||||||
|
_slots = vaultFile.getHeader().getSlots();
|
||||||
} catch (VaultManagerException e) {
|
} catch (VaultManagerException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Dialogs.showErrorDialog(this, R.string.vault_load_error, e, (dialog, which) -> onBackPressed());
|
Dialogs.showErrorDialog(this, R.string.vault_load_error, e, (dialog, which) -> onBackPressed());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_slots = vaultFile.getHeader().getSlots();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
||||||
if (_slots.has(BiometricSlot.class) && BiometricsHelper.isAvailable(this)) {
|
if (_slots.has(BiometricSlot.class) && BiometricsHelper.isAvailable(this)) {
|
||||||
boolean invalidated = false;
|
boolean invalidated = false;
|
||||||
|
@ -181,12 +175,8 @@ public class AuthActivity extends AegisActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (_stateless) {
|
|
||||||
super.onBackPressed();
|
|
||||||
} else {
|
|
||||||
finishAffinity();
|
finishAffinity();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
@ -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,12 +265,6 @@ 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) {
|
|
||||||
// send the master key back to the calling activity
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.putExtra("creds", creds);
|
|
||||||
setResult(RESULT_OK, intent);
|
|
||||||
} else {
|
|
||||||
try {
|
try {
|
||||||
AegisApplication app = getApp();
|
AegisApplication app = getApp();
|
||||||
app.initVaultManager(app.loadVaultFile(), creds);
|
app.initVaultManager(app.loadVaultFile(), creds);
|
||||||
|
@ -299,8 +278,6 @@ public class AuthActivity extends AegisActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
setResult(RESULT_OK);
|
setResult(RESULT_OK);
|
||||||
}
|
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue