diff --git a/dictionaries/pt_BR_wordlist.combined.gz b/dictionaries/pt_BR_wordlist.combined.gz
index 19394cb..83dbe79 100644
--- a/dictionaries/pt_BR_wordlist.combined.gz
+++ b/dictionaries/pt_BR_wordlist.combined.gz
Binary files differ
diff --git a/dictionaries/pt_PT_wordlist.combined.gz b/dictionaries/pt_PT_wordlist.combined.gz
index b29e4fd..00d50d0 100644
--- a/dictionaries/pt_PT_wordlist.combined.gz
+++ b/dictionaries/pt_PT_wordlist.combined.gz
Binary files differ
diff --git a/java/res/raw/main_pt_br.dict b/java/res/raw/main_pt_br.dict
index 28db0ed..8c14499 100644
--- a/java/res/raw/main_pt_br.dict
+++ b/java/res/raw/main_pt_br.dict
Binary files differ
diff --git a/java/res/values-af/strings.xml b/java/res/values-af/strings.xml
index afd6a0d..1ebe4d3 100644
--- a/java/res/values-af/strings.xml
+++ b/java/res/values-af/strings.xml
@@ -42,7 +42,7 @@
     <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Sleutelopspringer-wagperiode"</string>
     <string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"Geen wagperiode nie"</string>
     <string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"Verstek"</string>
-    <string name="settings_keypress_vibration_duration" msgid="489402970497503329">"<xliff:g id="MILLISECONDS">%s</xliff:g>ms"</string>
+    <string name="settings_keypress_vibration_duration" msgid="489402970497503329">"<xliff:g id="MILLISECONDS">%s</xliff:g>ms."</string>
     <string name="use_contacts_dict" msgid="4435317977804180815">"Stel kontakname voor"</string>
     <string name="use_contacts_dict_summary" msgid="6599983334507879959">"Gebruik name van kontakte vir voorstelle en korreksies"</string>
     <string name="use_double_space_period" msgid="8781529969425082860">"Dubbelspasie-punt"</string>
diff --git a/java/res/values-hi/strings.xml b/java/res/values-hi/strings.xml
index 7383682..1333f0f 100644
--- a/java/res/values-hi/strings.xml
+++ b/java/res/values-hi/strings.xml
@@ -42,8 +42,7 @@
     <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"कुंजी पॉपअप खारिज़ विलंब"</string>
     <string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"कोई विलंब नहीं"</string>
     <string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"डिफ़ॉल्ट"</string>
-    <!-- no translation found for settings_keypress_vibration_duration (489402970497503329) -->
-    <skip />
+    <string name="settings_keypress_vibration_duration" msgid="489402970497503329">"<xliff:g id="MILLISECONDS">%s</xliff:g> मिलीसेकंड"</string>
     <string name="use_contacts_dict" msgid="4435317977804180815">"संपर्क नाम सुझाएं"</string>
     <string name="use_contacts_dict_summary" msgid="6599983334507879959">"सुझाव और सुधार के लिए संपर्क से नामों का उपयोग करें"</string>
     <string name="use_double_space_period" msgid="8781529969425082860">"दोहरे स्पेस वाला पीरियड"</string>
diff --git a/java/res/values-sr/strings.xml b/java/res/values-sr/strings.xml
index c0085bb..ad0029e 100644
--- a/java/res/values-sr/strings.xml
+++ b/java/res/values-sr/strings.xml
@@ -42,7 +42,7 @@
     <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Одложи одбац. иск. прозора тастера"</string>
     <string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"Без одлагања"</string>
     <string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"Подразумевано"</string>
-    <string name="settings_keypress_vibration_duration" msgid="489402970497503329">"<xliff:g id="MILLISECONDS">%s</xliff:g> мс"</string>
+    <string name="settings_keypress_vibration_duration" msgid="489402970497503329">"<xliff:g id="MILLISECONDS">%s</xliff:g> ms"</string>
     <string name="use_contacts_dict" msgid="4435317977804180815">"Предложи имена контаката"</string>
     <string name="use_contacts_dict_summary" msgid="6599983334507879959">"Користи имена из Контаката за предлоге и исправке"</string>
     <string name="use_double_space_period" msgid="8781529969425082860">"Тачка и размак"</string>
diff --git a/java/res/values-tr/strings.xml b/java/res/values-tr/strings.xml
index 462f7c9..e98a31e 100644
--- a/java/res/values-tr/strings.xml
+++ b/java/res/values-tr/strings.xml
@@ -42,8 +42,7 @@
     <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Tuş popup\'ının kapatılmasını geciktirme"</string>
     <string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"Gecikme yok"</string>
     <string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"Varsayılan"</string>
-    <!-- no translation found for settings_keypress_vibration_duration (489402970497503329) -->
-    <skip />
+    <string name="settings_keypress_vibration_duration" msgid="489402970497503329">"<xliff:g id="MILLISECONDS">%s</xliff:g> ms"</string>
     <string name="use_contacts_dict" msgid="4435317977804180815">"Kişi Adları öner"</string>
     <string name="use_contacts_dict_summary" msgid="6599983334507879959">"Öneri ve düzeltmeler için Kişiler\'deki adları kullan"</string>
     <string name="use_double_space_period" msgid="8781529969425082860">"Çift boşlukla nokta ekleme"</string>
diff --git a/java/res/values-uk/strings.xml b/java/res/values-uk/strings.xml
index 32544fa..f6688c2 100644
--- a/java/res/values-uk/strings.xml
+++ b/java/res/values-uk/strings.xml
@@ -42,7 +42,7 @@
     <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Затримка клавіши закриття"</string>
     <string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"Без затримки"</string>
     <string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"За умовчанням"</string>
-    <string name="settings_keypress_vibration_duration" msgid="489402970497503329">"<xliff:g id="MILLISECONDS">%s</xliff:g> мсек"</string>
+    <string name="settings_keypress_vibration_duration" msgid="489402970497503329">"<xliff:g id="MILLISECONDS">%s</xliff:g> мс"</string>
     <string name="use_contacts_dict" msgid="4435317977804180815">"Пропон. імена контактів"</string>
     <string name="use_contacts_dict_summary" msgid="6599983334507879959">"Використ. імена зі списку контактів для пропозицій і виправлень"</string>
     <string name="use_double_space_period" msgid="8781529969425082860">"Крапка подвійним пробілом"</string>
diff --git a/java/src/com/android/inputmethod/event/Combiner.java b/java/src/com/android/inputmethod/event/Combiner.java
new file mode 100644
index 0000000..ab6b70c
--- /dev/null
+++ b/java/src/com/android/inputmethod/event/Combiner.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.event;
+
+/**
+ * A generic interface for combiners.
+ */
+public interface Combiner {
+    /**
+     * Combine an event with the existing state and return the new event.
+     * @param event the event to combine with the existing state.
+     * @return the resulting event.
+     */
+    Event combine(Event event);
+}
diff --git a/java/src/com/android/inputmethod/event/DeadKeyCombiner.java b/java/src/com/android/inputmethod/event/DeadKeyCombiner.java
new file mode 100644
index 0000000..52987d5
--- /dev/null
+++ b/java/src/com/android/inputmethod/event/DeadKeyCombiner.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.event;
+
+import android.text.TextUtils;
+import android.view.KeyCharacterMap;
+
+import com.android.inputmethod.latin.Constants;
+
+/**
+ * A combiner that handles dead keys.
+ */
+public class DeadKeyCombiner implements Combiner {
+    final StringBuilder mDeadSequence = new StringBuilder();
+
+    @Override
+    public Event combine(final Event event) {
+        if (null == event) return null; // Just in case some combiner is broken
+        if (TextUtils.isEmpty(mDeadSequence)) {
+            if (event.isDead()) {
+                mDeadSequence.appendCodePoint(event.mCodePoint);
+            }
+            return event;
+        } else {
+            // TODO: Allow combining for several dead chars rather than only the first one.
+            // The framework doesn't know how to do this now.
+            final int deadCodePoint = mDeadSequence.codePointAt(0);
+            mDeadSequence.setLength(0);
+            final int resultingCodePoint =
+                    KeyCharacterMap.getDeadChar(deadCodePoint, event.mCodePoint);
+            if (0 == resultingCodePoint) {
+                // We can't combine both characters. We need to commit the dead key as a committable
+                // character, and the next char too unless it's a space (because as a special case,
+                // dead key + space should result in only the dead key being committed - that's
+                // how dead keys work).
+                // If the event is a space, we should commit the dead char alone, but if it's
+                // not, we need to commit both.
+                return Event.createCommittableEvent(deadCodePoint,
+                        Constants.CODE_SPACE == event.mCodePoint ? null : event /* next */);
+            } else {
+                // We could combine the characters.
+                return Event.createCommittableEvent(resultingCodePoint, null /* next */);
+            }
+        }
+    }
+
+}
diff --git a/java/src/com/android/inputmethod/event/Event.java b/java/src/com/android/inputmethod/event/Event.java
index 3fe5d5b..1f3320e 100644
--- a/java/src/com/android/inputmethod/event/Event.java
+++ b/java/src/com/android/inputmethod/event/Event.java
@@ -61,26 +61,33 @@
     // ctrl, there is no code point associated so this should be NOT_A_CODE_POINT to avoid
     // unintentional use of its value when it's not relevant.
     final public int mCodePoint;
