Merge "[CS2] Refactor a bit removeDups"
diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml
index 5d8ef43..6f4e602 100644
--- a/java/AndroidManifest.xml
+++ b/java/AndroidManifest.xml
@@ -86,7 +86,7 @@
         </receiver>
 
         <activity android:name=".settings.SettingsActivity"
-                android:theme="@style/platformSettingsTheme"
+                android:theme="@style/platformActivityTheme"
                 android:label="@string/english_ime_settings"
                 android:uiOptions="splitActionBarWhenNarrow">
             <intent-filter>
@@ -95,7 +95,7 @@
         </activity>
 
         <activity android:name=".spellcheck.SpellCheckerSettingsActivity"
-                  android:theme="@style/platformSettingsTheme"
+                  android:theme="@style/platformActivityTheme"
                   android:label="@string/android_spell_checker_settings">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -103,7 +103,7 @@
         </activity>
 
         <activity android:name=".settings.DebugSettingsActivity"
-                android:theme="@style/platformSettingsTheme"
+                android:theme="@style/platformActivityTheme"
                 android:label="@string/english_ime_debug_settings">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -150,7 +150,7 @@
         </receiver>
 
         <activity android:name="com.android.inputmethod.dictionarypack.DictionarySettingsActivity"
-                android:theme="@style/platformSettingsTheme"
+                android:theme="@style/platformActivityTheme"
                 android:label="@string/dictionary_settings_title"
                 android:uiOptions="splitActionBarWhenNarrow">
             <intent-filter>
diff --git a/java/res/values-v20/platform-theme.xml b/java/res/values-v20/platform-theme.xml
new file mode 100644
index 0000000..52e7f35
--- /dev/null
+++ b/java/res/values-v20/platform-theme.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2014, 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.
+*/
+-->
+
+<!-- TODO: This file is temporarily placed under values-v20. -->
+<!-- TODO: It might be moved under values-v21. -->
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+    <style name="platformActivityTheme" parent="@android:style/Theme.Material.Light" />
+    <style name="platformDialogTheme" parent="@android:style/Theme.Material.Light.Dialog" />
+</resources>
diff --git a/java/res/values-v21/platform-theme.xml b/java/res/values-v21/platform-theme.xml
deleted file mode 100644
index a49e364..0000000
--- a/java/res/values-v21/platform-theme.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2014, 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.
-*/
--->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-    <style name="platformActivityTheme" parent="@android:style/Theme.Material.Light" />
-    <!-- From packages/apps/Settings -->
-    <style name="platformSettingsTheme" parent="@android:style/Theme.Material.Settings">
-        <item name="android:actionBarStyle">@android:style/Widget.Material.Light.ActionBar.Solid</item>
-        <item name="android:alertDialogTheme">@style/Theme.AlertDialog</item>
-    </style>
-    <!-- From packages/apps/Settings -->
-    <style name="Theme.AlertDialog" parent="@*android:style/Theme.Material.Light.Dialog.Alert">
-        <!-- Used by the ActionBar: @color/theme_primary -->
-        <item name="android:colorPrimary">#ff263238</item>
-        <!-- Used by the StatusBar: @color/theme_primary_dark -->
-        <item name="android:colorPrimaryDark">#ff21272b</item>
-        <!-- Used by controls, e.g. CheckBox, ProgressBar, etc.: @color/theme_accent -->
-        <item name="android:colorAccent">#ff009688</item>
-    </style>
-    <style name="platformDialogTheme" parent="@android:style/Theme.Material.Light.Dialog" />
-</resources>
diff --git a/java/res/values/platform-theme.xml b/java/res/values/platform-theme.xml
index e688597..8e131a2 100644
--- a/java/res/values/platform-theme.xml
+++ b/java/res/values/platform-theme.xml
@@ -20,6 +20,5 @@
 
 <resources xmlns:android="http://schemas.android.com/apk/res/android">
     <style name="platformActivityTheme" parent="@android:style/Theme.Holo" />
-    <style name="platformSettingsTheme" parent="@android:style/Theme.Holo" />
     <style name="platformDialogTheme" parent="@android:style/Theme.Holo.Dialog" />
 </resources>
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index cb951d2..e71d951 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -21,77 +21,61 @@
     <PreferenceScreen
         android:title="@string/settings_screen_input"
         android:key="screen_input">
