summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenpo Hu <senpo@google.com>2014-09-29 18:49:10 -0700
committerSenpo Hu <senpo@google.com>2014-09-30 05:32:15 +0000
commit2499af485d19e9e9843f7f8ea9a566ee24e62a33 (patch)
tree53b4911bbdff332c1517f44b4b8d56f0061b7aef
parent2f727affa9fa62c8395f628c193c36b1ab299d81 (diff)
downloadandroid_packages_apps_Camera2-2499af485d19e9e9843f7f8ea9a566ee24e62a33.tar.gz
android_packages_apps_Camera2-2499af485d19e9e9843f7f8ea9a566ee24e62a33.tar.bz2
android_packages_apps_Camera2-2499af485d19e9e9843f7f8ea9a566ee24e62a33.zip
Stability: call stopPreview() before switching off video module.
If the preview is not stopped, the following camera operations posted by other modules such as "apply settings" will turn camera object in turmoil. The camera object could start throwing exception and eventually hang. Bug: 16300704 Bug: 17403384 Change-Id: Idd2360869d51b9dfc06309f8ac185a65add8d0c9 (cherry picked from commit 36e045a43d9b8949d9a219b84cf894cf21f8e98a)
-rw-r--r--src/com/android/camera/VideoModule.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index f855d952c..73e5548ec 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -699,7 +699,9 @@ public class VideoModule extends CameraModule
startVideoRecording();
}
mAppController.setShutterEnabled(false);
- mFocusManager.onShutterUp(mCameraSettings.getCurrentFocusMode());
+ if (mCameraSettings != null) {
+ mFocusManager.onShutterUp(mCameraSettings.getCurrentFocusMode());
+ }
// Keep the shutter button disabled when in video capture intent
// mode and recording is stopped. It'll be re-enabled when
@@ -950,9 +952,16 @@ public class VideoModule extends CameraModule
@Override
public void stopPreview() {
- if (!mPreviewing || mCameraDevice == null) {
+ if (!mPreviewing) {
+ Log.v(TAG, "Skip stopPreview since it's not mPreviewing");
+ return;
+ }
+ if (mCameraDevice == null) {
+ Log.v(TAG, "Skip stopPreview since mCameraDevice is null");
return;
}
+
+ Log.v(TAG, "stopPreview");
mCameraDevice.stopPreview();
if (mFocusManager != null) {
mFocusManager.onPreviewStopped();
@@ -1400,14 +1409,14 @@ public class VideoModule extends CameraModule
}
private boolean stopVideoRecording() {
- Log.i(TAG, "stopVideoRecording");
-
// Do nothing if camera device is still capturing photo. Monkey test can trigger app crashes
// (b/17313985) without this check. Crash could also be reproduced by continuously tapping
// on shutter button and preview with two fingers.
if (mSnapshotInProgress) {
+ Log.v(TAG, "Skip stopVideoRecording since snapshot in progress");
return true;
}
+ Log.v(TAG, "stopVideoRecording");
mUI.setSwipingEnabled(true);
mUI.showFocusUI(true);
@@ -1438,6 +1447,10 @@ public class VideoModule extends CameraModule
// during recording. Release the camera as soon as possible because
// face unlock or other applications may need to use the camera.
if (mPaused) {
+ // b/16300704: Monkey is fast so it could pause the module while recording.
+ // stopPreview should definitely be called before switching off.
+ stopPreview();
+
closeCamera();
}