fix(ime): exitFloatingMode used LinearLayout.LayoutParams on the docked root (#43) - #45
Merged
Merged
Conversation
…ed root (#43) PostHog crash on Samsung tablet / Android 16: ClassCastException: LinearLayout$LayoutParams cannot be cast to FrameLayout$LayoutParams The docked root's parent is the IME window's FrameLayout-based DecorView. onCreateInputView and enterFloatingMode both correctly use FrameLayout.LayoutParams (the code comment at line 115 documents this exact class being fixed before), but exitFloatingMode at line 248 was setting LinearLayout.LayoutParams — the ONLY remaining path with the wrong type. Every Float → Dock transition armed the crash; the next layout pass (Choreographer.doFrame → DecorView.onMeasure → cast) fired it. One-line fix + a comment matching the existing two correct sites. Signed-off-by: will wade <willwade@gmail.com>
- setDockedHeight(heightPx): single site for docked root LayoutParams, making the wrong-type bug (#43) structurally impossible instead of merely absent at three copy-pasted call sites - imeHeightPx(): shared height formula (was duplicated between onCreateInputView and exitFloatingMode — drift would give different dock heights after Float → Dock) - windowManager.updateViewLayout in the drag handler wrapped in try/catch: a queued ACTION_MOVE after onDestroy removes the overlay → IllegalArgumentException (same lifecycle-race family as #43) Review score: 8/10 (gate met first pass; fix verified exhaustive against all layoutParams paths in the file). Signed-off-by: will wade <willwade@gmail.com>
Contributor
Author
Review-loop summary (1 pass, 8/10 — gate met)Verified correct: the one-line fix closes the last wrong-type path — all three Fixes applied from the review (5b71871):
Noted as follow-ups (not blocking):
|
…ndroid The android-actions/setup-android@v3 action fails on ubuntu-24.04 runners with 'Failed to find package tools' — the pre-installed SDK conflicts with the action's sdkmanager invocation. Pinning to ubuntu- 22.04 (which the release workflow already uses successfully) unblocks both open PRs. Signed-off-by: will wade <willwade@gmail.com>
…on's sdkmanager fails on current runner images android-actions/setup-android@v3 fails with 'Failed to find package tools' on both ubuntu-22.04 and ubuntu-24.04 — the cmdline-tools 16.0 it installs conflicts with the runner's pre-installed SDK repository. The runners already have the SDK; the action was only needed for the sdkmanager call, which we now run directly (with yes| for the license prompt and || true so a transient sdkmanager hiccup doesn't block a PR whose Gradle build would succeed anyway). Signed-off-by: will wade <willwade@gmail.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.
Fixes #43.
Root cause
DasherImeService.exitFloatingMode()(line 248) setLinearLayout.LayoutParamson the docked root. But the docked root's parent is the IME window'sFrameLayout-based DecorView — the next layout pass (Choreographer.doFrame → DecorView.onMeasure → FrameLayout.onMeasure) tries to cast the child'sLayoutParamstoFrameLayout.LayoutParamsand crashes.This bug was already found and fixed twice — the code comment at line 115 documents the original fix, and
enterFloatingMode(the Float shrink, line 209) also correctly usesFrameLayout.LayoutParams. But the exit path (Dock button → return to full keyboard) was the one remaining site with the wrong type. Every Float → Dock transition armed the crash.The crash path from the user report
Fix
One line:
LinearLayout.LayoutParams→android.widget.FrameLayout.LayoutParamsat line 248, with a comment matching the existing two correct sites.Testing
Manual verification needed: enter Float mode, tap Dock, type — no crash. The crash was
$exception_handled: true(caught by the handler, not a hard crash) but still breaks the keyboard.Companion: #44 (ProGuard mapping upload — needed for readable stacks on the next crash).