diff options
author | Owen Lin <owenlin@google.com> | 2009-09-14 18:48:12 +0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2009-09-17 16:39:10 +0800 |
commit | f6ef7b960f610d557f0bab924b9f7928b46f6f0a (patch) | |
tree | 6910abb7bbe1aa7948e44fc1e1cbc0c64ba9469d /src/com/android/camera/VideoCamera.java | |
parent | ce25062c826c35bd9f950a62cac4b8c838e9e6a6 (diff) | |
download | LegacyCamera-f6ef7b960f610d557f0bab924b9f7928b46f6f0a.zip LegacyCamera-f6ef7b960f610d557f0bab924b9f7928b46f6f0a.tar.gz LegacyCamera-f6ef7b960f610d557f0bab924b9f7928b46f6f0a.tar.bz2 |
Fix NPE in resizeForPreviewAspectRadio().
In user mode, if start preview fail, don't try to
set resizeForPreviewAspectRadio(). Also make changes in VideoCamera to prevent
similar problems.
In eng mode, reveal the exception so that test tools can detect and report the
error
Change-Id: Ice457d753dcf18e8e93cac90aa62ee1adcc332cd
Diffstat (limited to 'src/com/android/camera/VideoCamera.java')
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 7bdc302..21affac 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -33,6 +33,7 @@ import android.hardware.Camera.Size; import android.hardware.Camera.Parameters; import android.media.MediaRecorder; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Handler; @@ -235,6 +236,11 @@ public class VideoCamera extends Activity implements View.OnClickListener, mStartPreviewFail = false; startPreview(); } catch (CameraHardwareException e) { + // In eng build, we throw the exception so that test tool + // can detect it and report it + if ("eng".equals(Build.TYPE)) { + throw new RuntimeException(e); + } mStartPreviewFail = true; } } @@ -296,7 +302,10 @@ public class VideoCamera extends Activity implements View.OnClickListener, // Make sure preview is started. try { startPreviewThread.join(); - if (mStartPreviewFail) showCameraBusyAndFinish(); + if (mStartPreviewFail) { + showCameraBusyAndFinish(); + return; + } } catch (InterruptedException ex) { // ignore } |