[Android] Ml: fix discovery-failure after onboarding skip
Duncan McNamara
git at videolan.org
Tue Sep 27 07:45:39 UTC 2022
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Tue Sep 20 18:14:25 2022 +0200| [2338bd92a00c8e9ce00109cca5f3bb56f37b4e38] | committer: Nicolas Pomepuy
Ml: fix discovery-failure after onboarding skip
If storage access isn't granted, the medialibrary init will not add the
internal storage as a medialibrary device. After this, it is only
possible to add external devices. So later discovery of internal storage
will fail, not being registered in the medialibrary database.
To fix this, in the late device addition, a check for internal storage
is added.
Fixes #2689
> https://code.videolan.org/videolan/vlc-android/commit/2338bd92a00c8e9ce00109cca5f3bb56f37b4e38
---
.../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 6d6a6d892..5cb306315 100644
--- a/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -226,9 +226,12 @@ class MediaParsingService : LifecycleService(), DevicesDiscoveryCb {
return
}
}
- if (AndroidDevices.externalStorageDirectories.isNotEmpty()) {
+ val isMainStorage = path.removeFileScheme().startsWith(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY)
+ if (isMainStorage) {
+ medialibrary.addDevice("main-storage", path, false)
+ } else if (AndroidDevices.externalStorageDirectories.isNotEmpty()) {
for (storagePath in AndroidDevices.externalStorageDirectories) {
- if (path.startsWith(storagePath)) {
+ if (path.removeFileScheme().startsWith(storagePath)) {
val uuid = FileUtils.getFileNameFromPath(path)
if (uuid.isEmpty()) {
exitCommand()
@@ -240,9 +243,6 @@ class MediaParsingService : LifecycleService(), DevicesDiscoveryCb {
}
}
}
- } else {
- val uuid = FileUtils.getFileNameFromPath(path)
- medialibrary.addDevice(uuid, path, false)
}
}
More information about the Android
mailing list