summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/PhotoModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/PhotoModule.java')
-rwxr-xr-xsrc/com/android/camera/PhotoModule.java63
1 files changed, 43 insertions, 20 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 3ebc460b8..e46c323da 100755
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -128,6 +128,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;
public boolean mHistogramEnabled = false;
@@ -215,6 +216,8 @@ public class PhotoModule
private static final String PERSIST_CAPTURE_ANIMATION = "persist.camera.capture.animate";
private static final boolean PERSIST_SKIP_MEM_CHECK =
android.os.SystemProperties.getBoolean("persist.camera.perf.skip_memck", 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";
@@ -1065,8 +1068,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;
}
@@ -1276,7 +1288,9 @@ public class PhotoModule
@Override
public void onPictureTaken(byte [] jpegData, CameraProxy camera) {
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.
@@ -1339,12 +1353,17 @@ public class PhotoModule
Log.v(TAG, "mPictureDisplayedToJpegCallbackTime = "
+ mPictureDisplayedToJpegCallbackTime + "ms");
+ if (isLongshotDone()) {
+ mCameraDevice.setLongshot(false);
+ }
+
boolean needRestartPreview = !mIsImageCaptureIntent
&& !mPreviewRestartSupport
&& (mCameraState != LONGSHOT)
&& (mSnapshotMode != CameraInfo.CAMERA_SUPPORT_MODE_ZSL)
- && (mReceivedSnapNum == mBurstSnapNum);
+ && ((mReceivedSnapNum == mBurstSnapNum) && (mCameraState != LONGSHOT));
+ needRestartPreview |= (isLongshotDone() && !mFocusManager.isZslEnabled());
needRestartPreview |= mLgeHdrMode && (mCameraState != LONGSHOT);
boolean backCameraRestartPreviewOnPictureTaken = false;
@@ -1371,8 +1390,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))) {
@@ -1474,7 +1493,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
@@ -1521,6 +1541,10 @@ public class PhotoModule
mJpegPictureCallbackTime = 0;
}
+ if (isLongshotDone()) {
+ mLongshotSnapNum = 0;
+ }
+
if (mHistogramEnabled &&
(mSnapshotMode == CameraInfo.CAMERA_SUPPORT_MODE_ZSL)) {
mActivity.runOnUiThread(new Runnable() {
@@ -1672,6 +1696,7 @@ public class PhotoModule
}
if (mCameraState == LONGSHOT) {
+ mLongshotSnapNum = 0;
mCameraDevice.setLongshot(true);
}
@@ -2295,20 +2320,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);
}
}
@@ -2545,7 +2557,7 @@ public class PhotoModule
private void updateRemainingPhotos() {
if (mJpegFileSizeEstimation != 0) {
- mRemainingPhotos = (int)
+ mRemainingPhotos = (int)
((mActivity.getStorageSpaceBytes() - Storage.LOW_STORAGE_THRESHOLD_BYTES)
/ mJpegFileSizeEstimation);
} else {
@@ -3006,6 +3018,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();
}
@@ -3693,6 +3709,9 @@ public class PhotoModule
!mFocusManager.isFocusCompleted()) {
mUI.getFocusRing().stopFocusAnimations();
}
+
+ mLongShotMaxSnap = SystemProperties.getInt(PERSIST_LONGSHOT_MAX_SNAP, -1);
+ mParameters.set("max-longshot-snap",mLongShotMaxSnap);
}
private int estimateJpegFileSize(final Size size, final String quality) {
@@ -5044,6 +5063,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