[Android] Feedback: export the settings in a file
Nicolas Pomepuy
git at videolan.org
Mon Nov 9 13:36:42 UTC 2026
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Nov 4 11:53:52 2026 +0100| [d1cee7a0210125c1840db00a1d54e83af2b8dfac] | committer: Duncan McNamara
Feedback: export the settings in a file
So that we're sure that the email client doesn't mess up the json
> https://code.videolan.org/videolan/vlc-android/commit/d1cee7a0210125c1840db00a1d54e83af2b8dfac
---
.../org/videolan/vlc/gui/helpers/FeedbackUtil.kt | 30 ++++++++++++++--------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/FeedbackUtil.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/FeedbackUtil.kt
index 1871a9ee06..06d8ce630c 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/FeedbackUtil.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/FeedbackUtil.kt
@@ -41,7 +41,6 @@ import org.videolan.resources.VLCOptions
import org.videolan.vlc.BuildConfig
import org.videolan.vlc.R
import org.videolan.vlc.gui.preferences.search.PreferenceParser
-import org.videolan.vlc.gui.preferences.search.PreferenceParser.getChangedPrefsJson
import org.videolan.vlc.util.FileUtils
import org.videolan.vlc.util.Permissions
import java.io.BufferedWriter
@@ -65,13 +64,26 @@ object FeedbackUtil {
val emailIntent = Intent(Intent.ACTION_SEND_MULTIPLE)
emailIntent.type = "message/rfc822"
- //get medialib db if needed
+ val externalPath = AppContextProvider.appContext.getExternalFilesDir(null)?.absolutePath
val attachments = ArrayList<Uri>()
+
+ // Attach settings JSON file
+ if (externalPath != null) {
+ try {
+ val settingsJson = PreferenceParser.getChangedPrefsJson(activity)
+ val settingsFile = File(externalPath, "vlc_settings.json")
+ settingsFile.writeText(settingsJson)
+ attachments.add(FileProvider.getUriForFile(activity, activity.applicationContext.packageName + ".provider", settingsFile))
+ } catch (e: Exception) {
+ Log.e("FeedbackUtil", "Failed to export settings file", e)
+ }
+ }
+
+ //get medialib db if needed
if (includeMedialibrary) {
- val externalPath = AppContextProvider.appContext.getExternalFilesDir(null)?.absolutePath
- ?: return at withContext null
- val dbPath = "$externalPath/${Medialibrary.VLC_MEDIA_DB_NAME}"
- val dbZipPath = "$externalPath/db.zip"
+ val path = externalPath ?: return at withContext null
+ val dbPath = "$path/${Medialibrary.VLC_MEDIA_DB_NAME}"
+ val dbZipPath = "$path/db.zip"
val db = File(activity.getDir("db", Context.MODE_PRIVATE).toString() + Medialibrary.VLC_MEDIA_DB_NAME)
val dbFile = File(dbPath)
FileUtils.copyFile(db, dbFile)
@@ -82,7 +94,7 @@ object FeedbackUtil {
}
val appData = generateUsefulInfo(activity).replace("\r\n", "<br/>") + "<br/>"
- val body = "<p style=3D\"color:#16171A;\">$message</p><p>$appData</p>"
+ val body = "<p style=\"color:#16171A;\">$message</p><p>$appData</p>"
logcatZipPath?.let {
attachments.add(FileProvider.getUriForFile(activity, activity.applicationContext.packageName + ".provider", File(it)))
@@ -163,10 +175,6 @@ object FeedbackUtil {
append(Log.getStackTraceString(e))
}
append("____________________________\r\n")
- append("Settings export/import (copy this line in a file to restore those settings)\r\n")
- append("____________________________\r\n")
- append("${PreferenceParser.getChangedPrefsJson(context)}\r\n")
- append("____________________________\r\n")
append("vlc options: ${VLCOptions.libOptions.joinToString(" ")}\r\n")
append("____________________________\r\n")
}
More information about the Android
mailing list