[Android] Fix sending db in crash sender

Nicolas Pomepuy git at videolan.org
Tue Sep 17 09:26:09 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Tue Sep 17 09:10:25 2019 +0200| [77299ec1625435f895bdddb718ced1dd0040d7df] | committer: Nicolas Pomepuy

Fix sending db in crash sender

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

 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