From a4463d7a9a9b97ad0fba764698f75cd3bf036c12 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 11 Apr 2013 10:44:54 +0900 Subject: [PATCH] More precise geometry checking for more keys keyboard Bug: 8484528 Change-Id: I0dd09530a5262fee9c19bb0f11d5830b00306944 --- .../com/android/inputmethod/keyboard/MoreKeysKeyboard.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java index 66c30149c..f81ab8dd6 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java @@ -73,10 +73,11 @@ public final class MoreKeysKeyboard extends Keyboard { final int rowHeight, final int coordXInParent, final int parentKeyboardWidth, final boolean isFixedColumnOrder, final int dividerWidth) { mIsFixedOrder = isFixedColumnOrder; - if (parentKeyboardWidth / keyWidth < maxColumns) { + if (parentKeyboardWidth / keyWidth < Math.min(numKeys, maxColumns)) { throw new IllegalArgumentException( "Keyboard is too small to hold more keys keyboard: " - + parentKeyboardWidth + " " + keyWidth + " " + maxColumns); + + parentKeyboardWidth + " " + keyWidth + " " + + numKeys + " " + maxColumns); } mDefaultKeyWidth = keyWidth; mDefaultRowHeight = rowHeight;