merge in jb-mr1-release history after reset to jb-mr1-dev
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 38025e8..de8097b 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -200,6 +200,12 @@
         mState.onUpdateShiftState(mLatinIME.getCurrentAutoCapsState());
     }
 
+    // TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
+    // when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
+    public void resetKeyboardStateToAlphabet() {
+        mState.onResetKeyboardStateToAlphabet();
+    }
+
     public void onPressKey(int code) {
         if (isVibrateAndSoundFeedbackRequired()) {
             mLatinIME.hapticAndAudioFeedback(code);
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java
index 58cc897..5e111fb 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java
@@ -254,6 +254,22 @@
         }
     }
 
+    // TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
+    // when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
+    private void resetKeyboardStateToAlphabet() {
+        if (DEBUG_ACTION) {
+            Log.d(TAG, "resetKeyboardStateToAlphabet: " + this);
+        }
+        if (mIsAlphabetMode) return;
+
+        mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted;
+        setAlphabetKeyboard();
+        if (mPrevMainKeyboardWasShiftLocked) {
+            setShiftLocked(true);
+        }
+        mPrevMainKeyboardWasShiftLocked = false;
+    }
+
     private void toggleShiftInSymbols() {
         if (mIsSymbolShifted) {
             setSymbolsKeyboard();
@@ -380,6 +396,15 @@
         updateAlphabetShiftState(autoCaps);
     }
 
+    // TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
+    // when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
+    public void onResetKeyboardStateToAlphabet() {
+        if (DEBUG_EVENT) {
+            Log.d(TAG, "onResetKeyboardStateToAlphabet: " + this);
+        }
+        resetKeyboardStateToAlphabet();
+    }
+
     private void updateAlphabetShiftState(int autoCaps) {
         if (!mIsAlphabetMode) return;
         if (!mShiftKeyState.isReleasing()) {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 8ac0cd4..cf7eea7 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -732,6 +732,10 @@
             }
 
             switcher.loadKeyboard(editorInfo, mCurrentSettings);
+        } else if (restarting) {
+            // TODO: Come up with a more comprehensive way to reset the keyboard layout when
+            // a keyboard layout set doesn't get reloaded in this method.
+            switcher.resetKeyboardStateToAlphabet();
         }
         setSuggestionStripShownInternal(
                 isSuggestionsStripVisible(), /* needsInputViewShown */ false);