[Android] 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:27:12 2023 +0100| [1e89a2a66cfb91822160644c8e5a46a84cb88acd] | 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/1e89a2a66cfb91822160644c8e5a46a84cb88acd
---
application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index 20a6ae85e7..d2a0db0870 100644
--- a/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -227,7 +227,10 @@ 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)) {
val uuid = FileUtils.getFileNameFromPath(path)
More information about the Android
mailing list