[tbb-commits] [tor-browser/tor-browser-60.4.0esr-8.5-1] Bug 1450449 - Part 1: Add FileProvider. r=jchen

gk at torproject.org gk at torproject.org
Thu Jan 24 20:03:43 UTC 2019


commit e80f96596129a94a39caa8e525affa892077d3b0
Author: Jan Henning <jh+bugzilla at buttercookie.de>
Date:   Sat May 12 22:19:08 2018 +0200

    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
    
    --HG--
    extra : rebase_source : 2c1828e063c1b3e772ac20c415fd34d0da1c24a6
---
 mobile/android/app/src/main/res/xml/provider_paths.xml | 10 ++++++++++
 mobile/android/base/AndroidManifest.xml.in             | 10 ++++++++++
 mobile/android/base/AppConstants.java.in               |  1 +
 3 files changed, 21 insertions(+)

diff --git a/mobile/android/app/src/main/res/xml/provider_paths.xml b/mobile/android/app/src/main/res/xml/provider_paths.xml
new file mode 100644
index 000000000000..8bdaaac58a1c
--- /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>
diff --git a/mobile/android/base/AndroidManifest.xml.in b/mobile/android/base/AndroidManifest.xml.in
index 0e5f4edaf814..c7c5ead7f82f 100644
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -383,6 +383,16 @@
                   android:authorities="@ANDROID_PACKAGE_NAME at .db.searchhistory"
                   android:exported="false"/>
 
+        <provider android:name="android.support.v4.content.FileProvider"
+                  tools:replace="android:authorities"
+                  android:authorities="@ANDROID_PACKAGE_NAME at .fileprovider"
+                  android:exported="false"
+                  android:grantUriPermissions="true">
+                  <meta-data android:name="android.support.FILE_PROVIDER_PATHS"
+                             tools:replace="android:resource"
+                             android:resource="@xml/provider_paths" />
+        </provider>
+
         <service
             android:exported="false"
             android:name="org.mozilla.gecko.updater.UpdateService"
diff --git a/mobile/android/base/AppConstants.java.in b/mobile/android/base/AppConstants.java.in
index d676b1e1da12..e16d936b6b0d 100644
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -25,6 +25,7 @@ public class AppConstants {
     public static final String MANGLED_ANDROID_PACKAGE_NAME = "@MANGLED_ANDROID_PACKAGE_NAME@";
 
     public static final String MOZ_ANDROID_SHARED_FXACCOUNT_TYPE = "@ANDROID_PACKAGE_NAME at _fxaccount";
+    public static final String MOZ_FILE_PROVIDER_AUTHORITY = "@ANDROID_PACKAGE_NAME at .fileprovider";
 
     /**
      * Encapsulates access to compile-time version definitions, allowing





More information about the tbb-commits mailing list