From 2c5abc352c9fc6ccda50321e6666ad936bf16e04 Mon Sep 17 00:00:00 2001 From: Adrian Ulrich Date: Sun, 22 Jan 2017 20:41:01 +0100 Subject: [PATCH] Use MediaStore.Audio.Media.EXTERNAL_CONTENT_URI for cover lookups MediaStore.Audio.Media.getContentUriForPath() seems to return strange results on some phones and lookups to non-external databases are pretty unlikely anyway. --- src/ch/blinkenlights/android/vanilla/CoverCache.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ch/blinkenlights/android/vanilla/CoverCache.java b/src/ch/blinkenlights/android/vanilla/CoverCache.java index 9fec24c1..bb02229d 100644 --- a/src/ch/blinkenlights/android/vanilla/CoverCache.java +++ b/src/ch/blinkenlights/android/vanilla/CoverCache.java @@ -447,10 +447,9 @@ public class CoverCache { if (inputStream == null && (CoverCache.mCoverLoadMode & CoverCache.COVER_MODE_ANDROID) != 0) { long albumId = -1; ContentResolver res = mContext.getContentResolver(); - Uri contentUri = MediaStore.Audio.Media.getContentUriForPath(song.path); // Lookup the album id assigned to this path in the android media store - Cursor cursor = res.query(contentUri, new String[]{ MediaStore.Audio.Media.ALBUM_ID }, MediaStore.Audio.Media.DATA+"=?", new String[] { song.path }, null); + Cursor cursor = res.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String[]{ MediaStore.Audio.Media.ALBUM_ID }, MediaStore.Audio.Media.DATA+"=?", new String[] { song.path }, null); if (cursor.moveToFirst()) { albumId = cursor.getLong(0); }