OSDN Git Service

Fix for a hang when attempting to stream a non-existing content.
authorRavi K Yenduri <yenduri@pv.com>
Sat, 30 May 2009 03:34:25 +0000 (22:34 -0500)
committerMarco Nelissen <marcone@google.com>
Thu, 4 Jun 2009 17:48:17 +0000 (10:48 -0700)
commit11232b0a86408237d8f4f6ebe324a27d27d72ca3
treed065033e0cdaa471ea66adc2ce475e304989ef32
parent3d54a51b3ce7f7121bcf4b8bd99510ac1cfbaa37
Fix for a hang when attempting to stream a non-existing content.

 -- StreamStarter Activity is binding the the MediaPlaybackService. As part of this, it is registering for the intent "ASYNC_OPEN_COMPLETE".
 -- In the normal scenario, after prepareAsync completes, the OnPreparedListener is fired. This ends up broadcasting the "ASYNC_OPEN_COMPLETE" intent.
 -- Since the StreamStarter Activity has registered for the intent, it will receive the even on it's listener, "onReceive". Here, the MediaPlaybackService
    "play" is called which starts the actual playback. And, the PLAYBACK_VIEWER intent is sent. This starts the MediaPlaybackActivity. And, "finish" is
    called in the StreamStarter Activity that will kill the activity. From this point, the MediaPlayback Activity takes over (this activity is the screen
    where you see the progress bar, and the metadata stuff).
 -- Now, in this scenario, there is a failure in the "prepareAsync" command. Because of this the ASYNC_OPEN_COMPLETE intent is never broadcasted, and
    hence the StreamStarterActivity never finishes.

- Proposed solution:
  -- Register the StreamStarter Activity to another intent (PLAYBACK_COMPLETE).
  -- In OnReceive call, add a condition that when the received intent is PLAYBACK_COMPLETE, "finish" the activity.
     needs to be broadcasted only if this is a single attempt playback, i.e., if "mOneShot" is "true".
res/values/strings.xml
src/com/android/music/StreamStarter.java