diff options
-rw-r--r-- | AndroidManifest.xml | 1 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/VideoUtils.java | 5 | ||||
-rw-r--r-- | src/com/android/gallery3d/util/SaveVideoFileUtils.java | 11 |
3 files changed, 14 insertions, 3 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index a0cc65ffc..96e780bbe 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -31,6 +31,7 @@ <uses-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> <uses-permission android:name="com.android.gallery3d.permission.GALLERY_PROVIDER" /> + <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="true" diff --git a/src/com/android/gallery3d/app/VideoUtils.java b/src/com/android/gallery3d/app/VideoUtils.java index 359cf76f5..b96958672 100644 --- a/src/com/android/gallery3d/app/VideoUtils.java +++ b/src/com/android/gallery3d/app/VideoUtils.java @@ -174,6 +174,11 @@ public class VideoUtils { retrieverSrc.setDataSource(srcPath); String degreesString = retrieverSrc.extractMetadata( MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION); + try { + retrieverSrc.release(); + } catch (IOException e) { + // Ignore errors occurred while releasing the MediaMetadataRetriever. + } if (degreesString != null) { int degrees = Integer.parseInt(degreesString); if (degrees >= 0) { diff --git a/src/com/android/gallery3d/util/SaveVideoFileUtils.java b/src/com/android/gallery3d/util/SaveVideoFileUtils.java index bef75bac4..7c6ba5eb2 100644 --- a/src/com/android/gallery3d/util/SaveVideoFileUtils.java +++ b/src/com/android/gallery3d/util/SaveVideoFileUtils.java @@ -28,6 +28,7 @@ import android.provider.MediaStore.Video.VideoColumns; import com.android.gallery3d.filtershow.tools.SaveImage.ContentResolverQueryCallback; import java.io.File; +import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; @@ -101,7 +102,7 @@ public class SaveVideoFileUtils { values.put(Video.Media.DATE_ADDED, nowInSec); values.put(Video.Media.DATA, mDstFileInfo.mFile.getAbsolutePath()); values.put(Video.Media.SIZE, mDstFileInfo.mFile.length()); - int durationMs = retriveVideoDurationMs(mDstFileInfo.mFile.getPath()); + int durationMs = retrieveVideoDurationMs(mDstFileInfo.mFile.getPath()); values.put(Video.Media.DURATION, durationMs); // Copy the data taken and location info from src. String[] projection = new String[] { @@ -137,7 +138,7 @@ public class SaveVideoFileUtils { return contentResolver.insert(Video.Media.EXTERNAL_CONTENT_URI, values); } - public static int retriveVideoDurationMs(String path) { + private static int retrieveVideoDurationMs(String path) { int durationMs = 0; // Calculate the duration of the destination file. MediaMetadataRetriever retriever = new MediaMetadataRetriever(); @@ -147,7 +148,11 @@ public class SaveVideoFileUtils { if (duration != null) { durationMs = Integer.parseInt(duration); } - retriever.release(); + try { + retriever.release(); + } catch (IOException e) { + // Ignore errors occurred while releasing the retriever. + } return durationMs; } |