fix some focusing glitches on Android 8

This commit is contained in:
tibbi 2018-06-10 11:47:05 +02:00
parent fc058e2f05
commit 2b6370c77e
1 changed files with 3 additions and 10 deletions

View File

@ -570,7 +570,6 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
super.onCaptureCompleted(session, request, result) super.onCaptureCompleted(session, request, result)
if (request.tag == FOCUS_TAG) { if (request.tag == FOCUS_TAG) {
mPreviewRequestBuilder!!.set(CaptureRequest.CONTROL_AF_TRIGGER, null)
mCaptureSession!!.setRepeatingRequest(mPreviewRequestBuilder!!.build(), mCaptureCallback, mBackgroundHandler) mCaptureSession!!.setRepeatingRequest(mPreviewRequestBuilder!!.build(), mCaptureCallback, mBackgroundHandler)
} }
} }
@ -591,17 +590,11 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
} }
set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO) set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO)
set(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_AUTO)
val trigger = if (mIsRecording) { set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_START)
set(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_VIDEO)
CameraMetadata.CONTROL_AF_TRIGGER_IDLE
} else {
CameraMetadata.CONTROL_AF_TRIGGER_START
}
set(CaptureRequest.CONTROL_AF_TRIGGER, trigger)
setTag(FOCUS_TAG) setTag(FOCUS_TAG)
mCaptureSession!!.capture(build(), captureCallbackHandler, mBackgroundHandler) mCaptureSession!!.capture(build(), captureCallbackHandler, mBackgroundHandler)
set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_IDLE)
} }
} }