From a1f40f93fc1eb046a06683cafc62205a7ec6ca0c Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Mon, 22 Sep 2014 11:33:50 +0100 Subject: Pass ClipData in media capture Intent. This is necessary to ensure that the capture application has permission to read the URI that we are asking it to save the capture media into. Bug: 17524075 Change-Id: I6337e58f2610005fb22525e9ae45b037e9832db0 --- src/com/android/browser/UploadHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/com/android/browser') diff --git a/src/com/android/browser/UploadHandler.java b/src/com/android/browser/UploadHandler.java index ab4aff6..87c7897 100644 --- a/src/com/android/browser/UploadHandler.java +++ b/src/com/android/browser/UploadHandler.java @@ -18,6 +18,7 @@ package com.android.browser; import android.app.Activity; import android.content.ActivityNotFoundException; +import android.content.ClipData; import android.content.Intent; import android.net.Uri; import android.provider.MediaStore; @@ -36,6 +37,8 @@ public class UploadHandler { private final static String VIDEO_MIME_TYPE = "video/*"; private final static String AUDIO_MIME_TYPE = "audio/*"; + private final static String FILE_PROVIDER_AUTHORITY = "com.android.browser-classic.file"; + /* * The Object used to inform the WebView of the file to upload. */ @@ -158,7 +161,7 @@ public class UploadHandler { File mediaFile = File.createTempFile( String.valueOf(System.currentTimeMillis()), suffix, mediaPath); return FileProvider.getUriForFile(mController.getActivity(), - "com.android.browser-classic.file", mediaFile); + FILE_PROVIDER_AUTHORITY, mediaFile); } catch (java.io.IOException e) { throw new RuntimeException(e); } @@ -171,6 +174,8 @@ public class UploadHandler { intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); intent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedMedia); + intent.setClipData(ClipData.newUri(mController.getActivity().getContentResolver(), + FILE_PROVIDER_AUTHORITY, mCapturedMedia)); return intent; } -- cgit v1.1