diff options
author | mingwax <mingwax@codeaurora.org> | 2017-07-13 15:22:44 +0800 |
---|---|---|
committer | mingwax <mingwax@codeaurora.org> | 2017-07-13 15:28:06 +0800 |
commit | f90319b0d26d9dd1a6e0cf5a6e801adc300eb645 (patch) | |
tree | 9f50359688a2bb6e5ebff7ae8618fe7a82e6eefc /src | |
parent | c549110ab1165ff87ffc75c12910e1ac9ea7aa19 (diff) | |
download | android_packages_apps_Snap-f90319b0d26d9dd1a6e0cf5a6e801adc300eb645.tar.gz android_packages_apps_Snap-f90319b0d26d9dd1a6e0cf5a6e801adc300eb645.tar.bz2 android_packages_apps_Snap-f90319b0d26d9dd1a6e0cf5a6e801adc300eb645.zip |
SnapdragonCamera: Fix FC when mediarecorder start occur error
MediaRecorder.start method should be before the hideUIwhileRecording.
Adjust the logic for starting video.
CRs-Fixed: 2072609
Change-Id: Ie48f8ebc4bfe3385604d4095d8ff02029c26968b
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 35 | ||||
-rw-r--r--[-rwxr-xr-x] | src/com/android/camera/ui/Camera2FaceView.java | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | src/com/android/camera/ui/FaceView.java | 7 |
3 files changed, 19 insertions, 25 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index d61163919..6b9c6869e 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -3116,7 +3116,6 @@ public class CaptureModule implements CameraModule, PhotoController, mStartRecPending = true; mIsRecordingVideo = true; mMediaRecorderPausing = false; - mUI.hideUIwhileRecording(); mActivity.updateStorageSpaceAndHint(); if (mActivity.getStorageSpaceBytes() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) { @@ -3128,6 +3127,17 @@ public class CaptureModule implements CameraModule, PhotoController, try { setUpMediaRecorder(cameraId); + try { + mMediaRecorder.start(); // Recording is now started + } catch (RuntimeException e) { + Toast.makeText(mActivity,"Could not start media recorder.\n " + + "Can't start video recording.", Toast.LENGTH_LONG).show(); + releaseMediaRecorder(); + releaseAudioFocus(); + mStartRecPending = false; + mIsRecordingVideo = false; + return false; + } if (mUnsupportedResolution == true ) { Log.v(TAG, "Unsupported Resolution according to target"); mStartRecPending = false; @@ -3143,6 +3153,7 @@ public class CaptureModule implements CameraModule, PhotoController, requestAudioFocus(); mUI.clearFocus(); + mUI.hideUIwhileRecording(); mCameraHandler.removeMessages(CANCEL_TOUCH_FOCUS, mCameraId[cameraId]); mState[cameraId] = STATE_PREVIEW; mControlAFMode = CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE; @@ -3210,17 +3221,6 @@ public class CaptureModule implements CameraModule, PhotoController, + e.getMessage()); e.printStackTrace(); } - try { - mMediaRecorder.start(); // Recording is now started - } catch (RuntimeException e) { - Toast.makeText(mActivity,"Could not start media recorder.\n " + - "Can't start video recording.", Toast.LENGTH_LONG).show(); - releaseMediaRecorder(); - releaseAudioFocus(); - mStartRecPending = false; - mIsRecordingVideo = false; - return; - } mUI.clearFocus(); mUI.resetPauseButton(); mRecordingTotalTime = 0L; @@ -3255,17 +3255,6 @@ public class CaptureModule implements CameraModule, PhotoController, } catch (IllegalStateException e) { e.printStackTrace(); } - try { - mMediaRecorder.start(); // Recording is now started - } catch (RuntimeException e) { - Toast.makeText(mActivity,"Could not start media recorder.\n " + - "Can't start video recording.", Toast.LENGTH_LONG).show(); - releaseMediaRecorder(); - releaseAudioFocus(); - mStartRecPending = false; - mIsRecordingVideo = false; - return; - } mUI.clearFocus(); mUI.resetPauseButton(); mRecordingTotalTime = 0L; diff --git a/src/com/android/camera/ui/Camera2FaceView.java b/src/com/android/camera/ui/Camera2FaceView.java index 3b6d10541..81be61f81 100755..100644 --- a/src/com/android/camera/ui/Camera2FaceView.java +++ b/src/com/android/camera/ui/Camera2FaceView.java @@ -151,7 +151,9 @@ public class Camera2FaceView extends FaceView { faceBound.offset(-mCameraBound.left, -mCameraBound.top); mRect.set(faceBound); translateMatrix.mapRect(mRect); + if (LOGV) CameraUtil.dumpRect(mRect, "Original rect"); mMatrix.mapRect(mRect); + if (LOGV) CameraUtil.dumpRect(mRect, "Transformed rect"); mPaint.setColor(mColor); mRect.offset(dx, dy); diff --git a/src/com/android/camera/ui/FaceView.java b/src/com/android/camera/ui/FaceView.java index b617891e5..04b3664eb 100755..100644 --- a/src/com/android/camera/ui/FaceView.java +++ b/src/com/android/camera/ui/FaceView.java @@ -33,14 +33,17 @@ import android.view.View; import com.android.camera.PhotoUI; import com.android.camera.util.CameraUtil; +import com.android.camera.util.PersistUtil; import org.codeaurora.snapcam.R; import org.codeaurora.snapcam.wrapper.ExtendedFaceWrapper; public class FaceView extends View implements FocusIndicator, Rotatable, PhotoUI.SurfaceTextureSizeChangedListener { - protected static final String TAG = "CAM FaceView"; - protected final boolean LOGV = false; + protected static final String TAG = "CAM_FaceView"; + protected final boolean LOGV = + (PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_LOG) || + (PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_ALL); // The value for android.hardware.Camera.setDisplayOrientation. protected int mDisplayOrientation; // The orientation compensation for the face indicator to make it look |