Merge "Prevent repeated haptics on task dismissal." into sc-v2-dev
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
index 010f463..37a1674 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
@@ -84,6 +84,8 @@
 
     private TaskView mTaskBeingDragged;
 
+    private boolean mIsDismissHapticRunning = false;
+
     public TaskViewTouchController(T activity) {
         mActivity = activity;
         mRecentsView = activity.getOverviewPanel();
@@ -365,9 +367,10 @@
         mCurrentAnimation.startWithVelocity(mActivity, goingToEnd,
                 velocity * orientationHandler.getSecondaryTranslationDirectionFactor(),
                 mEndDisplacement, animationDuration);
-        if (goingUp && goingToEnd) {
+        if (goingUp && goingToEnd && !mIsDismissHapticRunning) {
             VibratorWrapper.INSTANCE.get(mActivity).vibrate(TASK_DISMISS_VIBRATION_PRIMITIVE,
                     TASK_DISMISS_VIBRATION_PRIMITIVE_SCALE, TASK_DISMISS_VIBRATION_FALLBACK);
+            mIsDismissHapticRunning = true;
         }
     }
 
@@ -376,5 +379,6 @@
         mDetector.setDetectableScrollConditions(0, false);
         mTaskBeingDragged = null;
         mCurrentAnimation = null;
+        mIsDismissHapticRunning = false;
     }
 }