Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions app/src/main/java/at/dasher/android/DasherImeService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,25 @@ class DasherImeService : InputMethodService() {

private fun createEngine() {
// Re-entry guard (#73): onCreateInputView can run again on a LIVE
// instance (configuration change; some OEM IME-switch flows keep the
// service alive). The engine is per-process by design ("created once
// per process", #53/#56) — a second one would leak the first with
// BOTH running dasher_frame loops into the same canvas. Reuse it;
// the new canvas wires itself through the fields, and its size
// callback reaches the engine (it is no longer null here).
if (engine != null) return
// instance (configuration change — rotation, fold, MuMu's resizable
// window; some OEM IME-switch flows keep the service alive). The
// engine is per-process by design ("created once per process",
// #53/#56) — a second one would leak the first with BOTH running
// dasher_frame loops into the same canvas. Reuse it.
if (engine != null) {
// #76: the recreated view tree built a FRESH loading overlay
// (visible by default) — the hide at the end of this function
// sits below the guard and never ran, so the keyboard came up
// as a dead, overlay-covered panel ("a big float-like window
// you can't type on"; repro'd via rotation on the API 33
// emulator: zero colorful canvas pixels). Hide it now and
// re-push the canvas geometry to the surviving engine.
loadingOverlay?.visibility = View.GONE
canvasView?.let { v ->
if (v.width > 0 && v.height > 0) engine?.onSurfaceSizeChanged(v.width, v.height)
}
return
}
val dataDir = DataInstaller.ensureInstalled(this)
// User state (settings, training) lives outside the data dir so a
// data re-extraction can never wipe it.
Expand Down Expand Up @@ -652,6 +664,9 @@ class DasherImeService : InputMethodService() {
if (type != 0 && type != 1 && type != 2) {
Log.w(TAG, "Unknown engine output event type $type (text='${text.take(32)}')")
}
if (text.isNotEmpty()) {
Log.d(TAG, "output event type=$type len=${text.length}")
}
outputCoalescer.onEngineOutput(type, text)
}
eng.setMessageListener { _, msg ->
Expand Down
Loading