summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Android Build Merger (Role) <noreply-android-build-merger@google.com> 2018-03-29 16:44:30 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-03-29 16:44:30 +0000
commita4d4c8e593bd58651e4aff3e7d106d1169fd89dc (patch)
tree052998e34fcbcd6ece7e03af10a3dc057a525c9a
parentf9767031dfda367c5ca55b95046db048b4be2a3e (diff)
parent0af55843d2f4172e9476e965fa05655d25e90360 (diff)
Merge "Merge "NotificationManagerService: don't play notif in SILENT mode" into pi-dev am: a908ec2a36 am: 0babc73c89"
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index e930f70fbec3..31b0461b53b4 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -4692,11 +4692,12 @@ 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
- // or the device is in vibrate mode
- if (!mAudioManager.isAudioFocusExclusive() && (mAudioManager.getRingerModeInternal()
- != AudioManager.RINGER_MODE_VIBRATE || mAudioManager.getStreamVolume(
- AudioAttributes.toLegacyStreamType(record.getAudioAttributes())) != 0)) {
+ // play notifications if there is no user of exclusive audio focus
+ // and the stream volume is not 0 (non-zero volume implies not silenced by SILENT or
+ // VIBRATE ringer mode)
+ if (!mAudioManager.isAudioFocusExclusive()
+ && (mAudioManager.getStreamVolume(
+ AudioAttributes.toLegacyStreamType(record.getAudioAttributes())) != 0)) {
final long identity = Binder.clearCallingIdentity();
try {
final IRingtonePlayer player = mAudioManager.getRingtonePlayer();