From 2bb55f148c2615cb13feaada6236e4c2f83035ed Mon Sep 17 00:00:00 2001 From: Brad Hinegardner Date: Thu, 4 May 2023 19:39:56 +0000 Subject: [PATCH] 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 --- .../keyguard/ui/binder/KeyguardBottomAreaVibrations.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaVibrations.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaVibrations.kt index 568db2f543b69..e7803c5e964c6 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaVibrations.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaVibrations.kt @@ -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(