Fixed
Status Update
Comments
ma...@google.com <ma...@google.com> #2
A couple of questions:
1. Have you saw crash in real device or only in simulators?
2. Do you use dynamic feature for language ID?
1. Have you saw crash in real device or only in simulators?
2. Do you use dynamic feature for language ID?
le...@google.com <le...@google.com>
ap...@google.com <ap...@google.com> #3
Tested on Android 12 Emulator with custom executor, but cannot repro this issue.
Description
CAMERAX VERSION: 1.0.0-beta06 CameraView Version: 1.0.0-alpha13
ANDROID OS BUILD NUMBER: QQ3A.200605.001
DEVICE NAME: Pixel 4
DESCRIPTION:
mCameraControlInternal.setActive(true);
is called immediately upon receiving a request to attach use cases.On the other hand
mCameraControlInternal.setActive(false);
is called only once all use cases have been detached.This causes a race condition if the
CameraRepository
is set from Inactive to Active very quickly. The result of this race condition is that controls on the camera are disabled, but the camera use cases are successfully attached (ie. zoom functionality does not work).STEPS TO REPRODUCE:
I am able to reproduce this by using a custom lifecycle observer that registers the
ON_STOP
lifecycle event when media is captured and the preview is shown. Then I register theON_START
event when the media is dismissed.This is so that we do not continue to run the camera while the view finder is covered by our media preview.
OBSERVED RESULTS:
If a user captures media then dismisses it quickly enough, the race condition observed above can occur. This results in a state where the camera is functioning properly but controls are disabled.
REPRODUCIBILITY: 5 of 5
I have attached a screen shot where you can see that
tryDetachUseCases (773)
is called afterattachUseCases (648)
. The line numbers are slightly different from the Android source I link above but this is the effect I am describing,Camera2CameraControl.setActive(false)
is called afterCamera2CameraControl.setActive(true)
incorrectly.