+    // The next event, if any. Null if there is no next event yet.
+    final public Event mNextEvent;
 
     // This method is private - to create a new event, use one of the create* utility methods.
-    private Event(final int type, final int codePoint) {
+    private Event(final int type, final int codePoint, final Event next) {
         mType = type;
         mCodePoint = codePoint;
+        mNextEvent = next;
     }
 
-    public static Event createDeadEvent(final int codePoint) {
-        return new Event(EVENT_DEAD, codePoint);
+    public static Event createDeadEvent(final int codePoint, final Event next) {
+        return new Event(EVENT_DEAD, codePoint, next);
     }
 
-    public static Event createCommittableEvent(final int codePoint) {
-        return new Event(EVENT_COMMITTABLE, codePoint);
+    public static Event createCommittableEvent(final int codePoint, final Event next) {
+        return new Event(EVENT_COMMITTABLE, codePoint, next);
     }
 
     public static Event createNotHandledEvent() {
-        return new Event(EVENT_NOT_HANDLED, NOT_A_CODE_POINT);
+        return new Event(EVENT_NOT_HANDLED, NOT_A_CODE_POINT, null);
     }
 
     public boolean isCommittable() {
         return EVENT_COMMITTABLE == mType;
     }
+
+    public boolean isDead() {
+        return EVENT_DEAD == mType;
+    }
 }
diff --git a/java/src/com/android/inputmethod/event/EventInterpreter.java b/java/src/com/android/inputmethod/event/EventInterpreter.java
index f918578..6efe899 100644
--- a/java/src/com/android/inputmethod/event/EventInterpreter.java
+++ b/java/src/com/android/inputmethod/event/EventInterpreter.java
@@ -19,9 +19,12 @@
 import android.util.SparseArray;
 import android.view.KeyEvent;
 
+import com.android.inputmethod.latin.CollectionUtils;
 import com.android.inputmethod.latin.Constants;
 import com.android.inputmethod.latin.LatinIME;
 
+import java.util.ArrayList;
+
 /**
  * This class implements the logic between receiving events and generating code points.
  *
@@ -40,6 +43,7 @@
     final SparseArray<HardwareEventDecoder> mHardwareEventDecoders;
     final SoftwareEventDecoder mSoftwareEventDecoder;
     final LatinIME mLatinIme;
+    final ArrayList<Combiner> mCombiners;
 
     /**
      * Create a default interpreter.
@@ -74,6 +78,8 @@
         // capacity of 1.
         mHardwareEventDecoders = new SparseArray<HardwareEventDecoder>(1);
         mSoftwareEventDecoder = new SoftwareKeyboardEventDecoder();
+        mCombiners = CollectionUtils.newArrayList();
+        mCombiners.add(new DeadKeyCombiner());
         mLatinIme = latinIme;
     }
 
@@ -106,19 +112,22 @@
     }
 
     private boolean onEvent(final Event event) {
-        if (event.isCommittable()) {
-            mLatinIme.onCodeInput(event.mCodePoint,
-                    Constants.EXTERNAL_KEYBOARD_COORDINATE, Constants.EXTERNAL_KEYBOARD_COORDINATE);
-            return true;
+        Event currentlyProcessingEvent = event;
+        boolean processed = false;
+        for (int i = 0; i < mCombiners.size(); ++i) {
+            currentlyProcessingEvent = mCombiners.get(i).combine(event);
         }
-        // TODO: Classify the event - input or non-input (see design doc)
-        // TODO: IF action event
-        //          Send decoded action back to LatinIME
-        //       ELSE
-        //          Send input event to the combiner
-        //          Get back new input material + visual feedback + combiner state
-        //          Route the event to Latin IME
-        //       ENDIF
-        return false;
+        while (null != currentlyProcessingEvent) {
+            if (currentlyProcessingEvent.isCommittable()) {
+                mLatinIme.onCodeInput(currentlyProcessingEvent.mCodePoint,
+                        Constants.EXTERNAL_KEYBOARD_COORDINATE,
+                        Constants.EXTERNAL_KEYBOARD_COORDINATE);
+                processed = true;
+            } else if (event.isDead()) {
+                processed = true;
+            }
+            currentlyProcessingEvent = currentlyProcessingEvent.mNextEvent;
+        }
+        return processed;
     }
 }
diff --git a/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java b/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java
index 554319e..2fb7fe8 100644
--- a/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java
+++ b/java/src/com/android/inputmethod/event/HardwareKeyboardEventDecoder.java
@@ -47,17 +47,18 @@
         // the key for 'A' or Space, but also Backspace or Ctrl or Caps Lock.
         final int keyCode = keyEvent.getKeyCode();
         if (KeyEvent.KEYCODE_DEL == keyCode) {
-            return Event.createCommittableEvent(Constants.CODE_DELETE);
+            return Event.createCommittableEvent(Constants.CODE_DELETE, null /* next */);
         }
         if (keyEvent.isPrintingKey() || KeyEvent.KEYCODE_SPACE == keyCode
                 || KeyEvent.KEYCODE_ENTER == keyCode) {
             if (0 != (codePointAndFlags & KeyCharacterMap.COMBINING_ACCENT)) {
                 // A dead key.
-                return Event.createDeadEvent(codePointAndFlags & KeyCharacterMap.COMBINING_ACCENT_MASK);
+                return Event.createDeadEvent(
+                        codePointAndFlags & KeyCharacterMap.COMBINING_ACCENT_MASK, null /* next */);
             } else {
                 // A committable character. This should be committed right away, taking into
                 // account the current state.
-                return Event.createCommittableEvent(codePointAndFlags);
+                return Event.createCommittableEvent(codePointAndFlags, null /* next */);
             }
         } else {
             return Event.createNotHandledEvent();
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
index b413615..f9ff7b0 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
@@ -59,8 +59,6 @@
     public static final int FORM_FACTOR_TABLET7 = 1;
     public static final int FORM_FACTOR_TABLET10 = 2;
 
-    private static final int IME_ACTION_CUSTOM_LABEL = EditorInfo.IME_MASK_ACTION + 1;
-
     public final InputMethodSubtype mSubtype;
     public final Locale mLocale;
     public final int mDeviceFormFactor;
@@ -174,19 +172,12 @@
     }
 
     public int imeAction() {
-        final int actionId = mEditorInfo.imeOptions & EditorInfo.IME_MASK_ACTION;
-        if ((mEditorInfo.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
-            return EditorInfo.IME_ACTION_NONE;
-        } else if (mEditorInfo.actionLabel != null) {
-            return IME_ACTION_CUSTOM_LABEL;
-        } else {
-            return actionId;
-        }
+        return InputTypeUtils.getActionIdFromEditorInfo(mEditorInfo);
     }
 
     public int imeActionId() {
         final int actionId = imeAction();
-        return actionId == IME_ACTION_CUSTOM_LABEL ? mEditorInfo.actionId : actionId;
+        return actionId == InputTypeUtils.IME_ACTION_CUSTOM_LABEL ? mEditorInfo.actionId : actionId;
     }
 
     @Override
@@ -269,7 +260,7 @@
     }
 
     public static String actionName(final int actionId) {
-        return (actionId == IME_ACTION_CUSTOM_LABEL) ? "actionCustomLabel"
+        return (actionId == InputTypeUtils.IME_ACTION_CUSTOM_LABEL) ? "actionCustomLabel"
                 : EditorInfoCompatUtils.imeActionName(actionId);
     }
 }
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 1088fda..bc9dbc0 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -36,6 +36,7 @@
 import com.android.inputmethod.latin.LatinImeLogger;
 import com.android.inputmethod.latin.R;
 import com.android.inputmethod.latin.RichInputMethodManager;
+import com.android.inputmethod.latin.Settings;
 import com.android.inputmethod.latin.SettingsValues;
 import com.android.inputmethod.latin.SubtypeSwitcher;
 import com.android.inputmethod.latin.WordComposer;
@@ -181,8 +182,8 @@
         keyboardView.setKeyboard(keyboard);
         mCurrentInputView.setKeyboardGeometry(keyboard.mTopPadding);
         keyboardView.setKeyPreviewPopupEnabled(
-                SettingsValues.isKeyPreviewPopupEnabled(mPrefs, mResources),
-                SettingsValues.getKeyPreviewPopupDismissDelay(mPrefs, mResources));
+                Settings.readKeyPreviewPopupEnabled(mPrefs, mResources),
+                Settings.readKeyPreviewPopupDismissDelay(mPrefs, mResources));
         keyboardView.updateAutoCorrectionState(mIsAutoCorrectionActive);
         keyboardView.updateShortcutKey(mSubtypeSwitcher.isShortcutImeReady());
         final boolean subtypeChanged = (oldKeyboard == null)
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index b7bee34..b7584d4 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -146,13 +146,17 @@
     // Key preview
     private static final int PREVIEW_ALPHA = 240;
     private final int mKeyPreviewLayoutId;
