[Android] StartActivity: rm forward_result flag from intent

Duncan McNamara git at videolan.org
Fri Jan 6 07:37:31 UTC 2023


vlc-android | branch: 3.5.x | Duncan McNamara <dcn.mcnamara at gmail.com> | Mon Dec 19 18:00:46 2022 +0100| [8b40ddb912e1ac2b0a0531740d6b8802c54477e7] | committer: Nicolas Pomepuy

StartActivity: rm forward_result flag from intent

This flag is incompatible with startActivityForResult, and causes a
crash when opening the app from a third party app that uses it to open a
video.


(cherry picked from commit c83c4d5f7980f659875ed0055719d7c09f8eeb0c)

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

 application/vlc-android/src/org/videolan/vlc/StartActivity.kt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/application/vlc-android/src/org/videolan/vlc/StartActivity.kt b/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
index 6a6c3c13da..8de588f528 100644
--- a/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
@@ -247,6 +247,8 @@ class StartActivity : FragmentActivity() {
             finish()
             return at launch
         }
+        // Remove FLAG_ACTIVITY_FORWARD_RESULT that is incompatible with startActivityForResult
+        intent.flags = Intent.FLAG_ACTIVITY_FORWARD_RESULT.inv() and intent.flags
         if (Permissions.canReadStorage(applicationContext) || getStoragePermission()) when {
             intent.type?.startsWith("video") == true -> try {
                 startActivityForResult(intent.setClass(this at StartActivity, VideoPlayerActivity::class.java).apply { putExtra(VideoPlayerActivity.FROM_EXTERNAL, true) }, PROPAGATE_RESULT)



More information about the Android mailing list