Merge "Add URI for unknown contacts to enable quick contact badge" into klp-dev
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index c9cc7d9..53f6b8d 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -73,10 +73,10 @@
         </view>
 
         <LinearLayout
-            android:id="@+id/blue_separator"
+            android:id="@+id/separator"
             android:layout_width="match_parent"
             android:layout_height="1dip"
-            android:background="@android:color/holo_blue_light"
+            android:background="@color/background_dialer_light"
             android:layout_below="@+id/contact_background_sizer"
         />
         <View
@@ -126,7 +126,7 @@
             android:id="@+id/voicemail_container"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_below="@id/blue_separator"
+            android:layout_below="@id/separator"
             android:paddingBottom="@dimen/call_detail_button_spacing">
             <!-- The voicemail fragment will be put here. -->
         </LinearLayout>
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 6f5ca67..46e503c 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -17,6 +17,7 @@
 <view
     xmlns:android="http://schemas.android.com/apk/res/android"
     class="com.android.dialer.calllog.CallLogListItemView"
+    android:id="@+id/call_log_list_item"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml
index e4eb2b3..9d63514 100644
--- a/res/layout/dialtacts_activity.xml
+++ b/res/layout/dialtacts_activity.xml
@@ -42,6 +42,7 @@
                 android:layout_width="0dp"
                 android:layout_height="56dp"
                 android:layout_weight="1"
+                android:textSize="@dimen/search_text_size"
                 android:inputType="textFilter"/>
             <ImageView
                 android:id="@+id/search_close_button"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 87b0c1d..d1052d5 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -29,6 +29,9 @@
     <!-- Match call_button_height to Phone's dimens/in_call_end_button_height -->
     <dimen name="call_button_height">74dp</dimen>
 
+    <!--  Search View -->
+    <dimen name="search_text_size">16sp</dimen>
+
     <!-- Call Log -->
     <dimen name="call_log_call_action_size">32dip</dimen>
     <dimen name="call_log_call_action_width">48dip</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c6947dd..ad16f03 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -520,8 +520,8 @@
     <string name="add_contact_not_available">Re-enable the People application to use this feature.</string>
 
     <!-- Hint displayed in dialer search box when there is no query that is currently typed.
-         [CHAR LIMIT=25] -->
-    <string name="dialer_hint_find_contact">Type a name or phone</string>
+         [CHAR LIMIT=30] -->
+    <string name="dialer_hint_find_contact">Type a name or phone number</string>
 
     <!-- Title for the call log tab containing the list of all voicemails and calls
          [CHAR LIMIT=15] -->
@@ -609,7 +609,7 @@
     <!--  Title of show all contacts button -->
     <string name="show_all_contacts_button_text">All contacts</string>
     <!--  Text displayed when user swipes out a favorite contact -->
-    <string name="favorite_hidden">Hidden from favorites</string>
+    <string name="favorite_hidden">Removed from favorites</string>
     <!--  Text displayed for the undo button to undo removing a favorite contact -->
     <string name="favorite_hidden_undo">Undo</string>
 
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index d0e18bf..e26d2f0 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -569,7 +569,7 @@
                             private View mControls = findViewById(R.id.controls);
                             private View mPhoto = findViewById(R.id.contact_background_sizer);
                             private View mHeader = findViewById(R.id.photo_text_bar);
-                            private View mSeparator = findViewById(R.id.blue_separator);
+                        private View mSeparator = findViewById(R.id.separator);
 
                             @Override
                             public void setOffset(int offset) {
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index c85ce42..ca7a958 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -233,6 +233,7 @@
                 if (TextUtils.isEmpty(newText) && getInSearchUi()) {
                     exitSearchUi();
                     mSearchViewCloseButton.setVisibility(View.GONE);
+                    mVoiceSearchButton.setVisibility(View.VISIBLE);
                     return;
                 } else if (!TextUtils.isEmpty(newText)) {
                     final boolean sameSearchMode = (dialpadSearch && mInDialpadSearch) ||
@@ -249,6 +250,7 @@
                         mRegularSearchFragment.setQueryString(newText, false);
                     }
                     mSearchViewCloseButton.setVisibility(View.VISIBLE);
+                    mVoiceSearchButton.setVisibility(View.GONE);
                     return;
                 }
             }
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 7168667..b685030 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -26,8 +26,6 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
-import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.provider.CallLog;
 import android.provider.CallLog.Calls;
 import android.provider.ContactsContract;
