Add presence to ContactsHeaderWidget
diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java
index 58fa0ba..462143f 100644
--- a/core/java/com/android/internal/widget/ContactHeaderWidget.java
+++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java
@@ -35,6 +35,7 @@
 import android.provider.ContactsContract.Data;
 import android.provider.ContactsContract.Intents;
 import android.provider.ContactsContract.PhoneLookup;
+import android.provider.ContactsContract.Presence;
 import android.provider.ContactsContract.RawContacts;
 import android.provider.ContactsContract.CommonDataKinds.Photo;
 import android.provider.SocialContract.Activities;
@@ -61,12 +62,13 @@
     private TextView mPhoneticNameView;
     private CheckBox mStarredView;
     private ImageView mPhotoView;
+    private ImageView mPresenceView;
     private TextView mStatusView;
     private int mNoPhotoResource;
     private QueryHandler mQueryHandler;
 
     protected long mContactId;
-    protected Uri mContactDataUri;
+    protected Uri mContactSummaryUri;
     protected Uri mContactUri;
     protected Uri mStatusUri;
 
@@ -84,12 +86,14 @@
         Contacts.DISPLAY_NAME,
         Contacts.STARRED,
         Contacts.PHOTO_ID,
+        Contacts.PRESENCE_STATUS,
     };
     protected static final int HEADER_DISPLAY_NAME_COLUMN_INDEX = 0;
     //TODO: We need to figure out how we're going to get the phonetic name.
     //static final int HEADER_PHONETIC_NAME_COLUMN_INDEX
     protected static final int HEADER_STARRED_COLUMN_INDEX = 1;
     protected static final int HEADER_PHOTO_ID_COLUMN_INDEX = 2;
+    protected static final int HEADER_PRESENCE_STATUS_COLUMN_INDEX = 3;
 
     //Projection used for finding the most recent social status.
     protected static final String[] SOCIAL_PROJECTION = new String[] {
@@ -144,6 +148,8 @@
         mPhotoView.setOnClickListener(this);
         mPhotoView.setOnLongClickListener(this);
 
+        mPresenceView = (ImageView) findViewById(R.id.presence);
+
         mStatusView = (TextView)findViewById(R.id.status);
 
         // Set the photo with a random "no contact" image
@@ -250,7 +256,7 @@
     public void bindFromContactId(long contactId) {
         mContactId = contactId;
         mContactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, mContactId);
-        mContactDataUri = Uri.withAppendedPath(mContactUri, Contacts.Data.CONTENT_DIRECTORY);
+        mContactSummaryUri = ContentUris.withAppendedId(Contacts.CONTENT_SUMMARY_URI, mContactId);
         mStatusUri = ContentUris.withAppendedId(
                 SocialContract.Activities.CONTENT_CONTACT_STATUS_URI, mContactId);
         redrawHeader();
@@ -317,8 +323,8 @@
     }
 
     protected void redrawHeader() {
-        if (mContactDataUri != null) {
-            mQueryHandler.startQuery(TOKEN_CONTACT_INFO, null, mContactDataUri, HEADER_PROJECTION,
+        if (mContactSummaryUri != null) {
+            mQueryHandler.startQuery(TOKEN_CONTACT_INFO, null, mContactSummaryUri, HEADER_PROJECTION,
                     null, null, null);
         }
 
@@ -352,6 +358,10 @@
                 photoBitmap = loadPlaceholderPhoto(null);
             }
             mPhotoView.setImageBitmap(photoBitmap);
+
+            //Set the presence status
+            int presence = c.getInt(HEADER_PRESENCE_STATUS_COLUMN_INDEX);
+            mPresenceView.setImageResource(Presence.getPresenceIconResourceId(presence));
         }
     }
 
diff --git a/core/res/res/layout-ja/contact_header_name.xml b/core/res/res/layout-ja/contact_header_name.xml
index 03332b1..20df5c6 100644
--- a/core/res/res/layout-ja/contact_header_name.xml
+++ b/core/res/res/layout-ja/contact_header_name.xml
@@ -25,6 +25,8 @@
     <TextView android:id="@+id/name"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:singleLine="true"
+        android:ellipsize="end"
     	android:textAppearance="?android:attr/textAppearanceLargeInverse"
     	android:textColor="@android:color/secondary_text_light"
         />
@@ -32,6 +34,8 @@
     <TextView android:id="@+id/phonetic_name"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:singleLine="true"
+        android:ellipsize="end"
     	android:textAppearance="?android:attr/textAppearanceSmallInverse"
     	android:textColor="@android:color/secondary_text_light"
         />
diff --git a/core/res/res/layout/contact_header.xml b/core/res/res/layout/contact_header.xml
index 06cd38c..73e379b 100644
--- a/core/res/res/layout/contact_header.xml
+++ b/core/res/res/layout/contact_header.xml
@@ -48,6 +48,13 @@
                 
     </LinearLayout>
 
+    <ImageView
+        android:id="@+id/presence"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:paddingLeft="3dip"
+        android:paddingRight="6dip"/>
+        
     <CheckBox
         android:id="@+id/star"
         android:layout_width="wrap_content"
diff --git a/core/res/res/layout/contact_header_name.xml b/core/res/res/layout/contact_header_name.xml
index aec943e..77751c3 100644
--- a/core/res/res/layout/contact_header_name.xml
+++ b/core/res/res/layout/contact_header_name.xml
@@ -21,6 +21,6 @@
     android:layout_height="wrap_content"
     android:textAppearance="?android:attr/textAppearanceLargeInverse"
     android:textColor="@android:color/secondary_text_light"
-    android:maxLines="2"
+    android:singleLine="true"
     android:ellipsize="end"
     />