summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2009-11-04 12:22:12 +0800
committerChih-Chung Chang <chihchung@google.com>2009-11-04 12:22:12 +0800
commit111bf09fd62bd0c714ef2164c77965fb0db05a8e (patch)
treea3642f5650d485cf0d63aa7df1514c47df67489d /src
parent96aefdd25c72b2ec644efdeef9b3da0714a61aa1 (diff)
downloadLegacyCamera-111bf09fd62bd0c714ef2164c77965fb0db05a8e.zip
LegacyCamera-111bf09fd62bd0c714ef2164c77965fb0db05a8e.tar.gz
LegacyCamera-111bf09fd62bd0c714ef2164c77965fb0db05a8e.tar.bz2
Fix 2225024: Handle the case where the sd card is unmounted while recording.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/VideoCamera.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index ea3726d..b598d4f 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -955,9 +955,17 @@ public class VideoCamera extends NoSearchActivity
Uri videoTable = Uri.parse("content://media/external/video/media");
mCurrentVideoValues.put(Video.Media.SIZE,
new File(mCurrentVideoFilename).length());
- mCurrentVideoUri = mContentResolver.insert(videoTable,
- mCurrentVideoValues);
- Log.v(TAG, "Current video URI: " + mCurrentVideoUri);
+ try {
+ mCurrentVideoUri = mContentResolver.insert(videoTable,
+ mCurrentVideoValues);
+ } catch (Exception e) {
+ // We failed to insert into the database. This can happen if
+ // the SD card is unmounted.
+ mCurrentVideoUri = null;
+ mCurrentVideoFilename = null;
+ } finally {
+ Log.v(TAG, "Current video URI: " + mCurrentVideoUri);
+ }
}
mCurrentVideoValues = null;
}