[Android] Retrieve the real Uri from external providers sooner to avoid SecurityException
Nicolas Pomepuy
git at videolan.org
Thu May 20 08:20:22 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed May 19 07:53:48 2021 +0200| [748327bccab38114a2af3d7ab4e012f60a41f124] | committer: Nicolas Pomepuy
Retrieve the real Uri from external providers sooner to avoid SecurityException
Fixes #1817
> https://code.videolan.org/videolan/vlc-android/commit/748327bccab38114a2af3d7ab4e012f60a41f124
---
application/vlc-android/src/org/videolan/vlc/StartActivity.kt | 7 ++-----
.../vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 2 +-
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/StartActivity.kt b/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
index 646bb7fcf..7e6a499a4 100644
--- a/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
@@ -34,10 +34,7 @@ import androidx.core.content.ContextCompat
import androidx.core.net.toUri
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.lifecycleScope
-import kotlinx.coroutines.CoroutineStart
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.ObsoleteCoroutinesApi
-import kotlinx.coroutines.launch
+import kotlinx.coroutines.*
import org.videolan.libvlc.util.AndroidUtil
import org.videolan.medialibrary.MLServiceLocator
import org.videolan.resources.*
@@ -226,7 +223,7 @@ class StartActivity : FragmentActivity() {
intent.data?.let { MediaUtils.openMediaNoUi(it) }
}
intent.data?.authority == getString(R.string.tv_provider_authority) -> MediaUtils.openMediaNoUiFromTvContent(this at StartActivity, intent.data)
- else -> intent.data?.let { MediaUtils.openMediaNoUi(it) }
+ else -> withContext(Dispatchers.IO) { FileUtils.getUri(intent.data)}?.let { MediaUtils.openMediaNoUi(it) }
}
finish()
}
diff --git a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 86aa4b60e..4965db239 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -341,7 +341,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
if (mw.type != MediaWrapper.TYPE_VIDEO || isVideoPlaying || player.hasRenderer
|| mw.hasFlag(MediaWrapper.MEDIA_FORCE_AUDIO)) {
- var uri = withContext(Dispatchers.IO) { FileUtils.getUri(mw.uri) }
+ var uri = mw.uri
if (uri == null) {
skipMedia()
return
More information about the Android
mailing list