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

(cherry picked from commit 467ceacb17770399fd1f276aebe887bafb516f49)
This commit is contained in:
Ivan Iskandar 2022-09-24 21:46:35 +07:00 committed by Jobobby04
parent c34108b19d
commit 1fe34a35d7

View File

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