[flexiglass] Fixes extraneous haptic feedback in pattern bouncer. am: 4e9af5b759

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23334224

Change-Id: I2a59fa48b815303621c6b84fe31199e562abca63
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Alejandro Nijamkin
2023-05-26 00:46:59 +00:00
committed by Automerger Merge Worker

View File

@@ -100,10 +100,14 @@ internal fun PatternBouncer(
// When the current dot is changed, we need to update our animations. // When the current dot is changed, we need to update our animations.
LaunchedEffect(currentDot, isAnimationEnabled) { LaunchedEffect(currentDot, isAnimationEnabled) {
view.performHapticFeedback( // Perform haptic feedback, but only if the current dot is not null, so we don't perform it
HapticFeedbackConstants.VIRTUAL_KEY, // when the UI first shows up or when the user lifts their pointer/finger.
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING, if (currentDot != null) {
) view.performHapticFeedback(
HapticFeedbackConstants.VIRTUAL_KEY,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING,
)
}
if (!isAnimationEnabled) { if (!isAnimationEnabled) {
return@LaunchedEffect return@LaunchedEffect