diff options
| author | Angus Kong <shkong@google.com> | 2011-08-19 02:12:46 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-19 02:12:46 -0700 |
| commit | 69e3cc1f6c1cd167a62361b2fe07d7d755ee8844 (patch) | |
| tree | d8954610ac987566aea72c2060e59a4ca5c1b02c | |
| parent | 0e7b1301af5775c41827b9de0822566a91ea0c4f (diff) | |
| parent | 4d1c2846e24a7f7f6c8ff59e01ca36a000344944 (diff) | |
| download | LegacyCamera-69e3cc1f6c1cd167a62361b2fe07d7d755ee8844.zip LegacyCamera-69e3cc1f6c1cd167a62361b2fe07d7d755ee8844.tar.gz LegacyCamera-69e3cc1f6c1cd167a62361b2fe07d7d755ee8844.tar.bz2 | |
Merge "Fix NPE bug in onPause() when mSurface is null."
| -rw-r--r-- | src/com/android/camera/panorama/PanoramaActivity.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java index 53dbb7a..e507e06 100644 --- a/src/com/android/camera/panorama/PanoramaActivity.java +++ b/src/com/android/camera/panorama/PanoramaActivity.java @@ -287,8 +287,7 @@ public class PanoramaActivity extends Activity implements } public synchronized void onFrameAvailable(SurfaceTexture surface) { - /* For simplicity, SurfaceTexture calls here when it has new - * data available. Call may come in from some random thread, + /* This function may be called by some random thread, * so let's be safe and use synchronize. No OpenGL calls can be done here. */ // Updating the texture should be done in the GL thread which mMosaicView is attached. @@ -488,10 +487,9 @@ public class PanoramaActivity extends Activity implements @Override protected void onPause() { super.onPause(); - mSurfaceTexture.setOnFrameAvailableListener(null); + releaseCamera(); mPausing = true; - mMosaicView.onPause(); mSensorManager.unregisterListener(mListener); clearMosaicFrameProcessorIfNeeded(); @@ -513,6 +511,10 @@ public class PanoramaActivity extends Activity implements mSensorManager.registerListener(mListener, mSensor, SensorManager.SENSOR_DELAY_UI); mCaptureState = CAPTURE_VIEWFINDER; setupCamera(); + if (mSurfaceTexture != null) { + mSurfaceTexture.setOnFrameAvailableListener(this); + startCameraPreview(); + } // Camera must be initialized before MosaicFrameProcessor is initialized. The preview size // has to be decided by camera device. initMosaicFrameProcessorIfNeeded(); |
