Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c45147f authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "Make the media scanner disregard database entries that do not have...

Merge "Make the media scanner disregard database entries that do not have absolute path names. This allows us to store other things (perhaps with http or content URIs) in the database, without the media scanner removing them again."
parents a69a23b2 35b002a9
Loading
Loading
Loading
Loading
+32 −17
Original line number Diff line number Diff line
@@ -920,6 +920,10 @@ public class MediaScanner
                        String path = c.getString(PATH_AUDIO_COLUMN_INDEX);
                        long lastModified = c.getLong(DATE_MODIFIED_AUDIO_COLUMN_INDEX);

                        // Only consider entries with absolute path names.
                        // This allows storing URIs in the database without the
                        // media scanner removing them.
                        if (path.startsWith("/")) {
                            String key = path;
                            if (mCaseInsensitivePaths) {
                                key = path.toLowerCase();
@@ -927,6 +931,7 @@ public class MediaScanner
                            mFileCache.put(key, new FileCacheEntry(mAudioUri, rowId, path,
                                    lastModified));
                        }
                    }
                } finally {
                    c.close();
                    c = null;
@@ -948,6 +953,10 @@ public class MediaScanner
                        String path = c.getString(PATH_VIDEO_COLUMN_INDEX);
                        long lastModified = c.getLong(DATE_MODIFIED_VIDEO_COLUMN_INDEX);

                        // Only consider entries with absolute path names.
                        // This allows storing URIs in the database without the
                        // media scanner removing them.
                        if (path.startsWith("/")) {
                            String key = path;
                            if (mCaseInsensitivePaths) {
                                key = path.toLowerCase();
@@ -955,6 +964,7 @@ public class MediaScanner
                            mFileCache.put(key, new FileCacheEntry(mVideoUri, rowId, path,
                                    lastModified));
                        }
                    }
                } finally {
                    c.close();
                    c = null;
@@ -978,6 +988,10 @@ public class MediaScanner
                        String path = c.getString(PATH_IMAGES_COLUMN_INDEX);
                       long lastModified = c.getLong(DATE_MODIFIED_IMAGES_COLUMN_INDEX);

                       // Only consider entries with absolute path names.
                       // This allows storing URIs in the database without the
                       // media scanner removing them.
                       if (path.startsWith("/")) {
                           String key = path;
                           if (mCaseInsensitivePaths) {
                               key = path.toLowerCase();
@@ -985,6 +999,7 @@ public class MediaScanner
                           mFileCache.put(key, new FileCacheEntry(mImagesUri, rowId, path,
                                   lastModified));
                       }
                    }
                } finally {
                    c.close();
                    c = null;
@@ -1003,7 +1018,7 @@ public class MediaScanner
                if (c != null) {
                    try {
                        while (c.moveToNext()) {
                            String path = c.getString(PATH_IMAGES_COLUMN_INDEX);
                            String path = c.getString(PATH_PLAYLISTS_COLUMN_INDEX);

                            if (path != null && path.length() > 0) {
                                long rowId = c.getLong(ID_PLAYLISTS_COLUMN_INDEX);