Merge pull request #529 from alexbakker/fix-bioprompt-mixup

Fix behavior of AuthActivity under certain conditions
This commit is contained in:
Michael Schättgen 2020-08-01 13:34:09 +02:00 committed by GitHub
commit 7e403c2af6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 6 deletions

View file

@ -150,7 +150,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

@ -90,7 +90,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;
@ -190,11 +194,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();
} }
@ -218,6 +223,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();