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

Commit ff0c01c8 authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Small tweaks to swap animation

This CL fixes the interpolators used for shrink/grow movement, and shortens the veil fade delay to 300ms.

Fixes: 359303971
Test: Visually confirmed
Flag: EXEMPT bugfix
Change-Id: Ic239884b372dbbba6bbdb3f5789bc5456091ba06
parent c906b847
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ public class SplitScreenConstants {
    /** Duration used for every split fade-in or fade-out. */
    public static final int FADE_DURATION = 133;
    /** Duration where we keep an app veiled to allow it to redraw itself behind the scenes. */
    public static final int VEIL_DELAY_DURATION = 400;
    public static final int VEIL_DELAY_DURATION = 300;

    /** Key for passing in widget intents when invoking split from launcher workspace. */
    public static final String KEY_EXTRA_WIDGET_INTENT = "key_extra_widget_intent";
+12 −7
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ import static android.view.WindowManager.DOCKED_TOP;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_SPLIT_SCREEN_DOUBLE_TAP_DIVIDER;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_SPLIT_SCREEN_RESIZE;
import static com.android.wm.shell.shared.animation.Interpolators.DIM_INTERPOLATOR;
import static com.android.wm.shell.shared.animation.Interpolators.EMPHASIZED;
import static com.android.wm.shell.shared.animation.Interpolators.LINEAR;
import static com.android.wm.shell.shared.animation.Interpolators.SLOWDOWN_INTERPOLATOR;
import static com.android.wm.shell.shared.split.SplitScreenConstants.SNAP_TO_END_AND_DISMISS;
import static com.android.wm.shell.shared.split.SplitScreenConstants.SNAP_TO_START_AND_DISMISS;
@@ -813,7 +815,9 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
        float growPortion = 1 - shrinkPortion;

        ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
        animator.setInterpolator(Interpolators.EMPHASIZED);
        // Set the base animation to proceed linearly. Each component of the animation (movement,
        // shrinking, growing) overrides it with a different interpolator later.
        animator.setInterpolator(LINEAR);
        animator.addUpdateListener(animation -> {
            if (leash == null) return;
            if (roundCorners) {
@@ -822,10 +826,11 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
            }

            final float progress = (float) animation.getAnimatedValue();
            float instantaneousX = tempStart.left + progress * diffX;
            float instantaneousY = tempStart.top + progress * diffY;
            int width = (int) (tempStart.width() + progress * diffWidth);
            int height = (int) (tempStart.height() + progress * diffHeight);
            final float moveProgress = EMPHASIZED.getInterpolation(progress);
            float instantaneousX = tempStart.left + moveProgress * diffX;
            float instantaneousY = tempStart.top + moveProgress * diffY;
            int width = (int) (tempStart.width() + moveProgress * diffWidth);
            int height = (int) (tempStart.height() + moveProgress * diffHeight);

            if (isGoingBehind) {
                float shrinkDiffX; // the position adjustments needed for this frame
@@ -897,8 +902,8 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
                            taskInfo, mTempRect, t, isGoingBehind, leash, 0, 0);
                }
            } else {
                final int diffOffsetX = (int) (progress * offsetX);
                final int diffOffsetY = (int) (progress * offsetY);
                final int diffOffsetX = (int) (moveProgress * offsetX);
                final int diffOffsetY = (int) (moveProgress * offsetY);
                t.setPosition(leash, instantaneousX + diffOffsetX, instantaneousY + diffOffsetY);
                mTempRect.set(0, 0, width, height);
                mTempRect.offsetTo(-diffOffsetX, -diffOffsetY);