Merge pull request #1293 from alexbakker/disable-unlock-button

Disable the unlock button until the slot decryption task is done
This commit is contained in:
Michael Schättgen 2024-03-13 16:27:44 +01:00 committed by GitHub
commit b59350337f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,6 +57,7 @@ public class AuthActivity extends AegisActivity {
private SecretKey _bioKey;
private BiometricSlot _bioSlot;
private BiometricPrompt _bioPrompt;
private Button _decryptButton;
private int _failedUnlockAttempts;
@ -70,14 +71,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;
});
@ -148,7 +149,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);
@ -157,6 +158,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 -> {
@ -337,6 +340,7 @@ public class AuthActivity extends AegisActivity {
finish(result.getKey(), result.isSlotRepaired());
} else {
_decryptButton.setEnabled(true);
onInvalidPassword();
}
}