SecureActivityDelegate: Fix cold-start only lock behavior (#8066)

This commit is contained in:
Ivan Iskandar 2022-09-24 21:46:35 +07:00 committed by GitHub
parent 2d22baba62
commit 467ceacb17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,8 +25,8 @@ interface SecureActivityDelegate {
companion object {
fun onApplicationCreated() {
val lockDelay = Injekt.get<SecurityPreferences>().lockAppAfter().get()
if (lockDelay == 0) {
// Restore always active app lock
if (lockDelay <= 0) {
// Restore always active/on start app lock
// Delayed lock will be restored later on activity resume
lockState = LockState.ACTIVE
}
@ -39,8 +39,12 @@ interface SecureActivityDelegate {
preferences.lastAppClosed().set(Date().time)
}
if (!AuthenticatorUtil.isAuthenticating) {
lockState = if (preferences.lockAppAfter().get() >= 0) {
val lockAfter = preferences.lockAppAfter().get()
lockState = if (lockAfter > 0) {
LockState.PENDING
} else if (lockAfter == -1) {
// Never lock on idle
LockState.INACTIVE
} else {
LockState.ACTIVE
}