@@ -429,22 +427,6 @@
         }
     }
 
-    /** Removes the missed call notifications. */
-    private void removeMissedCallNotifications() {
-        try {
-            ITelephony telephony =
-                    ITelephony.Stub.asInterface(ServiceManager.getService("phone"));
-            if (telephony != null) {
-                telephony.cancelMissedCallsNotification();
-            } else {
-                Log.w(TAG, "Telephony service is null, can't call " +
-                        "cancelMissedCallsNotification");
-            }
-        } catch (RemoteException e) {
-            Log.e(TAG, "Failed to clear missed calls notification due to remote exception");
-        }
-    }
-
     /** Updates call data and notification state while leaving the call log tab. */
     private void updateOnExit() {
         updateOnTransition(false);
@@ -469,14 +451,8 @@
             if (!onEntry) {
                 mCallLogQueryHandler.markMissedCallsAsRead();
             }
-            removeMissedCallNotifications();
-            updateVoicemailNotifications();
+            CallLogNotificationsHelper.removeMissedCallNotifications();
+            CallLogNotificationsHelper.updateVoicemailNotifications(getActivity());
         }
     }
-
-    private void updateVoicemailNotifications() {
-        Intent serviceIntent = new Intent(getActivity(), CallLogNotificationsService.class);
-        serviceIntent.setAction(CallLogNotificationsService.ACTION_UPDATE_NOTIFICATIONS);
-        getActivity().startService(serviceIntent);
-    }
 }
diff --git a/src/com/android/dialer/calllog/CallLogNotificationsHelper.java b/src/com/android/dialer/calllog/CallLogNotificationsHelper.java
new file mode 100644
index 0000000..6ce66f0
--- /dev/null
+++ b/src/com/android/dialer/calllog/CallLogNotificationsHelper.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2013 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.dialer.calllog;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.Log;
+
+import com.android.internal.telephony.ITelephony;
+
+/**
+ * Helper class operating on call log notifications.
+ */
+public class CallLogNotificationsHelper {
+    private static final String TAG = "CallLogNotificationsHelper";
+
+    /** Removes the missed call notifications. */
+    public static void removeMissedCallNotifications() {
+        try {
+            ITelephony telephony =
+                    ITelephony.Stub.asInterface(ServiceManager.getService("phone"));
+            if (telephony != null) {
+                telephony.cancelMissedCallsNotification();
+            } else {
+                Log.w(TAG, "Telephony service is null, can't call " +
+                        "cancelMissedCallsNotification");
+            }
+        } catch (RemoteException e) {
+            Log.e(TAG, "Failed to clear missed calls notification due to remote exception");
+        }
+    }
+
+    /** Update the voice mail notifications. */
+    public static void updateVoicemailNotifications(Context context) {
+        Intent serviceIntent = new Intent(context, CallLogNotificationsService.class);
+        serviceIntent.setAction(CallLogNotificationsService.ACTION_UPDATE_NOTIFICATIONS);
+        context.startService(serviceIntent);
+    }
+}
diff --git a/src/com/android/dialer/calllog/CallLogQueryHandler.java b/src/com/android/dialer/calllog/CallLogQueryHandler.java
index 91a2e5d..987dedf 100644
--- a/src/com/android/dialer/calllog/CallLogQueryHandler.java
+++ b/src/com/android/dialer/calllog/CallLogQueryHandler.java
@@ -132,16 +132,28 @@
         mLogLimit = limit;
     }
 
