Loading packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt +8 −12 Original line number Diff line number Diff line Loading @@ -136,20 +136,16 @@ constructor( ) /** * The timings when animating a View into an app using a spring animator. * * Important: since springs don't have fixed durations, these timings represent fractions of * the progress between the spring's initial value and its final value. * * TODO(b/372858592): make this a separate class explicitly using percentages. * The timings when animating a View into an app using a spring animator. These timings * represent fractions of the progress between the spring's initial value and its final * value. */ val SPRING_TIMINGS = TransitionAnimator.Timings( totalDuration = 1000L, contentBeforeFadeOutDelay = 0L, contentBeforeFadeOutDuration = 800L, contentAfterFadeInDelay = 850L, contentAfterFadeInDuration = 135L, TransitionAnimator.SpringTimings( contentBeforeFadeOutDelay = 0f, contentBeforeFadeOutDuration = 0.8f, contentAfterFadeInDelay = 0.85f, contentAfterFadeInDuration = 0.135f, ) /** Loading packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt +74 −32 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ class TransitionAnimator( private val interpolators: Interpolators, /** [springTimings] and [springInterpolators] must either both be null or both not null. */ private val springTimings: Timings? = null, private val springTimings: SpringTimings? = null, private val springInterpolators: Interpolators? = null, private val springParams: SpringParams = DEFAULT_SPRING_PARAMS, ) { Loading Loading @@ -82,9 +82,23 @@ class TransitionAnimator( linearProgress: Float, delay: Long, duration: Long, ): Float { return getProgressInternal( timings.totalDuration.toFloat(), linearProgress, delay.toFloat(), duration.toFloat(), ) } private fun getProgressInternal( totalDuration: Float, linearProgress: Float, delay: Float, duration: Float, ): Float { return MathUtils.constrain( (linearProgress * timings.totalDuration - delay) / duration, (linearProgress * totalDuration - delay) / duration, 0.0f, 1.0f, ) Loading Loading @@ -367,6 +381,25 @@ class TransitionAnimator( val contentAfterFadeInDuration: Long, ) /** * The timings (durations and delays) used by the multi-spring animator. These are expressed as * fractions of 1, similar to how the progress of an animator can be expressed as a float value * between 0 and 1. */ class SpringTimings( /** The portion of animation to wait before fading out the expanding content. */ val contentBeforeFadeOutDelay: Float, /** The portion of animation during which the expanding content fades out. */ val contentBeforeFadeOutDuration: Float, /** The portion of animation to wait before fading in the expanded content. */ val contentAfterFadeInDelay: Float, /** The portion of animation during which the expanded content fades in. */ val contentAfterFadeInDuration: Float, ) /** The interpolators used by this animator. */ data class Interpolators( /** The interpolator used for the Y position, width, height and corner radius. */ Loading Loading @@ -576,18 +609,14 @@ class TransitionAnimator( } override fun onAnimationEnd(animation: Animator) { if (DEBUG) { Log.d(TAG, "Animation ended") } // TODO(b/330672236): Post this to the main thread instead so that it does not // flicker with Flexiglass enabled. controller.onTransitionAnimationEnd(isExpandingFullyAbove) transitionContainerOverlay.remove(windowBackgroundLayer) if (moveBackgroundLayerWhenAppVisibilityChanges && controller.isLaunching) { openingWindowSyncViewOverlay?.remove(windowBackgroundLayer) } onAnimationEnd( controller, isExpandingFullyAbove, windowBackgroundLayer, transitionContainerOverlay, openingWindowSyncViewOverlay, moveBackgroundLayerWhenAppVisibilityChanges, ) } } ) Loading Loading @@ -1021,34 +1050,47 @@ class TransitionAnimator( cornerRadii[7] = state.bottomCornerRadius drawable.cornerRadii = cornerRadii val timings: Timings val interpolators: Interpolators val fadeInProgress: Float val fadeOutProgress: Float if (useSpring) { timings = springTimings!! interpolators = springInterpolators!! val timings = springTimings!! fadeInProgress = getProgressInternal( totalDuration = 1f, linearProgress, timings.contentBeforeFadeOutDelay, timings.contentBeforeFadeOutDuration, ) fadeOutProgress = getProgressInternal( totalDuration = 1f, linearProgress, timings.contentAfterFadeInDelay, timings.contentAfterFadeInDuration, ) } else { timings = this.timings interpolators = this.interpolators } // We first fade in the background layer to hide the expanding view, then fade it out with // SRC mode to draw a hole punch in the status bar and reveal the opening window (if // needed). If !isLaunching, the reverse happens. val fadeInProgress = fadeInProgress = getProgress( timings, linearProgress, timings.contentBeforeFadeOutDelay, timings.contentBeforeFadeOutDuration, ) val fadeOutProgress = fadeOutProgress = getProgress( timings, linearProgress, timings.contentAfterFadeInDelay, timings.contentAfterFadeInDuration, ) } // We first fade in the background layer to hide the expanding view, then fade it out with // SRC mode to draw a hole punch in the status bar and reveal the opening window (if // needed). If !isLaunching, the reverse happens. if (isLaunching) { if (fadeInProgress < 1) { val alpha = Loading Loading
packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt +8 −12 Original line number Diff line number Diff line Loading @@ -136,20 +136,16 @@ constructor( ) /** * The timings when animating a View into an app using a spring animator. * * Important: since springs don't have fixed durations, these timings represent fractions of * the progress between the spring's initial value and its final value. * * TODO(b/372858592): make this a separate class explicitly using percentages. * The timings when animating a View into an app using a spring animator. These timings * represent fractions of the progress between the spring's initial value and its final * value. */ val SPRING_TIMINGS = TransitionAnimator.Timings( totalDuration = 1000L, contentBeforeFadeOutDelay = 0L, contentBeforeFadeOutDuration = 800L, contentAfterFadeInDelay = 850L, contentAfterFadeInDuration = 135L, TransitionAnimator.SpringTimings( contentBeforeFadeOutDelay = 0f, contentBeforeFadeOutDuration = 0.8f, contentAfterFadeInDelay = 0.85f, contentAfterFadeInDuration = 0.135f, ) /** Loading
packages/SystemUI/animation/src/com/android/systemui/animation/TransitionAnimator.kt +74 −32 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ class TransitionAnimator( private val interpolators: Interpolators, /** [springTimings] and [springInterpolators] must either both be null or both not null. */ private val springTimings: Timings? = null, private val springTimings: SpringTimings? = null, private val springInterpolators: Interpolators? = null, private val springParams: SpringParams = DEFAULT_SPRING_PARAMS, ) { Loading Loading @@ -82,9 +82,23 @@ class TransitionAnimator( linearProgress: Float, delay: Long, duration: Long, ): Float { return getProgressInternal( timings.totalDuration.toFloat(), linearProgress, delay.toFloat(), duration.toFloat(), ) } private fun getProgressInternal( totalDuration: Float, linearProgress: Float, delay: Float, duration: Float, ): Float { return MathUtils.constrain( (linearProgress * timings.totalDuration - delay) / duration, (linearProgress * totalDuration - delay) / duration, 0.0f, 1.0f, ) Loading Loading @@ -367,6 +381,25 @@ class TransitionAnimator( val contentAfterFadeInDuration: Long, ) /** * The timings (durations and delays) used by the multi-spring animator. These are expressed as * fractions of 1, similar to how the progress of an animator can be expressed as a float value * between 0 and 1. */ class SpringTimings( /** The portion of animation to wait before fading out the expanding content. */ val contentBeforeFadeOutDelay: Float, /** The portion of animation during which the expanding content fades out. */ val contentBeforeFadeOutDuration: Float, /** The portion of animation to wait before fading in the expanded content. */ val contentAfterFadeInDelay: Float, /** The portion of animation during which the expanded content fades in. */ val contentAfterFadeInDuration: Float, ) /** The interpolators used by this animator. */ data class Interpolators( /** The interpolator used for the Y position, width, height and corner radius. */ Loading Loading @@ -576,18 +609,14 @@ class TransitionAnimator( } override fun onAnimationEnd(animation: Animator) { if (DEBUG) { Log.d(TAG, "Animation ended") } // TODO(b/330672236): Post this to the main thread instead so that it does not // flicker with Flexiglass enabled. controller.onTransitionAnimationEnd(isExpandingFullyAbove) transitionContainerOverlay.remove(windowBackgroundLayer) if (moveBackgroundLayerWhenAppVisibilityChanges && controller.isLaunching) { openingWindowSyncViewOverlay?.remove(windowBackgroundLayer) } onAnimationEnd( controller, isExpandingFullyAbove, windowBackgroundLayer, transitionContainerOverlay, openingWindowSyncViewOverlay, moveBackgroundLayerWhenAppVisibilityChanges, ) } } ) Loading Loading @@ -1021,34 +1050,47 @@ class TransitionAnimator( cornerRadii[7] = state.bottomCornerRadius drawable.cornerRadii = cornerRadii val timings: Timings val interpolators: Interpolators val fadeInProgress: Float val fadeOutProgress: Float if (useSpring) { timings = springTimings!! interpolators = springInterpolators!! val timings = springTimings!! fadeInProgress = getProgressInternal( totalDuration = 1f, linearProgress, timings.contentBeforeFadeOutDelay, timings.contentBeforeFadeOutDuration, ) fadeOutProgress = getProgressInternal( totalDuration = 1f, linearProgress, timings.contentAfterFadeInDelay, timings.contentAfterFadeInDuration, ) } else { timings = this.timings interpolators = this.interpolators } // We first fade in the background layer to hide the expanding view, then fade it out with // SRC mode to draw a hole punch in the status bar and reveal the opening window (if // needed). If !isLaunching, the reverse happens. val fadeInProgress = fadeInProgress = getProgress( timings, linearProgress, timings.contentBeforeFadeOutDelay, timings.contentBeforeFadeOutDuration, ) val fadeOutProgress = fadeOutProgress = getProgress( timings, linearProgress, timings.contentAfterFadeInDelay, timings.contentAfterFadeInDuration, ) } // We first fade in the background layer to hide the expanding view, then fade it out with // SRC mode to draw a hole punch in the status bar and reveal the opening window (if // needed). If !isLaunching, the reverse happens. if (isLaunching) { if (fadeInProgress < 1) { val alpha = Loading