[Android] Fix sending db in crash sender

Nicolas Pomepuy git at videolan.org
Mon Sep 23 18:10:45 CEST 2019


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Tue Sep 17 09:10:25 2019 +0200| [812a1974422a42c419ad862e53e3f1f9ed2504bf] | committer: Geoffrey Métais

Fix sending db in crash sender

(cherry picked from commit 77299ec1625435f895bdddb718ced1dd0040d7df)

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

 vlc-android/src/org/videolan/vlc/gui/SendCrashActivity.kt | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/SendCrashActivity.kt b/vlc-android/src/org/videolan/vlc/gui/SendCrashActivity.kt
index 6414e9f35..424195e41 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SendCrashActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/SendCrashActivity.kt
@@ -82,9 +82,10 @@ class SendCrashActivity : AppCompatActivity(), DebugLogService.Client.Callback {
             client.stop()
             FileUtils.zip(arrayOf(path), logcatZipPath)
 
-            val emailIntent = Intent(Intent.ACTION_SEND)
+            val emailIntent = Intent(Intent.ACTION_SEND_MULTIPLE)
             emailIntent.type = "message/rfc822"
             //get medialib db if needed
+            val attachments = ArrayList<Uri>()
             if (binding.includeMedialibSwitch.isChecked) {
                 if (Permissions.canWriteStorage()) {
                     val db = File(getDir("db", Context.MODE_PRIVATE).toString() + AbstractMedialibrary.VLC_MEDIA_DB_NAME)
@@ -94,9 +95,7 @@ class SendCrashActivity : AppCompatActivity(), DebugLogService.Client.Callback {
                     FileUtils.zip(arrayOf(dbPath), dbZipPath)
                     FileUtils.deleteFile(dbFile)
 
-                    val dbUri = FileProvider.getUriForFile(this, applicationContext.packageName + ".provider", File(dbZipPath))
-                    emailIntent.putExtra(Intent.EXTRA_STREAM, dbUri)
-                    emailIntent.type = "application/zip"
+                    attachments.add(FileProvider.getUriForFile(this, applicationContext.packageName + ".provider", File(dbZipPath)))
                 }
             }
             val appData = StringBuilder()
@@ -111,11 +110,11 @@ class SendCrashActivity : AppCompatActivity(), DebugLogService.Client.Callback {
             appData.append("System name: ${Build.DISPLAY}<br/>")
             appData.append("Memory free: ${AppUtils.freeMemory().readableFileSize()} on ${AppUtils.totalMemory().readableFileSize()}")
 
-            val logcatUri = FileProvider.getUriForFile(this, applicationContext.packageName + ".provider", File(logcatZipPath))
-            emailIntent.putExtra(Intent.EXTRA_STREAM, logcatUri)
+            attachments.add(FileProvider.getUriForFile(this, applicationContext.packageName + ".provider", File(logcatZipPath)))
+            emailIntent.putExtra(Intent.EXTRA_STREAM, attachments)
             emailIntent.type = "application/zip"
 
-            val describeCrash = getString(R.string.describe_crash)
+            val describeCrash = getString(org.videolan.vlc.R.string.describe_crash)
             val body = "<p>Here are my crash logs for VLC</strong></p><p style=3D\"color:#16171A;\"> [$describeCrash]</p><p>$appData</p>"
             val htmlBody = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) Html.fromHtml(body, HtmlCompat.FROM_HTML_MODE_LEGACY) else Html.fromHtml(body)
 
@@ -162,5 +161,4 @@ class SendCrashActivity : AppCompatActivity(), DebugLogService.Client.Callback {
         if (::client.isInitialized) client.release()
         super.onDestroy()
     }
-
 }



More information about the Android mailing list