From bd8e92d8431418929276fb739f0113e2297c9d00 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 11 Apr 2013 15:08:36 +0900 Subject: [PATCH] Add debug message to detect unusual zero width condition Bug: 8452013 Change-Id: I0169dc6b0d08d1b4d9e01a5fa2ad01e9db292bda --- .../inputmethod/keyboard/MoreKeysKeyboard.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java index 5d14f93a3..ae08a5953 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java @@ -291,10 +291,22 @@ public final class MoreKeysKeyboard extends Keyboard { // adjusted with their bottom paddings deducted. width = keyPreviewDrawParams.mPreviewVisibleWidth; height = keyPreviewDrawParams.mPreviewVisibleHeight + mParams.mVerticalGap; + // TODO: Remove this check. + if (width == 0) { + throw new IllegalArgumentException( + "Zero width key detected: " + parentKey + " in " + parentKeyboard.mId); + } } else { width = getMaxKeyWidth(parentKeyboardView, parentKey, mParams.mDefaultKeyWidth, context.getResources()); height = parentKeyboard.mMostCommonKeyHeight; + // TODO: Remove this check. + if (width == 0) { + throw new IllegalArgumentException( + "Zero width calculated: " + parentKey + + " moreKeys=" + java.util.Arrays.toString(parentKey.mMoreKeys) + + " in " + parentKeyboard.mId); + } } final int dividerWidth; if (parentKey.needsDividersInMoreKeys()) {