Fix behavior of AuthActivity under certain conditions

- Properly use 'inhibitBioPrompt'
- Don't show the biometric prompt when a password reminder is needed
This commit is contained in:
Alexander Bakker 2020-07-05 19:49:51 +02:00
parent 57ef52d6ff
commit ba3e6203ec
3 changed files with 16 additions and 6 deletions

View file

@ -143,7 +143,7 @@ public abstract class AegisActivity extends AppCompatActivity implements AegisAp
* Reports whether this Activity instance has become an orphan. This can happen if * Reports whether this Activity instance has become an orphan. This can happen if
* the vault was locked by an external trigger while the Activity was still open. * the vault was locked by an external trigger while the Activity was still open.
*/ */
private boolean isOrphan() { protected boolean isOrphan() {
return !(this instanceof MainActivity) && !(this instanceof AuthActivity) && _app.isVaultLocked(); return !(this instanceof MainActivity) && !(this instanceof AuthActivity) && _app.isVaultLocked();
} }

View file

@ -84,7 +84,11 @@ public class AuthActivity extends AegisActivity {
}); });
Intent intent = getIntent(); Intent intent = getIntent();
_inhibitBioPrompt = savedInstanceState == null ? !intent.getBooleanExtra("_inhibitBioPrompt", true) : savedInstanceState.getBoolean("_inhibitBioPrompt"); if (savedInstanceState == null) {
_inhibitBioPrompt = intent.getBooleanExtra("inhibitBioPrompt", false);
} else {
_inhibitBioPrompt = savedInstanceState.getBoolean("inhibitBioPrompt", false);
}
_cancelAction = (CancelAction) intent.getSerializableExtra("cancelAction"); _cancelAction = (CancelAction) intent.getSerializableExtra("cancelAction");
_slots = (SlotList) intent.getSerializableExtra("slots"); _slots = (SlotList) intent.getSerializableExtra("slots");
_stateless = _slots != null; _stateless = _slots != null;
@ -207,11 +211,12 @@ public class AuthActivity extends AegisActivity {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (_bioKey == null || _prefs.isPasswordReminderNeeded()) { boolean remindPassword = _prefs.isPasswordReminderNeeded();
if (_bioKey == null || remindPassword) {
focusPasswordField(); focusPasswordField();
} }
if (_bioKey != null && _bioPrompt == null && !_inhibitBioPrompt) { if (_bioKey != null && _bioPrompt == null && !_inhibitBioPrompt && !remindPassword) {
_bioPrompt = showBiometricPrompt(); _bioPrompt = showBiometricPrompt();
} }
@ -235,6 +240,11 @@ 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);

View file

@ -491,7 +491,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
} }
if (_app.isVaultLocked()) { if (_app.isVaultLocked()) {
startAuthActivity(true); startAuthActivity(false);
} else if (_loaded) { } else if (_loaded) {
// update the list of groups in the filter menu // update the list of groups in the filter menu
if (_menu != null) { if (_menu != null) {
@ -753,7 +753,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
_loaded = false; _loaded = false;
if (isOpen()) { if (isOpen()) {
startAuthActivity(false); startAuthActivity(true);
} }
super.onLocked(); super.onLocked();