-    private final int mPreviewOffset;
-    private final int mPreviewHeight;
-    private final int mPreviewLingerTimeout;
+    private final int mKeyPreviewOffset;
+    private final int mKeyPreviewHeight;
     private final SparseArray<TextView> mKeyPreviewTexts = CollectionUtils.newSparseArray();
     protected final KeyPreviewDrawParams mKeyPreviewDrawParams = new KeyPreviewDrawParams();
     private boolean mShowKeyPreviewPopup = true;
-    private int mDelayAfterPreview;
+    private int mKeyPreviewLingerTimeout;
+
+    // Gesture floating preview text
+    // TODO: Make this parameter customizable by user via settings.
+    private int mGestureFloatingPreviewTextLingerTimeout;
+
     // Background state set
     private static final int[][][] KEY_PREVIEW_BACKGROUND_STATE_TABLE = {
         { // STATE_MIDDLE
@@ -204,6 +208,7 @@
 
     public static class DrawingHandler extends StaticInnerHandlerWrapper<KeyboardView> {
         private static final int MSG_DISMISS_KEY_PREVIEW = 0;
+        private static final int MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 1;
 
         public DrawingHandler(final KeyboardView outerInstance) {
             super(outerInstance);
@@ -221,6 +226,9 @@
                     previewText.setVisibility(INVISIBLE);
                 }
                 break;
+            case MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT:
+                keyboardView.mPreviewPlacerView.setGestureFloatingPreviewText(SuggestedWords.EMPTY);
+                break;
             }
         }
 
@@ -236,6 +244,10 @@
             removeMessages(MSG_DISMISS_KEY_PREVIEW);
         }
 
+        public void dismissGestureFloatingPreviewText(final long delay) {
+            sendMessageDelayed(obtainMessage(MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT), delay);
+        }
+
         public void cancelAllMessages() {
             cancelAllDismissKeyPreviews();
         }
@@ -252,13 +264,12 @@
                 R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
         mKeyBackground = keyboardViewAttr.getDrawable(R.styleable.KeyboardView_keyBackground);
         mKeyBackground.getPadding(mKeyBackgroundPadding);