-        <SwitchPreference
+        <CheckBoxPreference
             android:key="auto_cap"
             android:title="@string/auto_cap"
             android:summary="@string/auto_cap_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
-        <SwitchPreference
+            android:defaultValue="true"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="pref_key_use_double_space_period"
             android:title="@string/use_double_space_period"
             android:summary="@string/use_double_space_period_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
-        <SwitchPreference
+            android:defaultValue="true"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="vibrate_on"
             android:title="@string/vibrate_on_keypress"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="@bool/config_default_vibration_enabled" />
-        <SwitchPreference
+            android:defaultValue="@bool/config_default_vibration_enabled"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="sound_on"
             android:title="@string/sound_on_keypress"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="@bool/config_default_sound_enabled" />
-        <SwitchPreference
+            android:defaultValue="@bool/config_default_sound_enabled"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="popup_on"
             android:title="@string/popup_on_keypress"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="@bool/config_default_key_preview_popup" />
-        <SwitchPreference
+            android:defaultValue="@bool/config_default_key_preview_popup"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="pref_voice_input_key"
             android:title="@string/voice_input"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
+            android:defaultValue="true"
+            android:persistent="true" />
     </PreferenceScreen>
     <ListPreference
         android:key="pref_keyboard_theme"
         android:title="@string/keyboard_theme"
-        android:persistent="true"
         android:entryValues="@array/keyboard_theme_ids"
-        android:entries="@array/keyboard_theme_names" />
+        android:entries="@array/keyboard_theme_names"
+        android:persistent="true" />
     <PreferenceScreen
         android:title="@string/settings_screen_multi_lingual"
         android:key="screen_multi_lingual">
-        <SwitchPreference
+        <CheckBoxPreference
             android:key="pref_show_language_switch_key"
             android:title="@string/show_language_switch_key"
             android:summary="@string/show_language_switch_key_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
-        <SwitchPreference
+            android:defaultValue="true"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="pref_include_other_imes_in_language_switch_list"
             android:dependency="pref_show_language_switch_key"
             android:title="@string/include_other_imes_in_language_switch_list"
             android:summary="@string/include_other_imes_in_language_switch_list_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="false" />
+            android:defaultValue="false"
+            android:persistent="true" />
         <PreferenceScreen
             android:fragment="com.android.inputmethod.latin.settings.AdditionalSubtypeSettings"
             android:key="custom_input_styles"
@@ -100,31 +84,25 @@
     <PreferenceScreen
         android:title="@string/settings_screen_gesture"
         android:key="screen_gesture">
-        <SwitchPreference
+        <CheckBoxPreference
             android:key="gesture_input"
             android:title="@string/gesture_input"
             android:summary="@string/gesture_input_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
-        <SwitchPreference
+            android:defaultValue="true"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="pref_gesture_floating_preview_text"
             android:dependency="gesture_input"
             android:title="@string/gesture_floating_preview_text"
             android:summary="@string/gesture_floating_preview_text_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
-        <SwitchPreference
+            android:defaultValue="true"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="pref_gesture_preview_trail"
             android:dependency="gesture_input"
             android:title="@string/gesture_preview_trail"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
+            android:defaultValue="true"
+            android:persistent="true" />
     </PreferenceScreen>
     <PreferenceScreen
         android:title="@string/settings_screen_correction"
@@ -145,55 +123,47 @@
                  android:value="@string/dictionary_pack_client_id" />
            </intent>
         </PreferenceScreen>
-        <SwitchPreference
+        <CheckBoxPreference
             android:key="pref_key_block_potentially_offensive"
             android:title="@string/prefs_block_potentially_offensive_title"
             android:summary="@string/prefs_block_potentially_offensive_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="@bool/config_block_potentially_offensive" />
+            android:defaultValue="@bool/config_block_potentially_offensive"
+            android:persistent="true" />
         <ListPreference
             android:key="auto_correction_threshold"
             android:title="@string/auto_correction"
             android:summary="@string/auto_correction_summary"
-            android:persistent="true"
             android:entryValues="@array/auto_correction_threshold_mode_indexes"
             android:entries="@array/auto_correction_threshold_modes"
