summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2009-05-20 11:14:09 +0800
committerChih-Chung Chang <chihchung@google.com>2009-05-20 11:37:22 +0800
commitacdd1d7d819d17f9690d9bfddb7a9aec9dd2210d (patch)
treea23abc720fac0deaaa6b5cb7b90f996626aee79c /src/com
parentf0666590162507e8b372b32c55dca3835392196a (diff)
downloadLegacyCamera-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.java14
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);