-
     /**
      * Fetches the list of calls from the call log for a given type.
+     * This call ignores the new or old state.
      * <p>
      * It will asynchronously update the content of the list view when the fetch completes.
      */
     public void fetchCalls(int callType) {
         cancelFetch();
         int requestId = newCallsRequest();
-        fetchCalls(QUERY_CALLLOG_TOKEN, requestId, callType);
+        fetchCalls(QUERY_CALLLOG_TOKEN, requestId, callType , false /* newOnly */);
+    }
+
+    /**
+     * Fetches the list of calls from the call log for a given type.
+     * This call fetches only the new (i.e. NEW = 1) ones.
+     * <p>
+     * It will asynchronously update the content of the list view when the fetch completes.
+     */
+    public void fetchNewCalls(int callType) {
+        cancelFetch();
+        int requestId = newCallsRequest();
+        fetchCalls(QUERY_CALLLOG_TOKEN, requestId, callType , true /* newOnly */);
     }
 
     public void fetchVoicemailStatus() {
@@ -149,20 +161,29 @@
                 VoicemailStatusHelperImpl.PROJECTION, null, null, null);
     }
 
-    /** Fetches the list of calls in the call log, either the new one or the old ones. */
-    private void fetchCalls(int token, int requestId, int callType) {
+    /** Fetches the list of calls in the call log. */
+    private void fetchCalls(int token, int requestId, int callType, boolean newOnly) {
         // We need to check for NULL explicitly otherwise entries with where READ is NULL
         // may not match either the query or its negation.
         // We consider the calls that are not yet consumed (i.e. IS_READ = 0) as "new".
-        String selection = null;
+        StringBuilder where = new StringBuilder();
         List<String> selectionArgs = Lists.newArrayList();
 
+        if (newOnly) {
+            where.append(Calls.NEW);
+            where.append(" = 1");
+        }
+
         if (callType > CALL_TYPE_ALL) {
+            if (where.length() > 0) {
+                where.append(" AND ");
+            }
             // Add a clause to fetch only items of type voicemail.
-            selection = String.format("(%s = ?)", Calls.TYPE);
+            where.append(String.format("(%s = ?)", Calls.TYPE));
             selectionArgs.add(Integer.toString(callType));
         }
         final int limit = (mLogLimit == -1) ? NUM_LOGS_TO_DISPLAY : mLogLimit;
+        final String selection = where.length() > 0 ? where.toString() : null;
         Uri uri = Calls.CONTENT_URI_WITH_VOICEMAIL.buildUpon()
                 .appendQueryParameter(Calls.LIMIT_PARAM_KEY, Integer.toString(limit))
                 .build();
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 11889bf..4ffb030 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -199,7 +199,7 @@
     @Override
     public void onResume() {
         super.onResume();
-        mCallLogQueryHandler.fetchCalls(CallLogQueryHandler.CALL_TYPE_ALL);
+        mCallLogQueryHandler.fetchNewCalls(CallLogQueryHandler.CALL_TYPE_ALL);
         mCallLogAdapter.setLoading(true);
         getLoaderManager().getLoader(LOADER_ID_CONTACT_TILE).forceLoad();
     }
diff --git a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
index f8e1e71..fba55a6 100644
--- a/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoriteMergedAdapter.java
@@ -18,14 +18,21 @@
 
 import android.content.Context;
 import android.content.res.Resources;
+import android.database.Cursor;
 import android.database.DataSetObserver;
+import android.view.MotionEvent;
 import android.view.View;
+import android.view.ViewConfiguration;
 import android.view.ViewGroup;
 import android.widget.BaseAdapter;
 import android.widget.FrameLayout;
 
 import com.android.dialer.R;
 import com.android.dialer.calllog.CallLogAdapter;
+import com.android.dialer.calllog.CallLogNotificationsHelper;
+import com.android.dialer.calllog.CallLogQueryHandler;
+import com.android.dialer.list.SwipeHelper.OnItemGestureListener;
+import com.android.dialer.list.SwipeHelper.SwipeHelperCallback;
 
 /**
  * An adapter that combines items from {@link com.android.contacts.common.list.ContactTileAdapter}
@@ -54,6 +61,41 @@
 
     private final DataSetObserver mObserver;
 
+    private final CallLogQueryHandler mCallLogQueryHandler;
+
+    private final OnItemGestureListener mCallLogOnItemSwipeListener =
+            new OnItemGestureListener() {
+        @Override
+        public void onSwipe(View view) {
+            mCallLogQueryHandler.markNewCallsAsOld();
+            mCallLogQueryHandler.markNewVoicemailsAsOld();
+            CallLogNotificationsHelper.removeMissedCallNotifications();
+            CallLogNotificationsHelper.updateVoicemailNotifications(mContext);
+            mCallLogQueryHandler.fetchNewCalls(CallLogQueryHandler.CALL_TYPE_ALL);
+        }
+
+        @Override
+        public void onTouch() {}
+
+        @Override
+        public boolean isSwipeEnabled() {
+            return true;
+        }
+    };
+
+    private final CallLogQueryHandler.Listener mCallLogQueryHandlerListener =
+            new CallLogQueryHandler.Listener() {
+        @Override
+        public void onVoicemailStatusFetched(Cursor statusCursor) {}
+
+        @Override
+        public void onCallsFetched(Cursor combinedCursor) {
+            mCallLogAdapter.invalidateCache();
+            mCallLogAdapter.changeCursor(combinedCursor);
+            mCallLogAdapter.notifyDataSetChanged();
+        }
+    };
+
     public PhoneFavoriteMergedAdapter(Context context,
             PhoneFavoritesTileAdapter contactTileAdapter,
             CallLogAdapter callLogAdapter,
@@ -69,6 +111,8 @@
         mContactTileAdapter.registerDataSetObserver(mObserver);
         mLoadingView = loadingView;
         mShowAllContactsButton = showAllContactsButton;
+        mCallLogQueryHandler = new CallLogQueryHandler(mContext.getContentResolver(),
+                mCallLogQueryHandlerListener);
     }
 
     @Override
@@ -160,11 +204,12 @@
 
         if (callLogAdapterCount > 0) {
             if (position == 0) {
-                final FrameLayout wrapper;
+                final SwipeableCallLogRow wrapper;
                 if (convertView == null) {
-                    wrapper = new FrameLayout(mContext);
+                    wrapper = new SwipeableCallLogRow(mContext);
+                    wrapper.setOnItemSwipeListener(mCallLogOnItemSwipeListener);
                 } else {
-                    wrapper = (FrameLayout) convertView;
+                    wrapper = (SwipeableCallLogRow) convertView;
                 }
 
                 // Special case wrapper view for the most recent call log item. This allows
@@ -174,17 +219,7 @@
                 final View view = mCallLogAdapter.getView(position, convertView == null ?
                         null : wrapper.getChildAt(0), parent);
                 wrapper.removeAllViews();
-                view.setBackgroundResource(R.drawable.dialer_recent_card_bg);
-
-                final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
-                        FrameLayout.LayoutParams.WRAP_CONTENT,
-                        FrameLayout.LayoutParams.WRAP_CONTENT);
-
-                params.setMarginsRelative(mCallLogPadding, mCallLogPadding, mCallLogPadding,
-                        mCallLogPadding);
-                view.setLayoutParams(params);
                 wrapper.addView(view);
-
                 return wrapper;
             }
             // Set position to the position of the actual favorite contact in the
@@ -227,4 +262,91 @@
     private int getAdjustedFavoritePosition(int position, int callLogAdapterCount) {
         return position - callLogAdapterCount;
     }
+
+    /**
+     * The swipeable call log row.
+     * See also {@link PhoneFavoritesTileAdapter.ContactTileRow}.
+     */
+    private class SwipeableCallLogRow extends FrameLayout implements SwipeHelperCallback {
+        private SwipeHelper mSwipeHelper;
+        private OnItemGestureListener mOnItemSwipeListener;
+
+        public SwipeableCallLogRow(Context context) {
+            super(context);
+            final float densityScale = getResources().getDisplayMetrics().density;
+            final float pagingTouchSlop = ViewConfiguration.get(context)
+                    .getScaledPagingTouchSlop();
+            mSwipeHelper = new SwipeHelper(context, SwipeHelper.X, this,
+                    densityScale, pagingTouchSlop);
+        }
+
+        @Override
+        public void addView(View view) {
+            view.setBackgroundResource(R.drawable.dialer_recent_card_bg);
+
+            final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
+                    FrameLayout.LayoutParams.WRAP_CONTENT,
+                    FrameLayout.LayoutParams.WRAP_CONTENT);
+            params.setMarginsRelative(mCallLogPadding, mCallLogPadding, mCallLogPadding,
+                    mCallLogPadding);
+            view.setLayoutParams(params);
+
+            super.addView(view);
+        }
+
+        @Override
+        public View getChildAtPosition(MotionEvent ev) {
+            return getChildCount() > 0 ? getChildAt(0) : null;
+        }
+
+        @Override
+        public View getChildContentView(View v) {
+            return v.findViewById(R.id.call_log_list_item);
+        }
+
+        @Override
+        public void onScroll() {}
+
+        @Override
+        public boolean canChildBeDismissed(View v) {
+            return true;
+        }
+
+        @Override
+        public void onBeginDrag(View v) {
+        }
+
+        @Override
+        public void onChildDismissed(View v) {
+            if (v != null && mOnItemSwipeListener != null) {
+                mOnItemSwipeListener.onSwipe(v);
+            }
+            removeAllViews();
+        }
+
+        @Override
+        public void onDragCancelled(View v) {}
+
+        @Override
+        public boolean onInterceptTouchEvent(MotionEvent ev) {
+            if (mSwipeHelper != null) {
+                return mSwipeHelper.onInterceptTouchEvent(ev) || super.onInterceptTouchEvent(ev);
+            } else {
+                return super.onInterceptTouchEvent(ev);
+            }
+        }
+
+        @Override
+        public boolean onTouchEvent(MotionEvent ev) {
+            if (mSwipeHelper != null) {
+                return mSwipeHelper.onTouchEvent(ev) || super.onTouchEvent(ev);
+            } else {
+                return super.onTouchEvent(ev);
+            }
+        }
+
+        public void setOnItemSwipeListener(OnItemGestureListener listener) {
+            mOnItemSwipeListener = listener;
+        }
+    }
 }
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 1c6ffde..8eba964 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -715,6 +715,9 @@
                         .getScaledPagingTouchSlop();
                 mSwipeHelper = new SwipeHelper(context, SwipeHelper.X, this, densityScale,
                         pagingTouchSlop);
