summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/AndroidCameraManagerImpl.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/com/android/camera/AndroidCameraManagerImpl.java b/src/com/android/camera/AndroidCameraManagerImpl.java
index 9a7b7347e..97ec6af18 100644
--- a/src/com/android/camera/AndroidCameraManagerImpl.java
+++ b/src/com/android/camera/AndroidCameraManagerImpl.java
@@ -211,25 +211,26 @@ class AndroidCameraManagerImpl implements CameraManager {
switch (msg.what) {
case OPEN_CAMERA:
int cameraId = msg.arg1;
- try {
- Context context = CameraApp.getContext();
-
- boolean backCameraOpenLegacy = context.getResources().getBoolean(R.bool.back_camera_open_legacy);
- boolean frontCameraOpenLegacy = context.getResources().getBoolean(R.bool.front_camera_open_legacy);
+ Context context = CameraApp.getContext();
- CameraInfo info = CameraHolder.instance().getCameraInfo()[cameraId];
+ boolean backCameraOpenLegacy = context.getResources().
+ getBoolean(R.bool.back_camera_open_legacy);
+ boolean frontCameraOpenLegacy = context.getResources().
+ getBoolean(R.bool.front_camera_open_legacy);
- if ((info.facing == CameraInfo.CAMERA_FACING_BACK && backCameraOpenLegacy) ||
- (info.facing == CameraInfo.CAMERA_FACING_FRONT && frontCameraOpenLegacy)) {
+ CameraInfo info = CameraHolder.instance().getCameraInfo()[cameraId];
+ if (info.facing == CameraInfo.CAMERA_FACING_BACK && backCameraOpenLegacy ||
+ info.facing == CameraInfo.CAMERA_FACING_FRONT && frontCameraOpenLegacy) {
+ try {
mCamera = android.hardware.Camera.openLegacy(cameraId,
android.hardware.Camera.CAMERA_HAL_API_VERSION_1_0);
- } else {
+ } catch (RuntimeException e) {
+ /* Retry with open if openLegacy fails */
+ Log.v(TAG, "openLegacy failed. Using open instead");
mCamera = android.hardware.Camera.open(cameraId);
}
- } catch (RuntimeException e) {
- /* Retry with open if openLegacy fails */
- Log.v(TAG, "openLegacy failed. Using open instead");
- mCamera = android.hardware.Camera.open(cameraId);
+ } else {
+ mCamera = android.hardware.Camera.open(cameraId);
}
if (mCamera != null) {
mParametersIsDirty = true;