Skip to content

Commit 872e7b7

Browse files
author
Ray Chen
committed
Fix b/5353417 Images downloaded from browser are showing incorrect details (Time is shown as dec 31 1969)
MediaScanner sets DATE_TAKEN with EXIF's datetime tag value. When this information is not available, ExifInterface will simply return -1 which is accidentally used by MediaScanner. Adding a check to avoid it so MediaProvider can calculate the date taken from last modified time instead. Change-Id: I305b93a6c5602cbb9f97c3bbd384d358bda030c6
1 parent 5571ffd commit 872e7b7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

media/java/android/media/MediaScanner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ private Uri endFile(FileEntry entry, boolean ringtones, boolean notifications,
839839
// and EXIF local time is not less than 1 Day, otherwise MediaProvider
840840
// will use file time as taken time.
841841
time = exif.getDateTime();
842-
if (Math.abs(mLastModified * 1000 - time) >= 86400000) {
842+
if (time != -1 && Math.abs(mLastModified * 1000 - time) >= 86400000) {
843843
values.put(Images.Media.DATE_TAKEN, time);
844844
}
845845
}
@@ -1183,7 +1183,7 @@ private void pruneDeadThumbnailFiles() {
11831183

11841184
static class MediaBulkDeleter {
11851185
StringBuilder whereClause = new StringBuilder();
1186-
ArrayList<String> whereArgs = new ArrayList<String>(100);
1186+
ArrayList<String> whereArgs = new ArrayList<String>(100);
11871187
IContentProvider mProvider;
11881188
Uri mBaseUri;
11891189

0 commit comments

Comments
 (0)