[Android] Filter storage detection on specific devices only

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


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

Filter storage detection on specific devices only

(cherry picked from commit db4863b0858dbd9cac6583bb4682fe2e244fff39)

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

 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 52f204078..a63045652 100644
--- a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+++ b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
@@ -135,11 +135,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