[Android] Revert "Ml: fix discovery-failure after onboarding skip"

Duncan McNamara git at videolan.org
Tue Jan 24 12:43:50 UTC 2023


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Tue Jan 24 13:20:42 2023 +0100| [b2e0b54eaf43e3c7e50bfee28514652778ba8bfd] | committer: Nicolas Pomepuy

Revert "Ml: fix discovery-failure after onboarding skip"

This reverts commit 2338bd92a00c8e9ce00109cca5f3bb56f37b4e38.

This commit causes medialibrary in sdcard to be dropped as it permits
the addition of folders as ML devices, which is not what they are.
This causes the medialibrary remove these "devices" when
updatingDevices, hence removing the selected folders.

Fixes #2791

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

 .../vlc-android/src/org/videolan/vlc/MediaParsingService.kt    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index bc77e3d953..20a6ae85e7 100644
--- a/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -227,12 +227,9 @@ class MediaParsingService : LifecycleService(), DevicesDiscoveryCb {
                 return
             }
         }
-        val isMainStorage = path.removeFileScheme().startsWith(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY)
-        if (isMainStorage) {
-            medialibrary.addDevice("main-storage", path, false)
-        } else if (AndroidDevices.externalStorageDirectories.isNotEmpty()) {
+        if (AndroidDevices.externalStorageDirectories.isNotEmpty()) {
             for (storagePath in AndroidDevices.externalStorageDirectories) {
-                if (path.removeFileScheme().startsWith(storagePath)) {
+                if (path.startsWith(storagePath)) {
                     val uuid = FileUtils.getFileNameFromPath(path)
                     if (uuid.isEmpty()) {
                         exitCommand()
@@ -244,6 +241,9 @@ class MediaParsingService : LifecycleService(), DevicesDiscoveryCb {
                     }
                 }
             }
+        } else {
+            val uuid = FileUtils.getFileNameFromPath(path)
+            medialibrary.addDevice(uuid, path, false)
         }
     }
 



More information about the Android mailing list