-            android:defaultValue="@string/auto_correction_threshold_mode_index_modest" />
+            android:defaultValue="@string/auto_correction_threshold_mode_index_modest"
+            android:persistent="true" />
         <ListPreference
             android:key="show_suggestions_setting"
             android:summary="@string/prefs_show_suggestions_summary"
             android:title="@string/prefs_show_suggestions"
-            android:persistent="true"
             android:entryValues="@array/prefs_suggestion_visibility_values"
             android:entries="@array/prefs_suggestion_visibilities"
-            android:defaultValue="@string/prefs_suggestion_visibility_default_value" />
-        <SwitchPreference
+            android:defaultValue="@string/prefs_suggestion_visibility_default_value"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="pref_key_use_personalized_dicts"
             android:title="@string/use_personalized_dicts"
             android:summary="@string/use_personalized_dicts_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
-        <SwitchPreference
+            android:defaultValue="true"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="pref_key_use_contacts_dict"
             android:title="@string/use_contacts_dict"
             android:summary="@string/use_contacts_dict_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
-        <SwitchPreference
+            android:defaultValue="true"
+            android:persistent="true" />
+        <CheckBoxPreference
             android:key="next_word_prediction"
             android:title="@string/bigram_prediction"
             android:summary="@string/bigram_prediction_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
-    </PreferenceScreen>
+            android:defaultValue="true"
+            android:persistent="true" />
+        </PreferenceScreen>
     <PreferenceScreen
         android:title="@string/settings_screen_advanced"
         android:key="screen_advanced">
@@ -211,24 +181,20 @@
             latin:maxValue="100" /> <!-- percent -->
         <!-- The settigs for showing setup wizard application icon shouldn't be persistent and
              the default value is added programmatically. -->
-        <SwitchPreference
+        <CheckBoxPreference
             android:key="pref_show_setup_wizard_icon"
             android:title="@string/show_setup_wizard_icon"
-            android:summary="@string/show_setup_wizard_icon_summary"
-            android:switchTextOn=""
-            android:switchTextOff="" />
+            android:summary="@string/show_setup_wizard_icon_summary" />
         <!-- title will be set programmatically to embed application name -->
-        <SwitchPreference
+        <CheckBoxPreference
             android:key="pref_enable_metrics_logging"
             android:summary="@string/enable_metrics_logging_summary"
-            android:switchTextOn=""
-            android:switchTextOff=""
-            android:persistent="true"
-            android:defaultValue="true" />
+            android:defaultValue="true"
+            android:persistent="true" />
         <PreferenceScreen
             android:key="screen_debug"
             android:title="Debug settings"
-            android:persistent="true"
-            android:defaultValue="false" />
-    </PreferenceScreen>
+            android:defaultValue="false"
+            android:persistent="true" />
+        </PreferenceScreen>
 </PreferenceScreen>
diff --git a/java/res/xml/prefs_for_debug.xml b/java/res/xml/prefs_for_debug.xml
index be4c8b3..ae29a8a 100644
--- a/java/res/xml/prefs_for_debug.xml
+++ b/java/res/xml/prefs_for_debug.xml
@@ -20,28 +20,22 @@
     android:title="@string/prefs_debug_mode"
     android:key="english_ime_debug_settings"
 >
-    <SwitchPreference
+    <CheckBoxPreference
         android:key="debug_mode"
         android:title="@string/prefs_debug_mode"
-        android:switchTextOn=""
-        android:switchTextOff=""
-        android:persistent="true"
-        android:defaultValue="false" />
-    <SwitchPreference
+        android:defaultValue="false"
+        android:persistent="true" />
+    <CheckBoxPreference
         android:key="force_non_distinct_multitouch"
         android:title="@string/prefs_force_non_distinct_multitouch"
-        android:switchTextOn=""
-        android:switchTextOff=""
-        android:persistent="true"
-        android:defaultValue="false" />
-    <SwitchPreference
+        android:defaultValue="false"
+        android:persistent="true" />
+    <CheckBoxPreference
         android:key="pref_sliding_key_input_preview"
         android:title="@string/sliding_key_input_preview"
         android:summary="@string/sliding_key_input_preview_summary"
