Caught RuntimeException for Camera.startPreview() and put up an error message. We were getting 135 reports a week about this.

git-svn-id: https://zxing.googlecode.com/svn/trunk@1788 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin@google.com 2011-05-20 15:19:44 +00:00
parent 2d7ef9faf4
commit f957304831

View file

@ -604,19 +604,18 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
private void initCamera(SurfaceHolder surfaceHolder) {
try {
CameraManager.get().openDriver(surfaceHolder);
// Creating the handler starts the preview, which can also throw a RuntimeException.
if (handler == null) {
handler = new CaptureActivityHandler(this, decodeFormats, characterSet);
}
} catch (IOException ioe) {
Log.w(TAG, ioe);
displayFrameworkBugMessageAndExit();
return;
} catch (RuntimeException e) {
// Barcode Scanner has seen crashes in the wild of this variety:
// java.?lang.?RuntimeException: Fail to connect to camera service
Log.w(TAG, "Unexpected error initializating camera", e);
displayFrameworkBugMessageAndExit();
return;
}
if (handler == null) {
handler = new CaptureActivityHandler(this, decodeFormats, characterSet);
}
}