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

Commit 9a6c97c1 authored by Josh Tsuji's avatar Josh Tsuji Committed by Android (Google) Code Review
Browse files

Merge changes from topic "revert-27773289-revert-27770576-DGMSFQBZGQ-BXQDHOGVAC" into main

* changes:
  Revert "Revert "Don't call setLockScreenShown until we know if i..."
  Revert "Revert "Always start dismiss transition when the going a..."
  Revert "Revert "Check both isDozing and isAodAvailable for aodVi..."
parents 90d82974 3e087075
Loading
Loading
Loading
Loading
+30 −25
Original line number Diff line number Diff line
@@ -142,15 +142,17 @@ constructor(
        nonApps: Array<RemoteAnimationTarget>,
        finishedCallback: IRemoteAnimationFinishedCallback
    ) {
        if (apps.isNotEmpty()) {
        // Ensure that we've started a dismiss keyguard transition. WindowManager can start the
            // going away animation on its own, if an activity launches and then requests dismissing
            // the keyguard. In this case, this is the first and only signal we'll receive to start
            // a transition to GONE.
        // going away animation on its own, if an activity launches and then requests dismissing the
        // keyguard. In this case, this is the first and only signal we'll receive to start
        // a transition to GONE. This transition needs to start even if we're not provided an app
        // animation target - it's possible the app is destroyed on creation, etc. but we'll still
        // be unlocking.
        keyguardTransitionInteractor.startDismissKeyguardTransition(
            reason = "Going away remote animation started"
        )

        if (apps.isNotEmpty()) {
            goingAwayRemoteAnimationFinishedCallback = finishedCallback
            keyguardSurfaceBehindAnimator.applyParamsToSurface(apps[0])
        } else {
@@ -183,25 +185,11 @@ constructor(
    /**
     * Sets the lockscreen state WM-side by calling ATMS#setLockScreenShown.
     *
     * [lockscreenShowing] defaults to true, since it's only ever null during the boot sequence,
     * when we haven't yet called ATMS#setLockScreenShown. Typically,
     * setWmLockscreenState(lockscreenShowing = true) is called early in the boot sequence, before
     * setWmLockscreenState(aodVisible = true), so we don't expect to need to use this default, but
     * if so, true should be the right choice.
     * If [lockscreenShowing] is null, it means we don't know if the lockscreen is showing yet. This
     * will be decided by the [KeyguardTransitionBootInteractor] shortly.
     */
    private fun setWmLockscreenState(
        lockscreenShowing: Boolean =
            this.isLockscreenShowing
                ?: true.also {
                    Log.d(
                        TAG,
                        "Using isLockscreenShowing=true default in setWmLockscreenState, " +
                            "because setAodVisible was called before the first " +
                            "setLockscreenShown call during boot. This is not typical, but is " +
                            "theoretically possible. If you're investigating the lockscreen " +
                            "showing unexpectedly, start here."
                    )
                },
        lockscreenShowing: Boolean? = this.isLockscreenShowing,
        aodVisible: Boolean = this.isAodVisible
    ) {
        Log.d(
@@ -211,10 +199,27 @@ constructor(
                "aodVisible=$aodVisible)."
        )

        if (lockscreenShowing == null) {
            Log.d(
                TAG,
                "isAodVisible=$aodVisible, but lockscreenShowing=null. Waiting for" +
                    "non-null lockscreenShowing before calling ATMS#setLockScreenShown, which" +
                    "will happen once KeyguardTransitionBootInteractor starts the boot transition."
            )
            this.isAodVisible = aodVisible
            return
        }

        if (this.isLockscreenShowing == lockscreenShowing && this.isAodVisible == aodVisible) {
            return
        }

        Log.d(
            TAG,
            "ATMS#setLockScreenShown(" +
                "isLockscreenShowing=$lockscreenShowing, " +
                "aodVisible=$aodVisible)."
        )
        activityTaskManagerService.setLockScreenShown(lockscreenShowing, aodVisible)
        this.isLockscreenShowing = lockscreenShowing
        this.isAodVisible = aodVisible
+5 −2
Original line number Diff line number Diff line
@@ -229,11 +229,14 @@ constructor(
    val aodVisibility: Flow<Boolean> =
        combine(
                keyguardInteractor.isDozing,
                keyguardInteractor.isAodAvailable,
                keyguardInteractor.biometricUnlockState,
            ) { isDozing, biometricUnlockState ->
            ) { isDozing, isAodAvailable, biometricUnlockState ->
                // AOD is visible if we're dozing, unless we are wake and unlocking (where we go
                // directly from AOD to unlocked while dozing).
                isDozing && !BiometricUnlockMode.isWakeAndUnlock(biometricUnlockState.mode)
                isDozing &&
                    isAodAvailable &&
                    !BiometricUnlockMode.isWakeAndUnlock(biometricUnlockState.mode)
            }
            .distinctUntilChanged()

+3 −1
Original line number Diff line number Diff line
@@ -100,9 +100,11 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() {
    }

    @Test
    fun testAodVisible_noLockscreenShownCallYet_defaultsToShowLockscreen() {
    fun testAodVisible_noLockscreenShownCallYet_doesNotShowLockscreenUntilLater() {
        underTest.setAodVisible(false)
        verifyNoMoreInteractions(activityTaskManagerService)

        underTest.setLockscreenShown(true)
        verify(activityTaskManagerService).setLockScreenShown(true, false)
        verifyNoMoreInteractions(activityTaskManagerService)
    }