-
-
Notifications
You must be signed in to change notification settings - Fork 12
Description
We are using the main Camera.MAUI package and are currently encountering a crash on Android devices with Android 15.
This issue was already brought up as an issue in the main project, however this project isn't very actively maintained. We decided to switch to your fork of the main project, and we noticed the same issue also occurring on this fork.
I couldn't find any mention of this issue here, so I decided to open one. The original issue can be found here: hjam40#200 (comment)
We aren't exactly familiar with Android code, but we decided to try and find a solution. Looking at the exception:
[AndroidRuntime] java.util.concurrent.RejectedExecutionException: Task android.hardware.camera2.impl.CameraDeviceImpl$ClientStateCallback$1@be5e7ec rejected from java.util.concurrent.ThreadPoolExecutor@a15d7b5
It seemed to imply the thread pool executor was stopped. Because of this we thought the issue seemed to originate form the StopCamera method in the (Android) MauiCameraView. One of the things that happen during the cleanup that is done in this method, is stopping the background thread.
So we came to the conclusion that the backgroundThread was stopped to soon. The solution we arrived at, was to wait for the camera to completely close and stop the backgroundThread then.
This solution prevents the crash (as far as we have been able to tell), however some RejectedExecutionExceptions still seem to get logged.
The full solution we arrived at can be found here: Leonardo-pixel/CameraMauiAndroid@f9d549e
Hopefully you're able to do something with this!