Explicitly trigger media scanner after saving images and videos
Snap does not use SAF yet and relies on directly saving files
using a file path.
This results in pictures and videos saved on external storage
not being visible for other apps until media scanner decides
to randomly scan the external storage or the device reboots.
As workaround MediaProvider got patched[1], however this change
causes CTS to fail (see below for test procedure).
The real solution would be to rewrite Snap to properly use new
APIs, SAF etc, which will take a lot of time.
As bandaid trigger the media scanner manually when saving
pictures and videos.
[1] - https://github.com/LineageOS/android_packages_providers_MediaProvider/commit/7a9f0c34bafbe78b2d672bebd48c2988e74fb159
Test: run cts -m CtsProviderTestCases -t android.provider.cts.MediaStore_FilesTest#testAccess
Change-Id: Ie432cb533631efe0db6f9a9852c572ecc7f7a573
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
3 files changed