Repository navigation
Fix 22091 shared decks safewebview - #22691
Conversation
1642556 to
f04626c
Compare
|
Snapshot diff report: Previous regressions were resolved by the latest commit. |
mikehardy
left a comment
There was a problem hiding this comment.
Assisted-by: prep verification (near-frontier withheld — unit red on act SHA)
Thanks for the shared-decks SafeWebView work.
Checked out the PR branch and rebased cleanly onto current ankidroid/main without pushing. On LOCAL_TIP 6c3fa6c18188ed74c7cde9a1a6f97729b634abab (act SHA remains PRE_TIP f04626c507f25c777c06982ba08cb08ecfe20646): ./gradlew -p buildSrc test, lintAll / ktlintCheck / lint-rules:test, and jacocoUnitTestReport on emulator-5554 / API36_GAPI_PS16K (cold-boot). Lint passed; unit failed.
SharedDecksDownloadFragmentTest.rate limited download with an AnkiDroid login redirects the WebView to the login page fails with ClassCastException: com.ichi2.anki.SafeWebViewLayout cannot be cast to android.webkit.WebView at SharedDecksDownloadFragmentTest.kt:384. The same test is red on all three GitHub JUnit jobs for this tip. Solo rerun of that test on current main passes, so this looks PR-caused after swapping the activity layout to SafeWebViewLayout.
Please update the fragment test (and any WebView-typed lookup) to match the new container, or expose the embedded WebView the way SharedDecksActivityTest already does. I am not approving while unit CI is red on this SHA.
f04626c to
28d3e3c
Compare
28d3e3c to
e77fb98
Compare
|
Conflict in Resolution: kept Pre-push, API33_GAPI (
Assisted-by: Grok 4.7 Medium |
e77fb98 to
0058328
Compare
mikehardy
left a comment
There was a problem hiding this comment.
Assisted-by: grok-4.7-medium
Thanks for iterating on the shared-decks WebView fix.
I did not check out or rebase this tip locally, and I did not run lint, unit, or emulator Gradle lanes on this SHA (prep stopped on required-red CI before local validation).
The diff still centers on SharedDecksActivity, the SafeWebViewLayout workaround, activity_shared_decks.xml, and the shared-deck unit tests that exercise the WebView container.
Blocker: the required GitHub Actions compare job is failing on 0058328ed65b85d01468cb25411ce2d59dcc934a. Please fix the screenshot regression or update baselines so compare is green before we can approve.
0058328 to
415757a
Compare
|
Thanks @mikehardy! |
david-allison
left a comment
There was a problem hiding this comment.
GPT-6 felt the back button needed improving
@Test
fun `back exits while the recovered WebView is loading`() {
val activity = startSharedDecks()
val initialWebView = activity.webView
val homeUrl = getResourceString(R.string.shared_decks_url)
val deckUrl = "https://ankiweb.net/shared/info/1"
shadowOf(initialWebView).pushEntryToHistory(homeUrl)
initialWebView.webViewClient.doUpdateVisitedHistory(initialWebView, homeUrl, false)
assertFalse(activity.onBackPressedDispatcher.hasEnabledCallbacks())
shadowOf(initialWebView).pushEntryToHistory(deckUrl)
initialWebView.webViewClient.doUpdateVisitedHistory(initialWebView, deckUrl, false)
assertTrue(initialWebView.canGoBack())
assertTrue(activity.onBackPressedDispatcher.hasEnabledCallbacks())
// Invoke the installed client, as Android does when the renderer exits.
assertTrue(initialWebView.webViewClient.onRenderProcessGone(initialWebView, mock()))
assertNotSame(initialWebView, activity.webView)
assertFalse(activity.webView.canGoBack())
assertFalse(activity.isFinishing)
// Robolectric has not delivered the replacement page's history callback yet.
activity.onBackPressedDispatcher.onBackPressed()
assertTrue(activity.isFinishing, "Back should exit while the replacement WebView has no history")
}
|
CI is failing |
f336a8d to
6e6d226
Compare
6e6d226 to
2be6cfa
Compare
2be6cfa to
11e2d04
Compare
|
Hi @mikehardy I have pushed the updates and changes as requested, could you review whenever you get time |
mikehardy
left a comment
There was a problem hiding this comment.
Assisted-by: Grok 4.7
Thank you — SafeWebViewLayout recovery plus fixing Back after renderer death closes the shared-decks crash loop.
Locally I rebased onto main without force-pushing (prep stayed at the PR tip). I ran lint (lintAll, ktlintCheck, lint-rules:test), unit tests (jacocoUnitTestReport), and release emulator tests (TEST_RELEASE_BUILD=true via run_emulator_tests.py on emulator-5556 / API35_GAPI); all passed.
Reviewed SharedDecksActivity hosting SafeWebViewLayout, render-process recreation reloading the home URL, back callback disabled after recovery until history returns, and tests/screenshots using the inner WebView.
some acceptable findings, no action required, just leaving for posterity: one commit title oversells activity support; copyBackForwardList bypasses activeWebView; a shorter subject for the shared-deck fix commit.
Note
Assisted-by: Claude Sonnet
Purpose / Description
Migrates
SharedDecksActivityto useSafeWebViewLayoutto address[MissingOnRenderProcessGone]from #22091.clearHistory()andsetDownloadListener()delegates toSafeWebViewLayout.OnWebViewRecreatedListeneronSharedDecksActivityto re-apply WebView settings and reload the URL on recovery.SharedDeckWebViewClientbase class withSafeWebViewClientand teardown withbinding.webView.safeDestroy().SharedDecksActivityTestcovering render process crash recovery and destroy cleanup.Fixes
MissingOnRenderProcessGone] #22091Approach
activity_shared_decks.xmlto useSafeWebViewLayout.OnWebViewRecreatedListenerinSharedDecksActivity.kt.clearHistory()andsetDownloadListener(...)inSafeWebViewLayout.kt.SharedDecksActivityTest.kt.How Has This Been Tested?
:AnkiDroid:testPlayDebugUnitTest --tests com.ichi2.anki.shareddeck.SharedDecksActivityTest(all 4 passed):AnkiDroid:testPlayDebugUnitTest --tests com.ichi2.anki.workarounds.SafeWebViewLayoutTest(all 9 passed)ktlintMainSourceSetCheck&ktlintTestSourceSetCheck(all passed)Checklist
Please, go through these checks before submitting the PR.