From f9b085e73f06b732cb3107a93eee49e8a6bf5353 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sun, 13 Dec 2020 22:44:30 +0100 Subject: [PATCH] Fix min setting version and condition in Android R --- .../com/kunzisoft/keepass/biometric/AdvancedUnlockManager.kt | 4 +--- .../kunzisoft/keepass/settings/NestedAppSettingsFragment.kt | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockManager.kt b/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockManager.kt index 0e0131069..0788e6b3d 100644 --- a/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockManager.kt +++ b/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockManager.kt @@ -143,7 +143,7 @@ class AdvancedUnlockManager(private var retrieveContext: () -> FragmentActivity) // Require the user to authenticate with a fingerprint to authorize every use // of the key, don't use it for device credential because it's the user authentication .apply { - if (isBiometricOperation()) { + if (biometricUnlockEnable) { setUserAuthenticationRequired(true) } } @@ -170,7 +170,6 @@ class AdvancedUnlockManager(private var retrieveContext: () -> FragmentActivity) return } try { - // TODO if (keyguardManager?.isDeviceSecure == true) { getSecretKey()?.let { secretKey -> cipher?.let { cipher -> cipher.init(Cipher.ENCRYPT_MODE, secretKey) @@ -221,7 +220,6 @@ class AdvancedUnlockManager(private var retrieveContext: () -> FragmentActivity) return } try { - // TODO if (keyguardManager?.isDeviceSecure == true) { // important to restore spec here that was used for decryption val iv = Base64.decode(ivSpecValue, Base64.NO_WRAP) val spec = IvParameterSpec(iv) diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt index 147bb1456..376c92801 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/NestedAppSettingsFragment.kt @@ -258,7 +258,7 @@ class NestedAppSettingsFragment : NestedSettingsFragment() { } } - val deviceCredentialUnlockSupported = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + val deviceCredentialUnlockSupported = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { AdvancedUnlockManager.deviceCredentialUnlockSupported(activity) } else false deviceCredentialUnlockEnablePreference?.apply { @@ -266,7 +266,7 @@ class NestedAppSettingsFragment : NestedSettingsFragment() { isChecked = false setOnPreferenceClickListener { preference -> (preference as SwitchPreference).isChecked = false - UnavailableFeatureDialogFragment.getInstance(Build.VERSION_CODES.LOLLIPOP) + UnavailableFeatureDialogFragment.getInstance(Build.VERSION_CODES.M) .show(parentFragmentManager, "unavailableFeatureDialog") false }