Merge "Add InCallUI tests folder and basic test"
diff --git a/InCallUI/res/layout/answer_fragment.xml b/InCallUI/res/layout/answer_fragment.xml
index 7026dd1..d663b83 100644
--- a/InCallUI/res/layout/answer_fragment.xml
+++ b/InCallUI/res/layout/answer_fragment.xml
@@ -15,7 +15,6 @@
   ~ limitations under the License
   -->
 
-<!-- TODO(klp): move out to separate file -->
 <com.android.incallui.GlowPadWrapper
         xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:dc="http://schemas.android.com/apk/res-auto"
diff --git a/InCallUI/res/values-ne-rNP/strings.xml b/InCallUI/res/values-ne-rNP/strings.xml
index 5acaad9..f0e1df6 100644
--- a/InCallUI/res/values-ne-rNP/strings.xml
+++ b/InCallUI/res/values-ne-rNP/strings.xml
@@ -27,7 +27,7 @@
     <string name="audio_mode_speaker" msgid="27649582100085266">"स्पिकर"</string>
     <string name="audio_mode_earpiece" msgid="4156527186373869107">"ह्यान्डसेट इयरपिस"</string>
     <string name="audio_mode_wired_headset" msgid="1465350758489175975">"तारसहितको हेडसेट"</string>
-    <string name="audio_mode_bluetooth" msgid="3047641300848211128">"ब्लुटुथ"</string>
+    <string name="audio_mode_bluetooth" msgid="3047641300848211128">"ब्लुटूथ"</string>
     <string name="wait_prompt_str" msgid="7601815427707856238">"निम्न टोनहरू पठाउने? \n"</string>
     <string name="pause_prompt_str" msgid="1789964702154314806">"टोनहरू \n पठाउँदै"</string>
     <string name="send_button" msgid="4106860097497818751">"पठाउनुहोस्"</string>
diff --git a/InCallUI/src/com/android/incallui/AccelerometerListener.java b/InCallUI/src/com/android/incallui/AccelerometerListener.java
index 95f48e3..ca8e7d0 100644
--- a/InCallUI/src/com/android/incallui/AccelerometerListener.java
+++ b/InCallUI/src/com/android/incallui/AccelerometerListener.java
@@ -131,16 +131,19 @@
     }
 
     SensorEventListener mSensorListener = new SensorEventListener() {
+        @Override
         public void onSensorChanged(SensorEvent event) {
             onSensorEvent(event.values[0], event.values[1], event.values[2]);
         }
 
+        @Override
         public void onAccuracyChanged(Sensor sensor, int accuracy) {
             // ignore
         }
     };
 
     Handler mHandler = new Handler() {
+        @Override
         public void handleMessage(Message msg) {
             switch (msg.what) {
             case ORIENTATION_CHANGED:
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index f75c33b..32bee93 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -59,7 +59,7 @@
 import java.util.Locale;
 
 /**
- * Phone app "in call" screen.
+ * Main activity that the user interacts with while in a live call.
  */
 public class InCallActivity extends Activity {
 
@@ -136,7 +136,6 @@
         // TODO(klp): Do we need to add this back when prox sensor is not available?
         // lp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
 
-        // Inflate everything in incall_screen.xml and add it to the screen.
         setContentView(R.layout.incall_screen);
 
         initializeInCall();
@@ -265,21 +264,6 @@
         return mDialog != null;
     }
 
-    /**
-     * Dismisses the in-call screen.
-     *
-     * We never *really* finish() the InCallActivity, since we don't want to get destroyed and then
-     * have to be re-created from scratch for the next call.  Instead, we just move ourselves to the
-     * back of the activity stack.
-     *
-     * This also means that we'll no longer be reachable via the BACK button (since moveTaskToBack()
-     * puts us behind the Home app, but the home app doesn't allow the BACK key to move you any
-     * farther down in the history stack.)
-     *
-     * (Since the Phone app itself is never killed, this basically means that we'll keep a single
-     * InCallActivity instance around for the entire uptime of the device.  This noticeably improves
-     * the UI responsiveness for incoming calls.)
-     */
     @Override
     public void finish() {
         Log.i(this, "finish().  Dialog showing: " + (mDialog != null));
@@ -333,7 +317,7 @@
         // Always disable the Back key while an incoming call is ringing
         final Call call = CallList.getInstance().getIncomingCall();
         if (call != null) {
-            Log.d(this, "Consume Back press for an incoming call");
+            Log.i(this, "Consume Back press for an incoming call");
             return;
         }
 
@@ -429,13 +413,6 @@
         // key events to the DTMFDialer's onDialerKeyDown.
         if (mDialpadFragment != null && mDialpadFragment.isVisible()) {
             return mDialpadFragment.onDialerKeyDown(event);
-
-            // TODO: If the dialpad isn't currently visible, maybe
-            // consider automatically bringing it up right now?
-            // (Just to make sure the user sees the digits widget...)
-            // But this probably isn't too critical since it's awkward to
-            // use the hard keyboard while in-call in the first place,
-            // especially now that the in-call UI is portrait-only...
         }
 
         return false;
diff --git a/InCallUI/src/com/android/incallui/InCallUIMaterialColorMapUtils.java b/InCallUI/src/com/android/incallui/InCallUIMaterialColorMapUtils.java
index 1f61070..d65580e 100644
--- a/InCallUI/src/com/android/incallui/InCallUIMaterialColorMapUtils.java
+++ b/InCallUI/src/com/android/incallui/InCallUIMaterialColorMapUtils.java
@@ -45,8 +45,8 @@
     }
 
     public static MaterialPalette getDefaultPrimaryAndSecondaryColors(Resources resources) {
-        final int primaryColor = resources.getColor(R.color.dialer_theme_color);
-        final int secondaryColor = resources.getColor(R.color.dialer_theme_color_dark);
+        final int primaryColor = resources.getColor(R.color.dialer_theme_color, null);
+        final int secondaryColor = resources.getColor(R.color.dialer_theme_color_dark, null);
         return new MaterialPalette(primaryColor, secondaryColor);
     }
 }
\ No newline at end of file
diff --git a/InCallUI/src/com/android/incallui/PostCharDialogFragment.java b/InCallUI/src/com/android/incallui/PostCharDialogFragment.java
index e1edbc7..09b626a 100644
--- a/InCallUI/src/com/android/incallui/PostCharDialogFragment.java
+++ b/InCallUI/src/com/android/incallui/PostCharDialogFragment.java
@@ -62,7 +62,6 @@
         });
 
         final AlertDialog dialog = builder.create();
