am fcdb7609: Include Music app in Global search.

Merge commit 'fcdb7609887efb0a745fc027e1be0c558218e237'

* commit 'fcdb7609887efb0a745fc027e1be0c558218e237':
  Include Music app in Global search.
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 9a7806a..07a5839 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -16,6 +16,5 @@
 
 <resources>
     <color name="appwidget_text">#ff000000</color>
-    <color name="appwidget_shadow">#ffffffff</color>
 </resources>
 
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
deleted file mode 100644
index 539b64f..0000000
--- a/res/values/dimens.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<resources>
-    <!-- Size of widget album art cutout -->
-    <dimen name="appwidget_cutout">198dip</dimen>
-</resources>
diff --git a/src/com/android/music/AlbumBrowserActivity.java b/src/com/android/music/AlbumBrowserActivity.java
index 0d6c150..2a55d08 100644
--- a/src/com/android/music/AlbumBrowserActivity.java
+++ b/src/com/android/music/AlbumBrowserActivity.java
@@ -253,13 +253,13 @@
         switch (item.getItemId()) {
             case PLAY_SELECTION: {
                 // play the selected album
-                int [] list = MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
+                long [] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId));
                 MusicUtils.playAll(this, list, 0);
                 return true;
             }
 
             case QUEUE: {
-                int [] list = MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
+                long [] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId));
                 MusicUtils.addToCurrentPlaylist(this, list);
                 return true;
             }
@@ -272,18 +272,18 @@
             }
 
             case PLAYLIST_SELECTED: {
-                int [] list = MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
-                int playlist = item.getIntent().getIntExtra("playlist", 0);
+                long [] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId));
+                long playlist = item.getIntent().getLongExtra("playlist", 0);
                 MusicUtils.addToPlaylist(this, list, playlist);
                 return true;
             }
             case DELETE_ITEM: {
-                int [] list = MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
+                long [] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId));
                 String f = getString(R.string.delete_album_desc); 
                 String desc = String.format(f, mCurrentAlbumName);
                 Bundle b = new Bundle();
                 b.putString("description", desc);
-                b.putIntArray("items", list);
+                b.putLongArray("items", list);
                 Intent intent = new Intent();
                 intent.setClass(this, DeleteItems.class);
                 intent.putExtras(b);
@@ -332,8 +332,8 @@
                 if (resultCode == RESULT_OK) {
                     Uri uri = intent.getData();
                     if (uri != null) {
-                        int [] list = MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
-                        MusicUtils.addToPlaylist(this, list, Integer.parseInt(uri.getLastPathSegment()));
+                        long [] list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId));
+                        MusicUtils.addToPlaylist(this, list, Long.parseLong(uri.getLastPathSegment()));
                     }
                 }
                 break;
@@ -573,16 +573,15 @@
             // We don't actually need the path to the thumbnail file,
             // we just use it to see if there is album art or not
             String art = cursor.getString(mAlbumArtIndex);
+            long aid = cursor.getLong(0);
             if (unknown || art == null || art.length() == 0) {
                 iv.setImageDrawable(null);
             } else {
-                int artIndex = cursor.getInt(0);
-                Drawable d = MusicUtils.getCachedArtwork(context, artIndex, mDefaultAlbumIcon);
+                Drawable d = MusicUtils.getCachedArtwork(context, aid, mDefaultAlbumIcon);
                 iv.setImageDrawable(d);
             }
             
-            int currentalbumid = MusicUtils.getCurrentAlbumId();
-            int aid = cursor.getInt(0);
+            long currentalbumid = MusicUtils.getCurrentAlbumId();
             iv = vh.play_indicator;
             if (currentalbumid == aid) {
                 iv.setImageDrawable(mNowPlayingOverlay);
diff --git a/src/com/android/music/ArtistAlbumBrowserActivity.java b/src/com/android/music/ArtistAlbumBrowserActivity.java
index 35bf54e..8165979 100644
--- a/src/com/android/music/ArtistAlbumBrowserActivity.java
+++ b/src/com/android/music/ArtistAlbumBrowserActivity.java
@@ -348,20 +348,20 @@
         switch (item.getItemId()) {
             case PLAY_SELECTION: {
                 // play everything by the selected artist
-                int [] list =
+                long [] list =
                     mCurrentArtistId != null ?
-                    MusicUtils.getSongListForArtist(this, Integer.parseInt(mCurrentArtistId))
-                    : MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
+                    MusicUtils.getSongListForArtist(this, Long.parseLong(mCurrentArtistId))
+                    : MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId));
                         
                 MusicUtils.playAll(this, list, 0);
                 return true;
             }
 
             case QUEUE: {
-                int [] list =
+                long [] list =
                     mCurrentArtistId != null ?
-                    MusicUtils.getSongListForArtist(this, Integer.parseInt(mCurrentArtistId))
-                    : MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
+                    MusicUtils.getSongListForArtist(this, Long.parseLong(mCurrentArtistId))
+                    : MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId));
                 MusicUtils.addToCurrentPlaylist(this, list);
                 return true;
             }
@@ -374,30 +374,30 @@
             }
 
             case PLAYLIST_SELECTED: {
-                int [] list =
+                long [] list =
                     mCurrentArtistId != null ?
-                    MusicUtils.getSongListForArtist(this, Integer.parseInt(mCurrentArtistId))
-                    : MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
-                int playlist = item.getIntent().getIntExtra("playlist", 0);
+                    MusicUtils.getSongListForArtist(this, Long.parseLong(mCurrentArtistId))
+                    : MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId));
+                long playlist = item.getIntent().getLongExtra("playlist", 0);
                 MusicUtils.addToPlaylist(this, list, playlist);
                 return true;
             }
             
             case DELETE_ITEM: {
-                int [] list;
+                long [] list;
                 String desc;
                 if (mCurrentArtistId != null) {
-                    list = MusicUtils.getSongListForArtist(this, Integer.parseInt(mCurrentArtistId));
+                    list = MusicUtils.getSongListForArtist(this, Long.parseLong(mCurrentArtistId));
                     String f = getString(R.string.delete_artist_desc);
                     desc = String.format(f, mCurrentArtistName);
                 } else {
-                    list = MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
+                    list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId));
                     String f = getString(R.string.delete_album_desc); 
                     desc = String.format(f, mCurrentAlbumName);
                 }
                 Bundle b = new Bundle();
                 b.putString("description", desc);
-                b.putIntArray("items", list);
+                b.putLongArray("items", list);
                 Intent intent = new Intent();
                 intent.setClass(this, DeleteItems.class);
                 intent.putExtras(b);
