Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle java.lang.RuntimeException on fingerprint #2004

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Build;
import android.os.Bundle;

import androidx.core.app.ActivityCompat;
Expand Down Expand Up @@ -147,10 +146,16 @@ protected void onCreate(Bundle savedInstanceState) {
buttonKeyBack.setImageDrawable(ui.getIcon(GoogleMaterial.Icon.gmd_backspace)
.color(ui.getPrimaryTextColor()));

// Handle fingerprint authentication
findViewById(R.id.fpImageView).setVisibility(View.GONE);
Copy link
Contributor

@guanlisheng guanlisheng Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know the reason for producing null here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet... I suppose there is something relete to SDK 34, but still need investigation

findViewById(R.id.fingerprintInfo).setVisibility(View.GONE);
setupLegacyFingerprintAuth();
try {
// Handle fingerprint authentication
findViewById(R.id.fpImageView).setVisibility(View.GONE);
findViewById(R.id.fingerprintInfo).setVisibility(View.GONE);
setupLegacyFingerprintAuth();
} catch (Exception e)
{
// handle java.lang.RuntimeException on
// void android.view.View.setVisibility(int)
}
// TODO setupBiometricPrompt();
}

Expand Down Expand Up @@ -181,6 +186,7 @@ private void onBackspaceClick() {
} else nullRequestFocus = true;
//quick-fix convert 'switch' to 'if-else'
if (getFocus.getId() == R.id.editTextPasscode1) {
// no action
} else if (getFocus.getId() == R.id.editTextPasscode2) {
findViewById(R.id.editTextPasscode1).requestFocus();
if (nullRequestFocus) {
Expand Down Expand Up @@ -228,7 +234,7 @@ private void setupLegacyFingerprintAuth() {
try {
generateKey();
} catch (FingerprintException e) {
e.printStackTrace();
Timber.e(e, "Error generating key");
}
if (initCipher()) {
FingerprintManager.CryptoObject cryptoObject = new FingerprintManager.CryptoObject(cipher);
Expand Down Expand Up @@ -265,7 +271,7 @@ private void generateKey() throws FingerprintException {
| InvalidAlgorithmParameterException
| CertificateException
| IOException exc) {
exc.printStackTrace();
Timber.e(exc, "Error KeySoreException");
throw new FingerprintException(exc);
}

Expand Down
Loading