From ac73410cf8d2ebff5d7453860dccc47bbdaa241d Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Tue, 12 Apr 2022 14:41:48 +0600 Subject: [PATCH] 5244-Fix_video_preview_uri_issue issue: https://gitlab.e.foundation/e/backlog/-/issues/5244 For video recording `MediaScannerConnection.scanFile` providing wrong uri, as a result gallery app crashed on it. To resolve it, when video is recorded, we need to fetch latest video media's uri & pass it to use in galleryPreview section. --- .../main/java/net/sourceforge/opencamera/StorageUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/net/sourceforge/opencamera/StorageUtils.java b/app/src/main/java/net/sourceforge/opencamera/StorageUtils.java index 0a22d84ac..8abf1adbd 100644 --- a/app/src/main/java/net/sourceforge/opencamera/StorageUtils.java +++ b/app/src/main/java/net/sourceforge/opencamera/StorageUtils.java @@ -240,6 +240,10 @@ public class StorageUtils { } if( set_last_scanned ) { last_media_scanned = uri; + if (is_new_video) { + Media media = getLatestMedia(is_new_video); + last_media_scanned = (media != null) ? media.uri : uri; + } if( MyDebug.LOG ) Log.d(TAG, "set last_media_scanned to " + last_media_scanned); } -- GitLab