Specify keyboard metrics with physical unit "inch"

Cherrypick I44f3b2eef8086d6e0b0db53d38f08487549060c6 from Gingerbread

This change also introduces the key background drawables which has no
fixed bottom padding.  Instead of relying on bottom padding in
drawable, this change also specifies Keyboard.verticalGap with
physical unit.  Other keyboard related length, distance and size are
also specified by physical unit.

Bug: 3066107
Change-Id: Ib38355ebfc2f8d5b1d26c4e90eba87196fbeddfa
diff --git a/java/res/xml/kbd_phone.xml b/java/res/xml/kbd_phone.xml
index dc88e2b..17e7ba2 100644
--- a/java/res/xml/kbd_phone.xml
+++ b/java/res/xml/kbd_phone.xml
@@ -22,7 +22,7 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
     latin:keyWidth="26.67%p"
     latin:horizontalGap="0px"
-    latin:verticalGap="0px"
+    latin:verticalGap="@dimen/key_bottom_gap"
     latin:keyHeight="@dimen/key_height"
 >
     <Row
diff --git a/java/res/xml/kbd_phone_black.xml b/java/res/xml/kbd_phone_black.xml
index 5247945..6ade277 100644
--- a/java/res/xml/kbd_phone_black.xml
+++ b/java/res/xml/kbd_phone_black.xml
@@ -22,7 +22,7 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
     latin:keyWidth="26.67%p"
     latin:horizontalGap="0px"
-    latin:verticalGap="0px"
+    latin:verticalGap="@dimen/key_bottom_gap"
     latin:keyHeight="@dimen/key_height"
 >
     <Row
diff --git a/java/res/xml/kbd_phone_symbols.xml b/java/res/xml/kbd_phone_symbols.xml
index 1400d36..5062d47 100644
--- a/java/res/xml/kbd_phone_symbols.xml
+++ b/java/res/xml/kbd_phone_symbols.xml
@@ -22,7 +22,7 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
     latin:keyWidth="26.67%p"
     latin:horizontalGap="0px"
-    latin:verticalGap="0px"
+    latin:verticalGap="@dimen/key_bottom_gap"
     latin:keyHeight="@dimen/key_height"
 >
     <Row
diff --git a/java/res/xml/kbd_phone_symbols_black.xml b/java/res/xml/kbd_phone_symbols_black.xml
index 8b683cc..2a6932a 100644
--- a/java/res/xml/kbd_phone_symbols_black.xml
+++ b/java/res/xml/kbd_phone_symbols_black.xml
@@ -22,7 +22,7 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
     latin:keyWidth="26.67%p"
     latin:horizontalGap="0px"
-    latin:verticalGap="0px"
+    latin:verticalGap="@dimen/key_bottom_gap"
     latin:keyHeight="@dimen/key_height"
 >
     <Row
diff --git a/java/res/xml/kbd_popup_narrow_template.xml b/java/res/xml/kbd_popup_narrow_template.xml
index ed3b130..23c686e 100644
--- a/java/res/xml/kbd_popup_narrow_template.xml
+++ b/java/res/xml/kbd_popup_narrow_template.xml
@@ -22,6 +22,6 @@
     android:keyWidth="9.45%p"
     android:horizontalGap="0px"
     android:verticalGap="0px"
-    android:keyHeight="@dimen/key_height"
+    android:keyHeight="@dimen/popup_key_height"
     >
 </Keyboard>
diff --git a/java/res/xml/kbd_popup_template.xml b/java/res/xml/kbd_popup_template.xml
index cbb7058..f1aa86f 100644
--- a/java/res/xml/kbd_popup_template.xml
+++ b/java/res/xml/kbd_popup_template.xml
@@ -22,6 +22,6 @@
     latin:keyWidth="10%p"
     latin:horizontalGap="0px"
     latin:verticalGap="0px"
-    latin:keyHeight="@dimen/key_height"
+    latin:keyHeight="@dimen/popup_key_height"
     >
 </Keyboard>
diff --git a/java/res/xml/kbd_qwerty.xml b/java/res/xml/kbd_qwerty.xml
index c14c7fa..21a7ccb 100644
--- a/java/res/xml/kbd_qwerty.xml
+++ b/java/res/xml/kbd_qwerty.xml
@@ -22,10 +22,12 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
     latin:keyWidth="10%p"
     latin:horizontalGap="0px"
-    latin:verticalGap="0px"
+    latin:verticalGap="@dimen/key_bottom_gap"
     latin:keyHeight="@dimen/key_height"
 >
-    <Row>
+    <Row
+        latin:rowEdgeFlags="top"
+    >
         <Key
             latin:keyLabel="q"
             latin:keyHintIcon="@drawable/keyboard_hint_1"
diff --git a/java/res/xml/kbd_qwerty_black.xml b/java/res/xml/kbd_qwerty_black.xml
index e1aa4f3..adb10dc 100644
--- a/java/res/xml/kbd_qwerty_black.xml
+++ b/java/res/xml/kbd_qwerty_black.xml
@@ -22,10 +22,12 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
     latin:keyWidth="10%p"
     latin:horizontalGap="0px"
-    latin:verticalGap="0px"
+    latin:verticalGap="@dimen/key_bottom_gap"
     latin:keyHeight="@dimen/key_height"
 >
-    <Row>
+    <Row
+        latin:rowEdgeFlags="top"
+    >
         <Key
             latin:keyLabel="q"
             latin:keyHintIcon="@drawable/keyboard_hint_1"
diff --git a/java/res/xml/kbd_symbols.xml b/java/res/xml/kbd_symbols.xml
index 4cdc539..4ce9a86 100644
--- a/java/res/xml/kbd_symbols.xml
+++ b/java/res/xml/kbd_symbols.xml
@@ -22,7 +22,7 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
     latin:keyWidth="10%p"
     latin:horizontalGap="0px"
-    latin:verticalGap="0px"
+    latin:verticalGap="@dimen/key_bottom_gap"
     latin:keyHeight="@dimen/key_height"
 >
     <Row
diff --git a/java/res/xml/kbd_symbols_black.xml b/java/res/xml/kbd_symbols_black.xml
index cb695f5..dedd2da 100644
--- a/java/res/xml/kbd_symbols_black.xml
+++ b/java/res/xml/kbd_symbols_black.xml
@@ -22,7 +22,7 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
     latin:keyWidth="10%p"
     latin:horizontalGap="0px"
-    latin:verticalGap="0px"
+    latin:verticalGap="@dimen/key_bottom_gap"
     latin:keyHeight="@dimen/key_height"
 >
     <Row
diff --git a/java/res/xml/kbd_symbols_shift.xml b/java/res/xml/kbd_symbols_shift.xml
index e346384..52afa38 100644
--- a/java/res/xml/kbd_symbols_shift.xml
+++ b/java/res/xml/kbd_symbols_shift.xml
@@ -22,7 +22,7 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
     latin:keyWidth="10%p"
     latin:horizontalGap="0px"
-    latin:verticalGap="0px"
+    latin:verticalGap="@dimen/key_bottom_gap"
     latin:keyHeight="@dimen/key_height"
 >
     <Row
diff --git a/java/res/xml/kbd_symbols_shift_black.xml b/java/res/xml/kbd_symbols_shift_black.xml
index a157492..c1bd4e3 100644
--- a/java/res/xml/kbd_symbols_shift_black.xml
+++ b/java/res/xml/kbd_symbols_shift_black.xml
@@ -22,7 +22,7 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
     latin:keyWidth="10%p"
     latin:horizontalGap="0px"
-    latin:verticalGap="0px"
+    latin:verticalGap="@dimen/key_bottom_gap"
     latin:keyHeight="@dimen/key_height"
 >
     <Row
diff --git a/java/res/xml/popup_comma.xml b/java/res/xml/popup_comma.xml
index 4e88f26..cef836a 100644
--- a/java/res/xml/popup_comma.xml
+++ b/java/res/xml/popup_comma.xml
@@ -23,7 +23,7 @@
     latin:keyWidth="10%p"
     latin:horizontalGap="0px"
     latin:verticalGap="0px"
-    latin:keyHeight="@dimen/key_height"
+    latin:keyHeight="@dimen/popup_key_height"
 >
     <Row
         latin:rowEdgeFlags="top|bottom"
diff --git a/java/res/xml/popup_domains.xml b/java/res/xml/popup_domains.xml
index c110ef6..5f92e2f 100644
--- a/java/res/xml/popup_domains.xml
+++ b/java/res/xml/popup_domains.xml
@@ -23,7 +23,7 @@
     latin:keyWidth="15%p"
     latin:horizontalGap="0px"
     latin:verticalGap="0px"
-    latin:keyHeight="@dimen/key_height"
+    latin:keyHeight="@dimen/popup_key_height"
 >
     <Row
         latin:rowEdgeFlags="top|bottom"
diff --git a/java/res/xml/popup_mic.xml b/java/res/xml/popup_mic.xml
index f5ef6ee..99c97ce 100644
--- a/java/res/xml/popup_mic.xml
+++ b/java/res/xml/popup_mic.xml
@@ -23,7 +23,7 @@
     latin:keyWidth="10%p"
     latin:horizontalGap="0px"
     latin:verticalGap="0px"
-    latin:keyHeight="@dimen/key_height"
+    latin:keyHeight="@dimen/popup_key_height"
 >
     <Row
         latin:rowEdgeFlags="top|bottom"
diff --git a/java/res/xml/popup_punctuation.xml b/java/res/xml/popup_punctuation.xml
index ecbf09f..76572b0 100644
--- a/java/res/xml/popup_punctuation.xml
+++ b/java/res/xml/popup_punctuation.xml
@@ -23,7 +23,7 @@
     latin:keyWidth="10%p"
     latin:horizontalGap="0px"
     latin:verticalGap="0px"
-    latin:keyHeight="@dimen/key_height"
+    latin:keyHeight="@dimen/popup_key_height"
 >
     <Row
         latin:rowEdgeFlags="top"
diff --git a/java/res/xml/popup_smileys.xml b/java/res/xml/popup_smileys.xml
index 33006f6..2f08231 100644
--- a/java/res/xml/popup_smileys.xml
+++ b/java/res/xml/popup_smileys.xml
@@ -23,7 +23,7 @@
     latin:keyWidth="15%p"
     latin:horizontalGap="0px"
     latin:verticalGap="0px"
-    latin:keyHeight="@dimen/key_height"
+    latin:keyHeight="@dimen/popup_key_height"
 >
     <Row
         latin:rowEdgeFlags="top"