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

Commit aeb9595b authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Explicitly set animation and timings for split cancel button

* Mismatched animation durations were causing recents task
thumbnails to flash in at the end.
* Following a similar pattern started at ag/26378432, except
here we manually call all the steps to create launcherState
animation

Fixes: 321863575
Test: Repro steps from bug no longer occur.
Tested on phone and large screen, workspace, overview and all apps

Change-Id: I02696c0470bf4cfe6a278f0a2bc0786367a9fe37
parent 520d91f9
Loading
Loading
Loading
Loading
+24 −4
Original line number Diff line number Diff line
@@ -16,10 +16,12 @@

package com.android.quickstep.views;

import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTION_EXIT_CANCEL_BUTTON;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.content.Context;
import android.util.AttributeSet;
import android.util.FloatProperty;
@@ -33,12 +35,14 @@ import androidx.dynamicanimation.animation.SpringAnimation;
import androidx.dynamicanimation.animation.SpringForce;

import com.android.app.animation.Interpolators;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.BaseState;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.quickstep.util.SplitSelectStateController;

/**
@@ -51,6 +55,7 @@ import com.android.quickstep.util.SplitSelectStateController;
public class SplitInstructionsView extends LinearLayout {
    private static final int BOUNCE_DURATION = 250;
    private static final float BOUNCE_HEIGHT = 20;
    private static final int DURATION_DEFAULT_SPLIT_DISMISS = 350;

    private final StatefulActivity mLauncher;
    public boolean mIsCurrentlyAnimating = false;
@@ -137,9 +142,24 @@ public class SplitInstructionsView extends LinearLayout {
        SplitSelectStateController splitSelectController =
                ((RecentsView) mLauncher.getOverviewPanel()).getSplitSelectController();

        splitSelectController.getSplitAnimationController().playPlaceholderDismissAnim(mLauncher,
                LAUNCHER_SPLIT_SELECTION_EXIT_CANCEL_BUTTON);
        mLauncher.getStateManager().goToState(LauncherState.NORMAL);
        StateManager stateManager = mLauncher.getStateManager();
        BaseState startState = stateManager.getState();
        long duration = startState.getTransitionDuration(mLauncher, false);
        if (duration == 0) {
            // Case where we're in contextual on workspace (NORMAL), which by default has 0
            // transition duration
            duration = DURATION_DEFAULT_SPLIT_DISMISS;
        }
        StateAnimationConfig config = new StateAnimationConfig();
        config.duration = duration;
        AnimatorSet stateAnim = stateManager.createAtomicAnimation(
                startState, NORMAL, config);
        AnimatorSet dismissAnim = splitSelectController.getSplitAnimationController()
                .createPlaceholderDismissAnim(mLauncher,
                        LAUNCHER_SPLIT_SELECTION_EXIT_CANCEL_BUTTON, duration);
        stateAnim.play(dismissAnim);
        stateManager.setCurrentAnimation(stateAnim, NORMAL);
        stateAnim.start();
    }

    void ensureProperRotation() {