Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5313f8c6 authored by Abhishek Aggarwal's avatar Abhishek Aggarwal
Browse files

Revert "Gallery2: Try to extract datetaken from exif if mediastore returns 0"

Opening gallery with many images and videos is taking lots of time
so revert it for now.

This reverts commit 0769f9d7.
parent 46b7238f
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ import com.android.gallery3d.util.UpdateHelper;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.Exception;

// LocalImage represents an image in the local storage.
public class LocalImage extends LocalMediaItem {
@@ -147,7 +146,6 @@ public class LocalImage extends LocalMediaItem {
        fileSize = cursor.getLong(INDEX_SIZE);
        width = cursor.getInt(INDEX_WIDTH);
        height = cursor.getInt(INDEX_HEIGHT);
        dateTakenInMs = extractDateTaken(dateTakenInMs);
    }

    @Override
@@ -158,7 +156,7 @@ public class LocalImage extends LocalMediaItem {
        latitude = uh.update(latitude, cursor.getDouble(INDEX_LATITUDE));
        longitude = uh.update(longitude, cursor.getDouble(INDEX_LONGITUDE));
        dateTakenInMs = uh.update(
                dateTakenInMs, extractDateTaken(cursor.getLong(INDEX_DATE_TAKEN)));
                dateTakenInMs, cursor.getLong(INDEX_DATE_TAKEN));
        dateAddedInSec = uh.update(
                dateAddedInSec, cursor.getLong(INDEX_DATE_ADDED));
        dateModifiedInSec = uh.update(
@@ -179,18 +177,6 @@ public class LocalImage extends LocalMediaItem {
                type, filePath, mimeType);
    }

    private long extractDateTaken(long dateTaken) {
        if (dateTaken == 0) {
            MediaDetails details = super.getDetails();
            MediaDetails.extractExifInfo(details, filePath);
            try {
                return ExifInterface.DATETIME_FORMAT.parse(
                        details.getDetail(MediaDetails.INDEX_DATETIME_ORIGINAL).toString()).getTime();
            } catch (Exception e) {}
        }
        return dateTaken;
    }

    public static class LocalImageRequest extends ImageCacheRequest {
        private String mLocalFilePath;