diff options
| author | 2023-05-18 09:50:46 -0700 | |
|---|---|---|
| committer | 2023-05-25 14:23:09 -0700 | |
| commit | 4e9af5b7592bc0abccf639c8e771c34e001baef4 (patch) | |
| tree | 87854715eb06f3d88887d0afee0cd6d9ff139a9f | |
| parent | 33ddd9ab1789643fc9696f109987faa24e6f3774 (diff) | |
[flexiglass] Fixes extraneous haptic feedback in pattern bouncer.
There's a bug where we vibrate when we first open the bouncer UI in the
pattern configuration and when we stop dragging. This CL fixes that.
Bug: 281871687
Test: manually verified that, after the fix, we only get haptic feedback
when selecting a new dot and not when we first bring up the UI nor when
we stop dragging.
Change-Id: I808698e74a3d9300c11b7422fc70dfdfc5fea80b
| -rw-r--r-- | packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt index e20833d7db17..0609d1409c07 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt @@ -100,10 +100,14 @@ internal fun PatternBouncer( // When the current dot is changed, we need to update our animations. LaunchedEffect(currentDot, isAnimationEnabled) { - view.performHapticFeedback( - HapticFeedbackConstants.VIRTUAL_KEY, - HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING, - ) + // Perform haptic feedback, but only if the current dot is not null, so we don't perform it + // when the UI first shows up or when the user lifts their pointer/finger. + if (currentDot != null) { + view.performHapticFeedback( + HapticFeedbackConstants.VIRTUAL_KEY, + HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING, + ) + } if (!isAnimationEnabled) { return@LaunchedEffect |