From eeac1aba306b4593df0d7290eeb57ed52a07f4be Mon Sep 17 00:00:00 2001 From: Matt Casey Date: Tue, 22 Jun 2021 10:14:10 -0400 Subject: [PATCH] Send a zero for assist invocation on animation end When a corner gesture doesn't complete, we animate the progress from its current value back to 0. When it hits 0, sysui will perform some cleanup e.g. removing the window. However, it's possible the animator won't return exactly 0 and will complete, so we should send an explicit 0 whenever the animator completes. Bug: 187768368 Test: We don't have a repro for the bug, but expect this should be more robust. Tested to validate it didn't regress. Change-Id: Id65f94534363c326fc2c8d0a9114a3c036aa55e4 --- .../inputconsumers/AssistantInputConsumer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java index a3cd7dffb2..510820a1e5 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java @@ -26,6 +26,8 @@ import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.Utilities.squaredHypot; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.Resources; @@ -199,6 +201,14 @@ public class AssistantInputConsumer extends DelegateInputConsumer { float progress = (float) valueAnimator.getAnimatedValue(); SystemUiProxy.INSTANCE.get(mContext).onAssistantProgress(progress); }); + // Ensure that we always send a zero at the end to clear the invocation state. + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + super.onAnimationEnd(animation); + SystemUiProxy.INSTANCE.get(mContext).onAssistantProgress(0f); + } + }); animator.setInterpolator(Interpolators.DEACCEL_2); animator.start(); }