Merge "[qrcode] Open any available camera if back camera isn't available." into rvc-dev
diff --git a/src/com/android/settings/wifi/qrcode/QrCamera.java b/src/com/android/settings/wifi/qrcode/QrCamera.java
index 8e4b39f..3865eb1 100644
--- a/src/com/android/settings/wifi/qrcode/QrCamera.java
+++ b/src/com/android/settings/wifi/qrcode/QrCamera.java
@@ -299,6 +299,13 @@
break;
}
}
+ if (mCamera == null && numberOfCameras > 0) {
+ Log.i(TAG, "Can't find back camera. Opening a different camera");
+ Camera.getCameraInfo(0, cameraInfo);
+ releaseCamera();
+ mCamera = Camera.open(0);
+ mCameraOrientation = cameraInfo.orientation;
+ }
} catch (RuntimeException e) {
Log.e(TAG, "Fail to open camera: " + e);
mCamera = null;
@@ -308,7 +315,7 @@
try {
if (mCamera == null) {
- throw new IOException("Cannot find available back camera");
+ throw new IOException("Cannot find available camera");
}
mCamera.setPreviewTexture(surface);
setCameraParameter();