-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch setDisplayOrientation() RuntimeException #126
Catch setDisplayOrientation() RuntimeException #126
Conversation
608bb75
to
e016142
Compare
Catch setDisplayOrientation() RuntimeException in UpdateOrientationRoutine and pass it to the CameraErrorCallback.
e016142
to
65c67ca
Compare
try { | ||
cameraDevice.setDisplayOrientation(degrees); | ||
} catch (RuntimeException e) { | ||
cameraErrorCallback.onError(new CameraException(e)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a problem with that - at the moment onError
basically means "everything is super bad, camera is dead". However, it is very likely not the case here, since orientation events are constantly coming in.
I would instead do it like it is done in Camera1#autoFocus
where we just log the failure in logFailedAutoFocus
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I'll make that change.
verify(cameraDevice).setDisplayOrientation(90); | ||
ArgumentCaptor<CameraException> argumentCaptor = ArgumentCaptor.forClass(CameraException.class); | ||
verify(cameraErrorCallback).onError(argumentCaptor.capture()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small thing - ArgumentCaptor
is not really needed here. You can just do:
verify(cameraErrorCallback).onError(exception);
0aff624
to
ba69cce
Compare
Thanks for fixing the issue! This will into the next release. |
Catch setDisplayOrientation() RuntimeException in UpdateOrientationRoutine.
This fixes issue #105.