diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java index 11f0ff3259..e458c1f022 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java @@ -425,12 +425,18 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mMainThreadHandler.removeCallbacks(mCancelRecentsAnimationRunnable); mMainThreadHandler.postDelayed(mCancelRecentsAnimationRunnable, 100); } - mVelocityTracker.recycle(); - mVelocityTracker = null; - mMotionPauseDetector.clear(); + cleanupAfterGesture(); TraceHelper.INSTANCE.endSection(traceToken); } + private void cleanupAfterGesture() { + if (mVelocityTracker != null) { + mVelocityTracker.recycle(); + mVelocityTracker = null; + } + mMotionPauseDetector.clear(); + } + @Override public void notifyOrientationSetup() { mRotationTouchHelper.onStartGesture(); @@ -453,6 +459,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC Preconditions.assertUIThread(); removeListener(); mInteractionHandler = null; + cleanupAfterGesture(); mOnCompleteCallback.accept(this); }