summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2010-11-01 10:21:46 -0700
committerAndroid Code Review <code-review@android.com>2010-11-01 10:21:46 -0700
commit7804e2b95a88ab1f01d15f2b0a6b7d83a64820de (patch)
tree3e2b8585a14770c29253a3eb871fbdf5160b4c87
parent77a7c123c3473131a6e2cda32c25d00333bc46fd (diff)
parenta6ee6de3a7deafdd011bf0dc3c346b0586cfbc4a (diff)
downloadMusic-tools_r9.tar.gz
Merge "Make PlaylistBrowserActivity handle missing playlist extras."tools_r9tools_r8froyo-plus-aosp
-rw-r--r--src/com/android/music/PlaylistBrowserActivity.java31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/com/android/music/PlaylistBrowserActivity.java b/src/com/android/music/PlaylistBrowserActivity.java
index 8c79e64..6149aa0 100644
--- a/src/com/android/music/PlaylistBrowserActivity.java
+++ b/src/com/android/music/PlaylistBrowserActivity.java
@@ -98,18 +98,27 @@ public class PlaylistBrowserActivity extends ListActivity
mToken = MusicUtils.bindToService(this, new ServiceConnection() {
public void onServiceConnected(ComponentName classname, IBinder obj) {
if (Intent.ACTION_VIEW.equals(action)) {
- long id = Long.parseLong(intent.getExtras().getString("playlist"));
- if (id == RECENTLY_ADDED_PLAYLIST) {
- playRecentlyAdded();
- } else if (id == PODCASTS_PLAYLIST) {
- playPodcasts();
- } else if (id == ALL_SONGS_PLAYLIST) {
- long [] list = MusicUtils.getAllSongs(PlaylistBrowserActivity.this);
- if (list != null) {
- MusicUtils.playAll(PlaylistBrowserActivity.this, list, 0);
- }
+ Bundle b = intent.getExtras();
+ if (b == null) {
+ Log.w(TAG, "Unexpected:getExtras() returns null.");
} else {
- MusicUtils.playPlaylist(PlaylistBrowserActivity.this, id);
+ try {
+ long id = Long.parseLong(b.getString("playlist"));
+ if (id == RECENTLY_ADDED_PLAYLIST) {
+ playRecentlyAdded();
+ } else if (id == PODCASTS_PLAYLIST) {
+ playPodcasts();
+ } else if (id == ALL_SONGS_PLAYLIST) {
+ long[] list = MusicUtils.getAllSongs(PlaylistBrowserActivity.this);
+ if (list != null) {
+ MusicUtils.playAll(PlaylistBrowserActivity.this, list, 0);
+ }
+ } else {
+ MusicUtils.playPlaylist(PlaylistBrowserActivity.this, id);
+ }
+ } catch (NumberFormatException e) {
+ Log.w(TAG, "Playlist id missing or broken");
+ }
}
finish();
return;