diff options
author | Chih-Chung Chang <chihchung@google.com> | 2009-05-20 11:14:09 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2009-05-20 11:37:22 +0800 |
commit | acdd1d7d819d17f9690d9bfddb7a9aec9dd2210d (patch) | |
tree | a23abc720fac0deaaa6b5cb7b90f996626aee79c /src/com | |
parent | f0666590162507e8b372b32c55dca3835392196a (diff) | |
download | LegacyCamera-acdd1d7d819d17f9690d9bfddb7a9aec9dd2210d.zip LegacyCamera-acdd1d7d819d17f9690d9bfddb7a9aec9dd2210d.tar.gz LegacyCamera-acdd1d7d819d17f9690d9bfddb7a9aec9dd2210d.tar.bz2 |
Fix 1864421.
Handle the situation that startPreview fails.
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 034836b..1ba9ec0 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -471,7 +471,8 @@ public class VideoCamera extends Activity implements View.OnClickListener, } // Precondition: mSurfaceHolder != null - private void startPreview() { + // Returns true if starting preview succeeds. + private boolean startPreview() { Log.v(TAG, "startPreview"); if (mPreviewing) { // We should just return here, but we stop and start again to avoid @@ -480,7 +481,7 @@ public class VideoCamera extends Activity implements View.OnClickListener, mCameraDevice.stopPreview(); mCameraDevice.startPreview(); mCameraDevice.unlock(); - return; + return true; } if (mCameraDevice == null) { @@ -496,7 +497,7 @@ public class VideoCamera extends Activity implements View.OnClickListener, mCameraDevice.release(); mCameraDevice = null; Log.e(TAG, "failed to set preview display"); - return; + return false; } try { @@ -509,9 +510,10 @@ public class VideoCamera extends Activity implements View.OnClickListener, mCameraDevice.release(); mCameraDevice = null; Log.e(TAG, "failed to start preview"); - return; + return false; } mCameraDevice.unlock(); + return true; } private void closeCamera() { @@ -783,7 +785,9 @@ public class VideoCamera extends Activity implements View.OnClickListener, Log.v(TAG, "SurfaceHolder is null"); return false; } - startPreview(); + + if (!startPreview()) return false; + mMediaRecorder = new MediaRecorder(); mMediaRecorder.setCamera(mCameraDevice); |