diff options
author | xianming wang <mingwax@codeaurora.org> | 2018-09-07 10:42:34 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-01-06 21:56:39 -0800 |
commit | c1a696583dac3da1853f582e4fac6a1eca4cfac5 (patch) | |
tree | ad4355fce3e51385378f777248327ef3f2fdbdd4 /src/com/android/camera/CaptureModule.java | |
parent | 31c7c217712785479fa3b7824761cea2cb138284 (diff) | |
download | android_packages_apps_Snap-c1a696583dac3da1853f582e4fac6a1eca4cfac5.tar.gz android_packages_apps_Snap-c1a696583dac3da1853f582e4fac6a1eca4cfac5.tar.bz2 android_packages_apps_Snap-c1a696583dac3da1853f582e4fac6a1eca4cfac5.zip |
SnapdragonCamera: Add abortCaptures for flush
Add abortCaptures for flush.
(1) when exit app.
(2) when switch cameraID.
(3) start recording before closePreview session.
(4) stop recording except enable EIS.
CRs-Fixed: 2349737
Change-Id: I4546fbfefa3ffa4bcec688a6b5c6eea24045f232
Diffstat (limited to 'src/com/android/camera/CaptureModule.java')
-rwxr-xr-x | src/com/android/camera/CaptureModule.java | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 5864a9193..e5a65c564 100755 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -3030,6 +3030,16 @@ public class CaptureModule implements CameraModule, PhotoController, throw new RuntimeException("Time out waiting to lock camera closing"); } Log.d(TAG, "Closing camera: " + mCameraDevice[i].getId()); + + if (isAbortCapturesEnable()) { + mCaptureSession[i].abortCaptures(); + Log.d(TAG, "Closing camera call abortCaptures "); + } + if (isSendRequestAfterFlushEnable()) { + Log.v(TAG, "Closing camera call setRepeatingRequest"); + mCaptureSession[i].setRepeatingRequest(mPreviewRequestBuilder[i].build(), + mCaptureCallback, mCameraHandler); + } mCameraDevice[i].close(); mCameraDevice[i] = null; mCameraOpened[i] = false; @@ -3056,6 +3066,8 @@ public class CaptureModule implements CameraModule, PhotoController, } catch (InterruptedException e) { mCameraOpenCloseLock.release(); throw new RuntimeException("Interrupted while trying to lock camera closing.", e); + } catch (CameraAccessException e) { + e.printStackTrace(); } finally { mCameraOpenCloseLock.release(); } @@ -4607,6 +4619,10 @@ public class CaptureModule implements CameraModule, PhotoController, mUI.clearFocus(); mUI.hideUIwhileRecording(); mCameraHandler.removeMessages(CANCEL_TOUCH_FOCUS, mCameraId[cameraId]); + if (isAbortCapturesEnable()) { + mCaptureSession[cameraId].abortCaptures(); + Log.d(TAG, "startRecordingVideo call abortCaptures befor close preview "); + } mState[cameraId] = STATE_PREVIEW; mControlAFMode = CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE; mIsAutoFocusStarted = false; @@ -5189,6 +5205,36 @@ public class CaptureModule implements CameraModule, PhotoController, resumeVideoRecording(); } + private boolean isEISDisable() { + boolean result = true; + String value = mSettingsManager.getValue(SettingsManager.KEY_EIS_VALUE); + if (value != null) { + result = value.equals(mActivity.getResources().getString( + R.string.pref_camera2_eis_entry_value_disable)); + } else { + result = false; + } + Log.v(TAG, "isEISDisable :" + result); + return result; + } + + private boolean isAbortCapturesEnable() { + boolean result = true; + String value = mSettingsManager.getValue(SettingsManager.KEY_ABORT_CAPTURES); + if (value != null) { + result = value.equals(mActivity.getResources().getString( + R.string.pref_camera2_abort_captures_entry_value_enable)); + } else { + result = false; + } + Log.v(TAG, "isAbortCapturesEnable :" + result); + return result; + } + + private boolean isSendRequestAfterFlushEnable() { + return PersistUtil.isSendRequestAfterFlush(); + } + private void stopRecordingVideo(int cameraId) { Log.d(TAG, "stopRecordingVideo " + cameraId); mStopRecordingTime = System.currentTimeMillis(); @@ -5202,8 +5248,18 @@ public class CaptureModule implements CameraModule, PhotoController, if (mLiveShotInitHeifWriter != null) { mLiveShotInitHeifWriter.close(); } - closePreviewSession(); mIsRecordingVideo = false; + if (isEISDisable() && isAbortCapturesEnable()) { + try { + mCurrentSession.abortCaptures(); + Log.d(TAG, "stopRecordingVideo call abortCaptures "); + } catch (CameraAccessException e) { + e.printStackTrace(); + } + } + if (!mPaused) { + closePreviewSession(); + } try { mMediaRecorder.setOnErrorListener(null); mMediaRecorder.setOnInfoListener(null); @@ -5245,7 +5301,9 @@ public class CaptureModule implements CameraModule, PhotoController, mUI.hideSurfaceView(); mUI.showSurfaceView(); } - createSessions(); + if (!mPaused) { + createSessions(); + } mUI.showUIafterRecording(); mUI.resetTrackingFocus(); mStopRecPending = false; |