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

Commit 0f6668d0 authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

Miscellaneous polish for new home animation.

1. Update the starting window velocity when coming from 3-button nav or
   predictive back

Before we used an arbitrary fixed velocity which goes down to basically
0 with the old implementation, but caused a noticeable jump up in the
new one when using predictive back. Now we just pass 0, since the
predictive back framework doesn't give us the actual velocity.

2. Add the scaling home reveal to the targetless (not going back to a
   specific app icon or widget) animation and 3-button nav

Bug: 298089923
Fix: 343143876
Flag: com.android.launcher3.enable_scaling_reveal_home_animation
Test: manually tested with flag on and off
Change-Id: Ied3630a51862731fad044b68f76a45dc87f2e17b
parent 3661e3f6
Loading
Loading
Loading
Loading
+19 −7
Original line number Original line Diff line number Diff line
@@ -151,6 +151,7 @@ import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.RectFSpringAnim.DefaultSpringConfig;
import com.android.quickstep.util.RectFSpringAnim.DefaultSpringConfig;
import com.android.quickstep.util.RectFSpringAnim.TaskbarHotseatSpringConfig;
import com.android.quickstep.util.RectFSpringAnim.TaskbarHotseatSpringConfig;
import com.android.quickstep.util.ScalingWorkspaceRevealAnim;
import com.android.quickstep.util.StaggeredWorkspaceAnim;
import com.android.quickstep.util.StaggeredWorkspaceAnim;
import com.android.quickstep.util.SurfaceTransaction;
import com.android.quickstep.util.SurfaceTransaction;
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
@@ -174,7 +175,6 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.List;
import java.util.Map.Entry;


/**
/**
 * Manages the opening and closing app transitions from Launcher
 * Manages the opening and closing app transitions from Launcher
@@ -1630,10 +1630,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
            anim.play(getUnlockWindowAnimator(appTargets, wallpaperTargets));
            anim.play(getUnlockWindowAnimator(appTargets, wallpaperTargets));
        } else if (ENABLE_BACK_SWIPE_HOME_ANIMATION.get()
        } else if (ENABLE_BACK_SWIPE_HOME_ANIMATION.get()
                && !playFallBackAnimation) {
                && !playFallBackAnimation) {
            PointF velocity;
            if (enableScalingRevealHomeAnimation()) {
                velocity = new PointF();
            } else {
                // Use a fixed velocity to start the animation.
                // Use a fixed velocity to start the animation.
                float velocityPxPerS = DynamicResource.provider(mLauncher)
                float velocityPxPerS = DynamicResource.provider(mLauncher)
                        .getDimension(R.dimen.unlock_staggered_velocity_dp_per_s);
                        .getDimension(R.dimen.unlock_staggered_velocity_dp_per_s);
            PointF velocity = new PointF(0, -velocityPxPerS);
                velocity = new PointF(0, -velocityPxPerS);
            }
            rectFSpringAnim = getClosingWindowAnimators(
            rectFSpringAnim = getClosingWindowAnimators(
                    anim, appTargets, launcherView, velocity, startRect,
                    anim, appTargets, launcherView, velocity, startRect,
                    startWindowCornerRadius);
                    startWindowCornerRadius);
@@ -1642,8 +1647,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
                // layout bounds.
                // layout bounds.
                skipAllAppsScale = true;
                skipAllAppsScale = true;
            } else if (!fromPredictiveBack) {
            } else if (!fromPredictiveBack) {
                if (enableScalingRevealHomeAnimation()) {
                    anim.play(
                            new ScalingWorkspaceRevealAnim(
                                    mLauncher, rectFSpringAnim,
                                    rectFSpringAnim.getTargetRect()).getAnimators());
                } else {
                    anim.play(new StaggeredWorkspaceAnim(mLauncher, velocity.y,
                    anim.play(new StaggeredWorkspaceAnim(mLauncher, velocity.y,
                            true /* animateOverviewScrim */, launcherView).getAnimators());
                            true /* animateOverviewScrim */, launcherView).getAnimators());
                }


                if (!areAllTargetsTranslucent(appTargets)) {
                if (!areAllTargetsTranslucent(appTargets)) {
                    anim.play(ObjectAnimator.ofFloat(mLauncher.getDepthController().stateDepth,
                    anim.play(ObjectAnimator.ofFloat(mLauncher.getDepthController().stateDepth,
+23 −11
Original line number Original line Diff line number Diff line
@@ -173,14 +173,10 @@ public class LauncherSwipeHandlerV2 extends
            }
            }


            @Override
            @Override
            public void playAtomicAnimation(float velocity) {
            protected void playScalingRevealAnimation() {
                if (enableScalingRevealHomeAnimation()) {
                if (mContainer != null) {
                if (mContainer != null) {
                        new ScalingWorkspaceRevealAnim(
                    new ScalingWorkspaceRevealAnim(mContainer, mSiblingAnimation,
                                mContainer, mSiblingAnimation, getWindowTargetRect()).start();
                            getWindowTargetRect()).start();
                    }
                } else {
                    super.playAtomicAnimation(velocity);
                }
                }
            }
            }


@@ -370,9 +366,25 @@ public class LauncherSwipeHandlerV2 extends


        @Override
        @Override
        public void playAtomicAnimation(float velocity) {
        public void playAtomicAnimation(float velocity) {
            if (enableScalingRevealHomeAnimation()) {
                playScalingRevealAnimation();
            } else {
                new StaggeredWorkspaceAnim(mContainer, velocity, true /* animateOverviewScrim */,
                new StaggeredWorkspaceAnim(mContainer, velocity, true /* animateOverviewScrim */,
                        getViewIgnoredInWorkspaceRevealAnimation())
                        getViewIgnoredInWorkspaceRevealAnimation())
                        .start();
                        .start();
            }
            }
        }
        }

        /**
         * Extracted in a different method so subclasses that have a custom window animation with a
         * target (icons, widgets) can pass the optional parameters.
         */
        protected void playScalingRevealAnimation() {
            if (mContainer != null) {
                new ScalingWorkspaceRevealAnim(
                        mContainer, null /* siblingAnimation */,
                        null /* windowTargetRect */).start();
            }
        }
    }
}
}
+4 −0
Original line number Original line Diff line number Diff line
@@ -157,6 +157,10 @@ public class RectFSpringAnim extends ReleaseCheck {
        mCurrentY = getTrackedYFromRect(mStartRect);
        mCurrentY = getTrackedYFromRect(mStartRect);
    }
    }


    public RectF getTargetRect() {
        return mTargetRect;
    }

    private float getTrackedYFromRect(RectF rect) {
    private float getTrackedYFromRect(RectF rect) {
        switch (mTracking) {
        switch (mTracking) {
            case TRACKING_TOP:
            case TRACKING_TOP:
+6 −1
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.quickstep.util
package com.android.quickstep.util


import android.animation.AnimatorSet
import android.graphics.Matrix
import android.graphics.Matrix
import android.graphics.Path
import android.graphics.Path
import android.graphics.RectF
import android.graphics.RectF
@@ -187,7 +188,11 @@ class ScalingWorkspaceRevealAnim(
        )
        )
    }
    }


    fun getAnimators(): AnimatorSet {
        return animation.buildAnim()
    }

    fun start() {
    fun start() {
        animation.buildAnim().start()
        getAnimators().start()
    }
    }
}
}