am e0e126ba: merge -s ours from froyo-release so that upgrading to gingerbread is a git fast-forward

Merge commit 'e0e126bad38e267e5b4e31b9981ce2858b811e04' into gingerbread-plus-aosp

* commit 'e0e126bad38e267e5b4e31b9981ce2858b811e04':
  Compare only network portion to determine if number is voicemail.
  Fixing use of green button in call log
diff --git a/res/layout-finger/quickcontact_item_nodata.xml b/res/layout-finger/quickcontact_item_nodata.xml
new file mode 100644
index 0000000..5215e30
--- /dev/null
+++ b/res/layout-finger/quickcontact_item_nodata.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<TextView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingLeft="12dip"
+    android:paddingRight="12dip"
+    android:scaleType="centerInside"
+    android:focusable="false"
+    android:clickable="false"
+    android:gravity="center_vertical"
+    android:background="@drawable/quickcontact_slider_btn_normal"
+    android:textColor="@android:color/black"
+    android:text="@string/quickcontact_no_data" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index facf34c..2a426fe 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -462,7 +462,7 @@
     </string>
 
     <!-- Activity title for the activity that lets the user choose which groups of contacts to sync from the server -->
-    
+
 
     <!-- Live folder label for all contacts -->
     <string name="liveFolder_all_label">All contacts</string>
@@ -840,6 +840,9 @@
     <!-- Shown as the header name for a person when the name is missing or unknown. -->
     <string name="quickcontact_missing_name">Unknown</string>
 
+    <!-- Text that is shown in the Badge, when there is no data to display -->
+    <string name="quickcontact_no_data">No data</string>
+
     <!-- The menu item to open the list of accounts -->
     <string name="menu_accounts">Accounts</string>
 
@@ -1085,28 +1088,28 @@
 
     <!-- Text describing that a contact has no information available other than name and photo -->
     <string name="no_contact_details">No additional information for this contact</string>
-    
+
     <!-- Label of the "sort list by" display option -->
     <string name="display_options_sort_list_by">Sort list by</string>
-    
+
     <!-- An allowable value for the "sort list by" contact display option  -->
     <string name="display_options_sort_by_given_name">Given name</string>
-    
+
     <!-- An allowable value for the "sort list by" contact display option  -->
     <string name="display_options_sort_by_family_name">Family name</string>
-           
+
     <!-- Label of the "view names as" display option -->
     <string name="display_options_view_names_as">View contact names as</string>
-    
+
     <!-- An allowable value for the "view names as" contact display option  -->
     <string name="display_options_view_given_name_first">Given name first</string>
-    
+
     <!-- An allowable value for the "view names as" contact display option  -->
     <string name="display_options_view_family_name_first">Family name first</string>
-    
+
     <!-- Gray hint displayed in the search field in Contacts when empty -->
     <string name="search_bar_hint">Search contacts</string>
-    
+
     <!-- Button displayed underneath the list of filtered visible contacts -->
     <string name="search_for_all_contacts">Search for all contacts</string>
 
@@ -1124,12 +1127,12 @@
 
     <!-- Text shown in the contacts app if the background process updating contacts fails because of memory shortage -->
     <string name="upgrade_out_of_memory">Contacts are in the process of being upgraded.
-    \n\nThe upgrade process requires approximately <xliff:g id="size_in_megabytes">%d</xliff:g>Mb of 
-    internal phone storage.\n\nChoose one of the following options:</string>
-    
+    \n\nThe upgrade process requires approximately <xliff:g id="size_in_megabytes">%d</xliff:g>
+    Mb of internal phone storage.\n\nChoose one of the following options:</string>
+
     <!-- Button shown in the contacts app if the background process updating contacts fails because of memory shortage -->
     <string name="upgrade_out_of_memory_uninstall">Uninstall some applications</string>
-    
+
     <!-- Button shown in the contacts app if the background process updating contacts fails because of memory shortage -->
     <string name="upgrade_out_of_memory_retry">Retry upgrade</string>
 
diff --git a/src/com/android/contacts/model/EntityDelta.java b/src/com/android/contacts/model/EntityDelta.java
index 9eb7779..cdf2e41 100644
--- a/src/com/android/contacts/model/EntityDelta.java
+++ b/src/com/android/contacts/model/EntityDelta.java
@@ -59,7 +59,7 @@
     // TODO: optimize by using contentvalues pool, since we allocate so many of them
 
     private static final String TAG = "EntityDelta";
