Repository navigation
Description
Summary
在 Android 上使用 OpenLess IME 时,用户报告:在 OpenLess 自己的词典/类似文本输入框中输入内容后,点击 Backspace(或 Delete)会出现明显的逐字符卡顿;每删一个字符都要等待一段时间。用户尚未确认是否所有 OpenLess 输入框、所有输入模式或外部应用都复现。
本报告不把“词典”当作已确认根因:用户只知道问题是在编辑这类文本后出现,具体触发操作和平台细节仍需补齐。
Environment and supplied log
- 平台:从 supplied log 首行
OpenLess mobile 启动推断为 Android/mobile;确切设备、Android 版本、APK build 尚未知。 - 日志时间:2026-12-01 12:39:45Z–14:32:45Z。
- 日志大小/行数:8,417,407 bytes / 35,336 lines。
- 日志包含 89 个 capture/session,32,415 行重复的
[OpenLessDbg58c22b]状态通知警告。 - 日志中没有
Backspace、Delete、keydown、keyup、vocab、dictionary、词典或输入框耗时记录,因此它不能直接证明删除卡顿或定位根因。原始日志未上传,避免公开可能包含的个人内容。
Source-level leads from current upstream beta
调查固定在上游 beta SHA 10d8b533b4832d20f7354f60c46b7fdf3b4c9e95。
Android Rime path
The recent Android Rime migration (#1455, merged on December 1, 2026 at 04:14:41 UTC) is a plausible regression window. Its PR description explicitly left Android APK/Kotlin/real-device interaction validation pending.
In the current beta:
- Pinyin-mode Backspace enters
RimePinyinController.backspace()throughOpenLessImeService.englishDeleteBackward():
openless/openless-all/android/kotlin/OpenLessImeService.kt
Lines 1334 to 1348 in 10d8b53
/** Backspace on the English keyboard: same field edit as everywhere else, plus keeping englishComposingWord (and therefore the candidate bar) in sync. In Pinyin mode, deletes from the (never-committed) encoding instead — falls back to the normal field edit only once the encoding is already empty (plan 3.3: "编码为空时 Backspace 恢复现有普通删除"). */ private fun englishDeleteBackward() { if (latinInputMode == LatinInputMode.PINYIN) { rimePinyinController.backspace({ renderPinyinCandidates(it) }, { rimePinyinController.resetAssociationContext() deleteBackward() }) return } clearEnglishAutoText() deleteBackward() if (englishComposingWord.isNotEmpty()) { englishComposingWord.deleteCharAt(englishComposingWord.length - 1) } updateEnglishCandidates() - Each request is queued on the single shared
RimeTaskQueueand may perform nativestate,key=65288,candidates, and main-thread delivery:
openless/openless-all/android/kotlin/RimePinyinController.kt
Lines 58 to 142 in 10d8b53
private fun submit(operation: String, argument: String, update: (List<String>) -> Unit, emptyAction: (() -> Unit)? = null) { val epoch = generation val revision = ++requestId if (!OpenLessRime.isReady && operation != "state") { statusHint = "词库初始化中…" main.post { if (epoch == generation && revision == requestId && !OpenLessRime.isReady) update(candidates) } } worker.execute { try { if (epoch != generation) return@execute OpenLessRime.initialize(context) // A dictionary import/export or a fuzzy-pinyin redeploy closed every native session. if (session.isNotEmpty() && sessionGeneration != OpenLessRime.sessionGeneration) { // A failed editor write still belongs to this editor even if // maintenance closed the native session before its retry. session = "" } if (session.isEmpty()) { sessionGeneration = OpenLessRime.sessionGeneration session = OpenLessRime.request("create", "", if (learning) "learning" else "private").getString("session") } if (pending.isNotEmpty()) { check(deliver(pending, epoch)) { "Editor write failed" } OpenLessRime.request("ack", session); pending = "" } if (pendingLiteral.isNotEmpty()) { check(deliver(pendingLiteral, epoch)) { "Editor write failed" } pendingLiteral = "" } // Inspect the native composition on the worker, after all earlier keys. // UI snapshots may lag behind fast typing or an in-flight commit. var state = OpenLessRime.request("state", session) val composing = state.optString("input").isNotEmpty() val nativeOperation = when (operation) { "backspace", "space", "confirmFirst" -> if (composing) "key" else "state" "literal" -> if (argument == "'" && composing) "key" else "confirm" "commitRaw" -> if (composing) "clear" else "state" else -> operation } val rawBeforeClear = if (operation == "commitRaw" && composing) state.optString("input") else "" val nativeArgument = when (operation) { "backspace" -> "65288" "space", "confirmFirst" -> "32" "literal" -> if (argument == "'" && composing) "39" else argument "commitRaw" -> "" else -> argument } if (!composing && operation in listOf("backspace", "space", "confirmFirst", "commitRaw")) { if (operation == "space") check(deliver(" ", epoch)) { "Editor write failed" } else check(onEditor(epoch) { emptyAction?.invoke(); true }) { "Editor unavailable" } } else { state = OpenLessRime.request(nativeOperation, session, nativeArgument) } if (operation == "literal" && nativeOperation == "confirm") pendingLiteral = argument if (rawBeforeClear.isNotEmpty()) pendingLiteral = rawBeforeClear pending = state.optString("commit") if (pending.isNotEmpty()) { check(deliver(pending, epoch)) { "Editor write failed" } state = OpenLessRime.request("ack", session); pending = "" } if (pendingLiteral.isNotEmpty()) { check(deliver(pendingLiteral, epoch)) { "Editor write failed" } pendingLiteral = "" } if (epoch != generation || revision != requestId) return@execute state = OpenLessRime.request("candidates", session) val input = state.optString("input") val preedit = state.optString("preedit").ifEmpty { input } val rows = state.optJSONArray("candidates") val result = if (rows == null) emptyList() else (0 until rows.length()).map { rows.getString(it) } val contextForPrediction = predictionContext val ranked = if (input.isNotEmpty() && learning && OpenLessAndroidPreferences.strokeAssociationEnabled(context)) { RimePrediction.rank(result, contextForPrediction) } else result main.post { if (epoch != generation || revision != requestId) return@post val displayed = if (predictionContext == contextForPrediction) ranked else result statusHint = null // Keep the native order for selection indices; only reorder the visible list. encoding = input; preeditText = preedit; candidates = result; cloudChoices = emptySet() candidateRevision = state.optLong("revision"); update(displayed) scheduleCloud(input, displayed, epoch, revision, update) - The queue is shared by input/editor delivery and session-closing maintenance:
openless/openless-all/android/kotlin/RimeTaskQueue.kt
Lines 7 to 22 in 10d8b53
/** Input (including editor delivery and ack) and session-closing maintenance share one queue. */ internal object RimeTaskQueue { @Volatile private var workerThread: Thread? = null val executor = Executors.newSingleThreadExecutor { task -> Thread(task, "openless-rime").apply { isDaemon = true workerThread = this } } /** Maintenance callers are off the main thread; nested calls on this queue run directly. */ fun <T> run(task: () -> T): T { if (Thread.currentThread() === workerThread) return task() return try { executor.submit(Callable { task() }).get() } catch (error: InterruptedException) { - Rime user-dictionary import and fuzzy-pinyin redeploy also use that queue:
openless/openless-all/android/kotlin/OpenLessRime.kt
Lines 167 to 194 in 10d8b53
/** Writes the pinyin user dictionary snapshot to [target]; false when nothing has been learned yet. Off the main thread. */ fun exportUserDictionary(context: Context, target: File): Boolean = RimeTaskQueue.run { initialize(context) closingSessions("user_dict_export", target.absolutePath).optBoolean("exported") } /** Validates and merges learned entries only; imported deletion markers cannot remove local words. Off the main thread. */ fun importUserDictionary(context: Context, source: File) = RimeTaskQueue.run { val snapshot = RimeUserDictionaryFile.forImport(source.readText()) val normalized = File.createTempFile("pinyin-import-", ".userdb.txt", context.cacheDir) try { normalized.writeText(snapshot) initialize(context) closingSessions("user_dict_import", normalized.absolutePath) Unit } finally { normalized.delete() } } /** Rewrites both pinyin schemas' patches for [groups] and redeploys them. Off the main thread. */ fun applyFuzzyPinyin(context: Context, groups: Set<String>) = RimeTaskQueue.run { initialize(context) val patch = RimeFuzzyPinyin.customYaml(groups) for (schema in listOf("openless_pinyin_learning", "openless_pinyin_private")) { val file = File(context.filesDir, "rime-user/$schema.custom.yaml") if (patch == null) file.delete() else file.writeText(patch) } closingSessions("redeploy", "") Unit - English-mode Backspace re-queries English candidates after every deletion:
openless/openless-all/android/kotlin/OpenLessImeService.kt
Lines 1802 to 1823 in 10d8b53
/** * Re-queries EnglishCandidateProvider for the current englishComposingWord * prefix (or clears the bar if suggestions are off / nothing is being * typed) — called after every letter, backspace, and word boundary. * englishCandidateQueryEpoch discards a stale async result that comes * back after a faster subsequent keystroke already moved the prefix on. */ private fun updateEnglishCandidates() { val epoch = ++englishCandidateQueryEpoch if (typingPanel == null) return if (!personalizedLearningAllowed() || !englishSuggestionsEnabled()) { renderEnglishCandidates(emptyList()) return } val prefix = englishComposingWord.toString() if (prefix.isEmpty()) { renderEnglishCandidates(emptyList()) return } englishCandidateProvider.queryTopN(prefix, ENGLISH_CANDIDATE_QUERY_LIMIT) { results -> if (epoch == englishCandidateQueryEpoch) renderEnglishCandidates(results) }
This is a candidate mechanism, not a confirmed root cause. The supplied log lacks the timings needed to distinguish queue wait, native Rime latency, candidate callback backlog, InputConnection latency, and target WebView rendering.
Global Dictionary action
The clipboard Dictionary action calls the Android native bridge asynchronously and then refreshes the panel:
openless/openless-all/android/kotlin/OpenLessImeService.kt
Lines 1603 to 1665 in 10d8b53
private fun renderClipboardPanel() { val panel = clipboardPanel ?: return val epoch = sessionEpoch val all = OpenLessClipboardHistory.load(this).distinctBy { it.text } val vocabulary = if (clipboardHistoryMode && isBackendReady()) { runCatching { val array = org.json.JSONArray(OpenLessNative.nativeVocabularyPhrases()) (0 until array.length()).mapTo(mutableSetOf()) { array.getString(it) } }.getOrDefault(emptySet()) } else emptySet() fun item(entry: ClipboardEntry) = ImeClipboardPanel.Item( text = entry.text, favorite = entry.favorite, inDictionary = entry.text in vocabulary, select = { if (clipboardActionCurrent(epoch)) pasteClipboardHistory(entry.text) }, toggleFavorite = { if (clipboardActionCurrent(epoch)) { OpenLessClipboardHistory.toggleFavorite(this, entry.text) renderClipboardPanel() } }, remove = { if (clipboardActionCurrent(epoch)) { OpenLessClipboardHistory.delete(this, entry.text) renderClipboardPanel() } }, toggleDictionary = { if (clipboardActionCurrent(epoch)) toggleClipboardDictionary(entry.text, entry.text in vocabulary) }, ) panel.render( epoch, clipboardHistoryMode, clipboardSelectionMode, clipboardHistoryCategory.name, OpenLessClipboardHistory.filter(all, clipboardHistoryCategory).map(::item), all.take(3).map(::item), ) panel.setBlocked(dictationEditingLocked()) } private fun pasteClipboardHistory(text: String) { if (currentInputConnection?.commitText(text, 1) == true) { OpenLessClipboardHistory.recordCopy(this, text) clipboardHistoryMode = false renderClipboardPanel() } else { OpenLessNativeNotice.makeText(this, ui("输入连接已失效,未粘贴", "Editor unavailable; nothing pasted"), Toast.LENGTH_SHORT).show() } } private fun toggleClipboardDictionary(text: String, present: Boolean) { if (!isBackendReady()) { ensureBackendReady() OpenLessNativeNotice.makeText(this, ui("词典服务正在准备,请稍后重试", "Dictionary is preparing; please retry"), Toast.LENGTH_SHORT).show() return } runCatching { if (present) OpenLessNative.nativeRemoveVocabularyWord(text) else OpenLessNative.nativeAddVocabularyWord(text) }.onSuccess { renderClipboardPanel() }.onFailure { OpenLessNativeNotice.makeText(this, ui("词典操作失败,请重试", "Dictionary operation failed; please retry"), Toast.LENGTH_SHORT).show() } } openless/openless-all/app/src-tauri/src/android/native_bridge.rs
Lines 897 to 918 in 10d8b53
/// Records a spoken correction as a global Dictionary entry instead of a /// CorrectionRule — the IME's "edit result"/clipboard-correction flows used /// to auto-generate a pattern->replacement rule from every edit; that's now /// hand-maintained only (desktop's Corrections settings page), and these /// flows just remember the corrected word/phrase itself, the same /// mechanism `add_vocab` (commands/dictionary.rs) exposes to the desktop /// Dictionary UI. `add_vocabulary_if_absent` skips silently if the phrase /// is already known, so repeatedly correcting the same word never piles up /// duplicate entries. fn spawn_add_vocabulary_word(phrase: String) { let Some(backend) = CORE_BACKEND.get().cloned() else { log::warn!("[android-native] core backend unavailable"); return; }; if phrase.trim().is_empty() { return; } tauri::async_runtime::spawn(async move { if let Err(error) = backend.add_vocabulary_if_absent(phrase, None) { log::warn!("[android-native] add_vocabulary_if_absent failed: {error}"); } });
The source does not yet prove that the global Dictionary write itself blocks the Rime queue; the report should ask maintainers to distinguish that action from Rime user-dictionary import/redeploy and from ordinary text-field editing.
Reproduction requested
- Record APK version/build, device, Android version, input mode (English/Pinyin/Stroke), and whether Rime user-dictionary import/redeploy was used.
- Reproduce in the OpenLess dictionary-like field, another OpenLess field, and an external app with the same text.
- Compare: no Dictionary action; after Add to Dictionary; after Rime user-dictionary import/redeploy; after IME restart.
- Capture per-key timing for Backspace from action dispatch to visible text change.
- Add bounded timing probes for queue wait, Rime
state/key/candidates,InputConnection, and main-thread candidate rendering, without recording text.
Acceptance criteria
- A Dictionary or Rime maintenance operation cannot indefinitely delay ordinary Backspace.
- Stale per-key Rime requests do not accumulate and consume main-thread work after the user has already deleted further characters.
- Ordinary deletion remains correct for Pinyin composition, English candidate mode, selections, and Unicode/code points.
- The same reproduction is verified on the actual Android device/build, not only by source inspection.
Duplicate check
Searches covered English/Chinese terms for backspace, delete, input lag, keyboard freeze, typing, Rime, Pinyin, dictionary, and 卡顿. Existing #1526 is an Android backspace gesture feature request, not this latency report.
Activity
HKLHaoBin commentedon Dec 2, 2026
Android diagnostic artifact is ready for Issue #1527 testing.
1ce591c7a427a727fa40bd3a2a41fd1541b78635openless-android-release-arm64-v8asha256:da36a86a9fb344bd16bc95645b3cd070bf4f2bba3aba2d8c4cf72ca853c8898c68,279,902bytes2026-12-16 16:17:02 UTCOpenLess_2.0.3_arm64-v8a.apk147,064,647bytesa57f6264ca7c2f46e6cb26f48f41053f399e61fc8cbab7e0cc90d161bc6a903bTesting scope:
key_debug_features_enabledpreference off, then with it enabled.[DEBUG-ISSUE-1527]; do not include typed text, candidate text, host package names, paths, credentials, or raw exceptions.This is an observation-only diagnostic build. It does not claim that the runtime root cause is confirmed or that the issue is fixed. CI and the desktop workflow are still running separately; this Android artifact is the early platform milestone.
HKLHaoBin commentedon Dec 3, 2026
Updated Android diagnostic artifact for Issue #1527 is ready from the reviewed candidate.
bc17628c6e6b3e78d7b1f87076970b76f47ab942openless-android-release-arm64-v8asha256:93ad12938eb22772e8a5ce4bbc4784b048c6d23c2f8351efc376eee246682fd768,285,318bytes2026-12-17 07:40:37 UTCOpenLess_2.0.3_arm64-v8a.apk147,081,027bytes6f8f9af550bb81ff0c105173e7fdd2878d2cf2f69ece9b4beef3d007e2e67eadThis artifact includes the Android instrumentation-compatibility repair and the completed diagnostic lifecycle fixes. It supersedes the earlier APK from commit
1ce591c7a427a727fa40bd3a2a41fd1541b78635.Testing scope remains observation-only:
key_debug_features_enabledoff, then with it enabled.[DEBUG-ISSUE-1527]; do not include typed text, candidate text, host package names, paths, credentials, or raw exceptions.CI and the Tauri desktop workflow for this same commit are still running separately. No root cause or product fix is claimed yet.