Commit fbd21c67 authored by Ted Choc's avatar Ted Choc Committed by Commit Bot

Support content URIs triggering the FRE.

We need to ensure that we propogate the URI read permission
for subsequent intent triggers if the FRE was launched with
a content:// URI.

BUG=817717

Change-Id: Idc3089db222a423f66597f4f59102e42d4101e4c
Reviewed-on: https://chromium-review.googlesource.com/1103540
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568035}
parent 40b58e54
......@@ -10,6 +10,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
......@@ -20,7 +21,9 @@ import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.LaunchIntentDispatcher;
import org.chromium.chrome.browser.UrlConstants;
import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
import org.chromium.chrome.browser.preferences.PrefServiceBridge;
......@@ -336,6 +339,13 @@ public abstract class FirstRunFlowSequencer {
// Check if the user needs to go through First Run at all.
if (!checkIfFirstRunIsNecessary(caller, intent, preferLightweightFre)) return false;
String intentUrl = IntentHandler.getUrlFromIntent(intent);
Uri uri = intentUrl != null ? Uri.parse(intentUrl) : null;
if (uri != null && UrlConstants.CONTENT_SCHEME.equals(uri.getScheme())) {
caller.grantUriPermission(
caller.getPackageName(), uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
Log.d(TAG, "Redirecting user through FRE.");
if ((intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0) {
boolean isVrIntent = VrIntentUtils.isVrIntent(intent);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment