Fix crash on start in release due to WebView remote debug pref#6841
Merged
TimoPtr merged 1 commit intoMay 13, 2026
Merged
Conversation
Member
Author
|
Chromium source for the crash says this function is essentially a no-op in debug: https://source.chromium.org/chromium/chromium/src/+/main:android_webview/glue/java/src/com/android/webview/chromium/SharedStatics.java;l=166;drc=875e15c94d995212867016abd2651d71f1c9f4b4 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an app-start crash in release builds by ensuring WebView.setWebContentsDebuggingEnabled(...) is invoked on the main (UI) thread when initializing the global WebView remote debugging preference in HomeAssistantApplication.
Changes:
- Compute the effective WebView debugging flag (
BuildConfig.DEBUG || pref) during app startup. - Switch to
Dispatchers.Mainbefore callingWebView.setWebContentsDebuggingEnabled(...)to satisfy WebView’s threading requirement.
TimoPtr
approved these changes
May 12, 2026
cddu33
added a commit
to cddu33/android
that referenced
this pull request
May 14, 2026
* Introduce WebViewAction and enforce EvaluateScriptUsage (home-assistant#6713) * Introduce WebViewActions and enforce EvaluateScriptUsage * Apply Copilot feedback * Update app/src/main/kotlin/io/homeassistant/companion/android/frontend/WebViewAction.kt Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> --------- Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> * Update github/codeql-action action to v4.35.2 (home-assistant#6728) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update ruby/setup-ruby action to v1.302.0 (home-assistant#6731) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Bump changelog_master.xml for weekly release 2026.4.5 (home-assistant#6730) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Handle missing client certificate chooser activity (home-assistant#6716) * Add support for Gesture in FrontendScreen (home-assistant#6714) --------- Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> * Update lokalise/lokalise-pull-action action to v5.2.1 (home-assistant#6724) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Enable cookie in FrontendScreen (home-assistant#6715) * Update dependency io.sentry:sentry-android-core to v8.39.1 (home-assistant#6732) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Update fastlane to 2.233.0 (home-assistant#6737) * Allow artifacts update for Ruby with renovate (home-assistant#6738) * Add support for NFC write in FrontendScreen (home-assistant#6719) * Add support for NFC write in FrontendScreen * Apply suggestions * Apply suggestion and improve NfcSetupActivity * Renovate: split Compose screenshot updates from other com.android updates (home-assistant#6743) * Update runConfigurations to work properly on Android 17 (home-assistant#6740) * Update com.android.* (home-assistant#6675) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> * Remove Trigger workflow step from Renovate lockfile worflow (home-assistant#6747) * Remove unnecessary permissions for actions (home-assistant#6748) * Adjust LaunchActivity configChanges flags (home-assistant#6751) * Ignore Chromium keystore disk write strict mode issue (home-assistant#6758) * Add start workers in LaunchActivity (home-assistant#6720) * Introduce check location disabled usecase and show Changelog on LaunchActivity (home-assistant#6734) * Add support for Zoom in FrontendScreen (home-assistant#6739) * Allow observeChanges on LocalStorate * Update dependency sh.calvin.reorderable:reorderable to v3.1.0 (home-assistant#6761) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Initialize Timber before Application.onCreate (home-assistant#6757) * Disable microwakeword test on wearOS (home-assistant#6766) * Add lint rule for webview evaluate javascript (home-assistant#6741) * Configure Composer diagnostic stacktrace (home-assistant#6764) * Ignore JobService leak in InstrumentationTest for API23 (home-assistant#6765) --------- Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> * Update ruby/setup-ruby action to v1.304.0 (home-assistant#6770) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update ruby/setup-ruby action to v1.305.0 (home-assistant#6772) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency ruby to v4.0.3 (home-assistant#6762) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Lock file maintenance (home-assistant#6783) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Bump changelog_master.xml for weekly release 2026.4.6 (home-assistant#6778) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> * Update dependency io.sentry:sentry-android-core to v8.40.0 (home-assistant#6775) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Update dependency androidx.navigation:navigation-testing to v2.9.8 (home-assistant#6776) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> * Update org.jetbrains.kotlin.* (home-assistant#6774) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> * Update androidx.compose.* (home-assistant#6777) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> * Update com.android.* (home-assistant#6769) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> * Remove the use of Dispachers.Default in AppLockViewModel (home-assistant#6784) * Fix compose unit test and kotlin configuration after update (home-assistant#6785) --------- Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> * Honor user-installed CAs in OkHttp trust store (home-assistant#6753) --------- Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add support for JSConfirm dialog in FrontendScreen (home-assistant#6749) * Fix resize cast for ExoPlayer in WebViewActivity causing blank player (home-assistant#6767) * Fix resize cast for ExoPlayer in WebViewActivity causing blank player * Use Double instead of Float * Enable fullscreen support at the LaunchActivity level (home-assistant#6759) * Enable fullscreen support at the LaunchActivity level * Add missing tests * Update ruby/setup-ruby action to v1.306.0 (home-assistant#6789) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Setup emulator WTF (home-assistant#6768) --------- Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> * Add file chooser capability to FrontendScreen (home-assistant#6755) * Use a queue to handle FileChooserRequest --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Adjust PermissionManager to use awaitResult (home-assistant#6787) * Update Gradle to v9.5.0 (home-assistant#6796) * Update Gradle to v9.5.0 * Update wrapper: gradlew wrapper --gradle-version 9.5.0 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com> * Bump changelog_master.xml for weekly release 2026.5.1 (home-assistant#6795) * Bump changelog_master.xml for weekly release 2026.5.1 * Empty commit for CI --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com> * Lock file maintenance (home-assistant#6802) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Bump changelog_master.xml for weekly release 2026.5.2 (home-assistant#6800) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Use OIDC to authenticate on Emulator.wtf (home-assistant#6803) * Add HTTP basic auth dialog to FrontendScreen (home-assistant#6750) * Introduce HACheckbox * Fix WebViewActivity leak via Handler.postDelayed in waitForConnection (home-assistant#5453) (home-assistant#6791) --------- Co-authored-by: jim-daf <jim-daf@users.noreply.github.com> Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> * Add app lock feature to FrontendScreen (home-assistant#6756) * Add Blur overlay to LaunchActivity * Migrate to AppLockStateManager * Fix leak of WebMessageListener by properly removing it in onDestroy (home-assistant#6805) --------- Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> * Update lokalise/lokalise-pull-action action to v5.2.2 (home-assistant#6807) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update github/codeql-action action to v4.35.3 (home-assistant#6808) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Add ExoPlayer support for FrontendScreen from frontend request (home-assistant#6771) * Introduce FrontendExoPlayerManager * Allow HAApp to make fullscreen request to the LaunchActivity * Add support for ExoPlayer in FrontendScreen * Use Double for resize * Use ktx * Fix unit test * Fix tests * Apply Copilot feedbacks * Apply last suggestions * Apply suggestions on tests * Bump Gradle actions to 6.1.0 and use basic cache provider (home-assistant#6811) * Update aboutlibraries to v14.1.0 (home-assistant#6809) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com> * Add support for custom view in FrontendScreen (home-assistant#6790) Instanciate the HAWebChromeClient from Compose to get the custom view * Support for auto play video in FrontendScreen (home-assistant#6806) * Support for auto play video in FrontendScreen * Adjust logic to address Copilot concern * Update app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendViewModel.kt Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> * Make observeChanges support multiples keys * Move entirely to LocalStorage --------- Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> * Update com.android.* (home-assistant#6820) * Update com.android.* * Update dependency lockfiles * Empty commit for CI --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com> * Update androidx.compose.* (home-assistant#6823) * Update androidx.compose.* * Update dependency lockfiles * Empty commit for CI --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com> * Update dependency com.google.android.gms:play-services-wearable to v20 (home-assistant#6797) * Update dependency com.google.android.gms:play-services-wearable to v20 * Update dependency lockfiles * Empty commit for CI --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com> * Update github/codeql-action action to v4.35.4 (home-assistant#6830) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Lock file maintenance (home-assistant#6833) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency com.google.firebase:firebase-bom to v34.13.0 (home-assistant#6831) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Bump changelog_master.xml for weekly release 2026.5.3 (home-assistant#6827) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Update org.jetbrains.kotlin.* to v1.11.0 (home-assistant#6832) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> * Introduce RequestAccurateLocationReceiver and restrict LocationSensorManager export (home-assistant#6837) Introduce RequestAcurateLocationReceiver to stop exporting LocationSensorManager * Update aboutlibraries to v14.2.0 (home-assistant#6828) * Update aboutlibraries to v14.2.0 * Update dependency lockfiles * Empty commit for CI --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com> * Update dependency com.slack.lint.compose:compose-lint-checks to v1.4.3 (home-assistant#6825) * Update dependency com.slack.lint.compose:compose-lint-checks to v1.4.3 * Update dependency lockfiles * Empty commit for CI --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com> * Restore HTTP 404/410 handling for updating registration (home-assistant#6835) * Update dependency io.sentry:sentry-android-core to v8.41.0 (home-assistant#6826) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Move the debug flag for WebView into the Application and Settings (home-assistant#6813) * Update androidx.* (home-assistant#6824) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> * Add Improv external bus messages models (home-assistant#6817) * Fix crash on start in release due to WebView remote debug pref (home-assistant#6841) * Add support for PiP for FrontendScreen (home-assistant#6812) * Deprecated the old Material Design 2 theme to avoid using it (home-assistant#6815) * Deprecated the old Material Design 2 theme to avoid using it * Remove Autofix * Add action to open Settings View from Automotive main screen (home-assistant#6834) * Migrate TagReaderActivity to use BottomSheet and add confirmation buttons (home-assistant#6814) * Support next.home-assistant.io in Debug * Make TagReaderActivity standalone and translucent * Add preference to stored allowed tag and clearing in dev settings * Introduce PainterResourceUtil to load app icon --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> * Update emulator wtf actions (home-assistant#6843) * isDrivingDistracted --------- Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com> Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Runye Zhang <dev@zry.io> Co-authored-by: Dimitris Dafnis <68849116+jim-daf@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Joris Pelgröm <joris.pelgrom@gmail.com> Co-authored-by: jim-daf <jim-daf@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a crash on start in release builds on start after merging #6813 due to calling
WebView.setWebContentsDebuggingEnablednot on the main thread, by moving this call to the main thread.This doesn't seem to be an issue in debug builds, and also isn't a timing issue (removing
BuildConfig.DEBUGfrom the condition or introducing artificial delays doesn't introduce the crash in debug).The preference change in settings is already done on the main thread.
Checklist
Screenshots
n/a
Link to pull request in documentation repositories
n/a
Any other notes