[Android] Filter external storage from storages lists
Geoffrey Métais
git at videolan.org
Thu Dec 7 14:08:02 CET 2017
vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec 7 11:57:56 2017 +0100| [5a24ea6c9e806855981f7050c0a83282150d250a] | committer: Geoffrey Métais
Filter external storage from storages lists
(cherry picked from commit a057ca4340bdcf6ee88f8c246655874eb81f3988)
> https://code.videolan.org/videolan/vlc-android/commit/5a24ea6c9e806855981f7050c0a83282150d250a
---
vlc-android/src/org/videolan/vlc/ExternalMonitor.java | 1 +
vlc-android/src/org/videolan/vlc/MediaParsingService.java | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
index 6d965da41..04f65a3b9 100644
--- a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
+++ b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
@@ -90,6 +90,7 @@ public class ExternalMonitor extends BroadcastReceiver {
public void run() {
final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx);
final List<String> devices = AndroidDevices.getExternalStorageDirectories();
+ devices.remove(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
final String[] knownDevices = ml.getDevices();
final List<String> missingDevices = Util.arrayToArrayList(knownDevices);
missingDevices.remove("file://"+AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.java b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
index 928a8c844..93657c129 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.java
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
@@ -227,8 +227,9 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
shouldInit |= initCode == Medialibrary.ML_INIT_DB_RESET;
if (initCode != Medialibrary.ML_INIT_FAILED) {
final List<String> devices = new ArrayList<>();
- devices.add(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
devices.addAll(AndroidDevices.getExternalStorageDirectories());
+ if (!devices.contains(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY))
+ devices.add(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
for (final String device : devices) {
final boolean isMainStorage = TextUtils.equals(device, AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
More information about the Android
mailing list