Repository navigation
fix(handwriting): plugin fails after re-open, panel closes after first word, false download prompt - #854
Merged
Conversation
…851) Closing the keyboard releases the recognizer, and the next open created a new PluginClassLoader that tried to load libdigitalink.so again. ART only allows one ClassLoader per native library, so it failed with UnsatisfiedLinkError until a forced restart. Cache the loader per plugin APK (as OcrPluginLoader does) and share it with importPlugin().
…word Committing the first handwritten word turns auto-caps off, and the shift update reloaded the alphabet keyboard, which hid the handwriting panel. Skip shift updates while handwriting is showing and apply the current auto-caps state when leaving handwriting.
The plugin's isLanguageReady() waits about 1s for ML Kit's model manager and reports a timeout as "not downloaded", so an installed model showed "Tap to download" right after the keyboard started. Check imported models first and retry the ML Kit check before showing the download prompt.
This was referenced Nov 16, 2026
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 #851
Problems
PluginClassLoaderand tried to loadlibdigitalink.soagain. ART allows only one ClassLoader per native library, so it failed withUnsatisfiedLinkError: ... already opened by ClassLoaderuntil a forced restart.KeyboardState.setShifted(UNSHIFT)reloaded the alphabet keyboard, which hid the handwriting panel.isLanguageReady()waits about 1s for ML Kit's model manager and reports a timeout on cold start as "not downloaded".Changes
HandwritingLoader: cache thePluginClassLoaderper plugin APK (same approach asOcrPluginLoader), shared bygetRecognizer()andimportPlugin(); cleared on failed import and on removal.KeyboardSwitcher.requestUpdatingShiftState(): skip while handwriting is showing.HandwritingView.exitToAlphabet()applies the current auto-caps state when leaving handwriting (ABC key, long-press clear).HandwritingView: check imported models first, then retry the ML Kit readiness check up to 3 times before showing the download prompt.Notes
updateAlphabetShiftState.CjkPluginLoadercreates a new ClassLoader on every load afterrelease(); not checked whether it hits the same native-library issue.Testing
UnsatisfiedLinkErroras the reporter's Honor 90)../gradlew compileOfflineRunTestsKotlinpasses. No unit tests run.