Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the CallWebView logs to our logging stack #3637

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

jmartinesp
Copy link
Member

Content

Intercept the logs for the Element Call webview and log them using Timber so they go through our logging system.

Motivation and context

Element Call logs were lost in nightly and release versions of the app since they're not printed to the logcat or saved to disk, so it's very difficult to debug issues unless it's in a debug version.

Tests

  • Open a call using EXA.
  • Check the logcat, send a rageshake or check the logs using the bug report file viewer.
  • Check there are [WebView] prefixed logs inside.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 14

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

@jmartinesp jmartinesp added the PR-Bugfix For bug fix label Oct 9, 2024
@jmartinesp jmartinesp requested a review from a team as a code owner October 9, 2024 16:18
@jmartinesp jmartinesp requested review from bmarty and removed request for a team October 9, 2024 16:19
Copy link
Contributor

github-actions bot commented Oct 9, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/uoiNoA

Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 82.74%. Comparing base (7a45024) to head (2f2d851).
Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
...nt/android/features/call/impl/ui/CallScreenView.kt 0.00% 14 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3637      +/-   ##
===========================================
- Coverage    82.77%   82.74%   -0.03%     
===========================================
  Files         1747     1747              
  Lines        41391    41405      +14     
  Branches      5015     5016       +1     
===========================================
  Hits         34260    34260              
- Misses        5358     5372      +14     
  Partials      1773     1773              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but are we sure that the log from the WebView will not contain any sensitive data?

@@ -189,6 +191,11 @@ private fun WebView.setup(
override fun onPermissionRequest(request: PermissionRequest) {
onPermissionsRequested(request)
}

override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
consoleMessage?.let { Timber.d("[WebView]: ${it.message()}") }
Copy link
Member

@bmarty bmarty Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could maybe have a better mapping using other provided fields:

override fun onConsoleMessage(consoleMessage: ConsoleMessage): Boolean {
    val priority = when (consoleMessage.messageLevel()) {
        ConsoleMessage.MessageLevel.ERROR -> Log.ERROR
        ConsoleMessage.MessageLevel.WARNING -> Log.WARN
        else -> Log.DEBUG
    }
    Timber.tag("[WebView]").log(
        priority = priority,
        message = buildString {
            append(consoleMessage.sourceId())
            append(":")
            append(consoleMessage.lineNumber())
            append(" ")
            append(consoleMessage.message())
        },
    )
    return true
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmartinesp
Copy link
Member Author

Thanks, but are we sure that the log from the WebView will not contain any sensitive data?

According to @toger5 they don't contain sensitive data, the only thing that could be considered 'sensitive' are user ids, but that should be fine to log.

Copy link

sonarcloud bot commented Oct 10, 2024

@jmartinesp jmartinesp added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 10, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 10, 2024
@jmartinesp jmartinesp enabled auto-merge (squash) October 10, 2024 13:44
@jmartinesp jmartinesp merged commit c6d3ad8 into develop Oct 10, 2024
28 of 30 checks passed
@jmartinesp jmartinesp deleted the fix/jme/include-webview-logs-in-rageshakes branch October 10, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bugfix For bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants