[G1 Android Development] overpower:
Hacking to display completion suggestions with hard keyboard open?

I'm wondering what is controlling when the suggestions for auto complete pop up.

My goal would be to enable these suggestions when the onscreen keyboard is open. Right now it appears that the ime is fully processing any hard keyboard inputs (pinyin), but we just don't have an option to select the appropriate character since we can't see the autocomplete suggestions.

Looking at log for HTCImeService with the hard keyboard closed and opened, I'm seeing the ability to use the trackball to select the suggestions:

07-22 02:09:17.156: INFO/HTCIMEService(658): [onKeyDown]: KeyCode=16
07-22 02:09:17.176: INFO/HTCIMEService(658): [sendInternalKeyEvent]: keyid=7120003
07-22 02:09:17.176: INFO/HTCIMEService(658): [setWCLSelByIndex]: wclBarIdx=1, wclIdx=-1
07-22 02:09:17.176: INFO/HTCIMEService(658): [setWCLSelByIndex]: wclBarIdx=0, wclIdx=3
07-22 02:09:17.196: INFO/HTCIMEService(658): [onKeyUp]: KeyCode=16

Right now, it does look like using the jogbar to go left and right does move the selection to other suggestions, however, since we can't see it, its not that helpful.

When you startup the ime in horizontal view you see the following events:

07-22 02:23:20.326: INFO/HTCIMEService(658): [onShowInputRequested]: flags=1 configChange-false
07-22 02:23:20.346: INFO/HTCIMEService(658): [onCreateExtractTextView]:
07-22 02:23:20.746: INFO/HTCIMEService(658): [setExtractView]:
07-22 02:23:20.826: INFO/HTCIMEService(658): [onCreateInputView]
07-22 02:23:21.276: INFO/HTCIMEService(658): mapLandToPort(): landScapeSipId = 6
07-22 02:23:21.306: INFO/HTCIMEService(658): getSIPByTypeEx2(): isSipModeSwitch = false, isSipModeQWERTY = true
07-22 02:23:21.306: INFO/HTCIMEService(658): Orientation: 1, CSType :0, sipID :6
07-22 02:23:21.686: INFO/HTCIMEService(658): [onStartInputView]: , attribute=0x24001, restarting=false
07-22 02:23:21.696: INFO/HTCIMEService(658): [onStartInputView]: , initialSelStart=6, initialSelEnd=6
07-22 02:23:21.696: INFO/HTCIMEService(658): [onStartInputView]: EditorInfo=TYPE_TEXT_VARIATION_NORMAL
07-22 02:23:21.696: INFO/HTCIMEService(658): [onStartInputView]: flags=1
07-22 02:23:21.726: INFO/HTCIMEService(658): mapLandToPort(): landScapeSipId = 6
07-22 02:23:21.726: INFO/HTCIMEService(658): getSIPByTypeEx2(): isSipModeSwitch = false, isSipModeQWERTY = true
07-22 02:23:21.746: INFO/HTCIMEService(658): Orientation: 1, CSType :0, sipID :6

When you close the hardware keyboard I'm seeing two things happening.

07-22 02:16:39.956: INFO/HTCIMEService(658): [hideWindow]:
07-22 02:16:39.986: INFO/HTCIMEService(658): [onFinishInput]:

So my guess is that the hideWindow command is the one that is stopping us from seeing any suggestions at all.

Suggestions only appear when the virtual keyboard is displayed. At first I thought it might be app dependent, and not ime dependent so we could try to trick the ime via an app setting. However, after playing with it, the only solution may have to be tricking the ime into not realizing the keyboard is open.

This may involve modifying the interrupt handler so that open and closed keyboard events are not passed on to the ime. It might be easiest to even disable it in the apk code, but I did a search in the forums and can't seem to find any information about disassembling the apk.

Any thoughts?