Skip to content

Try to fix emoji search ending#2326

Draft
eranl wants to merge 2 commits intoHeliBorg:mainfrom
eranl:fix-emoji-search
Draft

Try to fix emoji search ending#2326
eranl wants to merge 2 commits intoHeliBorg:mainfrom
eranl:fix-emoji-search

Conversation

@eranl
Copy link
Copy Markdown
Contributor

@eranl eranl commented Feb 26, 2026

Added logging around emoji search ending, to try to figure out #2325 item 7.

@Helium314
Copy link
Copy Markdown
Collaborator

I read the log in #2325 (comment), and it seems that the characters are committed by RichInputConnection, but don't arrive in the right place / at the right time. My guess is that RichInputConnection.isConnected returns false.

The (I guess) relevant lines for the not working attempt (found twice):

2026-02-27 14:17:11.733355 D emoji-search: IME opened in onGloballyPositioned
2026-02-27 14:17:13.105313 I LatinIME: onFinishInputView
2026-02-27 14:17:13.106004 I LatinIME: onFinishInput
2026-02-27 14:17:13.108393 I LatinIME: Starting input. Cursor position = -1,-1
2026-02-27 14:17:13.109006 D LatinIME: editorInfo: inputType: 0x00000000, imeOptions: 0x12000000
2026-02-27 14:17:13.109308 D LatinIME: All caps: false, sentence caps: false, word caps: false
2026-02-27 14:17:13.109877 I InputAttributes: InputType.TYPE_NULL is specified
2026-02-27 14:17:13.110094 I Settings: loadSettings
2026-02-27 14:17:13.143731 D KeyboardState: setAlphabetKeyboard: [keyboard=UNSHIFTED shift=RELEASING symbol=RELEASING switch=ALPHA] autoCapsFlags=none recapitalizeMode=null
2026-02-27 14:17:13.178923 I LatinIME: hideWindow
2026-02-27 14:17:13.183428 I LatinIME: onFinishInputView
2026-02-27 14:17:13.183889 I LatinIME: onWindowHidden
2026-02-27 14:17:13.430482 D emoji-search: search ending. Selected emoji: 🐅. imeClosed: false
2026-02-27 14:17:13.493233 D emoji-search: after activity closing. isEmojiSearch: false. Intent: Intent { act=EMOJI_SEARCH_DONE cmp=helium314.keyboard.debug/helium314.keyboard.latin.LatinIME (has extras) }. imeClosed: false. selected emoji: 🐅
2026-02-27 14:17:13.495013 D RichInputConnection: committing 2 characters
2026-02-27 14:17:13.626279 D InputLogic: performUpdateSuggestionStripSync()
2026-02-27 14:17:14.522903 I LatinIME: Starting input. Cursor position = 0,0

When it works (I assume):

2026-02-27 14:16:00.083677 D emoji-search: IME opened in onGloballyPositioned
2026-02-27 14:16:01.646077 D RichInputConnection: setting composing text of length 1
2026-02-27 14:16:01.696309 I LatinIME: onUpdateSelection: oss=0, ose=0, nss=1, nse=1, cs=0, ce=1
2026-02-27 14:16:01.796667 D InputLogic: performUpdateSuggestionStripSync()
2026-02-27 14:16:01.918446 D InputLogic: performUpdateSuggestionStripSync() : 122 ms to finish
2026-02-27 14:16:01.920518 D RichInputConnection: setting composing text of length 2
2026-02-27 14:16:01.998230 I LatinIME: onUpdateSelection: oss=1, ose=1, nss=2, nse=2, cs=0, ce=2
2026-02-27 14:16:02.000472 D RichInputConnection: setting composing text of length 3
2026-02-27 14:16:02.097115 I LatinIME: onUpdateSelection: oss=2, ose=2, nss=3, nse=3, cs=0, ce=3
2026-02-27 14:16:02.109710 D InputLogic: performUpdateSuggestionStripSync()
2026-02-27 14:16:02.205011 D InputLogic: performUpdateSuggestionStripSync() : 95 ms to finish
2026-02-27 14:16:03.023616 I LatinIME: onFinishInputView
2026-02-27 14:16:03.024082 I LatinIME: onFinishInput
2026-02-27 14:16:03.026048 I LatinIME: Starting input. Cursor position = 0,0
2026-02-27 14:16:03.026517 D LatinIME: editorInfo: inputType: 0x00008001, imeOptions: 0x02000003
2026-02-27 14:16:03.026681 D LatinIME: All caps: false, sentence caps: false, word caps: false
2026-02-27 14:16:03.027238 I Settings: loadSettings
2026-02-27 14:16:03.036154 D KeyboardState: setAlphabetKeyboard: [keyboard=UNSHIFTED shift=RELEASING symbol=RELEASING switch=ALPHA] autoCapsFlags=none recapitalizeMode=null
2026-02-27 14:16:03.339588 D emoji-search: search ending. Selected emoji: 😼. imeClosed: false
2026-02-27 14:16:03.446947 D emoji-search: after activity closing. isEmojiSearch: false. Intent: Intent { act=EMOJI_SEARCH_DONE cmp=helium314.keyboard.debug/helium314.keyboard.latin.LatinIME (has extras) }. imeClosed: false. selected emoji: 😼
2026-02-27 14:16:03.447930 D RichInputConnection: committing 2 characters
2026-02-27 14:16:03.569243 I LatinIME: onUpdateSelection: oss=0, ose=0, nss=2, nse=2, cs=-1, ce=-1

The differences I see are that hideWindow is called and finished before EmojiSearchActivity.onStop.
In the working attempt, LatinIME.onStartInputViewInternal is called before EmojiSearchActivity.onStop, in the not working attempt it's called after onStop.

Ugly but possibly working: Maybe if instead of using onTextInput in onStartCommand you could put the emoji string in the EmojiSearchActivity companion object and read / input it at the end of onStartInputViewInternal.

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.

2 participants