-        mPreviewOffset = keyboardViewAttr.getDimensionPixelOffset(
+        mKeyPreviewOffset = keyboardViewAttr.getDimensionPixelOffset(
                 R.styleable.KeyboardView_keyPreviewOffset, 0);
-        mPreviewHeight = keyboardViewAttr.getDimensionPixelSize(
+        mKeyPreviewHeight = keyboardViewAttr.getDimensionPixelSize(
                 R.styleable.KeyboardView_keyPreviewHeight, 80);
-        mPreviewLingerTimeout = keyboardViewAttr.getInt(
+        mKeyPreviewLingerTimeout = keyboardViewAttr.getInt(
                 R.styleable.KeyboardView_keyPreviewLingerTimeout, 0);
-        mDelayAfterPreview = mPreviewLingerTimeout;
         mKeyLabelHorizontalPadding = keyboardViewAttr.getDimensionPixelOffset(
                 R.styleable.KeyboardView_keyLabelHorizontalPadding, 0);
         mKeyHintLetterPadding = keyboardViewAttr.getDimension(
@@ -280,6 +291,8 @@
                 R.styleable.KeyboardView_moreKeysLayout, 0);
         mBackgroundDimAlpha = keyboardViewAttr.getInt(
                 R.styleable.KeyboardView_backgroundDimAlpha, 0);
+        mGestureFloatingPreviewTextLingerTimeout = keyboardViewAttr.getInt(
+                R.styleable.KeyboardView_gestureFloatingPreviewTextLingerTimeout, 0);
         keyboardViewAttr.recycle();
 
         final TypedArray keyAttr = context.obtainStyledAttributes(attrs,
@@ -332,7 +345,7 @@
      */
     public void setKeyPreviewPopupEnabled(final boolean previewEnabled, final int delay) {
         mShowKeyPreviewPopup = previewEnabled;
-        mDelayAfterPreview = delay;
+        mKeyPreviewLingerTimeout = delay;
     }
 
     /**
@@ -820,7 +833,7 @@
 
     @Override
     public void dismissKeyPreview(final PointerTracker tracker) {
-        mDrawingHandler.dismissKeyPreview(mDelayAfterPreview, tracker);
+        mDrawingHandler.dismissKeyPreview(mKeyPreviewLingerTimeout, tracker);
     }
 
     private void addKeyPreview(final TextView keyPreview) {
@@ -878,7 +891,7 @@
 
     public void dismissGestureFloatingPreviewText() {
         locatePreviewPlacerView();
-        mPreviewPlacerView.dismissGestureFloatingPreviewText();
+        mDrawingHandler.dismissGestureFloatingPreviewText(mGestureFloatingPreviewTextLingerTimeout);
     }
 
     @Override
@@ -942,7 +955,7 @@
                 ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
         final int keyDrawWidth = key.getDrawWidth();
         final int previewWidth = previewText.getMeasuredWidth();
-        final int previewHeight = mPreviewHeight;
+        final int previewHeight = mKeyPreviewHeight;
         // The width and height of visible part of the key preview background. The content marker
         // of the background 9-patch have to cover the visible part of the background.
         previewParams.mPreviewVisibleWidth = previewWidth - previewText.getPaddingLeft()
@@ -951,7 +964,7 @@
                 - previewText.getPaddingBottom();
         // The distance between the top edge of the parent key and the bottom of the visible part
         // of the key preview background.
-        previewParams.mPreviewVisibleOffset = mPreviewOffset - previewText.getPaddingBottom();
+        previewParams.mPreviewVisibleOffset = mKeyPreviewOffset - previewText.getPaddingBottom();
         getLocationInWindow(mOriginCoords);
         // The key preview is horizontally aligned with the center of the visible part of the
         // parent key. If it doesn't fit in this {@link KeyboardView}, it is moved inward to fit and
@@ -970,7 +983,7 @@
         }
         // The key preview is placed vertically above the top edge of the parent key with an
         // arbitrary offset.
-        final int previewY = key.mY - previewHeight + mPreviewOffset
+        final int previewY = key.mY - previewHeight + mKeyPreviewOffset
                 + CoordinateUtils.y(mOriginCoords);
 
         if (background != null) {
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index 62e674a..036372c 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -920,8 +920,12 @@
             final boolean isMajorEvent, final Key key) {
         final int gestureTime = (int)(eventTime - sGestureFirstDownTime);
         if (mIsDetectingGesture) {
+            final int beforeLength = mGestureStrokeWithPreviewPoints.getLength();
             final boolean onValidArea = mGestureStrokeWithPreviewPoints.addPointOnKeyboard(
                     x, y, gestureTime, isMajorEvent);
+            if (mGestureStrokeWithPreviewPoints.getLength() > beforeLength) {
+                mTimerProxy.startUpdateBatchInputTimer(this);
+            }
             // If the move event goes out from valid batch input area, cancel batch input.
             if (!onValidArea) {
                 cancelBatchInput();
@@ -943,7 +947,6 @@
         if (DEBUG_MOVE_EVENT) {
             printTouchEvent("onMoveEvent:", x, y, eventTime);
         }
-        mTimerProxy.cancelUpdateBatchInputTimer(this);
         if (mIsTrackingCanceled) {
             return;
         }
diff --git a/java/src/com/android/inputmethod/keyboard/internal/GestureFloatingPreviewText.java b/java/src/com/android/inputmethod/keyboard/internal/GestureFloatingPreviewText.java
index 84cfb38..aed23a4 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/GestureFloatingPreviewText.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/GestureFloatingPreviewText.java
@@ -19,7 +19,6 @@
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.graphics.Canvas;
-import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.Paint.Align;
 import android.graphics.Rect;
@@ -40,7 +39,6 @@
     private static final class GesturePreviewTextParams {
         public final int mGesturePreviewTextSize;
         public final int mGesturePreviewTextColor;
-        public final int mGesturePreviewTextDimmedColor;
         public final int mGesturePreviewTextOffset;
         public final int mGesturePreviewTextHeight;
         public final int mGesturePreviewColor;
@@ -66,7 +64,6 @@
                     R.styleable.KeyboardView_gestureFloatingPreviewVerticalPadding, 0.0f);
             mGesturePreviewRoundRadius = keyboardViewAttr.getDimension(
                     R.styleable.KeyboardView_gestureFloatingPreviewRoundRadius, 0.0f);
-            mGesturePreviewTextDimmedColor = Color.GRAY;
 
             final Paint textPaint = new Paint();
             textPaint.setAntiAlias(true);
@@ -103,11 +100,7 @@
     }
 
     public void setSuggetedWords(final SuggestedWords suggestedWords) {
-        if (suggestedWords == null) {
-            mSuggestedWords = SuggestedWords.EMPTY;
-        } else {
-            mSuggestedWords = suggestedWords;
-        }
+        mSuggestedWords = suggestedWords;
         updatePreviewPosition();
     }
 
diff --git a/java/src/com/android/inputmethod/keyboard/internal/GesturePreviewTrail.java b/java/src/com/android/inputmethod/keyboard/internal/GesturePreviewTrail.java
index f8949b2..a840725 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/GesturePreviewTrail.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/GesturePreviewTrail.java
@@ -133,7 +133,8 @@
     private static float getWidth(final int elapsedTime, final Params params) {
         final int deltaTime = params.mTrailLingerDuration - elapsedTime;
         final float deltaWidth = params.mTrailStartWidth - params.mTrailEndWidth;
-        return (deltaTime * deltaWidth) / params.mTrailLingerDuration + params.mTrailEndWidth;
+        return Math.max(
+                (deltaTime * deltaWidth) / params.mTrailLingerDuration, params.mTrailEndWidth);
     }
 
     private final RoundedLine mRoundedLine = new RoundedLine();
diff --git a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
index adf2236..ea03f1b 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
@@ -163,6 +163,10 @@
         }
     }
 
+    public int getLength() {
+        return mEventTimes.getLength();
+    }
+
     public void onDownEvent(final int x, final int y, final long downTime,
             final long gestureFirstDownTime, final long lastTypingTime) {
         reset();
@@ -202,7 +206,7 @@
         if (!hasDetectedFastMove()) {
             return false;
         }
-        final int size = mEventTimes.getLength();
+        final int size = getLength();
         if (size <= 0) {
             return false;
         }
@@ -229,7 +233,7 @@
     }
 
     public void duplicateLastPointWith(final int time) {
-        final int lastIndex = mEventTimes.getLength() - 1;
+        final int lastIndex = getLength() - 1;
         if (lastIndex >= 0) {
             final int x = mXCoordinates.get(lastIndex);
             final int y = mYCoordinates.get(lastIndex);
@@ -255,7 +259,7 @@
     }
 
     private void appendPoint(final int x, final int y, final int time) {
-        final int lastIndex = mEventTimes.getLength() - 1;
+        final int lastIndex = getLength() - 1;
         // The point that is created by {@link duplicateLastPointWith(int)} may have later event
         // time than the next {@link MotionEvent}. To maintain the monotonicity of the event time,
         // drop the successive point here.
@@ -281,7 +285,7 @@
     }
 
     private int detectFastMove(final int x, final int y, final int time) {
-        final int size = mEventTimes.getLength();
+        final int size = getLength();
         final int lastIndex = size - 1;
         final int lastX = mXCoordinates.get(lastIndex);
         final int lastY = mYCoordinates.get(lastIndex);
@@ -321,7 +325,7 @@
      */
     public boolean addPointOnKeyboard(final int x, final int y, final int time,
             final boolean isMajorEvent) {
-        final int size = mEventTimes.getLength();
+        final int size = getLength();
         if (size <= 0) {
             // Down event
             appendPoint(x, y, time);
@@ -348,7 +352,7 @@
         final int pixelsPerSec = pixels * MSEC_PER_SEC;
         // Equivalent to (pixels / msecs < mGestureRecognitionThreshold / MSEC_PER_SEC)
         if (pixelsPerSec < mGestureRecognitionSpeedThreshold * msecs) {
-            mIncrementalRecognitionSize = mEventTimes.getLength();
+            mIncrementalRecognitionSize = getLength();
         }
     }
 
@@ -358,7 +362,7 @@
     }
 
     public final void appendAllBatchPoints(final InputPointers out) {
-        appendBatchPoints(out, mEventTimes.getLength());
+        appendBatchPoints(out, getLength());
     }
 
     public final void appendIncrementalBatchPoints(final InputPointers out) {
diff --git a/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java b/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java
index a005dc9..bfb7b1f 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java
@@ -41,6 +41,7 @@
 public final class PreviewPlacerView extends RelativeLayout {
     private final int[] mKeyboardViewOrigin = CoordinateUtils.newInstance();
 
+    // TODO: Consolidate gesture preview trail with {@link KeyboardView}
     private final SparseArray<GesturePreviewTrail> mGesturePreviewTrails =
             CollectionUtils.newSparseArray();
     private final Params mGesturePreviewTrailParams;
@@ -60,19 +61,16 @@
 
     private final DrawingHandler mDrawingHandler;
 
+    // TODO: Remove drawing handler.
     private static final class DrawingHandler extends StaticInnerHandlerWrapper<PreviewPlacerView> {
-        private static final int MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 0;
-        private static final int MSG_UPDATE_GESTURE_PREVIEW_TRAIL = 1;
+        private static final int MSG_UPDATE_GESTURE_PREVIEW_TRAIL = 0;
 
         private final Params mGesturePreviewTrailParams;
-        private final int mGestureFloatingPreviewTextLingerTimeout;
 
         public DrawingHandler(final PreviewPlacerView outerInstance,
-                final Params gesturePreviewTrailParams,
-                final int getstureFloatinPreviewTextLinerTimeout) {
+                final Params gesturePreviewTrailParams) {
             super(outerInstance);
             mGesturePreviewTrailParams = gesturePreviewTrailParams;
-            mGestureFloatingPreviewTextLingerTimeout = getstureFloatinPreviewTextLinerTimeout;
         }
 
         @Override
@@ -80,21 +78,12 @@
             final PreviewPlacerView placerView = getOuterInstance();
             if (placerView == null) return;
             switch (msg.what) {
-            case MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT:
-                placerView.setGestureFloatingPreviewText(null);
-                break;
             case MSG_UPDATE_GESTURE_PREVIEW_TRAIL:
                 placerView.invalidate();
                 break;
             }
         }
 
-        public void dismissGestureFloatingPreviewText() {
-            removeMessages(MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT);
-            sendMessageDelayed(obtainMessage(MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT),
-                    mGestureFloatingPreviewTextLingerTimeout);
-        }
-
         public void postUpdateGestureTrailPreview() {
             removeMessages(MSG_UPDATE_GESTURE_PREVIEW_TRAIL);
             sendMessageDelayed(obtainMessage(MSG_UPDATE_GESTURE_PREVIEW_TRAIL),
@@ -112,16 +101,13 @@
 
         final TypedArray keyboardViewAttr = context.obtainStyledAttributes(
                 attrs, R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
-        final int gestureFloatingPreviewTextLingerTimeout = keyboardViewAttr.getInt(
-                R.styleable.KeyboardView_gestureFloatingPreviewTextLingerTimeout, 0);
         // TODO: mGestureFloatingPreviewText could be an instance of GestureFloatingPreviewText or
         // MultiGesturePreviewText, depending on the user's choice in the settings.
         mGestureFloatingPreviewText = new GestureFloatingPreviewText(keyboardViewAttr, context);
         mGesturePreviewTrailParams = new Params(keyboardViewAttr);
         keyboardViewAttr.recycle();
 
-        mDrawingHandler = new DrawingHandler(this, mGesturePreviewTrailParams,
-                gestureFloatingPreviewTextLingerTimeout);
+        mDrawingHandler = new DrawingHandler(this, mGesturePreviewTrailParams);
 
         final Paint gesturePaint = new Paint();
         gesturePaint.setAntiAlias(true);
@@ -285,10 +271,6 @@
         invalidate();
     }
 
-    public void dismissGestureFloatingPreviewText() {
-        mDrawingHandler.dismissGestureFloatingPreviewText();
-    }
-
     private void drawSlidingKeyInputPreview(final Canvas canvas) {
         // TODO: Implement rubber band preview
     }
diff --git a/java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java b/java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java
index 6ac5a9b..a7e85e4 100644
--- a/java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java
+++ b/java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java
@@ -400,7 +400,7 @@
         mKeyboardLayoutSetAdapter = new KeyboardLayoutSetAdapter(context);
 
         final String prefSubtypes =
-                SettingsValues.getPrefAdditionalSubtypes(mPrefs, getResources());
+                Settings.readPrefAdditionalSubtypes(mPrefs, getResources());
         setPrefSubtypes(prefSubtypes, context);
 
         mIsAddingNewSubtype = (savedInstanceState != null)
@@ -564,19 +564,13 @@
     @Override
     public void onPause() {
         super.onPause();
-        final String oldSubtypes = SettingsValues.getPrefAdditionalSubtypes(mPrefs, getResources());
+        final String oldSubtypes = Settings.readPrefAdditionalSubtypes(mPrefs, getResources());
         final InputMethodSubtype[] subtypes = getSubtypes();
         final String prefSubtypes = AdditionalSubtype.createPrefSubtypes(subtypes);
         if (prefSubtypes.equals(oldSubtypes)) {
             return;
         }
-
-        final SharedPreferences.Editor editor = mPrefs.edit();
-        try {
-            editor.putString(Settings.PREF_CUSTOM_INPUT_STYLES, prefSubtypes);
-        } finally {
-            editor.apply();
-        }
+        Settings.writePrefAdditionalSubtypes(mPrefs, prefSubtypes);
         mRichImm.setAdditionalInputMethodSubtypes(subtypes);
     }
 
diff --git a/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java b/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
index 6367156..8a16131 100644
--- a/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
+++ b/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
@@ -102,7 +102,7 @@
                 sound = AudioManager.FX_KEYPRESS_STANDARD;
                 break;
             }
-            mAudioManager.playSoundEffect(sound, mSettingsValues.mFxVolume);
+            mAudioManager.playSoundEffect(sound, mSettingsValues.mKeypressSoundVolume);
         }
     }
 
diff --git a/java/src/com/android/inputmethod/latin/DebugSettings.java b/java/src/com/android/inputmethod/latin/DebugSettings.java
index d1792a3..9be8784 100644
--- a/java/src/com/android/inputmethod/latin/DebugSettings.java
+++ b/java/src/com/android/inputmethod/latin/DebugSettings.java
@@ -107,6 +107,9 @@
         String version = "";
         try {
             final Context context = getActivity();
+            if (context == null) {
+                return;
+            }
             final String packageName = context.getPackageName();
             PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
             version = "Version " + info.versionName;
diff --git a/java/src/com/android/inputmethod/latin/InputTypeUtils.java b/java/src/com/android/inputmethod/latin/InputTypeUtils.java
index 9a4503b..55414b8 100644
--- a/java/src/com/android/inputmethod/latin/InputTypeUtils.java
+++ b/java/src/com/android/inputmethod/latin/InputTypeUtils.java
@@ -17,6 +17,7 @@
 package com.android.inputmethod.latin;
 
 import android.text.InputType;
+import android.view.inputmethod.EditorInfo;
 
 public final class InputTypeUtils implements InputType {
     private static final int WEB_TEXT_PASSWORD_INPUT_TYPE =
@@ -35,6 +36,7 @@
         InputType.TYPE_TEXT_VARIATION_URI,
         InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD,
         InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD };
+    public static final int IME_ACTION_CUSTOM_LABEL = EditorInfo.IME_MASK_ACTION + 1;
 
     private InputTypeUtils() {
         // This utility class is not publicly instantiable.
@@ -102,4 +104,15 @@
         }
         return true;
     }
+
+    public static int getActionIdFromEditorInfo(final EditorInfo editorInfo) {
+        final int actionId = editorInfo.imeOptions & EditorInfo.IME_MASK_ACTION;
+        if ((editorInfo.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
+            return EditorInfo.IME_ACTION_NONE;
+        } else if (editorInfo.actionLabel != null) {
+            return IME_ACTION_CUSTOM_LABEL;
+        } else {
+            return actionId;
+        }
+    }
 }
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 1fdafda..df733c5 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1083,7 +1083,7 @@
     public boolean onEvaluateFullscreenMode() {
         // Reread resource value here, because this method is called by framework anytime as needed.
         final boolean isFullscreenModeAllowed =
-                SettingsValues.isFullscreenModeAllowed(getResources());
+                Settings.readUseFullscreenMode(getResources());
         if (super.onEvaluateFullscreenMode() && isFullscreenModeAllowed) {
             // TODO: Remove this hack. Actually we should not really assume NO_EXTRACT_UI
             // implies NO_FULLSCREEN. However, the framework mistakenly does.  i.e. NO_EXTRACT_UI
@@ -1588,10 +1588,9 @@
             final boolean dismissGestureFloatingPreviewText) {
         showSuggestionStrip(suggestedWords, null);
         final KeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
+        mainKeyboardView.showGestureFloatingPreviewText(suggestedWords);
         if (dismissGestureFloatingPreviewText) {
             mainKeyboardView.dismissGestureFloatingPreviewText();
-        } else {
-            mainKeyboardView.showGestureFloatingPreviewText(suggestedWords);
         }
     }
 
diff --git a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java
index 637916f..e39aae9 100644
--- a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java
+++ b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java
@@ -75,7 +75,7 @@
 
         // Initialize additional subtypes.
         SubtypeLocale.init(context);
-        final String prefAdditionalSubtypes = SettingsValues.getPrefAdditionalSubtypes(
+        final String prefAdditionalSubtypes = Settings.readPrefAdditionalSubtypes(
                 prefs, context.getResources());
         final InputMethodSubtype[] additionalSubtypes =
                 AdditionalSubtype.createAdditionalSubtypesArray(prefAdditionalSubtypes);
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index 1d9d85b..c5930a9 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -23,6 +23,7 @@
 
 import com.android.inputmethod.latin.LocaleUtils.RunInLocale;
 
+import java.util.HashMap;
 import java.util.Locale;
 
 public final class Settings implements SharedPreferences.OnSharedPreferenceChangeListener {
@@ -66,6 +67,11 @@
     public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
     public static final String PREF_DEBUG_SETTINGS = "debug_settings";
 
+    // This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead.
+    // This is being used only for the backward compatibility.
+    private static final String PREF_SUPPRESS_LANGUAGE_SWITCH_KEY =
+            "pref_suppress_language_switch_key";
+
     private Resources mRes;
     private SharedPreferences mPrefs;
     private Locale mCurrentLocale;
@@ -116,4 +122,92 @@
     public SettingsValues getCurrent() {
         return mSettingsValues;
     }
+
+    // Accessed from the settings interface, hence public
+    public static boolean readKeyPreviewPopupEnabled(final SharedPreferences prefs,
+            final Resources res) {
+        final boolean showPopupOption = res.getBoolean(
+                R.bool.config_enable_show_popup_on_keypress_option);
+        if (!showPopupOption) return res.getBoolean(R.bool.config_default_popup_preview);
+        return prefs.getBoolean(PREF_POPUP_ON,
+                res.getBoolean(R.bool.config_default_popup_preview));
+    }
+
+    public static int readKeyPreviewPopupDismissDelay(final SharedPreferences prefs,
+            final Resources res) {
+        return Integer.parseInt(prefs.getString(PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
+                Integer.toString(res.getInteger(
+                        R.integer.config_key_preview_linger_timeout))));
+    }
+
+    public static boolean readShowsLanguageSwitchKey(final SharedPreferences prefs) {
+        if (prefs.contains(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY)) {
+            final boolean suppressLanguageSwitchKey = prefs.getBoolean(
+                    PREF_SUPPRESS_LANGUAGE_SWITCH_KEY, false);
+            final SharedPreferences.Editor editor = prefs.edit();
+            editor.remove(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY);
+            editor.putBoolean(PREF_SHOW_LANGUAGE_SWITCH_KEY, !suppressLanguageSwitchKey);
+            editor.apply();
+        }
+        return prefs.getBoolean(PREF_SHOW_LANGUAGE_SWITCH_KEY, true);
+    }
+
+    public static String readPrefAdditionalSubtypes(final SharedPreferences prefs,
+            final Resources res) {
+        final String predefinedPrefSubtypes = AdditionalSubtype.createPrefSubtypes(
+                res.getStringArray(R.array.predefined_subtypes));
+        return prefs.getString(PREF_CUSTOM_INPUT_STYLES, predefinedPrefSubtypes);
+    }
+
+    public static void writePrefAdditionalSubtypes(final SharedPreferences prefs,
+            final String prefSubtypes) {
+        prefs.edit().putString(Settings.PREF_CUSTOM_INPUT_STYLES, prefSubtypes).apply();
+    }
+
+    public static float readKeypressSoundVolume(final SharedPreferences prefs,
+            final Resources res) {
+        final float volume = prefs.getFloat(PREF_KEYPRESS_SOUND_VOLUME, -1.0f);
+        if (volume >= 0) {
+            return volume;
+        }
+        return Float.parseFloat(
+                ResourceUtils.getDeviceOverrideValue(res, R.array.keypress_volumes));
+    }
+
+    public static int readVibrationDuration(final SharedPreferences prefs,
+            final Resources res) {
+        final int ms = prefs.getInt(PREF_VIBRATION_DURATION_SETTINGS, -1);
+        if (ms >= 0) {
+            return ms;
+        }
+        return Integer.parseInt(
+                ResourceUtils.getDeviceOverrideValue(res, R.array.keypress_vibration_durations));
+    }
+
+    public static boolean readUsabilityStudyMode(final SharedPreferences prefs) {
+        return prefs.getBoolean(DebugSettings.PREF_USABILITY_STUDY_MODE, true);
+    }
+
+    public static long readLastUserHistoryWriteTime(final SharedPreferences prefs,
+            final String locale) {
+        final String str = prefs.getString(PREF_LAST_USER_DICTIONARY_WRITE_TIME, "");
+        final HashMap<String, Long> map = LocaleUtils.localeAndTimeStrToHashMap(str);
+        if (map.containsKey(locale)) {
+            return map.get(locale);
+        }
+        return 0;
+    }
+
+    public static void writeLastUserHistoryWriteTime(final SharedPreferences prefs,
+            final String locale) {
+        final String oldStr = prefs.getString(PREF_LAST_USER_DICTIONARY_WRITE_TIME, "");
+        final HashMap<String, Long> map = LocaleUtils.localeAndTimeStrToHashMap(oldStr);
+        map.put(locale, System.currentTimeMillis());
+        final String newStr = LocaleUtils.localeAndTimeHashMapToStr(map);
+        prefs.edit().putString(PREF_LAST_USER_DICTIONARY_WRITE_TIME, newStr).apply();
+    }
+
+    public static boolean readUseFullscreenMode(final Resources res) {
+        return res.getBoolean(R.bool.config_use_fullscreen_mode);
+    }
 }
diff --git a/java/src/com/android/inputmethod/latin/SettingsFragment.java b/java/src/com/android/inputmethod/latin/SettingsFragment.java
index a2980bf..507a37b 100644
--- a/java/src/com/android/inputmethod/latin/SettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/SettingsFragment.java
@@ -145,11 +145,11 @@
                 mKeyPreviewPopupDismissDelay.setValue(popupDismissDelayDefaultValue);
             }
             mKeyPreviewPopupDismissDelay.setEnabled(
-                    SettingsValues.isKeyPreviewPopupEnabled(prefs, res));
+                    Settings.readKeyPreviewPopupEnabled(prefs, res));
         }
 
         setPreferenceEnabled(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST,
-                SettingsValues.showsLanguageSwitchKey(prefs));
+                Settings.readShowsLanguageSwitchKey(prefs));
 
         final PreferenceScreen dictionaryLink =
                 (PreferenceScreen) findPreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY);
@@ -180,7 +180,7 @@
                     });
             mKeypressVibrationDurationSettingsPref.setSummary(
                     res.getString(R.string.settings_keypress_vibration_duration,
-                            SettingsValues.getCurrentVibrationDuration(prefs, res)));
+                            Settings.readVibrationDuration(prefs, res)));
         }
 
         mKeypressSoundVolumeSettingsPref =
