When setting LENS_FOCUS_DISTANCE into Camera2CameraControl in an app that using CameraX, it works in major cases, but not on a Samsung S22 Ultra device, in a particular case.
Code that sets LENS_FOCUS_DISTANCE :
Camera2CameraControl.from(camera.cameraControl).captureRequestOptions = CaptureRequestOptions.Builder()
.apply {
setCaptureRequestOption(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_OFF)
setCaptureRequestOption(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CONTROL_AE_MODE_ON)
// Fix focus lens distance to infinity to get focus far away (avoid to get a close focus)
setCaptureRequestOption(CaptureRequest.LENS_FOCUS_DISTANCE, 0.0f)
}
.build()
Test case :
- open Camera app, set mode to "Pro" and define by yourself the focal length
- open custom app with CameraX, go to camera screen. Check if focal length is at 0 > ERROR: focal length is set as it was in Camera app
Maybe One UI's Samsung overlay may interfere?