summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2017-10-07 14:57:12 +0200
committerMichael W <baddaemon87@gmail.com>2017-10-07 14:57:12 +0200
commit121bd8429c78248771f12c6b1d4356a68397cbb3 (patch)
tree8c4194c4fb8bbbde13a7a7ef6a15443932a8d403
parente17192105b61934ccb8b34d218e9a60075fc5a58 (diff)
downloadandroid_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-xsrc/com/android/gallery3d/app/MuteVideo.java9
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);
}