|
|
|
@ -768,6 +768,8 @@ class Camera1 extends CameraController { |
|
|
|
|
boolean startAutoFocus(@Nullable final Gesture gesture, PointF point) { |
|
|
|
|
if (!isCameraAvailable()) return false; |
|
|
|
|
if (!mOptions.isAutoFocusSupported()) return false; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
final PointF p = new PointF(point.x, point.y); // copy.
|
|
|
|
|
List<Camera.Area> meteringAreas2 = computeMeteringAreas(p.x, p.y); |
|
|
|
|
List<Camera.Area> meteringAreas1 = meteringAreas2.subList(0, 1); |
|
|
|
@ -794,6 +796,15 @@ class Camera1 extends CameraController { |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
catch (Exception e) { |
|
|
|
|
// at least setParameters may fail.
|
|
|
|
|
// TODO why does it fail and is it possible to prevent such errors?
|
|
|
|
|
CameraException cameraException = new CameraConfigurationFailedException("Failed to " + |
|
|
|
|
"start auto focus.", e); |
|
|
|
|
mCameraCallbacks.onError(cameraException); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<Camera.Area> computeMeteringAreas(double viewClickX, double viewClickY) { |
|
|
|
|