From 4a7a9b963b42358a891b42187e46d76ecb92ff31 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Tue, 20 Nov 2012 12:59:41 -0500 Subject: DEFAULT_VIBRATE must always use the default vibe pattern The logic here was backwards, causing the (softer) fallback vibe pattern to be applied if the notification specified a sound (or DEFAULT_SOUND) and also DEFAULT_VIBRATE. The fallback vibe should only play if you have *no* vibration set. Bug: 7588655 Change-Id: Iecdd362729bccedf779b51cc9b90a12014328aff --- services/java/com/android/server/NotificationManagerService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index fa84f486ac59..e2be577b489f 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -1128,13 +1128,13 @@ public class NotificationManagerService extends INotificationManager.Stub final boolean hasCustomVibrate = notification.vibrate != null; // new in 4.2: if there was supposed to be a sound and we're in vibrate mode, - // and no other vibration is specified, we apply the default vibration anyway + // and no other vibration is specified, we fall back to vibration final boolean convertSoundToVibration = !hasCustomVibrate && hasValidSound && (audioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE); - // The DEFAULT_VIBRATE flag trumps any custom vibration. + // The DEFAULT_VIBRATE flag trumps any custom vibration AND the fallback. final boolean useDefaultVibrate = (notification.defaults & Notification.DEFAULT_VIBRATE) != 0; @@ -1147,8 +1147,8 @@ public class NotificationManagerService extends INotificationManager.Stub // does not have the VIBRATE permission. long identity = Binder.clearCallingIdentity(); try { - mVibrator.vibrate(convertSoundToVibration ? mFallbackVibrationPattern - : mDefaultVibrationPattern, + mVibrator.vibrate(useDefaultVibrate ? mDefaultVibrationPattern + : mFallbackVibrationPattern, ((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1); } finally { Binder.restoreCallingIdentity(identity); -- cgit v1.2.3-59-g8ed1b