Loading core/java/android/provider/MediaStore.java +17 −4 Original line number Diff line number Diff line Loading @@ -273,7 +273,9 @@ public final class MediaStore { } /** * Media provider interface used by MTP implementation. * Media provider table containing an index of all files in the storage. * This can be used by applications to find all documents of a particular type * and is also used internally by the device side MTP implementation. * @hide */ public static final class Files { Loading @@ -289,11 +291,22 @@ public final class MediaStore { + "/file/" + fileId); } // used for MTP GetObjectReferences and SetObjectReferences public static final Uri getReferencesUri(String volumeName, public static Uri getMtpObjectsUri(String volumeName) { return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName + "/object"); } public static final Uri getMtpObjectsUri(String volumeName, long fileId) { return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName + "/object/" + fileId); } // Used to implement the MTP GetObjectReferences and SetObjectReferences commands. public static final Uri getMtpReferencesUri(String volumeName, long fileId) { return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName + "/file/" + fileId + "/references"); + "/object/" + fileId + "/references"); } /** Loading media/java/android/media/MtpDatabase.java +4 −4 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public class MtpDatabase { mContext = context; mMediaProvider = context.getContentResolver().acquireProvider("media"); mVolumeName = volumeName; mObjectsUri = Files.getContentUri(volumeName); mObjectsUri = Files.getMtpObjectsUri(volumeName); mMediaScanner = new MediaScanner(context); openDevicePropertiesDatabase(context); } Loading Loading @@ -481,7 +481,7 @@ public class MtpDatabase { private int deleteFile(int handle) { Log.d(TAG, "deleteFile: " + handle); mDatabaseModified = true; Uri uri = Files.getContentUri(mVolumeName, handle); Uri uri = Files.getMtpObjectsUri(mVolumeName, handle); try { if (mMediaProvider.delete(uri, null, null) == 1) { return MtpConstants.RESPONSE_OK; Loading @@ -496,7 +496,7 @@ public class MtpDatabase { private int[] getObjectReferences(int handle) { Log.d(TAG, "getObjectReferences for: " + handle); Uri uri = Files.getReferencesUri(mVolumeName, handle); Uri uri = Files.getMtpReferencesUri(mVolumeName, handle); Cursor c = null; try { c = mMediaProvider.query(uri, ID_PROJECTION, null, null, null); Loading Loading @@ -524,7 +524,7 @@ public class MtpDatabase { private int setObjectReferences(int handle, int[] references) { mDatabaseModified = true; Uri uri = Files.getReferencesUri(mVolumeName, handle); Uri uri = Files.getMtpReferencesUri(mVolumeName, handle); int count = references.length; ContentValues[] valuesList = new ContentValues[count]; for (int i = 0; i < count; i++) { Loading Loading
core/java/android/provider/MediaStore.java +17 −4 Original line number Diff line number Diff line Loading @@ -273,7 +273,9 @@ public final class MediaStore { } /** * Media provider interface used by MTP implementation. * Media provider table containing an index of all files in the storage. * This can be used by applications to find all documents of a particular type * and is also used internally by the device side MTP implementation. * @hide */ public static final class Files { Loading @@ -289,11 +291,22 @@ public final class MediaStore { + "/file/" + fileId); } // used for MTP GetObjectReferences and SetObjectReferences public static final Uri getReferencesUri(String volumeName, public static Uri getMtpObjectsUri(String volumeName) { return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName + "/object"); } public static final Uri getMtpObjectsUri(String volumeName, long fileId) { return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName + "/object/" + fileId); } // Used to implement the MTP GetObjectReferences and SetObjectReferences commands. public static final Uri getMtpReferencesUri(String volumeName, long fileId) { return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName + "/file/" + fileId + "/references"); + "/object/" + fileId + "/references"); } /** Loading
media/java/android/media/MtpDatabase.java +4 −4 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public class MtpDatabase { mContext = context; mMediaProvider = context.getContentResolver().acquireProvider("media"); mVolumeName = volumeName; mObjectsUri = Files.getContentUri(volumeName); mObjectsUri = Files.getMtpObjectsUri(volumeName); mMediaScanner = new MediaScanner(context); openDevicePropertiesDatabase(context); } Loading Loading @@ -481,7 +481,7 @@ public class MtpDatabase { private int deleteFile(int handle) { Log.d(TAG, "deleteFile: " + handle); mDatabaseModified = true; Uri uri = Files.getContentUri(mVolumeName, handle); Uri uri = Files.getMtpObjectsUri(mVolumeName, handle); try { if (mMediaProvider.delete(uri, null, null) == 1) { return MtpConstants.RESPONSE_OK; Loading @@ -496,7 +496,7 @@ public class MtpDatabase { private int[] getObjectReferences(int handle) { Log.d(TAG, "getObjectReferences for: " + handle); Uri uri = Files.getReferencesUri(mVolumeName, handle); Uri uri = Files.getMtpReferencesUri(mVolumeName, handle); Cursor c = null; try { c = mMediaProvider.query(uri, ID_PROJECTION, null, null, null); Loading Loading @@ -524,7 +524,7 @@ public class MtpDatabase { private int setObjectReferences(int handle, int[] references) { mDatabaseModified = true; Uri uri = Files.getReferencesUri(mVolumeName, handle); Uri uri = Files.getMtpReferencesUri(mVolumeName, handle); int count = references.length; ContentValues[] valuesList = new ContentValues[count]; for (int i = 0; i < count; i++) { Loading