Fixed
Status Update
Comments
wu...@google.com <wu...@google.com>
ch...@google.com <ch...@google.com> #2
Hi Doudera,
Thank you for reporting this issue. It is working as intended. This is because the state of CameraControl follows Camera. Once the Camera is closed, all settings will be restored, just like the settings of the focus area and zoom level. The app can restore the torch state by resetting torch at the time of activity onResume.
pr...@paralleldots.com <pr...@paralleldots.com> #3
Hello,
thank you for the fast reply. The behaviour is unexpected to me because if you have the same code as before and just add logging like this:
camera = cameraProvider.bindToLifecycle(
this, cameraSelector, preview, imageCapture, imageAnalyzer)
.apply {
Log.d(TAG, "Enabling torch after binding") // <-- called everytime it returns to Activity so next statement should be applied
cameraControl.enableTorch(true)
}
The log is always called even when returning to Activity so I suppose it should be applied. Why it is not applied when it is called?
Unfortunately, I cannot make it work even with your hint. I tried to add camera?.cameraControl?.enableTorch(true) to onResume() but without any effect. Can you please describe more how to reset torch state onResume().
As you said the same happens with setZoomRatio() etc.
Thank you, Martin
thank you for the fast reply. The behaviour is unexpected to me because if you have the same code as before and just add logging like this:
camera = cameraProvider.bindToLifecycle(
this, cameraSelector, preview, imageCapture, imageAnalyzer)
.apply {
Log.d(TAG, "Enabling torch after binding") // <-- called everytime it returns to Activity so next statement should be applied
cameraControl.enableTorch(true)
}
The log is always called even when returning to Activity so I suppose it should be applied. Why it is not applied when it is called?
Unfortunately, I cannot make it work even with your hint. I tried to add camera?.cameraControl?.enableTorch(true) to onResume() but without any effect. Can you please describe more how to reset torch state onResume().
As you said the same happens with setZoomRatio() etc.
Thank you, Martin
wu...@google.com <wu...@google.com>
ch...@google.com <ch...@google.com>
ap...@google.com <ap...@google.com> #4
Hi Doudera, Thank you for the detail description. It sounds like some problem in the code. I will investigate it more.
ch...@google.com <ch...@google.com>
pr...@google.com <pr...@google.com> #5
From the log, it shows the camera state
-> open -> enable torch -> close -> open
The torch was gone because it restarted the camera.
It needs to investigate more about why it open/close so frequently.
Description
CAMERAX VERSION 1.3.4
CAMERA APPLICATION NAME AND VERSION: Shelfwatch and 5.3.0
DEVICE NAME:
Samsung Galaxy S10e
Samsung Galaxy A24
Samsung Galaxy S10+
Samsung Galaxy S20 +/FE
DESCRIPTION: Users are facing crashes while taking images, does not happen for all images but happens randomly.
STEPS TO REPRODUCE:
1. Click multiple images with camera x library
REPRODUCIBILITY: As this is faced by our users on specific devices we have not reproduced but from the logs it seems like it happens for 1/20 pictures.
STACK TRACE :
Fatal Exception: java.lang.UnsupportedOperationException: Decode jpeg byte array failed
at androidx.camera.core.internal.utils.ImageUtil.createBitmapFromJpegImage(ImageUtil.java:453)
at androidx.camera.core.internal.utils.ImageUtil.createBitmapFromImageProxy(ImageUtil.java:82)
at androidx.camera.core.ImageProxy.toBitmap(ImageProxy.java:154)
Additonal comments :
Have upgraded to 1.3.4 version of Camera X for the fix in Galaxy A24, will it be fixed for other devices as well?