diff options
author | Chih-Chung Chang <chihchung@google.com> | 2010-03-25 11:53:10 -0700 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2010-03-25 11:59:21 -0700 |
commit | 137417dade91f8a98cefa655cbd0d48b8cf52af1 (patch) | |
tree | 4e16f2220c34a4a5947b88e38ac1337a0b33e3cc /src | |
parent | 416f65b0cc009d251a16512e7b6c3621bf62dc76 (diff) | |
download | LegacyCamera-137417dade91f8a98cefa655cbd0d48b8cf52af1.zip LegacyCamera-137417dade91f8a98cefa655cbd0d48b8cf52af1.tar.gz LegacyCamera-137417dade91f8a98cefa655cbd0d48b8cf52af1.tar.bz2 |
Revert "Fix one more NPE."
This reverts commit 416f65b0cc009d251a16512e7b6c3621bf62dc76.
This broke video recording because the GLThread has exited
after the GLSurfaceView is detached from the window, so the
the runnable put into queueEvent never runs.
Change-Id: I7b071ef170d4d36fd551a81db9f3af7f6ff85a83
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/Camera.java | 29 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 11 |
2 files changed, 26 insertions, 14 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 0256e08..3296912 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -290,7 +290,7 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, // once only. We could have done these things in onCreate() but we want to // make preview screen appear as soon as possible. private void initializeFirstTime() { - if (mFirstTimeInitialized || mPausing || isFinishing()) return; + if (mFirstTimeInitialized) return; // Create orientation listenter. This should be done first because it // takes some time to get first orientation. @@ -308,11 +308,13 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, if (!mIsImageCaptureIntent) { setOrientationIndicator(mLastOrientation); } - mGLRootView.queueEvent(new Runnable() { - public void run() { - mHeadUpDisplay.setOrientation(mLastOrientation); - } - }); + if (mGLRootView != null) { + mGLRootView.queueEvent(new Runnable() { + public void run() { + mHeadUpDisplay.setOrientation(mLastOrientation); + } + }); + } } } }; @@ -1275,10 +1277,12 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, closeCamera(); resetScreenOn(); - mGLRootView.onPause(); - if (mHeadUpDisplay != null) { - mHeadUpDisplay.setGpsHasSignal(false); - mHeadUpDisplay.collapse(); + if (mGLRootView != null) { + mGLRootView.onPause(); + if (mHeadUpDisplay != null) { + mHeadUpDisplay.setGpsHasSignal(false); + mHeadUpDisplay.collapse(); + } } if (mFirstTimeInitialized) { mOrientationListener.disable(); @@ -2064,7 +2068,10 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, private boolean switchToVideoMode() { if (isFinishing() || !isCameraIdle()) return false; MenuHelper.gotoVideoMode(this); - ((ViewGroup) mGLRootView.getParent()).removeView(mGLRootView); + if (mGLRootView != null) { + ((ViewGroup) mGLRootView.getParent()).removeView(mGLRootView); + mGLRootView = null; + } finish(); return true; } diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 69d7353..411386a 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -632,8 +632,10 @@ public class VideoCamera extends NoSearchActivity super.onPause(); mPausing = true; - mGLRootView.onPause(); - if (mHeadUpDisplay != null) mHeadUpDisplay.collapse(); + if (mGLRootView != null) { + mGLRootView.onPause(); + if (mHeadUpDisplay != null) mHeadUpDisplay.collapse(); + } // Hide the preview now. Otherwise, the preview may be rotated during // onPause and it is annoying to users. @@ -1397,7 +1399,10 @@ public class VideoCamera extends NoSearchActivity private boolean switchToCameraMode() { if (isFinishing() || mMediaRecorderRecording) return false; MenuHelper.gotoCameraMode(this); - ((ViewGroup) mGLRootView.getParent()).removeView(mGLRootView); + if (mGLRootView != null) { + ((ViewGroup) mGLRootView.getParent()).removeView(mGLRootView); + mGLRootView = null; + } finish(); return true; } |