List of usage examples for android.hardware.camera2 CaptureResult LENS_FOCUS_DISTANCE
Key LENS_FOCUS_DISTANCE
To view the source code for android.hardware.camera2 CaptureResult LENS_FOCUS_DISTANCE.
Click Source Link
Desired distance to plane of sharpest focus, measured from frontmost surface of the lens.
Should be zero for fixed-focus cameras
Units: See CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration for details
Range of valid values:
>= 0
Optional - This value may be null on some devices.
Full capability - Present on all camera devices that report being CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL devices in the CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel key
From source file:com.android.camera.one.v2.OneCameraZslImpl.java
@Override public void setFocusDistanceListener(FocusDistanceListener focusDistanceListener) { if (mFocusDistanceListener == null) { mCaptureManager.addMetadataChangeListener(CaptureResult.LENS_FOCUS_DISTANCE, new ImageCaptureManager.MetadataChangeListener() { @Override/*from ww w.j a va2 s. co m*/ public void onImageMetadataChange(Key<?> key, Object oldValue, Object newValue, CaptureResult result) { Integer state = result.get(CaptureResult.LENS_STATE); // Forward changes if we have a new value and the camera // A) Doesn't support lens state or B) lens state is // reported and it is reported as moving. if (newValue != null && (state == null || state == CameraMetadata.LENS_STATE_MOVING)) { mFocusDistanceListener.onFocusDistance((float) newValue, mLensRange); } } }); } mFocusDistanceListener = focusDistanceListener; }