diff options
author | Michael W <baddaemon87@gmail.com> | 2017-10-07 14:57:12 +0200 |
---|---|---|
committer | Michael W <baddaemon87@gmail.com> | 2017-10-07 14:57:12 +0200 |
commit | 121bd8429c78248771f12c6b1d4356a68397cbb3 (patch) | |
tree | 8c4194c4fb8bbbde13a7a7ef6a15443932a8d403 | |
parent | e17192105b61934ccb8b34d218e9a60075fc5a58 (diff) | |
download | android_packages_apps_Gallery2-121bd8429c78248771f12c6b1d4356a68397cbb3.tar.gz android_packages_apps_Gallery2-121bd8429c78248771f12c6b1d4356a68397cbb3.tar.bz2 android_packages_apps_Gallery2-121bd8429c78248771f12c6b1d4356a68397cbb3.zip |
Gallery2: Fix crash when muting a video
* See https://review.lineageos.org/#/c/191263/
* Thanks to KhabarlakKonstantin <habarlack@gmail.com>
Change-Id: Iff5ecc461dd1d3f5604f909aeffa74bb3ec7edfc
-rwxr-xr-x | src/com/android/gallery3d/app/MuteVideo.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/app/MuteVideo.java b/src/com/android/gallery3d/app/MuteVideo.java index 86bd05db2..f1e9d6958 100755 --- a/src/com/android/gallery3d/app/MuteVideo.java +++ b/src/com/android/gallery3d/app/MuteVideo.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 The Android Open Source Project + * Copyright (C) 2017 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +25,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Handler; import android.provider.MediaStore; +import android.support.v4.content.FileProvider; import android.widget.Toast; import org.codeaurora.gallery.R; @@ -52,6 +54,8 @@ public class MuteVideo { final String TIME_STAMP_NAME = "'MUTE'_yyyyMMdd_HHmmss"; + private static final String FILE_PROVIDER_AUTHORITY = "com.android.gallery3d.fileprovider"; + public MuteVideo(String filePath, Uri uri, Activity activity) { mUri = uri; mFilePath = filePath; @@ -118,7 +122,10 @@ public class MuteVideo { // Show the result only when the activity not // stopped. Intent intent = new Intent(android.content.Intent.ACTION_VIEW); - intent.setDataAndType(Uri.fromFile(mDstFileInfo.mFile), "video/*"); + Uri fileUri = FileProvider.getUriForFile(mActivity, + FILE_PROVIDER_AUTHORITY, mDstFileInfo.mFile); + intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + intent.setDataAndType(fileUri, "video/*"); intent.putExtra(MediaStore.EXTRA_FINISH_ON_COMPLETION, false); mActivity.startActivity(intent); } |