Merge change I740cfdad into eclair

* changes:
  Use a thread pool to fetch images. Bug 2163087.
diff --git a/res/drawable-hdpi-finger/divider_dark_opaque.9.png b/res/drawable-hdpi-finger/divider_dark_opaque.9.png
deleted file mode 100644
index 9444f0d..0000000
--- a/res/drawable-hdpi-finger/divider_dark_opaque.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/infobar_dark.9.png b/res/drawable-hdpi-finger/infobar_dark.9.png
index be0085a..105f6d0 100644
--- a/res/drawable-hdpi-finger/infobar_dark.9.png
+++ b/res/drawable-hdpi-finger/infobar_dark.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/section_dark.9.png b/res/drawable-hdpi-finger/section_dark.9.png
deleted file mode 100644
index 5a865fa..0000000
--- a/res/drawable-hdpi-finger/section_dark.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/divider_dark_opaque.9.png b/res/drawable-mdpi-finger/divider_dark_opaque.9.png
deleted file mode 100644
index 9444f0d..0000000
--- a/res/drawable-mdpi-finger/divider_dark_opaque.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/infobar_dark.9.png b/res/drawable-mdpi-finger/infobar_dark.9.png
index a3f3b01..45b2dcb 100644
--- a/res/drawable-mdpi-finger/infobar_dark.9.png
+++ b/res/drawable-mdpi-finger/infobar_dark.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/section_dark.9.png b/res/drawable-mdpi-finger/section_dark.9.png
deleted file mode 100644
index dbf6ded..0000000
--- a/res/drawable-mdpi-finger/section_dark.9.png
+++ /dev/null
Binary files differ
diff --git a/res/layout-finger/contacts_list_item_photo.xml b/res/layout-finger/contacts_list_item_photo.xml
index bd3baf8..b7fcd7a 100644
--- a/res/layout-finger/contacts_list_item_photo.xml
+++ b/res/layout-finger/contacts_list_item_photo.xml
@@ -140,6 +140,6 @@
     <View android:id="@+id/list_divider"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        android:background="@drawable/divider_dark_opaque"
+        android:background="@*android:drawable/divider_horizontal_dark_opaque"
     />
 </LinearLayout>
diff --git a/res/layout-finger/list_section.xml b/res/layout-finger/list_section.xml
index b91d213..06a9ffe 100644
--- a/res/layout-finger/list_section.xml
+++ b/res/layout-finger/list_section.xml
@@ -19,7 +19,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="25dip"
-    android:background="@drawable/section_dark"
+    android:background="@*android:drawable/dark_header"
     >
     <TextView
         android:id="@+id/header_text"
@@ -28,14 +28,8 @@
         android:layout_centerVertical="true"
         android:layout_alignParentLeft="true"
         android:textStyle="bold"
-        android:textColor="#ffbfbfbf"
+        android:textColor="@*android:color/dim_foreground_dark"
         android:textSize="14sp"
         android:gravity="center"
     />
-    <View
-        android:layout_width="fill_parent"
-        android:layout_height="1dip"
-        android:layout_alignParentBottom="true"
-        android:background="@drawable/divider_dark_opaque"
-    />
 </RelativeLayout>
diff --git a/src/com/android/contacts/model/EntityModifier.java b/src/com/android/contacts/model/EntityModifier.java
index d6f6571..5700df2 100644
--- a/src/com/android/contacts/model/EntityModifier.java
+++ b/src/com/android/contacts/model/EntityModifier.java
@@ -85,7 +85,10 @@
 
         if (!hasChild && kind != null) {
             // Create child when none exists and valid kind
-            insertChild(state, kind);
+            final ValuesDelta child = insertChild(state, kind);
+            if (kind.mimeType.equals(Photo.CONTENT_ITEM_TYPE)) {
+                child.setFromTemplate(true);
+            }
         }
     }
 
@@ -321,7 +324,6 @@
     public static ValuesDelta insertChild(EntityDelta state, DataKind kind, EditType type) {
         // Bail early if invalid kind
         if (kind == null) return null;
-
         final ContentValues after = new ContentValues();
 
         // Our parent CONTACT_ID is provided later
@@ -338,7 +340,7 @@
         }
 
         final ValuesDelta child = ValuesDelta.fromAfter(after);
-        state.addEntry(child);
+	state.addEntry(child);
         return child;
     }
 
@@ -385,6 +387,7 @@
                         state.getValues().getAsString(RawContacts.ACCOUNT_TYPE));
                 final boolean isPhoto = TextUtils.equals(Photo.CONTENT_ITEM_TYPE, kind.mimeType);
                 final boolean isGooglePhoto = isPhoto && isGoogleSource;
+
                 if (EntityModifier.isEmpty(entry, kind) && !isGooglePhoto) {
                     // TODO: remove this verbose logging
                     Log.w(TAG, "Trimming: " + entry.toString());
@@ -394,7 +397,6 @@
                 }
             }
         }
-
         if (!hasValues) {
             // Trim overall entity if no children exist
             state.markDeleted();
diff --git a/src/com/android/contacts/ui/widget/PhotoEditorView.java b/src/com/android/contacts/ui/widget/PhotoEditorView.java
index 184b907..7dfe3d7 100644
--- a/src/com/android/contacts/ui/widget/PhotoEditorView.java
+++ b/src/com/android/contacts/ui/widget/PhotoEditorView.java
@@ -87,6 +87,7 @@
                 setImageBitmap(photo);
 		setEnabled(!readOnly);
                 mHasSetPhoto = true;
+                mEntry.setFromTemplate(false);
             } else {
                 resetDefault();
             }
@@ -125,6 +126,7 @@
             mEntry.put(Photo.PHOTO, out.toByteArray());
             setImageBitmap(photo);
             mHasSetPhoto = true;
+            mEntry.setFromTemplate(false);
         } catch (IOException e) {
             Log.w(TAG, "Unable to serialize photo: " + e.toString());
         }
@@ -135,6 +137,7 @@
         setScaleType(ImageView.ScaleType.CENTER);
         setImageResource(R.drawable.ic_menu_add_picture);
         mHasSetPhoto = false;
+        mEntry.setFromTemplate(true);
     }
 
     /** {@inheritDoc} */