Catch strange RuntimeExceptino from inside autoFocus() in Android 4.0.x+

git-svn-id: https://zxing.googlecode.com/svn/trunk@2107 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-01-11 14:30:55 +00:00
parent 5cc9295451
commit ccf169425f

View file

@ -165,7 +165,12 @@ public final class CameraManager {
public void requestAutoFocus(Handler handler, int message) {
if (camera != null && previewing) {
autoFocusCallback.setHandler(handler, message);
camera.autoFocus(autoFocusCallback);
try {
camera.autoFocus(autoFocusCallback);
} catch (RuntimeException re) {
// Have heard RuntimeException reported in Android 4.0.x+; continue?
Log.w(TAG, "Unexpected exception while focusing", re);
}
}
}