Bug 768727 - Send '&' as composition string because some Gingerbread VKBs incorrectly map '&' key events. r=blassey

This commit is contained in:
Chris Peterson 2012-06-29 12:06:03 -07:00
parent 18d65efbbd
commit b2c8432fd8

View File

@ -639,12 +639,12 @@ public class GeckoInputConnection
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
switch (inputChar) {
case '&':
// Gingerbread's KeyCharacterMap would return ALT+7, but we want SHIFT+7.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
return createKeyDownKeyUpEvents(KeyEvent.KEYCODE_7, KeyEvent.META_SHIFT_ON);
}
// Froyo's KeyCharacterMap will return the correct '&' key events below.
break;
// Some Gingerbread devices' KeyCharacterMaps return ALT+7 instead of SHIFT+7,
// but some devices like the Droid Bionic treat SHIFT+7 as '7'. So just return
// null and onTextChanged() will send "&" as a composition string instead of
// KEY_DOWN + KEY_UP event pair. This may break web content listening for '&'
// key events, but they will still receive "&" input event.
return null;
case '<':
case '>':