Handle cancelled All Apps transitions.

Previously if this was cancelled mid-animation, the background
panel could get stuck on the screen.

To reproduce this consistently, I automatically cancelled the
animation 50ms after it started. Here's how that looked:
 - Before: https://drive.google.com/file/d/1tiW7mFehk3of-qYe1_HBZSmJLjU4VVmv/view?usp=drive_link&resourcekey=0-tH7YccjcNuXe8qKaL_8H2w
 - After: https://drive.google.com/file/d/1XpRy8FusaSZkJTGa7FHhUuqMUHkeI_UA/view?usp=drive_link&resourcekey=0-gvoyXE3puv7lW78kgKLEng

Fix: 383731295
Test: Manual
Flag: EXEMPT bugfix
Change-Id: I9423b75800a002419a56a3fe3f93b2e7350aeaa0
This commit is contained in:
Andy Wickham committed 2024-12-13 17:59:32 -08:00
1 parent 29ccf8703b
commit f6850bd4f2
1 file changed
+7
@@ -34,6 +34,7 @@ import static com.android.launcher3.util.SystemUiController.FLAG_LIGHT_NAV;
import static com.android.launcher3.util.SystemUiController.UI_STATE_ALL_APPS;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.util.FloatProperty;
import android.view.HapticFeedbackConstants;
@@ -365,6 +366,12 @@ public class AllAppsTransitionController
Interpolator verticalProgressInterpolator = config.getInterpolator(ANIM_VERTICAL_PROGRESS,
config.isUserControlled() ? LINEAR : DECELERATE_1_7);
Animator anim = createSpringAnimation(mProgress, targetProgress);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animation) {
setProgress(targetProgress);
}
});
anim.setInterpolator(verticalProgressInterpolator);
builder.add(anim);