From fdb0539aae5cd09cbaf67f09f9d91f0e485e7783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= <975883+pazos@users.noreply.github.com> Date: Sun, 23 May 2021 01:20:13 +0200 Subject: [PATCH] Bug report changes (#7709) * android: dump logcat to file * Update .github/ISSUE_TEMPLATE/bug_report.md Co-authored-by: Frans de Jonge --- .github/ISSUE_TEMPLATE/bug_report.md | 4 ++-- .../ui/elements/common_info_menu_table.lua | 22 ++++++++++++++++--- platform/android/luajit-launcher | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index fd43de881..22c3200e9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -23,8 +23,8 @@ normally be found in the KOReader directory: * `.adds/koreader/` directory for Kobo * `applications/koreader/` directory for Pocketbook -Android won't have a crash.log file because Google restricts what apps can log, so you'll need to obtain logs using `adb logcat KOReader:I ActivityManager:* AndroidRuntime:* DEBUG:* *:F`. +Android logs are kept in memory. Please go to Help → Bug Report to save these logs to a file. Please try to include the relevant sections in your issue description. You can upload the whole `crash.log` file on GitHub by dragging and @@ -33,7 +33,7 @@ dropping it onto this textbox. If you instead opt to inline it, please do so behind a spoiler tag:
crash.log - + ``` ``` diff --git a/frontend/ui/elements/common_info_menu_table.lua b/frontend/ui/elements/common_info_menu_table.lua index 4070fed8d..504069c27 100644 --- a/frontend/ui/elements/common_info_menu_table.lua +++ b/frontend/ui/elements/common_info_menu_table.lua @@ -53,10 +53,26 @@ common_info.about = { common_info.report_bug = { text = _("Report a bug"), keep_menu_open = true, - callback = function() + callback_func = function() + local DataStorage = require("datastorage") + local log_path = string.format("%s/%s", DataStorage:getDataDir(), "crash.log") + local common_msg = T(_("Please report bugs to \nhttps://github.com/koreader/koreader/issues\n\nVersion:\n%1\n\nDetected device:\n%2"), + Version:getCurrentRevision(), Device:info()) + local log_msg = T(_("Attach %1 to your bug report."), log_path) + + if Device:isAndroid() then + local android = require("android") + android.dumpLogs(log_path) + end + + local msg + if lfs.attributes(log_path, "mode") == "file" then + msg = string.format("%s\n\n%s", common_msg, log_msg) + else + msg = common_msg + end UIManager:show(InfoMessage:new{ - text = T(_("Please report bugs to \nhttps://github.com/koreader/koreader/issues\n\nVersion:\n%1\n\nDetected device:\n%2"), - Version:getCurrentRevision(), Device:info()), + text = msg, }) end } diff --git a/platform/android/luajit-launcher b/platform/android/luajit-launcher index 76f10d206..b1697e48f 160000 --- a/platform/android/luajit-launcher +++ b/platform/android/luajit-launcher @@ -1 +1 @@ -Subproject commit 76f10d206a8b07924630598667872b0cd7ede64c +Subproject commit b1697e48fa87077ede7455b10fa212a43dfdde11