Status Update
Comments
yc...@gmail.com <yc...@gmail.com> #2
Thanks for reporting. We will look into the issue and update the status here.
ze...@google.com <ze...@google.com>
ra...@google.com <ra...@google.com>
ma...@google.com <ma...@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 ?
yc...@gmail.com <yc...@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%.
yc...@gmail.com <yc...@gmail.com> #5
Thanks for the information! We will look into this.
ap...@google.com <ap...@google.com> #7
ma...@google.com <ma...@google.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
na...@google.com <na...@google.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
yc...@gmail.com <yc...@gmail.com> #10
I can still reproduce this in 1.3.0-alpha03. I've pushed a
- run
./gradlew assembleDevBenchmarkRelease
- the
android/app/build/intermediates/merged_startup_profile/devBenchmarkRelease/mergeDevBenchmarkReleaseStartupProfile/
folder is still empty - the
android/app/build/intermediates/merged_art_profile/devBenchmarkRelease/mergeDevBenchmarkReleaseArtProfile/baseline-prof.txt
only has profiles from libraries - the build completes even when the
baseline-prof.txt
andstartup-prof.txt
insrc/main/generated/baselineProfiles
have unparsable contentfoo
andbar
.
ma...@google.com <ma...@google.com> #11
Was looking at the project and I think the issue is here:
beforeVariants {
it.enable = it.name in listOf(
"devDebug",
"demoDebug",
"mockDebug",
"prodRelease",
"devNonMinifiedRelease",
"devBenchmarkRelease",
"prodBenchmarkRelease",
)
}
In this beforeVariants
block, the variant devRelease
is disabled, so the onVariants
callback for that variant won't run. The set up work for devBenchmarkRelease
is done in that callback.
Unfortunately this code is a bit tricky because it's not possible to access a variant from another variant, using the variant api. So the baseline profile plugin processes the base variant and then schedules some work for when the benchmark variant is processed, in order to add the baseline profile src sets.
The (non-optimal) "fix" here would be to re-enable devRelease
.
yc...@gmail.com <yc...@gmail.com> #12
Thanks, enabling devRelease
does work. For now I've worked around this by enabling benchmark related variants only when running benchmarks by checking gradle.startParameter
.
Description
Using the baseline profile gradle plugin, the
startup-prof.txt
is copied intosrc/sourceSet/generated/baselineProfiles
by default.The file is not being picked up by AGP when compiling the release build
STEPS TO REPRODUCE:
android/app/src/main/generated/baselineProfiles/startup-prof.txt
foo
./gradlew assembleProdRelease
startup-prof.txt
toandroid/app/src/main/baselineProfiles
./gradlew assembleProdRelease
ERROR: /path/android/app/build/intermediates/merged_startup_profile/prodRelease/mergeProdReleaseStartupProfile/startup-prof.txt: R8: Unable to parse rule at line 1 from ART profile: foo
Studio Build: Android Studio Koala 2024.1.1 Canary 3
Version of Gradle Plugin: 8.5.0-alpha03
Version of Gradle: 8.7
Version of androidx.baselineprofile: 1.3.0-alpha02
Version of Java: 21
OS: macOS