[Android] Ml: fix discovery-failure after onboarding skip
Duncan McNamara
git at videolan.org
Tue Jan 24 12:47:30 UTC 2023
vlc-android | branch: 3.5.x | Duncan McNamara <dcn.mcnamara at gmail.com> | Tue Jan 24 13:27:12 2023 +0100| [fdf003bbd1ba9456d9933962f7be17a8918c0633] | 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
(cherry picked from commit 1e89a2a66cfb91822160644c8e5a46a84cb88acd)
> https://code.videolan.org/videolan/vlc-android/commit/fdf003bbd1ba9456d9933962f7be17a8918c0633
---
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 6d6a6d8925..11214427e4 100644
--- a/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -226,7 +226,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