[Android] StartActivity: rm forward_result flag from intent

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


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Mon Dec 19 18:00:46 2022 +0100| [c83c4d5f7980f659875ed0055719d7c09f8eeb0c] | 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.

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

 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 8129b53e25..7f25f2798e 100644
--- a/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
@@ -245,6 +245,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