Merge "Update asset for the icon to put on to the recent call card" into lmp-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9b39844..7532763 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -120,6 +120,9 @@
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.TAB" />
             </intent-filter>
+            <meta-data
+                android:name="com.android.keyguard.layout"
+                android:resource="@layout/keyguard_preview" />
         </activity>
 
         <activity android:name="com.android.dialer.settings.DialerSettingsActivity"
diff --git a/res/layout/keyguard_preview.xml b/res/layout/keyguard_preview.xml
new file mode 100644
index 0000000..0a55268
--- /dev/null
+++ b/res/layout/keyguard_preview.xml
@@ -0,0 +1,34 @@
+<?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
+  -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:orientation="vertical"
+        android:layout_height="match_parent"
+        android:layout_width="match_parent">
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="25dp"
+        android:background="@color/dialer_theme_color_dark" />
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/actionbar_and_tab_height"
+        android:background="@color/dialer_theme_color" />
+    <View
+        android:layout_width="match_parent"
+        android:layout_weight="1"
+        android:layout_height="0dp"
+        android:background="#ffffff" />
+</LinearLayout>
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 0c4e23e..7814718 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -107,7 +107,8 @@
     /** Indicates whether a drag is in process. */
     private boolean mInDragging = false;
 
-    public static final int PIN_LIMIT = 20;
+    // Pinned positions start from 1, so there are a total of 20 maximum pinned contacts
+    public static final int PIN_LIMIT = 21;
 
     /**
      * The soft limit on how many contact tiles to show.
@@ -551,7 +552,7 @@
         for (int i = 0; i < length; i++) {
             final ContactEntry contact = toArrange.get(i);
             // Decide whether the contact is hidden(demoted), pinned, or unpinned
-            if (contact.pinned > PIN_LIMIT) {
+            if (contact.pinned > PIN_LIMIT || contact.pinned == PinnedPositions.UNPINNED) {
                 unpinnedContacts.add(contact);
             } else if (contact.pinned > PinnedPositions.DEMOTED) {
                 // Demoted or contacts with negative pinned positions are ignored.
@@ -565,7 +566,7 @@
         final int maxToPin = Math.min(PIN_LIMIT, pinnedQueue.size() + unpinnedContacts.size());
 
         toArrange.clear();
-        for (int i = 0; i < maxToPin; i++) {
+        for (int i = 1; i < maxToPin + 1; i++) {
             if (!pinnedQueue.isEmpty() && pinnedQueue.peek().pinned <= i) {
                 final ContactEntry toPin = pinnedQueue.poll();
                 toPin.pinned = i;