diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2013-02-06 12:35:07 -0800 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2013-02-12 15:30:39 -0800 |
commit | 97ad2cd1a80eef7db0fe19f15c417de4fa752519 (patch) | |
tree | cb7bc55c36a9089d104f7ca79847ed3b68acc081 /packages | |
parent | d21267a26845c36842990e0705a470b92caa7628 (diff) | |
download | frameworks_base-97ad2cd1a80eef7db0fe19f15c417de4fa752519.zip frameworks_base-97ad2cd1a80eef7db0fe19f15c417de4fa752519.tar.gz frameworks_base-97ad2cd1a80eef7db0fe19f15c417de4fa752519.tar.bz2 |
No AudioFocus for notifications when media played remotely
Don't use AudioFocus when playing a notification when media is
playing remotely. This behavior may be accompanied by
rules in the device's audio policy to not route the notifications
to the remote display.
Bug 7485803
Change-Id: I8b96aa59cace75f6e9a0e73799ef8c75e9ee97aa
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java b/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java index 6a12eb1..ba2fbe3 100644 --- a/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java +++ b/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java @@ -90,12 +90,14 @@ public class NotificationPlayer implements OnCompletionListener { player.prepare(); if ((mCmd.uri != null) && (mCmd.uri.getEncodedPath() != null) && (mCmd.uri.getEncodedPath().length() > 0)) { - if (mCmd.looping) { - audioManager.requestAudioFocus(null, mCmd.stream, - AudioManager.AUDIOFOCUS_GAIN); - } else { - audioManager.requestAudioFocus(null, mCmd.stream, - AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK); + if (!audioManager.isMusicActiveRemotely()) { + if (mCmd.looping) { + audioManager.requestAudioFocus(null, mCmd.stream, + AudioManager.AUDIOFOCUS_GAIN); + } else { + audioManager.requestAudioFocus(null, mCmd.stream, + AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK); + } } } player.setOnCompletionListener(NotificationPlayer.this); |