emansih / FireflyMobile

Mobile Application for Firefly III written in Kotlin
GNU General Public License v3.0
323 stars 48 forks source link

"security" setting disabled even though Pin is configured #224

Closed apollo13 closed 1 year ago

apollo13 commented 2 years ago

Firefly III Server Version: 5.7.9

Firefly III Mobile Version: 5.0.7

Android Version: 10

Device Information:

I'd like to go into settings and enable "security"

Current Behavior

"security" is disabled and say "please enable pin / password / biometrics in your device settings"

Steps to Reproduce

Not sure how to reproduce. My device is secured with a PIN and has a few fingers registered. Is there any way I can get more information about why the current check fails?

apollo13 commented 2 years ago

I think I found the issue, FireflyMobile does test support via:

https://github.com/emansih/FireflyMobile/blob/4c7d3d121ca5127d19d5070f9b51c32f9ca047a0/app/src/main/java/xyz/hisname/fireflyiii/ui/settings/SettingsFragment.kt#L204-L205

The Android API docs https://developer.android.com/reference/androidx/biometric/BiometricManager#canAuthenticate(int) note:

Note that not all combinations of authenticator types are supported prior to Android 11 (API 30). Specifically, DEVICE_CREDENTIAL alone is unsupported prior to API 30, and BIOMETRIC_STRONG | DEVICE_CREDENTIAL is unsupported on API 28-29. Developers that wish to check for the presence of a PIN, pattern, or password on these versions should instead use [KeyguardManager.isDeviceSecure()](https://developer.android.com/reference/android/app/KeyguardManager.html#isDeviceSecure()).

this seems to suggest that on Android 10 canAuthenticate(BiometricManager.Authenticators.DEVICE_CREDENTIAL) will never return True and as such will not work. Does this make sense?

apollo13 commented 2 years ago

I have verified that the attached PR fixes the issue and imo it seems to correct to actually ask for biometric authenticators. That said I am not really familiar with Android APIs.