Skip to content

Commit 15db00e

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "DEFAULT_VIBRATE must always use the default vibe pattern" into jb-mr1.1-dev
2 parents 4d931ac + 4a7a9b9 commit 15db00e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

services/java/com/android/server/NotificationManagerService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,13 +1128,13 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
11281128
final boolean hasCustomVibrate = notification.vibrate != null;
11291129

11301130
// new in 4.2: if there was supposed to be a sound and we're in vibrate mode,
1131-
// and no other vibration is specified, we apply the default vibration anyway
1131+
// and no other vibration is specified, we fall back to vibration
11321132
final boolean convertSoundToVibration =
11331133
!hasCustomVibrate
11341134
&& hasValidSound
11351135
&& (audioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE);
11361136

1137-
// The DEFAULT_VIBRATE flag trumps any custom vibration.
1137+
// The DEFAULT_VIBRATE flag trumps any custom vibration AND the fallback.
11381138
final boolean useDefaultVibrate =
11391139
(notification.defaults & Notification.DEFAULT_VIBRATE) != 0;
11401140

@@ -1147,8 +1147,8 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
11471147
// does not have the VIBRATE permission.
11481148
long identity = Binder.clearCallingIdentity();
11491149
try {
1150-
mVibrator.vibrate(convertSoundToVibration ? mFallbackVibrationPattern
1151-
: mDefaultVibrationPattern,
1150+
mVibrator.vibrate(useDefaultVibrate ? mDefaultVibrationPattern
1151+
: mFallbackVibrationPattern,
11521152
((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
11531153
} finally {
11541154
Binder.restoreCallingIdentity(identity);

0 commit comments

Comments
 (0)