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

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

Merge "Support primary bouncer => AOD UDFPS device-entry transiiton" into main

parents e7e12e35 b114c4fc
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -616,4 +616,28 @@ class UdfpsKeyguardViewLegacyControllerWithCoroutinesTest :
                .onDozeAmountChanged(eq(.3f), eq(.3f), eq(ANIMATION_BETWEEN_AOD_AND_LOCKSCREEN))
            job.cancel()
        }

    @Test
    fun bouncerToAod_dozeAmountChanged() =
        testScope.runTest {
            // GIVEN view is attached
            mController.onViewAttached()
            Mockito.reset(mView)

            val job = mController.listenForPrimaryBouncerToAodTransitions(this)
            // WHEN alternate bouncer to aod transition in progress
            transitionRepository.sendTransitionStep(
                TransitionStep(
                    from = KeyguardState.PRIMARY_BOUNCER,
                    to = KeyguardState.AOD,
                    value = .3f,
                    transitionState = TransitionState.RUNNING
                )
            )
            runCurrent()

            // THEN doze amount is updated to
            verify(mView).onDozeAmountChanged(eq(.3f), eq(.3f), eq(ANIMATE_APPEAR_ON_SCREEN_OFF))
            job.cancel()
        }
}
+16 −0
Original line number Diff line number Diff line
@@ -199,6 +199,22 @@ open class UdfpsKeyguardViewControllerLegacy(
                listenForAodToOccludedTransitions(this)
                listenForAlternateBouncerToAodTransitions(this)
                listenForDreamingToAodTransitions(this)
                listenForPrimaryBouncerToAodTransitions(this)
            }
        }
    }

    @VisibleForTesting
    suspend fun listenForPrimaryBouncerToAodTransitions(scope: CoroutineScope): Job {
        return scope.launch {
            transitionInteractor
                .transition(KeyguardState.PRIMARY_BOUNCER, KeyguardState.AOD)
                .collect { transitionStep ->
                    view.onDozeAmountChanged(
                        transitionStep.value,
                        transitionStep.value,
                        ANIMATE_APPEAR_ON_SCREEN_OFF,
                    )
                }
        }
    }