@@ -229,7 +229,7 @@
                     prefs.getBoolean(Settings.PREF_POPUP_ON, true));
         } else if (key.equals(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY)) {
             setPreferenceEnabled(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST,
-                    SettingsValues.showsLanguageSwitchKey(prefs));
+                    Settings.readShowsLanguageSwitchKey(prefs));
         } else if (key.equals(Settings.PREF_GESTURE_INPUT)) {
             final boolean gestureInputEnabledByConfig = getResources().getBoolean(
                     R.bool.config_gesture_input_enabled_by_build_config);
@@ -261,7 +261,7 @@
                 (PreferenceScreen)findPreference(Settings.PREF_CUSTOM_INPUT_STYLES);
         final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
         final Resources res = getResources();
-        final String prefSubtype = SettingsValues.getPrefAdditionalSubtypes(prefs, res);
+        final String prefSubtype = Settings.readPrefAdditionalSubtypes(prefs, res);
         final InputMethodSubtype[] subtypes =
                 AdditionalSubtype.createAdditionalSubtypesArray(prefSubtype);
         final StringBuilder styles = new StringBuilder();
@@ -323,7 +323,7 @@
                 AudioAndHapticFeedbackManager.getInstance().vibrate(ms);
             }
         };
-        final int currentMs = SettingsValues.getCurrentVibrationDuration(sp, getResources());
+        final int currentMs = Settings.readVibrationDuration(sp, getResources());
         final SeekBarDialog.Builder builder = new SeekBarDialog.Builder(context);
         builder.setTitle(R.string.prefs_keypress_vibration_duration_settings)
                 .setListener(listener)
