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

Commit 893f2b46 authored by Beverly's avatar Beverly
Browse files

Reset face isAuthenticated on keyguardDoneAnimationsFinished

Instead of onKeyguardGoingAway. We don't want the isUnlocked
state to be FALSE until all the keyguardDone animations are
finished.

Test: manually auth with face and then swipe up the bouncer.
Observe there aren't bouncer artifacts on the display.
Test: atest DeviceEntryFaceAuthRepositoryTest
Fixes: 314848760
Flag: NONE

Change-Id: I8b0c826653fb2a15765f7b3f5b7d1bb1be9f4416
parent 145259a2
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -827,7 +827,7 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
        }

    @Test
    fun isAuthenticatedIsResetToFalseWhenKeyguardIsGoingAway() =
    fun isAuthenticatedIsResetToFalseWhenDeviceStartsGoingToSleep() =
        testScope.runTest {
            initCollectors()
            allPreconditionsToRunFaceAuthAreTrue()
@@ -840,13 +840,13 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {

            assertThat(authenticated()).isTrue()

            keyguardRepository.setKeyguardGoingAway(true)
            powerInteractor.setAsleepForTest()

            assertThat(authenticated()).isFalse()
        }

    @Test
    fun isAuthenticatedIsResetToFalseWhenDeviceStartsGoingToSleep() =
    fun isAuthenticatedIsResetToFalseWhenDeviceGoesToSleep() =
        testScope.runTest {
            initCollectors()
            allPreconditionsToRunFaceAuthAreTrue()
@@ -865,7 +865,7 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
        }

    @Test
    fun isAuthenticatedIsResetToFalseWhenDeviceGoesToSleep() =
    fun isAuthenticatedIsResetToFalseWhenUserIsSwitching() =
        testScope.runTest {
            initCollectors()
            allPreconditionsToRunFaceAuthAreTrue()
@@ -878,13 +878,16 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {

            assertThat(authenticated()).isTrue()

            powerInteractor.setAsleepForTest()
            fakeUserRepository.setSelectedUserInfo(
                primaryUser,
                SelectionStatus.SELECTION_IN_PROGRESS
            )

            assertThat(authenticated()).isFalse()
        }

    @Test
    fun isAuthenticatedIsResetToFalseWhenUserIsSwitching() =
    fun isAuthenticatedIsResetToFalseWhenKeyguardDoneAnimationsFinished() =
        testScope.runTest {
            initCollectors()
            allPreconditionsToRunFaceAuthAreTrue()
@@ -897,10 +900,7 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {

            assertThat(authenticated()).isTrue()

            fakeUserRepository.setSelectedUserInfo(
                primaryUser,
                SelectionStatus.SELECTION_IN_PROGRESS
            )
            keyguardRepository.keyguardDoneAnimationsFinished()

            assertThat(authenticated()).isFalse()
        }
+6 −1
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.flags.SystemPropertiesHelper;
import com.android.systemui.keyguard.dagger.KeyguardModule;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.keyguard.shared.model.TransitionStep;
import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel;
import com.android.systemui.log.SessionTracker;
@@ -1319,6 +1320,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
    private DeviceConfigProxy mDeviceConfig;
    private DozeParameters mDozeParameters;
    private SelectedUserInteractor mSelectedUserInteractor;
    private KeyguardInteractor mKeyguardInteractor;

    private final KeyguardStateController mKeyguardStateController;
    private final KeyguardStateController.Callback mKeyguardStateControllerCallback =
@@ -1400,7 +1402,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            Lazy<DreamingToLockscreenTransitionViewModel> dreamingToLockscreenTransitionViewModel,
            SystemPropertiesHelper systemPropertiesHelper,
            Lazy<WindowManagerLockscreenVisibilityManager> wmLockscreenVisibilityManager,
            SelectedUserInteractor selectedUserInteractor) {
            SelectedUserInteractor selectedUserInteractor,
            KeyguardInteractor keyguardInteractor) {
        mContext = context;
        mUserTracker = userTracker;
        mFalsingCollector = falsingCollector;
@@ -1441,6 +1444,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
                }));
        mDozeParameters = dozeParameters;
        mSelectedUserInteractor = selectedUserInteractor;
        mKeyguardInteractor = keyguardInteractor;

        mStatusBarStateController = statusBarStateController;
        statusBarStateController.addCallback(this);
