diff options
| author | 2014-11-18 22:20:03 +0000 | |
|---|---|---|
| committer | 2014-11-18 22:20:05 +0000 | |
| commit | 6104fb2862e591fcd62660f5cd11ab5ca48adebb (patch) | |
| tree | 37f62c814baf50c5b7ca93dc27ce76644c026633 | |
| parent | 25f20bdeab04c72b4fda405ad1bfbd2ed42ff121 (diff) | |
| parent | 1c066306c6cac35210e27b5af70fa6584bcad11d (diff) | |
Merge "Use stream type if set by user" into lmp-mr1-dev
| -rw-r--r-- | services/core/java/com/android/server/notification/NotificationManagerService.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 42a855165c20..6958ff842b8a 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -1931,12 +1931,7 @@ public class NotificationManagerService extends SystemService { if (hasValidSound) { boolean looping = (notification.flags & Notification.FLAG_INSISTENT) != 0; - AudioAttributes audioAttributes; - if (notification.audioAttributes != null) { - audioAttributes = notification.audioAttributes; - } else { - audioAttributes = Notification.AUDIO_ATTRIBUTES_DEFAULT; - } + AudioAttributes audioAttributes = audioAttributesForNotification(notification); mSoundNotification = record; // do not play notifications if stream volume is 0 (typically because // ringer mode is silent) or if there is a user of exclusive audio focus @@ -2030,7 +2025,9 @@ public class NotificationManagerService extends SystemService { } private static AudioAttributes audioAttributesForNotification(Notification n) { - if (n.audioAttributes != null) { + if (n.audioAttributes != null + && !Notification.AUDIO_ATTRIBUTES_DEFAULT.equals(n.audioAttributes)) { + // the audio attributes are set and different from the default, use them return n.audioAttributes; } else if (n.audioStreamType >= 0 && n.audioStreamType < AudioSystem.getNumStreamTypes()) { // the stream type is valid, use it |