Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a82b416 authored by Chandru S's avatar Chandru S
Browse files

Remove dependencies on legacy keyguard state for the isUnlocked state

Change how device entry and face auth bypass flows are wired up.

Fixes: 307768356
Test: updated existing unit tests, verified device entry scenarios with
flexiglass
Test: atest DeviceUnlockedInteractorTest
Test: manually
  1. Enroll fingerprint and unlocking using fingerprint should dismiss lockscreen
  2. Enroll face auth with bypass enabled, lockscreen should be dismissed on success
  3. Enroll face auth without bypass enabled, lockscreen should not be dismissed on success
  4. Enroll trust agent, keep device unlocked using trust agent, lockscreen should not be dismissed
  5. Enter pin/pattern/password, lockscreen should get dismissed.
  6. Set auth method to swipe, lockscreen should be visible and swiping up should dismiss it.
  7. Set auth method to none, lockscreen should not be seen when waking up from sleep

Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT

Change-Id: Idfa2cf740cfebf7092d76fd6a1083a594d0f412e
parent ab57e5b3
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -47,15 +47,16 @@ import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor
import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants
import com.android.systemui.classifier.FalsingA11yDelegate
import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
import com.android.systemui.flags.FakeFeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.keyboard.data.repository.FakeKeyboardRepository
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFingerprintAuthRepository
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
import com.android.systemui.keyguard.shared.model.SuccessFingerprintAuthenticationStatus
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.testScope
import com.android.systemui.log.SessionTracker
@@ -832,7 +833,9 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {

            // While listening, going from the bouncer scene to the gone scene, does dismiss the
            // keyguard.
            kosmos.fakeDeviceEntryRepository.setUnlocked(true)
            kosmos.fakeDeviceEntryFingerprintAuthRepository.setAuthenticationStatus(
                SuccessFingerprintAuthenticationStatus(0, true)
            )
            runCurrent()
            fakeSceneDataSource.pause()
            sceneInteractor.changeScene(Scenes.Gone, "reason")
+5 −5
Original line number Diff line number Diff line
@@ -122,7 +122,6 @@ class BouncerMessageViewModelTest : SysuiTestCase() {
            repeat(FakeAuthenticationRepository.MAX_FAILED_AUTH_TRIES_BEFORE_LOCKOUT) {
                bouncerInteractor.authenticate(WRONG_PIN)
            }
            assertThat(message?.isUpdateAnimated).isFalse()

            val lockoutEndMs = authenticationInteractor.lockoutEndTimestamp ?: 0
            advanceTimeBy(lockoutEndMs - testScope.currentTime)
@@ -133,6 +132,7 @@ class BouncerMessageViewModelTest : SysuiTestCase() {
    fun lockoutMessage() =
        testScope.runTest {
            val message by collectLastValue(underTest.message)
            val lockoutSeconds = FakeAuthenticationRepository.LOCKOUT_DURATION_SECONDS
            kosmos.fakeAuthenticationRepository.setAuthenticationMethod(Pin)
            assertThat(kosmos.fakeAuthenticationRepository.lockoutEndTimestamp).isNull()
            runCurrent()
@@ -140,14 +140,14 @@ class BouncerMessageViewModelTest : SysuiTestCase() {
            repeat(FakeAuthenticationRepository.MAX_FAILED_AUTH_TRIES_BEFORE_LOCKOUT) { times ->
                bouncerInteractor.authenticate(WRONG_PIN)
                runCurrent()
                if (times < FakeAuthenticationRepository.MAX_FAILED_AUTH_TRIES_BEFORE_LOCKOUT - 1) {
                if (times == FakeAuthenticationRepository.MAX_FAILED_AUTH_TRIES_BEFORE_LOCKOUT) {
                    assertTryAgainMessage(message?.text, lockoutSeconds)
                    assertThat(message?.isUpdateAnimated).isFalse()
                } else {
                    assertThat(message?.text).isEqualTo("Wrong PIN. Try again.")
                    assertThat(message?.isUpdateAnimated).isTrue()
                }
            }
            val lockoutSeconds = FakeAuthenticationRepository.LOCKOUT_DURATION_SECONDS
            assertTryAgainMessage(message?.text, lockoutSeconds)
            assertThat(message?.isUpdateAnimated).isFalse()

            repeat(FakeAuthenticationRepository.LOCKOUT_DURATION_SECONDS) { time ->
                advanceTimeBy(1.seconds)
+0 −3
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import com.android.systemui.authentication.shared.model.AuthenticationMethodMode
import com.android.systemui.bouncer.domain.interactor.bouncerInteractor
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectValues
import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository
import com.android.systemui.inputmethod.data.model.InputMethodModel
import com.android.systemui.inputmethod.data.repository.fakeInputMethodRepository
import com.android.systemui.inputmethod.domain.interactor.inputMethodInteractor
@@ -153,7 +152,6 @@ class PasswordBouncerViewModelTest : SysuiTestCase() {
            kosmos.fakeAuthenticationRepository.setAuthenticationMethod(
                AuthenticationMethodModel.Password
            )
            kosmos.fakeDeviceEntryRepository.setUnlocked(false)
            switchToScene(Scenes.Bouncer)

            // No input entered.
@@ -329,7 +327,6 @@ class PasswordBouncerViewModelTest : SysuiTestCase() {
        kosmos.fakeAuthenticationRepository.setAuthenticationMethod(
            AuthenticationMethodModel.Password
        )
        kosmos.fakeDeviceEntryRepository.setUnlocked(false)
        switchToScene(Scenes.Bouncer)
    }

+0 −2
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import com.android.systemui.authentication.shared.model.AuthenticationMethodMode
import com.android.systemui.authentication.shared.model.AuthenticationPatternCoordinate as Point
import com.android.systemui.bouncer.domain.interactor.bouncerInteractor
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository
import com.android.systemui.kosmos.testScope
import com.android.systemui.res.R
import com.android.systemui.scene.domain.interactor.sceneInteractor
@@ -373,7 +372,6 @@ class PatternBouncerViewModelTest : SysuiTestCase() {
        kosmos.fakeAuthenticationRepository.setAuthenticationMethod(
            AuthenticationMethodModel.Pattern
        )
        kosmos.fakeDeviceEntryRepository.setUnlocked(false)
        switchToScene(Scenes.Bouncer)
    }

+0 −2
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import com.android.systemui.bouncer.data.repository.fakeSimBouncerRepository
import com.android.systemui.bouncer.domain.interactor.bouncerInteractor
import com.android.systemui.bouncer.domain.interactor.simBouncerInteractor
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository
import com.android.systemui.kosmos.testScope
import com.android.systemui.res.R
import com.android.systemui.scene.domain.interactor.sceneInteractor
@@ -387,7 +386,6 @@ class PinBouncerViewModelTest : SysuiTestCase() {

    private fun TestScope.lockDeviceAndOpenPinBouncer() {
        kosmos.fakeAuthenticationRepository.setAuthenticationMethod(AuthenticationMethodModel.Pin)
        kosmos.fakeDeviceEntryRepository.setUnlocked(false)
        switchToScene(Scenes.Bouncer)
    }

Loading