[fenix] For https://github.com/mozilla-mobile/fenix/issues/7603 - Temporarily do not show biometric prompt for OnePlus devices

pull/600/head
Emily Kager 5 years ago committed by Jeff Boek
parent aab266a1c8
commit 3d6673cd60

@ -140,15 +140,23 @@ class LoginsFragment : PreferenceFragmentCompat(), AccountObserver {
override fun onAuthenticationProblems() = updateSyncPreferenceNeedsReauth() override fun onAuthenticationProblems() = updateSyncPreferenceNeedsReauth()
val isHardwareAvailable: Boolean by lazy { val isHardwareAvailable: Boolean by lazy {
if (Build.VERSION.SDK_INT >= M) { // Temporary fix for certain devices that can't use the current biometrics library
context?.let { // https://github.com/mozilla-mobile/fenix/issues/7603
val bm = BiometricManager.from(it) when {
val canAuthenticate = bm.canAuthenticate() Build.MANUFACTURER.toLowerCase().contains("oneplus") -> {
!(canAuthenticate == BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE || false
canAuthenticate == BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE) }
} ?: false Build.VERSION.SDK_INT >= M -> {
} else { context?.let {
false val bm = BiometricManager.from(it)
val canAuthenticate = bm.canAuthenticate()
!(canAuthenticate == BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE ||
canAuthenticate == BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE)
} ?: false
}
else -> {
false
}
} }
} }

Loading…
Cancel
Save