Bug 1450449 - Part 1: Add FileProvider. r?jchen
In case we change our thinking on launching of downloaded files and start using
content:// URIs for that case as well, we already allow our FileProvider to
generate URIs for the whole file system using <root-path>. This is because users
can in principle move our download directory to an arbitrary location on the
file system as long as it is accessible to Firefox. However not all of these
locations (e.g. on a removable SD card) can be specified through the other
methods of specifying available files for a FileProvider, so only the <root-
path> option remains.
MozReview-Commit-ID: 2UStBlU4JsG
new file mode 100644
--- /dev/null
+++ b/mobile/android/app/src/main/res/xml/provider_paths.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<paths xmlns:android="http://schemas.android.com/apk/res/android">
+ <root-path
+ name="root"
+ path="." />
+</paths>
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -368,16 +368,24 @@
<provider android:name="org.mozilla.gecko.db.HomeProvider"
android:authorities="@ANDROID_PACKAGE_NAME@.db.home"
android:exported="false"/>
<provider android:name="org.mozilla.gecko.db.SearchHistoryProvider"
android:authorities="@ANDROID_PACKAGE_NAME@.db.searchhistory"
android:exported="false"/>
+ <provider android:name="android.support.v4.content.FileProvider"
+ android:authorities="@ANDROID_PACKAGE_NAME@.fileprovider"
+ android:exported="false"
+ android:grantUriPermissions="true">
+ <meta-data android:name="android.support.FILE_PROVIDER_PATHS"
+ android:resource="@xml/provider_paths" />
+ </provider>
+
<service
android:exported="false"
android:name="org.mozilla.gecko.updater.UpdateService"
android:process="@MANGLED_ANDROID_PACKAGE_NAME@.UpdateService">
</service>
<service
android:exported="false"
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -20,16 +20,17 @@ import android.os.Build;
// Normally, we'd annotate with @RobocopTarget. Since AppConstants is compiled
// before RobocopTarget, we instead add o.m.g.AppConstants directly to the
// Proguard configuration.
public class AppConstants {
public static final String ANDROID_PACKAGE_NAME = "@ANDROID_PACKAGE_NAME@";
public static final String MANGLED_ANDROID_PACKAGE_NAME = "@MANGLED_ANDROID_PACKAGE_NAME@";
public static final String MOZ_ANDROID_SHARED_FXACCOUNT_TYPE = "@ANDROID_PACKAGE_NAME@_fxaccount";
+ public static final String MOZ_FILE_PROVIDER_AUTHORITY = "@ANDROID_PACKAGE_NAME@.fileprovider";
/**
* Encapsulates access to compile-time version definitions, allowing
* for dead code removal for particular APKs.
*/
public static final class Versions {
public static final int MIN_SDK_VERSION = @MOZ_ANDROID_MIN_SDK_VERSION@;
public static final int MAX_SDK_VERSION =