Fix video capture intent preview alert for effects.
In effects mode, stopping video record is asynchronous, and dealing
with alerts and thumbnails has to be deferred until a done callback
from the effectsrecorder.
Bug: 5494625
Change-Id: Ic343b672c29515cb77f62b8d3e685d668681fdd1
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 4d09fee..1479bac 100755
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -178,6 +178,7 @@
private MediaRecorder mMediaRecorder;
private EffectsRecorder mEffectsRecorder;
+ private boolean mEffectsDisplayResult;
private int mEffectType = EffectsRecorder.EFFECT_NONE;
private Object mEffectParameter = null;
@@ -601,14 +602,15 @@
}
private void onStopVideoRecording(boolean valid) {
+ mEffectsDisplayResult = true;
stopVideoRecording();
if (mIsVideoCaptureIntent) {
if (mQuickCapture) {
doReturnToCaller(valid);
- } else {
+ } else if (!effectsActive()) {
showAlert();
}
- } else {
+ } else if (!effectsActive()) {
getThumbnail();
}
}
@@ -925,12 +927,13 @@
// This is similar to what mShutterButton.performClick() does,
// but not quite the same.
if (mMediaRecorderRecording) {
+ mEffectsDisplayResult = true;
if (mIsVideoCaptureIntent) {
stopVideoRecording();
- showAlert();
+ if (!effectsActive()) showAlert();
} else {
stopVideoRecording();
- getThumbnail();
+ if (!effectsActive()) getThumbnail();
}
} else {
stopVideoRecording();
@@ -1236,6 +1239,7 @@
CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId];
+ mEffectsDisplayResult = false;
mEffectsRecorder = new EffectsRecorder(this);
// TODO: Confirm none of the foll need to go to initializeEffectsRecording()
@@ -1946,8 +1950,20 @@
mBgLearningMessageFrame.setVisibility(View.GONE);
checkQualityAndStartPreview();
} else if (effectMsg == EffectsRecorder.EFFECT_MSG_RECORDING_DONE) {
- addVideoToMediaStore();
- getThumbnail();
+ // TODO: This assumes the codepath from onStopVideoRecording. It
+ // does not appear to cause problems for the other codepaths, but
+ // should be properly thought through.
+ if (mEffectsDisplayResult) {
+ addVideoToMediaStore();
+ if (mIsVideoCaptureIntent) {
+ if (!mQuickCapture) {
+ showAlert();
+ }
+ } else {
+ getThumbnail();
+ }
+ }
+ mEffectsDisplayResult = false;
} else if (effectId == EffectsRecorder.EFFECT_BACKDROPPER) {
switch (effectMsg) {
case EffectsRecorder.EFFECT_MSG_STARTED_LEARNING: