Merge "Use stream type if set by user" into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6104fb2862
@@ -1931,12 +1931,7 @@ public class NotificationManagerService extends SystemService {
|
|||||||
if (hasValidSound) {
|
if (hasValidSound) {
|
||||||
boolean looping =
|
boolean looping =
|
||||||
(notification.flags & Notification.FLAG_INSISTENT) != 0;
|
(notification.flags & Notification.FLAG_INSISTENT) != 0;
|
||||||
AudioAttributes audioAttributes;
|
AudioAttributes audioAttributes = audioAttributesForNotification(notification);
|
||||||
if (notification.audioAttributes != null) {
|
|
||||||
audioAttributes = notification.audioAttributes;
|
|
||||||
} else {
|
|
||||||
audioAttributes = Notification.AUDIO_ATTRIBUTES_DEFAULT;
|
|
||||||
}
|
|
||||||
mSoundNotification = record;
|
mSoundNotification = record;
|
||||||
// do not play notifications if stream volume is 0 (typically because
|
// 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
|
// 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) {
|
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;
|
return n.audioAttributes;
|
||||||
} else if (n.audioStreamType >= 0 && n.audioStreamType < AudioSystem.getNumStreamTypes()) {
|
} else if (n.audioStreamType >= 0 && n.audioStreamType < AudioSystem.getNumStreamTypes()) {
|
||||||
// the stream type is valid, use it
|
// the stream type is valid, use it
|
||||||
|
|||||||
Reference in New Issue
Block a user