am 8c220a0a: Fix bug that can cause unexpected off-keyboard chars to appear as suggestions.

* commit '8c220a0aa2c5139a3b12af20e68c420f6402294a':
  Fix bug that can cause unexpected off-keyboard chars to appear as suggestions.
This commit is contained in:
Tom Ouyang 2012-09-04 22:54:33 -07:00 committed by Android Git Automerger
commit 2d15f11e25

View file

@ -391,11 +391,12 @@ int ProximityInfoState::getDuration(const int index) const {
float ProximityInfoState::getPointToKeyLength(int inputIndex, int codePoint, float scale) { float ProximityInfoState::getPointToKeyLength(int inputIndex, int codePoint, float scale) {
const int keyId = mProximityInfo->getKeyIndexOf(codePoint); const int keyId = mProximityInfo->getKeyIndexOf(codePoint);
if (keyId >= 0) { if (keyId != NOT_AN_INDEX) {
const int index = inputIndex * mProximityInfo->getKeyCount() + keyId; const int index = inputIndex * mProximityInfo->getKeyCount() + keyId;
return min(mDistanceCache[index] * scale, mMaxPointToKeyLength); return min(mDistanceCache[index] * scale, mMaxPointToKeyLength);
} }
return 0; // If the char is not a key on the keyboard then return the max length.
return MAX_POINT_TO_KEY_LENGTH;
} }
int ProximityInfoState::getKeyKeyDistance(int key0, int key1) { int ProximityInfoState::getKeyKeyDistance(int key0, int key1) {