Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Attachment actions
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.