Align the lockscreen shortcuts haptics with the animation

The math for `vibrationDelayMs` was slightly off due to order of operations.

Bug: b/280825875
Test: manual - tap (not long-press) a lockscreen shortcut, and feel that the vibration starts and ends at the same time as the shake animation.
Change-Id: I616e99c484b4509d2a526ab5cd6a2612c93d52a2
This commit is contained in:
Brad Hinegardner
2023-05-04 19:39:56 +00:00
parent 284f8b62da
commit 2bb55f148c

View File

@@ -31,7 +31,9 @@ object KeyguardBottomAreaVibrations {
VibrationEffect.startComposition()
.apply {
val vibrationDelayMs =
(ShakeAnimationDuration.inWholeMilliseconds / ShakeAnimationCycles * 2).toInt()
(ShakeAnimationDuration.inWholeMilliseconds / (ShakeAnimationCycles * 2))
.toInt()
val vibrationCount = ShakeAnimationCycles.toInt() * 2
repeat(vibrationCount) {
addPrimitive(