From 175d9615d2108fb689505852323067deae6ad24c Mon Sep 17 00:00:00 2001 From: Tanay Kamath <2tanaykamath@gmail.com> Date: Wed, 24 Mar 2021 22:54:02 +0530 Subject: [PATCH] Add WebView and Hardware details to Info clipboard copy (#8250) * Added additional debug info (WebView/Hardware) Fixes #8234 --- AnkiDroid/src/main/java/com/ichi2/anki/Info.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/Info.java b/AnkiDroid/src/main/java/com/ichi2/anki/Info.java index 9603d6fd3c31..46355ec490a1 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/Info.java +++ b/AnkiDroid/src/main/java/com/ichi2/anki/Info.java @@ -218,9 +218,13 @@ public String copyDebugInfo() { Timber.w(e, "Unable to detect Rust Backend"); } - + String webviewUserAgent = getWebviewUserAgent(); String debugInfo = "AnkiDroid Version = " + VersionUtils.getPkgVersionName() + "\n\n" + "Android Version = " + Build.VERSION.RELEASE + "\n\n" + + "Manufacturer = " + Build.MANUFACTURER + "\n\n" + + "Model = " + Build.MODEL + "\n\n" + + "Hardware = " + Build.HARDWARE + "\n\n" + + "Webview User Agent = " + webviewUserAgent + "\n\n" + "ACRA UUID = " + Installation.id(this) + "\n\n" + "Scheduler = " + schedName + "\n\n" + "Crash Reports Enabled = " + isSendingCrashReports() + "\n\n" + @@ -236,6 +240,14 @@ public String copyDebugInfo() { return debugInfo; } + private String getWebviewUserAgent() { + try { + return new WebView(this).getSettings().getUserAgentString(); + } catch (Throwable e) { + AnkiDroidApp.sendExceptionReport(e, "Info::copyDebugInfo()", "some issue occured while extracting webview user agent"); + } + return null; + } private boolean isSendingCrashReports() { return AnkiDroidApp.isAcraEnbled(this, false);