diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index 8864b7603..2fe081921 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -58,8 +58,6 @@ public final class KeyboardId { public final InputMethodSubtype mSubtype; public final Locale mLocale; - // TODO: Remove this member. It is used only for logging purpose. - public final int mOrientation; public final int mWidth; public final int mHeight; public final int mMode; @@ -77,7 +75,6 @@ public final class KeyboardId { public KeyboardId(final int elementId, final KeyboardLayoutSet.Params params) { mSubtype = params.mSubtype; mLocale = SubtypeLocaleUtils.getSubtypeLocale(mSubtype); - mOrientation = params.mOrientation; mWidth = params.mKeyboardWidth; mHeight = params.mKeyboardHeight; mMode = params.mMode; @@ -101,7 +98,6 @@ public final class KeyboardId { private static int computeHashCode(final KeyboardId id) { return Arrays.hashCode(new Object[] { - id.mOrientation, id.mElementId, id.mMode, id.mWidth, @@ -123,8 +119,7 @@ public final class KeyboardId { private boolean equals(final KeyboardId other) { if (other == this) return true; - return other.mOrientation == mOrientation - && other.mElementId == mElementId + return other.mElementId == mElementId && other.mMode == mMode && other.mWidth == mWidth && other.mHeight == mHeight @@ -185,13 +180,10 @@ public final class KeyboardId { @Override public String toString() { - final String orientation = (mOrientation == Configuration.ORIENTATION_PORTRAIT) - ? "port" : "land"; - return String.format(Locale.ROOT, "[%s %s:%s %s:%dx%d %s %s %s%s%s%s%s%s%s%s%s]", + return String.format(Locale.ROOT, "[%s %s:%s %dx%d %s %s %s%s%s%s%s%s%s%s%s]", elementIdToName(mElementId), - mLocale, - mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET), - orientation, mWidth, mHeight, + mLocale, mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET), + mWidth, mHeight, modeName(mMode), imeAction(), (navigateNext() ? "navigateNext" : ""), diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java index e15310721..00b096c17 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java @@ -119,7 +119,6 @@ public final class KeyboardLayoutSet { boolean mLanguageSwitchKeyEnabled; InputMethodSubtype mSubtype; boolean mIsSpellChecker; - int mOrientation; int mKeyboardWidth; int mKeyboardHeight; // Sparse array of KeyboardLayoutSet element parameters indexed by element's id. @@ -242,9 +241,6 @@ public final class KeyboardLayoutSet { } public Builder setScreenGeometry(final int widthPixels, final int heightPixels) { - final Params params = mParams; - params.mOrientation = (heightPixels > widthPixels) - ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE; setDefaultKeyboardSize(widthPixels, heightPixels); return this; } @@ -317,8 +313,6 @@ public final class KeyboardLayoutSet { } public KeyboardLayoutSet build() { - if (mParams.mOrientation == Configuration.ORIENTATION_UNDEFINED) - throw new RuntimeException("Screen geometry is not specified"); if (mParams.mSubtype == null) throw new RuntimeException("KeyboardLayoutSet subtype is not specified"); final String packageName = mResources.getResourcePackageName( diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 6782317d0..7a5038843 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -615,7 +615,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap; mSpacebarTextSize = keyHeight * mSpacebarTextRatio; if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { - ResearchLogger.mainKeyboardView_setKeyboard(keyboard); + final int orientation = getContext().getResources().getConfiguration().orientation; + ResearchLogger.mainKeyboardView_setKeyboard(keyboard, orientation); } // This always needs to be set since the accessibility state can diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java index 0bd493970..3a3408266 100644 --- a/java/src/com/android/inputmethod/research/ResearchLogger.java +++ b/java/src/com/android/inputmethod/research/ResearchLogger.java @@ -1414,7 +1414,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang "navigatePrevious", "clobberSettingsKey", "passwordInput", "shortcutKeyEnabled", "hasShortcutKey", "languageSwitchKeyEnabled", "isMultiLine", "tw", "th", "keys"); - public static void mainKeyboardView_setKeyboard(final Keyboard keyboard) { + public static void mainKeyboardView_setKeyboard(final Keyboard keyboard, + final int orientation) { final KeyboardId kid = keyboard.mId; final boolean isPasswordView = kid.passwordInput(); final ResearchLogger researchLogger = getInstance(); @@ -1422,7 +1423,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang researchLogger.enqueueEvent(LOGSTATEMENT_MAINKEYBOARDVIEW_SETKEYBOARD, KeyboardId.elementIdToName(kid.mElementId), kid.mLocale + ":" + kid.mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET), - kid.mOrientation, kid.mWidth, KeyboardId.modeName(kid.mMode), kid.imeAction(), + orientation, kid.mWidth, KeyboardId.modeName(kid.mMode), kid.imeAction(), kid.navigateNext(), kid.navigatePrevious(), kid.mClobberSettingsKey, isPasswordView, kid.mShortcutKeyEnabled, kid.mHasShortcutKey, kid.mLanguageSwitchKeyEnabled, kid.isMultiLine(), keyboard.mOccupiedWidth,