Status Update
Comments
wu...@google.com <wu...@google.com> #2
Thanks for reporting. We will look into the issue and update the status here.
sc...@google.com <sc...@google.com> #3
Hi Thanks for reporting the issue. To have more context, can you help provide the following information ?
-
Can you show us how you configure the ImageCapture in the codes ?
-
Did you enable CameraX Extensions ?
-
so the occurrence rate is like 20%, right ?
sh...@gmail.com <sh...@gmail.com> #4
Thanks for your response.
Sure. I can provide more data.
1.
ImageCapture.Builder builder = new ImageCapture.Builder();
builder.setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY);
if (!extensionAvailable) {
builder.setBufferFormat(ImageFormat.YUV_420_888);
}
imageCapture = builder.build();
UseCaseGroup useCaseGroup = new UseCaseGroup.Builder()
.addUseCase(preview)
.addUseCase(imageCapture)
.setViewPort(viewPort)
.build();
cameraProvider.unbindAll();
camera = cameraProvider.bindToLifecycle(this, cameraSelector, useCaseGroup);
-
Yes, Extensions are enabled, which means that the code is not configuring the buffer format and therefore will use the JPEG format. If I disable the extensions, than the error disapears. But I think its more a jpeg format issue then an extension problem.
-
Yes, occurrence rate is 20%.
ch...@google.com <ch...@google.com> #5
Thanks for the information! We will look into this.
sh...@gmail.com <sh...@gmail.com> #6
Any updates on this?
ap...@google.com <ap...@google.com> #7
sh...@gmail.com <sh...@gmail.com> #8
Branch: androidx-main
commit 366c0b3e157615a4eb7f4597166bf30e0f1c9bdd
Author: Scott Nien <scottnien@google.com>
Date: Thu Dec 14 17:52:42 2023
Fixed the issue when takePicture with Extensions is interruped by lifecycle stop and it can't takePicture anymore after lifecyce start.
1. Handling the image of aborted request in CaptureNode
- When request is aborted, clear the pending request in NoMetadataImageReader
to avoid crash when next request is available.
- When incoming image has null stageId, close the image instead
of crash since this is the case when aborted request
still produce image.
2. Run the CaptureProcessorImpl.process() in non-camera thread instead.
to avoid it from blocking the camera thread which will freeze the preview.
Bug: 306202751
Test: CaptureNodeTest, extensions/ImageCaptureTest
Relnote: "Fixed the crash that happens when lifecycle is stopped before
takePicture request is completed"
Change-Id: Idf017ef3ec1400955066433dd8446f94728b8a1a
M camera/camera-core/src/main/java/androidx/camera/core/imagecapture/CaptureNode.java
M camera/camera-core/src/main/java/androidx/camera/core/imagecapture/NoMetadataImageReader.java
M camera/camera-core/src/test/java/androidx/camera/core/imagecapture/CaptureNodeTest.kt
M camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/ImageCaptureTest.kt
M camera/camera-extensions/src/main/java/androidx/camera/extensions/internal/AdvancedVendorExtender.java
M camera/camera-extensions/src/main/java/androidx/camera/extensions/internal/BasicVendorExtender.java
M camera/camera-extensions/src/main/java/androidx/camera/extensions/internal/sessionprocessor/BasicExtenderSessionProcessor.java
M camera/camera-extensions/src/main/java/androidx/camera/extensions/internal/sessionprocessor/StillCaptureProcessor.java
M camera/camera-testing/src/main/java/androidx/camera/testing/impl/fakes/FakeImageReaderProxy.java
M camera/camera-testlib-extensions/src/main/java/androidx/camera/extensions/impl/NightImageCaptureExtenderImpl.java
M camera/camera-testlib-extensions/src/main/java/androidx/camera/extensions/impl/advanced/LongCaptureAdvancedExtenderImpl.java
ju...@gomore.com <ju...@gomore.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.camera:camera-core:1.4.0-alpha04
androidx.camera:camera-extensions:1.4.0-alpha04
sg...@google.com <sg...@google.com> #10
This was caused by a bug in R8 (internal issue settings.gradle
or settings.gradle.kts
:
pluginManagement {
buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath("com.android.tools:r8:8.5.35")
}
}
}
sc...@google.com <sc...@google.com> #11
Hi developer,
We are sorry to cause you so many troubles. We have been tried to add Proguard rules to fix it but seems not working as the problem is caused by missing file in the app instead of files being obfuscated incorrectly. That's why we end up doing such a weird solution to workaround it.
To avoid the issue from happening in the future, we have added the released flavor apk testing into our daily tests which will monitor any issues that only happen with Proguard/R8. We will fix any issue if found and mitigate any impacts to the developers.
Below are more technical details if you are interested:
The OEM's extensions implementation files are in the device runtime instead of in the app or the libraries. In CameraX, we use "compileOnly" dependency to invoke these runtime library so technically these files are missing in the apps. The R8 bug is that it can't handle the missing file case correctly when apps invoke instanceOf
. So adding the Proguard rules doesn't help.
sc...@google.com <sc...@google.com> #12
One thing to add,
We have always tested the released flavor apk with R8 enabled right before releasing the new CameraX libraries. It is enough for catching CameraX bug but it can't catch the R8/AGP issues quickly. That's why we integrate the released apk testing to our daily testing.
ju...@gomore.com <ju...@gomore.com> #13
Thanks for the testing changes and the clarification!
pr...@google.com <pr...@google.com> #14
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.camera:camera-extensions:1.4.0-rc01
Description
Hi Team CameraX,
Gradle version 8.5.1 seems to currently causing a crash (possibly due to minification) for CameraX extension usage. One of our users reported that switching to night mode caused the preview to freeze and switching to another mode (which rebinds a new camera instance) caused the preview to unfreeze.
Quoting their report on this issue,
(Source:https://github.com/GrapheneOS/Camera/issues/449 )
Downgrading to Gradle 8.5.0 in our app's recent release caused the issue to no longer persist. Could you'll please help us fix this issue?
The CameraX version for which we're facing this issue is CameraX 1.4.0-beta01 and the device on which this issue was reported is Pixel 6.
Please do let us know if any additional information is required for the same
Thanks a lot for your time and all the help and support!
Regards,
Mohit