From 2143e5de733cf239cceb58af24f73385a113759b Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Tue, 17 Jan 2017 16:28:48 -0500 Subject: [PATCH] Don't play notification audio in vibrate mode Bug: 34254134 Test: manual Change-Id: Iac9183b98a699fba26dac24d446f94723c36cb60 --- .../server/notification/NotificationManagerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 0cac406ffac63..a28a02557c451 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -3289,7 +3289,9 @@ public class NotificationManagerService extends SystemService { private boolean playSound(final NotificationRecord record, Uri soundUri) { boolean looping = (record.getNotification().flags & Notification.FLAG_INSISTENT) != 0; // do not play notifications if there is a user of exclusive audio focus - if (!mAudioManager.isAudioFocusExclusive()) { + // or the device is in vibrate mode + if (!mAudioManager.isAudioFocusExclusive() && mAudioManager.getRingerModeInternal() + != AudioManager.RINGER_MODE_VIBRATE) { final long identity = Binder.clearCallingIdentity(); try { final IRingtonePlayer player = mAudioManager.getRingtonePlayer();