From 7de574175bb81354cad47e472bdaba1dd28ac5b0 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 17 May 2018 16:30:46 -0700 Subject: [PATCH] Fix a couple issues with swiping up from home - Don't update the animation to go from 0 to 1; instead, update the interpolator to clamp to the remaining progress (b/79773309) - Fix NPE that can happen in a race between the atomic animation ending and the non-atomic animation canceling/ending Change-Id: I313251dc5cbd7b931b043fc3e840bb4ab368a790 --- .../uioverrides/PortraitStatesTouchController.java | 10 ++-------- .../touch/AbstractStateChangeTouchController.java | 12 +++++++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java index 54ecb289ab..987f952baf 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/PortraitStatesTouchController.java @@ -189,14 +189,8 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr if (isFling && expectedDuration != 0) { // Update all apps interpolator to add a bit of overshoot starting from currFraction final float currFraction = mCurrentAnimation.getProgressFraction(); - mAllAppsInterpolatorWrapper.baseInterpolator - = new OvershootInterpolator(Math.min(Math.abs(velocity) / 3, 3f)) { - @Override - public float getInterpolation(float t) { - return super.getInterpolation(t) + ((1 - t) * currFraction); - } - }; - animator.setFloatValues(0, 1); + mAllAppsInterpolatorWrapper.baseInterpolator = Interpolators.clampToProgress( + new OvershootInterpolator(Math.min(Math.abs(velocity), 3f)), currFraction, 1); animator.setDuration(Math.min(expectedDuration, ATOMIC_DURATION)) .setInterpolator(LINEAR); } diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index e29250a5e4..24382b7d00 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -209,11 +209,13 @@ public abstract class AbstractStateChangeTouchController @Override public void onAnimationSuccess(Animator animation) { cancelAtomicComponentsController(); - mAtomicComponentsStartProgress = mCurrentAnimation.getProgressFraction(); - long duration = (long) (getShiftRange() * 2); - mAtomicComponentsController = AnimatorPlaybackController.wrap( - createAtomicAnimForState(mFromState, mToState, duration), duration); - mAtomicComponentsController.dispatchOnStart(); + if (mCurrentAnimation != null) { + mAtomicComponentsStartProgress = mCurrentAnimation.getProgressFraction(); + long duration = (long) (getShiftRange() * 2); + mAtomicComponentsController = AnimatorPlaybackController.wrap( + createAtomicAnimForState(mFromState, mToState, duration), duration); + mAtomicComponentsController.dispatchOnStart(); + } } }); }