summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CaptureModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/CaptureModule.java')
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java45
1 files changed, 38 insertions, 7 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 7dd2e59ff..d43f22117 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -655,7 +655,10 @@ public class CaptureModule implements CameraModule, PhotoController,
Log.e(TAG, "onError " + id + " " + error);
mCameraOpenCloseLock.release();
mCamerasOpened = false;
+
if (null != mActivity) {
+ Toast.makeText(mActivity,"open camera error id =" + id,
+ Toast.LENGTH_LONG).show();
mActivity.finish();
}
}
@@ -815,6 +818,8 @@ public class CaptureModule implements CameraModule, PhotoController,
}
public boolean isBackCamera() {
+ String switchValue = mSettingsManager.getValue(SettingsManager.KEY_SWITCH_CAMERA);
+ if (switchValue != null && !switchValue.equals("-1") ) return false;
String value = mSettingsManager.getValue(SettingsManager.KEY_CAMERA_ID);
if (value == null) return true;
if (Integer.parseInt(value) == BAYER_ID) return true;
@@ -973,7 +978,10 @@ public class CaptureModule implements CameraModule, PhotoController,
break;
}
} else {
- createSession(FRONT_ID);
+ int switchId = Integer.parseInt(
+ mSettingsManager.getValue(SettingsManager.KEY_SWITCH_CAMERA));
+ int cameraId = switchId == -1? FRONT_ID : switchId;
+ createSession(cameraId);
}
}
@@ -1051,7 +1059,8 @@ public class CaptureModule implements CameraModule, PhotoController,
// Finally, we start displaying the camera preview.
// for cases where we are in dual mode with mono preview off,
// don't set repeating request for mono
- if(id == MONO_ID && !canStartMonoPreview()) {
+ if(id == MONO_ID && !canStartMonoPreview()
+ && getCameraMode() == DUAL_MODE) {
mCaptureSession[id].capture(mPreviewRequestBuilder[id]
.build(), mCaptureCallback, mCameraHandler);
} else {
@@ -1331,10 +1340,13 @@ public class CaptureModule implements CameraModule, PhotoController,
break;
}
} else {
- if (takeZSLPicture(FRONT_ID)) {
+ int switchId = Integer.parseInt(
+ mSettingsManager.getValue(SettingsManager.KEY_SWITCH_CAMERA));
+ int cameraId = switchId == -1? FRONT_ID : switchId;
+ if(takeZSLPicture(cameraId)) {
return;
}
- lockFocus(FRONT_ID);
+ lockFocus(cameraId);
}
}
}
@@ -2459,7 +2471,10 @@ public class CaptureModule implements CameraModule, PhotoController,
break;
}
} else {
- msg.arg1 = FRONT_ID;
+ int switchId = Integer.parseInt(
+ mSettingsManager.getValue(SettingsManager.KEY_SWITCH_CAMERA));
+ int cameraId = switchId == -1? FRONT_ID : switchId;
+ msg.arg1 = cameraId;
mCameraHandler.sendMessage(msg);
}
mUI.showSurfaceView();
@@ -2800,7 +2815,10 @@ public class CaptureModule implements CameraModule, PhotoController,
}
return 0;
} else {
- return FRONT_ID;
+ int switchId = Integer.parseInt(
+ mSettingsManager.getValue(SettingsManager.KEY_SWITCH_CAMERA));
+ int cameraId = switchId == -1? FRONT_ID : switchId;
+ return cameraId;
}
}
@@ -3083,6 +3101,7 @@ public class CaptureModule implements CameraModule, PhotoController,
private void updateVideoSize() {
String videoSize = mSettingsManager.getValue(SettingsManager.KEY_VIDEO_QUALITY);
+ if (videoSize == null) return;
mVideoSize = parsePictureSize(videoSize);
Size[] prevSizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(),
MediaRecorder.class);
@@ -3642,7 +3661,18 @@ public class CaptureModule implements CameraModule, PhotoController,
updateHFRSetting();
boolean hfr = mHighSpeedCapture && !mHighSpeedRecordingMode;
- mProfile = CamcorderProfile.get(cameraId, size);
+ if (CamcorderProfile.hasProfile(cameraId, size)) {
+ mProfile = CamcorderProfile.get(cameraId, size);
+ } else {
+ if (!"-1".equals(mSettingsManager.getValue(SettingsManager.KEY_SWITCH_CAMERA))) {
+ mProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
+ } else {
+ RotateTextToast.makeText(mActivity, R.string.error_app_unsupported_profile,
+ Toast.LENGTH_LONG).show();
+ return;
+ }
+ }
+
int videoWidth = mProfile.videoFrameWidth;
int videoHeight = mProfile.videoFrameHeight;
mUnsupportedResolution = false;
@@ -4587,6 +4617,7 @@ public class CaptureModule implements CameraModule, PhotoController,
case SettingsManager.KEY_CAMERA_ID:
case SettingsManager.KEY_MONO_ONLY:
case SettingsManager.KEY_CLEARSIGHT:
+ case SettingsManager.KEY_SWITCH_CAMERA:
case SettingsManager.KEY_MONO_PREVIEW:
if (count == 0) restartAll();
return;