From 83d81f2e34b28e56bb0f8505d2315ae53c8f9eef Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 24 Jan 2012 15:02:35 +0900 Subject: [PATCH] Fix sliding shift input in caps lock mode Bug: 5881820 Change-Id: I4cbe3eda83c09edc9da8efbdff7d3359c1e140d5 --- .../inputmethod/keyboard/internal/KeyboardState.java | 6 +++++- .../keyboard/internal/KeyboardStateSingleTouchTests.java | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java index f89f156ea..5054bd954 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java @@ -383,12 +383,16 @@ public class KeyboardState { if (mIsAlphabetMode) { final boolean isShiftLocked = mAlphabetShiftState.isShiftLocked(); if (mShiftKeyState.isMomentary()) { - // After chording input while normal state. if (mAlphabetShiftState.isShiftLockShifted()) { + // After chording input while caps lock state. setShiftLocked(true); } else { + // After chording input while normal state. setShifted(UNSHIFT); } + } else if (mAlphabetShiftState.isShiftLockShifted() && withSliding) { + // In caps lock state, shift has been pressed and slid out to other key. + setShiftLocked(true); } else if (isShiftLocked && !mAlphabetShiftState.isShiftLockShifted() && (mShiftKeyState.isPressing() || mShiftKeyState.isPressingOnShifted()) && !withSliding) { diff --git a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateSingleTouchTests.java b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateSingleTouchTests.java index 14f307750..2204fca89 100644 --- a/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateSingleTouchTests.java +++ b/tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateSingleTouchTests.java @@ -375,12 +375,9 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase { // Alphabet shift locked -> "?123" key + letter -> alphabet shift locked. // Press and slide from shift key, enter alphabet shifted. - pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED); + pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED); // Enter/release letter key, switch back to shift locked. - // TODO: This test fails due to bug, though the external behavior is correct. -// pressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED); - // TODO: Replace this with the above line once the bug fixed. - pressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED); + pressAndReleaseKey('Z', ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED); } // Sliding input in symbols.