Closed frikisama closed 3 years ago
This patch works around this issue: https://gist.github.com/frikisama/ff736e69be0a8732735fc34477ab25a8
Work needs to be done around gallery image loading and thumbnailing, as it reads the whole directory every time, but the application itself can start even with a high amount of images in the DCIM directory on Android 11, and simply becomes unbearably slow when working with the gallery.
Thanks for the bug report, I will take into account that there is such a bug.
(Edited)
Still happening to me. I had 2000+ images in DCIM folder, and it uses ~10 seconds to start or switch views. Guess it's less than 5000+ and it's just slow rather than crash?
The phone is Oneplus 8. OS is LineageOS 18.1. PhotonCamera is v0.8.12381.
I went through a quite bit to build the latest dev branch (reporting v0.8.14951), and confirm it's not freezing or crashing for me!
Describe the bug With LineageOS 18.1 (Android 11) on a OnePlus 7 Pro, when there is a great amount of pictures in the DCIM directory (5k+ in my case), the application crashes on startup. This is caused by the application scanning ALL image files in that directory on startup to create the thumbnails for the gallery while building the Camera fragment.
The
cameraFragmentViewModel.updateGalleryThumb();
call in theonResume()
method insrc/main/java/com/particlesdevs/photoncamera/ui/camera/CameraFragment.java
takes several minutes in this case, and the application crashes after finishing.To Reproduce Steps to reproduce the behavior:
Expected behavior The application starts up. Maybe first boot takes longer. Maybe gallery startup takes longer.
Logs https://gist.github.com/frikisama/ff78255ff0a6ca731f705ed2c04df9e4
Smartphone (please complete the following information):
Additional context The background could be the slow FS access on Android 11. See here for example: https://github.com/syncthing/syncthing-android/issues/1630 Or here: https://www.reddit.com/r/androiddev/comments/kpn68k/android_11_very_slow_file_access_performance/
Bypassing the scanning on startup lets the application start, but it crashes getting into the gallery. Putting this in a background thread could help. Maybe a cache could help with the UX side of things, in this case. An option to use an external gallery app could be used as a workaround.