diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index ae1d302..863421f 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -330,6 +330,10 @@
         return isAlphaKeyboard() && mShiftState.isManualTemporaryUpperCase();
     }
 
+    public boolean isManualTemporaryUpperCaseFromAuto() {
+        return isAlphaKeyboard() && mShiftState.isManualTemporaryUpperCaseFromAuto();
+    }
+
     public KeyboardShiftState getKeyboardShiftState() {
         return mShiftState;
     }
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardShiftState.java b/java/src/com/android/inputmethod/keyboard/KeyboardShiftState.java
index 3e1eaf4..d541279 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardShiftState.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardShiftState.java
@@ -24,26 +24,38 @@
 
     private static final int NORMAL = 0;
     private static final int MANUAL_SHIFTED = 1;
-    private static final int SHIFT_LOCKED = 2;
+    private static final int MANUAL_SHIFTED_FROM_AUTO = 2;
     private static final int AUTO_SHIFTED = 3;
-    private static final int SHIFT_LOCK_SHIFTED = 4;
+    private static final int SHIFT_LOCKED = 4;
+    private static final int SHIFT_LOCK_SHIFTED = 5;
 
     private int mState = NORMAL;
 
     public boolean setShifted(boolean newShiftState) {
         final int oldState = mState;
         if (newShiftState) {
-            if (oldState == NORMAL || oldState == AUTO_SHIFTED) {
+            switch (oldState) {
+            case NORMAL:
                 mState = MANUAL_SHIFTED;
-            } else if (oldState == SHIFT_LOCKED) {
+                break;
+            case AUTO_SHIFTED:
+                mState = MANUAL_SHIFTED_FROM_AUTO;
+                break;
+            case SHIFT_LOCKED:
                 mState = SHIFT_LOCK_SHIFTED;
+                break;
             }
         } else {
-            if (oldState == MANUAL_SHIFTED || oldState == AUTO_SHIFTED) {
+            switch (oldState) {
+            case MANUAL_SHIFTED:
+            case MANUAL_SHIFTED_FROM_AUTO:
+            case AUTO_SHIFTED:
                 mState = NORMAL;
-            } else if (oldState == SHIFT_LOCK_SHIFTED) {
+                break;
+            case SHIFT_LOCK_SHIFTED:
                 mState = SHIFT_LOCKED;
-                            }
+                break;
+            }
         }
         if (DEBUG)
             Log.d(TAG, "setShifted(" + newShiftState + "): " + toString(oldState) + " > " + this);
@@ -53,11 +65,21 @@
     public void setShiftLocked(boolean newShiftLockState) {
         final int oldState = mState;
         if (newShiftLockState) {
-            if (oldState == NORMAL || oldState == MANUAL_SHIFTED || oldState == AUTO_SHIFTED)
+            switch (oldState) {
+            case NORMAL:
+            case MANUAL_SHIFTED:
+            case MANUAL_SHIFTED_FROM_AUTO:
+            case AUTO_SHIFTED:
                 mState = SHIFT_LOCKED;
+                break;
+            }
         } else {
-            if (oldState == SHIFT_LOCKED || oldState == SHIFT_LOCK_SHIFTED)
+            switch (oldState) {
+            case SHIFT_LOCKED:
+            case SHIFT_LOCK_SHIFTED:
                 mState = NORMAL;
+                break;
+            }
         }
         if (DEBUG)
             Log.d(TAG, "setShiftLocked(" + newShiftLockState + "): " + toString(oldState)
@@ -84,7 +106,12 @@
     }
 
     public boolean isManualTemporaryUpperCase() {
-        return mState == MANUAL_SHIFTED || mState == SHIFT_LOCK_SHIFTED;
+        return mState == MANUAL_SHIFTED || mState == MANUAL_SHIFTED_FROM_AUTO
+                || mState == SHIFT_LOCK_SHIFTED;
+    }
+
+    public boolean isManualTemporaryUpperCaseFromAuto() {
+        return mState == MANUAL_SHIFTED_FROM_AUTO;
     }
 
     @Override
@@ -96,8 +123,9 @@
         switch (state) {
         case NORMAL: return "NORMAL";
         case MANUAL_SHIFTED: return "MANUAL_SHIFTED";
-        case SHIFT_LOCKED: return "SHIFT_LOCKED";
+        case MANUAL_SHIFTED_FROM_AUTO: return "MANUAL_SHIFTED_FROM_AUTO";
         case AUTO_SHIFTED: return "AUTO_SHIFTED";
+        case SHIFT_LOCKED: return "SHIFT_LOCKED";
         case SHIFT_LOCK_SHIFTED: return "SHIFT_LOCK_SHIFTED";
         default: return "UKNOWN";
         }
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 68d3ccd..558de66 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -327,6 +327,13 @@
         return false;
     }
 
+    private boolean isManualTemporaryUpperCaseFromAuto() {
+        LatinKeyboard latinKeyboard = getLatinKeyboard();
+        if (latinKeyboard != null)
+            return latinKeyboard.isManualTemporaryUpperCaseFromAuto();
+        return false;
+    }
+
     private void setManualTemporaryUpperCase(boolean shifted) {
         LatinKeyboard latinKeyboard = getLatinKeyboard();
         if (latinKeyboard != null) {
@@ -482,6 +489,10 @@
             } else if (isShiftedOrShiftLocked() && shiftKeyState.isPressingOnShifted()) {
                 // Shift has been pressed without chording while shifted state.
                 toggleShift();
+            } else if (isManualTemporaryUpperCaseFromAuto() && shiftKeyState.isPressing()) {
+                // Shift has been pressed without chording while manual temporary upper case
+                // transited from automatic temporary upper case.
+                toggleShift();
             }
         }
         shiftKeyState.onRelease();
