android/app/src/main/java/org/libreoffice/androidapp/storage/external/ExtsdDocumentsProvider.java
 |   12 +++++-----
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 1da821c72a354a6a9f63bf6d6cdcf314232bd00c
Author:     Jan Holesovsky <ke...@collabora.com>
AuthorDate: Thu Jan 2 18:04:03 2020 +0100
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Thu Jan 2 18:09:48 2020 +0100

    android: Show the External SD item when the user has set something 
explicitly.
    
    Change-Id: I628ba55f1a7fc7115784695c065d23672cefc4a2
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86139
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>

diff --git 
a/android/app/src/main/java/org/libreoffice/androidapp/storage/external/ExtsdDocumentsProvider.java
 
b/android/app/src/main/java/org/libreoffice/androidapp/storage/external/ExtsdDocumentsProvider.java
index c6f481910..e19d5f67e 100644
--- 
a/android/app/src/main/java/org/libreoffice/androidapp/storage/external/ExtsdDocumentsProvider.java
+++ 
b/android/app/src/main/java/org/libreoffice/androidapp/storage/external/ExtsdDocumentsProvider.java
@@ -169,16 +169,16 @@ public class ExtsdDocumentsProvider implements 
IExternalDocumentProvider,
 
     @Override
     public boolean checkProviderAvailability(Context context) {
-        // too many devices (or I am just unlucky) don't report the mounted 
state properly, and other
-        // devices also consider dedicated part of internal storage to be 
"mounted" so cannot use
-        // getExternalStorageState().equals(Environment.MEDIA_MOUNTED) && 
isExternalStorageRemovable()
-        // but they refer to the primary external storage anyway, so what 
currently is covered by the
-        // "LocalDocumentsProvider"
+        SharedPreferences preferences = 
PreferenceManager.getDefaultSharedPreferences(context);
+        String rootPathURI = 
preferences.getString(DocumentProviderSettingsActivity.KEY_PREF_EXTERNAL_SD_PATH_URI,
 "");
 
-        return hasRemovableStorage && 
ContextCompat.checkSelfPermission(context, 
Manifest.permission.WRITE_EXTERNAL_STORAGE) == 
PackageManager.PERMISSION_GRANTED;
+        // either we know we have the storage or the user has set something 
explicitly
+        return (hasRemovableStorage || !rootPathURI.isEmpty()) && 
ContextCompat.checkSelfPermission(context, 
Manifest.permission.WRITE_EXTERNAL_STORAGE) == 
PackageManager.PERMISSION_GRANTED;
     }
 
     @Override
     public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, 
String key) {
     }
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to