[Android] Remove a now useless workaround for media coming from mail clients

Nicolas Pomepuy git at videolan.org
Wed Oct 14 09:28:20 UTC 2026


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Oct  6 11:16:41 2026 +0200| [d289a54689d82eb788ec547ff5fb08f847ae62e6] | committer: Nicolas Pomepuy

Remove a now useless workaround for media coming from mail clients

Credit: Ostorlab

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

 .../src/org/videolan/vlc/util/FileUtils.kt         | 41 ----------------------
 1 file changed, 41 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt b/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
index 81e37b96e8..23a581cedf 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
@@ -394,47 +394,6 @@ object FileUtils {
                 if (!Permissions.canReadStorage(ctx)) {
                     uri = getFileDescriptorFromUri(data)
                 // Mail-based apps - download the stream to a temporary file and play it
-                } else if ("com.fsck.k9.attachmentprovider" == data.host || "gmail-ls" == data.host) {
-                    var inputStream: InputStream? = null
-                    var os: OutputStream? = null
-                    var cursor: Cursor? = null
-                    try {
-                        cursor = ctx.contentResolver.query(
-                            data,
-                            arrayOf(MediaStore.MediaColumns.DISPLAY_NAME), null, null, null
-                        )
-                        if (cursor != null && cursor.moveToFirst()) {
-                            val filename =
-                                cursor.getString(cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME))
-                                    .replace("/", "")
-                            if (BuildConfig.DEBUG) Log.i(
-                                TAG,
-                                "Getting file $filename from content:// URI"
-                            )
-                            inputStream = ctx.contentResolver.openInputStream(data)
-                            if (inputStream == null) {
-                                Log.i("FileUtils", "Expanding uri: $data to $data")
-                                return data
-                            }
-                            os =
-                                FileOutputStream(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + "/Download/" + filename)
-                            val buffer = ByteArray(1024)
-                            var bytesRead = inputStream.read(buffer)
-                            while (bytesRead >= 0) {
-                                os.write(buffer, 0, bytesRead)
-                                bytesRead = inputStream.read(buffer)
-                            }
-                            uri =
-                                AndroidUtil.PathToUri(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + "/Download/" + filename)
-                        }
-                    } catch (e: Exception) {
-                        Log.e(TAG, "Couldn't download file from mail URI: $data")
-                        return null
-                    } finally {
-                        CloseableUtils.close(inputStream)
-                        CloseableUtils.close(os)
-                        CloseableUtils.close(cursor)
-                    }
                 } else if (data.host == "com.amaze.filemanager" && data.path != null) {
                     uri = data.path!!.replace("/storage_root", "file://").toUri()
                     uri.let {



More information about the Android mailing list