Status Update
Comments
we...@google.com <we...@google.com> #2
Thanks for reporting this and providing such detailed information!
To help us investigate further, could you have a chance to test this behavior on the CameraXBasic sample app (
This will help us determine if the issue lies in your implementation or within the CameraX library itself.
li...@visma.com <li...@visma.com> #3
I've tried using the fold emulator, and the library works as expected. The stack trace that I've added is from production Crashlytics, and I don't have a Samsung Galaxy Fold 6 phone, so I can't test this on a real device. The Camera library works as expected on other phone models, though.
we...@google.com <we...@google.com> #4
Thanks for testing on the emulator and providing the additional information!
We've tested the CameraXBasic sample app on an SM-F956B in our lab and haven't been able to reproduce the error. This leads us to believe it might be related to a specific device configuration, software issue, or even a problem with the camera HAL on certain Fold 6 models.
To help us pinpoint this issue, could you please provide some more details about the affected devices? Specifically:
- Device Model Number: While you mentioned Fold 6, it would be helpful to know the exact model number (e.g., SM-F956B, SM-F956U, etc.). There might be subtle differences between submodels that could be contributing to the problem.
- Occurrence Rate/Device IDs: Do you have any information on how often this error occurs? Is it happening on a large number of Fold 6 devices or just a few specific ones? This will help us determine if it's a widespread issue or a problem with specific devices.
- Camera Lens Facing: Does this issue occur with both the front and back cameras, or is it specific to one lens facing?
- Preview Status: When the capture fails, is the camera preview still working correctly? This can help us understand if the issue is with the capture process itself or a more general camera malfunction.
Since you mentioned the camera works on other phone models and the emulator, it's possible this is related to:
- Hardware variability: There might be subtle differences in the camera hardware or drivers in certain Fold 6 submodels that are causing this issue.
- Device-specific issue: It could be a problem with a limited number of devices with faulty camera modules.
- Software interactions: There might be an unforeseen interaction with other software or settings on the Fold 6 that we haven't encountered in our testing.
Your insights will be invaluable in helping us narrow down the cause. Thanks again for your patience and cooperation!
li...@visma.com <li...@visma.com> #5
For last 90 days we got about 1.5k errors. Not sure if all fold/flip models gets this error I just see that 99% that report this issue is Flip and Fold 6.
We are using only back cameras.
When the capture fails the preview still works.
we...@google.com <we...@google.com> #6
Over to Tahsin for image capture issue.
ta...@google.com <ta...@google.com> #7
Hi,
Unfortunately, we don't have any Flip 6 (SM-F741B) available for testing and weren't able to reproduce the issue in devices like Flip 5, Fold 6 (SM-F956B) etc.
In case it's related to some specific way of configuring CameraX, could you please let us know which CameraX use cases (e.g. Preview, ImageCapture, VideoCapture) you are binding and what other features/configurations (e.g. CameraEffect, specific target resolution, aspect ratio etc.) you are using?
Also, from the crashlytics, can you see the Android SDK version or some device build version for these crashes? There is also a chance that the issue occurs in some specific build or Android version (which may be the reason why weren't able to reproduce in our Fold 6).
Thank you for your understanding.
Description
CAMERAX VERSION: (1.3.4)
DEVICE NAME: (Samsung Galaxy Z Fold6)
DESCRIPTION:
Camera is used in compose as AndroidView. Back camera is used.
Take picture is handled using LifecycleCameraController. Here is the code snippet which handles picture capture:
internal fun LifecycleCameraController.capturePhoto(
context: Context,
onPhotoCaptured: (image: ByteArray) -> Unit,
onPhotoCaptureError: (error: Exception) -> Unit,
onPhotoCaptureInfo: (params: String) -> Unit = {}
) {
val mainExecutor: Executor = ContextCompat.getMainExecutor(context)
takePicture(mainExecutor, object : ImageCapture.OnImageCapturedCallback() {
override fun onCaptureSuccess(image: ImageProxy) {
try {
val rotationDegrees = image.imageInfo.rotationDegrees
val width = image.width
val height = image.height
val paramsAsString = getImageParams(rotationDegrees, width, height)
onPhotoCaptureInfo(paramsAsString)
val correctedBitmap: Bitmap = image
.toBitmap()
.rotateBitmap(rotationDegrees)
onPhotoCaptured(correctedBitmap.toByteArray())
} catch (ex: UnsupportedOperationException) {
onPhotoCaptureError.invoke(ex)
} finally {
image.close()
}
}
override fun onError(exception: ImageCaptureException) {
onPhotoCaptureError.invoke(exception)
}
})
}
STEPS TO REPRODUCE:
1 Take picture
2. Receive error.
OBSERVED RESULTS:
This issue happens only on Fold models.
REPRODUCIBILITY: Seems like happens 100% on Samsung Galaxy Z Fold6
ADDITIONAL INFORMATION:
Exception stacktrace:
androidx.camera.core.ImageCaptureException: Capture request failed with reason ERROR
at androidx.camera.core.ImageCaptureException.<init>(ImageCaptureException.java:36)
at androidx.camera.camera2.internal.Camera2CapturePipeline$Pipeline$2.onCaptureFailed(Camera2CapturePipeline.java:365)
at androidx.camera.camera2.internal.CaptureCallbackAdapter.onCaptureFailed(CaptureCallbackAdapter.java:81)
at androidx.camera.camera2.internal.CameraBurstCaptureCallback.onCaptureFailed(CameraBurstCaptureCallback.java:75)
at android.hardware.camera2.impl.CameraCaptureSessionImpl$1.lambda$onCaptureFailed$5(CameraCaptureSessionImpl.java:722)
at android.hardware.camera2.impl.CameraCaptureSessionImpl$1.$r8$lambda$Ydhh2FrZkp7a6vW9ZdpZg9oABIk()
at android.hardware.camera2.impl.CameraCaptureSessionImpl$1$$ExternalSyntheticLambda7.run(:8)
at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:231)
at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:173)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)