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

Commit 86f3f52b authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/22598537',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/22598537', 'googleplex-android-review.googlesource.com/22603500'] into tm-qpr3-release.

Change-Id: Iae0b3c09526d92bcb7df495610cd8ad8c4639db3
parents a6e66aa9 4e209c52
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -642,14 +642,8 @@ public class TaskbarLauncherStateController {
        long resetDuration = mControllers.taskbarStashController.isInApp()
                ? duration
                : duration / 2;
        boolean shouldReset =
                mControllers.taskbarTranslationController.shouldResetBackToZero(resetDuration);
        boolean goingToLauncher = isAnimatingToLauncher();
        boolean isNormalState = mLauncherState == LauncherState.NORMAL;
        // Taskbar should always reset when animating to launcher in normal state to ensure there
        // is no jump during the handoff to the hotseat.
        if ((goingToLauncher && isNormalState)
                || (shouldReset && (goingToLauncher || isNormalState))) {
        if (!mControllers.taskbarTranslationController.willAnimateToZeroBefore(resetDuration)
                && (isAnimatingToLauncher() || mLauncherState == LauncherState.NORMAL)) {
            animatorSet.play(mControllers.taskbarTranslationController
                    .createAnimToResetTranslation(resetDuration));
        }
+5 −16
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
    private boolean mHasSprungOnceThisGesture;
    private @Nullable ValueAnimator mSpringBounce;
    private boolean mGestureEnded;
    private boolean mGestureInProgress;
    private boolean mAnimationToHomeRunning;

    private final boolean mIsTransientTaskbar;
@@ -124,7 +123,6 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable

    private void reset() {
        mGestureEnded = false;
        mGestureInProgress = false;
        mHasSprungOnceThisGesture = false;
    }

@@ -136,24 +134,18 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
    }

    /**
     * Returns {@code true} if we should reset the animation back to zero.
     *
     * Returns {@code false} if there is a gesture in progress, or if we are already animating
     * to 0 within the specified duration.
     * Returns true if we will animate to zero before the input duration.
     */
    public boolean shouldResetBackToZero(long duration) {
        if (mGestureInProgress) {
            return false;
        }
    public boolean willAnimateToZeroBefore(long duration) {
        if (mSpringBounce != null && mSpringBounce.isRunning()) {
            long springDuration = mSpringBounce.getDuration();
            long current = mSpringBounce.getCurrentPlayTime();
            return (springDuration - current >= duration);
            return (springDuration - current < duration);
        }
        if (mTranslationYForSwipe.isAnimatingToValue(0)) {
            return mTranslationYForSwipe.getRemainingTime() >= duration;
            return mTranslationYForSwipe.getRemainingTime() < duration;
        }
        return true;
        return false;
    }

    /**
@@ -196,7 +188,6 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
            mAnimationToHomeRunning = false;
            cancelSpringIfExists();
            reset();
            mGestureInProgress = true;
        }
        /**
         * Called when there is movement to move the taskbar.
@@ -220,7 +211,6 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
                mGestureEnded = true;
                startSpring();
            }
            mGestureInProgress = false;
        }
    }

@@ -232,7 +222,6 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
        pw.println(prefix + "\tmHasSprungOnceThisGesture=" + mHasSprungOnceThisGesture);
        pw.println(prefix + "\tmAnimationToHomeRunning=" + mAnimationToHomeRunning);
        pw.println(prefix + "\tmGestureEnded=" + mGestureEnded);
        pw.println(prefix + "\tmGestureInProgress=" + mGestureInProgress);
        pw.println(prefix + "\tmSpringBounce is running=" + (mSpringBounce != null
                && mSpringBounce.isRunning()));
    }