Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 4c0fc03

Browse files
committed
When in vibrate mode, all notifications will vibrate.
(Unless the notification specifies no ringtone AND no vibration, in which case it will remain silent.) Bug: 7516358 Change-Id: I926d0fe0165b9622cd117e6c3ef6e3637772b444
1 parent 85abb08 commit 4c0fc03

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,8 +1086,17 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
10861086
}
10871087

10881088
// vibrate
1089+
// new in 4.2: if there was supposed to be a sound and we're in vibrate mode,
1090+
// we always vibrate, even if no vibration was specified
1091+
final boolean convertSoundToVibration =
1092+
notification.vibrate == null
1093+
&& (useDefaultSound || notification.sound != null)
1094+
&& (audioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE);
1095+
10891096
final boolean useDefaultVibrate =
1090-
(notification.defaults & Notification.DEFAULT_VIBRATE) != 0;
1097+
(notification.defaults & Notification.DEFAULT_VIBRATE) != 0
1098+
|| convertSoundToVibration;
1099+
10911100
if ((useDefaultVibrate || notification.vibrate != null)
10921101
&& !(audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT)) {
10931102
mVibrateNotification = r;

0 commit comments

Comments
 (0)