Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 121bd842 authored by Michael W's avatar Michael W
Browse files

Gallery2: Fix crash when muting a video

* See https://review.lineageos.org/#/c/191263/
* Thanks to KhabarlakKonstantin <habarlack@gmail.com>

Change-Id: Iff5ecc461dd1d3f5604f909aeffa74bb3ec7edfc
parent e1719210
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
/*
 * 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);
                        }