Loading media/java/android/media/MediaScanner.java +2 −30 Original line number Diff line number Diff line Loading @@ -292,7 +292,6 @@ public class MediaScanner private boolean mProcessPlaylists, mProcessGenres; private int mMtpObjectHandle; private final String mMediaStoragePath; private final String mExternalStoragePath; // used when scanning the image database so we know whether we have to prune Loading Loading @@ -365,12 +364,6 @@ public class MediaScanner setDefaultRingtoneFileNames(); String mediaStoragePath = SystemProperties.get("ro.media.storage"); if (mediaStoragePath != null && mediaStoragePath.length() > 0) { mMediaStoragePath = mediaStoragePath; } else { mMediaStoragePath = null; } mExternalStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath(); } Loading @@ -390,13 +383,6 @@ public class MediaScanner return prop != null && prop.equals("true"); } private final String mediaToExternalPath(String path) { if (mMediaStoragePath != null && path.startsWith(mMediaStoragePath)) { path = mExternalStoragePath + path.substring(mMediaStoragePath.length()); } return path; } private class MyMediaScannerClient implements MediaScannerClient { private String mArtist; Loading Loading @@ -471,9 +457,7 @@ public class MediaScanner } } // MediaProvider uses external variant of path for _data, so we need to match // against that path instead. String key = mediaToExternalPath(path); String key = path; if (mCaseInsensitivePaths) { key = path.toLowerCase(); } Loading Loading @@ -886,8 +870,6 @@ public class MediaScanner } public void addNoMediaFolder(String path) { path = mediaToExternalPath(path); ContentValues values = new ContentValues(); values.put(MediaStore.Images.ImageColumns.DATA, ""); String [] pathSpec = new String[] {path + '%'}; Loading Loading @@ -946,10 +928,6 @@ public class MediaScanner } if (filePath != null) { // MediaProvider uses external variant of path for _data, so we need to query // using that path instead. filePath = mediaToExternalPath(filePath); // query for only one file where = Files.FileColumns.DATA + "=?"; selectionArgs = new String[] { filePath }; Loading Loading @@ -1007,10 +985,6 @@ public class MediaScanner private boolean inScanDirectory(String path, String[] directories) { for (int i = 0; i < directories.length; i++) { String directory = directories[i]; if (mExternalStoragePath != null && directory.equals(mMediaStoragePath)) { // database paths use external storage prefix directory = mExternalStoragePath; } if (path.startsWith(directory)) { return true; } Loading Loading @@ -1217,9 +1191,7 @@ public class MediaScanner // build file cache so we can look up tracks in the playlist prescan(null, true); // MediaProvider uses external variant of path for _data, so we need to match // against that path instead. String key = mediaToExternalPath(path); String key = path; if (mCaseInsensitivePaths) { key = path.toLowerCase(); } Loading media/java/android/mtp/MtpDatabase.java +2 −14 Original line number Diff line number Diff line Loading @@ -50,7 +50,6 @@ public class MtpDatabase { private final String mVolumeName; private final Uri mObjectsUri; private final String mMediaStoragePath; private final String mExternalStoragePath; // cached property groups for single properties private final HashMap<Integer, MtpPropertyGroup> mPropertyGroupsByProperty Loading Loading @@ -113,7 +112,6 @@ public class MtpDatabase { mMediaProvider = context.getContentResolver().acquireProvider("media"); mVolumeName = volumeName; mMediaStoragePath = storagePath; mExternalStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath(); mObjectsUri = Files.getMtpObjectsUri(volumeName); mMediaScanner = new MediaScanner(context); openDevicePropertiesDatabase(context); Loading @@ -128,16 +126,6 @@ public class MtpDatabase { } } private String externalToMediaPath(String path) { // convert external storage path to media path if (path != null && mMediaStoragePath != null && mExternalStoragePath != null && path.startsWith(mExternalStoragePath)) { path = mMediaStoragePath + path.substring(mExternalStoragePath.length()); } return path; } private void openDevicePropertiesDatabase(Context context) { mDevicePropDb = context.openOrCreateDatabase("device-properties", Context.MODE_PRIVATE, null); int version = mDevicePropDb.getVersion(); Loading Loading @@ -525,7 +513,7 @@ public class MtpDatabase { try { c = mMediaProvider.query(mObjectsUri, PATH_PROJECTION, ID_WHERE, whereArgs, null); if (c != null && c.moveToNext()) { path = externalToMediaPath(c.getString(1)); path = c.getString(1); } } catch (RemoteException e) { Log.e(TAG, "RemoteException in getObjectFilePath", e); Loading Loading @@ -707,7 +695,7 @@ public class MtpDatabase { c = mMediaProvider.query(mObjectsUri, PATH_SIZE_FORMAT_PROJECTION, ID_WHERE, new String[] { Integer.toString(handle) }, null); if (c != null && c.moveToNext()) { String path = externalToMediaPath(c.getString(1)); String path = c.getString(1); path.getChars(0, path.length(), outFilePath, 0); outFilePath[path.length()] = 0; outFileLengthFormat[0] = c.getLong(2); Loading Loading
media/java/android/media/MediaScanner.java +2 −30 Original line number Diff line number Diff line Loading @@ -292,7 +292,6 @@ public class MediaScanner private boolean mProcessPlaylists, mProcessGenres; private int mMtpObjectHandle; private final String mMediaStoragePath; private final String mExternalStoragePath; // used when scanning the image database so we know whether we have to prune Loading Loading @@ -365,12 +364,6 @@ public class MediaScanner setDefaultRingtoneFileNames(); String mediaStoragePath = SystemProperties.get("ro.media.storage"); if (mediaStoragePath != null && mediaStoragePath.length() > 0) { mMediaStoragePath = mediaStoragePath; } else { mMediaStoragePath = null; } mExternalStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath(); } Loading @@ -390,13 +383,6 @@ public class MediaScanner return prop != null && prop.equals("true"); } private final String mediaToExternalPath(String path) { if (mMediaStoragePath != null && path.startsWith(mMediaStoragePath)) { path = mExternalStoragePath + path.substring(mMediaStoragePath.length()); } return path; } private class MyMediaScannerClient implements MediaScannerClient { private String mArtist; Loading Loading @@ -471,9 +457,7 @@ public class MediaScanner } } // MediaProvider uses external variant of path for _data, so we need to match // against that path instead. String key = mediaToExternalPath(path); String key = path; if (mCaseInsensitivePaths) { key = path.toLowerCase(); } Loading Loading @@ -886,8 +870,6 @@ public class MediaScanner } public void addNoMediaFolder(String path) { path = mediaToExternalPath(path); ContentValues values = new ContentValues(); values.put(MediaStore.Images.ImageColumns.DATA, ""); String [] pathSpec = new String[] {path + '%'}; Loading Loading @@ -946,10 +928,6 @@ public class MediaScanner } if (filePath != null) { // MediaProvider uses external variant of path for _data, so we need to query // using that path instead. filePath = mediaToExternalPath(filePath); // query for only one file where = Files.FileColumns.DATA + "=?"; selectionArgs = new String[] { filePath }; Loading Loading @@ -1007,10 +985,6 @@ public class MediaScanner private boolean inScanDirectory(String path, String[] directories) { for (int i = 0; i < directories.length; i++) { String directory = directories[i]; if (mExternalStoragePath != null && directory.equals(mMediaStoragePath)) { // database paths use external storage prefix directory = mExternalStoragePath; } if (path.startsWith(directory)) { return true; } Loading Loading @@ -1217,9 +1191,7 @@ public class MediaScanner // build file cache so we can look up tracks in the playlist prescan(null, true); // MediaProvider uses external variant of path for _data, so we need to match // against that path instead. String key = mediaToExternalPath(path); String key = path; if (mCaseInsensitivePaths) { key = path.toLowerCase(); } Loading
media/java/android/mtp/MtpDatabase.java +2 −14 Original line number Diff line number Diff line Loading @@ -50,7 +50,6 @@ public class MtpDatabase { private final String mVolumeName; private final Uri mObjectsUri; private final String mMediaStoragePath; private final String mExternalStoragePath; // cached property groups for single properties private final HashMap<Integer, MtpPropertyGroup> mPropertyGroupsByProperty Loading Loading @@ -113,7 +112,6 @@ public class MtpDatabase { mMediaProvider = context.getContentResolver().acquireProvider("media"); mVolumeName = volumeName; mMediaStoragePath = storagePath; mExternalStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath(); mObjectsUri = Files.getMtpObjectsUri(volumeName); mMediaScanner = new MediaScanner(context); openDevicePropertiesDatabase(context); Loading @@ -128,16 +126,6 @@ public class MtpDatabase { } } private String externalToMediaPath(String path) { // convert external storage path to media path if (path != null && mMediaStoragePath != null && mExternalStoragePath != null && path.startsWith(mExternalStoragePath)) { path = mMediaStoragePath + path.substring(mExternalStoragePath.length()); } return path; } private void openDevicePropertiesDatabase(Context context) { mDevicePropDb = context.openOrCreateDatabase("device-properties", Context.MODE_PRIVATE, null); int version = mDevicePropDb.getVersion(); Loading Loading @@ -525,7 +513,7 @@ public class MtpDatabase { try { c = mMediaProvider.query(mObjectsUri, PATH_PROJECTION, ID_WHERE, whereArgs, null); if (c != null && c.moveToNext()) { path = externalToMediaPath(c.getString(1)); path = c.getString(1); } } catch (RemoteException e) { Log.e(TAG, "RemoteException in getObjectFilePath", e); Loading Loading @@ -707,7 +695,7 @@ public class MtpDatabase { c = mMediaProvider.query(mObjectsUri, PATH_SIZE_FORMAT_PROJECTION, ID_WHERE, new String[] { Integer.toString(handle) }, null); if (c != null && c.moveToNext()) { String path = externalToMediaPath(c.getString(1)); String path = c.getString(1); path.getChars(0, path.length(), outFilePath, 0); outFilePath[path.length()] = 0; outFileLengthFormat[0] = c.getLong(2); Loading