Merge "Refactor to memorize device dependent override parameters"
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-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/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/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/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 99a4d54..e67f0ea 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1288,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:
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/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java
index a914ff7..7086345 100644
--- a/java/src/com/android/inputmethod/latin/Utils.java
+++ b/java/src/com/android/inputmethod/latin/Utils.java
@@ -263,8 +263,8 @@
             }
         }
 
-        public static void writeBackSpace() {
-            UsabilityStudyLogUtils.getInstance().write("<backspace>\t0\t0");
+        public static void writeBackSpace(int x, int y) {
+            UsabilityStudyLogUtils.getInstance().write("<backspace>\t" + x + "\t" + y);
         }
 
         public void writeChar(char c, int x, int y) {
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;
 }