Fix saving keyboard state while rotating

This change also uses longer timeout for restoring keyboard state.

Bug: 4311428
Change-Id: Ieade33d7c69f1dee727b2b8c26f0112eca44b336
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 2d08abc..f629a07 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -188,8 +188,13 @@
 
         public void save() {
             mIsAlphabetMode = isAlphabetMode();
-            mIsShiftLocked = mIsAlphabetMode && isShiftLocked();
-            mIsShifted = !mIsShiftLocked && isShiftedOrShiftLocked();
+            if (mIsAlphabetMode) {
+                mIsShiftLocked = isShiftLocked();
+                mIsShifted = !mIsShiftLocked && isShiftedOrShiftLocked();
+            } else {
+                mIsShiftLocked = false;
+                mIsShifted = mSymbolsShiftedKeyboardId.equals(mCurrentId);
+            }
             mIsValid = true;
         }
 
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index d00ce78..cbfc900 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -115,7 +115,7 @@
 
     private static final int SCREEN_ORIENTATION_CHANGE_DETECTION_DELAY = 2;
     private static final int ACCUMULATE_START_INPUT_VIEW_DELAY = 20;
-    private static final int RESTORE_KEYBOARD_STATE_DELAY = 200;
+    private static final int RESTORE_KEYBOARD_STATE_DELAY = 300;
 
     /**
      * The name of the scheme used by the Package Manager to warn of a new package installation,