-        dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
         return dialog;
     }
 
diff --git a/InCallUI/src/com/android/incallui/SmallerHitTargetTouchListener.java b/InCallUI/src/com/android/incallui/SmallerHitTargetTouchListener.java
deleted file mode 100644
index 83feaf5..0000000
--- a/InCallUI/src/com/android/incallui/SmallerHitTargetTouchListener.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-package com.android.incallui;
-
-import android.view.MotionEvent;
-import android.view.View;
-
-/**
- * OnTouchListener used to shrink the "hit target" of some onscreen buttons.
- *
- * We do this for a few specific buttons which are vulnerable to
- * "false touches" because either (1) they're near the edge of the
- * screen and might be unintentionally touched while holding the
- * device in your hand, (2) they're in the upper corners and might
- * be touched by the user's ear before the prox sensor has a chance to
- * kick in, or (3) they are close to other buttons.
- */
-public class SmallerHitTargetTouchListener implements View.OnTouchListener {
-    private static final String TAG = "SmallerHitTargetTouchListener";
-
-    /**
-     * Edge dimensions where a touch does not register an action (in DIP).
-     */
-    private static final int HIT_TARGET_EDGE_IGNORE_DP_X = 30;
-    private static final int HIT_TARGET_EDGE_IGNORE_DP_Y = 10;
-    private static final int HIT_TARGET_MIN_SIZE_DP_X = HIT_TARGET_EDGE_IGNORE_DP_X * 3;
-    private static final int HIT_TARGET_MIN_SIZE_DP_Y = HIT_TARGET_EDGE_IGNORE_DP_Y * 3;
-
-    // True if the most recent DOWN event was a "hit".
-    boolean mDownEventHit;
-
-    /**
-     * Called when a touch event is dispatched to a view. This allows listeners to
-     * get a chance to respond before the target view.
-     *
-     * @return True if the listener has consumed the event, false otherwise.
-     *         (In other words, we return true when the touch is *outside*
-     *         the "smaller hit target", which will prevent the actual
-     *         button from handling these events.)
-     */
-    @Override
-    public boolean onTouch(View v, MotionEvent event) {
-        // if (DBG) log("SmallerHitTargetTouchListener: " + v + ", event " + event);
-
-        if (event.getAction() == MotionEvent.ACTION_DOWN) {
-            // Note that event.getX() and event.getY() are already
-            // translated into the View's coordinates.  (In other words,
-            // "0,0" is a touch on the upper-left-most corner of the view.)
-            final int touchX = (int) event.getX();
-            final int touchY = (int) event.getY();
-
-            final int viewWidth = v.getWidth();
-            final int viewHeight = v.getHeight();
-
-            final float pixelDensity = v.getResources().getDisplayMetrics().density;
-            final int targetMinSizeX = (int) (HIT_TARGET_MIN_SIZE_DP_X * pixelDensity);
-            final int targetMinSizeY = (int) (HIT_TARGET_MIN_SIZE_DP_Y * pixelDensity);
-
-            int edgeIgnoreX = (int) (HIT_TARGET_EDGE_IGNORE_DP_X * pixelDensity);
-            int edgeIgnoreY = (int) (HIT_TARGET_EDGE_IGNORE_DP_Y * pixelDensity);
-
-            // If we are dealing with smaller buttons where the dead zone defined by
-            // HIT_TARGET_EDGE_IGNORE_DP_[X|Y] is too large.
-            if (viewWidth < targetMinSizeX || viewHeight < targetMinSizeY) {
-                // This really should not happen given our two use cases (as of this writing)
-                // in the call edge button and secondary calling card. However, we leave
-                // this is as a precautionary measure.
-                Log.w(TAG, "onTouch: view is too small for SmallerHitTargetTouchListener");
-                edgeIgnoreX = 0;
-                edgeIgnoreY = 0;
-            }
-
-            final int minTouchX = edgeIgnoreX;
-            final int maxTouchX = viewWidth - edgeIgnoreX;
-            final int minTouchY = edgeIgnoreY;
-            final int maxTouchY = viewHeight - edgeIgnoreY;
-
-            if (touchX < minTouchX || touchX > maxTouchX ||
-                    touchY < minTouchY || touchY > maxTouchY) {
-                // Missed!
-                // if (DBG) log("  -> MISSED!");
-                mDownEventHit = false;
-                return true;  // Consume this event; don't let the button see it
-            } else {
-                // Hit!
-                // if (DBG) log("  -> HIT!");
-                mDownEventHit = true;
-                return false;  // Let this event through to the actual button
-            }
-        } else {
-            // This is a MOVE, UP or CANCEL event.
-            //
-            // We only do the "smaller hit target" check on DOWN events.
-            // For the subsequent MOVE/UP/CANCEL events, we let them
-            // through to the actual button IFF the previous DOWN event
-            // got through to the actual button (i.e. it was a "hit".)
-            return !mDownEventHit;
-        }
-    }
-}