|
|
@ -40,14 +40,24 @@ class Camera1 extends CameraController { |
|
|
|
private Runnable mPostFocusResetRunnable = new Runnable() { |
|
|
|
private Runnable mPostFocusResetRunnable = new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
if (!isCameraAvailable()) return; |
|
|
|
try { |
|
|
|
mCamera.cancelAutoFocus(); |
|
|
|
if (!isCameraAvailable()) return; |
|
|
|
synchronized (mLock) { |
|
|
|
mCamera.cancelAutoFocus(); |
|
|
|
Camera.Parameters params = mCamera.getParameters(); |
|
|
|
synchronized (mLock) { |
|
|
|
params.setFocusAreas(null); |
|
|
|
Camera.Parameters params = mCamera.getParameters(); |
|
|
|
params.setMeteringAreas(null); |
|
|
|
params.setFocusAreas(null); |
|
|
|
applyDefaultFocus(params); // Revert to internal focus.
|
|
|
|
params.setMeteringAreas(null); |
|
|
|
mCamera.setParameters(params); |
|
|
|
applyDefaultFocus(params); // Revert to internal focus.
|
|
|
|
|
|
|
|
mCamera.setParameters(params); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception e) { |
|
|
|
|
|
|
|
// at least setParameters may fail.
|
|
|
|
|
|
|
|
// problem may be device-specific to the Samsung Galaxy J5
|
|
|
|
|
|
|
|
// TODO why does it fail occasionally and is it possible to prevent such errors?
|
|
|
|
|
|
|
|
CameraException cameraException = new CameraConfigurationFailedException("Failed to " + |
|
|
|
|
|
|
|
"reset auto focus.", e); |
|
|
|
|
|
|
|
mCameraCallbacks.onError(cameraException); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|