History log of /frameworks/base/services/java/com/android/server/NotificationPlayer.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
392a2bbb52688ebd25768a7784d9edca7f498110 11-May-2010 Jean-Michel Trivi <jmtrivi@google.com> 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 completion listener
to not be called, which with the AudioFocus logic causes the Music
app to pause and never resume. The NotificationPlayer modifications
cause the MediaPlayer for the notification to only request audio
focus when the data source is not empty.
The audio focus code in AudioService is defensively synchronized
against a unique lock, and the exception observed in bug 2670395
is explicitely caught in case another edge case wasn't caught by
this fix.
The AudioFocus handling in AudioManager is modified so only the
requestAudioFocus and abandonAudioFocus methods are meant to be
used, as registerAudioFocusListener and unregisterAudioFocusListener
provided no additional functionality over the request/abandon
methods. abandonAudioFocus() also removes the listener from the
map in AudioManager since after abandonning focus, the listener
would no longer be called.

Change-Id: I3b553ee8a8163c25e01117d7e5479dd5fdfa7c6b
/frameworks/base/services/java/com/android/server/NotificationPlayer.java
6cf3d096363c62212870fb71bda8f55eb8d3823c 27-Apr-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2605504 Don't leak a metric ton of NotificationPlayer threads
The Looper on the thread created in order to be notified of the
playback completion of notification sounds, was never stopped, causing
the threads to stay around in wait state.
The fix consists in quitting the Looper used for the previous sound
when a new sound is started.

Change-Id: Ia4b3d16b5447ffafacc093db3a7fe05574089935
/frameworks/base/services/java/com/android/server/NotificationPlayer.java
a99f5f43cdb24f60fd1adc3fdfcb8d6ff101a0fd 17-Apr-2010 Jean-Michel Trivi <jmtrivi@google.com> Fix bug 2599698 Music paused by itself
The NotificationPlayer sets an OnCompletionListener on the
MediaPlayer it's using to play the notification.
NotificationPlayer relies on the completion event to abandon
audio focus.
The player was started before the listener was set. The theory
about the bug is that the player finished playing before the listener
was called. Therefore the audio focus was never abandonned, and
the music didn't resume.

Change-Id: Ic3baf359ea24de0d832a655dc47e745b25bc3dec
/frameworks/base/services/java/com/android/server/NotificationPlayer.java
211957f63913d4a050604e0dfc1e0f80980e3d0c 27-Mar-2010 Jean-Michel Trivi <jmtrivi@google.com> Implement audio focus support in the notification manager.

This change introduces the NotificationPlayer class which was
created from the code of android.media.AsyncPlayer. The only modification
was to modify the construction of the MediaPlayer so it properly issues
onCompletion notifications (which are used to abandon audio focus).

Unless the sound to be played is looped, the notification is transient
and other apps may duck (uses AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK in
audio focus request).
Change-Id: I69cbb71d0892447b934351384e4e24a2e239295b
/frameworks/base/services/java/com/android/server/NotificationPlayer.java