summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/AndroidCameraManagerImpl.java10
-rw-r--r--src/com/android/camera/CameraManager.java5
-rw-r--r--src/com/android/camera/PhotoModule.java62
-rw-r--r--src_wrapper/org/codeaurora/snapcam/wrapper/CameraWrapper.java17
4 files changed, 75 insertions, 19 deletions
diff --git a/src/com/android/camera/AndroidCameraManagerImpl.java b/src/com/android/camera/AndroidCameraManagerImpl.java
index b8650e5..27a31c0 100644
--- a/src/com/android/camera/AndroidCameraManagerImpl.java
+++ b/src/com/android/camera/AndroidCameraManagerImpl.java
@@ -103,6 +103,7 @@ class AndroidCameraManagerImpl implements CameraManager {
private static final int SEND_HISTOGRAM_DATA = 602;
//LONGSHOT
private static final int SET_LONGSHOT = 701;
+ private static final int STOP_LONGSHOT = 702;
private static final int SET_AUTO_HDR_MODE = 801;
//HAL1 version code
@@ -416,6 +417,10 @@ class AndroidCameraManagerImpl implements CameraManager {
CameraWrapper.setLongshot(mCamera, (Boolean) msg.obj);
break;
+ case STOP_LONGSHOT:
+ CameraWrapper.stopLongshot(mCamera);
+ break;
+
case SET_AUTO_HDR_MODE:
CameraWrapper.setMetadataCb(mCamera, (CameraMetaDataCallback) msg.obj);
break;
@@ -676,6 +681,11 @@ class AndroidCameraManagerImpl implements CameraManager {
}
@Override
+ public void stopLongshot() {
+ mCameraHandler.sendEmptyMessage(STOP_LONGSHOT);
+ }
+
+ @Override
public void setHistogramMode(CameraDataCallback cb) {
mCameraHandler.obtainMessage(SET_HISTOGRAM_MODE, cb).sendToTarget();
}
diff --git a/src/com/android/camera/CameraManager.java b/src/com/android/camera/CameraManager.java
index b93e718..2aeba7c 100644
--- a/src/com/android/camera/CameraManager.java
+++ b/src/com/android/camera/CameraManager.java
@@ -384,5 +384,10 @@ public interface CameraManager {
* {@code false} to disable it.
*/
public void setLongshot(boolean enable);
+ /**
+ * Stop longshot.
+ *
+ */
+ public void stopLongshot();
}
}
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 9056d87..e41eda4 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
diff --git a/src_wrapper/org/codeaurora/snapcam/wrapper/CameraWrapper.java b/src_wrapper/org/codeaurora/snapcam/wrapper/CameraWrapper.java
index 960ca1f..dd27430 100644
--- a/src_wrapper/org/codeaurora/snapcam/wrapper/CameraWrapper.java
+++ b/src_wrapper/org/codeaurora/snapcam/wrapper/CameraWrapper.java
@@ -118,4 +118,21 @@ public class CameraWrapper extends Wrapper{
}
}
+ private static Method method_stopLongshot = null;
+ public static final void stopLongshot(Camera camera){
+ if ( DEBUG ){
+ Log.e(TAG, "" + Camera.class + " no stopLongshot");
+ return;
+ }
+ try {
+ if (method_stopLongshot == null) {
+ method_stopLongshot =
+ Camera.class.getDeclaredMethod("stopLongshot");
+ }
+ method_stopLongshot.invoke(camera);
+ }catch (Exception exception){
+ exception.printStackTrace();
+ }
+ }
+
}