[Android] App start: catch SecurityException
Geoffrey Métais
git at videolan.org
Tue Oct 1 14:44:29 CEST 2019
vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 26 11:12:28 2019 +0200| [093d9b6f8a8e14aa0d4b074825381d1e08e09efc] | committer: Geoffrey Métais
App start: catch SecurityException
(cherry picked from commit d180d7482c33bd2ba411514b7db0bc1509b9b9f4)
> https://code.videolan.org/videolan/vlc-android/commit/093d9b6f8a8e14aa0d4b074825381d1e08e09efc
---
vlc-android/src/org/videolan/vlc/StartActivity.kt | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.kt b/vlc-android/src/org/videolan/vlc/StartActivity.kt
index cd36defe4..2129e6941 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.kt
@@ -196,9 +196,13 @@ class StartActivity : FragmentActivity() {
}
private fun startPlaybackFromApp(intent: Intent) {
- if (intent.type?.startsWith("video") == true)
- startActivity(intent.setClass(this, VideoPlayerActivity::class.java))
- else
+ if (intent.type?.startsWith("video") == true) {
+ try {
+ startActivity(intent.setClass(this, VideoPlayerActivity::class.java))
+ } catch (ex: SecurityException) {
+ intent.data.let { MediaUtils.openMediaNoUi(it) }
+ }
+ } else
intent.data.let { MediaUtils.openMediaNoUi(it) }
finish()
}
More information about the Android
mailing list