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

Commit ef6341dc authored by Mikael2 Svensson's avatar Mikael2 Svensson Committed by Steve Kondik
Browse files

Change in media scanner to set correct date

When the media scanner scanned a single file, the modified
date (DATE_MODIFIED) was not correctly set in the content
provider. It was set as milliseconds but should have been
set as seconds. This caused downloaded media items to display
wrongly in the camera album, since the date was wrong.

Change-Id: I24cd92215c26f579eb33a4a3890f96c6ef9ec8c0
parent ae17b739
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -1215,8 +1215,12 @@ public class MediaScanner
            prescan(path);
            prescan(path);


            File file = new File(path);
            File file = new File(path);

            // lastModified is in milliseconds on Files.
            long lastModifiedSeconds = file.lastModified() / 1000;

            // always scan the file, so we can return the content://media Uri for existing files
            // always scan the file, so we can return the content://media Uri for existing files
            return mClient.doScanFile(path, mimeType, file.lastModified(), file.length(), true);
            return mClient.doScanFile(path, mimeType, lastModifiedSeconds, file.length(), true);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e);
            Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e);
            return null;
            return null;