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

Commit e30a551f authored by Jon Miranda's avatar Jon Miranda
Browse files

Fix bug where unstash animation plays twice.

Fixes: 282056846
Change-Id: I372444684fafd246369f6bc1e77c5e6fbb651c6f
Flag: ENABLE_TRANSIENT_TASKBAR
Test: open app, then very quickly swipe to unstash taskbar
parent 52d47645
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.launcher3.taskbar;

import static com.android.launcher3.anim.AnimatedFloat.VALUE;

import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;

import androidx.annotation.Nullable;
@@ -85,6 +86,15 @@ public class TaskbarSpringOnStashController implements LoggableTaskbarController
                .build(mTranslationForStash, VALUE);
    }

    /**
     * Returns an animation to reset the stash translation back to 0 when unstashing.
     */
    public @Nullable ObjectAnimator createResetAnimForUnstash() {
        if (!mIsTransientTaskbar) {
            return null;
        }
        return mTranslationForStash.animateToValue(0);
    }

    @Override
    public void dumpLogs(String prefix, PrintWriter pw) {
+12 −0
Original line number Diff line number Diff line
@@ -799,6 +799,9 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
        if (isStashed) {
            play(skippable, mControllers.taskbarSpringOnStashController.createSpringToStash(),
                    0, duration, LINEAR);
        } else {
            play(skippable, mControllers.taskbarSpringOnStashController.createResetAnimForUnstash(),
                    0, duration, LINEAR);
        }

        mControllers.taskbarViewController.addRevealAnimToIsStashed(skippable, isStashed, duration,
@@ -1218,6 +1221,15 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
                    && mLastStartedTransitionType == TRANSITION_DEFAULT
                    && animationType != TRANSITION_DEFAULT;

            // It is possible for stash=false to be requested by TRANSITION_HOME_TO_APP and
            // TRANSITION_DEFAULT in quick succession. In this case, we should ignore
            // transitionTypeChanged because the animations are exactly the same.
            if (transitionTypeChanged
                    && (!mIsStashed && !isStashed)
                    && animationType == TRANSITION_HOME_TO_APP) {
                transitionTypeChanged = false;
            }

            if (mIsStashed != isStashed || transitionTypeChanged) {
                mIsStashed = isStashed;
                mLastStartedTransitionType = animationType;