summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoModule.java
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-08-12 15:18:53 -0700
committerDoris Liu <tianliu@google.com>2013-08-13 11:22:27 -0700
commit2a7f44cac888de5683d05bef5708f846ee950f43 (patch)
treea7cb316a8a385be64c08b0ff9ffcf64fab1281e5 /src/com/android/camera/VideoModule.java
parent39685480a9705a949275c4b9cb0cca46c6c3cbc4 (diff)
downloadandroid_packages_apps_Snap-2a7f44cac888de5683d05bef5708f846ee950f43.tar.gz
android_packages_apps_Snap-2a7f44cac888de5683d05bef5708f846ee950f43.tar.bz2
android_packages_apps_Snap-2a7f44cac888de5683d05bef5708f846ee950f43.zip
Fix video capture intent handling
Bug: 10296343 Change-Id: I55fb6c71b59a1559ebb58c65e71d510379367435
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r--src/com/android/camera/VideoModule.java33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 90915334e..b28b66ffd 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -198,6 +198,8 @@ public class VideoModule implements CameraModule,
@Override
public void onMediaSaved(Uri uri) {
if (uri != null) {
+ mCurrentVideoUri = uri;
+ onVideoSaved();
mActivity.notifyNewMedia(uri);
}
}
@@ -550,6 +552,12 @@ public class VideoModule implements CameraModule,
}
}
+ public void onVideoSaved() {
+ if (mIsVideoCaptureIntent) {
+ showCaptureResult();
+ }
+ }
+
public void onProtectiveCurtainClick(View v) {
// Consume clicks
}
@@ -1488,9 +1496,15 @@ public class VideoModule implements CameraModule,
if (mVideoFileDescriptor != null) {
bitmap = Thumbnail.createVideoThumbnailBitmap(mVideoFileDescriptor.getFileDescriptor(),
mDesiredPreviewWidth);
- } else if (mCurrentVideoFilename != null) {
- bitmap = Thumbnail.createVideoThumbnailBitmap(mCurrentVideoFilename,
- mDesiredPreviewWidth);
+ } else if (mCurrentVideoUri != null) {
+ try {
+ mVideoFileDescriptor = mContentResolver.openFileDescriptor(mCurrentVideoUri, "r");
+ bitmap = Thumbnail.createVideoThumbnailBitmap(
+ mVideoFileDescriptor.getFileDescriptor(), mDesiredPreviewWidth);
+ } catch (java.io.FileNotFoundException ex) {
+ // invalid uri
+ Log.e(TAG, ex.toString());
+ }
}
if (bitmap != null) {
// MetadataRetriever already rotates the thumbnail. We should rotate
@@ -1524,7 +1538,9 @@ public class VideoModule implements CameraModule,
private boolean stopVideoRecording() {
Log.v(TAG, "stopVideoRecording");
mUI.setSwipingEnabled(true);
- mUI.showSwitcher();
+ if (!isVideoCaptureIntent()) {
+ mUI.showSwitcher();
+ }
boolean fail = false;
if (mMediaRecorderRecording) {
@@ -1580,8 +1596,13 @@ public class VideoModule implements CameraModule,
// reflect the device orientation as video recording is stopped.
mUI.setOrientationIndicator(0, true);
keepScreenOnAwhile();
- if (shouldAddToMediaStoreNow) {
- saveVideo();
+ if (shouldAddToMediaStoreNow && !fail) {
+ if (mVideoFileDescriptor == null) {
+ saveVideo();
+ } else if (mIsVideoCaptureIntent) {
+ // if no file save is needed, we can show the post capture UI now
+ showCaptureResult();
+ }
}
}
// always release media recorder if no effects running