@@ -453,13 +453,13 @@
                 if (resultCode == RESULT_OK) {
                     Uri uri = intent.getData();
                     if (uri != null) {
-                        int [] list = null;
+                        long [] list = null;
                         if (mCurrentArtistId != null) {
-                            list = MusicUtils.getSongListForArtist(this, Integer.parseInt(mCurrentArtistId));
+                            list = MusicUtils.getSongListForArtist(this, Long.parseLong(mCurrentArtistId));
                         } else if (mCurrentAlbumId != null) {
-                            list = MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
+                            list = MusicUtils.getSongListForAlbum(this, Long.parseLong(mCurrentAlbumId));
                         }
-                        MusicUtils.addToPlaylist(this, list, Integer.parseInt(uri.getLastPathSegment()));
+                        MusicUtils.addToPlaylist(this, list, Long.parseLong(uri.getLastPathSegment()));
                     }
                 }
                 break;
@@ -644,8 +644,8 @@
             
             vh.line2.setText(songs_albums);
             
-            int currentartistid = MusicUtils.getCurrentArtistId();
-            int artistid = cursor.getInt(mGroupArtistIdIdx);
+            long currentartistid = MusicUtils.getCurrentArtistId();
+            long artistid = cursor.getLong(mGroupArtistIdIdx);
             if (currentartistid == artistid && !isexpanded) {
                 vh.play_indicator.setImageDrawable(mNowPlayingOverlay);
             } else {
@@ -701,13 +701,13 @@
                 iv.setBackgroundDrawable(mDefaultAlbumIcon);
                 iv.setImageDrawable(null);
             } else {
-                int artIndex = cursor.getInt(0);
+                long artIndex = cursor.getLong(0);
                 Drawable d = MusicUtils.getCachedArtwork(context, artIndex, mDefaultAlbumIcon);
                 iv.setImageDrawable(d);
             }
 