-        android:switchTextOn=""
-        android:switchTextOff=""
-        android:persistent="true"
-        android:defaultValue="true" />
+        android:defaultValue="true"
+        android:persistent="true" />
     <com.android.inputmethod.latin.settings.SeekBarDialogPreference
         android:key="pref_key_longpress_timeout"
         android:title="@string/prefs_key_longpress_timeout_settings"
diff --git a/java/res/xml/spell_checker_settings.xml b/java/res/xml/spell_checker_settings.xml
index e3db485..3d95018 100644
--- a/java/res/xml/spell_checker_settings.xml
+++ b/java/res/xml/spell_checker_settings.xml
@@ -17,12 +17,10 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
 >
-    <SwitchPreference
+    <CheckBoxPreference
         android:key="pref_spellcheck_use_contacts"
         android:title="@string/use_contacts_for_spellchecking_option_title"
         android:summary="@string/use_contacts_for_spellchecking_option_summary"
-        android:switchTextOn=""
-        android:switchTextOff=""
-        android:persistent="true"
-        android:defaultValue="true" />
+        android:defaultValue="true"
+        android:persistent="true" />
 </PreferenceScreen>
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 8182593..702efb3 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -451,7 +451,7 @@
 
         locatePreviewPlacerView();
         getLocationInWindow(mOriginCoords);
-        mKeyPreviewChoreographer.placeKeyPreviewAndShow(key, keyboard.mIconsSet, mKeyDrawParams,
+        mKeyPreviewChoreographer.placeAndShowKeyPreview(key, keyboard.mIconsSet, mKeyDrawParams,
                 getWidth(), mOriginCoords, mDrawingPreviewPlacerView, isHardwareAccelerated());
     }
 
@@ -554,11 +554,11 @@
             // though there may be some chances that the value is zero. <code>width == 0</code>
             // will cause zero-division error at
             // {@link MoreKeysKeyboardParams#setParameters(int,int,int,int,int,int,boolean,int)}.
-            final boolean singleMoreKeyWithPreview = mKeyPreviewDrawParams.isPopupEnabled()
+            final boolean isSingleMoreKeyWithPreview = mKeyPreviewDrawParams.isPopupEnabled()
                     && !key.noKeyPreview() && moreKeys.length == 1
                     && mKeyPreviewDrawParams.getVisibleWidth() > 0;
             final MoreKeysKeyboard.Builder builder = new MoreKeysKeyboard.Builder(
-                    context, key, getKeyboard(), singleMoreKeyWithPreview,
+                    context, key, getKeyboard(), isSingleMoreKeyWithPreview,
                     mKeyPreviewDrawParams.getVisibleWidth(),
                     mKeyPreviewDrawParams.getVisibleHeight(), newLabelPaint(key));
             moreKeysKeyboard = builder.build();
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
index 353e07c..e0184d7 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
@@ -261,13 +261,13 @@
          * @param context the context of {@link MoreKeysKeyboardView}.
          * @param key the {@link Key} that invokes more keys keyboard.
          * @param keyboard the {@link Keyboard} that contains the parentKey.
-         * @param singleMoreKeyWithPreview true if the <code>key</code> has only one more key
-         *        and key popup preview is enabled.
+         * @param isSingleMoreKeyWithPreview true if the <code>key</code> has just a single
+         *        "more key" and its key popup preview is enabled.
          * @param keyPreviewDrawParams the parameter to place key preview.
