Bug 1538270 - Show toast for default file picker when permissions denied.;r=VladBaicu a=jcristau l10n=fennec-nightly-on-beta
authorBrad Arant <brad.arant@softvision.com>
Wed, 22 May 2019 09:10:45 +0000
changeset 536696 615fe993833fe6edf90bc5d1386a23de6ffb86d9
parent 536695 023ce53e3a94f9d306aef2ed07e5587784dc5a3a
child 536697 794943628c3b0f522df456695520b9083038062d
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersVladBaicu, jcristau
bugs1538270
milestone68.0
Bug 1538270 - Show toast for default file picker when permissions denied.;r=VladBaicu a=jcristau l10n=fennec-nightly-on-beta Differential Revision: https://phabricator.services.mozilla.com/D32073
mobile/android/base/java/org/mozilla/gecko/FilePicker.java
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/strings.xml.in
--- a/mobile/android/base/java/org/mozilla/gecko/FilePicker.java
+++ b/mobile/android/base/java/org/mozilla/gecko/FilePicker.java
@@ -17,16 +17,17 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.os.Environment;
 import android.os.Parcelable;
 import android.support.annotation.NonNull;
 import android.text.TextUtils;
 import android.util.Log;
+import android.widget.Toast;
 
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 
 public class FilePicker implements BundleEventListener {
@@ -85,16 +86,17 @@ public class FilePicker implements Bundl
                 .andFallback(new Runnable() {
                     @Override
                     public void run() {
                         // In the fallback case, we still show the picker, just
                         // with the default file list.
                         // TODO: Figure out which permissions have been denied and use that
                         // knowledge for availPermissions. For now we assume we don't have any
                         // permissions at all (bug 1411014).
+                        Toast.makeText(context, context.getString(R.string.filepicker_permission_denied), Toast.LENGTH_LONG).show();
                         showFilePickerAsync(title, "*/*", new String[0], isModeOpenMultiple, new ResultHandler() {
                             @Override
                             public void gotFile(final String filename) {
                                 callback.sendSuccess(filename);
                             }
                         }, tabId);
                     }
                 })
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -666,16 +666,17 @@ shown from Android O while a tab is bein
 <!ENTITY remote_tabs_panel_moved_link "Take me to my new panel.">
 
 <!ENTITY pin_site_dialog_hint "Enter a search keyword">
 
 <!ENTITY filepicker_title "Choose File">
 <!ENTITY filepicker_audio_title "Choose or record a sound">
 <!ENTITY filepicker_image_title "Choose or take a picture">
 <!ENTITY filepicker_video_title "Choose or record a video">
+<!ENTITY filepicker_permission_denied "Required permissions not granted, reverting to the system file picker. ">
 
 <!-- Site identity popup -->
 <!ENTITY identity_connected_to "You are connected to">
 <!-- Localization note (identity_run_by) : This string appears between a
 domain name (above) and an organization name (below). E.g.
 
 example.com
 which is run by
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -476,16 +476,18 @@
   <string name="home_unpinned_site">&home_unpinned_site;</string>
 
   <string name="remote_tabs_never_synced">&remote_tabs_never_synced;</string>
 
   <string name="filepicker_title">&filepicker_title;</string>
   <string name="filepicker_audio_title">&filepicker_audio_title;</string>
   <string name="filepicker_image_title">&filepicker_image_title;</string>
   <string name="filepicker_video_title">&filepicker_video_title;</string>
+  <!-- Toast for default file picker when authority is denied. -->
+  <string name="filepicker_permission_denied">&filepicker_permission_denied;</string>
 
   <!-- Default bookmarks. We used to use bookmark titles shared with XUL from mobile's
        profile/bookmarks.inc (see bug 964946). Don't expose the URLs to L10N. -->
   <string name="bookmarkdefaults_title_aboutfirefox">&bookmarks_about_browser;</string>
   <string name="bookmarkdefaults_url_aboutfirefox">about:firefox</string>
 
   <!-- Icon is automatically generated from R.drawable.bookmarkdefaults_favicon_addons -->
   <string name="bookmarkdefaults_title_addons">&bookmarks_addons;</string>