Play haptic after dismissal even if no neighbors spring into place.
Currently haptics will play as the neighbors reflow into place, but if none reflow, we also want a haptic to fire.
Fix: 398198796
Test: Manual. Dismiss end task so none move, feel haptic play.
Flag: com.android.launcher3.enable_expressive_dismiss_task_motion
Change-Id: I467a45472992722bcd05ef31cbaeb157441c4931
diff --git a/quickstep/src/com/android/quickstep/views/RecentsDismissUtils.kt b/quickstep/src/com/android/quickstep/views/RecentsDismissUtils.kt
index d39b528..b74764d 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsDismissUtils.kt
+++ b/quickstep/src/com/android/quickstep/views/RecentsDismissUtils.kt
@@ -295,7 +295,7 @@
val maxDismissSettlingVelocity =
recentsView.pagedOrientationHandler.getSecondaryDimension(recentsView)
MSDLPlayerWrapper.INSTANCE.get(recentsView.context)
- .playToken(
+ ?.playToken(
MSDLToken.CANCEL,
InteractionProperties.DynamicVibrationScale(
boundToRange(abs(velocity) / maxDismissSettlingVelocity, 0f, 1f),
@@ -427,6 +427,11 @@
driverProgressThreshold = dismissedTaskGap,
isSpringDirectionVertical = false,
)
+ } else {
+ springAnimationDriver.addEndListener { _, _, _, _ ->
+ // Play the same haptic as when neighbors spring into place.
+ MSDLPlayerWrapper.INSTANCE.get(recentsView.context)?.playToken(MSDLToken.CANCEL)
+ }
}
// Start animations and remove the dismissed task at the end, dismiss immediately if no