[Libreoffice-commits] online.git: android/app
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 2 17:10:14 UTC 2020
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 <kendy at collabora.com>
AuthorDate: Thu Jan 2 18:04:03 2020 +0100
Commit: Jan Holesovsky <kendy at 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 <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at 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: */
More information about the Libreoffice-commits
mailing list