Disable biometric unlock when we disable pin code unlock (#6781)
* Disable biometric unlock when we disable pin code unlock
This commit is contained in:
parent
4e3853a718
commit
e3d1a811d5
5 changed files with 19 additions and 5 deletions
|
|
@ -43,7 +43,7 @@ class DefaultLockScreenService(
|
|||
private val coroutineScope: CoroutineScope,
|
||||
private val sessionObserver: SessionObserver,
|
||||
private val appForegroundStateService: AppForegroundStateService,
|
||||
biometricAuthenticatorManager: BiometricAuthenticatorManager,
|
||||
private val biometricAuthenticatorManager: BiometricAuthenticatorManager,
|
||||
) : LockScreenService {
|
||||
private val _lockState = MutableStateFlow<LockScreenLockState>(LockScreenLockState.Unlocked)
|
||||
override val lockState: StateFlow<LockScreenLockState> = _lockState
|
||||
|
|
@ -81,6 +81,7 @@ class DefaultLockScreenService(
|
|||
override suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) {
|
||||
if (wasLastSession) {
|
||||
pinCodeManager.deletePinCode()
|
||||
biometricAuthenticatorManager.disable()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@ interface BiometricAuthenticatorManager {
|
|||
fun addCallback(callback: BiometricAuthenticator.Callback)
|
||||
fun removeCallback(callback: BiometricAuthenticator.Callback)
|
||||
|
||||
/**
|
||||
* Disable using the biometric unlock feature and remove any data associated with it.
|
||||
*/
|
||||
suspend fun disable()
|
||||
|
||||
/**
|
||||
* Remember a biometric authenticator ready for unlocking the app.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -80,10 +80,7 @@ class DefaultBiometricAuthenticatorManager(
|
|||
|
||||
private val internalCallback = object : DefaultBiometricUnlockCallback() {
|
||||
override fun onBiometricSetupError() {
|
||||
coroutineScope.launch {
|
||||
lockScreenStore.setIsBiometricUnlockAllowed(false)
|
||||
secretKeyRepository.deleteKey(SECRET_KEY_ALIAS)
|
||||
}
|
||||
coroutineScope.launch { disable() }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,6 +117,11 @@ class DefaultBiometricAuthenticatorManager(
|
|||
)
|
||||
}
|
||||
|
||||
override suspend fun disable() {
|
||||
lockScreenStore.setIsBiometricUnlockAllowed(false)
|
||||
secretKeyRepository.deleteKey(SECRET_KEY_ALIAS)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun rememberBiometricAuthenticator(
|
||||
isAvailable: Boolean,
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class LockScreenSettingsPresenter(
|
|||
if (showRemovePinConfirmation) {
|
||||
showRemovePinConfirmation = false
|
||||
pinCodeManager.deletePinCode()
|
||||
biometricAuthenticatorManager.disable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class FakeBiometricAuthenticatorManager(
|
|||
override var isDeviceSecured: Boolean = true,
|
||||
override var hasAvailableAuthenticator: Boolean = false,
|
||||
private val createBiometricAuthenticator: () -> BiometricAuthenticator = { FakeBiometricAuthenticator() },
|
||||
private val disableLambda: suspend () -> Unit = { },
|
||||
) : BiometricAuthenticatorManager {
|
||||
override fun addCallback(callback: BiometricAuthenticator.Callback) {
|
||||
// no-op
|
||||
|
|
@ -37,4 +38,8 @@ class FakeBiometricAuthenticatorManager(
|
|||
createBiometricAuthenticator()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun disable() {
|
||||
disableLambda()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue