Merge "Move locale-specific configuration out of config.xml."
diff --git a/java/res/layout-sw768dp/recognition_status.xml b/java/res/layout-sw768dp/recognition_status.xml
index 40bc098..d476651 100644
--- a/java/res/layout-sw768dp/recognition_status.xml
+++ b/java/res/layout-sw768dp/recognition_status.xml
@@ -26,8 +26,8 @@
             xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/popup_layout"
             android:orientation="vertical"
-            android:layout_height="371dip"
-            android:layout_width="500dip"
+            android:layout_height="371dp"
+            android:layout_width="500dp"
             android:layout_centerInParent="true"
             android:background="@drawable/vs_dialog_red">
         <TextView
@@ -36,13 +36,13 @@
                 android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:singleLine="true"
-                android:layout_marginTop="10dip"
+                android:layout_marginTop="10dp"
                 android:textSize="28sp"
                 android:textColor="#ffffff"
                 android:layout_gravity="center"
                 android:visibility="invisible"/>
         <RelativeLayout
-                android:layout_height="0dip"
+                android:layout_height="0dp"
                 android:layout_width="match_parent"
                 android:layout_weight="1.0">
             <com.android.inputmethod.deprecated.voice.SoundIndicator
@@ -65,8 +65,8 @@
                     android:id="@+id/progress"
                     android:indeterminate="true"
                     android:indeterminateOnly="false"
-                    android:layout_height="60dip"
-                    android:layout_width="60dip"
+                    android:layout_height="60dp"
+                    android:layout_width="60dp"
                     android:layout_centerInParent="true"
                     android:visibility="gone"/>
         </RelativeLayout>
@@ -82,14 +82,14 @@
                 android:layout_width="wrap_content"
                 android:singleLine="true"
                 android:textSize="14sp"
-                android:layout_marginBottom="3dip"
+                android:layout_marginBottom="3dp"
                 android:layout_gravity="center"
                 android:textColor="#ffffff"
                 android:visibility="invisible"/>
         <Button
                 android:id="@+id/button"
                 android:layout_width="match_parent"
-                android:layout_height="54dip"
+                android:layout_height="54dp"
                 android:singleLine="true"
                 android:focusable="true"
                 android:text="@string/cancel"
diff --git a/java/res/layout/input_view.xml b/java/res/layout/input_view.xml
index 0a8d71f..3863534 100644
--- a/java/res/layout/input_view.xml
+++ b/java/res/layout/input_view.xml
@@ -28,7 +28,7 @@
     <View
         android:id="@+id/key_preview_backing"
         android:layout_width="match_parent"
-        android:layout_height="0dip" />
+        android:layout_height="0dp" />
 
     <!-- On tablets, the suggestions strip is centered with horizontal paddings on both sides
          because width of the landscape mode is too long for the suggestions strip. This
diff --git a/java/res/layout/key_preview.xml b/java/res/layout/key_preview.xml
index b620d07..6ed892e 100644
--- a/java/res/layout/key_preview.xml
+++ b/java/res/layout/key_preview.xml
@@ -20,8 +20,8 @@
 
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="wrap_content"
-    android:layout_height="80sp"
-    android:textSize="40sp"
-    android:minWidth="32dip"
+    android:layout_height="80dp"
+    android:textSize="40dp"
+    android:minWidth="32dp"
     android:gravity="center"
     />
diff --git a/java/res/layout/recognition_status.xml b/java/res/layout/recognition_status.xml
index a2ddb7c..5787888 100644
--- a/java/res/layout/recognition_status.xml
+++ b/java/res/layout/recognition_status.xml
@@ -26,8 +26,8 @@
             xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/popup_layout"
             android:orientation="vertical"
-            android:layout_height="371dip"
-            android:layout_width="500dip"
+            android:layout_height="371dp"
+            android:layout_width="500dp"
             android:layout_centerInParent="true"
             android:background="@drawable/vs_dialog_red">
         <TextView
@@ -36,13 +36,13 @@
                 android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:singleLine="true"
-                android:layout_marginTop="10dip"
+                android:layout_marginTop="10dp"
                 android:textSize="20sp"
                 android:textColor="#ffffff"
                 android:layout_gravity="center"
                 android:visibility="invisible"/>
         <RelativeLayout
-                android:layout_height="0dip"
+                android:layout_height="0dp"
                 android:layout_width="match_parent"
                 android:layout_weight="1.0">
             <com.android.inputmethod.deprecated.voice.SoundIndicator
@@ -65,8 +65,8 @@
                     android:id="@+id/progress"
                     android:indeterminate="true"
                     android:indeterminateOnly="false"
-                    android:layout_height="60dip"
-                    android:layout_width="60dip"
+                    android:layout_height="60dp"
+                    android:layout_width="60dp"
                     android:layout_centerInParent="true"
                     android:visibility="gone"/>
         </RelativeLayout>
@@ -82,15 +82,15 @@
                 android:layout_width="wrap_content"
                 android:singleLine="true"
                 android:textSize="15sp"
-                android:layout_marginTop="3dip"
-                android:layout_marginBottom="3dip"
+                android:layout_marginTop="3dp"
+                android:layout_marginBottom="3dp"
                 android:layout_gravity="center"
                 android:textColor="#ffffff"
                 android:visibility="invisible"/>
         <Button
                 android:id="@+id/button"
                 android:layout_width="match_parent"
-                android:layout_height="30dip"
+                android:layout_height="30dp"
                 android:singleLine="true"
                 android:focusable="true"
                 android:text="@string/cancel"
diff --git a/java/res/layout/sound_effect_volume_dialog.xml b/java/res/layout/sound_effect_volume_dialog.xml
index c5b2f10..2946630 100644
--- a/java/res/layout/sound_effect_volume_dialog.xml
+++ b/java/res/layout/sound_effect_volume_dialog.xml
@@ -23,22 +23,22 @@
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_margin="10dip">
+        android:layout_margin="10dp">
     <LinearLayout
         android:orientation="horizontal"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="center_horizontal"
-        android:layout_margin="10dip">
+        android:layout_margin="10dp">
         <TextView android:id="@+id/sound_effect_volume_value"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:textSize="20dip"/>
+            android:textSize="20dp"/>
     </LinearLayout>
     <SeekBar
         android:id="@+id/sound_effect_volume_bar"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:max="100"
-        android:layout_margin="10dip"/>
+        android:layout_margin="10dp"/>
 </LinearLayout>
diff --git a/java/res/layout/suggestion_info.xml b/java/res/layout/suggestion_info.xml
index a364d46..a4ad6df 100644
--- a/java/res/layout/suggestion_info.xml
+++ b/java/res/layout/suggestion_info.xml
@@ -22,6 +22,6 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
-    android:textSize="6sp"
+    android:textSize="6dp"
     android:textColor="@android:color/white"
     style="?attr/suggestionBackgroundStyle" />
diff --git a/java/res/layout/suggestion_preview.xml b/java/res/layout/suggestion_preview.xml
index 3c026ae..856447b 100644
--- a/java/res/layout/suggestion_preview.xml
+++ b/java/res/layout/suggestion_preview.xml
@@ -21,8 +21,8 @@
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
-    android:textSize="18sp"
+    android:textSize="18dp"
     android:textColor="?android:attr/textColorPrimaryInverse"
-    android:minWidth="32dip"
+    android:minWidth="32dp"
     android:gravity="center"
     style="?attr/suggestionPreviewBackgroundStyle" />
diff --git a/java/res/layout/vibration_settings_dialog.xml b/java/res/layout/vibration_settings_dialog.xml
index 981ba9b..c9fb6ec 100644
--- a/java/res/layout/vibration_settings_dialog.xml
+++ b/java/res/layout/vibration_settings_dialog.xml
@@ -23,27 +23,27 @@
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_margin="10dip">
+        android:layout_margin="10dp">
     <LinearLayout
         android:orientation="horizontal"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="center_horizontal"
-        android:layout_margin="10dip">
+        android:layout_margin="10dp">
         <TextView android:id="@+id/vibration_value"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:textSize="20dip"/>
+            android:textSize="20dp"/>
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/settings_ms"
-            android:textSize="20dip"/>
+            android:textSize="20dp"/>
     </LinearLayout>
     <SeekBar
         android:id="@+id/vibration_settings"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:max="250"
-        android:layout_margin="10dip"/>
+        android:layout_margin="10dp"/>
 </LinearLayout>
diff --git a/java/res/layout/voice_punctuation_hint.xml b/java/res/layout/voice_punctuation_hint.xml
index 629a7f2..b32feb6 100644
--- a/java/res/layout/voice_punctuation_hint.xml
+++ b/java/res/layout/voice_punctuation_hint.xml
@@ -29,8 +29,8 @@
     <ImageView android:id="@+id/image"
             android:layout_height="wrap_content"
             android:layout_width="wrap_content"
-            android:paddingLeft="8dip"
-            android:paddingRight="8dip"
+            android:paddingLeft="8dp"
+            android:paddingRight="8dp"
             android:layout_gravity="center_horizontal"
             android:src="@drawable/ic_suggest_strip_microphone"
     />
@@ -39,8 +39,8 @@
             android:text="@string/voice_punctuation_hint"
             android:layout_height="wrap_content"
             android:layout_width="wrap_content"
-            android:paddingTop="2dip"
-            android:paddingRight="3dip"
+            android:paddingTop="2dp"
+            android:paddingRight="3dp"
             android:textSize="13sp"
             android:textColor="#888888"
             android:layout_gravity="center_horizontal"
diff --git a/java/res/layout/voice_swipe_hint.xml b/java/res/layout/voice_swipe_hint.xml
index 4e8859a..b1e27c2 100644
--- a/java/res/layout/voice_swipe_hint.xml
+++ b/java/res/layout/voice_swipe_hint.xml
@@ -25,14 +25,14 @@
         android:layout_height="wrap_content"
         android:background="@drawable/keyboard_suggest_strip"
         android:gravity="center_horizontal"
-        android:paddingTop="2dip">
+        android:paddingTop="2dp">
 
     <TextView android:id="@+id/text"
             android:text="@string/voice_swipe_hint"
             android:layout_height="wrap_content"
             android:layout_width="wrap_content"
-            android:paddingTop="10dip"
-            android:paddingRight="6dip"
+            android:paddingTop="10dp"
+            android:paddingRight="6dp"
             android:textSize="13sp"
             android:textColor="#888888"
             android:layout_gravity="center_horizontal"
diff --git a/java/res/values-en/additional-proximitychars.xml b/java/res/values-en/additional-proximitychars.xml
deleted file mode 100644
index a5ff4a9..0000000
--- a/java/res/values-en/additional-proximitychars.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, 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:xliff="urn:oasis:names:tc:xliff:document:1.2">
-
-    <string-array name="additional_proximitychars">
-        <!-- Empty entry terminates the proximity chars array. -->
-
-        <!-- Additional proximity chars for a -->
-        <item>a</item>
-        <item>e</item>
-        <item>i</item>
-        <item>o</item>
-        <item>u</item>
-        <item></item>
-        <!-- Additional proximity chars for e -->
-        <item>e</item>
-        <item>a</item>
-        <item>i</item>
-        <item>o</item>
-        <item>u</item>
-        <item></item>
-        <!-- Additional proximity chars for i -->
-        <item>i</item>
-        <item>a</item>
-        <item>e</item>
-        <item>o</item>
-        <item>u</item>
-        <item></item>
-        <!-- Additional proximity chars for o -->
-        <item>o</item>
-        <item>a</item>
-        <item>e</item>
-        <item>i</item>
-        <item>u</item>
-        <item></item>
-        <!-- Additional proximity chars for u -->
-        <item>u</item>
-        <item>a</item>
-        <item>e</item>
-        <item>i</item>
-        <item>o</item>
-        <item></item>
-    </string-array>
-
-</resources>
diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml
index 73192d9..6cdcf89 100644
--- a/java/res/values-land/dimens.xml
+++ b/java/res/values-land/dimens.xml
@@ -44,7 +44,7 @@
     <fraction name="key_horizontal_gap_ics">1.020%p</fraction>
 
     <!-- left or right padding of label alignment -->
-    <dimen name="key_label_horizontal_padding">8dip</dimen>
+    <dimen name="key_label_horizontal_padding">8dp</dimen>
 
     <fraction name="key_letter_ratio">65%</fraction>
     <fraction name="key_large_letter_ratio">74%</fraction>
@@ -60,8 +60,8 @@
     <!-- popup_key_height x -0.5 -->
     <dimen name="more_keys_keyboard_vertical_correction_ics">-0.140in</dimen>
 
-    <dimen name="suggestions_strip_height">36dip</dimen>
-    <dimen name="more_suggestions_row_height">36dip</dimen>
+    <dimen name="suggestions_strip_height">36dp</dimen>
+    <dimen name="more_suggestions_row_height">36dp</dimen>
     <integer name="max_more_suggestions_row">2</integer>
     <fraction name="min_more_suggestions_width">60%</fraction>
     <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
diff --git a/java/res/values-sw600dp-land/dimens.xml b/java/res/values-sw600dp-land/dimens.xml
index 68083b5..5dce47e 100644
--- a/java/res/values-sw600dp-land/dimens.xml
+++ b/java/res/values-sw600dp-land/dimens.xml
@@ -40,7 +40,7 @@
     <dimen name="popup_key_height">13.0mm</dimen>
 
     <!-- left or right padding of label alignment -->
-    <dimen name="key_label_horizontal_padding">18dip</dimen>
+    <dimen name="key_label_horizontal_padding">18dp</dimen>
 
     <fraction name="key_letter_ratio">45%</fraction>
     <fraction name="key_large_letter_ratio">48%</fraction>
diff --git a/java/res/values-sw600dp/dimens.xml b/java/res/values-sw600dp/dimens.xml
index a861024..0f256a3 100644
--- a/java/res/values-sw600dp/dimens.xml
+++ b/java/res/values-sw600dp/dimens.xml
@@ -40,7 +40,7 @@
 
     <fraction name="keyboard_bottom_padding_ics">0.0%p</fraction>
 
-    <dimen name="more_keys_keyboard_key_horizontal_padding">6dip</dimen>
+    <dimen name="more_keys_keyboard_key_horizontal_padding">6dp</dimen>
     <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
     <!-- popup_key_height x 1.2 -->
     <dimen name="more_keys_keyboard_slide_allowance">15.6mm</dimen>
@@ -48,7 +48,7 @@
     <dimen name="more_keys_keyboard_vertical_correction">-13.0mm</dimen>
 
     <!-- left or right padding of label alignment -->
-    <dimen name="key_label_horizontal_padding">6dip</dimen>
+    <dimen name="key_label_horizontal_padding">6dp</dimen>
     <dimen name="key_hint_letter_padding">3dp</dimen>
     <dimen name="key_uppercase_letter_padding">3dp</dimen>
 
@@ -63,18 +63,17 @@
     <dimen name="key_preview_height">15.0mm</dimen>
     <dimen name="key_preview_offset">0.1in</dimen>
 
-    <dimen name="key_preview_height_ics">15.0mm</dimen>
     <dimen name="key_preview_offset_ics">0.05in</dimen>
     <!-- popup_key_height x -0.5 -->
     <dimen name="more_keys_keyboard_vertical_correction_ics">-5mm</dimen>
 
-    <dimen name="suggestions_strip_height">44dip</dimen>
-    <dimen name="more_suggestions_row_height">44dip</dimen>
+    <dimen name="suggestions_strip_height">44dp</dimen>
+    <dimen name="more_suggestions_row_height">44dp</dimen>
     <integer name="max_more_suggestions_row">6</integer>
     <fraction name="min_more_suggestions_width">90%</fraction>
     <dimen name="suggestions_strip_padding">15.0mm</dimen>
     <dimen name="suggestion_min_width">0.3in</dimen>
-    <dimen name="suggestion_padding">12dip</dimen>
-    <dimen name="suggestion_text_size">22dip</dimen>
-    <dimen name="more_suggestions_hint_text_size">33dip</dimen>
+    <dimen name="suggestion_padding">12dp</dimen>
+    <dimen name="suggestion_text_size">22dp</dimen>
+    <dimen name="more_suggestions_hint_text_size">33dp</dimen>
 </resources>
diff --git a/java/res/values-sw768dp-land/dimens.xml b/java/res/values-sw768dp-land/dimens.xml
index ef39f43..535c623 100644
--- a/java/res/values-sw768dp-land/dimens.xml
+++ b/java/res/values-sw768dp-land/dimens.xml
@@ -44,7 +44,7 @@
     <dimen name="popup_key_height">13.0mm</dimen>
 
     <!-- left or right padding of label alignment -->
-    <dimen name="key_label_horizontal_padding">18dip</dimen>
+    <dimen name="key_label_horizontal_padding">18dp</dimen>
 
     <fraction name="key_letter_ratio">43%</fraction>
     <fraction name="key_large_letter_ratio">42%</fraction>
@@ -55,7 +55,6 @@
     <fraction name="spacebar_text_ratio">24.00%</fraction>
     <dimen name="key_preview_height">17.0mm</dimen>
 
-    <dimen name="key_preview_height_ics">26.5mm</dimen>
     <dimen name="key_preview_offset_ics">0.05in</dimen>
 
     <dimen name="suggestions_strip_padding">40.0mm</dimen>
diff --git a/java/res/values-sw768dp/dimens.xml b/java/res/values-sw768dp/dimens.xml
index a9ad030..7aefa26 100644
--- a/java/res/values-sw768dp/dimens.xml
+++ b/java/res/values-sw768dp/dimens.xml
@@ -43,7 +43,7 @@
 
     <dimen name="popup_key_height">10.0mm</dimen>
 
-    <dimen name="more_keys_keyboard_key_horizontal_padding">12dip</dimen>
+    <dimen name="more_keys_keyboard_key_horizontal_padding">12dp</dimen>
     <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
     <!-- popup_key_height x 1.2 -->
     <dimen name="more_keys_keyboard_slide_allowance">15.6mm</dimen>
@@ -51,7 +51,7 @@
     <dimen name="more_keys_keyboard_vertical_correction">-13.0mm</dimen>
 
     <!-- left or right padding of label alignment -->
-    <dimen name="key_label_horizontal_padding">6dip</dimen>
+    <dimen name="key_label_horizontal_padding">6dp</dimen>
     <dimen name="key_hint_letter_padding">3dp</dimen>
     <dimen name="key_uppercase_letter_padding">3dp</dimen>
 
@@ -66,18 +66,17 @@
     <dimen name="key_preview_height">15.0mm</dimen>
     <dimen name="key_preview_offset">0.1in</dimen>
 
-    <dimen name="key_preview_height_ics">15.0mm</dimen>
     <dimen name="key_preview_offset_ics">0.05in</dimen>
     <!-- popup_key_height x -0.5 -->
     <dimen name="more_keys_keyboard_vertical_correction_ics">-5mm</dimen>
 
-    <dimen name="suggestions_strip_height">44dip</dimen>
-    <dimen name="more_suggestions_row_height">44dip</dimen>
+    <dimen name="suggestions_strip_height">44dp</dimen>
+    <dimen name="more_suggestions_row_height">44dp</dimen>
     <integer name="max_more_suggestions_row">6</integer>
     <fraction name="min_more_suggestions_width">90%</fraction>
     <dimen name="suggestions_strip_padding">15.0mm</dimen>
-    <dimen name="suggestion_min_width">46dip</dimen>
-    <dimen name="suggestion_padding">8dip</dimen>
-    <dimen name="suggestion_text_size">22dip</dimen>
-    <dimen name="more_suggestions_hint_text_size">33dip</dimen>
+    <dimen name="suggestion_min_width">46dp</dimen>
+    <dimen name="suggestion_padding">8dp</dimen>
+    <dimen name="suggestion_text_size">22dp</dimen>
+    <dimen name="more_suggestions_hint_text_size">33dp</dimen>
 </resources>
diff --git a/java/res/values/additional-proximitychars.xml b/java/res/values/additional-proximitychars.xml
deleted file mode 100644
index 03d10d5..0000000
--- a/java/res/values/additional-proximitychars.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, 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:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string-array name="additional_proximitychars">
-    </string-array>
-</resources>
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index 37720ce..5f74fa7 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -26,8 +26,8 @@
 
     <dimen name="popup_key_height">0.330in</dimen>
 
-    <dimen name="more_keys_keyboard_horizontal_edges_padding">16dip</dimen>
-    <dimen name="more_keys_keyboard_key_horizontal_padding">8dip</dimen>
+    <dimen name="more_keys_keyboard_horizontal_edges_padding">16dp</dimen>
+    <dimen name="more_keys_keyboard_key_horizontal_padding">8dp</dimen>
 
     <fraction name="keyboard_top_padding">1.556%p</fraction>
     <fraction name="keyboard_bottom_padding">4.669%p</fraction>
@@ -48,7 +48,7 @@
     <fraction name="keyboard_bottom_padding_ics">4.669%p</fraction>
     <fraction name="key_bottom_gap_ics">6.127%p</fraction>
     <fraction name="key_horizontal_gap_ics">1.739%p</fraction>
-    <dimen name="more_keys_keyboard_horizontal_edges_padding_ics">4dip</dimen>
+    <dimen name="more_keys_keyboard_horizontal_edges_padding_ics">4dp</dimen>
 
     <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
     <!-- popup_key_height x 1.2 -->
@@ -67,33 +67,32 @@
     <fraction name="key_uppercase_letter_ratio">35%</fraction>
     <fraction name="key_preview_text_ratio">82%</fraction>
     <fraction name="spacebar_text_ratio">33.735%</fraction>
-    <dimen name="key_preview_height">80sp</dimen>
+    <dimen name="key_preview_height">80dp</dimen>
     <dimen name="key_preview_offset">0.1in</dimen>
 
-    <dimen name="key_label_horizontal_padding">4dip</dimen>
+    <dimen name="key_label_horizontal_padding">4dp</dimen>
     <dimen name="key_hint_letter_padding">1dp</dimen>
     <dimen name="key_popup_hint_letter_padding">2dp</dimen>
     <dimen name="key_uppercase_letter_padding">2dp</dimen>
 
-    <dimen name="key_preview_height_ics">80sp</dimen>
     <dimen name="key_preview_offset_ics">0.05in</dimen>
     <!-- popup_key_height x -0.5 -->
     <dimen name="more_keys_keyboard_vertical_correction_ics">-0.165in</dimen>
 
-    <dimen name="suggestions_strip_height">40dip</dimen>
-    <dimen name="more_suggestions_key_horizontal_padding">12dip</dimen>
-    <dimen name="more_suggestions_row_height">40dip</dimen>
-    <dimen name="more_suggestions_bottom_gap">6dip</dimen>
+    <dimen name="suggestions_strip_height">40dp</dimen>
+    <dimen name="more_suggestions_key_horizontal_padding">12dp</dimen>
+    <dimen name="more_suggestions_row_height">40dp</dimen>
+    <dimen name="more_suggestions_bottom_gap">6dp</dimen>
     <dimen name="more_suggestions_modal_tolerance">0.2in</dimen>
     <dimen name="more_suggestions_slide_allowance">0.1in</dimen>
     <integer name="max_more_suggestions_row">6</integer>
     <fraction name="min_more_suggestions_width">90%</fraction>
     <fraction name="more_suggestions_info_ratio">18%</fraction>
-    <dimen name="suggestions_strip_padding">0dip</dimen>
-    <dimen name="suggestion_min_width">44dip</dimen>
-    <dimen name="suggestion_padding">6dip</dimen>
-    <dimen name="suggestion_text_size">18dip</dimen>
-    <dimen name="more_suggestions_hint_text_size">27dip</dimen>
+    <dimen name="suggestions_strip_padding">0dp</dimen>
+    <dimen name="suggestion_min_width">44dp</dimen>
+    <dimen name="suggestion_padding">6dp</dimen>
+    <dimen name="suggestion_text_size">18dp</dimen>
+    <dimen name="more_suggestions_hint_text_size">27dp</dimen>
     <integer name="suggestions_count_in_strip">3</integer>
     <integer name="center_suggestion_percentile">36</integer>
 </resources>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index 7d8b7dd..5628f27 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -95,9 +95,9 @@
         name="MoreKeysKeyboard"
         parent="Keyboard"
     >
-        <item name="keyboardTopPadding">0dip</item>
-        <item name="keyboardBottomPadding">0dip</item>
-        <item name="horizontalGap">0dip</item>
+        <item name="keyboardTopPadding">0dp</item>
+        <item name="keyboardBottomPadding">0dp</item>
+        <item name="horizontalGap">0dp</item>
     </style>
     <style
         name="MoreKeysKeyboardView"
@@ -205,9 +205,9 @@
         name="MoreKeysKeyboard.Stone"
         parent="Keyboard.Stone"
     >
-        <item name="keyboardTopPadding">0dip</item>
-        <item name="keyboardBottomPadding">0dip</item>
-        <item name="horizontalGap">0dip</item>
+        <item name="keyboardTopPadding">0dp</item>
+        <item name="keyboardBottomPadding">0dp</item>
+        <item name="horizontalGap">0dp</item>
     </style>
     <style
         name="MoreKeysKeyboardView.Stone"
@@ -274,9 +274,9 @@
         name="MoreKeysKeyboard.Gingerbread"
         parent="Keyboard.Gingerbread"
     >
-        <item name="keyboardTopPadding">0dip</item>
-        <item name="keyboardBottomPadding">0dip</item>
-        <item name="horizontalGap">0dip</item>
+        <item name="keyboardTopPadding">0dp</item>
+        <item name="keyboardBottomPadding">0dp</item>
+        <item name="horizontalGap">0dp</item>
     </style>
     <style
         name="MoreKeysKeyboardView.Gingerbread"
@@ -315,7 +315,6 @@
         <item name="keyPreviewBackgroundWidth">@dimen/keyboard_key_feedback_background_holo_width</item>
         <item name="keyPreviewBackgroundHeight">@dimen/keyboard_key_feedback_background_holo_height</item>
         <item name="keyPreviewTextColor">#FFFFFFFF</item>
-        <item name="keyPreviewHeight">@dimen/key_preview_height_ics</item>
         <item name="keyPreviewOffset">@dimen/key_preview_offset_ics</item>
         <item name="shadowColor">#00000000</item>
         <item name="shadowRadius">0.0</item>
@@ -334,9 +333,9 @@
         name="MoreKeysKeyboard.IceCreamSandwich"
         parent="Keyboard.IceCreamSandwich"
     >
-        <item name="keyboardTopPadding">0dip</item>
-        <item name="keyboardBottomPadding">0dip</item>
-        <item name="horizontalGap">0dip</item>
+        <item name="keyboardTopPadding">0dp</item>
+        <item name="keyboardBottomPadding">0dp</item>
+        <item name="horizontalGap">0dp</item>
     </style>
     <style
         name="MoreKeysKeyboardView.IceCreamSandwich"
diff --git a/java/res/values/sudden-jumping-touch-event-device-list.xml b/java/res/values/sudden-jumping-touch-event-device-list.xml
index ba828a7..543992a 100644
--- a/java/res/values/sudden-jumping-touch-event-device-list.xml
+++ b/java/res/values/sudden-jumping-touch-event-device-list.xml
@@ -19,9 +19,9 @@
 -->
 <resources>
     <string-array name="sudden_jumping_touch_event_device_list" translatable="false">
-        <!-- Nexus One -->
-        <item>mahimahi</item>
-        <!-- Droid -->
-        <item>sholes</item>
+        <!-- "Build.HARDWARE,true" that needs "sudden jump touch event" hack.
+             See {@link com.android.inputmethod.keyboard.SuddenJumpingTouchEventHandler}. -->
+        <item>mahimahi,true</item> <!-- Nexus One -->
+        <item>sholes,true</item> <!-- Droid -->
     </string-array>
 </resources>
diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java
index d342c6d..13e909c 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java
@@ -16,17 +16,9 @@
 
 package com.android.inputmethod.keyboard;
 
-import android.util.Log;
-
-import java.util.Arrays;
-import java.util.List;
 
 public class KeyDetector {
-    private static final String TAG = KeyDetector.class.getSimpleName();
-    private static final boolean DEBUG = false;
-
     public static final int NOT_A_CODE = -1;
-    private static final int ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE = 2;
 
     private final int mKeyHysteresisDistanceSquared;
 
@@ -34,12 +26,6 @@
     private int mCorrectionX;
     private int mCorrectionY;
     private boolean mProximityCorrectOn;
-    private int mProximityThresholdSquare;
-
-    // working area
-    private static final int MAX_NEARBY_KEYS = 12;
-    private final int[] mDistances = new int[MAX_NEARBY_KEYS];
-    private final Key[] mNeighborKeys = new Key[MAX_NEARBY_KEYS];
 
     /**
      * This class handles key detection.
@@ -57,8 +43,6 @@
         mCorrectionX = (int)correctionX;
         mCorrectionY = (int)correctionY;
         mKeyboard = keyboard;
-        final int threshold = keyboard.mMostCommonKeyWidth;
-        mProximityThresholdSquare = threshold * threshold;
     }
 
     public int getKeyHysteresisDistanceSquared() {
@@ -87,169 +71,11 @@
         return mProximityCorrectOn;
     }
 
-    public void setProximityThreshold(int threshold) {
-        mProximityThresholdSquare = threshold * threshold;
-    }
-
     public boolean alwaysAllowsSlidingInput() {
         return false;
     }
 
     /**
-     * Computes maximum size of the array that can contain all nearby key codes returned by
-     * {@link #getNearbyCodes}.
-     *
-     * @return Returns maximum size of the array that can contain all nearby key codes returned
-     *         by {@link #getNearbyCodes}.
-     */
-    protected int getMaxNearbyKeys() {
-        return MAX_NEARBY_KEYS;
-    }
-
-    /**
-     * Allocates array that can hold all key codes returned by {@link #getNearbyCodes}
-     * method. The maximum size of the array should be computed by {@link #getMaxNearbyKeys}.
-     *
-     * @return Allocates and returns an array that can hold all key codes returned by
-     *         {@link #getNearbyCodes} method. All elements in the returned array are
-     *         initialized by {@link #NOT_A_CODE} value.
-     */
-    public int[] newCodeArray() {
-        int[] codes = new int[getMaxNearbyKeys()];
-        Arrays.fill(codes, NOT_A_CODE);
-        return codes;
-    }
-
-    private void initializeNearbyKeys() {
-        Arrays.fill(mDistances, Integer.MAX_VALUE);
-        Arrays.fill(mNeighborKeys, null);
-    }
-
-    /**
-     * Insert the key into nearby keys buffer and sort nearby keys by ascending order of distance.
-     * If the distance of two keys are the same, the key which the point is on should be considered
-     * as a closer one.
-     *
-     * @param key the key to be inserted into the nearby keys buffer.
-     * @param distance distance between the key's edge and user touched point.
-     * @param isOnKey true if the point is on the key.
-     * @return order of the key in the nearby buffer, 0 if it is the nearest key.
-     */
-    private int sortNearbyKeys(Key key, int distance, boolean isOnKey) {
-        final int[] distances = mDistances;
-        final Key[] neighborKeys = mNeighborKeys;
-        for (int insertPos = 0; insertPos < distances.length; insertPos++) {
-            final int comparingDistance = distances[insertPos];
-            if (distance < comparingDistance || (distance == comparingDistance && isOnKey)) {
-                final int nextPos = insertPos + 1;
-                if (nextPos < distances.length) {
-                    System.arraycopy(distances, insertPos, distances, nextPos,
-                            distances.length - nextPos);
-                    System.arraycopy(neighborKeys, insertPos, neighborKeys, nextPos,
-                            neighborKeys.length - nextPos);
-                }
-                distances[insertPos] = distance;
-                neighborKeys[insertPos] = key;
-                return insertPos;
-            }
-        }
-        return distances.length;
-    }
-
-    private void getNearbyKeyCodes(final int primaryCode, final int[] allCodes) {
-        final Key[] neighborKeys = mNeighborKeys;
-        final int maxCodesSize = allCodes.length;
-
-        // allCodes[0] should always have the key code even if it is a non-letter key.
-        if (neighborKeys[0] == null) {
-            allCodes[0] = NOT_A_CODE;
-            return;
-        }
-
-        int numCodes = 0;
-        for (int j = 0; j < neighborKeys.length && numCodes < maxCodesSize; j++) {
-            final Key key = neighborKeys[j];
-            if (key == null)
-                break;
-            final int code = key.mCode;
-            // filter out a non-letter key from nearby keys
-            if (code < Keyboard.CODE_SPACE)
-                continue;
-            allCodes[numCodes++] = code;
-        }
-        if (maxCodesSize <= numCodes) {
-            return;
-        }
-
-        final int code = (primaryCode == NOT_A_CODE) ? allCodes[0] : primaryCode;
-        if (code == NOT_A_CODE) {
-            return;
-        }
-        final List<Integer> additionalChars = mKeyboard.getAdditionalProximityChars().get(code);
-        if (additionalChars == null || additionalChars.size() == 0) {
-            return;
-        }
-        int currentCodesSize = numCodes;
-        allCodes[numCodes++] = ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE;
-        if (maxCodesSize <= numCodes) {
-            return;
-        }
-        // TODO: This is O(N^2). Assuming additionalChars.size() is up to 4 or 5.
-        for (int i = 0; i < additionalChars.size(); ++i) {
-            final int additionalChar = additionalChars.get(i);
-            boolean contains = false;
-            for (int j = 0; j < currentCodesSize; ++j) {
-                if (additionalChar == allCodes[j]) {
-                    contains = true;
-                    break;
-                }
-            }
-            if (!contains) {
-                allCodes[numCodes++] = additionalChar;
-                if (maxCodesSize <= numCodes) {
-                    return;
-                }
-            }
-        }
-    }
-
-    /**
-     * Finds all possible nearby key codes around a touch event point and returns the nearest key.
-     * The algorithm to determine the nearby keys depends on the threshold set by
-     * {@link #setProximityThreshold(int)} and the mode set by
-     * {@link #setProximityCorrectionEnabled(boolean)}.
-     *
-     * @param x The x-coordinate of a touch point
-     * @param y The y-coordinate of a touch point
-     * @param allCodes All nearby key codes except functional key are returned in this array
-     */
-    // TODO: Move this method to native code.
-    public void getNearbyCodes(int x, int y, final int[] allCodes) {
-        final int touchX = getTouchX(x);
-        final int touchY = getTouchY(y);
-
-        initializeNearbyKeys();
-        Key primaryKey = null;
-        for (final Key key : mKeyboard.getNearestKeys(touchX, touchY)) {
-            final boolean isOnKey = key.isOnKey(touchX, touchY);
-            final int distance = key.squaredDistanceToEdge(touchX, touchY);
-            if (isOnKey || (mProximityCorrectOn && distance < mProximityThresholdSquare)) {
-                final int insertedPosition = sortNearbyKeys(key, distance, isOnKey);
-                if (insertedPosition == 0 && isOnKey) {
-                    primaryKey = key;
-                }
-            }
-        }
-
-        getNearbyKeyCodes(primaryKey != null ? primaryKey.mCode : NOT_A_CODE, allCodes);
-        if (DEBUG) {
-            Log.d(TAG, "x=" + x + " y=" + y
-                    + " primary=" + printableCode(primaryKey)
-                    + " codes=" + printableCodes(allCodes));
-        }
-    }
-
-    /**
      * Detect the key whose hitbox the touch point is in.
      *
      * @param x The x-coordinate of a touch point
@@ -265,9 +91,9 @@
         for (final Key key: mKeyboard.getNearestKeys(touchX, touchY)) {
             final boolean isOnKey = key.isOnKey(touchX, touchY);
             final int distance = key.squaredDistanceToEdge(touchX, touchY);
-            // TODO: need to take care of hitbox overlaps
+            // To take care of hitbox overlaps, we compare mCode here too.
             if (primaryKey == null || distance < minDistance
-                    || (distance == minDistance && isOnKey)) {
+                    || (distance == minDistance && isOnKey && key.mCode > primaryKey.mCode)) {
                 minDistance = distance;
                 primaryKey = key;
             }
@@ -284,14 +110,9 @@
         boolean addDelimiter = false;
         for (final int code : codes) {
             if (code == NOT_A_CODE) break;
-            if (code == ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE) {
-                sb.append(" | ");
-                addDelimiter = false;
-            } else {
-                if (addDelimiter) sb.append(", ");
-                sb.append(Keyboard.printableCode(code));
-                addDelimiter = true;
-            }
+            if (addDelimiter) sb.append(", ");
+            sb.append(Keyboard.printableCode(code));
+            addDelimiter = true;
         }
         return "[" + sb + "]";
     }
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 973f64b..2b1cc43 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -20,7 +20,6 @@
 import android.content.res.Resources;
 import android.content.res.TypedArray;
 import android.content.res.XmlResourceParser;
-import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.util.DisplayMetrics;
 import android.util.Log;
@@ -42,8 +41,6 @@
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
 
 /**
  * Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard
@@ -133,8 +130,6 @@
 
     private final ProximityInfo mProximityInfo;
 
-    private final Map<Integer, List<Integer>> mAdditionalProximityChars;
-
     public Keyboard(Params params) {
         mId = params.mId;
         mThemeId = params.mThemeId;
@@ -153,12 +148,10 @@
         mAltCodeKeysWhileTyping = params.mAltCodeKeysWhileTyping.toArray(
                 new Key[params.mAltCodeKeysWhileTyping.size()]);
         mIconsSet = params.mIconsSet;
-        mAdditionalProximityChars = params.mAdditionalProximityChars;
 
         mProximityInfo = new ProximityInfo(params.mId.mLocale.toString(),
                 params.GRID_WIDTH, params.GRID_HEIGHT, mOccupiedWidth, mOccupiedHeight,
-                mMostCommonKeyWidth, mMostCommonKeyHeight, mKeys, params.mTouchPositionCorrection,
-                params.mAdditionalProximityChars);
+                mMostCommonKeyWidth, mMostCommonKeyHeight, mKeys, params.mTouchPositionCorrection);
     }
 
     public ProximityInfo getProximityInfo() {
@@ -230,9 +223,6 @@
         public final ArrayList<Key> mShiftKeys = new ArrayList<Key>();
         public final ArrayList<Key> mAltCodeKeysWhileTyping = new ArrayList<Key>();
         public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet();
-        // TODO: Should be in Key instead of Keyboard.Params?
-        public final Map<Integer, List<Integer>> mAdditionalProximityChars =
-                new HashMap<Integer, List<Integer>>();
 
         public KeyboardSet.KeysCache mKeysCache;
 
@@ -368,10 +358,6 @@
         return mProximityInfo.getNearestKeys(adjustedX, adjustedY);
     }
 
-    public Map<Integer, List<Integer>> getAdditionalProximityChars() {
-        return mAdditionalProximityChars;
-    }
-
     public static String printableCode(int code) {
         switch (code) {
         case CODE_SHIFT: return "shift";
@@ -630,7 +616,6 @@
             mParams = params;
 
             setTouchPositionCorrectionData(context, params);
-            setAdditionalProximityChars(context, params);
 
             params.GRID_WIDTH = res.getInteger(R.integer.config_keyboard_grid_width);
             params.GRID_HEIGHT = res.getInteger(R.integer.config_keyboard_grid_height);
@@ -653,25 +638,6 @@
             params.mTouchPositionCorrection.load(data);
         }
 
-        private static void setAdditionalProximityChars(Context context, Params params) {
-            final String[] additionalChars =
-                    context.getResources().getStringArray(R.array.additional_proximitychars);
-            int currentPrimaryIndex = 0;
-            for (int i = 0; i < additionalChars.length; ++i) {
-                final String additionalChar = additionalChars[i];
-                if (TextUtils.isEmpty(additionalChar)) {
-                    currentPrimaryIndex = 0;
-                } else if (currentPrimaryIndex == 0) {
-                    currentPrimaryIndex = additionalChar.charAt(0);
-                    params.mAdditionalProximityChars.put(
-                            currentPrimaryIndex, new ArrayList<Integer>());
-                } else if (currentPrimaryIndex != 0) {
-                    final int c = additionalChar.charAt(0);
-                    params.mAdditionalProximityChars.get(currentPrimaryIndex).add(c);
-                }
-            }
-        }
-
         public void setAutoGenerate(KeyboardSet.KeysCache keysCache) {
             mParams.mKeysCache = keysCache;
         }
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 847174c..24eb759 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -99,7 +99,7 @@
 
     // Main keyboard
     private Keyboard mKeyboard;
-    private final KeyDrawParams mKeyDrawParams;
+    protected final KeyDrawParams mKeyDrawParams;
 
     // Key preview
     private final int mKeyPreviewLayoutId;
@@ -171,7 +171,7 @@
         }
     }
 
-    /* package */ static class KeyDrawParams {
+    protected static class KeyDrawParams {
         // XML attributes
         public final int mKeyTextColor;
         public final int mKeyTextInactivatedColor;
@@ -351,7 +351,6 @@
         mDelayAfterPreview = mKeyPreviewDrawParams.mLingerTimeout;
 
         mPaint.setAntiAlias(true);
-        mPaint.setTextAlign(Align.CENTER);
     }
 
     // Read fraction value in TypedArray as float.
@@ -729,10 +728,10 @@
         }
     }
 
-    private static int getCharGeometryCacheKey(char reference, Paint paint) {
+    private static int getCharGeometryCacheKey(char referenceChar, Paint paint) {
         final int labelSize = (int)paint.getTextSize();
         final Typeface face = paint.getTypeface();
-        final int codePointOffset = reference << 15;
+        final int codePointOffset = referenceChar << 15;
         if (face == Typeface.DEFAULT) {
             return codePointOffset + labelSize;
         } else if (face == Typeface.DEFAULT_BOLD) {
@@ -747,41 +746,35 @@
     // Working variable for the following methods.
     private final Rect mTextBounds = new Rect();
 
-    private float getCharHeight(char[] character, Paint paint) {
-        final Integer key = getCharGeometryCacheKey(character[0], paint);
+    private float getCharHeight(char[] referenceChar, Paint paint) {
+        final Integer key = getCharGeometryCacheKey(referenceChar[0], paint);
         final Float cachedValue = sTextHeightCache.get(key);
         if (cachedValue != null)
             return cachedValue;
 
-        paint.getTextBounds(character, 0, 1, mTextBounds);
+        paint.getTextBounds(referenceChar, 0, 1, mTextBounds);
         final float height = mTextBounds.height();
         sTextHeightCache.put(key, height);
         return height;
     }
 
-    private float getCharWidth(char[] character, Paint paint) {
-        final Integer key = getCharGeometryCacheKey(character[0], paint);
+    private float getCharWidth(char[] referenceChar, Paint paint) {
+        final Integer key = getCharGeometryCacheKey(referenceChar[0], paint);
         final Float cachedValue = sTextWidthCache.get(key);
         if (cachedValue != null)
             return cachedValue;
 
-        paint.getTextBounds(character, 0, 1, mTextBounds);
+        paint.getTextBounds(referenceChar, 0, 1, mTextBounds);
         final float width = mTextBounds.width();
         sTextWidthCache.put(key, width);
         return width;
     }
 
-    protected float getLabelWidth(CharSequence label, Paint paint) {
+    public float getLabelWidth(String label, Paint paint) {
         paint.getTextBounds(label.toString(), 0, label.length(), mTextBounds);
         return mTextBounds.width();
     }
 
-    public float getDefaultLabelWidth(String label, Paint paint) {
-        paint.setTextSize(mKeyDrawParams.mKeyLabelSize);
-        paint.setTypeface(mKeyDrawParams.mKeyTextStyle);
-        return getLabelWidth(label, paint);
-    }
-
     protected static void drawIcon(Canvas canvas, Drawable icon, int x, int y, int width,
             int height) {
         canvas.translate(x, y);
@@ -815,6 +808,14 @@
         canvas.translate(-x, -y);
     }
 
+    public Paint newDefaultLabelPaint() {
+        final Paint paint = new Paint();
+        paint.setAntiAlias(true);
+        paint.setTypeface(mKeyDrawParams.mKeyTextStyle);
+        paint.setTextSize(mKeyDrawParams.mKeyLabelSize);
+        return paint;
+    }
+
     public void cancelAllMessages() {
         mDrawingHandler.cancelAllMessages();
     }
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index 3438425..da7d01a 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -54,6 +54,7 @@
 import com.android.inputmethod.latin.SubtypeUtils;
 import com.android.inputmethod.latin.Utils;
 import com.android.inputmethod.latin.Utils.UsabilityStudyLogUtils;
+import com.android.inputmethod.latin.Utils.UsabilityStudyLogUtils.LogGroup;
 
 import java.util.Locale;
 import java.util.WeakHashMap;
@@ -480,7 +481,6 @@
         super.setKeyboard(keyboard);
         mKeyDetector.setKeyboard(
                 keyboard, -getPaddingLeft(), -getPaddingTop() + mVerticalCorrection);
-        mKeyDetector.setProximityThreshold(keyboard.mMostCommonKeyWidth);
         PointerTracker.setKeyDetector(mKeyDetector);
         mTouchScreenRegulator.setKeyboard(keyboard);
         mMoreKeysPanelCache.clear();
@@ -702,7 +702,7 @@
                     break;
             }
             if (!TextUtils.isEmpty(eventTag)) {
-                UsabilityStudyLogUtils.getInstance().write(
+                UsabilityStudyLogUtils.getInstance().write(LogGroup.MOTION_EVENT,
                         eventTag + eventTime + "," + id + "," + x + "," + y + ","
                         + me.getSize(index) + "," + me.getPressure(index));
             }
@@ -765,9 +765,10 @@
                 }
                 tracker.onMoveEvent(px, py, eventTime);
                 if (ENABLE_USABILITY_STUDY_LOG) {
-                    UsabilityStudyLogUtils.getInstance().write("[Move]"  + eventTime + ","
-                            + me.getPointerId(i) + "," + px + "," + py + ","
-                            + me.getSize(i) + "," + me.getPressure(i));
+                    UsabilityStudyLogUtils.getInstance().write(
+                            LogGroup.MOTION_EVENT,
+                            "[Move]" + eventTime + "," + me.getPointerId(i) + "," + px + "," + py
+                                    + "," + me.getSize(i) + "," + me.getPressure(i));
                 }
             }
         } else {
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysDetector.java b/java/src/com/android/inputmethod/keyboard/MoreKeysDetector.java
index 6c8d020..cd4e300 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysDetector.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysDetector.java
@@ -33,34 +33,6 @@
     }
 
     @Override
-    protected int getMaxNearbyKeys() {
-        // No nearby key will be returned.
-        return 1;
-    }
-
-    @Override
-    public void getNearbyCodes(int x, int y, final int[] allCodes) {
-        final int touchX = getTouchX(x);
-        final int touchY = getTouchY(y);
-
-        Key nearestKey = null;
-        int nearestDist = (y < 0) ? mSlideAllowanceSquareTop : mSlideAllowanceSquare;
-        for (final Key key : getKeyboard().mKeys) {
-            final int dist = key.squaredDistanceToEdge(touchX, touchY);
-            if (dist < nearestDist) {
-                nearestKey = key;
-                nearestDist = dist;
-            }
-        }
-
-        if (nearestKey != null) {
-            allCodes[0] = nearestKey.mCode;
-        } else {
-            allCodes[0] = NOT_A_CODE;
-        }
-    }
-
-    @Override
     public Key detectHitKey(int x, int y) {
         final int touchX = getTouchX(x);
         final int touchY = getTouchY(y);
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
index 904a81d..72a5d0f 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
@@ -296,17 +296,16 @@
             final int padding = (int)(view.getResources()
                     .getDimension(R.dimen.more_keys_keyboard_key_horizontal_padding)
                     + (parentKey.hasLabelsInMoreKeys() ? minKeyWidth * LABEL_PADDING_RATIO : 0));
-            Paint paint = null;
+            final Paint paint = view.newDefaultLabelPaint();
+            paint.setTextSize(parentKey.hasLabelsInMoreKeys()
+                    ? view.mKeyDrawParams.mKeyLabelSize
+                    : view.mKeyDrawParams.mKeyLetterSize);
             int maxWidth = minKeyWidth;
             for (String moreKeySpec : parentKey.mMoreKeys) {
                 final String label = KeySpecParser.getLabel(moreKeySpec);
                 // If the label is single letter, minKeyWidth is enough to hold the label.
                 if (label != null && StringUtils.codePointCount(label) > 1) {
-                    if (paint == null) {
-                        paint = new Paint();
-                        paint.setAntiAlias(true);
-                    }
-                    final int width = (int)view.getDefaultLabelWidth(label, paint) + padding;
+                    final int width = (int)view.getLabelWidth(label, paint) + padding;
                     if (maxWidth < width) {
                         maxWidth = width;
                     }
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
index 61d75e2..442413c 100644
--- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
+++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
@@ -24,10 +24,7 @@
 import com.android.inputmethod.latin.spellcheck.SpellCheckerProximityInfo;
 
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 public class ProximityInfo {
     public static final int MAX_PROXIMITY_CHARS_SIZE = 16;
@@ -50,8 +47,7 @@
 
     ProximityInfo(String localeStr, int gridWidth, int gridHeight, int minWidth, int height,
             int mostCommonKeyWidth, int mostCommonKeyHeight, final Key[] keys,
-            TouchPositionCorrection touchPositionCorrection,
-            Map<Integer, List<Integer>> additionalProximityChars) {
+            TouchPositionCorrection touchPositionCorrection) {
         if (TextUtils.isEmpty(localeStr)) {
             mLocaleStr = "";
         } else {
@@ -72,12 +68,11 @@
             return;
         }
         computeNearestNeighbors(
-                mostCommonKeyWidth, keys, touchPositionCorrection, additionalProximityChars);
+                mostCommonKeyWidth, keys, touchPositionCorrection);
     }
 
     public static ProximityInfo createDummyProximityInfo() {
-        return new ProximityInfo("", 1, 1, 1, 1, 1, 1, EMPTY_KEY_ARRAY, null,
-                Collections.<Integer, List<Integer>> emptyMap());
+        return new ProximityInfo("", 1, 1, 1, 1, 1, 1, EMPTY_KEY_ARRAY, null);
     }
 
     public static ProximityInfo createSpellCheckerProximityInfo(final int[] proximity) {
@@ -184,8 +179,7 @@
     }
 
     private void computeNearestNeighbors(int defaultWidth, final Key[] keys,
-            TouchPositionCorrection touchPositionCorrection,
-            Map<Integer, List<Integer>> additionalProximityChars) {
+            TouchPositionCorrection touchPositionCorrection) {
         final HashMap<Integer, Key> keyCodeMap = new HashMap<Integer, Key>();
         for (final Key key : keys) {
             keyCodeMap.put(key.mCode, key);
@@ -207,27 +201,6 @@
                         neighborKeys[count++] = key;
                     }
                 }
-                int currentCodesSize = count;
-                for (int i = 0; i < currentCodesSize; ++i) {
-                    final int c = neighborKeys[i].mCode;
-                    final List<Integer> additionalChars = additionalProximityChars.get(c);
-                    if (additionalChars == null || additionalChars.size() == 0) {
-                        continue;
-                    }
-                    for (int j = 0; j < additionalChars.size(); ++j) {
-                        final int additionalChar = additionalChars.get(j);
-                        boolean contains = false;
-                        for (int k = 0; k < count; ++k) {
-                            if(additionalChar == neighborKeys[k].mCode) {
-                                contains = true;
-                                break;
-                            }
-                        }
-                        if (!contains) {
-                            neighborKeys[count++] = keyCodeMap.get(additionalChar);
-                        }
-                    }
-                }
                 mGridNeighbors[(y / mCellHeight) * mGridWidth + (x / mCellWidth)] =
                         Arrays.copyOfRange(neighborKeys, 0, count);
             }
diff --git a/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java b/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java
index 62a9259..347383f 100644
--- a/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java
+++ b/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java
@@ -17,12 +17,12 @@
 package com.android.inputmethod.keyboard;
 
 import android.content.Context;
-import android.os.Build;
 import android.util.Log;
 import android.view.MotionEvent;
 
 import com.android.inputmethod.latin.LatinImeLogger;
 import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.Utils;
 
 public class SuddenJumpingTouchEventHandler {
     private static final String TAG = SuddenJumpingTouchEventHandler.class.getSimpleName();
@@ -49,18 +49,8 @@
 
     public SuddenJumpingTouchEventHandler(Context context, ProcessMotionEvent view) {
         mView = view;
-        final String[] deviceList = context.getResources().getStringArray(
-                R.array.sudden_jumping_touch_event_device_list);
-        mNeedsSuddenJumpingHack = needsSuddenJumpingHack(Build.HARDWARE, deviceList);
-    }
-
-    private static boolean needsSuddenJumpingHack(String deviceName, String[] deviceList) {
-        for (String device : deviceList) {
-            if (device.equalsIgnoreCase(deviceName)) {
-                return true;
-            }
-        }
-        return false;
+        mNeedsSuddenJumpingHack = Boolean.parseBoolean(Utils.getDeviceOverrideValue(
+                context.getResources(), R.array.sudden_jumping_touch_event_device_list, "false"));
     }
 
     public void setKeyboard(Keyboard newKeyboard) {
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index 31ff4e7..dfc8c8e 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -149,6 +149,9 @@
         int count = getBigramsNative(mNativeDict, chars, chars.length, mInputCodes, codesSize,
                 mOutputChars_bigrams, mBigramScores, MAX_WORD_LENGTH, MAX_BIGRAMS,
                 MAX_PROXIMITY_CHARS_SIZE);
+        if (count > MAX_BIGRAMS) {
+            count = MAX_BIGRAMS;
+        }
 
         for (int j = 0; j < count; ++j) {
             if (codesSize > 0 && mBigramScores[j] < 1) break;
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
index 9ffc7d0..8ec4405 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
@@ -196,8 +196,8 @@
             } finally {
                 // Ignore exceptions while closing files.
                 try {
-                    // afd.close() will close inputStream, we should not call inputStream.close().
-                    if (null != afd) afd.close();
+                    // inputStream.close() will close afd, we should not call afd.close().
+                    if (null != inputStream) inputStream.close();
                 } catch (Exception e) {
                     Log.e(TAG, "Exception while closing a cross-process file descriptor : " + e);
                 }
diff --git a/java/src/com/android/inputmethod/latin/DebugSettings.java b/java/src/com/android/inputmethod/latin/DebugSettings.java
index 870b33f..23d63b4 100644
--- a/java/src/com/android/inputmethod/latin/DebugSettings.java
+++ b/java/src/com/android/inputmethod/latin/DebugSettings.java
@@ -30,7 +30,7 @@
 public class DebugSettings extends PreferenceActivity
         implements SharedPreferences.OnSharedPreferenceChangeListener {
 
-    private static final String TAG = "DebugSettings";
+    private static final String TAG = DebugSettings.class.getSimpleName();
     private static final String DEBUG_MODE_KEY = "debug_mode";
     public static final String FORCE_NON_DISTINCT_MULTITOUCH_KEY = "force_non_distinct_multitouch";
 
diff --git a/java/src/com/android/inputmethod/latin/InputAttributes.java b/java/src/com/android/inputmethod/latin/InputAttributes.java
index f7afed2..06c70c4 100644
--- a/java/src/com/android/inputmethod/latin/InputAttributes.java
+++ b/java/src/com/android/inputmethod/latin/InputAttributes.java
@@ -95,6 +95,7 @@
         }
     }
 
+    @SuppressWarnings("unused")
     private void dumpFlags(final int inputType) {
         Log.i(TAG, "Input class:");
         final int inputClass = inputType & InputType.TYPE_MASK_CLASS;
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index d5cd35d..e67f0ea 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -202,7 +202,7 @@
     private boolean mShouldSwitchToLastSubtype = true;
 
     private UserDictionary mUserDictionary;
-    private UserBigramDictionary mUserBigramDictionary;
+    private UserHistoryDictionary mUserHistoryDictionary;
     private boolean mIsUserDictionaryAvailable;
 
     private LastComposedWord mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
@@ -526,11 +526,9 @@
 
         resetContactsDictionary(oldContactsDictionary);
 
-        // TODO: rename UserBigramDictionary into UserHistoryDictionary
-        mUserBigramDictionary
-                = new UserBigramDictionary(this, this, localeStr, Suggest.DIC_USER_BIGRAM);
-        mSuggest.setUserUnigramDictionary(mUserBigramDictionary);
-        mSuggest.setUserBigramDictionary(mUserBigramDictionary);
+        mUserHistoryDictionary
+                = new UserHistoryDictionary(this, this, localeStr, Suggest.DIC_USER_HISTORY);
+        mSuggest.setUserHistoryDictionary(mUserHistoryDictionary);
 
         LocaleUtils.setSystemLocale(res, savedLocale);
     }
@@ -772,7 +770,7 @@
 
         KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
         if (inputView != null) inputView.closing();
-        if (mUserBigramDictionary != null) mUserBigramDictionary.flushPendingWrites();
+        if (mUserHistoryDictionary != null) mUserHistoryDictionary.flushPendingWrites();
     }
 
     private void onFinishInputViewInternal(boolean finishingInput) {
@@ -1290,7 +1288,7 @@
             mDeleteCount++;
             mExpectingUpdateSelection = true;
             mShouldSwitchToLastSubtype = true;
-            LatinImeLogger.logOnDelete();
+            LatinImeLogger.logOnDelete(x, y);
             break;
         case Keyboard.CODE_SHIFT:
         case Keyboard.CODE_SWITCH_ALPHA_SYMBOL:
@@ -1990,9 +1988,6 @@
         setSuggestionStripShown(isSuggestionsStripVisible());
     }
 
-    /**
-     * Adds to the UserBigramDictionary and/or UserUnigramDictionary
-     */
     private void addToUserHistoryDictionary(final CharSequence suggestion) {
         if (suggestion == null || suggestion.length() < 1) return;
 
@@ -2004,16 +1999,16 @@
             return;
         }
 
-        if (mUserBigramDictionary != null) {
-            mUserBigramDictionary.addUnigram(suggestion.toString());
+        if (mUserHistoryDictionary != null) {
             final InputConnection ic = getCurrentInputConnection();
+            final CharSequence prevWord;
             if (null != ic) {
-                final CharSequence prevWord =
-                        EditingUtils.getPreviousWord(ic, mSettingsValues.mWordSeparators);
-                if (null != prevWord) {
-                    mUserBigramDictionary.addBigramPair(prevWord.toString(), suggestion.toString());
-                }
+                prevWord = EditingUtils.getPreviousWord(ic, mSettingsValues.mWordSeparators);
+            } else {
+                prevWord = null;
             }
+            mUserHistoryDictionary.addToUserHistory(null == prevWord ? null : prevWord.toString(),
+                    suggestion.toString());
         }
     }
 
diff --git a/java/src/com/android/inputmethod/latin/LatinImeLogger.java b/java/src/com/android/inputmethod/latin/LatinImeLogger.java
index 683dafa..079f3b5 100644
--- a/java/src/com/android/inputmethod/latin/LatinImeLogger.java
+++ b/java/src/com/android/inputmethod/latin/LatinImeLogger.java
@@ -51,7 +51,7 @@
     public static void logOnAutoCorrectionCancelled() {
     }
 
-    public static void logOnDelete() {
+    public static void logOnDelete(int x, int y) {
     }
 
     public static void logOnInputChar() {
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index 020b57c..c1335fd 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -19,11 +19,9 @@
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.content.res.Resources;
-import android.os.Build;
 import android.util.Log;
 import android.view.inputmethod.EditorInfo;
 
-import com.android.inputmethod.compat.InputMethodInfoCompatWrapper;
 import com.android.inputmethod.compat.InputTypeCompatUtils;
 import com.android.inputmethod.compat.VibratorCompatWrapper;
 import com.android.inputmethod.keyboard.internal.KeySpecParser;
@@ -323,14 +321,8 @@
             return volume;
         }
 
-        final String[] volumePerHardwareList = res.getStringArray(R.array.keypress_volumes);
-        final String hardwarePrefix = Build.HARDWARE + ",";
-        for (final String element : volumePerHardwareList) {
-            if (element.startsWith(hardwarePrefix)) {
-                return Float.parseFloat(element.substring(element.lastIndexOf(',') + 1));
-            }
-        }
-        return -1.0f;
+        return Float.parseFloat(
+                Utils.getDeviceOverrideValue(res, R.array.keypress_volumes, "-1.0f"));
     }
 
     // Likewise
@@ -341,15 +333,9 @@
         if (ms >= 0) {
             return ms;
         }
-        final String[] durationPerHardwareList = res.getStringArray(
-                R.array.keypress_vibration_durations);
-        final String hardwarePrefix = Build.HARDWARE + ",";
-        for (final String element : durationPerHardwareList) {
-            if (element.startsWith(hardwarePrefix)) {
-                return (int)Long.parseLong(element.substring(element.lastIndexOf(',') + 1));
-            }
-        }
-        return -1;
+
+        return Integer.parseInt(
+                Utils.getDeviceOverrideValue(res, R.array.keypress_vibration_durations, "-1"));
     }
 
     // Likewise
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 08f0e42..9ae2506 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -62,9 +62,8 @@
     public static final int DIC_USER_TYPED = 0;
     public static final int DIC_MAIN = 1;
     public static final int DIC_USER = 2;
-    public static final int DIC_USER_UNIGRAM = 3;
+    public static final int DIC_USER_HISTORY = 3;
     public static final int DIC_CONTACTS = 4;
-    public static final int DIC_USER_BIGRAM = 5;
     public static final int DIC_WHITELIST = 6;
     // If you add a type of dictionary, increment DIC_TYPE_LAST_ID
     // TODO: this value seems unused. Remove it?
@@ -73,10 +72,10 @@
     public static final String DICT_KEY_CONTACTS = "contacts";
     // User dictionary, the system-managed one.
     public static final String DICT_KEY_USER = "user";
-    // User unigram dictionary, internal to LatinIME
-    public static final String DICT_KEY_USER_UNIGRAM = "user_unigram";
-    // User bigram dictionary, internal to LatinIME
-    public static final String DICT_KEY_USER_BIGRAM = "user_bigram";
+    // User history dictionary for the unigram map, internal to LatinIME
+    public static final String DICT_KEY_USER_HISTORY_UNIGRAM = "history_unigram";
+    // User history dictionary for the bigram map, internal to LatinIME
+    public static final String DICT_KEY_USER_HISTORY_BIGRAM = "history_bigram";
     public static final String DICT_KEY_WHITELIST ="whitelist";
 
     private static final boolean DBG = LatinImeLogger.sDBG;
@@ -203,12 +202,11 @@
         addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_CONTACTS, contactsDictionary);
     }
 
-    public void setUserUnigramDictionary(Dictionary userUnigramDictionary) {
-        addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_USER_UNIGRAM, userUnigramDictionary);
-    }
-
-    public void setUserBigramDictionary(Dictionary userBigramDictionary) {
-        addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_USER_BIGRAM, userBigramDictionary);
+    public void setUserHistoryDictionary(Dictionary userHistoryDictionary) {
+        addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_USER_HISTORY_UNIGRAM,
+                userHistoryDictionary);
+        addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_USER_HISTORY_BIGRAM,
+                userHistoryDictionary);
     }
 
     public void setAutoCorrectionThreshold(double threshold) {
@@ -347,7 +345,7 @@
             // At second character typed, search the unigrams (scores being affected by bigrams)
             for (final String key : mUnigramDictionaries.keySet()) {
                 // Skip UserUnigramDictionary and WhitelistDictionary to lookup
-                if (key.equals(DICT_KEY_USER_UNIGRAM) || key.equals(DICT_KEY_WHITELIST))
+                if (key.equals(DICT_KEY_USER_HISTORY_UNIGRAM) || key.equals(DICT_KEY_WHITELIST))
                     continue;
                 final Dictionary dictionary = mUnigramDictionaries.get(key);
                 dictionary.getWords(wordComposerForLookup, this, proximityInfo);
diff --git a/java/src/com/android/inputmethod/latin/UserBigramDictionary.java b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
similarity index 92%
rename from java/src/com/android/inputmethod/latin/UserBigramDictionary.java
rename to java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
index 91f84be..4e79846 100644
--- a/java/src/com/android/inputmethod/latin/UserBigramDictionary.java
+++ b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
@@ -24,7 +24,6 @@
 import android.database.sqlite.SQLiteQueryBuilder;
 import android.os.AsyncTask;
 import android.provider.BaseColumns;
-import android.text.TextUtils;
 import android.util.Log;
 
 import java.util.HashMap;
@@ -32,12 +31,11 @@
 import java.util.Iterator;
 
 /**
- * Stores all the pairs user types in databases. Prune the database if the size
- * gets too big. Unlike AutoDictionary, it even stores the pairs that are already
- * in the dictionary.
+ * Locally gathers stats about the words user types and various other signals like auto-correction
+ * cancellation or manual picks. This allows the keyboard to adapt to the typist over time.
  */
-public class UserBigramDictionary extends ExpandableDictionary {
-    private static final String TAG = "UserBigramDictionary";
+public class UserHistoryDictionary extends ExpandableDictionary {
+    private static final String TAG = "UserHistoryDictionary";
 
     /** Any pair being typed or picked */
     private static final int FREQUENCY_FOR_TYPED = 2;
@@ -46,14 +44,14 @@
     private static final int FREQUENCY_MAX = 127;
 
     /** Maximum number of pairs. Pruning will start when databases goes above this number. */
-    private static int sMaxUserBigrams = 10000;
+    private static int sMaxHistoryBigrams = 10000;
 
     /**
      * When it hits maximum bigram pair, it will delete until you are left with
-     * only (sMaxUserBigrams - sDeleteUserBigrams) pairs.
+     * only (sMaxHistoryBigrams - sDeleteHistoryBigrams) pairs.
      * Do not keep this number small to avoid deleting too often.
      */
-    private static int sDeleteUserBigrams = 1000;
+    private static int sDeleteHistoryBigrams = 1000;
 
     /**
      * Database version should increase if the database structure changes
@@ -65,7 +63,7 @@
     /** Name of the words table in the database */
     private static final String MAIN_TABLE_NAME = "main";
     // TODO: Consume less space by using a unique id for locale instead of the whole
-    // 2-5 character string. (Same TODO from AutoDictionary)
+    // 2-5 character string.
     private static final String MAIN_COLUMN_ID = BaseColumns._ID;
     private static final String MAIN_COLUMN_WORD1 = "word1";
     private static final String MAIN_COLUMN_WORD2 = "word2";
@@ -133,15 +131,15 @@
         }
     }
 
-    public void setDatabaseMax(int maxUserBigram) {
-        sMaxUserBigrams = maxUserBigram;
+    public void setDatabaseMax(int maxHistoryBigram) {
+        sMaxHistoryBigrams = maxHistoryBigram;
     }
 
-    public void setDatabaseDelete(int deleteUserBigram) {
-        sDeleteUserBigrams = deleteUserBigram;
+    public void setDatabaseDelete(int deleteHistoryBigram) {
+        sDeleteHistoryBigrams = deleteHistoryBigram;
     }
 
-    public UserBigramDictionary(Context context, LatinIME ime, String locale, int dicTypeId) {
+    public UserHistoryDictionary(Context context, LatinIME ime, String locale, int dicTypeId) {
         super(context, dicTypeId);
         mIme = ime;
         mLocale = locale;
@@ -173,16 +171,6 @@
     }
 
     /**
-     * Add a single word without context.
-     *
-     * This is a temporary method to match the interface to UserUnigramDictionary. In the end
-     * this should be merged with addBigramPair.
-     */
-    public void addUnigram(final String newWord) {
-        addBigramPair(null, newWord);
-    }
-
-    /**
      * Pair will be added to the user history dictionary.
      *
      * The first word may be null. That means we don't know the context, in other words,
@@ -190,11 +178,12 @@
      * context, as in beginning of a sentence for example.
      * The second word may not be null (a NullPointerException would be thrown).
      */
-    public int addBigramPair(final String word1, String word2) {
+    public int addToUserHistory(final String word1, String word2) {
         // remove caps if second word is autocapitalized
         if (mIme != null && mIme.isAutoCapitalized()) {
             word2 = Character.toLowerCase(word2.charAt(0)) + word2.substring(1);
         }
+        super.addWord(word2, FREQUENCY_FOR_TYPED);
         // Do not insert a word as a bigram of itself
         if (word2.equals(word1)) {
             return 0;
@@ -203,7 +192,6 @@
         int freq;
         if (null == word1) {
             freq = FREQUENCY_FOR_TYPED;
-            super.addWord(word2, FREQUENCY_FOR_TYPED);
         } else {
             freq = super.addBigram(word1, word2, FREQUENCY_FOR_TYPED);
         }
@@ -366,8 +354,8 @@
             try {
                 int totalRowCount = c.getCount();
                 // prune out old data if we have too much data
-                if (totalRowCount > sMaxUserBigrams) {
-                    int numDeleteRows = (totalRowCount - sMaxUserBigrams) + sDeleteUserBigrams;
+                if (totalRowCount > sMaxHistoryBigrams) {
+                    int numDeleteRows = (totalRowCount - sMaxHistoryBigrams) + sDeleteHistoryBigrams;
                     int pairIdColumnId = c.getColumnIndex(FREQ_COLUMN_PAIR_ID);
                     c.moveToFirst();
                     int count = 0;
diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java
index a7de47c..e2ce083 100644
--- a/java/src/com/android/inputmethod/latin/Utils.java
+++ b/java/src/com/android/inputmethod/latin/Utils.java
@@ -19,9 +19,11 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.content.res.Resources;
 import android.inputmethodservice.InputMethodService;
 import android.net.Uri;
 import android.os.AsyncTask;
+import android.os.Build;
 import android.os.Environment;
 import android.os.Handler;
 import android.os.HandlerThread;
@@ -43,6 +45,7 @@
 import java.nio.channels.FileChannel;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.HashMap;
 
 public class Utils {
     private Utils() {
@@ -260,8 +263,25 @@
             }
         }
 
-        public static void writeBackSpace() {
-            UsabilityStudyLogUtils.getInstance().write("<backspace>\t0\t0");
+        /**
+         * Represents a category of logging events that share the same subfield structure.
+         */
+        public static enum LogGroup {
+            MOTION_EVENT("m"),
+            KEY("k"),
+            CORRECTION("c"),
+            STATE_CHANGE("s");
+
+            private final String mLogString;
+
+            private LogGroup(String logString) {
+                mLogString = logString;
+            }
+        }
+
+        public static void writeBackSpace(int x, int y) {
+            UsabilityStudyLogUtils.getInstance().write(
+                    LogGroup.KEY, "<backspace>\t" + x + "\t" + y);
         }
 
         public void writeChar(char c, int x, int y) {
@@ -277,11 +297,12 @@
                     inputChar = "<space>";
                     break;
             }
-            UsabilityStudyLogUtils.getInstance().write(inputChar + "\t" + x + "\t" + y);
+            UsabilityStudyLogUtils.getInstance().write(LogGroup.KEY,
+                    inputChar + "\t" + x + "\t" + y);
             LatinImeLogger.onPrintAllUsabilityStudyLogs();
         }
 
-        public void write(final String log) {
+        public void write(final LogGroup logGroup, final String log) {
             mLoggingHandler.post(new Runnable() {
                 @Override
                 public void run() {
@@ -289,8 +310,8 @@
                     final long currentTime = System.currentTimeMillis();
                     mDate.setTime(currentTime);
 
-                    final String printString = String.format("%s\t%d\t%s\n",
-                            mDateFormat.format(mDate), currentTime, log);
+                    final String printString = String.format("%s\t%d\t%s\t%s\n",
+                            mDateFormat.format(mDate), currentTime, logGroup.mLogString, log);
                     if (LatinImeLogger.sDBG) {
                         Log.d(USABILITY_TAG, "Write: " + log);
                     }
@@ -465,4 +486,23 @@
         if (TextUtils.isEmpty(info)) return null;
         return info;
     }
+
+    private static final String HARDWARE_PREFIX = Build.HARDWARE + ",";
+    private static final HashMap<Integer, String> sDeviceOverrideValueMap =
+            new HashMap<Integer, String>();
+
+    public static String getDeviceOverrideValue(Resources res, int overrideResId, String defValue) {
+        final Integer key = overrideResId;
+        if (!sDeviceOverrideValueMap.containsKey(key)) {
+            String overrideValue = defValue;
+            for (final String element : res.getStringArray(overrideResId)) {
+                if (element.startsWith(HARDWARE_PREFIX)) {
+                    overrideValue = element.substring(HARDWARE_PREFIX.length());
+                    break;
+                }
+            }
+            sDeviceOverrideValueMap.put(key, overrideValue);
+        }
+        return sDeviceOverrideValueMap.get(key);
+    }
 }
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index 251063e..9f23f17 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -141,6 +141,7 @@
             keyY = y;
         } else {
             final Key key = keyDetector.detectHitKey(x, y);
+            // TODO: Pass an integer instead of an integer array
             codes = new int[] { key != null ? key.mCode : NOT_A_CODE };
             keyX = keyDetector.getTouchX(x);
             keyY = keyDetector.getTouchY(y);
@@ -202,9 +203,8 @@
             if (key.mCode == codePoint) {
                 final int x = key.mX + key.mWidth / 2;
                 final int y = key.mY + key.mHeight / 2;
-                final int[] codes = keyDetector.newCodeArray();
-                keyDetector.getNearbyCodes(x, y, codes);
-                add(codePoint, codes, x, y);
+                // TODO: Pass an integer instead of an integer array
+                add(codePoint, new int[] { key.mCode }, x, y);
                 return;
             }
         }
@@ -216,7 +216,7 @@
      * Set the currently composing word to the one passed as an argument.
      * This will register NOT_A_COORDINATE for X and Ys, and use the passed keyboard for proximity.
      */
-    public void setComposingWord(final CharSequence word, final Keyboard keyboard,
+    private void setComposingWord(final CharSequence word, final Keyboard keyboard,
             final KeyDetector keyDetector) {
         reset();
         final int length = word.length();
@@ -233,7 +233,6 @@
         final KeyDetector keyDetector = new KeyDetector(0);
         keyDetector.setKeyboard(keyboard, 0, 0);
         keyDetector.setProximityCorrectionEnabled(true);
-        keyDetector.setProximityThreshold(keyboard.mMostCommonKeyWidth);
         setComposingWord(word, keyboard, keyDetector);
     }
 
diff --git a/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
similarity index 98%
rename from tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java
rename to java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
index 485dba1..42dd4df 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
@@ -14,11 +14,11 @@
  * the License.
  */
 
-package com.android.inputmethod.latin;
+package com.android.inputmethod.latin.makedict;
 
-import com.android.inputmethod.latin.FusionDictionary.CharGroup;
-import com.android.inputmethod.latin.FusionDictionary.Node;
-import com.android.inputmethod.latin.FusionDictionary.WeightedString;
+import com.android.inputmethod.latin.makedict.FusionDictionary.CharGroup;
+import com.android.inputmethod.latin.makedict.FusionDictionary.Node;
+import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
diff --git a/tools/makedict/src/com/android/inputmethod/latin/CharGroupInfo.java b/java/src/com/android/inputmethod/latin/makedict/CharGroupInfo.java
similarity index 96%
rename from tools/makedict/src/com/android/inputmethod/latin/CharGroupInfo.java
rename to java/src/com/android/inputmethod/latin/makedict/CharGroupInfo.java
index 759cd45..444b117 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/CharGroupInfo.java
+++ b/java/src/com/android/inputmethod/latin/makedict/CharGroupInfo.java
@@ -14,7 +14,7 @@
  * the License.
  */
 
-package com.android.inputmethod.latin;
+package com.android.inputmethod.latin.makedict;
 
 import java.util.ArrayList;
 
diff --git a/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
similarity index 99%
rename from tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java
rename to java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
index 08143d3..d196721 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java
+++ b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
@@ -14,7 +14,7 @@
  * the License.
  */
 
-package com.android.inputmethod.latin;
+package com.android.inputmethod.latin.makedict;
 
 import java.util.ArrayList;
 import java.util.Arrays;
diff --git a/tools/makedict/src/com/android/inputmethod/latin/MakedictLog.java b/java/src/com/android/inputmethod/latin/makedict/MakedictLog.java
similarity index 95%
rename from tools/makedict/src/com/android/inputmethod/latin/MakedictLog.java
rename to java/src/com/android/inputmethod/latin/makedict/MakedictLog.java
index badb2ff..cff8d6f 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/MakedictLog.java
+++ b/java/src/com/android/inputmethod/latin/makedict/MakedictLog.java
@@ -14,7 +14,7 @@
  * the License.
  */
 
-package com.android.inputmethod.latin;
+package com.android.inputmethod.latin.makedict;
 
 /**
  * Wrapper to redirect log events to the right output medium.
diff --git a/tools/makedict/src/com/android/inputmethod/latin/PendingAttribute.java b/java/src/com/android/inputmethod/latin/makedict/PendingAttribute.java
similarity index 94%
rename from tools/makedict/src/com/android/inputmethod/latin/PendingAttribute.java
rename to java/src/com/android/inputmethod/latin/makedict/PendingAttribute.java
index cf66eef..5b41d27 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/PendingAttribute.java
+++ b/java/src/com/android/inputmethod/latin/makedict/PendingAttribute.java
@@ -14,7 +14,7 @@
  * the License.
  */
 
-package com.android.inputmethod.latin;
+package com.android.inputmethod.latin.makedict;
 
 /**
  * A not-yet-resolved attribute.
diff --git a/tools/makedict/src/com/android/inputmethod/latin/UnsupportedFormatException.java b/java/src/com/android/inputmethod/latin/makedict/UnsupportedFormatException.java
similarity index 94%
rename from tools/makedict/src/com/android/inputmethod/latin/UnsupportedFormatException.java
rename to java/src/com/android/inputmethod/latin/makedict/UnsupportedFormatException.java
index 511ad56..bd42fb8 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/UnsupportedFormatException.java
+++ b/java/src/com/android/inputmethod/latin/makedict/UnsupportedFormatException.java
@@ -14,7 +14,7 @@
  * the License.
  */
 
-package com.android.inputmethod.latin;
+package com.android.inputmethod.latin.makedict;
 
 /**
  * Simple exception thrown when a file format is not recognized.
diff --git a/tools/makedict/src/com/android/inputmethod/latin/Word.java b/java/src/com/android/inputmethod/latin/makedict/Word.java
similarity index 94%
rename from tools/makedict/src/com/android/inputmethod/latin/Word.java
rename to java/src/com/android/inputmethod/latin/makedict/Word.java
index cf6116f..c2c01e1 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/Word.java
+++ b/java/src/com/android/inputmethod/latin/makedict/Word.java
@@ -14,9 +14,9 @@
  * the License.
  */
 
-package com.android.inputmethod.latin;
+package com.android.inputmethod.latin.makedict;
 
-import com.android.inputmethod.latin.FusionDictionary.WeightedString;
+import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString;
 
 import java.util.ArrayList;
 
diff --git a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java
index c9c88fd..dd83a0c 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java
@@ -23,9 +23,7 @@
 import com.android.inputmethod.keyboard.Key;
 import com.android.inputmethod.keyboard.Keyboard;
 import com.android.inputmethod.keyboard.KeyboardSwitcher;
-import com.android.inputmethod.keyboard.KeyboardView;
 import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
-import com.android.inputmethod.latin.LatinImeLogger;
 import com.android.inputmethod.latin.R;
 import com.android.inputmethod.latin.SuggestedWords;
 import com.android.inputmethod.latin.Utils;
@@ -38,8 +36,6 @@
     }
 
     public static class Builder extends Keyboard.Builder<Builder.MoreSuggestionsParam> {
-        private static final boolean DBG = LatinImeLogger.sDBG;
-
         private final MoreSuggestionsView mPaneView;
         private SuggestedWords mSuggestions;
         private int mFromPos;
@@ -56,10 +52,8 @@
             public int mDividerWidth;
 
             public int layout(SuggestedWords suggestions, int fromPos, int maxWidth, int minWidth,
-                    int maxRow, KeyboardView view) {
+                    int maxRow, MoreSuggestionsView view) {
                 clearKeys();
-                final Paint paint = new Paint();
-                paint.setAntiAlias(true);
                 final Resources res = view.getContext().getResources();
                 mDivider = res.getDrawable(R.drawable.more_suggestions_divider);
                 // TODO: Drawable itself should have an alpha value.
@@ -67,6 +61,7 @@
                 mDividerWidth = mDivider.getIntrinsicWidth();
                 final int padding = (int) res.getDimension(
                         R.dimen.more_suggestions_key_horizontal_padding);
+                final Paint paint = view.newDefaultLabelPaint();
 
                 int row = 0;
                 int pos = fromPos, rowStartPos = fromPos;
@@ -74,7 +69,7 @@
                 while (pos < size) {
                     final String word = suggestions.getWord(pos).toString();
                     // TODO: Should take care of text x-scaling.
-                    mWidths[pos] = (int)view.getDefaultLabelWidth(word, paint) + padding;
+                    mWidths[pos] = (int)view.getLabelWidth(word, paint) + padding;
                     final int numColumn = pos - rowStartPos + 1;
                     final int columnWidth =
                             (maxWidth - mDividerWidth * (numColumn - 1)) / numColumn;
diff --git a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
index f11b1a4..e64e7a6 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
@@ -43,17 +43,17 @@
 public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel {
     private final int[] mCoordinates = new int[2];
 
-    private final KeyDetector mModalPanelKeyDetector;
+    final KeyDetector mModalPanelKeyDetector;
     private final KeyDetector mSlidingPanelKeyDetector;
 
     private Controller mController;
-    private KeyboardActionListener mListener;
+    KeyboardActionListener mListener;
     private int mOriginX;
     private int mOriginY;
 
-    private static final TimerProxy EMPTY_TIMER_PROXY = new TimerProxy.Adapter();
+    static final TimerProxy EMPTY_TIMER_PROXY = new TimerProxy.Adapter();
 
-    private final KeyboardActionListener mSuggestionsPaneListener =
+    final KeyboardActionListener mSuggestionsPaneListener =
             new KeyboardActionListener.Adapter() {
         @Override
         public void onPressKey(int primaryCode) {
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java
index 286bf0a..06fda44 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionsView.java
@@ -62,7 +62,6 @@
 import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
 import com.android.inputmethod.latin.Suggest;
 import com.android.inputmethod.latin.SuggestedWords;
-import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
 import com.android.inputmethod.latin.Utils;
 
 import java.util.ArrayList;
diff --git a/native/src/bigram_dictionary.cpp b/native/src/bigram_dictionary.cpp
index 84048d7..fa69de8 100644
--- a/native/src/bigram_dictionary.cpp
+++ b/native/src/bigram_dictionary.cpp
@@ -137,9 +137,10 @@
         // codesSize == 0 means we are trying to find bigram predictions.
         if (codesSize < 1 || checkFirstCharacter(bigramBuffer)) {
             const int frequency = UnigramDictionary::MASK_ATTRIBUTE_FREQUENCY & bigramFlags;
-            addWordBigram(bigramBuffer, length, frequency);
+            if (addWordBigram(bigramBuffer, length, frequency)) {
+                ++bigramCount;
+            }
         }
-        ++bigramCount;
     } while (0 != (UnigramDictionary::FLAG_ATTRIBUTE_HAS_NEXT & bigramFlags));
     return bigramCount;
 }
diff --git a/tools/makedict/Android.mk b/tools/makedict/Android.mk
index 6832b1c..facbbf7 100644
--- a/tools/makedict/Android.mk
+++ b/tools/makedict/Android.mk
@@ -13,15 +13,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,src)
-LOCAL_SRC_FILES += $(call all-java-files-under,tests)
-LOCAL_JAR_MANIFEST := etc/manifest.txt
-LOCAL_MODULE_TAGS := eng
-LOCAL_MODULE := makedict
-LOCAL_JAVA_LIBRARIES := junit
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-include $(LOCAL_PATH)/etc/Android.mk
+#LOCAL_PATH := $(call my-dir)
+#include $(CLEAR_VARS)
+#
+#LOCAL_SRC_FILES := $(call all-java-files-under,src)
+#LOCAL_SRC_FILES += $(call all-java-files-under,tests)
+#LOCAL_JAR_MANIFEST := etc/manifest.txt
+#LOCAL_MODULE_TAGS := eng
+#LOCAL_MODULE := makedict
+#LOCAL_JAVA_LIBRARIES := junit
+#
+#include $(BUILD_HOST_JAVA_LIBRARY)
+#include $(LOCAL_PATH)/etc/Android.mk
diff --git a/tools/makedict/etc/manifest.txt b/tools/makedict/etc/manifest.txt
index 948609d..4f085e7 100644
--- a/tools/makedict/etc/manifest.txt
+++ b/tools/makedict/etc/manifest.txt
@@ -1 +1 @@
-Main-Class: com.android.inputmethod.latin.DictionaryMaker
+Main-Class: com.android.inputmethod.latin.makedict.DictionaryMaker
diff --git a/tools/makedict/src/com/android/inputmethod/latin/DictionaryMaker.java b/tools/makedict/src/com/android/inputmethod/latin/makedict/DictionaryMaker.java
similarity index 99%
rename from tools/makedict/src/com/android/inputmethod/latin/DictionaryMaker.java
rename to tools/makedict/src/com/android/inputmethod/latin/makedict/DictionaryMaker.java
index fbfa424..5e39215 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/DictionaryMaker.java
+++ b/tools/makedict/src/com/android/inputmethod/latin/makedict/DictionaryMaker.java
@@ -14,7 +14,7 @@
  * the License.
  */
 
-package com.android.inputmethod.latin;
+package com.android.inputmethod.latin.makedict;
 
 import java.io.File;
 import java.io.FileInputStream;
diff --git a/tools/makedict/src/com/android/inputmethod/latin/XmlDictInputOutput.java b/tools/makedict/src/com/android/inputmethod/latin/makedict/XmlDictInputOutput.java
similarity index 98%
rename from tools/makedict/src/com/android/inputmethod/latin/XmlDictInputOutput.java
rename to tools/makedict/src/com/android/inputmethod/latin/makedict/XmlDictInputOutput.java
index 77c5366..483473b 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/XmlDictInputOutput.java
+++ b/tools/makedict/src/com/android/inputmethod/latin/makedict/XmlDictInputOutput.java
@@ -14,9 +14,9 @@
  * the License.
  */
 
-package com.android.inputmethod.latin;
+package com.android.inputmethod.latin.makedict;
 
-import com.android.inputmethod.latin.FusionDictionary.WeightedString;
+import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString;
 
 import java.io.IOException;
 import java.io.InputStream;
diff --git a/tools/makedict/tests/com/android/inputmethod/latin/BinaryDictInputOutputTest.java b/tools/makedict/tests/com/android/inputmethod/latin/BinaryDictInputOutputTest.java
index 6ac046b..9682c9b 100644
--- a/tools/makedict/tests/com/android/inputmethod/latin/BinaryDictInputOutputTest.java
+++ b/tools/makedict/tests/com/android/inputmethod/latin/BinaryDictInputOutputTest.java
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.android.inputmethod.latin;
+package com.android.inputmethod.latin.makedict;
 
-import com.android.inputmethod.latin.FusionDictionary.Node;
+import com.android.inputmethod.latin.makedict.FusionDictionary.Node;
 
 import java.util.ArrayList;