summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2014-09-22 11:33:50 +0100
committerBen Murdoch <benm@google.com>2014-09-22 11:33:50 +0100
commita1f40f93fc1eb046a06683cafc62205a7ec6ca0c (patch)
treea22630c07971904afd6f6eb30f5adb72d9de6265
parent481681a1d37ea51a6b1ee53600efeb5013666c58 (diff)
downloadBrowser-a1f40f93fc1eb046a06683cafc62205a7ec6ca0c.tar.gz
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
-rw-r--r--src/com/android/browser/UploadHandler.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/browser/UploadHandler.java b/src/com/android/browser/UploadHandler.java
index ab4aff67..87c7897a 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;
}