+                // Increase swipe thresholds for square tiles since they are relatively small.
+                mSwipeHelper.setChildSwipedFarEnoughFactor(0.9f);
+                mSwipeHelper.setChildSwipedFastEnoughFactor(0.1f);
                 mOnItemSwipeListener = PhoneFavoritesTileAdapter.this;
             }
         }
diff --git a/src/com/android/dialer/list/RegularSearchListAdapter.java b/src/com/android/dialer/list/RegularSearchListAdapter.java
index 627262e..5877912 100644
--- a/src/com/android/dialer/list/RegularSearchListAdapter.java
+++ b/src/com/android/dialer/list/RegularSearchListAdapter.java
@@ -50,13 +50,11 @@
             final DirectoryPartition partition =
                 (DirectoryPartition) getPartition(partitionIndex);
             final long directoryId = partition.getDirectoryId();
-            if (isExtendedDirectory(directoryId)) {
-               info.sourceType = CachedContactInfo.SOURCE_TYPE_EXTENDED;
-                // TODO source_id for extended directory?
-            } else {
-                info.sourceType = CachedContactInfo.SOURCE_TYPE_DIRECTORY;
-                info.sourceId = (int) directoryId;
-            }
+            info.sourceName = partition.getLabel();
+            info.sourceType = isExtendedDirectory(directoryId) ?
+                CachedContactInfo.SOURCE_TYPE_EXTENDED :
+                CachedContactInfo.SOURCE_TYPE_DIRECTORY;
+            info.sourceId = (int) directoryId;
         }
         return info;
     }
