Merge "Allow ModernMediaScanner to set MEDIA_TYPE" into rvc-dev
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 0920b47..762dbf4 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -2703,7 +2703,12 @@
if (mimeType != null) {
values.put(FileColumns.MIME_TYPE, mimeType);
- values.put(FileColumns.MEDIA_TYPE, MimeUtils.resolveMediaType(mimeType));
+ if (isCallingPackageSystem() && values.containsKey(FileColumns.MEDIA_TYPE)) {
+ // Leave FileColumns.MEDIA_TYPE untouched if the caller is ModernMediaScanner and
+ // FileColumns.MEDIA_TYPE is already populated.
+ } else{
+ values.put(FileColumns.MEDIA_TYPE, MimeUtils.resolveMediaType(mimeType));
+ }
} else {
values.put(FileColumns.MEDIA_TYPE, mediaType);
}