-    private static final boolean LOGV = true;
+    private static final boolean LOGV = false;
 
     /**
      * Direct values from {@link Entity#getEntityValues()}.
diff --git a/src/com/android/contacts/ui/EditContactActivity.java b/src/com/android/contacts/ui/EditContactActivity.java
index c70cff6..3e248ea 100644
--- a/src/com/android/contacts/ui/EditContactActivity.java
+++ b/src/com/android/contacts/ui/EditContactActivity.java
@@ -1370,6 +1370,9 @@
 
         int value;
         if (!skipAccountTypeCheck) {
+            if (oneSource.accountType == null) {
+                return 1;
+            }
             value = oneSource.accountType.compareTo(twoSource.accountType);
             if (value != 0) {
                 return value;
diff --git a/src/com/android/contacts/ui/QuickContactWindow.java b/src/com/android/contacts/ui/QuickContactWindow.java
index 6fdcb01..20d5bfd 100644
--- a/src/com/android/contacts/ui/QuickContactWindow.java
+++ b/src/com/android/contacts/ui/QuickContactWindow.java
@@ -168,7 +168,6 @@
     private int mRequestedY;
 
     private boolean mHasValidSocial = false;
-    private boolean mHasData = false;
     private boolean mMakePrimary = false;
 
     private ImageView mArrowUp;
@@ -599,7 +598,7 @@
      * {@link #showInternal()} when all data items are present.
      */
     private void considerShowing() {
-        if (mHasData && !mShowing && !mDismissed) {
+        if (!mShowing && !mDismissed) {
             if (mMode == QuickContact.MODE_MEDIUM && !mHasValidSocial) {
                 // Missing valid social, swap medium for small header
                 mHeader.setVisibility(View.GONE);
@@ -624,7 +623,6 @@
         }
 
         handleData(cursor);
-        mHasData = true;
 
         if (!cursor.isClosed()) {
             cursor.close();
@@ -960,8 +958,8 @@
         /** {@inheritDoc} */
         public Intent getIntent() {
             final Intent intent = new Intent(Intent.ACTION_VIEW, mLookupUri);
-	    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
-	    return intent;
+            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+            return intent;
         }
 
         /** {@inheritDoc} */
@@ -1258,9 +1256,12 @@
         // All the mime-types to add.
         final Set<String> containedTypes = new HashSet<String>(mActions.keySet());
 
+        boolean hasData = false;
+
         // First, add PRECEDING_MIMETYPES, which are most common.
         for (String mimeType : PRECEDING_MIMETYPES) {
             if (containedTypes.contains(mimeType)) {
+                hasData = true;
                 mTrack.addView(inflateAction(mimeType), index++);
                 containedTypes.remove(mimeType);
             }
@@ -1272,6 +1273,7 @@
         // Then, add FOLLOWING_MIMETYPES, which are least common.
         for (String mimeType : FOLLOWING_MIMETYPES) {
             if (containedTypes.contains(mimeType)) {
+                hasData = true;
                 mTrack.addView(inflateAction(mimeType), index++);
                 containedTypes.remove(mimeType);
             }
@@ -1280,10 +1282,17 @@
         // Go back to just after PRECEDING_MIMETYPES, and append the rest.
         index = indexAfterPreceding;
         final String[] remainingTypes = containedTypes.toArray(new String[containedTypes.size()]);
+        if (remainingTypes.length > 0) hasData = true;
         Arrays.sort(remainingTypes);
         for (String mimeType : remainingTypes) {
             mTrack.addView(inflateAction(mimeType), index++);
         }
+
+        // When there is no data to display, add a TextView to show the user there's no data
+        if (!hasData) {
+            View view = mInflater.inflate(R.layout.quickcontact_item_nodata, mTrack, false);
+            mTrack.addView(view, index++);
+        }
     }
 
     /**
@@ -1316,6 +1325,10 @@
      * possible recycling during another pass.
      */
     private synchronized void releaseView(View view) {
+        // Only add CheckableImageViews
+        if (!(view instanceof CheckableImageView)) {
+            return;
+        }
         mActionPool.offer(view);
         mActionRecycled++;
     }