summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/PhotoModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/PhotoModule.java')
-rw-r--r--src/com/android/camera/PhotoModule.java62
1 files changed, 43 insertions, 19 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 9056d8795..e41eda475 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -140,6 +140,7 @@ public class PhotoModule
private int mSnapshotMode;
private int mBurstSnapNum = 1;
private int mReceivedSnapNum = 0;
+ private int mLongshotSnapNum = 0;
public boolean mFaceDetectionEnabled = false;
private boolean mLgeHdrMode = false;
private DrawAutoHDR mDrawAutoHDR;
@@ -241,6 +242,9 @@ public class PhotoModule
private static final String PERSISI_BOKEH_DEBUG = "persist.camera.bokeh.debug";
private static final boolean PERSIST_BOKEH_DEBUG_CHECK =
android.os.SystemProperties.getBoolean(PERSISI_BOKEH_DEBUG, false);
+ private static final String PERSIST_LONGSHOT_MAX_SNAP = "persist.camera.longshot.max";
+ private static int mLongShotMaxSnap = -1;
+
// Constant from android.hardware.Camera.Parameters
private static final String KEY_PICTURE_FORMAT = "picture-format";
private static final String KEY_QC_RAW_PICUTRE_SIZE = "raw-size";
@@ -1104,8 +1108,17 @@ public class PhotoModule
Log.e(TAG, "[KPI Perf] PROFILE_SHUTTER_LAG mShutterLag = " + mShutterLag + "ms");
synchronized(mCameraDevice) {
+ if (++mLongshotSnapNum >= mLongShotMaxSnap &&
+ (mLongShotMaxSnap != -1)) {
+ mLongshotActive = false;
+ mUI.enableShutter(false);
+ mCameraDevice.stopLongshot();
+ return;
+ }
+
if (mCameraState != LONGSHOT ||
!mLongshotActive) {
+ mCameraDevice.stopLongshot();
return;
}
@@ -1416,7 +1429,9 @@ public class PhotoModule
}
}
mUI.stopSelfieFlash();
- mUI.enableShutter(true);
+ if (mCameraState != LONGSHOT) {
+ mUI.enableShutter(true);
+ }
if (mUI.isPreviewCoverVisible()) {
// When take picture request is sent before starting preview, onPreviewFrame()
// callback doesn't happen so removing preview cover here, instead.
@@ -1479,14 +1494,19 @@ public class PhotoModule
Log.v(TAG, "mPictureDisplayedToJpegCallbackTime = "
+ mPictureDisplayedToJpegCallbackTime + "ms");
+ if (isLongshotDone()) {
+ mCameraDevice.setLongshot(false);
+ }
+
mFocusManager.updateFocusUI(); // Ensure focus indicator is hidden.
boolean needRestartPreview = !mIsImageCaptureIntent
&& !mPreviewRestartSupport
&& (mCameraState != LONGSHOT)
&& (mSnapshotMode != CameraInfoWrapper.CAMERA_SUPPORT_MODE_ZSL)
- && (mReceivedSnapNum == mBurstSnapNum);
+ && ((mReceivedSnapNum == mBurstSnapNum) && (mCameraState != LONGSHOT));
+ needRestartPreview |= (isLongshotDone() && !mFocusManager.isZslEnabled());
needRestartPreview |= mLgeHdrMode && (mCameraState != LONGSHOT);
boolean backCameraRestartPreviewOnPictureTaken = false;
@@ -1518,8 +1538,8 @@ public class PhotoModule
|| CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false))) {
mCameraDevice.cancelAutoFocus();
}
- } else if ((mReceivedSnapNum == mBurstSnapNum)
- && (mCameraState != LONGSHOT)){
+ } else if (((mCameraState != LONGSHOT) && (mReceivedSnapNum == mBurstSnapNum))
+ || isLongshotDone()){
mFocusManager.restartTouchFocusTimer();
if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false))
|| CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode(false))) {
@@ -1650,7 +1670,8 @@ public class PhotoModule
}
}
// Animate capture with real jpeg data instead of a preview frame.
- if (mCameraState != LONGSHOT) {
+ if ((mCameraState != LONGSHOT) ||
+ isLongshotDone()) {
Size pic_size = mParameters.getPictureSize();
if ((pic_size.width <= 352) && (pic_size.height<= 288)) {
mUI.setDownFactor(2); //Downsample by 2 for CIF & below
@@ -1697,6 +1718,10 @@ public class PhotoModule
mJpegPictureCallbackTime = 0;
}
+ if (isLongshotDone()) {
+ mLongshotSnapNum = 0;
+ }
+
if (mHiston && (mSnapshotMode ==CameraInfoWrapper.CAMERA_SUPPORT_MODE_ZSL)) {
mActivity.runOnUiThread(new Runnable() {
public void run() {
@@ -1865,6 +1890,7 @@ public class PhotoModule
}
if (mCameraState == LONGSHOT) {
+ mLongshotSnapNum = 0;
mCameraDevice.setLongshot(true);
}
@@ -2532,20 +2558,7 @@ public class PhotoModule
synchronized(mCameraDevice) {
if (mCameraState == LONGSHOT) {
mLongshotActive = false;
- mCameraDevice.setLongshot(false);
- mUI.animateCapture(mLastJpegData);
- mLastJpegData = null;
- if (!mFocusManager.isZslEnabled()) {
- setupPreview();
- } else {
- setCameraState(IDLE);
- mFocusManager.resetTouchFocus();
- if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(
- mFocusManager.getFocusMode(false))) {
- mCameraDevice.cancelAutoFocus();
- }
- mUI.resumeFaceDetection();
- }
+ mUI.enableShutter(false);
}
}
@@ -3252,6 +3265,10 @@ public class PhotoModule
@Override
public void stopPreview() {
if (mCameraDevice != null && mCameraState != PREVIEW_STOPPED) {
+ if (mCameraState == LONGSHOT) {
+ mCameraDevice.setLongshot(false);
+ mLongshotActive = false;
+ }
Log.v(TAG, "stopPreview");
mCameraDevice.stopPreview();
}
@@ -3973,6 +3990,9 @@ public class PhotoModule
mParameters.set(CameraSettings.KEY_QC_BOKEH_BLUR_VALUE, bokehBlurDegree);
Log.v(TAG, "Bokeh Mode = " + bokehMode + " bokehMpo = " + bokehMpo +
" bokehBlurDegree = " + bokehBlurDegree);
+
+ mLongShotMaxSnap = SystemProperties.getInt(PERSIST_LONGSHOT_MAX_SNAP, -1);
+ mParameters.set("max-longshot-snap",mLongShotMaxSnap);
}
private int estimateJpegFileSize(final Size size, final String quality) {
@@ -5406,6 +5426,10 @@ public class PhotoModule
enableRecordingLocation(false);
}
+ public boolean isLongshotDone() {
+ return ((mCameraState == LONGSHOT) && (mLongshotSnapNum == mReceivedSnapNum) &&
+ !mLongshotActive);
+ }
}
/* Below is no longer needed, except to get rid of compile error