OSDN Git Service

Fix bug 2670395 and 2599698
authorJean-Michel Trivi <jmtrivi@google.com>
Tue, 11 May 2010 03:02:46 +0000 (20:02 -0700)
committerJean-Michel Trivi <jmtrivi@google.com>
Tue, 11 May 2010 16:20:49 +0000 (09:20 -0700)
commit392a2bbb52688ebd25768a7784d9edca7f498110
tree5ad454ac9523fbfc4f8e6f0b9509f415cf44f406
parentf78acacb0d7a8e4d9e85a1cd6eed0f6bb38d6776
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
media/java/android/media/AudioManager.java
media/java/android/media/AudioService.java
services/java/com/android/server/NotificationPlayer.java