diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/engine/CameraEngine.java b/cameraview/src/main/java/com/otaliastudios/cameraview/engine/CameraEngine.java index 0614789d..3569264d 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/engine/CameraEngine.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/engine/CameraEngine.java @@ -3,8 +3,6 @@ package com.otaliastudios.cameraview.engine; import android.content.Context; import android.graphics.PointF; import android.location.Location; - - import android.os.Handler; import android.os.Looper; @@ -17,43 +15,43 @@ import com.otaliastudios.cameraview.CameraException; import com.otaliastudios.cameraview.CameraLogger; import com.otaliastudios.cameraview.CameraOptions; import com.otaliastudios.cameraview.PictureResult; +import com.otaliastudios.cameraview.VideoResult; +import com.otaliastudios.cameraview.controls.Audio; import com.otaliastudios.cameraview.controls.AudioCodec; +import com.otaliastudios.cameraview.controls.Facing; +import com.otaliastudios.cameraview.controls.Flash; +import com.otaliastudios.cameraview.controls.Hdr; +import com.otaliastudios.cameraview.controls.Mode; import com.otaliastudios.cameraview.controls.PictureFormat; +import com.otaliastudios.cameraview.controls.VideoCodec; +import com.otaliastudios.cameraview.controls.WhiteBalance; +import com.otaliastudios.cameraview.engine.offset.Angles; +import com.otaliastudios.cameraview.engine.offset.Reference; import com.otaliastudios.cameraview.engine.orchestrator.CameraOrchestrator; import com.otaliastudios.cameraview.engine.orchestrator.CameraState; import com.otaliastudios.cameraview.engine.orchestrator.CameraStateOrchestrator; -import com.otaliastudios.cameraview.metering.MeteringRegions; -import com.otaliastudios.cameraview.overlay.Overlay; -import com.otaliastudios.cameraview.VideoResult; -import com.otaliastudios.cameraview.engine.offset.Angles; -import com.otaliastudios.cameraview.engine.offset.Reference; import com.otaliastudios.cameraview.frame.Frame; import com.otaliastudios.cameraview.frame.FrameManager; +import com.otaliastudios.cameraview.gesture.Gesture; import com.otaliastudios.cameraview.internal.WorkerHandler; +import com.otaliastudios.cameraview.metering.MeteringRegions; +import com.otaliastudios.cameraview.overlay.Overlay; import com.otaliastudios.cameraview.picture.PictureRecorder; import com.otaliastudios.cameraview.preview.CameraPreview; -import com.otaliastudios.cameraview.controls.Audio; -import com.otaliastudios.cameraview.controls.Facing; -import com.otaliastudios.cameraview.controls.Flash; -import com.otaliastudios.cameraview.gesture.Gesture; -import com.otaliastudios.cameraview.controls.Hdr; -import com.otaliastudios.cameraview.controls.Mode; -import com.otaliastudios.cameraview.controls.VideoCodec; -import com.otaliastudios.cameraview.controls.WhiteBalance; import com.otaliastudios.cameraview.size.Size; import com.otaliastudios.cameraview.size.SizeSelector; import com.otaliastudios.cameraview.video.VideoRecorder; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; - import java.io.File; import java.io.FileDescriptor; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; + /** * PROCESS @@ -234,11 +232,7 @@ public abstract class CameraEngine implements LOG.e("EXCEPTION:", "Unexpected error! Executing destroy(true)."); destroy(true); LOG.e("EXCEPTION:", "Unexpected error! Throwing."); - if (throwable instanceof RuntimeException) { - throw (RuntimeException) throwable; - } else { - throw new RuntimeException(throwable); - } + mCallback.dispatchError(new CameraException(throwable)); } } });