-            int currentalbumid = MusicUtils.getCurrentAlbumId();
-            int aid = cursor.getInt(0);
+            long currentalbumid = MusicUtils.getCurrentAlbumId();
+            long aid = cursor.getLong(0);
             iv = vh.play_indicator;
             if (currentalbumid == aid) {
                 iv.setImageDrawable(mNowPlayingOverlay);
@@ -720,7 +720,7 @@
         @Override
         protected Cursor getChildrenCursor(Cursor groupCursor) {
             
-            int id = groupCursor.getInt(groupCursor.getColumnIndexOrThrow(MediaStore.Audio.Artists._ID));
+            long id = groupCursor.getLong(groupCursor.getColumnIndexOrThrow(MediaStore.Audio.Artists._ID));
             
             String[] cols = new String[] {
                     MediaStore.Audio.Albums._ID,
diff --git a/src/com/android/music/DeleteItems.java b/src/com/android/music/DeleteItems.java
index 15e681f..6cb2527 100644
--- a/src/com/android/music/DeleteItems.java
+++ b/src/com/android/music/DeleteItems.java
@@ -40,7 +40,7 @@
 {
     private TextView mPrompt;
     private Button mButton;
-    private int [] mItemList;
+    private long [] mItemList;
 
     @Override
     public void onCreate(Bundle icicle) {
@@ -64,7 +64,7 @@
 
         Bundle b = getIntent().getExtras();
         String desc = b.getString("description");
-        mItemList = b.getIntArray("items");
+        mItemList = b.getLongArray("items");
         
         mPrompt.setText(desc);
     }
diff --git a/src/com/android/music/IMediaPlaybackService.aidl b/src/com/android/music/IMediaPlaybackService.aidl
index 1d27057..be48247 100644
--- a/src/com/android/music/IMediaPlaybackService.aidl
+++ b/src/com/android/music/IMediaPlaybackService.aidl
@@ -23,7 +23,7 @@
 {
     void openFile(String path, boolean oneShot);
     void openFileAsync(String path);
-    void open(in int [] list, int position);
+    void open(in long [] list, int position);
     int getQueuePosition();
     boolean isPlaying();
     void stop();
@@ -36,19 +36,19 @@
     long seek(long pos);
     String getTrackName();
     String getAlbumName();
-    int getAlbumId();
+    long getAlbumId();
     String getArtistName();
-    int getArtistId();
-    void enqueue(in int [] list, int action);
-    int [] getQueue();
+    long getArtistId();
+    void enqueue(in long [] list, int action);
+    long [] getQueue();
     void moveQueueItem(int from, int to);
     void setQueuePosition(int index);
     String getPath();
-    int getAudioId();
+    long getAudioId();
     void setShuffleMode(int shufflemode);
     int getShuffleMode();
     int removeTracks(int first, int last);
-    int removeTrack(int id);
+    int removeTrack(long id);
     void setRepeatMode(int repeatmode);
     int getRepeatMode();
     int getMediaMountedCount();
diff --git a/src/com/android/music/MediaPlaybackActivity.java b/src/com/android/music/MediaPlaybackActivity.java
index 8f47a40..b8612fe 100644
--- a/src/com/android/music/MediaPlaybackActivity.java
+++ b/src/com/android/music/MediaPlaybackActivity.java
@@ -566,21 +566,21 @@
                 }
 
                 case PLAYLIST_SELECTED: {
-                    int [] list = new int[1];
+                    long [] list = new long[1];
                     list[0] = MusicUtils.getCurrentAudioId();
-                    int playlist = item.getIntent().getIntExtra("playlist", 0);
+                    long playlist = item.getIntent().getLongExtra("playlist", 0);
                     MusicUtils.addToPlaylist(this, list, playlist);
                     return true;
                 }
                 
                 case DELETE_ITEM: {
                     if (mService != null) {
-                        int [] list = new int[1];
+                        long [] list = new long[1];
                         list[0] = MusicUtils.getCurrentAudioId();
                         Bundle b = new Bundle();
                         b.putString("description", getString(R.string.delete_song_desc,
                                 mService.getTrackName()));
-                        b.putIntArray("items", list);
+                        b.putLongArray("items", list);
                         intent = new Intent();
                         intent.setClass(this, DeleteItems.class);
                         intent.putExtras(b);
@@ -603,7 +603,7 @@
             case NEW_PLAYLIST:
                 Uri uri = intent.getData();
                 if (uri != null) {
-                    int [] list = new int[1];
+                    long [] list = new long[1];
                     list[0] = MusicUtils.getCurrentAudioId();
                     int playlist = Integer.parseInt(uri.getLastPathSegment());
                     MusicUtils.addToPlaylist(this, list, playlist);
@@ -1209,6 +1209,15 @@
         }
     };
 
+    private static class AlbumSongIdWrapper {
+        public long albumid;
+        public long songid;
+        AlbumSongIdWrapper(long aid, long sid) {
+            albumid = aid;
+            songid = sid;
+        }
+    }
+    
     private void updateTrackInfo() {
         if (mService == null) {
             return;
@@ -1220,13 +1229,16 @@
                 return;
             }
             
-            if (mService.getAudioId() < 0 && path.toLowerCase().startsWith("http://")) {
+            long songid = mService.getAudioId(); 
+            if (songid < 0 && path.toLowerCase().startsWith("http://")) {
+                // Once we can get album art and meta data from MediaPlayer, we
+                // can show that info again when streaming.
                 ((View) mArtistName.getParent()).setVisibility(View.INVISIBLE);
                 ((View) mAlbumName.getParent()).setVisibility(View.INVISIBLE);
                 mAlbum.setVisibility(View.GONE);
                 mTrackName.setText(path);
                 mAlbumArtHandler.removeMessages(GET_ALBUM_ART);
-                mAlbumArtHandler.obtainMessage(GET_ALBUM_ART, -1, 0).sendToTarget();
+                mAlbumArtHandler.obtainMessage(GET_ALBUM_ART, new AlbumSongIdWrapper(-1, -1)).sendToTarget();
             } else {
                 ((View) mArtistName.getParent()).setVisibility(View.VISIBLE);
                 ((View) mAlbumName.getParent()).setVisibility(View.VISIBLE);
@@ -1236,7 +1248,7 @@
                 }
                 mArtistName.setText(artistName);
                 String albumName = mService.getAlbumName();
-                int albumid = mService.getAlbumId();
+                long albumid = mService.getAlbumId();
                 if (MediaFile.UNKNOWN_STRING.equals(albumName)) {
                     albumName = getString(R.string.unknown_album_name);
                     albumid = -1;
@@ -1244,7 +1256,7 @@
                 mAlbumName.setText(albumName);
                 mTrackName.setText(mService.getTrackName());
                 mAlbumArtHandler.removeMessages(GET_ALBUM_ART);
-                mAlbumArtHandler.obtainMessage(GET_ALBUM_ART, albumid, 0).sendToTarget();
+                mAlbumArtHandler.obtainMessage(GET_ALBUM_ART, new AlbumSongIdWrapper(albumid, songid)).sendToTarget();
                 mAlbum.setVisibility(View.VISIBLE);
             }
             mDuration = mService.duration();
@@ -1255,22 +1267,24 @@
     }
     
     public class AlbumArtHandler extends Handler {
-        private int mAlbumId = -1;
+        private long mAlbumId = -1;
         
         public AlbumArtHandler(Looper looper) {
             super(looper);
         }
+        @Override
         public void handleMessage(Message msg)
         {
-            int albumid = msg.arg1;
+            long albumid = ((AlbumSongIdWrapper) msg.obj).albumid;
+            long songid = ((AlbumSongIdWrapper) msg.obj).songid;
             if (msg.what == GET_ALBUM_ART && (mAlbumId != albumid || albumid < 0)) {
                 // while decoding the new image, show the default album art
                 Message numsg = mHandler.obtainMessage(ALBUM_ART_DECODED, null);
                 mHandler.removeMessages(ALBUM_ART_DECODED);
                 mHandler.sendMessageDelayed(numsg, 300);
-                Bitmap bm = MusicUtils.getArtwork(MediaPlaybackActivity.this, albumid);
+                Bitmap bm = MusicUtils.getArtwork(MediaPlaybackActivity.this, songid, albumid);
                 if (bm == null) {
-                    bm = MusicUtils.getArtwork(MediaPlaybackActivity.this, -1);
+                    bm = MusicUtils.getArtwork(MediaPlaybackActivity.this, songid, -1);
                     albumid = -1;
                 }
                 if (bm != null) {
diff --git a/src/com/android/music/MediaPlaybackService.java b/src/com/android/music/MediaPlaybackService.java
index 23ca124..83bc800 100644
--- a/src/com/android/music/MediaPlaybackService.java
+++ b/src/com/android/music/MediaPlaybackService.java
@@ -108,9 +108,9 @@
     private int mShuffleMode = SHUFFLE_NONE;
     private int mRepeatMode = REPEAT_NONE;
     private int mMediaMountedCount = 0;
-    private int [] mAutoShuffleList = null;
+    private long [] mAutoShuffleList = null;
     private boolean mOneShot;
-    private int [] mPlayList = null;
+    private long [] mPlayList = null;
     private int mPlayListLen = 0;
     private Vector<Integer> mHistory = new Vector<Integer>(MAX_HISTORY_SIZE);
     private Cursor mCursor;
@@ -359,12 +359,12 @@
             // on the phone)
             int len = mPlayListLen;
             for (int i = 0; i < len; i++) {
-                int n = mPlayList[i];
+                long n = mPlayList[i];
                 if (n == 0) {
                     q.append("0;");
                 } else {
                     while (n != 0) {
-                        int digit = n & 0xf;
+                        int digit = (int)(n & 0xf);
                         n >>= 4;
                         q.append(hexdigits[digit]);
                     }
@@ -654,7 +654,7 @@
     private void notifyChange(String what) {
         
         Intent i = new Intent(what);
-        i.putExtra("id", Integer.valueOf(getAudioId()));
+        i.putExtra("id", Long.valueOf(getAudioId()));
         i.putExtra("artist", getArtistName());
         i.putExtra("album",getAlbumName());
         i.putExtra("track", getTrackName());
@@ -675,7 +675,7 @@
             // reallocate at 2x requested size so we don't
             // need to grow and copy the array for every
             // insert
-            int [] newlist = new int[size * 2];
+            long [] newlist = new long[size * 2];
             int len = mPlayList != null ? mPlayList.length : mPlayListLen;
             for (int i = 0; i < len; i++) {
                 newlist[i] = mPlayList[i];
@@ -687,7 +687,7 @@
     }
     
     // insert the list of songs at the specified position in the playlist
-    private void addToPlayList(int [] list, int position) {
+    private void addToPlayList(long [] list, int position) {
         int addlen = list.length;
         if (position < 0) { // overwrite
             mPlayListLen = 0;
@@ -720,7 +720,7 @@
      * @param list The list of tracks to append.
      * @param action NOW, NEXT or LAST
      */
-    public void enqueue(int [] list, int action) {
+    public void enqueue(long [] list, int action) {
         synchronized(this) {
             if (action == NEXT && mPlayPos + 1 < mPlayListLen) {
                 addToPlayList(list, mPlayPos + 1);
@@ -753,12 +753,12 @@
      * specified position is 0.
      * @param list The new list of tracks.
      */
-    public void open(int [] list, int position) {
+    public void open(long [] list, int position) {
         synchronized (this) {
             if (mShuffleMode == SHUFFLE_AUTO) {
                 mShuffleMode = SHUFFLE_NORMAL;
             }
-            int oldId = getAudioId();
+            long oldId = getAudioId();
             int listlength = list.length;
             boolean newlist = true;
             if (mPlayListLen == listlength) {
@@ -805,7 +805,7 @@
                 index2 = mPlayListLen - 1;
             }
             if (index1 < index2) {
-                int tmp = mPlayList[index1];
+                long tmp = mPlayList[index1];
                 for (int i = index1; i < index2; i++) {
                     mPlayList[i] = mPlayList[i+1];
                 }
@@ -816,7 +816,7 @@
                         mPlayPos--;
                 }
             } else if (index2 < index1) {
-                int tmp = mPlayList[index1];
+                long tmp = mPlayList[index1];
                 for (int i = index1; i > index2; i--) {
                     mPlayList[i] = mPlayList[i-1];
                 }
@@ -835,10 +835,10 @@
      * Returns the current play list
      * @return An array of integers containing the IDs of the tracks in the play list
      */
-    public int [] getQueue() {
+    public long [] getQueue() {
         synchronized (this) {
             int len = mPlayListLen;
-            int [] list = new int[len];
+            long [] list = new long[len];
             for (int i = 0; i < len; i++) {
                 list[i] = mPlayList[i];
             }
@@ -941,7 +941,7 @@
                             mCursor.moveToNext();
                             ensurePlayListCapacity(1);
                             mPlayListLen = 1;
-                            mPlayList[0] = mCursor.getInt(IDCOLIDX);
+                            mPlayList[0] = mCursor.getLong(IDCOLIDX);
                             mPlayPos = 0;
                         }
                     }
@@ -1283,7 +1283,7 @@
         for (int i = 0; i < to_add; i++) {
             // pick something at random from the list
             int idx = mRand.nextInt(mAutoShuffleList.length);
-            Integer which = mAutoShuffleList[idx];
+            long which = mAutoShuffleList[idx];
             ensurePlayListCapacity(mPlayListLen + 1);
             mPlayList[mPlayListLen++] = which;
             notify = true;
@@ -1320,10 +1320,10 @@
                 return false;
             }
             int len = c.getCount();
-            int[] list = new int[len];
+            long [] list = new long[len];
             for (int i = 0; i < len; i++) {
                 c.moveToNext();
-                list[i] = c.getInt(0);
+                list[i] = c.getLong(0);
             }
             mAutoShuffleList = list;
             return true;
@@ -1397,7 +1397,7 @@
      * @param id The id to be removed
      * @return how many instances of the track were removed
      */
-    public int removeTrack(int id) {
+    public int removeTrack(long id) {
         int numremoved = 0;
         synchronized (this) {
             for (int i = 0; i < mPlayListLen; i++) {
@@ -1466,7 +1466,7 @@
      * Returns the rowid of the currently playing file, or -1 if
      * no file is currently playing.
      */
-    public int getAudioId() {
+    public long getAudioId() {
         synchronized (this) {
             if (mPlayPos >= 0 && mPlayer.isInitialized()) {
                 return mPlayList[mPlayPos];
@@ -1508,12 +1508,12 @@
         }
     }
     
-    public int getArtistId() {
+    public long getArtistId() {
         synchronized (this) {
             if (mCursor == null) {
                 return -1;
             }
-            return mCursor.getInt(mCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST_ID));
+            return mCursor.getLong(mCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST_ID));
         }
     }
 
@@ -1526,12 +1526,12 @@
         }
     }
 
-    public int getAlbumId() {
+    public long getAlbumId() {
         synchronized (this) {
             if (mCursor == null) {
                 return -1;
             }
-            return mCursor.getInt(mCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM_ID));
+            return mCursor.getLong(mCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM_ID));
         }
     }
 
@@ -1764,7 +1764,7 @@
         {
             mService.get().open(path, oneShot);
         }
-        public void open(int [] list, int position) {
+        public void open(long [] list, int position) {
             mService.get().open(list, position);
         }
         public int getQueuePosition() {
@@ -1797,19 +1797,19 @@
         public String getAlbumName() {
             return mService.get().getAlbumName();
         }
-        public int getAlbumId() {
+        public long getAlbumId() {
             return mService.get().getAlbumId();
         }
         public String getArtistName() {
             return mService.get().getArtistName();
         }
-        public int getArtistId() {
+        public long getArtistId() {
             return mService.get().getArtistId();
         }
-        public void enqueue(int [] list , int action) {
+        public void enqueue(long [] list , int action) {
             mService.get().enqueue(list, action);
         }
-        public int [] getQueue() {
+        public long [] getQueue() {
             return mService.get().getQueue();
         }
         public void moveQueueItem(int from, int to) {
@@ -1818,7 +1818,7 @@
         public String getPath() {
             return mService.get().getPath();
         }
-        public int getAudioId() {
+        public long getAudioId() {
             return mService.get().getAudioId();
         }
         public long position() {
@@ -1839,7 +1839,7 @@
         public int removeTracks(int first, int last) {
             return mService.get().removeTracks(first, last);
         }
-        public int removeTrack(int id) {
+        public int removeTrack(long id) {
             return mService.get().removeTrack(id);
         }
         public void setRepeatMode(int repeatmode) {
diff --git a/src/com/android/music/MusicUtils.java b/src/com/android/music/MusicUtils.java
index ea20794..2d85926 100644
--- a/src/com/android/music/MusicUtils.java
+++ b/src/com/android/music/MusicUtils.java
@@ -16,21 +16,7 @@
 
 package com.android.music;
 
-import java.io.File;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.Formatter;
-import java.util.HashMap;
-import java.util.Locale;
-
 import android.app.Activity;
-import android.app.ExpandableListActivity;
 import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.ContentUris;
@@ -49,12 +35,10 @@
 import android.graphics.PixelFormat;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
-import android.media.MediaFile;
-import android.media.MediaScanner;
 import android.net.Uri;
-import android.os.RemoteException;
 import android.os.Environment;
 import android.os.ParcelFileDescriptor;
+import android.os.RemoteException;
 import android.provider.MediaStore;
 import android.provider.Settings;
 import android.util.Log;
@@ -64,6 +48,16 @@
 import android.widget.TextView;
 import android.widget.Toast;
 
+import java.io.File;
+import java.io.FileDescriptor;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Formatter;
+import java.util.HashMap;
+import java.util.Locale;
+
 public class MusicUtils {
 
     private static final String TAG = "MusicUtils";
@@ -195,7 +189,7 @@
         }
     }
     
-    public static int getCurrentAlbumId() {
+    public static long getCurrentAlbumId() {
         if (sService != null) {
             try {
                 return sService.getAlbumId();
@@ -205,7 +199,7 @@
         return -1;
     }
 
-    public static int getCurrentArtistId() {
+    public static long getCurrentArtistId() {
         if (MusicUtils.sService != null) {
             try {
                 return sService.getArtistId();
@@ -215,7 +209,7 @@
         return -1;
     }
 
-    public static int getCurrentAudioId() {
+    public static long getCurrentAudioId() {
         if (MusicUtils.sService != null) {
             try {
                 return sService.getAudioId();
@@ -250,14 +244,14 @@
         return false;
     }
 
-    private final static int [] sEmptyList = new int[0];
+    private final static long [] sEmptyList = new long[0];
     
-    public static int [] getSongListForCursor(Cursor cursor) {
+    public static long [] getSongListForCursor(Cursor cursor) {
         if (cursor == null) {
             return sEmptyList;
         }
         int len = cursor.getCount();
-        int [] list = new int[len];
+        long [] list = new long[len];
         cursor.moveToFirst();
         int colidx = -1;
         try {
@@ -266,13 +260,13 @@
             colidx = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media._ID);
         }
         for (int i = 0; i < len; i++) {
-            list[i] = cursor.getInt(colidx);
+            list[i] = cursor.getLong(colidx);
             cursor.moveToNext();
         }
         return list;
     }
 
-    public static int [] getSongListForArtist(Context context, int id) {
+    public static long [] getSongListForArtist(Context context, long id) {
         final String[] ccols = new String[] { MediaStore.Audio.Media._ID };
         String where = MediaStore.Audio.Media.ARTIST_ID + "=" + id + " AND " + 
         MediaStore.Audio.Media.IS_MUSIC + "=1";
@@ -281,14 +275,14 @@
                 MediaStore.Audio.Media.ALBUM_KEY + ","  + MediaStore.Audio.Media.TRACK);
         
         if (cursor != null) {
-            int [] list = getSongListForCursor(cursor);
+            long [] list = getSongListForCursor(cursor);
             cursor.close();
             return list;
         }
         return sEmptyList;
     }
 
-    public static int [] getSongListForAlbum(Context context, int id) {
+    public static long [] getSongListForAlbum(Context context, long id) {
         final String[] ccols = new String[] { MediaStore.Audio.Media._ID };
         String where = MediaStore.Audio.Media.ALBUM_ID + "=" + id + " AND " + 
                 MediaStore.Audio.Media.IS_MUSIC + "=1";
@@ -296,20 +290,20 @@
                 ccols, where, null, MediaStore.Audio.Media.TRACK);
 
         if (cursor != null) {
-            int [] list = getSongListForCursor(cursor);
+            long [] list = getSongListForCursor(cursor);
             cursor.close();
             return list;
         }
         return sEmptyList;
     }
 
-    public static int [] getSongListForPlaylist(Context context, long plid) {
+    public static long [] getSongListForPlaylist(Context context, long plid) {
         final String[] ccols = new String[] { MediaStore.Audio.Playlists.Members.AUDIO_ID };
         Cursor cursor = query(context, MediaStore.Audio.Playlists.Members.getContentUri("external", plid),
                 ccols, null, null, MediaStore.Audio.Playlists.Members.DEFAULT_SORT_ORDER);
         
         if (cursor != null) {
-            int [] list = getSongListForCursor(cursor);
+            long [] list = getSongListForCursor(cursor);
             cursor.close();
             return list;
         }
@@ -317,13 +311,13 @@
     }
     
     public static void playPlaylist(Context context, long plid) {
-        int [] list = getSongListForPlaylist(context, plid);
+        long [] list = getSongListForPlaylist(context, plid);
         if (list != null) {
             playAll(context, list, -1, false);
         }
     }
 
-    public static int [] getAllSongs(Context context) {
+    public static long [] getAllSongs(Context context) {
         Cursor c = query(context, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
                 new String[] {MediaStore.Audio.Media._ID}, MediaStore.Audio.Media.IS_MUSIC + "=1",
                 null, null);
@@ -332,10 +326,10 @@
                 return null;
             }
             int len = c.getCount();
-            int[] list = new int[len];
+            long [] list = new long[len];
             for (int i = 0; i < len; i++) {
                 c.moveToNext();
-                list[i] = c.getInt(0);
+                list[i] = c.getLong(0);
             }
 
             return list;
@@ -377,7 +371,7 @@
                 cur.moveToFirst();
                 while (! cur.isAfterLast()) {
                     Intent intent = new Intent();
-                    intent.putExtra("playlist", cur.getInt(0));
+                    intent.putExtra("playlist", cur.getLong(0));
 //                    if (cur.getInt(0) == mLastPlaylistSelected) {
 //                        sub.add(0, MusicBaseActivity.PLAYLIST_SELECTED, cur.getString(1)).setIntent(intent);
 //                    } else {
@@ -399,7 +393,7 @@
         return;
     }
     
-    public static void deleteTracks(Context context, int [] list) {
+    public static void deleteTracks(Context context, long [] list) {
         
         String [] cols = new String [] { MediaStore.Audio.Media._ID, 
                 MediaStore.Audio.Media.DATA, MediaStore.Audio.Media.ALBUM_ID };
@@ -423,10 +417,10 @@
                 c.moveToFirst();
                 while (! c.isAfterLast()) {
                     // remove from current playlist
-                    int id = c.getInt(0);
+                    long id = c.getLong(0);
                     sService.removeTrack(id);
                     // remove from album art cache
-                    int artIndex = c.getInt(2);
+                    long artIndex = c.getLong(2);
                     synchronized(sArtCache) {
                         sArtCache.remove(artIndex);
                     }
@@ -466,7 +460,7 @@
         context.getContentResolver().notifyChange(Uri.parse("content://media"), null);
     }
     
-    public static void addToCurrentPlaylist(Context context, int [] list) {
+    public static void addToCurrentPlaylist(Context context, long [] list) {
         if (sService == null) {
             return;
         }
@@ -479,7 +473,7 @@
         }
     }
     
-    public static void addToPlaylist(Context context, int [] ids, long playlistid) {
+    public static void addToPlaylist(Context context, long [] ids, long playlistid) {
         if (ids == null) {
             // this shouldn't happen (the menuitems shouldn't be visible
             // unless the selected item represents something playable
@@ -661,17 +655,17 @@
         playAll(context, cursor, position, false);
     }
     
-    public static void playAll(Context context, int [] list, int position) {
+    public static void playAll(Context context, long [] list, int position) {
         playAll(context, list, position, false);
     }
     
     private static void playAll(Context context, Cursor cursor, int position, boolean force_shuffle) {
     
-        int [] list = getSongListForCursor(cursor);
+        long [] list = getSongListForCursor(cursor);
         playAll(context, list, position, force_shuffle);
     }
     
-    private static void playAll(Context context, int [] list, int position, boolean force_shuffle) {
+    private static void playAll(Context context, long [] list, int position, boolean force_shuffle) {
         if (list.length == 0 || sService == null) {
             Log.d("MusicUtils", "attempt to play empty song list");
             // Don't try to play empty playlists. Nothing good will come of it.
@@ -683,13 +677,13 @@
             if (force_shuffle) {
                 sService.setShuffleMode(MediaPlaybackService.SHUFFLE_NORMAL);
             }
-            int curid = sService.getAudioId();
+            long curid = sService.getAudioId();
             int curpos = sService.getQueuePosition();
             if (position != -1 && curpos == position && curid == list[position]) {
                 // The selected file is the file that's currently playing;
                 // figure out if we need to restart with a new playlist,
                 // or just launch the playback activity.
-                int [] playlist = sService.getQueue();
+                long [] playlist = sService.getQueue();
                 if (Arrays.equals(list, playlist)) {
                     // we don't need to set a new list, but we should resume playback if needed
                     sService.play();
@@ -740,12 +734,11 @@
     }
     
     private static int sArtId = -2;
-    private static byte [] mCachedArt;
     private static Bitmap mCachedBit = null;
     private static final BitmapFactory.Options sBitmapOptionsCache = new BitmapFactory.Options();
     private static final BitmapFactory.Options sBitmapOptions = new BitmapFactory.Options();
     private static final Uri sArtworkUri = Uri.parse("content://media/external/audio/albumart");
-    private static final HashMap<Integer, Drawable> sArtCache = new HashMap<Integer, Drawable>();
+    private static final HashMap<Long, Drawable> sArtCache = new HashMap<Long, Drawable>();
     private static int sArtCacheId = -1;
     
     static {
@@ -777,7 +770,7 @@
         }
     }
     
-    public static Drawable getCachedArtwork(Context context, int artIndex, BitmapDrawable defaultArtwork) {
+    public static Drawable getCachedArtwork(Context context, long artIndex, BitmapDrawable defaultArtwork) {
         Drawable d = null;
         synchronized(sArtCache) {
             d = sArtCache.get(artIndex);
@@ -807,7 +800,7 @@
     // Get album art for specified album. This method will not try to
     // fall back to getting artwork directly from the file, nor will
     // it attempt to repair the database.
-    private static Bitmap getArtworkQuick(Context context, int album_id, int w, int h) {
+    private static Bitmap getArtworkQuick(Context context, long album_id, int w, int h) {
         // NOTE: There is in fact a 1 pixel border on the right side in the ImageView
         // used to display this drawable. Take it into account now, so we don't have to
         // scale later.
@@ -865,27 +858,18 @@
     /** Get album art for specified album. You should not pass in the album id
      * for the "unknown" album here (use -1 instead)
      */
-    public static Bitmap getArtwork(Context context, int album_id) {
-        return getArtwork(context, album_id, true);
-    }
-    
-    /** Get album art for specified album. You should not pass in the album id
-     * for the "unknown" album here (use -1 instead)
-     */
-    public static Bitmap getArtwork(Context context, int album_id, boolean allowDefault) {
+    public static Bitmap getArtwork(Context context, long song_id, long album_id) {
 
         if (album_id < 0) {
             // This is something that is not in the database, so get the album art directly
             // from the file.
-            Bitmap bm = getArtworkFromFile(context, null, -1);
-            if (bm != null) {
-                return bm;
+            if (song_id >= 0) {
+                Bitmap bm = getArtworkFromFile(context, song_id, -1);
+                if (bm != null) {
+                    return bm;
+                }
             }
-            if (allowDefault) {
-                return getDefaultArtwork(context);
-            } else {
-                return null;
-            }
+            return getDefaultArtwork(context);
         }
 
         ContentResolver res = context.getContentResolver();
@@ -898,61 +882,16 @@
             } catch (FileNotFoundException ex) {
                 // The album art thumbnail does not actually exist. Maybe the user deleted it, or
                 // maybe it never existed to begin with.
-                Bitmap bm = getArtworkFromFile(context, null, album_id);
+                Bitmap bm = getArtworkFromFile(context, song_id, album_id);
                 if (bm != null) {
                     if (bm.getConfig() == null) {
                         bm = bm.copy(Bitmap.Config.RGB_565, false);
                         if (bm == null) {
-                            if (allowDefault) {
-                                return getDefaultArtwork(context);
-                            } else {
-                                return null;
-                            }
+                            return getDefaultArtwork(context);
                         }
                     }
-                    // Put the newly found artwork in the database.
-                    // Note that this shouldn't be done for the "unknown" album,
-                    // but if this method is called correctly, that won't happen.
-                    
-                    // first write it somewhere
-                    String file = Environment.getExternalStorageDirectory()
-                        + "/albumthumbs/" + String.valueOf(System.currentTimeMillis());
-                    if (ensureFileExists(file)) {
-                        try {
-                            OutputStream outstream = new FileOutputStream(file);
-                            boolean success = bm.compress(Bitmap.CompressFormat.JPEG, 75, outstream);
-                            outstream.close();
-                            if (success) {
-                                ContentValues values = new ContentValues();
-                                values.put("album_id", album_id);
-                                values.put("_data", file);
-                                Uri newuri = res.insert(sArtworkUri, values);
-                                if (newuri == null) {
-                                    // Failed to insert in to the database. The most likely
-                                    // cause of this is that the item already existed in the
-                                    // database, and the most likely cause of that is that
-                                    // the album was scanned before, but the user deleted the
-                                    // album art from the sd card.
-                                    // We can ignore that case here, since the media provider
-                                    // will regenerate the album art for those entries when
-                                    // it detects this.
-                                    success = false;
-                                }
-                            }
-                            if (!success) {
-                                File f = new File(file);
-                                f.delete();
-                            }
-                        } catch (FileNotFoundException e) {
-                            Log.e(TAG, "error creating file", e);
-                        } catch (IOException e) {
-                            Log.e(TAG, "error creating file", e);
-                        }
-                    }
-                } else if (allowDefault) {
-                    bm = getDefaultArtwork(context);
                 } else {
-                    bm = null;
+                    bm = getDefaultArtwork(context);
                 }
                 return bm;
             } finally {
@@ -967,168 +906,39 @@
         
         return null;
     }
-
-    // copied from MediaProvider
-    private static boolean ensureFileExists(String path) {
-        File file = new File(path);
-        if (file.exists()) {
-            return true;
-        } else {
-            // we will not attempt to create the first directory in the path
-            // (for example, do not create /sdcard if the SD card is not mounted)
-            int secondSlash = path.indexOf('/', 1);
-            if (secondSlash < 1) return false;
-            String directoryPath = path.substring(0, secondSlash);
-            File directory = new File(directoryPath);
-            if (!directory.exists())
-                return false;
-            file.getParentFile().mkdirs();
-            try {
-                return file.createNewFile();
-            } catch(IOException ioe) {
-                Log.d(TAG, "File creation failed for " + path);
-            }
-            return false;
-        }
-    }
     
     // get album art for specified file
     private static final String sExternalMediaUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI.toString();
-    private static Bitmap getArtworkFromFile(Context context, Uri uri, int albumid) {
+    private static Bitmap getArtworkFromFile(Context context, long songid, long albumid) {
         Bitmap bm = null;
         byte [] art = null;
         String path = null;
 
-        if (sArtId == albumid) {
-            //Log.i("@@@@@@ ", "reusing cached data", new Exception());
-            if (mCachedBit != null) {
-                return mCachedBit;
-            }
-            art = mCachedArt;
-        } else {
-            // try reading embedded artwork
-            if (uri == null) {
-                try {
-                    int curalbum = sService.getAlbumId();
-                    if (curalbum == albumid || albumid < 0) {
-                        path = sService.getPath();
-                        if (path != null) {
-                            uri = Uri.parse(path);
-                        }
-                    }
-                } catch (RemoteException ex) {
-                    return null;
-                } catch (NullPointerException ex) {
-                    return null;
-                }
-            }
-            if (uri == null) {
-                if (albumid >= 0) {
-                    Cursor c = query(context,MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
-                            new String[] { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.ALBUM },
-                            MediaStore.Audio.Media.ALBUM_ID + "=?", new String [] {String.valueOf(albumid)},
-                            null);
-                    if (c != null) {
-                        if (c.moveToFirst()) {
-                            int trackid = c.getInt(0);
-                            uri = ContentUris.withAppendedId(
-                                    MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, trackid);
-                            if (MediaFile.UNKNOWN_STRING.equals(c.getString(1))) {
-                                albumid = -1;
-                            }
-                        }
-                        c.close();
-                    }
-                }
-            }
-            if (uri != null) {
-                MediaScanner scanner = new MediaScanner(context);
-                ParcelFileDescriptor pfd = null;
-                try {
-                    pfd = context.getContentResolver().openFileDescriptor(uri, "r");
-                    if (pfd != null) {
-                        FileDescriptor fd = pfd.getFileDescriptor();
-                        art = scanner.extractAlbumArt(fd);
-                    }
-                } catch (IOException ex) {
-                } catch (SecurityException ex) {
-                } finally {
-                    try {
-                        if (pfd != null) {
-                            pfd.close();
-                        }
-                    } catch (IOException ex) {
-                    }
-                }
-            }
+        if (albumid < 0 && songid < 0) {
+            throw new IllegalArgumentException("Must specify an album or a song id");
         }
-        // if no embedded art exists, look for AlbumArt.jpg in same directory as the media file
-        if (art == null && path != null) {
-            if (path.startsWith(sExternalMediaUri)) {
-                // get the real path
-                Cursor c = query(context,Uri.parse(path),
-                        new String[] { MediaStore.Audio.Media.DATA},
-                        null, null, null);
-                if (c != null) {
-                    c.moveToFirst();
-                    if (!c.isAfterLast()) {
-                        path = c.getString(0);
-                    }
-                    c.close();
+
+        try {
+            if (albumid < 0) {
+                Uri uri = Uri.parse("content://media/external/audio/media/" + songid + "/albumart");
+                ParcelFileDescriptor pfd = context.getContentResolver().openFileDescriptor(uri, "r");
+                if (pfd != null) {
+                    FileDescriptor fd = pfd.getFileDescriptor();
+                    bm = BitmapFactory.decodeFileDescriptor(fd);
+                }
+            } else {
+                Uri uri = ContentUris.withAppendedId(sArtworkUri, albumid);
+                ParcelFileDescriptor pfd = context.getContentResolver().openFileDescriptor(uri, "r");
+                if (pfd != null) {
+                    FileDescriptor fd = pfd.getFileDescriptor();
+                    bm = BitmapFactory.decodeFileDescriptor(fd);
                 }
             }
-            int lastSlash = path.lastIndexOf('/');
-            if (lastSlash > 0) {
-                String artPath = path.substring(0, lastSlash + 1) + "AlbumArt.jpg";
-                File file = new File(artPath);
-                if (file.exists()) {
-                    art = new byte[(int)file.length()];
-                    FileInputStream stream = null;
-                    try {
-                        stream = new FileInputStream(file);
-                        stream.read(art);
-                    } catch (IOException ex) {
-                        art = null;
-                    } finally {
-                        try {
-                            if (stream != null) {
-                                stream.close();
-                            }
-                        } catch (IOException ex) {
-                        }
-                    }
-                } else {
-                    // TODO: try getting album art from the web
-                }
-            }
+        } catch (FileNotFoundException ex) {
+            //
         }
-        
-        if (art != null) {
-            try {
-                // get the size of the bitmap
-                BitmapFactory.Options opts = new BitmapFactory.Options();
-                opts.inJustDecodeBounds = true;
-                opts.inSampleSize = 1;
-                BitmapFactory.decodeByteArray(art, 0, art.length, opts);
-                
-                // request a reasonably sized output image
-                // TODO: don't hardcode the size
-                while (opts.outHeight > 320 || opts.outWidth > 320) {
-                    opts.outHeight /= 2;
-                    opts.outWidth /= 2;
-                    opts.inSampleSize *= 2;
-                }
-                
-                // get the image for real now
-                opts.inJustDecodeBounds = false;
-                bm = BitmapFactory.decodeByteArray(art, 0, art.length, opts);
-                if (albumid != -1) {
-                    sArtId = albumid;
-                }
-                mCachedArt = art;
-                mCachedBit = bm;
-            } catch (Exception e) {
-            }
+        if (bm != null) {
+            mCachedBit = bm;
         }
         return bm;
     }
diff --git a/src/com/android/music/PlaylistBrowserActivity.java b/src/com/android/music/PlaylistBrowserActivity.java
index da934b2..d85f07d 100644
--- a/src/com/android/music/PlaylistBrowserActivity.java
+++ b/src/com/android/music/PlaylistBrowserActivity.java
@@ -100,7 +100,7 @@
                     } else if (id == PODCASTS_PLAYLIST) {
                         playPodcasts();
                     } else if (id == ALL_SONGS_PLAYLIST) {
-                        int [] list = MusicUtils.getAllSongs(PlaylistBrowserActivity.this);
+                        long [] list = MusicUtils.getAllSongs(PlaylistBrowserActivity.this);
                         if (list != null) {
                             MusicUtils.playAll(PlaylistBrowserActivity.this, list, 0);
                         }
@@ -384,10 +384,10 @@
         }
         try {
             int len = cursor.getCount();
-            int [] list = new int[len];
+            long [] list = new long[len];
             for (int i = 0; i < len; i++) {
                 cursor.moveToNext();
-                list[i] = cursor.getInt(0);
+                list[i] = cursor.getLong(0);
             }
             MusicUtils.playAll(this, list, 0);
         } catch (SQLiteException ex) {
@@ -409,10 +409,10 @@
         }
         try {
             int len = cursor.getCount();
-            int [] list = new int[len];
+            long [] list = new long[len];
             for (int i = 0; i < len; i++) {
                 cursor.moveToNext();
-                list[i] = cursor.getInt(0);
+                list[i] = cursor.getLong(0);
             }
             MusicUtils.playAll(this, list, 0);
         } catch (SQLiteException ex) {
diff --git a/src/com/android/music/QueryBrowserActivity.java b/src/com/android/music/QueryBrowserActivity.java
index a67790a..99fae16 100644
--- a/src/com/android/music/QueryBrowserActivity.java
+++ b/src/com/android/music/QueryBrowserActivity.java
@@ -100,7 +100,7 @@
             if (path.startsWith("content://media/external/audio/media/")) {
                 // This is a specific file
                 String id = uri.getLastPathSegment();
-                int [] list = new int[] { Integer.valueOf(id) };
+                long [] list = new long[] { Long.valueOf(id) };
                 MusicUtils.playAll(this, list, 0);
                 finish();
                 return;
@@ -254,7 +254,7 @@
             intent.putExtra("album", Long.valueOf(id).toString());
             startActivity(intent);
         } else if (position >= 0 && id >= 0){
-            int [] list = new int[] { (int) id };
+            long [] list = new long[] { id };
             MusicUtils.playAll(this, list, 0);
         } else {
             Log.e("QueryBrowser", "invalid position/id: " + position + "/" + id);
diff --git a/src/com/android/music/TrackBrowserActivity.java b/src/com/android/music/TrackBrowserActivity.java
index 1f1adf6..8f122db 100644
--- a/src/com/android/music/TrackBrowserActivity.java
+++ b/src/com/android/music/TrackBrowserActivity.java
@@ -462,7 +462,7 @@
                 if (from < to) {
                     // move the item to somewhere later in the list
                     mTrackCursor.moveToPosition(to);
-                    int toidx = mTrackCursor.getInt(colidx);
+                    long toidx = mTrackCursor.getLong(colidx);
                     mTrackCursor.moveToPosition(from);
                     values.put(MediaStore.Audio.Playlists.Members.PLAY_ORDER, toidx);
                     wherearg[0] = mTrackCursor.getString(0);
@@ -476,7 +476,7 @@
                 } else if (from > to) {
                     // move the item to somewhere earlier in the list
                     mTrackCursor.moveToPosition(to);
-                    int toidx = mTrackCursor.getInt(colidx);
+                    long toidx = mTrackCursor.getLong(colidx);
                     mTrackCursor.moveToPosition(from);
                     values.put(MediaStore.Audio.Playlists.Members.PLAY_ORDER, toidx);
                     wherearg[0] = mTrackCursor.getString(0);
@@ -575,7 +575,7 @@
         try {
             int id_idx = mTrackCursor.getColumnIndexOrThrow(
                     MediaStore.Audio.Playlists.Members.AUDIO_ID);
-            mSelectedId = mTrackCursor.getInt(id_idx);
+            mSelectedId = mTrackCursor.getLong(id_idx);
         } catch (IllegalArgumentException ex) {
             mSelectedId = mi.id;
         }
@@ -599,7 +599,7 @@
             }
 
             case QUEUE: {
-                int [] list = new int[] { (int) mSelectedId };
+                long [] list = new long[] { mSelectedId };
                 MusicUtils.addToCurrentPlaylist(this, list);
                 return true;
             }
@@ -612,8 +612,8 @@
             }
 
             case PLAYLIST_SELECTED: {
-                int [] list = new int[] { (int) mSelectedId };
-                int playlist = item.getIntent().getIntExtra("playlist", 0);
+                long [] list = new long[] { mSelectedId };
+                long playlist = item.getIntent().getLongExtra("playlist", 0);
                 MusicUtils.addToPlaylist(this, list, playlist);
                 return true;
             }
@@ -624,13 +624,13 @@
                 return true;
 
             case DELETE_ITEM: {
-                int [] list = new int[1];
+                long [] list = new long[1];
                 list[0] = (int) mSelectedId;
                 Bundle b = new Bundle();
                 String f = getString(R.string.delete_song_desc); 
                 String desc = String.format(f, mCurrentTrackName);
                 b.putString("description", desc);
-                b.putIntArray("items", list);
+                b.putLongArray("items", list);
                 Intent intent = new Intent();
                 intent.setClass(this, DeleteItems.class);
                 intent.putExtras(b);
@@ -877,7 +877,7 @@
                 if (resultCode == RESULT_OK) {
                     Uri uri = intent.getData();
                     if (uri != null) {
-                        int [] list = new int[] { (int) mSelectedId };
+                        long [] list = new long[] { mSelectedId };
                         MusicUtils.addToPlaylist(this, list, Integer.valueOf(uri.getLastPathSegment()));
                     }
                 }
@@ -887,7 +887,7 @@
                 if (resultCode == RESULT_OK) {
                     Uri uri = intent.getData();
                     if (uri != null) {
-                        int [] list = MusicUtils.getSongListForCursor(mTrackCursor);
+                        long [] list = MusicUtils.getSongListForCursor(mTrackCursor);
                         int plid = Integer.parseInt(uri.getLastPathSegment());
                         MusicUtils.addToPlaylist(this, list, plid);
                     }
@@ -1024,7 +1024,7 @@
             try {
                 mNowPlaying = mService.getQueue();
             } catch (RemoteException ex) {
-                mNowPlaying = new int[0];
+                mNowPlaying = new long[0];
             }
             mSize = mNowPlaying.length;
             if (mSize == 0) {
@@ -1051,11 +1051,11 @@
             }
             
             int size = mCurrentPlaylistCursor.getCount();
-            mCursorIdxs = new int[size];
+            mCursorIdxs = new long[size];
             mCurrentPlaylistCursor.moveToFirst();
             int colidx = mCurrentPlaylistCursor.getColumnIndexOrThrow(MediaStore.Audio.Media._ID);
             for (int i = 0; i < size; i++) {
-                mCursorIdxs[i] = mCurrentPlaylistCursor.getInt(colidx);
+                mCursorIdxs[i] = mCurrentPlaylistCursor.getLong(colidx);
                 mCurrentPlaylistCursor.moveToNext();
             }
             mCurrentPlaylistCursor.moveToFirst();
@@ -1068,7 +1068,7 @@
             try {
                 int removed = 0;
                 for (int i = mNowPlaying.length - 1; i >= 0; i--) {
-                    int trackid = mNowPlaying[i];
+                    long trackid = mNowPlaying[i];
                     int crsridx = Arrays.binarySearch(mCursorIdxs, trackid);
                     if (crsridx < 0) {
                         //Log.i("@@@@@", "item no longer exists in db: " + trackid);
@@ -1084,7 +1084,7 @@
                     }
                 }
             } catch (RemoteException ex) {
-                mNowPlaying = new int[0];
+                mNowPlaying = new long[0];
             }
         }
 
@@ -1108,7 +1108,7 @@
             // in queue-order, so we need to figure out where in the cursor we
             // should be.
            
-            int newid = mNowPlaying[newPosition];
+            long newid = mNowPlaying[newPosition];
             int crsridx = Arrays.binarySearch(mCursorIdxs, newid);
             mCurrentPlaylistCursor.moveToPosition(crsridx);
             mCurPos = newPosition;
@@ -1235,8 +1235,8 @@
         private String [] mCols;
         private Cursor mCurrentPlaylistCursor;     // updated in onMove
         private int mSize;          // size of the queue
-        private int[] mNowPlaying;
-        private int[] mCursorIdxs;
+        private long[] mNowPlaying;
+        private long[] mCursorIdxs;
         private int mCurPos;
         private IMediaPlaybackService mService;
     }
@@ -1381,7 +1381,7 @@
             vh.line2.setText(vh.buffer2, 0, len);
 
             ImageView iv = vh.play_indicator;
-            int id = -1;
+            long id = -1;
             if (MusicUtils.sService != null) {
                 // TODO: IPC call on each bind??
                 try {
@@ -1406,7 +1406,7 @@
             // playlist mode (except when you're viewing the "current playlist",
             // which is not really a playlist)
             if ( (mIsNowPlaying && cursor.getPosition() == id) ||
-                 (!mIsNowPlaying && !mDisableNowPlayingIndicator && cursor.getInt(mAudioIdIdx) == id)) {
+                 (!mIsNowPlaying && !mDisableNowPlayingIndicator && cursor.getLong(mAudioIdIdx) == id)) {
                 iv.setImageResource(R.drawable.indicator_ic_mp_playing_list);
                 iv.setVisibility(View.VISIBLE);
             } else {