Friday, October 14, 2011

HTC touch input w/ Fennec

In this week, I bought HTC Desire Z to debug several input issue on Firefox Mobile. HTC touch input is very buggy implementation as IME (Input Method Editor). Although I turn on IME support on hardware keyboard for Firefox Mobile from version 9 (released at Dec 2011), Touch Input with hardware keyboard doesn't work well.

When I investigate this, a articles of stackoverflow.com is found. But this wasn't good article for workaround and details.

When IME support on android application, onKeyPreIme has to return false. Then, InputConnection.commitText() is called per input. But 1st parameter may be incorrect because it has no meta state (alt/fn or shift). In other word, When you input Shift+[A], we expect "A". But HTC touch input calls commitText("a")....

If you doesn't implement full IME support using BaseInputConnection. this issue doesn't occurs. BaseInputConnection.commitText() has a workaround code for this issue. It generates KeyEvent for input, then it uses InputConnection.sendKeyEvent. Since this event has correct state, onKeyDown can handle correct key event.

I will create new fix for this problem then, I will land this to Firefox 9 and 10.