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

Commit 9b0ed5c4 authored by Paul Hobbs's avatar Paul Hobbs Committed by Android (Google) Code Review
Browse files

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

* changes:
  Revert "Check both isDozing and isAodAvailable for aodVisibility."
  Revert "Always start dismiss transition when the going away anim..."
  Revert "Don't call setLockScreenShown until we know if it's showing."
parents 463a8b1c be278893
Loading
Loading
Loading
Loading
+25 −30
Original line number Diff line number Diff line
@@ -142,17 +142,15 @@ 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. 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.
            // 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.
            keyguardTransitionInteractor.startDismissKeyguardTransition(
                reason = "Going away remote animation started"
            )

        if (apps.isNotEmpty()) {
            goingAwayRemoteAnimationFinishedCallback = finishedCallback
            keyguardSurfaceBehindAnimator.applyParamsToSurface(apps[0])
        } else {
@@ -185,11 +183,25 @@ constructor(
    /**
     * Sets the lockscreen state WM-side by calling ATMS#setLockScreenShown.
     *
     * If [lockscreenShowing] is null, it means we don't know if the lockscreen is showing yet. This
     * will be decided by the [KeyguardTransitionBootInteractor] shortly.
     * [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.
     */
    private fun setWmLockscreenState(
        lockscreenShowing: Boolean? = this.isLockscreenShowing,
        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."
                    )
                },
        aodVisible: Boolean = this.isAodVisible
    ) {
        Log.d(
@@ -199,27 +211,10 @@ 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
+2 −5
Original line number Diff line number Diff line
@@ -229,14 +229,11 @@ constructor(
    val aodVisibility: Flow<Boolean> =
        combine(
                keyguardInteractor.isDozing,
                keyguardInteractor.isAodAvailable,
                keyguardInteractor.biometricUnlockState,
            ) { isDozing, isAodAvailable, biometricUnlockState ->
            ) { isDozing, 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 &&
                    isAodAvailable &&
                    !BiometricUnlockMode.isWakeAndUnlock(biometricUnlockState.mode)
                isDozing && !BiometricUnlockMode.isWakeAndUnlock(biometricUnlockState.mode)
            }
            .distinctUntilChanged()

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

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

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