-         * @param paintToMeasure the {@link Paint} object to measure a more key width
+         * @param paintToMeasure the {@link Paint} object to measure a "more key" width
          */
         public Builder(final Context context, final Key key, final Keyboard keyboard,
-                final boolean singleMoreKeyWithPreview, final int keyPreviewVisibleWidth,
+                final boolean isSingleMoreKeyWithPreview, final int keyPreviewVisibleWidth,
                 final int keyPreviewVisibleHeight, final Paint paintToMeasure) {
             super(context, new MoreKeysKeyboardParams());
             load(keyboard.mMoreKeysTemplate, keyboard.mId);
@@ -275,10 +275,11 @@
             // TODO: More keys keyboard's vertical gap is currently calculated heuristically.
             // Should revise the algorithm.
             mParams.mVerticalGap = keyboard.mVerticalGap / 2;
+            // This {@link MoreKeysKeyboard} is invoked from the <code>key</code>.
             mParentKey = key;
 
             final int keyWidth, rowHeight;
-            if (singleMoreKeyWithPreview) {
+            if (isSingleMoreKeyWithPreview) {
                 // Use pre-computed width and height if this more keys keyboard has only one key to
                 // mitigate visual flicker between key preview and more keys keyboard.
                 // Caveats for the visual assets: To achieve this effect, both the key preview
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
index 6fc300b..cd29c8d 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
@@ -105,7 +105,7 @@
         mFreeKeyPreviewViews.add(keyPreviewView);
     }
 
-    public void placeKeyPreviewAndShow(final Key key, final KeyboardIconsSet iconsSet,
+    public void placeAndShowKeyPreview(final Key key, final KeyboardIconsSet iconsSet,
             final KeyDrawParams drawParams, final int keyboardViewWidth, final int[] keyboardOrigin,
             final ViewGroup placerView, final boolean withAnimation) {
         final KeyPreviewView keyPreviewView = getKeyPreviewView(key, placerView);
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
index 9d82412..689f878 100644
--- a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
@@ -126,9 +126,17 @@
 
         final PreferenceScreen inputScreen =
                 (PreferenceScreen) findPreference(Settings.SCREEN_INPUT);
+        final PreferenceScreen multiLingualScreen =
+                (PreferenceScreen) findPreference(Settings.SCREEN_MULTI_LINGUAL);
+        final PreferenceScreen gestureScreen =
+                (PreferenceScreen) findPreference(Settings.SCREEN_GESTURE);
+        final PreferenceScreen correctionScreen =
+                (PreferenceScreen) findPreference(Settings.SCREEN_CORRECTION);
         final PreferenceScreen advancedScreen =
                 (PreferenceScreen) findPreference(Settings.SCREEN_ADVANCED);
-        final Preference debugScreen = findPreference(Settings.SCREEN_DEBUG);
+        final PreferenceScreen debugScreen =
+                (PreferenceScreen) findPreference(Settings.SCREEN_DEBUG);
+
         if (Settings.isInternal(prefs)) {
             final Intent debugSettingsIntent = new Intent(Intent.ACTION_MAIN);
             debugSettingsIntent.setClassName(
@@ -149,8 +157,6 @@
             removePreference(Settings.PREF_VIBRATION_DURATION_SETTINGS, advancedScreen);
         }
         if (!Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS) {
-            final PreferenceScreen multiLingualScreen =
-                    (PreferenceScreen) findPreference(Settings.SCREEN_MULTI_LINGUAL);
             removePreference(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, multiLingualScreen);
             removePreference(
                     Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, multiLingualScreen);
@@ -185,8 +191,6 @@
             removePreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON, advancedScreen);
         }
 
-        final PreferenceScreen correctionScreen =
-                (PreferenceScreen) findPreference(Settings.SCREEN_CORRECTION);
         final PreferenceScreen dictionaryLink =
                 (PreferenceScreen) findPreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY);
         final Intent intent = dictionaryLink.getIntent();
@@ -221,7 +225,7 @@
         }
 
         if (!Settings.readFromBuildConfigIfGestureInputEnabled(res)) {
-            removePreference(Settings.SCREEN_GESTURE, getPreferenceScreen());
+            getPreferenceScreen().removePreference(gestureScreen);
         }
 
         AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this);
@@ -462,13 +466,14 @@
 
     @Override
     public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
-        if (!FeedbackUtils.isFeedbackFormSupported()) {
-            return;
+        if (FeedbackUtils.isFeedbackFormSupported()) {
+            menu.add(NO_MENU_GROUP, MENU_FEEDBACK /* itemId */, MENU_FEEDBACK /* order */,
+                    R.string.send_feedback);
         }
-        menu.add(NO_MENU_GROUP, MENU_FEEDBACK /* itemId */, MENU_FEEDBACK /* order */,
-                R.string.send_feedback);
-        menu.add(NO_MENU_GROUP, MENU_ABOUT /* itemId */, MENU_ABOUT /* order */,
-                FeedbackUtils.getAboutKeyboardTitleResId());
+        final int aboutResId = FeedbackUtils.getAboutKeyboardTitleResId();
+        if (aboutResId != 0) {
+            menu.add(NO_MENU_GROUP, MENU_ABOUT /* itemId */, MENU_ABOUT /* order */, aboutResId);
+        }
     }
 
     @Override
@@ -479,8 +484,11 @@
             return true;
         }
         if (itemId == MENU_ABOUT) {
-            startActivity(FeedbackUtils.getAboutKeyboardIntent(getActivity()));
-            return true;
+            final Intent aboutIntent = FeedbackUtils.getAboutKeyboardIntent(getActivity());
+            if (aboutIntent != null) {
+                startActivity(aboutIntent);
+                return true;
+            }
         }
         return super.onOptionsItemSelected(item);
     }
