1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 12:44:42 +00:00

Prevent crash

This commit is contained in:
M66B 2021-09-23 07:35:00 +02:00
parent f340f95201
commit d440f2562f

View file

@ -1783,8 +1783,26 @@ public class Helper {
if (!TextUtils.isEmpty(pin))
return true;
BiometricManager bm = BiometricManager.from(context);
return (bm.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK) == BiometricManager.BIOMETRIC_SUCCESS);
try {
BiometricManager bm = BiometricManager.from(context);
return (bm.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK) == BiometricManager.BIOMETRIC_SUCCESS);
} catch (Throwable ex) {
/*
java.lang.SecurityException: eu.faircode.email from uid 10377 not allowed to perform USE_FINGERPRINT
at android.os.Parcel.createException(Parcel.java:1953)
at android.os.Parcel.readException(Parcel.java:1921)
at android.os.Parcel.readException(Parcel.java:1871)
at android.hardware.fingerprint.IFingerprintService$Stub$Proxy.isHardwareDetected(IFingerprintService.java:460)
at android.hardware.fingerprint.FingerprintManager.isHardwareDetected(FingerprintManager.java:792)
at androidx.core.hardware.fingerprint.FingerprintManagerCompat.isHardwareDetected(SourceFile:3)
at androidx.biometric.BiometricManager.canAuthenticateWithFingerprint(SourceFile:3)
at androidx.biometric.BiometricManager.canAuthenticateWithFingerprintOrUnknownBiometric(SourceFile:2)
at androidx.biometric.BiometricManager.canAuthenticateCompat(SourceFile:10)
at androidx.biometric.BiometricManager.canAuthenticate(SourceFile:5)
*/
Log.e(ex);
return false;
}
}
static boolean shouldAuthenticate(Context context) {