From 0f5a1e366191bad12cc9bcfa4f8bd071b71b91d9 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Tue, 28 Sep 2021 17:35:58 +0000 Subject: [PATCH] Prevent repeated haptics on task dismissal. Test: manual Fix: 200813011 Change-Id: I74ce053023935a037074db25552f730d30f8ef52 --- .../touchcontrollers/TaskViewTouchController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java index 010f463438..37a1674635 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 @@ public abstract class TaskViewTouchController private TaskView mTaskBeingDragged; + private boolean mIsDismissHapticRunning = false; + public TaskViewTouchController(T activity) { mActivity = activity; mRecentsView = activity.getOverviewPanel(); @@ -365,9 +367,10 @@ public abstract class TaskViewTouchController 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 @@ public abstract class TaskViewTouchController mDetector.setDetectableScrollConditions(0, false); mTaskBeingDragged = null; mCurrentAnimation = null; + mIsDismissHapticRunning = false; } }