diff --git a/src/com/android/dialer/list/SwipeHelper.java b/src/com/android/dialer/list/SwipeHelper.java
index 1521714..ce46ec3 100644
--- a/src/com/android/dialer/list/SwipeHelper.java
+++ b/src/com/android/dialer/list/SwipeHelper.java
@@ -89,6 +89,9 @@
     private float mStartAlpha;
     private boolean mProtected = false;
 
+    private float mChildSwipedFarEnoughFactor = 0.4f;
+    private float mChildSwipedFastEnoughFactor = 0.05f;
+
     public SwipeHelper(Context context, int swipeDirection, SwipeHelperCallback callback, float densityScale,
             float pagingTouchSlop) {
         mCallback = callback;
@@ -118,6 +121,14 @@
         mPagingTouchSlop = pagingTouchSlop;
     }
 
+    public void setChildSwipedFarEnoughFactor(float factor) {
+        mChildSwipedFarEnoughFactor = factor;
+    }
+
+    public void setChildSwipedFastEnoughFactor(float factor) {
+        mChildSwipedFastEnoughFactor = factor;
+    }
+
     private float getVelocity(VelocityTracker vt) {
         return mSwipeDirection == X ? vt.getXVelocity() :
                 vt.getYVelocity();
@@ -407,15 +418,15 @@
                     // swipe/dismiss
                     float translation = Math.abs(mCurrAnimView.getTranslationX());
                     float currAnimViewSize = getSize(mCurrAnimView);
-                    // Long swipe = translation of .4 * width
+                    // Long swipe = translation of {@link #mChildSwipedFarEnoughFactor} * width
                     boolean childSwipedFarEnough = DISMISS_IF_SWIPED_FAR_ENOUGH
-                            && translation > 0.4 * currAnimViewSize;
-                    // Fast swipe = > escapeVelocity and translation of .1 *
-                    // width
+                            && translation > mChildSwipedFarEnoughFactor * currAnimViewSize;
+                    // Fast swipe = > escapeVelocity and translation of
+                    // {@link #mChildSwipedFastEnoughFactor} * width
                     boolean childSwipedFastEnough = (Math.abs(velocity) > escapeVelocity)
                             && (Math.abs(velocity) > Math.abs(perpendicularVelocity))
                             && (velocity > 0) == (mCurrAnimView.getTranslationX() > 0)
-                            && translation > 0.05 * currAnimViewSize;
+                            && translation > mChildSwipedFastEnoughFactor * currAnimViewSize;
                     if (LOG_SWIPE_DISMISS_VELOCITY) {
                         Log.v(TAG, "Swipe/Dismiss: " + velocity + "/" + escapeVelocity + "/"
                                 + perpendicularVelocity + ", x: " + translation + "/"
@@ -468,4 +479,4 @@
 
         public boolean isSwipeEnabled();
     }
-}
\ No newline at end of file
+}
diff --git a/src/com/android/dialer/service/CachedNumberLookupService.java b/src/com/android/dialer/service/CachedNumberLookupService.java
index 27bf589..b045934 100644
--- a/src/com/android/dialer/service/CachedNumberLookupService.java
+++ b/src/com/android/dialer/service/CachedNumberLookupService.java
@@ -13,6 +13,7 @@
         public static final int SOURCE_TYPE_PLACES = 3;
         public static final int SOURCE_TYPE_PROFILE = 4;
 
+        public String sourceName;
         public int    sourceType;
         public int    sourceId;
         public String lookupKey;