|
|
@ -237,11 +237,13 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv |
|
|
|
* it should be set before calling this method, for example by calling |
|
|
|
* it should be set before calling this method, for example by calling |
|
|
|
* {@link #createRepeatingRequestBuilder(int)}. |
|
|
|
* {@link #createRepeatingRequestBuilder(int)}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@EngineThread |
|
|
|
@SuppressWarnings("WeakerAccess") |
|
|
|
@SuppressWarnings("WeakerAccess") |
|
|
|
protected void applyRepeatingRequestBuilder() { |
|
|
|
protected void applyRepeatingRequestBuilder() { |
|
|
|
applyRepeatingRequestBuilder(true, CameraException.REASON_DISCONNECTED); |
|
|
|
applyRepeatingRequestBuilder(true, CameraException.REASON_DISCONNECTED); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EngineThread |
|
|
|
private void applyRepeatingRequestBuilder(boolean checkStarted, int errorReason) { |
|
|
|
private void applyRepeatingRequestBuilder(boolean checkStarted, int errorReason) { |
|
|
|
if ((getState() == CameraState.PREVIEW && !isChangingState()) || !checkStarted) { |
|
|
|
if ((getState() == CameraState.PREVIEW && !isChangingState()) || !checkStarted) { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -1574,15 +1576,19 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv |
|
|
|
return mRepeatingRequestBuilder; |
|
|
|
return mRepeatingRequestBuilder; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EngineThread |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void applyBuilder(@NonNull Action source) { |
|
|
|
public void applyBuilder(@NonNull Action source) { |
|
|
|
// NOTE: Should never be called on a non-engine thread!
|
|
|
|
// NOTE: Should never be called on a non-engine thread!
|
|
|
|
|
|
|
|
// Non-engine threads are not protected by the uncaught exception handler
|
|
|
|
|
|
|
|
// and can make the process crash.
|
|
|
|
applyRepeatingRequestBuilder(); |
|
|
|
applyRepeatingRequestBuilder(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void applyBuilder(@NonNull Action source, @NonNull CaptureRequest.Builder builder) |
|
|
|
public void applyBuilder(@NonNull Action source, @NonNull CaptureRequest.Builder builder) |
|
|
|
throws CameraAccessException { |
|
|
|
throws CameraAccessException { |
|
|
|
|
|
|
|
// Risky - would be better to ensure that thread is the engine one.
|
|
|
|
if (getState() == CameraState.PREVIEW && !isChangingState()) { |
|
|
|
if (getState() == CameraState.PREVIEW && !isChangingState()) { |
|
|
|
mSession.capture(builder.build(), mRepeatingRequestCallback, null); |
|
|
|
mSession.capture(builder.build(), mRepeatingRequestCallback, null); |
|
|
|
} |
|
|
|
} |
|
|
|