@@ -339,7 +339,7 @@
 
     private static int getCurrentKeyPressSoundVolumePercent(final SharedPreferences sp,
             final Resources res) {
-        return (int)(SettingsValues.getCurrentKeypressSoundVolume(sp, res) * PERCENT_FLOAT);
+        return (int)(Settings.readKeypressSoundVolume(sp, res) * PERCENT_FLOAT);
     }
 
     private void showKeypressSoundVolumeSettingDialog() {
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index 3940662..9a20246 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -27,7 +27,6 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 
 /**
  * When you call the constructor of this class, you may want to change the current system locale by
@@ -36,19 +35,6 @@
 public final class SettingsValues {
     private static final String TAG = SettingsValues.class.getSimpleName();
 
-    private static final int SUGGESTION_VISIBILITY_SHOW_VALUE
-            = R.string.prefs_suggestion_visibility_show_value;
-    private static final int SUGGESTION_VISIBILITY_SHOW_ONLY_PORTRAIT_VALUE
-            = R.string.prefs_suggestion_visibility_show_only_portrait_value;
-    private static final int SUGGESTION_VISIBILITY_HIDE_VALUE
-            = R.string.prefs_suggestion_visibility_hide_value;
-
-    private static final int[] SUGGESTION_VISIBILITY_VALUE_ARRAY = new int[] {
-        SUGGESTION_VISIBILITY_SHOW_VALUE,
-        SUGGESTION_VISIBILITY_SHOW_ONLY_PORTRAIT_VALUE,
-        SUGGESTION_VISIBILITY_HIDE_VALUE
-    };
-
     // From resources:
     public final int mDelayUpdateOldSuggestions;
     public final String mWeakSpaceStrippers;
@@ -65,14 +51,8 @@
     public final boolean mSoundOn;
     public final boolean mKeyPreviewPopupOn;
     private final String mVoiceMode;
-    private final String mAutoCorrectionThresholdRawValue;
-    public final String mShowSuggestionsSetting;
-    @SuppressWarnings("unused") // TODO: Use this
-    private final boolean mUsabilityStudyMode;
     public final boolean mIncludesOtherImesInLanguageSwitchList;
     public final boolean mShowsLanguageSwitchKey;
-    @SuppressWarnings("unused") // TODO: Use this
-    private final String mKeyPreviewPopupDismissDelayRawValue;
     public final boolean mUseContactsDict;
     public final boolean mUseDoubleSpacePeriod;
     // Use bigrams to predict the next word when there is no input for it yet
@@ -86,7 +66,7 @@
 
     // Deduced settings
     public final int mKeypressVibrationDuration;
-    public final float mFxVolume;
+    public final float mKeypressSoundVolume;
     public final int mKeyPreviewPopupDismissDelay;
     private final boolean mAutoCorrectEnabled;
     public final float mAutoCorrectionThreshold;
@@ -129,35 +109,30 @@
 
         // Get the settings preferences
         mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true);
-        mVibrateOn = isVibrateOn(prefs, res);
+        mVibrateOn = readVibrationEnabled(prefs, res);
         mSoundOn = prefs.getBoolean(Settings.PREF_SOUND_ON,
                 res.getBoolean(R.bool.config_default_sound_enabled));
-        mKeyPreviewPopupOn = isKeyPreviewPopupEnabled(prefs, res);
+        mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
         final String voiceModeMain = res.getString(R.string.voice_mode_main);
         final String voiceModeOff = res.getString(R.string.voice_mode_off);
         mVoiceMode = prefs.getString(Settings.PREF_VOICE_MODE, voiceModeMain);
-        mAutoCorrectionThresholdRawValue = prefs.getString(Settings.PREF_AUTO_CORRECTION_THRESHOLD,
+        final String autoCorrectionThresholdRawValue = prefs.getString(
+                Settings.PREF_AUTO_CORRECTION_THRESHOLD,
                 res.getString(R.string.auto_correction_threshold_mode_index_modest));
-        mShowSuggestionsSetting = prefs.getString(Settings.PREF_SHOW_SUGGESTIONS_SETTING,
-                res.getString(R.string.prefs_suggestion_visibility_default_value));
-        mUsabilityStudyMode = getUsabilityStudyMode(prefs);
         mIncludesOtherImesInLanguageSwitchList = prefs.getBoolean(
                 Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false);
-        mShowsLanguageSwitchKey = showsLanguageSwitchKey(prefs);
-        mKeyPreviewPopupDismissDelayRawValue = prefs.getString(
-                Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
-                Integer.toString(res.getInteger(R.integer.config_key_preview_linger_timeout)));
+        mShowsLanguageSwitchKey = Settings.readShowsLanguageSwitchKey(prefs);
         mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
         mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true);
-        mAutoCorrectEnabled = isAutoCorrectEnabled(res, mAutoCorrectionThresholdRawValue);
-        mBigramPredictionEnabled = isBigramPredictionEnabled(prefs, res);
+        mAutoCorrectEnabled = readAutoCorrectEnabled(res, autoCorrectionThresholdRawValue);
+        mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res);
 
         // Compute other readable settings
-        mKeypressVibrationDuration = getCurrentVibrationDuration(prefs, res);
-        mFxVolume = getCurrentKeypressSoundVolume(prefs, res);
-        mKeyPreviewPopupDismissDelay = getKeyPreviewPopupDismissDelay(prefs, res);
-        mAutoCorrectionThreshold = getAutoCorrectionThreshold(res,
-                mAutoCorrectionThresholdRawValue);
+        mKeypressVibrationDuration = Settings.readVibrationDuration(prefs, res);
+        mKeypressSoundVolume = Settings.readKeypressSoundVolume(prefs, res);
+        mKeyPreviewPopupDismissDelay = Settings.readKeyPreviewPopupDismissDelay(prefs, res);
+        mAutoCorrectionThreshold = readAutoCorrectionThreshold(res,
+                autoCorrectionThresholdRawValue);
         mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff);
         mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain);
         final boolean gestureInputEnabledByBuildConfig = res.getBoolean(
@@ -168,53 +143,10 @@
         mGestureFloatingPreviewTextEnabled = prefs.getBoolean(
                 Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true);
         mCorrectionEnabled = mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect;
-        mSuggestionVisibility = createSuggestionVisibility(res);
-    }
-
-    // Helper functions to create member values.
-    private static SuggestedWords createSuggestPuncList(final String[] puncs) {
-        final ArrayList<SuggestedWordInfo> puncList = CollectionUtils.newArrayList();
-        if (puncs != null) {
-            for (final String puncSpec : puncs) {
-                puncList.add(new SuggestedWordInfo(KeySpecParser.getLabel(puncSpec),
-                        SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_HARDCODED,
-                        Dictionary.TYPE_HARDCODED));
-            }
-        }
-        return new SuggestedWords(puncList,
-                false /* typedWordValid */,
-                false /* hasAutoCorrectionCandidate */,
-                true /* isPunctuationSuggestions */,
-                false /* isObsoleteSuggestions */,
-                false /* isPrediction */);
-    }
-
-    private static String createWordSeparators(final String weakSpaceStrippers,
-            final String weakSpaceSwappers, final String symbolsExcludedFromWordSeparators,
-            final Resources res) {
-        String wordSeparators = weakSpaceStrippers + weakSpaceSwappers
-                + res.getString(R.string.phantom_space_promoting_symbols);
-        for (int i = symbolsExcludedFromWordSeparators.length() - 1; i >= 0; --i) {
-            wordSeparators = wordSeparators.replace(
-                    symbolsExcludedFromWordSeparators.substring(i, i + 1), "");
-        }
-        return wordSeparators;
-    }
-
-    private int createSuggestionVisibility(final Resources res) {
-        final String suggestionVisiblityStr = mShowSuggestionsSetting;
-        for (int visibility : SUGGESTION_VISIBILITY_VALUE_ARRAY) {
-            if (suggestionVisiblityStr.equals(res.getString(visibility))) {
-                return visibility;
-            }
-        }
-        throw new RuntimeException("Bug: visibility string is not configured correctly");
-    }
-
-    private static boolean isVibrateOn(final SharedPreferences prefs, final Resources res) {
-        final boolean hasVibrator = AudioAndHapticFeedbackManager.getInstance().hasVibrator();
-        return hasVibrator && prefs.getBoolean(Settings.PREF_VIBRATE_ON,
-                res.getBoolean(R.bool.config_default_vibration_enabled));
+        final String showSuggestionsSetting = prefs.getString(
+                Settings.PREF_SHOW_SUGGESTIONS_SETTING,
+                res.getString(R.string.prefs_suggestion_visibility_default_value));
+        mSuggestionVisibility = createSuggestionVisibility(res, showSuggestionsSetting);
     }
 
     public boolean isApplicationSpecifiedCompletionsOn() {
@@ -262,41 +194,106 @@
         return mInputAttributes.mShouldInsertSpacesAutomatically;
     }
 
