Skip to content
Snippets Groups Projects
Commit 1f00d66d authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Add the app version to the logs for the crash reporter

parent 4e21f5d0
No related branches found
No related tags found
1 merge request!1036Add the app version to the logs for the crash reporter
Pipeline #119131 passed with stage
in 2 minutes and 41 seconds
......@@ -20,6 +20,8 @@
package org.videolan.resources.util
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.os.Environment
import android.text.format.DateFormat
import android.util.Log
......@@ -79,7 +81,15 @@ class VLCCrashHandler : UncaughtExceptionHandler {
val output = OutputStreamWriter(stream)
val bw = BufferedWriter(output)
val version = try {
val pInfo: PackageInfo = AppContextProvider.appContext.packageManager.getPackageInfo(AppContextProvider.appContext.getPackageName(), 0)
pInfo.versionName
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
}
try {
bw.write("App version: $version\r\n")
bw.write(log)
bw.newLine()
} catch (e: IOException) {
......
......@@ -176,6 +176,7 @@ class DebugLogService : Service(), Logcat.Callback, Runnable {
output = OutputStreamWriter(fos)
bw = BufferedWriter(output)
synchronized(this) {
bw.write("App version: ${BuildConfig.VLC_VERSION_CODE} / ${BuildConfig.VLC_VERSION_NAME}\r\n")
for (line in logList) {
bw.write(line)
bw.newLine()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment