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

Commit 7697ea30 authored by Gauri Shankar's avatar Gauri Shankar Committed by Android (Google) Code Review
Browse files

Merge "Calculating endState for dialog animation continuously to accommodate...

Merge "Calculating endState for dialog animation continuously to accommodate updates during animation." into main
parents 91640c0b 32f2b10e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2108,3 +2108,13 @@ flag {
      purpose: PURPOSE_BUGFIX
    }
}
flag {
    name: "dialog_anim_end_state_update"
    namespace: "systemui"
    description: "Continuously updating the endState of DialogTransitionAnimation to keep it in sync with tileShape if it gets changed during animation"
    bug: "429189355"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -2420,7 +2420,7 @@ constructor(
            animation =
                transitionAnimator.startAnimation(
                    controller,
                    endState,
                    { endState },
                    windowBackgroundColor,
                    shouldFadeWindowBackgroundLayer = shouldFadeWindowBackgroundLayer,
                    drawHole = !controller.isBelowAnimatingWindow,
+5 −1
Original line number Diff line number Diff line
@@ -996,7 +996,11 @@ private class AnimatedDialog(
                }
            }

        transitionAnimator.startAnimation(controller, endState, originalDialogBackgroundColor)
        transitionAnimator.startAnimation(
            controller,
            { endController.createAnimatorState() },
            originalDialogBackgroundColor,
        )
    }

    private fun updateTouchInterceptorViewConstraints(state: TransitionAnimator.State) {
+25 −10
Original line number Diff line number Diff line
@@ -498,7 +498,7 @@ class TransitionAnimator(
     */
    fun startAnimation(
        controller: Controller,
        endState: State,
        calculateEndState: () -> State,
        windowBackgroundColor: Int,
        shouldFadeWindowBackgroundLayer: () -> Boolean = { true },
        drawHole: Boolean = false,
@@ -518,7 +518,7 @@ class TransitionAnimator(
        return createAnimation(
                controller,
                controller.createAnimatorState(),
                endState,
                calculateEndState,
                windowBackgroundLayer,
                shouldFadeWindowBackgroundLayer,
                drawHole,
@@ -532,7 +532,7 @@ class TransitionAnimator(
    fun createAnimation(
        controller: Controller,
        startState: State,
        endState: State,
        calculateEndState: () -> State,
        windowBackgroundLayer: GradientDrawable,
        shouldFadeWindowBackgroundLayer: () -> Boolean = { true },
        drawHole: Boolean = false,
@@ -558,7 +558,7 @@ class TransitionAnimator(
            createSpringAnimation(
                controller,
                startState,
                endState,
                calculateEndState,
                startVelocity,
                startFrameTime,
                windowBackgroundLayer,
@@ -574,7 +574,7 @@ class TransitionAnimator(
            createInterpolatedAnimation(
                controller,
                startState,
                endState,
                calculateEndState,
                windowBackgroundLayer,
                transitionContainer,
                transitionContainerOverlay,
@@ -594,7 +594,7 @@ class TransitionAnimator(
    private fun createInterpolatedAnimation(
        controller: Controller,
        state: State,
        endState: State,
        calculateEndState: () -> State,
        windowBackgroundLayer: GradientDrawable,
        transitionContainer: View,
        transitionContainerOverlay: ViewGroupOverlay,
@@ -615,21 +615,27 @@ class TransitionAnimator(
        val startBottomCornerRadius = state.bottomCornerRadius

        // End state.
        var endState = calculateEndState()
        var endTop = endState.top
        var endBottom = endState.bottom
        var endLeft = endState.left
        var endRight = endState.right
        var endCenterX = (endLeft + endRight) / 2f
        var endWidth = endRight - endLeft
        val endTopCornerRadius = endState.topCornerRadius
        val endBottomCornerRadius = endState.bottomCornerRadius
        var endTopCornerRadius = endState.topCornerRadius
        var endBottomCornerRadius = endState.bottomCornerRadius

        fun maybeUpdateEndState() {
            if (Flags.dialogAnimEndStateUpdate()) {
                endState = calculateEndState()
            }
            if (
                endTop != endState.top ||
                    endBottom != endState.bottom ||
                    endLeft != endState.left ||
                    endRight != endState.right
                    endRight != endState.right ||
                    endTopCornerRadius != endState.topCornerRadius ||
                    endBottomCornerRadius != endState.bottomCornerRadius
            ) {
                endTop = endState.top
                endBottom = endState.bottom
@@ -637,6 +643,10 @@ class TransitionAnimator(
                endRight = endState.right
                endCenterX = (endLeft + endRight) / 2f
                endWidth = endRight - endLeft
                if (Flags.dialogAnimEndStateUpdate()) {
                    endTopCornerRadius = endState.topCornerRadius
                    endBottomCornerRadius = endState.bottomCornerRadius
                }
            }
        }

@@ -744,7 +754,7 @@ class TransitionAnimator(
    private fun createSpringAnimation(
        controller: Controller,
        startState: State,
        endState: State,
        calculateEndState: () -> State,
        startVelocity: PointF,
        startFrameTime: Long,
        windowBackgroundLayer: GradientDrawable,
@@ -756,6 +766,8 @@ class TransitionAnimator(
        drawHole: Boolean = false,
        moveBackgroundLayerWhenAppVisibilityChanges: Boolean = false,
    ): Animation {

        var endState = calculateEndState()
        var springX: SpringAnimation? = null
        var springY: SpringAnimation? = null
        var targetX = endState.centerX
@@ -764,6 +776,9 @@ class TransitionAnimator(
        var movedBackgroundLayer = false

        fun maybeUpdateEndState() {
            if (Flags.dialogAnimEndStateUpdate()) {
                endState = calculateEndState()
            }
            if (endState.centerX != targetX && endState.centerY != targetY) {
                targetX = endState.centerX
                targetY = endState.centerY
+1 −1
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ class TransitionAnimatorTest(
            .createAnimation(
                controller,
                controller.createAnimatorState(),
                endState,
                { endState },
                backgroundLayer,
                { fadeWindowBackgroundLayer },
                drawHole,