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

Commit d235e38a authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Android (Google) Code Review
Browse files

Merge "Close the shade when launch animation is cancelled." into sc-dev

parents 35f7ac1b 7f6bc03f
Loading
Loading
Loading
Loading
+5 −17
Original line number Diff line number Diff line
@@ -191,23 +191,11 @@ class ActivityLaunchAnimator(context: Context) {
        fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {}

        /**
         * The animation was cancelled remotely. Note that [onLaunchAnimationEnd] will still be
         * called after this if the animation was already started, i.e. if [onLaunchAnimationStart]
         * was called before the cancellation.
         * The animation was cancelled. Note that [onLaunchAnimationEnd] will still be called after
         * this if the animation was already started, i.e. if [onLaunchAnimationStart] was called
         * before the cancellation.
         */
        fun onLaunchAnimationCancelled() {}

        /**
         * The remote animation was not started within the expected time. It timed out and will
         * never [start][onLaunchAnimationStart].
         */
        fun onLaunchAnimationTimedOut() {}

        /**
         * The animation was aborted because the opening window was not found. It will never
         * [start][onLaunchAnimationStart].
         */
        fun onLaunchAnimationAborted() {}
    }

    /** The state of an expandable view during an [ActivityLaunchAnimator] animation. */
@@ -332,7 +320,7 @@ class ActivityLaunchAnimator(context: Context) {
            if (window == null) {
                removeTimeout()
                invokeCallback(iCallback)
                controller.onLaunchAnimationAborted()
                controller.onLaunchAnimationCancelled()
                return
            }

@@ -486,7 +474,7 @@ class ActivityLaunchAnimator(context: Context) {
            }

            timedOut = true
            controller.onLaunchAnimationTimedOut()
            controller.onLaunchAnimationCancelled()
        }

        override fun onAnimationCancelled() {
+0 −8
Original line number Diff line number Diff line
@@ -84,14 +84,6 @@ class NotificationLaunchAnimatorController(
        notificationShadeWindowViewController.setExpandAnimationRunning(false)
    }

    override fun onLaunchAnimationTimedOut() {
        notificationShadeWindowViewController.setExpandAnimationRunning(false)
    }

    override fun onLaunchAnimationAborted() {
        notificationShadeWindowViewController.setExpandAnimationRunning(false)
    }

    override fun onLaunchAnimationStart(isExpandingFullyAbove: Boolean) {
        notification.isExpandAnimationRunning = true
        notificationListContainer.setExpandingNotification(notification)
+5 −12
Original line number Diff line number Diff line
@@ -2015,9 +2015,12 @@ public class StatusBar extends SystemUI implements DemoMode,

    /** A launch animation was cancelled. */
    //TODO: These can / should probably be moved to NotificationPresenter or ShadeController
    public void onLaunchAnimationCancelled() {
        if (!mPresenter.isCollapsing()) {
    public void onLaunchAnimationCancelled(boolean isLaunchForActivity) {
        if (mPresenter.isPresenterFullyCollapsed() && !mPresenter.isCollapsing()
                && isLaunchForActivity) {
            onClosingFinished();
        } else {
            mShadeController.collapsePanel(true /* animate */);
        }
    }

@@ -2031,16 +2034,6 @@ public class StatusBar extends SystemUI implements DemoMode,
        }
    }

    /** A launch animation timed out. */
    public void onLaunchAnimationTimedOut(boolean isLaunchForActivity) {
        if (mPresenter.isPresenterFullyCollapsed() && !mPresenter.isCollapsing()
                && isLaunchForActivity) {
            onClosingFinished();
        } else {
            mShadeController.collapsePanel(true /* animate */);
        }
    }

    /** Whether we should animate an activity launch. */
    public boolean areLaunchAnimationsEnabled() {
        // TODO(b/184121838): Support lock screen launch animations.
+1 −11
Original line number Diff line number Diff line
@@ -43,16 +43,6 @@ class StatusBarLaunchAnimatorController(

    override fun onLaunchAnimationCancelled() {
        delegate.onLaunchAnimationCancelled()
        statusBar.onLaunchAnimationCancelled()
    }

    override fun onLaunchAnimationTimedOut() {
        delegate.onLaunchAnimationTimedOut()
        statusBar.onLaunchAnimationTimedOut(isLaunchForActivity)
    }

    override fun onLaunchAnimationAborted() {
        delegate.onLaunchAnimationAborted()
        statusBar.collapsePanelOnMainThread()
        statusBar.onLaunchAnimationCancelled(isLaunchForActivity)
    }
}
 No newline at end of file
+2 −10
Original line number Diff line number Diff line
@@ -106,12 +106,12 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() {
    }

    @Test
    fun abortsIfNoOpeningWindowIsFound() {
    fun cancelsIfNoOpeningWindowIsFound() {
        val runner = activityLaunchAnimator.createRunner(controller)
        runner.onAnimationStart(0, emptyArray(), emptyArray(), emptyArray(), iCallback)

        waitForIdleSync()
        verify(controller).onLaunchAnimationAborted()
        verify(controller).onLaunchAnimationCancelled()
        verify(controller, never()).onLaunchAnimationStart(anyBoolean())
    }

@@ -177,12 +177,4 @@ private class TestLaunchAnimatorController(
    override fun onLaunchAnimationCancelled() {
        assertOnMainThread()
    }

    override fun onLaunchAnimationTimedOut() {
        assertOnMainThread()
    }

    override fun onLaunchAnimationAborted() {
        assertOnMainThread()
    }
}