fix(android): Update Camera1 to not crash on invalid ratio (#2501)

Setting a property ends up with an unhandled exception that cannot be caught easily by RN. This should also make the behaviour consistent with camera startup and Camera2.
This commit is contained in:
cristianoccazinsp 2019-09-24 09:32:47 -03:00 committed by Sibelius Seraphini
parent 38a5ffb2eb
commit 702f60862e

View File

@ -336,7 +336,7 @@ class Camera1 extends CameraViewImpl implements MediaRecorder.OnInfoListener,
} else if (!mAspectRatio.equals(ratio)) {
final Set<Size> sizes = mPreviewSizes.sizes(ratio);
if (sizes == null) {
throw new UnsupportedOperationException(ratio + " is not supported");
// do nothing, ratio remains unchanged. Consistent with Camera2 and initial mount behaviour
} else {
mAspectRatio = ratio;
adjustCameraParameters();