DO NOT MERGE. One-time patch change to resolve differences where
klp-modular-dev became out of sync with klp-dev due to failures of
automatic merges. We decided it is far better to submit this to fix
the build rather than spending a bunch of time doing forensics on the
history of automated merges into klp-modular-dev.

Change-Id: I66ff89237b3308a919f711bc10425a7b9688c24b
diff --git a/InCallUI/proguard.flags b/InCallUI/proguard.flags
index bc88143..4e8310c 100644
--- a/InCallUI/proguard.flags
+++ b/InCallUI/proguard.flags
@@ -6,3 +6,9 @@
 -keepclasseswithmembers class com.android.incallui.AnimationUtils$CrossFadeDrawable {
     *** setCrossFadeAlpha(...);
 }
+
+# Any class or method annotated with NeededForTesting or NeededForReflection.
+-keepclassmembers class * {
+@com.android.contacts.common.test.NeededForTesting *;
+@com.android.incallui.NeededForReflection *;
+}
diff --git a/InCallUI/res/anim/incall_dialpad_slide_in.xml b/InCallUI/res/anim/incall_dialpad_slide_in.xml
new file mode 100644
index 0000000..89f4552
--- /dev/null
+++ b/InCallUI/res/anim/incall_dialpad_slide_in.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<objectAnimator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/decelerate_interpolator"
+    android:valueFrom="1.0"
+    android:valueTo="0"
+    android:valueType="floatType"
+    android:propertyName="yFraction"
+    android:duration="200" />
\ No newline at end of file
diff --git a/InCallUI/res/anim/incall_dialpad_slide_out.xml b/InCallUI/res/anim/incall_dialpad_slide_out.xml
new file mode 100644
index 0000000..7fa03a2
--- /dev/null
+++ b/InCallUI/res/anim/incall_dialpad_slide_out.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<objectAnimator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/decelerate_interpolator"
+    android:valueFrom="0"
+    android:valueTo="1.0"
+    android:valueType="floatType"
+    android:propertyName="yFraction"
+    android:duration="200" />
\ No newline at end of file
diff --git a/InCallUI/res/drawable/dialpad_key_colors.xml b/InCallUI/res/drawable/dialpad_key_colors.xml
new file mode 100644
index 0000000..27b4d4f
--- /dev/null
+++ b/InCallUI/res/drawable/dialpad_key_colors.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:state_pressed="true"
+        android:drawable="@color/background_dialpad_pressed" />
+    <item android:drawable="@color/background_dialpad" />
+</selector>
diff --git a/InCallUI/res/values/colors.xml b/InCallUI/res/values/colors.xml
index 6080e91..ca53f27 100644
--- a/InCallUI/res/values/colors.xml
+++ b/InCallUI/res/values/colors.xml
@@ -23,9 +23,6 @@
     <color name="incall_secondary_info_background">#8033b5e5</color> <!-- semitransparent blueish grey -->
     <color name="incall_call_banner_text_color">#FFFFFF</color> <!-- white -->
 
-    <!-- DTMF Dialer -->
-    <color name="dtmf_dialer_display_text">#FFFFFF</color> <!-- white -->
-
     <!-- Color of the theme of the People app -->
     <color name="people_app_theme_color">#33B5E5</color>
 
@@ -44,9 +41,24 @@
     <!-- Used when the End Call button is disabled -->
     <drawable name="end_call_disabled_state">#303030</drawable>
 
-    <!-- Dialpad background -->
-    <color name="dialpad_background">#000000</color>
+    <!-- Color of dialpad digits -->
+    <color name="dialpad_digits_text_color">#000000</color>
+
+    <!-- Background color of dialpad -->
+    <color name="background_dialpad">#ffffff</color>
+
+    <!-- Pressed color of dialpad buttons -->
+    <color name="background_dialpad_pressed">#ececec</color>
 
     <!-- Button background -->
     <color name="button_background">#000000</color>