-    private static boolean isAutoCorrectEnabled(final Resources res,
+    public boolean isVoiceKeyEnabled(final EditorInfo editorInfo) {
+        final boolean shortcutImeEnabled = SubtypeSwitcher.getInstance().isShortcutImeEnabled();
+        final int inputType = (editorInfo != null) ? editorInfo.inputType : 0;
+        return shortcutImeEnabled && mVoiceKeyEnabled
+                && !InputTypeUtils.isPasswordInputType(inputType);
+    }
+
+    public boolean isVoiceKeyOnMain() {
+        return mVoiceKeyOnMain;
+    }
+
+    public boolean isLanguageSwitchKeyEnabled() {
+        if (!mShowsLanguageSwitchKey) {
+            return false;
+        }
+        final RichInputMethodManager imm = RichInputMethodManager.getInstance();
+        if (mIncludesOtherImesInLanguageSwitchList) {
+            return imm.hasMultipleEnabledIMEsOrSubtypes(false /* include aux subtypes */);
+        } else {
+            return imm.hasMultipleEnabledSubtypesInThisIme(false /* include aux subtypes */);
+        }
+    }
+
+    public boolean isSameInputType(final EditorInfo editorInfo) {
+        return mInputAttributes.isSameInputType(editorInfo);
+    }
+
+    // Helper functions to create member values.
+    private static SuggestedWords createSuggestPuncList(final String[] puncs) {
+        final ArrayList<SuggestedWordInfo> puncList = CollectionUtils.newArrayList();
+        if (puncs != null) {
+            for (final String puncSpec : puncs) {
+                puncList.add(new SuggestedWordInfo(KeySpecParser.getLabel(puncSpec),
+                        SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_HARDCODED,
+                        Dictionary.TYPE_HARDCODED));
+            }
+        }
+        return new SuggestedWords(puncList,
+                false /* typedWordValid */,
+                false /* hasAutoCorrectionCandidate */,
+                true /* isPunctuationSuggestions */,
+                false /* isObsoleteSuggestions */,
+                false /* isPrediction */);
+    }
+
+    private static String createWordSeparators(final String weakSpaceStrippers,
+            final String weakSpaceSwappers, final String symbolsExcludedFromWordSeparators,
+            final Resources res) {
+        String wordSeparators = weakSpaceStrippers + weakSpaceSwappers
+                + res.getString(R.string.phantom_space_promoting_symbols);
+        for (int i = symbolsExcludedFromWordSeparators.length() - 1; i >= 0; --i) {
+            wordSeparators = wordSeparators.replace(
+                    symbolsExcludedFromWordSeparators.substring(i, i + 1), "");
+        }
+        return wordSeparators;
+    }
+
+    private static final int SUGGESTION_VISIBILITY_SHOW_VALUE =
+            R.string.prefs_suggestion_visibility_show_value;
+    private static final int SUGGESTION_VISIBILITY_SHOW_ONLY_PORTRAIT_VALUE =
+            R.string.prefs_suggestion_visibility_show_only_portrait_value;
+    private static final int SUGGESTION_VISIBILITY_HIDE_VALUE =
+            R.string.prefs_suggestion_visibility_hide_value;
+    private static final int[] SUGGESTION_VISIBILITY_VALUE_ARRAY = new int[] {
+        SUGGESTION_VISIBILITY_SHOW_VALUE,
+        SUGGESTION_VISIBILITY_SHOW_ONLY_PORTRAIT_VALUE,
+        SUGGESTION_VISIBILITY_HIDE_VALUE
+    };
+
+    private static int createSuggestionVisibility(final Resources res,
+            final String suggestionVisiblityStr) {
+        for (int visibility : SUGGESTION_VISIBILITY_VALUE_ARRAY) {
+            if (suggestionVisiblityStr.equals(res.getString(visibility))) {
+                return visibility;
+            }
+        }
+        throw new RuntimeException("Bug: visibility string is not configured correctly");
+    }
+
+    private static boolean readVibrationEnabled(final SharedPreferences prefs,
+            final Resources res) {
+        final boolean hasVibrator = AudioAndHapticFeedbackManager.getInstance().hasVibrator();
+        return hasVibrator && prefs.getBoolean(Settings.PREF_VIBRATE_ON,
+                res.getBoolean(R.bool.config_default_vibration_enabled));
+    }
+
+    private static boolean readAutoCorrectEnabled(final Resources res,
             final String currentAutoCorrectionSetting) {
         final String autoCorrectionOff = res.getString(
                 R.string.auto_correction_threshold_mode_index_off);
         return !currentAutoCorrectionSetting.equals(autoCorrectionOff);
     }
 
-    // TODO: Clean up and move public helper methods to Settings class.
-    // Public to access from KeyboardSwitcher. Should it have access to some
-    // process-global instance instead?
-    public static boolean isKeyPreviewPopupEnabled(final SharedPreferences prefs,
-            final Resources res) {
-        final boolean showPopupOption = res.getBoolean(
-                R.bool.config_enable_show_popup_on_keypress_option);
-        if (!showPopupOption) return res.getBoolean(R.bool.config_default_popup_preview);
-        return prefs.getBoolean(Settings.PREF_POPUP_ON,
-                res.getBoolean(R.bool.config_default_popup_preview));
-    }
-
-    // Likewise
-    public static int getKeyPreviewPopupDismissDelay(final SharedPreferences prefs,
-            final Resources res) {
-        // TODO: use mKeyPreviewPopupDismissDelayRawValue instead of reading it again here.
-        return Integer.parseInt(prefs.getString(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
-                Integer.toString(res.getInteger(
-                        R.integer.config_key_preview_linger_timeout))));
-    }
-
-    private static boolean isBigramPredictionEnabled(final SharedPreferences prefs,
+    private static boolean readBigramPredictionEnabled(final SharedPreferences prefs,
             final Resources res) {
         return prefs.getBoolean(Settings.PREF_BIGRAM_PREDICTIONS, res.getBoolean(
                 R.bool.config_default_next_word_prediction));
     }
 
-    private static float getAutoCorrectionThreshold(final Resources res,
+    private static float readAutoCorrectionThreshold(final Resources res,
             final String currentAutoCorrectionSetting) {
         final String[] autoCorrectionThresholdValues = res.getStringArray(
                 R.array.auto_correction_threshold_values);
@@ -318,106 +315,4 @@
         }
         return autoCorrectionThreshold;
     }
-
-    public boolean isVoiceKeyEnabled(final EditorInfo editorInfo) {
-        final boolean shortcutImeEnabled = SubtypeSwitcher.getInstance().isShortcutImeEnabled();
-        final int inputType = (editorInfo != null) ? editorInfo.inputType : 0;
-        return shortcutImeEnabled && mVoiceKeyEnabled
-                && !InputTypeUtils.isPasswordInputType(inputType);
-    }
-
-    public boolean isVoiceKeyOnMain() {
-        return mVoiceKeyOnMain;
-    }
-
-    // This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead.
-    // This is being used only for the backward compatibility.
-    private static final String PREF_SUPPRESS_LANGUAGE_SWITCH_KEY =
-            "pref_suppress_language_switch_key";
-
-    public static boolean showsLanguageSwitchKey(final SharedPreferences prefs) {
-        if (prefs.contains(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY)) {
-            final boolean suppressLanguageSwitchKey = prefs.getBoolean(
-                    PREF_SUPPRESS_LANGUAGE_SWITCH_KEY, false);
-            final SharedPreferences.Editor editor = prefs.edit();
-            editor.remove(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY);
-            editor.putBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, !suppressLanguageSwitchKey);
-            editor.apply();
-        }
-        return prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, true);
-    }
-
-    public boolean isLanguageSwitchKeyEnabled() {
-        if (!mShowsLanguageSwitchKey) {
-            return false;
-        }
-        final RichInputMethodManager imm = RichInputMethodManager.getInstance();
-        if (mIncludesOtherImesInLanguageSwitchList) {
-            return imm.hasMultipleEnabledIMEsOrSubtypes(false /* include aux subtypes */);
-        } else {
-            return imm.hasMultipleEnabledSubtypesInThisIme(false /* include aux subtypes */);
-        }
-    }
-
-    public static boolean isFullscreenModeAllowed(final Resources res) {
-        return res.getBoolean(R.bool.config_use_fullscreen_mode);
-    }
-
-    public static String getPrefAdditionalSubtypes(final SharedPreferences prefs,
-            final Resources res) {
-        final String predefinedPrefSubtypes = AdditionalSubtype.createPrefSubtypes(
-                res.getStringArray(R.array.predefined_subtypes));
-        return prefs.getString(Settings.PREF_CUSTOM_INPUT_STYLES, predefinedPrefSubtypes);
-    }
-
-    // Accessed from the settings interface, hence public
-    public static float getCurrentKeypressSoundVolume(final SharedPreferences prefs,
-            final Resources res) {
-        final float volume = prefs.getFloat(Settings.PREF_KEYPRESS_SOUND_VOLUME, -1.0f);
-        if (volume >= 0) {
-            return volume;
-        }
-        return Float.parseFloat(
-                ResourceUtils.getDeviceOverrideValue(res, R.array.keypress_volumes));
-    }
-
-    // Likewise
-    public static int getCurrentVibrationDuration(final SharedPreferences prefs,
-            final Resources res) {
-        final int ms = prefs.getInt(Settings.PREF_VIBRATION_DURATION_SETTINGS, -1);
-        if (ms >= 0) {
-            return ms;
-        }
-        return Integer.parseInt(
-                ResourceUtils.getDeviceOverrideValue(res, R.array.keypress_vibration_durations));
-    }
-
-    // Likewise
-    public static boolean getUsabilityStudyMode(final SharedPreferences prefs) {
-        // TODO: use mUsabilityStudyMode instead of reading it again here
-        return prefs.getBoolean(DebugSettings.PREF_USABILITY_STUDY_MODE, true);
-    }
-
-    public static long getLastUserHistoryWriteTime(final SharedPreferences prefs,
-            final String locale) {
-        final String str = prefs.getString(Settings.PREF_LAST_USER_DICTIONARY_WRITE_TIME, "");
-        final HashMap<String, Long> map = LocaleUtils.localeAndTimeStrToHashMap(str);
-        if (map.containsKey(locale)) {
-            return map.get(locale);
-        }
-        return 0;
-    }
-
-    public static void setLastUserHistoryWriteTime(final SharedPreferences prefs,
-            final String locale) {
-        final String oldStr = prefs.getString(Settings.PREF_LAST_USER_DICTIONARY_WRITE_TIME, "");
-        final HashMap<String, Long> map = LocaleUtils.localeAndTimeStrToHashMap(oldStr);
-        map.put(locale, System.currentTimeMillis());
-        final String newStr = LocaleUtils.localeAndTimeHashMapToStr(map);
-        prefs.edit().putString(Settings.PREF_LAST_USER_DICTIONARY_WRITE_TIME, newStr).apply();
-    }
-
-    public boolean isSameInputType(final EditorInfo editorInfo) {
-        return mInputAttributes.isSameInputType(editorInfo);
-    }
 }
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index fe29084..eb0ec39 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -31,6 +31,7 @@
 import android.view.inputmethod.InputMethodManager;
 import android.view.inputmethod.InputMethodSubtype;
 
