Catch possible RuntimeException from getCameraCharacteristics
Also changed the logging of exceptions to give more details Bug: webrtc:10804 Change-Id: Ifba6dee3d1c8ba4ecab408ca7715c3b792d9c004 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222641 Commit-Queue: Xavier Lepaul <xalep@webrtc.org> Reviewed-by: Paulina Hensman <phensman@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34325}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
11b92cfa65
commit
afb28116d3
@ -55,7 +55,7 @@ public class Camera2Enumerator implements CameraEnumerator {
|
||||
// catch statement with an Exception from a newer API, even if the code is never executed.
|
||||
// https://code.google.com/p/android/issues/detail?id=209129
|
||||
} catch (/* CameraAccessException */ AndroidException e) {
|
||||
Logging.e(TAG, "Camera access exception: " + e);
|
||||
Logging.e(TAG, "Camera access exception", e);
|
||||
return new String[] {};
|
||||
}
|
||||
}
|
||||
@ -97,7 +97,7 @@ public class Camera2Enumerator implements CameraEnumerator {
|
||||
// catch statement with an Exception from a newer API, even if the code is never executed.
|
||||
// https://code.google.com/p/android/issues/detail?id=209129
|
||||
} catch (/* CameraAccessException */ AndroidException e) {
|
||||
Logging.e(TAG, "Camera access exception: " + e);
|
||||
Logging.e(TAG, "Camera access exception", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -123,8 +123,8 @@ public class Camera2Enumerator implements CameraEnumerator {
|
||||
// On Android OS pre 4.4.2, a class will not load because of VerifyError if it contains a
|
||||
// catch statement with an Exception from a newer API, even if the code is never executed.
|
||||
// https://code.google.com/p/android/issues/detail?id=209129
|
||||
} catch (/* CameraAccessException */ AndroidException e) {
|
||||
Logging.e(TAG, "Camera access exception: " + e);
|
||||
} catch (/* CameraAccessException */ AndroidException | RuntimeException e) {
|
||||
Logging.e(TAG, "Failed to check if camera2 is supported", e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -186,7 +186,7 @@ public class Camera2Enumerator implements CameraEnumerator {
|
||||
try {
|
||||
cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraId);
|
||||
} catch (Exception ex) {
|
||||
Logging.e(TAG, "getCameraCharacteristics(): " + ex);
|
||||
Logging.e(TAG, "getCameraCharacteristics()", ex);
|
||||
return new ArrayList<CaptureFormat>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user