+
+    <!-- Background color of action bars -->
+    <color name="actionbar_background_color">#3B77E7</color>
+
+    <!-- Secondary color of dialpad text (used for the letters corresponding to each digit -->
+    <color name="dialpad_secondary_text_color">#8b8b8b</color>
+
+    <!-- Translucent shadow color -->
+    <color name="translucent_shadow">#33999999</color>
 </resources>
diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml
index 513cd91..0469171 100644
--- a/InCallUI/res/values/strings.xml
+++ b/InCallUI/res/values/strings.xml
@@ -517,4 +517,54 @@
 
     <!-- This can be used in any application wanting to disable the text "Emergency number" -->
     <string name="emergency_call_dialog_number_for_display">Emergency number</string>
+
+    <!-- The digit to be displayed on the 0 key of the dialpad [CHAR LIMIT=1]-->
+    <string name="dialpad_0_number">0</string>
+    <!-- The digit to be displayed on the 1 key of the dialpad [CHAR LIMIT=1]-->
+    <string name="dialpad_1_number">1</string>
+    <!-- The digit to be displayed on the 2 key of the dialpad [CHAR LIMIT=1]-->
+    <string name="dialpad_2_number">2</string>
+    <!-- The digit to be displayed on the 3 key of the dialpad [CHAR LIMIT=1]-->
+    <string name="dialpad_3_number">3</string>
+    <!-- The digit to be displayed on the 4 key of the dialpad [CHAR LIMIT=1]-->
+    <string name="dialpad_4_number">4</string>
+    <!-- The digit to be displayed on the 5 key of the dialpad [CHAR LIMIT=1]-->
+    <string name="dialpad_5_number">5</string>
+    <!-- The digit to be displayed on the 6 key of the dialpad [CHAR LIMIT=1]-->
+    <string name="dialpad_6_number">6</string>
+    <!-- The digit to be displayed on the 7 key of the dialpad [CHAR LIMIT=1]-->
+    <string name="dialpad_7_number">7</string>
+    <!-- The digit to be displayed on the 8 key of the dialpad [CHAR LIMIT=1]-->
+    <string name="dialpad_8_number">8</string>
+    <!-- The digit to be displayed on the 9 key of the dialpad [CHAR LIMIT=1]-->
+    <string name="dialpad_9_number">9</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_star_number">*</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_pound_number">#</string>
+
+    <!--  Do not translate. -->
+    <string name="dialpad_0_letters">+</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_1_letters"></string>
+    <!--  Do not translate. -->
+    <string name="dialpad_2_letters">ABC</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_3_letters">DEF</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_4_letters">GHI</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_5_letters">JKL</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_6_letters">MNO</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_7_letters">PQRS</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_8_letters">TUV</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_9_letters">WXYZ</string>
+    <!--  Do not translate. -->
+    <string name="dialpad_star_letters"></string>
+    <!--  Do not translate. -->
+    <string name="dialpad_pound_letters"></string>
 </resources>
diff --git a/InCallUI/src/com/android/incallui/DialpadFragment.java b/InCallUI/src/com/android/incallui/DialpadFragment.java
index ed45217..236b38c 100644
--- a/InCallUI/src/com/android/incallui/DialpadFragment.java
+++ b/InCallUI/src/com/android/incallui/DialpadFragment.java
@@ -17,6 +17,7 @@
 package com.android.incallui;
 
 import android.content.Context;
+import android.content.res.Resources;
 import android.os.Bundle;
 import android.text.Editable;
 import android.text.method.DialerKeyListener;
@@ -30,6 +31,8 @@
 import android.view.accessibility.AccessibilityManager;
 import android.widget.EditText;
 import android.widget.LinearLayout;
+import android.widget.TableRow;
+import android.widget.TextView;
 
 import java.util.HashMap;
 
@@ -40,7 +43,7 @@
         implements DialpadPresenter.DialpadUi, View.OnTouchListener, View.OnKeyListener,
         View.OnHoverListener, View.OnClickListener {
 
-    private static final float DIALPAD_SLIDE_FRACTION = 0.67f;
+    private static final float DIALPAD_SLIDE_FRACTION = 1.0f;
 
     /**
      * LinearLayout with getter and setter methods for the translationY property using floats,
@@ -520,21 +523,43 @@
         }
     }
 
-    /**
-     * setup the keys on the dialer activity, using the keymaps.
-     */
-    private void setupKeypad(View parent) {
-        // for each view id listed in the displaymap
+    private void setupKeypad(View fragmentView) {
+        final int[] buttonIds = new int[] {R.id.zero, R.id.one, R.id.two, R.id.three, R.id.four,
+                R.id.five, R.id.six, R.id.seven, R.id.eight, R.id.nine, R.id.star, R.id.pound};
+
+        final int[] numberIds = new int[] {R.string.dialpad_0_number, R.string.dialpad_1_number,
+                R.string.dialpad_2_number, R.string.dialpad_3_number, R.string.dialpad_4_number,
+                R.string.dialpad_5_number, R.string.dialpad_6_number, R.string.dialpad_7_number,
+                R.string.dialpad_8_number, R.string.dialpad_9_number, R.string.dialpad_star_number,
+                R.string.dialpad_pound_number};
+
+        final int[] letterIds = new int[] {R.string.dialpad_0_letters, R.string.dialpad_1_letters,
+                R.string.dialpad_2_letters, R.string.dialpad_3_letters, R.string.dialpad_4_letters,
+                R.string.dialpad_5_letters, R.string.dialpad_6_letters, R.string.dialpad_7_letters,
+                R.string.dialpad_8_letters, R.string.dialpad_9_letters,
+                R.string.dialpad_star_letters, R.string.dialpad_pound_letters};
+
+        final Resources resources = getResources();
+
         View button;
-        for (int viewId : mDisplayMap.keySet()) {
-            // locate the view
-            button = parent.findViewById(viewId);
-            // Setup the listeners for the buttons
+        TextView numberView;
+        TextView lettersView;
+
+        for (int i = 0; i < buttonIds.length; i++) {
+            button = fragmentView.findViewById(buttonIds[i]);
             button.setOnTouchListener(this);
             button.setClickable(true);
             button.setOnKeyListener(this);
             button.setOnHoverListener(this);
             button.setOnClickListener(this);
+            numberView = (TextView) button.findViewById(R.id.dialpad_key_number);
+            lettersView = (TextView) button.findViewById(R.id.dialpad_key_letters);
+            final String numberString = resources.getString(numberIds[i]);
+            numberView.setText(numberString);
+            button.setContentDescription(numberString);
+            if (lettersView != null) {
+                lettersView.setText(resources.getString(letterIds[i]));
+            }
         }
     }
 }
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 08a8f12..c34d854 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -21,6 +21,7 @@
 
 import android.app.Activity;
 import android.app.AlertDialog;
+import android.app.FragmentTransaction;
 import android.content.DialogInterface;
 import android.content.DialogInterface.OnClickListener;
 import android.content.DialogInterface.OnCancelListener;
@@ -308,6 +309,10 @@
         InCallPresenter.getInstance().getProximitySensor().onConfigurationChanged(config);
     }
 
+    public CallButtonFragment getCallButtonFragment() {
+        return mCallButtonFragment;
+    }
+
     private void internalResolveIntent(Intent intent) {
         final String action = intent.getAction();
 
@@ -365,7 +370,7 @@
         if (mDialpadFragment == null) {
             mDialpadFragment = (DialpadFragment) getFragmentManager()
                     .findFragmentById(R.id.dialpadFragment);
-            mDialpadFragment.getView().setVisibility(View.INVISIBLE);
+            getFragmentManager().beginTransaction().hide(mDialpadFragment).commit();
         }
 
         if (mConferenceManagerFragment == null) {
@@ -398,13 +403,15 @@
     }
 
     public void displayDialpad(boolean showDialpad) {
+        final FragmentTransaction ft = getFragmentManager().beginTransaction();
         if (showDialpad) {
-            mDialpadFragment.setVisible(true);
-            mCallCardFragment.setVisible(false);
+            ft.setCustomAnimations(R.anim.incall_dialpad_slide_in, 0);
+            ft.show(mDialpadFragment);
         } else {
-            mDialpadFragment.setVisible(false);
-            mCallCardFragment.setVisible(true);
+            ft.setCustomAnimations(0, R.anim.incall_dialpad_slide_out);
+            ft.hide(mDialpadFragment);
         }
+        ft.commitAllowingStateLoss();
 
         InCallPresenter.getInstance().getProximitySensor().onDialpadVisible(showDialpad);
     }
diff --git a/InCallUI/src/com/android/incallui/NeededForReflection.java b/InCallUI/src/com/android/incallui/NeededForReflection.java
new file mode 100644
index 0000000..363a0a5
--- /dev/null
+++ b/InCallUI/src/com/android/incallui/NeededForReflection.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.incallui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Denotes that the class, constructor, method or field is used for reflection and therefore cannot
+ * be removed by tools like ProGuard.
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target({ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD})
+public @interface NeededForReflection {}