Only set file size if the app didn't
This lets apps specify the eventual file size if it wants to,
while the provider will fill it in with the current file size
if the app didn't specify it.
b/6857704
Change-Id: Ide12957180a5826404821459368abd2de4f6d2ba
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 3434089..4d9f242 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -2976,7 +2976,9 @@
File file = new File(path);
if (file.exists()) {
values.put(FileColumns.DATE_MODIFIED, file.lastModified() / 1000);
- values.put(FileColumns.SIZE, file.length());
+ if (!values.containsKey(FileColumns.SIZE)) {
+ values.put(FileColumns.SIZE, file.length());
+ }
}
}