Skip to content

Commit 893e2b6

Browse files
Romain GuyAndroid Code Review
authored andcommitted
Merge "Change in media scanner to set correct date"
2 parents 879becf + ec74abb commit 893e2b6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

media/java/android/media/MediaScanner.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,8 +1203,12 @@ public Uri scanSingleFile(String path, String volumeName, String mimeType) {
12031203
prescan(path);
12041204

12051205
File file = new File(path);
1206+
1207+
// lastModified is in milliseconds on Files.
1208+
long lastModifiedSeconds = file.lastModified() / 1000;
1209+
12061210
// always scan the file, so we can return the content://media Uri for existing files
1207-
return mClient.doScanFile(path, mimeType, file.lastModified(), file.length(), true);
1211+
return mClient.doScanFile(path, mimeType, lastModifiedSeconds, file.length(), true);
12081212
} catch (RemoteException e) {
12091213
Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e);
12101214
return null;

0 commit comments

Comments
 (0)