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

Commit aa93e6db authored by William Xiao's avatar William Xiao
Browse files

Don't set exit animation state in DreamOverlayAnimationsController.wakeUp

wakeUp no longer actually controls the exit animation and thus we
shouldn't set the state to exit animation running state to true. This
caused the DreamOverlayService resetCurrentDreamOverlayLocked to never
finish when unlocking from the dream when showing the bouncer, which
doesn't run the exit animation.

Bug: 361864211
Fix: 361864211
Test: atest DreamOverlayAnimationsControllerTest DreamOverlayServiceTest
Flag: EXEMPT simple bugfix
Change-Id: Iba90f3dd3d369e6a58b6d1a086fae0b51e8e3b92
parent 7707c243
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -88,21 +88,14 @@ class DreamOverlayAnimationsControllerTest : SysuiTestCase() {
    }

    @Test
    fun testWakeUpSetsExitAnimationsRunning() {
        controller.wakeUp()

        verify(stateController).setExitAnimationsRunning(true)
    }

    @Test
    fun testWakeUpAfterStartWillCancel() {
    fun testOnWakeUpAfterStartWillCancel() {
        val mockStartAnimator: AnimatorSet = mock()

        controller.startEntryAnimations(false, animatorBuilder = { mockStartAnimator })

        verify(mockStartAnimator, never()).cancel()

        controller.wakeUp()
        controller.onWakeUp()

        // Verify that we cancelled the start animator in favor of the exit
        // animator.
+2 −2
Original line number Diff line number Diff line
@@ -611,14 +611,14 @@ class DreamOverlayServiceTest : SysuiTestCase() {
        )
        mMainExecutor.runAllReady()
        mService.onWakeUp()
        verify(mDreamOverlayContainerViewController).wakeUp()
        verify(mDreamOverlayContainerViewController).onWakeUp()
        verify(mDreamOverlayCallbackController).onWakeUp()
    }

    @Test
    fun testWakeUpBeforeStartDoesNothing() {
        mService.onWakeUp()
        verify(mDreamOverlayContainerViewController, Mockito.never()).wakeUp()
        verify(mDreamOverlayContainerViewController, Mockito.never()).onWakeUp()
    }

    @Test
+1 −3
Original line number Diff line number Diff line
@@ -243,10 +243,8 @@ constructor(
        return mAnimator as AnimatorSet
    }

    /** Starts the dream content and dream overlay exit animations. */
    fun wakeUp() {
    fun onWakeUp() {
        cancelAnimations()
        mOverlayStateController.setExitAnimationsRunning(true)
    }

    /** Cancels the dream content and dream overlay animations, if they're currently running. */
+4 −3
Original line number Diff line number Diff line
@@ -363,16 +363,17 @@ public class DreamOverlayContainerViewController extends
    }

    /**
     * Handle the dream waking up and run any necessary animations.
     * Handle the dream waking up.
     */
    public void wakeUp() {
    public void onWakeUp() {
        // TODO(b/361872929): clean up this bool as it doesn't do anything anymore
        // When swiping causes wakeup, do not run any animations as the dream should exit as soon
        // as possible.
        if (mWakingUpFromSwipe) {
            return;
        }

        mDreamOverlayAnimationsController.wakeUp();
        mDreamOverlayAnimationsController.onWakeUp();
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -461,7 +461,7 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
    public void onWakeUp() {
        if (mDreamOverlayContainerViewController != null) {
            mDreamOverlayCallbackController.onWakeUp();
            mDreamOverlayContainerViewController.wakeUp();
            mDreamOverlayContainerViewController.onWakeUp();
        }
    }