@@ -2618,6 +2622,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
        setPendingLock(false); // user may have authenticated during the screen off animation

        handleHide();
        mKeyguardInteractor.keyguardDoneAnimationsFinished();
        mUpdateMonitor.clearFingerprintRecognizedWhenKeyguardDone(currentUser);
        Trace.endSection();
    }
+5 −2
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.systemui.keyguard.WindowManagerLockscreenVisibilityManager;
import com.android.systemui.keyguard.data.quickaffordance.KeyguardDataQuickAffordanceModule;
import com.android.systemui.keyguard.data.repository.KeyguardFaceAuthModule;
import com.android.systemui.keyguard.data.repository.KeyguardRepositoryModule;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.keyguard.domain.interactor.StartKeyguardTransitionModule;
import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLogger;
import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLoggerImpl;
@@ -154,7 +155,8 @@ public class KeyguardModule {
            Lazy<DreamingToLockscreenTransitionViewModel> dreamingToLockscreenTransitionViewModel,
            SystemPropertiesHelper systemPropertiesHelper,
            Lazy<WindowManagerLockscreenVisibilityManager> wmLockscreenVisibilityManager,
            SelectedUserInteractor selectedUserInteractor) {
            SelectedUserInteractor selectedUserInteractor,
            KeyguardInteractor keyguardInteractor) {
        return new KeyguardViewMediator(
                context,
                uiEventLogger,
@@ -199,7 +201,8 @@ public class KeyguardModule {
                dreamingToLockscreenTransitionViewModel,
                systemPropertiesHelper,
                wmLockscreenVisibilityManager,
                selectedUserInteractor);
                selectedUserInteractor,
                keyguardInteractor);
    }

    /** */
+3 −3
Original line number Diff line number Diff line
@@ -313,14 +313,14 @@ constructor(
    }

    private fun observeFaceAuthResettingConditions() {
        // Clear auth status when keyguard is going away or when the user is switching or device
        // starts going to sleep.
        // Clear auth status when keyguard done animations finished or when the user is switching
        // or device starts going to sleep.
        merge(
                powerInteractor.isAsleep,
                if (featureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) {
                    keyguardTransitionInteractor.isInTransitionToState(KeyguardState.GONE)
                } else {
                    keyguardRepository.isKeyguardGoingAway
                    keyguardRepository.keyguardDoneAnimationsFinished.map { true }
                },
                userRepository.selectedUser.map {
                    it.selectionStatus == SelectionStatus.SELECTION_IN_PROGRESS
+27 −0
Original line number Diff line number Diff line
@@ -192,6 +192,17 @@ interface KeyguardRepository {
    /** Observable updated when keyguardDone should be called either now or soon. */
    val keyguardDone: Flow<KeyguardDone>

    /**
     * Emits after the keyguard is done animating away.
     *
     * TODO(b/278086361): Remove once KEYGUARD_WM_STATE_REFACTOR flag is removed.
     */
    @Deprecated(
        "Use KeyguardTransitionInteractor flows instead. The closest match for " +
            "'keyguardDoneAnimationsFinished' is when the GONE transition is finished."
    )
    val keyguardDoneAnimationsFinished: Flow<Unit>

    /** Receive whether clock should be centered on lockscreen. */
    val clockShouldBeCentered: Flow<Boolean>

@@ -239,6 +250,17 @@ interface KeyguardRepository {
    suspend fun setKeyguardDone(keyguardDoneType: KeyguardDone)

    fun setClockShouldBeCentered(shouldBeCentered: Boolean)

    /**
     * Updates signal that the keyguard done animations are finished
     *
     * TODO(b/278086361): Remove once KEYGUARD_WM_STATE_REFACTOR flag is removed.
     */
    @Deprecated(
        "Use KeyguardTransitionInteractor flows instead. The closest match for " +
            "'keyguardDoneAnimationsFinished' is when the GONE transition is finished."
    )
    fun keyguardDoneAnimationsFinished()
}

/** Encapsulates application state for the keyguard. */
@@ -269,6 +291,11 @@ constructor(
        _keyguardDone.emit(keyguardDoneType)
    }

    override val keyguardDoneAnimationsFinished: MutableSharedFlow<Unit> = MutableSharedFlow()
    override fun keyguardDoneAnimationsFinished() {
        keyguardDoneAnimationsFinished.tryEmit(Unit)
    }

    private val _animateBottomAreaDozingTransitions = MutableStateFlow(false)
    override val animateBottomAreaDozingTransitions =
        _animateBottomAreaDozingTransitions.asStateFlow()
Loading