diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java index 54b1c1f09..af16e4907 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java @@ -78,6 +78,7 @@ public class KeyboardState { private KeyboardShiftState mAlphabetShiftState = new KeyboardShiftState(); private boolean mIsSymbolShifted; private boolean mPrevMainKeyboardWasShiftLocked; + private boolean mPrevSymbolsKeyboardWasShifted; private final SavedKeyboardState mSavedKeyboardState = new SavedKeyboardState(); @@ -100,6 +101,7 @@ public class KeyboardState { // Reset alphabet shift state. mAlphabetShiftState.setShiftLocked(false); mPrevMainKeyboardWasShiftLocked = false; + mPrevSymbolsKeyboardWasShifted = false; mShiftKeyState.onRelease(); mSymbolKeyState.onRelease(); onRestoreKeyboardState(); @@ -202,6 +204,7 @@ public class KeyboardState { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetKeyboard"); } + mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted; mSwitchActions.setAlphabetKeyboard(); mIsAlphabetMode = true; mIsSymbolShifted = false; @@ -214,6 +217,11 @@ public class KeyboardState { // TODO: Make this method private public void setSymbolsKeyboard() { mPrevMainKeyboardWasShiftLocked = mAlphabetShiftState.isShiftLocked(); + if (mPrevSymbolsKeyboardWasShifted) { + setSymbolsShiftedKeyboard(); + return; + } + if (DEBUG_ACTION) { Log.d(TAG, "setSymbolsKeyboard"); } @@ -222,6 +230,7 @@ public class KeyboardState { mIsSymbolShifted = false; // Reset alphabet shift state. mAlphabetShiftState.setShiftLocked(false); + mPrevSymbolsKeyboardWasShifted = false; mSwitchState = SWITCH_STATE_SYMBOL_BEGIN; } @@ -234,6 +243,7 @@ public class KeyboardState { mIsSymbolShifted = true; // Reset alphabet shift state. mAlphabetShiftState.setShiftLocked(false); + mPrevSymbolsKeyboardWasShifted = false; mSwitchState = SWITCH_STATE_SYMBOL_BEGIN; } diff --git a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java index 7ca65cd69..729120bba 100644 --- a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java +++ b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java @@ -109,16 +109,15 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase { // Release shift key, switch back to symbols shifted state. releaseKey(CODE_SHIFT, SYMBOLS_SHIFTED); - // TODO: This test fails due to bug. -// // Press "ABC" key and hold, enter into choring alphabet state. -// pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED); -// -// // Press/release letter keys. -// chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED); -// chordingPressAndReleaseKey('b', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED); -// -// // Release "ABC" key, switch back to symbols. -// releaseKey(CODE_SYMBOL, SYMBOLS_SHIFTED); + // Press "ABC" key and hold, enter into choring alphabet state. + pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED); + + // Press/release letter keys. + chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED); + chordingPressAndReleaseKey('b', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED); + + // Release "ABC" key, switch back to symbols. + releaseKey(CODE_SYMBOL, SYMBOLS_SHIFTED); } // Chording shift key in automatic upper case.