CameraView icon indicating copy to clipboard operation
CameraView copied to clipboard

try/catch getCameraInfo() on Camera1Engine.java

Open EzequielAdrianM opened this issue 2 years ago • 3 comments

Please merge, this is a small try/catch that helps to prevent the apps using the library from crashing on devices using the old Camera1 API.

Fix Runtime Exception on devices trying to use Camera1

Fatal Exception: java.lang.RuntimeException: Fail to get camera info at android.hardware.Camera.getCameraInfo(Camera.java:332) at com.otaliastudios.cameraview.engine.Camera1Engine.collectCameraInfo(Camera1Engine.java:144)

EzequielAdrianM avatar Jul 16 '23 15:07 EzequielAdrianM

Wouldn't it be better to just continue the for loop? Maybe the next camera info succeeds.

natario1 avatar Jul 16 '23 15:07 natario1

I just modified the commit so that the loop can continue looking for other Camera info's.

EzequielAdrianM avatar Jan 07 '24 15:01 EzequielAdrianM

Codecov Report

Merging #1244 (84a32b8) into main (6aa2d3a) will decrease coverage by 0.7%. Report is 16 commits behind head on main. The diff coverage is 59.1%.

:exclamation: Current head 84a32b8 differs from pull request most recent head 0470e35. Consider uploading reports for the commit 0470e35 to get more accurate results

Additional details and impacted files
Files Coverage Δ
...a/com/otaliastudios/cameraview/CameraListener.java 85.7% <100.0%> (+1.1%) :arrow_up:
...java/com/otaliastudios/cameraview/CameraUtils.java 69.5% <ø> (ø)
.../otaliastudios/cameraview/engine/CameraEngine.java 90.3% <ø> (ø)
...taliastudios/cameraview/gesture/GestureAction.java 88.0% <100.0%> (+0.5%) :arrow_up:
...studios/cameraview/internal/FpsRangeValidator.java 71.4% <100.0%> (+4.8%) :arrow_up:
.../com/otaliastudios/cameraview/overlay/Overlay.java 100.0% <ø> (ø)
...taliastudios/cameraview/overlay/OverlayLayout.java 89.6% <100.0%> (+0.7%) :arrow_up:
...udios/cameraview/preview/SurfaceCameraPreview.java 90.0% <100.0%> (+0.3%) :arrow_up:
...tudios/cameraview/video/SnapshotVideoRecorder.java 78.7% <100.0%> (-1.1%) :arrow_down:
...tudios/cameraview/video/encoding/MediaEncoder.java 82.3% <100.0%> (+0.6%) :arrow_up:
... and 9 more

... and 15 files with indirect coverage changes

codecov[bot] avatar Jan 07 '24 16:01 codecov[bot]