+import com.android.inputmethod.annotations.UsedForTesting;
 import com.android.inputmethod.keyboard.KeyboardSwitcher;
 
 import java.util.List;
@@ -239,7 +240,14 @@
         return mNeedsToDisplayLanguage.getValue();
     }
 
+    private static Locale sForcedLocaleForTesting = null;
+    @UsedForTesting
+    void forceLocale(final Locale locale) {
+        sForcedLocaleForTesting = locale;
+    }
+
     public Locale getCurrentSubtypeLocale() {
+        if (null != sForcedLocaleForTesting) return sForcedLocaleForTesting;
         return SubtypeLocale.getSubtypeLocale(getCurrentSubtype());
     }
 
diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
index 31a0f83..4c78848 100644
--- a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
@@ -219,7 +219,7 @@
             } catch (InterruptedException e) {
             }
         }
-        final long last = SettingsValues.getLastUserHistoryWriteTime(mPrefs, mLocale);
+        final long last = Settings.readLastUserHistoryWriteTime(mPrefs, mLocale);
         final boolean initializing = last == 0;
         final long now = System.currentTimeMillis();
         profTotal = 0;
@@ -355,7 +355,7 @@
             }
 
             // Save the timestamp after we finish writing the binary dictionary.
-            SettingsValues.setLastUserHistoryWriteTime(mPrefs, mLocale);
+            Settings.writeLastUserHistoryWriteTime(mPrefs, mLocale);
             if (PROFILE_SAVE_RESTORE) {
                 final long diff = System.currentTimeMillis() - now;
                 Log.w(TAG, "PROF: Write User HistoryDictionary: " + mLocale + ", " + diff + "ms.");
diff --git a/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java b/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java
index e2d669b..6b4d52d 100644
--- a/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java
+++ b/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java
@@ -117,7 +117,5 @@
         // Now simulate the user moving the cursor.
         SpanGetter span = new SpanGetter(mTextView.getText(), UnderlineSpan.class);
         assertNull("should not be composing, so should not have an underline span", span.mSpan);
-        span = new SpanGetter(mTextView.getText(), SuggestionSpan.class);
-        assertNull("should not be composing, so should not have an underline span", span.mSpan);
     }
 }
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
index 8629867..a01fef2 100644
--- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java
+++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java
@@ -55,8 +55,6 @@
     protected MyTextView mTextView;
     protected View mInputView;
     protected InputConnection mInputConnection;
-    private final HashMap<String, InputMethodSubtype> mSubtypeMap =
-            new HashMap<String, InputMethodSubtype>();
 
     // A helper class to ease span tests
     public static class SpanGetter {
@@ -143,7 +141,6 @@
         final boolean previousDebugSetting = setDebugMode(true);
         mLatinIME.onCreate();
         setDebugMode(previousDebugSetting);
-        initSubtypeMap();
         final EditorInfo ei = new EditorInfo();
         ei.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT;
         final InputConnection ic = mTextView.onCreateInputConnection(ei);
@@ -161,26 +158,6 @@
         changeLanguage("en_US");
     }
 
-    private void initSubtypeMap() {
-        final InputMethodManager imm = (InputMethodManager)mLatinIME.getSystemService(
-                Context.INPUT_METHOD_SERVICE);
-        final String packageName = mLatinIME.getPackageName();
-        // The IMEs and subtypes don't need to be enabled to run this test because IMF isn't
-        // involved here.
-        for (final InputMethodInfo imi : imm.getInputMethodList()) {
-            if (imi.getPackageName().equals(packageName)) {
-                final int subtypeCount = imi.getSubtypeCount();
-                for (int i = 0; i < subtypeCount; i++) {
-                    final InputMethodSubtype ims = imi.getSubtypeAt(i);
-                    final String locale = ims.getLocale();
-                    mSubtypeMap.put(locale, ims);
-                }
-                return;
-            }
-        }
-        fail("LatinIME is not found");
-    }
-
     // We need to run the messages added to the handler from LatinIME. The only way to do
     // that is to call Looper#loop() on the right looper, so we're going to get the looper
     // object and call #loop() here. The messages in the handler actually run on the UI
@@ -270,12 +247,8 @@
     }
 
     protected void changeLanguage(final String locale) {
-        final InputMethodSubtype subtype = mSubtypeMap.get(locale);
         mTextView.mCurrentLocale = LocaleUtils.constructLocaleFromString(locale);
-        if (subtype == null) {
-            fail("InputMethodSubtype for locale " + locale + " is not enabled");
-        }
-        SubtypeSwitcher.getInstance().onSubtypeChanged(subtype);
+        SubtypeSwitcher.getInstance().forceLocale(mTextView.mCurrentLocale);
         mLatinIME.loadKeyboard();
         mKeyboard = mLatinIME.mKeyboardSwitcher.getKeyboard();
         waitForDictionaryToBeLoaded();
