diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2010-05-12 07:55:09 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-05-12 07:55:09 -0700 |
commit | 9f35d39a05bbf02ded519c1a4b3bf50f933a0cad (patch) | |
tree | ba14ddfc87e14309dce23f462a3d1f459dff233e /services/java/com/android/server | |
parent | b3390135890800b9c5f0ab58ae3af80ab200dd8e (diff) | |
parent | ea37d9b489aac1a4a8de71887581fe712e26e144 (diff) | |
download | frameworks_base-9f35d39a05bbf02ded519c1a4b3bf50f933a0cad.zip frameworks_base-9f35d39a05bbf02ded519c1a4b3bf50f933a0cad.tar.gz frameworks_base-9f35d39a05bbf02ded519c1a4b3bf50f933a0cad.tar.bz2 |
am ea37d9b4: am aaa01b18: Merge " Fix bug 2670395 and 2599698 When the user selects a "Silent" notification sound, the Uri encoded path is an empty string. Setting this Uri as the data source of the MediaPlayer used to play notifications caused the comp
Merge commit 'ea37d9b489aac1a4a8de71887581fe712e26e144' into kraken
* commit 'ea37d9b489aac1a4a8de71887581fe712e26e144':
Fix bug 2670395 and 2599698
Diffstat (limited to 'services/java/com/android/server')
-rw-r--r-- | services/java/com/android/server/NotificationPlayer.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/services/java/com/android/server/NotificationPlayer.java b/services/java/com/android/server/NotificationPlayer.java index 0b1a03b..52d2381 100644 --- a/services/java/com/android/server/NotificationPlayer.java +++ b/services/java/com/android/server/NotificationPlayer.java @@ -88,12 +88,15 @@ public class NotificationPlayer implements OnCompletionListener { player.setDataSource(mCmd.context, mCmd.uri); player.setLooping(mCmd.looping); player.prepare(); - if (mCmd.looping) { - audioManager.requestAudioFocus(null, mCmd.stream, - AudioManager.AUDIOFOCUS_GAIN); - } else { - audioManager.requestAudioFocus(null, mCmd.stream, - AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK); + 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); + } } player.setOnCompletionListener(NotificationPlayer.this); player.start(); |