diff --git a/tests/src/com/android/inputmethod/latin/ShiftModeTests.java b/tests/src/com/android/inputmethod/latin/ShiftModeTests.java
index a319ffd..db3c9ba 100644
--- a/tests/src/com/android/inputmethod/latin/ShiftModeTests.java
+++ b/tests/src/com/android/inputmethod/latin/ShiftModeTests.java
@@ -111,24 +111,16 @@
         assertTrue("(Spanish) Auto caps after inverted bang", isCapsModeAutoShifted());
     }
 
-    public void DISABLED_testOtherSentenceSeparators() {
-        // We only run this test on Kitkat+ because previous versions of Android don't
-        // have an Armenian locale. For some reason I don't know, when the requested
-        // locale is not present as a device locale, then the application under test can't
-        // access the resources in that locale -- though it works when the app is actually
-        // running on the device and not under test. If we ever figure out what's going
-        // on, remove this test.
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
-            changeLanguage("hy-AM");
-            assertTrue("(Armenian) Auto caps at start", isCapsModeAutoShifted());
-            type("Hey. ");
-            assertFalse("(Armenian) No auto-caps after latin period", isCapsModeAutoShifted());
-            type("Hey\u0589");
-            assertFalse("(Armenian) No auto-caps directly after armenian period",
-                    isCapsModeAutoShifted());
-            type(" ");
-            assertTrue("(Armenian) Auto-caps after armenian period-whitespace",
-                    isCapsModeAutoShifted());
-        }
+    public void testOtherSentenceSeparators() {
+        changeLanguage("hy_AM");
+        assertTrue("(Armenian) Auto caps at start", isCapsModeAutoShifted());
+        type("Hey. ");
+        assertFalse("(Armenian) No auto-caps after latin period", isCapsModeAutoShifted());
+        type("Hey\u0589");
+        assertFalse("(Armenian) No auto-caps directly after armenian period",
+                isCapsModeAutoShifted());
+        type(" ");
+        assertTrue("(Armenian) Auto-caps after armenian period-whitespace",
+                isCapsModeAutoShifted());
     }
 }
diff --git a/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
index 020d632..c746c83 100644
--- a/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/CapsModeUtilsTests.java
@@ -22,6 +22,7 @@
 import android.text.TextUtils;
 
 import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
+import com.android.inputmethod.latin.utils.LocaleUtils;
 
 import java.util.Locale;
 
@@ -109,5 +110,19 @@
         allPathsForCaps("Liebe Sara,  \n  ", c | w | s, sp, false);
         allPathsForCaps("Liebe Sara  \n  ", c | w | s, sp, false);
         allPathsForCaps("Liebe Sara.\n  ", c | w | s, sp, false);
+
+        // Test armenian period
+        sp = job.runInLocale(res, LocaleUtils.constructLocaleFromString("hy_AM"));
+        assertTrue("Period is not sentence separator in Armenian",
+                !sp.isSentenceSeparator('.'));
+        assertTrue("Sentence separator is Armenian period in Armenian",
+                sp.isSentenceSeparator(0x589));
+        // No space : capitalize only if MODE_CHARACTERS
+        allPathsForCaps("Word", c, sp, false);
+        allPathsForCaps("Word.", c, sp, false);
+        // Space, but no armenian period : capitalize if MODE_WORDS but not SENTENCES
+        allPathsForCaps("Word. ", c | w, sp, false);
+        // Armenian period : capitalize if MODE_SENTENCES
+        allPathsForCaps("Word\u0589 ", c | w | s, sp, false);
     }
 }