From 648bd1151f115b29a73adcd51ad7c7c1a61f2e96 Mon Sep 17 00:00:00 2001 From: Alexey Kuzmin Date: Tue, 23 Apr 2019 19:36:06 +0100 Subject: [PATCH] Change attrbute of double-power-to-camera vibration Test: turn haptic feedback vibration strength to low. Double-power to camera, squeeze for Assistant and fingerprint vibrations should still feel high strength. Bug:123870990 Change-Id: I25ea871fabfe42b634b15c6302fd73af7ba3887b --- .../android/systemui/statusbar/phone/StatusBar.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index c01367a4d2139..fe40eedf6fce1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -319,6 +319,17 @@ public class StatusBar extends SystemUI implements DemoMode, /** If true, the lockscreen will show a distinct wallpaper */ public static final boolean ENABLE_LOCKSCREEN_WALLPAPER = true; + private static final AudioAttributes AUDIO_ATTRIBUTES = + new AudioAttributes.Builder() + .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) + // Temporary fix for b/123870990. No time in this release to + // introduce a new vibration type, but we need to distinguish these vibrations + // from other haptic feedback vibrations. Fortunately, Alarm vibrations have + // exactly the same behavior as we need + // TODO: refactor within the scope of b/132170758 + .setUsage(AudioAttributes.USAGE_ALARM) + .build(); + static { boolean onlyCoreApps; try { @@ -3672,7 +3683,7 @@ public class StatusBar extends SystemUI implements DemoMode, private void vibrateForCameraGesture() { // Make sure to pass -1 for repeat so VibratorService doesn't stop us when going to sleep. - mVibrator.vibrate(mCameraLaunchGestureVibePattern, -1 /* repeat */); + mVibrator.vibrate(mCameraLaunchGestureVibePattern, -1 /* repeat */, AUDIO_ATTRIBUTES); } /**