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

Commit 149b85bd authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Reset face isAuthenticated on keyguardDoneAnimationsFinished" into main

parents 3b6c5289 893f2b46
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
@@ -304,14 +304,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