Skip to content

Commit

Permalink
Fix barcode scanner preview orientation on Nexus 5x
Browse files Browse the repository at this point in the history
The code that is supposed to deal with sensor orientation has a bug. The findCamera() method
never calls Camera#getCameraInfo() method for the first camera (index 0). As a result, mCameraInfo
may never be set to reflect the properties of the camera identified with mCameraId (may instead
contain info of the other camera).
  • Loading branch information
jharting committed Dec 8, 2015
1 parent 8fdaf72 commit 38ee329
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static int findCamera(CameraInfo cameraInfo) {
int cameraId = Camera.getNumberOfCameras() - 1;

// Find a back-facing camera, otherwise use the first camera.
for (; cameraId > 0; cameraId--) {
for (; cameraId >= 0; cameraId--) {
Camera.getCameraInfo(cameraId, cameraInfo);
if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK)
break;
Expand Down

0 comments on commit 38ee329

Please sign in to comment.