[Android] Filter storage detection on specific devices only

Geoffrey Métais git at videolan.org
Wed May 15 10:08:42 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed May 15 09:43:48 2019 +0200| [db4863b0858dbd9cac6583bb4682fe2e244fff39] | committer: Geoffrey Métais

Filter storage detection on specific devices only

> https://code.videolan.org/videolan/vlc-android/commit/db4863b0858dbd9cac6583bb4682fe2e244fff39
---

 vlc-android/src/org/videolan/vlc/util/Kextensions.kt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
index 7b3a252ac..e9033fc64 100644
--- a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+++ b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
@@ -141,11 +141,12 @@ fun MutableList<MediaWrapper>.updateWithMLMeta() : MutableList<MediaWrapper> {
     return this
 }
 
+ at ExperimentalCoroutinesApi
+ at ObsoleteCoroutinesApi
 suspend fun String.scanAllowed() = withContext(Dispatchers.IO) {
     val file = File(Uri.parse(this at scanAllowed).path)
     if (!file.exists() || !file.canRead()) return at withContext false
-    val children = file.list() ?: return at withContext true
-    for (child in children) if (child == ".nomedia") return at withContext false
+    if (AndroidDevices.watchDevices && file.list()?.any { it == ".nomedia" } == true) return at withContext false
     true
 }
 



More information about the Android mailing list