Fix min setting version and condition in Android R

This commit is contained in:
J-Jamet
2020-12-13 22:44:30 +01:00
parent 388cf6a91b
commit f9b085e73f
2 changed files with 3 additions and 5 deletions

View File

@@ -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)

View File

@@ -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
}