fix: Check if session is still valid before resetting AF after focus (#2550)

* fix: Check if session is still valid before resetting AF after focus

* Update PersistentCameraCaptureSession.kt
This commit is contained in:
Marc Rousavy 2024-02-13 15:15:19 +01:00 committed by GitHub
parent a2a2e94865
commit b7e24c444e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -238,6 +238,10 @@ class PersistentCameraCaptureSession(private val cameraManager: CameraManager, p
// this job got canceled from the outside // this job got canceled from the outside
return@launch return@launch
} }
if (!isRunning || this@PersistentCameraCaptureSession.session != session) {
// the view/session has already been destroyed in the meantime
return@launch
}
Log.i(TAG, "Resetting focus to auto-focus...") Log.i(TAG, "Resetting focus to auto-focus...")
// 6. Reset AF/AE/AWB to continuous auto-focus again, which is the default here. // 6. Reset AF/AE/AWB to continuous auto-focus again, which is the default here.
repeatingRequest.createCaptureRequest(device, deviceDetails, outputs).also { request -> repeatingRequest.createCaptureRequest(device, deviceDetails, outputs).also { request ->