mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Disable the unlock button until the slot decryption task is done
This prevents a crash that could occur when double tapping the Unlock button.
This commit is contained in:
parent
f7bac4331e
commit
6bd8521661
1 changed files with 7 additions and 3 deletions
|
@ -59,6 +59,7 @@ public class AuthActivity extends AegisActivity {
|
|||
private SecretKey _bioKey;
|
||||
private BiometricSlot _bioSlot;
|
||||
private BiometricPrompt _bioPrompt;
|
||||
private Button _decryptButton;
|
||||
|
||||
private int _failedUnlockAttempts;
|
||||
|
||||
|
@ -72,14 +73,14 @@ public class AuthActivity extends AegisActivity {
|
|||
setContentView(R.layout.activity_auth);
|
||||
_textPassword = findViewById(R.id.text_password);
|
||||
LinearLayout boxBiometricInfo = findViewById(R.id.box_biometric_info);
|
||||
Button decryptButton = findViewById(R.id.button_decrypt);
|
||||
_decryptButton = findViewById(R.id.button_decrypt);
|
||||
TextView biometricsButton = findViewById(R.id.button_biometrics);
|
||||
|
||||
getOnBackPressedDispatcher().addCallback(this, new BackPressHandler());
|
||||
|
||||
_textPassword.setOnEditorActionListener((v, actionId, event) -> {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
|
||||
decryptButton.performClick();
|
||||
_decryptButton.performClick();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
@ -150,7 +151,7 @@ public class AuthActivity extends AegisActivity {
|
|||
}
|
||||
}
|
||||
|
||||
decryptButton.setOnClickListener(v -> {
|
||||
_decryptButton.setOnClickListener(v -> {
|
||||
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||
|
||||
|
@ -159,6 +160,8 @@ public class AuthActivity extends AegisActivity {
|
|||
PasswordSlotDecryptTask.Params params = new PasswordSlotDecryptTask.Params(slots, password);
|
||||
PasswordSlotDecryptTask task = new PasswordSlotDecryptTask(AuthActivity.this, new PasswordDerivationListener());
|
||||
task.execute(getLifecycle(), params);
|
||||
|
||||
_decryptButton.setEnabled(false);
|
||||
});
|
||||
|
||||
biometricsButton.setOnClickListener(v -> {
|
||||
|
@ -345,6 +348,7 @@ public class AuthActivity extends AegisActivity {
|
|||
|
||||
finish(result.getKey(), result.isSlotRepaired());
|
||||
} else {
|
||||
_decryptButton.setEnabled(true);
|
||||
onInvalidPassword();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue