[Android] App start: catch SecurityException

Geoffrey Métais git at videolan.org
Thu Sep 26 11:46:18 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Sep 26 11:12:28 2019 +0200| [d180d7482c33bd2ba411514b7db0bc1509b9b9f4] | committer: Geoffrey Métais

App start: catch SecurityException

> https://code.videolan.org/videolan/vlc-android/commit/d180d7482c33bd2ba411514b7db0bc1509b9b9f4
---

 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