Skip to content

fix(ime): docked choice survives keyboard switches — self-healing mode restore, engine re-entry guard, unbind cleanup - #74

Merged
willwade merged 1 commit into
mainfrom
fix/ime-float-mode-restore
Oct 15, 2026
Merged

willwade merged 1 commit into
mainfrom
fix/ime-float-mode-restore

Conversation

@willwade

Copy link
Copy Markdown
Contributor

Fixes #73.

Heide (testing v0.1.21, before v0.1.22): "The IME still starts in float mode, then you have to tap on dock. Then it's fine unless you switch keyboards."

Not a v0.1.22 regression — v0.1.22's IME changes are output batching + force-show. This hardens #64's mode-remember machinery, which has three lifecycle holes found by inspection:

  1. onCreateInputView re-entry on a live instance (config change; OEM IME-switch flows that keep the service alive): createEngine() built a second engine — the first kept its dasher_frame loop, both submitting into the same canvas — and a stale floating=true made the posted restore early-return inside enterFloatingMode(), presenting a dead overlay canvas as "floating" over a full-height docked root. Tap Dock → clean; switch keyboards → repeats. This matches the report verbatim.
  2. No onUnbindInput cleanup — a surviving service left the overlay hovering over the next keyboard.
  3. exitFloatingMode early-returned on floatingView == null — a swallowed removeView failure (Samsung overlay quirks, cf. Floating window drag: horizontal moves opposite on Samsung (Galaxy Fold 5) — gravity + y-axis inversion #46) stranded a dead overlay over every subsequent show.

Changes (single file, +51/−4)

Testing

  • :app:assembleDebug + :app:testDebugUnitTest green locally
  • Manual on Heide's device (Samsung/Android 16): dock → switch to SwiftKey → switch back → still docked, no dead overlay
  • Float → switch away → back: overlay gone during the other keyboard, float restored on return

Given #71's human review is pending, happy to fold this into the same review session.

…e restore, engine re-entry guard, unbind cleanup (#73)

Heide (v0.1.21): "The IME still starts in float mode, then you have to
tap on dock. Then it's fine unless you switch keyboards." Not a v0.1.22
regression — v0.1.22's IME changes are output batching + force-show;
this is the #64 mode-remember machinery, which has three lifecycle holes:

- onCreateInputView can run again on a LIVE instance (configuration
  change; some OEM IME-switch flows keep the service alive). On re-entry
  createEngine() built a SECOND engine (the first kept its dasher_frame
  loop — both submitting into the same canvas), and a stale floating=true
  made the posted restore early-return inside enterFloatingMode(): a dead
  overlay canvas presented as floating over a full-height docked root.
  Tap Dock → clean; switch keyboards → the cycle repeated.
- No onUnbindInput cleanup: a surviving service left the overlay
  hovering over the next keyboard.
- exitFloatingMode early-returned when floatingView was null — a
  swallowed removeView failure (Samsung overlay quirks, cf. #46) stranded
  a dead overlay over every subsequent show.

Fixes:
- createEngine: re-entry guard — the engine is per-process by design
  (#53/#56); a second one leaked the first.
- Posted restore: self-heal — if floating, exitFloatingMode(persist=
  false) FIRST, then evaluate the saved preference, so every keyboard
  show converges to the persisted mode regardless of view recreation.
- onUnbindInput: exit floating without persisting (the saved mode stays
  the user's deliberate choice; it is re-evaluated on the next show).
- exitFloatingMode: never early-return on a missing overlay window —
  mode state and docked layout are restored regardless; removeView
  failures now log.

Manual verification still needed on Heide's device (Samsung/Android 16)
to confirm which path she hits; all three are hardened.

Signed-off-by: will wade <willwade@gmail.com>
@willwade
willwade merged commit d57a5e4 into main Oct 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IME: keyboard starts in float mode after switching keyboards — docked choice doesn't survive (Heide, pre-v0.1.22)

1 participant