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

Commit 854eda35 authored by Galia Peycheva's avatar Galia Peycheva Committed by Android (Google) Code Review
Browse files

Merge "Make the TV start window exit animation a fade out" into main

parents 72dbcc03 bca592cf
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -44,12 +44,11 @@
    if a custom action is present before closing it. -->
    <integer name="config_pipForceCloseDelay">5000</integer>

    <!-- Animation duration when exit starting window: fade out icon -->
    <integer name="starting_window_app_reveal_icon_fade_out_duration">0</integer>

    <!-- Animation duration when exit starting window: reveal app -->
    <integer name="starting_window_app_reveal_anim_delay">0</integer>
    <integer name="starting_window_app_reveal_anim_duration">500</integer>

    <!-- Animation duration when exit starting window: reveal app -->
    <integer name="starting_window_app_reveal_anim_duration">0</integer>
    <!-- Default animation type when hiding the starting window. The possible values are:
          - 0 for radial vanish + slide up
          - 1 for fade out -->
    <integer name="starting_window_exit_animation_type">1</integer>
</resources>
+5 −0
Original line number Diff line number Diff line
@@ -83,6 +83,11 @@
    <!-- Animation duration when exit starting window: reveal app -->
    <integer name="starting_window_app_reveal_anim_duration">266</integer>

    <!-- Default animation type when hiding the starting window. The possible values are:
          - 0 for radial vanish + slide up
          - 1 for fade out -->
    <integer name="starting_window_exit_animation_type">0</integer>

    <!-- Default insets [LEFT/RIGHTxTOP/BOTTOM] from the screen edge for picture-in-picture windows.
         These values are in DPs and will be converted to pixel sizes internally. -->
    <string translatable="false" name="config_defaultPictureInPictureScreenEdgeInsets">
+32 −4
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.view.View.GONE;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_SPLASHSCREEN_EXIT_ANIM;

import android.animation.Animator;
import android.annotation.IntDef;
import android.content.Context;
import android.graphics.Rect;
import android.util.Slog;
@@ -46,6 +47,8 @@ public class SplashScreenExitAnimation implements Animator.AnimatorListener {
    private final int mIconFadeOutDuration;
    private final int mAppRevealDelay;
    private final int mAppRevealDuration;
    @ExitAnimationType
    private final int mAnimationType;
    private final int mAnimationDuration;
    private final float mIconStartAlpha;
    private final float mBrandingStartAlpha;
@@ -55,6 +58,24 @@ public class SplashScreenExitAnimation implements Animator.AnimatorListener {

    private Runnable mFinishCallback;

    /**
    * This splash screen exit animation type uses a radial vanish to hide
    * the starting window and slides up the main window content.
    */
    private static final int TYPE_RADIAL_VANISH_SLIDE_UP = 0;

    /**
    * This splash screen exit animation type fades out the starting window
    * to reveal the main window content.
    */
    private static final int TYPE_FADE_OUT = 1;

    @IntDef(prefix = { "TYPE_" }, value = {
        TYPE_RADIAL_VANISH_SLIDE_UP,
        TYPE_FADE_OUT,
    })
    private @interface ExitAnimationType {}

    SplashScreenExitAnimation(Context context, SplashScreenView view, SurfaceControl leash,
            Rect frame, int mainWindowShiftLength, TransactionPool pool, Runnable handleFinish,
            float roundedCornerRadius) {
@@ -91,6 +112,8 @@ public class SplashScreenExitAnimation implements Animator.AnimatorListener {
        }
        mAppRevealDuration = context.getResources().getInteger(
                R.integer.starting_window_app_reveal_anim_duration);
        mAnimationType = context.getResources().getInteger(
                R.integer.starting_window_exit_animation_type);
        mAnimationDuration = Math.max(mIconFadeOutDuration, mAppRevealDelay + mAppRevealDuration);
        mMainWindowShiftLength = mainWindowShiftLength;
        mFinishCallback = handleFinish;
@@ -98,11 +121,16 @@ public class SplashScreenExitAnimation implements Animator.AnimatorListener {
    }

    void startAnimations() {
        if (mAnimationType == TYPE_FADE_OUT) {
            SplashScreenExitAnimationUtils.startFadeOutAnimation(mSplashScreenView,
                    mAnimationDuration, this);
        } else {
            SplashScreenExitAnimationUtils.startAnimations(mSplashScreenView, mFirstWindowSurface,
                    mMainWindowShiftLength, mTransactionPool, mFirstWindowFrame, mAnimationDuration,
                    mIconFadeOutDuration, mIconStartAlpha, mBrandingStartAlpha, mAppRevealDelay,
                    mAppRevealDuration, this, mRoundedCornerRadius);
        }
    }

    private void reset() {
        if (DEBUG_EXIT_ANIMATION) {
+19 −6
Original line number Diff line number Diff line
@@ -71,11 +71,10 @@ public class SplashScreenExitAnimationUtils {
            int iconFadeOutDuration, float iconStartAlpha, float brandingStartAlpha,
            int appRevealDelay, int appRevealDuration, Animator.AnimatorListener animatorListener,
            float roundedCornerRadius) {
        ValueAnimator animator =
                createAnimator(splashScreenView, firstWindowSurface, mainWindowShiftLength,
                        transactionPool, firstWindowFrame, animationDuration, iconFadeOutDuration,
                        iconStartAlpha, brandingStartAlpha, appRevealDelay, appRevealDuration,
                        animatorListener, roundedCornerRadius);
        ValueAnimator animator = createRadialVanishSlideUpAnimator(splashScreenView,
                firstWindowSurface, mainWindowShiftLength, transactionPool, firstWindowFrame,
                animationDuration, iconFadeOutDuration, iconStartAlpha, brandingStartAlpha,
                appRevealDelay, appRevealDuration, animatorListener, roundedCornerRadius);
        animator.start();
    }

@@ -99,7 +98,7 @@ public class SplashScreenExitAnimationUtils {
     * Creates the animator to fade out the icon, reveal the app, and shift up main window.
     * @hide
     */
    private static ValueAnimator createAnimator(ViewGroup splashScreenView,
    private static ValueAnimator createRadialVanishSlideUpAnimator(ViewGroup splashScreenView,
            SurfaceControl firstWindowSurface, int mMainWindowShiftLength,
            TransactionPool transactionPool, Rect firstWindowFrame, int animationDuration,
            int iconFadeOutDuration, float iconStartAlpha, float brandingStartAlpha,
@@ -210,6 +209,20 @@ public class SplashScreenExitAnimationUtils {
        return nightMode == Configuration.UI_MODE_NIGHT_YES;
    }

    static void startFadeOutAnimation(ViewGroup splashScreenView,
            int animationDuration, Animator.AnimatorListener animatorListener) {
        final ValueAnimator animator = ValueAnimator.ofFloat(1f, 0f);
        animator.setDuration(animationDuration);
        animator.setInterpolator(Interpolators.LINEAR);
        animator.addUpdateListener(animation -> {
            splashScreenView.setAlpha((float) animation.getAnimatedValue());
        });
        if (animatorListener != null) {
            animator.addListener(animatorListener);
        }
        animator.start();
    }

    /**
     * View which creates a circular reveal of the underlying view.
     * @hide