Fix ArrayIndexOutOfBoundsException.

bug: 2964045
Change-Id: I97d95181e1a6838ace9c135aa92e7f20034e821f
main
Ken Wakasa 2010-09-01 09:11:38 +09:00
parent ca4e42785f
commit b24cc640c1
1 changed files with 5 additions and 3 deletions

View File

@ -500,18 +500,20 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
if (!wasInKeyRepeat && !mProxy.isMiniKeyboardOnScreen()) { if (!wasInKeyRepeat && !mProxy.isMiniKeyboardOnScreen()) {
detectAndSendKey(mCurrentKey, touchX, touchY, eventTime); detectAndSendKey(mCurrentKey, touchX, touchY, eventTime);
} }
if (keyIndex != NOT_A_KEY) if (keyIndex != NOT_A_KEY && keyIndex < mKeys.length) {
mProxy.invalidateKey(mKeys[keyIndex]); mProxy.invalidateKey(mKeys[keyIndex]);
} }
}
public void onCancelEvent(int touchX, int touchY, long eventTime) { public void onCancelEvent(int touchX, int touchY, long eventTime) {
mHandler.cancelKeyTimers(); mHandler.cancelKeyTimers();
mHandler.cancelPopupPreview(); mHandler.cancelPopupPreview();
mProxy.dismissPopupKeyboard(); mProxy.dismissPopupKeyboard();
showKeyPreviewAndUpdateKey(NOT_A_KEY); showKeyPreviewAndUpdateKey(NOT_A_KEY);
if (mCurrentKey != NOT_A_KEY) if (mCurrentKey != NOT_A_KEY && mCurrentKey < mKeys.length) {
mProxy.invalidateKey(mKeys[mCurrentKey]); mProxy.invalidateKey(mKeys[mCurrentKey]);
} }
}
public void repeatKey(int keyIndex) { public void repeatKey(int keyIndex) {
Key key = mKeys[keyIndex]; Key key = mKeys[keyIndex];
@ -670,7 +672,7 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
} }
private void checkMultiTap(long eventTime, int keyIndex) { private void checkMultiTap(long eventTime, int keyIndex) {
if (keyIndex == NOT_A_KEY) return; if (keyIndex == NOT_A_KEY || keyIndex >= mKeys.length) return;
Key key = mKeys[keyIndex]; Key key = mKeys[keyIndex];
if (key.codes.length > 1) { if (key.codes.length > 1) {
mInMultiTap = true; mInMultiTap = true;