am 26585d93: (-s ours) am 0faf655c: Import revised translations.  DO NOT MERGE
diff --git a/Android.mk b/Android.mk
index 5a820bd..ff1b7e2 100644
--- a/Android.mk
+++ b/Android.mk
@@ -5,7 +5,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := com.android.phone.common
+LOCAL_STATIC_JAVA_LIBRARIES := com.android.phone.common com.android.vcard android-common
 
 LOCAL_PACKAGE_NAME := Contacts
 LOCAL_CERTIFICATE := shared
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 92ac452..1dc0235 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -40,6 +40,7 @@
         android:icon="@drawable/ic_launcher_contacts"
         android:process="android.process.acore"
         android:taskAffinity="android.task.contacts"
+        android:hardwareAccelerated="true"
     >
 
         <!-- A virtual 12 key dialer -->
@@ -72,6 +73,7 @@
             android:clearTaskOnLaunch="true"
             android:icon="@drawable/ic_launcher_phone"
             android:screenOrientation="nosensor"
+            android:enabled="@bool/dialerEnabled"
         >
             <intent-filter>
                 <action android:name="android.intent.action.DIAL" />
@@ -116,11 +118,11 @@
             </intent-filter>
         </activity>
 
-        <!-- Tab container for all tabs -->
-        <activity-alias android:name="DialtactsContactsEntryActivity"
-            android:targetActivity="DialtactsActivity"
+        <!-- Front door proxy that picks the right UI based on the screen config -->
+        <activity android:name=".activities.ContactsFrontDoor"
             android:label="@string/contactsList"
             android:icon="@drawable/ic_launcher_contacts"
+            android:theme="@android:style/Theme.NoTitleBar"
         >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -135,7 +137,22 @@
                 <data android:mimeType="vnd.android.cursor.dir/person" android:host="contacts" />
                 <data android:mimeType="vnd.android.cursor.dir/contact" android:host="com.android.contacts" />
             </intent-filter>
+        </activity>
 
+        <!-- Main launch Intent to open the Contacts app. This will open the app in its last manual
+        state. This is the state that has been explicitly set by the user (e.g. by clicking a tab).
+        States configured via other Intents (e.g. CallLog after Call) are not considered manual
+        state. At the moment, the Intent always goes to the DialtactsActivity, but this might later
+        be changed to also include sub-activities like Edit or View if they were left open -->
+
+        <activity-alias android:name="ContactsLaunchActivity"
+            android:targetActivity="DialtactsActivity"
+        >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.BROWSABLE" />
+            </intent-filter>
         </activity-alias>
 
         <!-- An empty activity that presents the DialtactActivity's Favorites tab -->
@@ -148,10 +165,11 @@
             </intent-filter>
         </activity-alias>
 
-        <!-- The actual list of contacts, usually embedded in ContactsActivity -->
-        <activity android:name="ContactsListActivity"
+        <!-- The actual list of contacts -->
+        <activity android:name=".activities.ContactBrowserActivity"
             android:label="@string/contactsList"
             android:clearTaskOnLaunch="true"
+            android:theme="@style/ContactBrowserTheme"
         >
             <intent-filter>
                 <action android:name="com.android.contacts.action.LIST_DEFAULT" />
@@ -196,6 +214,21 @@
             </intent-filter>
 
             <intent-filter>
+                <action android:name="android.intent.action.SEARCH" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+
+            <meta-data android:name="android.app.searchable"
+                android:resource="@xml/searchable"
+            />
+        </activity>
+        
+        <activity android:name=".activities.ContactSelectionActivity"
+            android:label="@string/contactsList"
+            android:clearTaskOnLaunch="true"
+            android:theme="@style/ContactPickerTheme"
+        >
+            <intent-filter>
                 <action android:name="android.intent.action.INSERT_OR_EDIT" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <data android:mimeType="vnd.android.cursor.item/person" />
@@ -206,70 +239,84 @@
             <intent-filter>
                 <action android:name="android.intent.action.PICK" />
                 <category android:name="android.intent.category.DEFAULT" />
-                <data android:mimeType="vnd.android.cursor.dir/contact" />
-                <data android:mimeType="vnd.android.cursor.dir/person" />
-                <data android:mimeType="vnd.android.cursor.dir/phone_v2" />
-                <data android:mimeType="vnd.android.cursor.dir/phone" />
-                <data android:mimeType="vnd.android.cursor.dir/postal-address_v2" />
-                <data android:mimeType="vnd.android.cursor.dir/postal-address" />
+                <data android:mimeType="vnd.android.cursor.dir/contact" android:host="com.android.contacts" />
+                <data android:mimeType="vnd.android.cursor.dir/person" android:host="contacts" />
+                <data android:mimeType="vnd.android.cursor.dir/phone_v2" android:host="com.android.contacts" />
+                <data android:mimeType="vnd.android.cursor.dir/phone" android:host="contacts" />
+                <data android:mimeType="vnd.android.cursor.dir/postal-address_v2" android:host="com.android.contacts" />
+                <data android:mimeType="vnd.android.cursor.dir/postal-address" android:host="contacts" />
             </intent-filter>
 
             <intent-filter>
                 <action android:name="android.intent.action.GET_CONTENT" />
                 <category android:name="android.intent.category.DEFAULT" />
-                <data android:mimeType="vnd.android.cursor.item/contact" />
-                <data android:mimeType="vnd.android.cursor.item/person" />
-                <data android:mimeType="vnd.android.cursor.item/phone_v2" />
-                <data android:mimeType="vnd.android.cursor.item/phone" />
-                <data android:mimeType="vnd.android.cursor.item/postal-address_v2" />
-                <data android:mimeType="vnd.android.cursor.item/postal-address" />
+                <data android:mimeType="vnd.android.cursor.item/contact" android:host="com.android.contacts" />
+                <data android:mimeType="vnd.android.cursor.item/person" android:host="contacts" />
+                <data android:mimeType="vnd.android.cursor.item/phone_v2" android:host="com.android.contacts" />
+                <data android:mimeType="vnd.android.cursor.item/phone" android:host="contacts" />
+                <data android:mimeType="vnd.android.cursor.item/postal-address_v2" android:host="com.android.contacts" />
+                <data android:mimeType="vnd.android.cursor.item/postal-address" android:host="contacts" />
             </intent-filter>
-
         </activity>
 
+        <!-- Backwards compatibility: somebody may have hard coded this activity name -->
+        <activity-alias android:name="ContactsListActivity"
+            android:targetActivity=".activities.ContactBrowserActivity"
+        />
+
         <!-- An activity for joining contacts -->
-        <activity android:name="ContactsListActivity$JoinContactActivity"
-            android:theme="@style/TallTitleBarTheme"
+        <activity android:name="JoinContactActivity"
+            android:theme="@style/JoinContactActivityTheme"
             android:clearTaskOnLaunch="true"
         >
             <intent-filter>
-                <action android:name="com.android.contacts.action.JOIN_AGGREGATE" />
+                <action android:name="com.android.contacts.action.JOIN_CONTACT" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
 
+        <!-- An activity for selecting multiple phone numbers -->
+        <activity android:name="MultiplePhonePickerActivity"
+            android:enabled="false">
+            <intent-filter>
+                <action android:name="com.android.contacts.action.GET_MULTIPLE_PHONES" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:mimeType="vnd.android.cursor.dir/phone_v2" android:host="com.android.contacts" />
+            </intent-filter>
+        </activity>
+
         <!-- The contacts search/filter UI -->
-        <activity android:name="ContactsListActivity$ContactsSearchActivity"
+        <activity android:name=".activities.ContactSearchActivity"
             android:theme="@style/ContactsSearchTheme"
-            android:windowSoftInputMode="stateAlwaysVisible|adjustPan"
+            android:windowSoftInputMode="stateAlwaysVisible"
         >
             <intent-filter>
                 <action android:name="com.android.contacts.action.FILTER_CONTACTS" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <data android:mimeType="vnd.android.cursor.dir/contact" android:host="com.android.contacts" />
             </intent-filter>
+
         </activity>
 
         <!-- The contacts search/filter UI -->
-        <activity android:name="SearchResultsActivity"
-            android:theme="@style/TallTitleBarTheme"
-            android:label="@string/contactsList"
-        >
-            <intent-filter>
-                <action android:name="android.intent.action.SEARCH" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
+        <activity-alias android:name="SearchResultsActivity"
+            android:targetActivity=".activities.ContactBrowserActivity">
+        </activity-alias>
 
-            <meta-data android:name="android.app.searchable"
-                android:resource="@xml/searchable"
-            />
-        </activity>
+        <!-- Used to set options -->
+        <activity
+            android:name=".preference.ContactsPreferenceActivity"
+            android:label="@string/activity_title_settings"
+            android:theme="@style/ContactsPreferencesTheme" />
 
         <!-- Used to select display and sync groups -->
-        <activity android:name=".ui.ContactsPreferencesActivity" android:label="@string/displayGroups" />
+        <activity
+            android:name=".list.CustomContactListFilterActivity"
+            android:label="@string/custom_list_filter"
+            android:theme="@style/CustomContactListFilterTheme" />
 
         <activity
-            android:name=".ui.ShowOrCreateActivity"
+            android:name=".activities.ShowOrCreateActivity"
             android:theme="@style/FullyTranslucent">
 
             <intent-filter>
@@ -283,7 +330,7 @@
         <!-- Used to show QuickContact window over a translucent activity, which is a
              temporary hack until we add better framework support. -->
         <activity
-            android:name=".ui.QuickContactActivity"
+            android:name=".quickcontact.QuickContactActivity"
             android:theme="@style/FullyTranslucent.QuickContact"
             android:launchMode="singleTop"
             android:excludeFromRecents="true"
@@ -300,7 +347,7 @@
         </activity>
 
         <activity-alias android:name="ContactShortcut"
-            android:targetActivity="ContactsListActivity"
+            android:targetActivity=".activities.ContactSelectionActivity"
             android:label="@string/shortcutContact"
             android:icon="@drawable/ic_launcher_shortcut_contact">
 
@@ -312,9 +359,10 @@
         </activity-alias>
 
         <activity-alias android:name="alias.DialShortcut"
-            android:targetActivity="ContactsListActivity"
+            android:targetActivity=".activities.ContactSelectionActivity"
             android:label="@string/shortcutDialContact"
-            android:icon="@drawable/ic_launcher_shortcut_directdial">
+            android:icon="@drawable/ic_launcher_shortcut_directdial"
+            android:enabled="@bool/dialerEnabled">
 
             <intent-filter>
                 <action android:name="android.intent.action.CREATE_SHORTCUT" />
@@ -325,9 +373,10 @@
         </activity-alias>
 
         <activity-alias android:name="alias.MessageShortcut"
-            android:targetActivity="ContactsListActivity"
+            android:targetActivity=".activities.ContactSelectionActivity"
             android:label="@string/shortcutMessageContact"
-            android:icon="@drawable/ic_launcher_shortcut_directmessage">
+            android:icon="@drawable/ic_launcher_shortcut_directmessage"
+            android:enabled="@bool/dialerEnabled">
 
             <intent-filter>
                 <action android:name="android.intent.action.CREATE_SHORTCUT" />
@@ -338,7 +387,7 @@
 
         <activity android:name="CallDetailActivity"
             android:label="@string/callDetailTitle"
-            android:theme="@style/TallTitleBarTheme"
+            android:theme="@style/CallDetailActivityTheme"
         >
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
@@ -348,9 +397,9 @@
         </activity>
 
         <!-- Views the details of a single contact -->
-        <activity android:name="ViewContactActivity"
+        <activity android:name=".activities.ContactDetailActivity"
             android:label="@string/viewContactTitle"
-            android:theme="@style/TallTitleBarTheme">
+            android:theme="@style/ContactDetailActivityTheme">
 
             <intent-filter android:label="@string/viewContactDesription">
                 <action android:name="android.intent.action.VIEW" />
@@ -361,10 +410,11 @@
             </intent-filter>
         </activity>
 
-        <!-- Edit or insert details for a contact -->
+        <!-- Create a new or edit an existing contact -->
         <activity
-            android:name=".ui.EditContactActivity"
-            android:windowSoftInputMode="stateHidden|adjustResize">
+            android:name=".activities.ContactEditorActivity"
+            android:theme="@style/ContactEditorActivityTheme"
+            android:windowSoftInputMode="adjustResize">
 
             <intent-filter android:label="@string/editContactDescription">
                 <action android:name="android.intent.action.EDIT" />
@@ -373,7 +423,6 @@
                 <data android:mimeType="vnd.android.cursor.item/contact" android:host="com.android.contacts" />
                 <data android:mimeType="vnd.android.cursor.item/raw_contact" android:host="com.android.contacts" />
             </intent-filter>
-
             <intent-filter android:label="@string/insertContactDescription">
                 <action android:name="android.intent.action.INSERT" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -381,7 +430,6 @@
                 <data android:mimeType="vnd.android.cursor.dir/contact" />
                 <data android:mimeType="vnd.android.cursor.dir/raw_contact" />
             </intent-filter>
-
         </activity>
 
         <!-- Stub service used to keep our process alive long enough for
@@ -390,6 +438,11 @@
             android:name=".util.EmptyService"
             android:exported="false" />
 
+        <!-- Service to save a contact -->
+        <service
+            android:name=".views.ContactSaveService"
+            android:exported="false" />
+
         <!-- Views the details of a single contact -->
         <activity android:name="ContactOptionsActivity"
             android:label="@string/contactOptionsTitle"
@@ -412,10 +465,15 @@
             />
         </activity>
 
-        <!-- Makes .ContactsListActivity the search target for any activity in Contacts -->
+        <!-- Interstitial activity that shows a phone disambig dialog -->
+        <activity android:name="CallContactActivity"
+            android:theme="@android:style/Theme.Translucent">
+        </activity>
+
+        <!-- Makes .ContactBrowserActivity the search target for any activity in Contacts -->
         <meta-data
             android:name="android.app.default_searchable"
-            android:value=".ContactsListActivity" />
+            android:value=".activities.ContactBrowserActivity" />
 
 
         <!-- LIVE FOLDERS -->
@@ -449,17 +507,55 @@
             </intent-filter>
         </activity>
 
-        <activity android:name=".ImportVCardActivity"
+        <!-- vCard related -->
+        <activity android:name=".vcard.ImportVCardActivity"
             android:theme="@style/BackgroundOnly">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
                 <data android:mimeType="text/directory" />
+                <data android:mimeType="text/vcard" />
                 <data android:mimeType="text/x-vcard" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
 
-        <activity android:name=".ExportVCardActivity"
+        <activity android:name=".vcard.CancelImportActivity"
             android:theme="@style/BackgroundOnly" />
+
+        <activity android:name=".vcard.SelectAccountActivity"
+            android:theme="@style/BackgroundOnly" />
+
+        <activity android:name=".vcard.ExportVCardActivity"
+            android:theme="@style/BackgroundOnly" />
+
+        <service
+            android:name=".vcard.VCardService"
+            android:exported="false" />
+
+        <!-- Pinned header list demo -->
+        <activity android:name=".widget.PinnedHeaderListDemoActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
+        <!-- The widget that shows details and the social stream of a contact -->
+        <receiver android:name=".socialwidget.SocialWidgetProvider"
+            android:label="Contact Social Stream" >
+            <intent-filter>
+                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+            </intent-filter>
+            <meta-data android:name="android.appwidget.provider"
+                    android:resource="@xml/social_widget_info" />
+        </receiver>
+
+        <activity
+            android:name=".socialwidget.SocialWidgetConfigureActivity"
+            android:theme="@style/SocialWidgetConfigureTheme">
+            <intent-filter>
+                <action android:name="android.intent.action.APPWIDGET_PICK" />
+            </intent-filter>
+        </activity>
     </application>
 </manifest>
diff --git a/proguard.flags b/proguard.flags
index 6cc704c..577144b 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -12,3 +12,8 @@
 -keep class com.android.contacts.model.EntityDelta$ValuesDelta {
   public android.content.ContentValues getAfter();
 }
+
+# Any methods whose name is '*ForTest' are preserved.
+-keep class ** {
+  *** *ForTest(...);
+}
\ No newline at end of file
diff --git a/res/anim/aizy_preview_popup_enter.xml b/res/anim/aizy_preview_popup_enter.xml
new file mode 100644
index 0000000..194a3a3
--- /dev/null
+++ b/res/anim/aizy_preview_popup_enter.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/accelerate_interpolator">
+	<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
+            android:duration="@android:integer/config_shortAnimTime" />
+</set>
diff --git a/res/anim/aizy_preview_popup_exit.xml b/res/anim/aizy_preview_popup_exit.xml
new file mode 100644
index 0000000..ed5cda8
--- /dev/null
+++ b/res/anim/aizy_preview_popup_exit.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/accelerate_interpolator">
+	<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
+            android:duration="@android:integer/config_longAnimTime" />
+</set>
diff --git a/res/anim/footer_appear.xml b/res/anim/footer_appear.xml
new file mode 100644
index 0000000..941454a
--- /dev/null
+++ b/res/anim/footer_appear.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<translate xmlns:android="http://schemas.android.com/apk/res/android"
+    android:fromYDelta="+10%p"
+    android:toYDelta="0"
+    android:duration="300" />
\ No newline at end of file
diff --git a/res/anim/search_bar_enter.xml b/res/anim/search_bar_enter.xml
index f0ee241..19bbbba 100644
--- a/res/anim/search_bar_enter.xml
+++ b/res/anim/search_bar_enter.xml
@@ -19,8 +19,6 @@
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:interpolator="@android:anim/decelerate_interpolator">
-	<translate android:fromYDelta="-32" android:toYDelta="0"
-            android:duration="@android:integer/config_shortAnimTime"/>
 	<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
             android:duration="@android:integer/config_shortAnimTime" />
 </set>
diff --git a/res/color-finger/dialer_button_text.xml b/res/color/dialer_button_text.xml
similarity index 100%
rename from res/color-finger/dialer_button_text.xml
rename to res/color/dialer_button_text.xml
diff --git a/res/color-finger/kind_title.xml b/res/color/kind_title.xml
similarity index 100%
rename from res/color-finger/kind_title.xml
rename to res/color/kind_title.xml
diff --git a/res/color-finger/tab_indicator_text.xml b/res/color/tab_indicator_text.xml
similarity index 100%
rename from res/color-finger/tab_indicator_text.xml
rename to res/color/tab_indicator_text.xml
diff --git a/res/drawable-finger/btn_dial_textfield.xml b/res/drawable-finger/btn_dial_textfield.xml
deleted file mode 100644
index 109f6ae..0000000
--- a/res/drawable-finger/btn_dial_textfield.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_pressed="true"
-        android:drawable="@drawable/btn_dial_textfield_pressed" />
-    <item android:state_focused="true"
-        android:drawable="@drawable/btn_dial_textfield_normal" />
-    <item
-        android:drawable="@drawable/btn_dial_textfield_normal" />
-</selector>
-
diff --git a/res/drawable-finger/btn_dial_textfield_active.xml b/res/drawable-finger/btn_dial_textfield_active.xml
deleted file mode 100644
index 246d543..0000000
--- a/res/drawable-finger/btn_dial_textfield_active.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_pressed="true"
-        android:drawable="@drawable/btn_dial_textfield_pressed" />
-    <item android:state_focused="true"
-        android:drawable="@drawable/btn_dial_textfield_activated" />
-    <item
-        android:drawable="@drawable/btn_dial_textfield_activated" />
-</selector>
-
diff --git a/res/drawable-hdpi-finger/btn_dial_action_middle_disable.9.png b/res/drawable-hdpi-finger/btn_dial_action_middle_disable.9.png
deleted file mode 100644
index bce33fd..0000000
--- a/res/drawable-hdpi-finger/btn_dial_action_middle_disable.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_right_disable.9.png b/res/drawable-hdpi-finger/btn_dial_action_right_disable.9.png
deleted file mode 100644
index e2b1372..0000000
--- a/res/drawable-hdpi-finger/btn_dial_action_right_disable.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_textfield_normal.9.png b/res/drawable-hdpi-finger/btn_dial_textfield_normal.9.png
deleted file mode 100644
index adacb44..0000000
--- a/res/drawable-hdpi-finger/btn_dial_textfield_normal.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_0_wht.png b/res/drawable-hdpi-finger/dial_num_0_wht.png
deleted file mode 100644
index 98dfecd..0000000
--- a/res/drawable-hdpi-finger/dial_num_0_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_1_no_vm_wht.png b/res/drawable-hdpi-finger/dial_num_1_no_vm_wht.png
deleted file mode 100644
index 8f65ee1..0000000
--- a/res/drawable-hdpi-finger/dial_num_1_no_vm_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_2_wht.png b/res/drawable-hdpi-finger/dial_num_2_wht.png
deleted file mode 100644
index a7c8993..0000000
--- a/res/drawable-hdpi-finger/dial_num_2_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_3_wht.png b/res/drawable-hdpi-finger/dial_num_3_wht.png
deleted file mode 100644
index d8276c0..0000000
--- a/res/drawable-hdpi-finger/dial_num_3_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_4_wht.png b/res/drawable-hdpi-finger/dial_num_4_wht.png
deleted file mode 100644
index 7de2623..0000000
--- a/res/drawable-hdpi-finger/dial_num_4_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_5_wht.png b/res/drawable-hdpi-finger/dial_num_5_wht.png
deleted file mode 100644
index e1cb279..0000000
--- a/res/drawable-hdpi-finger/dial_num_5_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_6_wht.png b/res/drawable-hdpi-finger/dial_num_6_wht.png
deleted file mode 100644
index 5b33e2f..0000000
--- a/res/drawable-hdpi-finger/dial_num_6_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_7_wht.png b/res/drawable-hdpi-finger/dial_num_7_wht.png
deleted file mode 100644
index 5136e67..0000000
--- a/res/drawable-hdpi-finger/dial_num_7_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_8_wht.png b/res/drawable-hdpi-finger/dial_num_8_wht.png
deleted file mode 100644
index 3386866..0000000
--- a/res/drawable-hdpi-finger/dial_num_8_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_9_wht.png b/res/drawable-hdpi-finger/dial_num_9_wht.png
deleted file mode 100644
index db78a47..0000000
--- a/res/drawable-hdpi-finger/dial_num_9_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_pound_wht.png b/res/drawable-hdpi-finger/dial_num_pound_wht.png
deleted file mode 100644
index b4793fd..0000000
--- a/res/drawable-hdpi-finger/dial_num_pound_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_star_wht.png b/res/drawable-hdpi-finger/dial_num_star_wht.png
deleted file mode 100644
index 612c4ee..0000000
--- a/res/drawable-hdpi-finger/dial_num_star_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_btn_round_less.png b/res/drawable-hdpi-finger/ic_btn_round_less.png
deleted file mode 100644
index 21a8eff..0000000
--- a/res/drawable-hdpi-finger/ic_btn_round_less.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_btn_round_minus.png b/res/drawable-hdpi-finger/ic_btn_round_minus.png
deleted file mode 100755
index 2cd610c..0000000
--- a/res/drawable-hdpi-finger/ic_btn_round_minus.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_btn_round_more.png b/res/drawable-hdpi-finger/ic_btn_round_more.png
deleted file mode 100755
index bf91bef..0000000
--- a/res/drawable-hdpi-finger/ic_btn_round_more.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_btn_round_plus.png b/res/drawable-hdpi-finger/ic_btn_round_plus.png
deleted file mode 100755
index a541efb..0000000
--- a/res/drawable-hdpi-finger/ic_btn_round_plus.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_menu_account_list.png b/res/drawable-hdpi-finger/ic_menu_account_list.png
deleted file mode 100755
index a69c642..0000000
--- a/res/drawable-hdpi-finger/ic_menu_account_list.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_menu_import_export.png b/res/drawable-hdpi-finger/ic_menu_import_export.png
deleted file mode 100644
index 4f1b608..0000000
--- a/res/drawable-hdpi-finger/ic_menu_import_export.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_menu_merge.png b/res/drawable-hdpi-finger/ic_menu_merge.png
deleted file mode 100644
index d3ed8cc..0000000
--- a/res/drawable-hdpi-finger/ic_menu_merge.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_menu_split.png b/res/drawable-hdpi-finger/ic_menu_split.png
deleted file mode 100644
index 33ef601..0000000
--- a/res/drawable-hdpi-finger/ic_menu_split.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/sym_action_map.png b/res/drawable-hdpi-finger/sym_action_map.png
deleted file mode 100755
index cf00c7b..0000000
--- a/res/drawable-hdpi-finger/sym_action_map.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/sym_action_organization.png b/res/drawable-hdpi-finger/sym_action_organization.png
deleted file mode 100755
index 9db8b44..0000000
--- a/res/drawable-hdpi-finger/sym_action_organization.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi-finger/sym_note.png b/res/drawable-hdpi-finger/sym_note.png
deleted file mode 100755
index 5257329..0000000
--- a/res/drawable-hdpi-finger/sym_note.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/aggregation_suggestions_bg.9.png b/res/drawable-hdpi/aggregation_suggestions_bg.9.png
new file mode 100644
index 0000000..687cc08
--- /dev/null
+++ b/res/drawable-hdpi/aggregation_suggestions_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi/aggregation_suggestions_bg_light_holo.9.png b/res/drawable-hdpi/aggregation_suggestions_bg_light_holo.9.png
new file mode 100644
index 0000000..da1fe94
--- /dev/null
+++ b/res/drawable-hdpi/aggregation_suggestions_bg_light_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/aizy_knob.png b/res/drawable-hdpi/aizy_knob.png
new file mode 100644
index 0000000..6940a94
--- /dev/null
+++ b/res/drawable-hdpi/aizy_knob.png
Binary files differ
diff --git a/res/drawable-hdpi/aizy_label.9.png b/res/drawable-hdpi/aizy_label.9.png
new file mode 100644
index 0000000..1599037
--- /dev/null
+++ b/res/drawable-hdpi/aizy_label.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_1.9.png b/res/drawable-hdpi/appointment_indicator_leftside_1.9.png
new file mode 100644
index 0000000..b72652b
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_1.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_10.9.png b/res/drawable-hdpi/appointment_indicator_leftside_10.9.png
new file mode 100644
index 0000000..ff09049
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_10.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_11.9.png b/res/drawable-hdpi/appointment_indicator_leftside_11.9.png
new file mode 100644
index 0000000..6a2e4f2
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_11.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_12.9.png b/res/drawable-hdpi/appointment_indicator_leftside_12.9.png
new file mode 100644
index 0000000..0f19c83
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_12.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_13.9.png b/res/drawable-hdpi/appointment_indicator_leftside_13.9.png
new file mode 100644
index 0000000..7501e35
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_13.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_14.9.png b/res/drawable-hdpi/appointment_indicator_leftside_14.9.png
new file mode 100644
index 0000000..53f97a6
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_14.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_15.9.png b/res/drawable-hdpi/appointment_indicator_leftside_15.9.png
new file mode 100644
index 0000000..846f6f8
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_15.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_16.9.png b/res/drawable-hdpi/appointment_indicator_leftside_16.9.png
new file mode 100644
index 0000000..1707540
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_16.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_17.9.png b/res/drawable-hdpi/appointment_indicator_leftside_17.9.png
new file mode 100644
index 0000000..7fd945d
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_17.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_18.9.png b/res/drawable-hdpi/appointment_indicator_leftside_18.9.png
new file mode 100644
index 0000000..8cf47ae
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_18.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_19.9.png b/res/drawable-hdpi/appointment_indicator_leftside_19.9.png
new file mode 100644
index 0000000..6831c01
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_19.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_2.9.png b/res/drawable-hdpi/appointment_indicator_leftside_2.9.png
new file mode 100644
index 0000000..b4cee11
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_2.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_20.9.png b/res/drawable-hdpi/appointment_indicator_leftside_20.9.png
new file mode 100644
index 0000000..d07d826
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_20.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_21.9.png b/res/drawable-hdpi/appointment_indicator_leftside_21.9.png
new file mode 100644
index 0000000..f410269
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_21.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_3.9.png b/res/drawable-hdpi/appointment_indicator_leftside_3.9.png
new file mode 100644
index 0000000..69bd6a9
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_3.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_4.9.png b/res/drawable-hdpi/appointment_indicator_leftside_4.9.png
new file mode 100644
index 0000000..d09ea90
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_4.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_5.9.png b/res/drawable-hdpi/appointment_indicator_leftside_5.9.png
new file mode 100644
index 0000000..d27fc91
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_5.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_6.9.png b/res/drawable-hdpi/appointment_indicator_leftside_6.9.png
new file mode 100644
index 0000000..c014633
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_6.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_7.9.png b/res/drawable-hdpi/appointment_indicator_leftside_7.9.png
new file mode 100644
index 0000000..febb514
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_7.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_8.9.png b/res/drawable-hdpi/appointment_indicator_leftside_8.9.png
new file mode 100644
index 0000000..1415e44
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_8.9.png
Binary files differ
diff --git a/res/drawable-hdpi/appointment_indicator_leftside_9.9.png b/res/drawable-hdpi/appointment_indicator_leftside_9.9.png
new file mode 100644
index 0000000..d018fcf
--- /dev/null
+++ b/res/drawable-hdpi/appointment_indicator_leftside_9.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/badge_action_call.png b/res/drawable-hdpi/badge_action_call.png
similarity index 100%
rename from res/drawable-hdpi-finger/badge_action_call.png
rename to res/drawable-hdpi/badge_action_call.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/badge_action_sms.png b/res/drawable-hdpi/badge_action_sms.png
similarity index 100%
rename from res/drawable-hdpi-finger/badge_action_sms.png
rename to res/drawable-hdpi/badge_action_sms.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/bg_blk_search_contact.9.png b/res/drawable-hdpi/bg_blk_search_contact.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/bg_blk_search_contact.9.png
rename to res/drawable-hdpi/bg_blk_search_contact.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_circle_disable.png b/res/drawable-hdpi/btn_circle_disable.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_circle_disable.png
rename to res/drawable-hdpi/btn_circle_disable.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_circle_disable_focused.png b/res/drawable-hdpi/btn_circle_disable_focused.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_circle_disable_focused.png
rename to res/drawable-hdpi/btn_circle_disable_focused.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_circle_normal.png b/res/drawable-hdpi/btn_circle_normal.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_circle_normal.png
rename to res/drawable-hdpi/btn_circle_normal.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_circle_pressed.png b/res/drawable-hdpi/btn_circle_pressed.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_circle_pressed.png
rename to res/drawable-hdpi/btn_circle_pressed.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_circle_selected.png b/res/drawable-hdpi/btn_circle_selected.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_circle_selected.png
rename to res/drawable-hdpi/btn_circle_selected.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_left_disable.9.png b/res/drawable-hdpi/btn_dial_action_left_disable.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_left_disable.9.png
rename to res/drawable-hdpi/btn_dial_action_left_disable.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_left_disable_focused.9.png b/res/drawable-hdpi/btn_dial_action_left_disable_focused.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_left_disable_focused.9.png
rename to res/drawable-hdpi/btn_dial_action_left_disable_focused.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_left_normal.9.png b/res/drawable-hdpi/btn_dial_action_left_normal.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_left_normal.9.png
rename to res/drawable-hdpi/btn_dial_action_left_normal.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_left_pressed.9.png b/res/drawable-hdpi/btn_dial_action_left_pressed.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_left_pressed.9.png
rename to res/drawable-hdpi/btn_dial_action_left_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_left_selected.9.png b/res/drawable-hdpi/btn_dial_action_left_selected.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_left_selected.9.png
rename to res/drawable-hdpi/btn_dial_action_left_selected.9.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_dial_action_middle_disable.9.png b/res/drawable-hdpi/btn_dial_action_middle_disable.9.png
new file mode 100644
index 0000000..5159c74
--- /dev/null
+++ b/res/drawable-hdpi/btn_dial_action_middle_disable.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_middle_disable_focused.9.png b/res/drawable-hdpi/btn_dial_action_middle_disable_focused.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_middle_disable_focused.9.png
rename to res/drawable-hdpi/btn_dial_action_middle_disable_focused.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_middle_normal.9.png b/res/drawable-hdpi/btn_dial_action_middle_normal.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_middle_normal.9.png
rename to res/drawable-hdpi/btn_dial_action_middle_normal.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_middle_pressed.9.png b/res/drawable-hdpi/btn_dial_action_middle_pressed.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_middle_pressed.9.png
rename to res/drawable-hdpi/btn_dial_action_middle_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_middle_selected.9.png b/res/drawable-hdpi/btn_dial_action_middle_selected.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_middle_selected.9.png
rename to res/drawable-hdpi/btn_dial_action_middle_selected.9.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_dial_action_right_disable.9.png b/res/drawable-hdpi/btn_dial_action_right_disable.9.png
new file mode 100644
index 0000000..4844ee2
--- /dev/null
+++ b/res/drawable-hdpi/btn_dial_action_right_disable.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_right_disable_focused.9.png b/res/drawable-hdpi/btn_dial_action_right_disable_focused.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_right_disable_focused.9.png
rename to res/drawable-hdpi/btn_dial_action_right_disable_focused.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_right_normal.9.png b/res/drawable-hdpi/btn_dial_action_right_normal.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_right_normal.9.png
rename to res/drawable-hdpi/btn_dial_action_right_normal.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_right_pressed.9.png b/res/drawable-hdpi/btn_dial_action_right_pressed.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_right_pressed.9.png
rename to res/drawable-hdpi/btn_dial_action_right_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_action_right_selected.9.png b/res/drawable-hdpi/btn_dial_action_right_selected.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_action_right_selected.9.png
rename to res/drawable-hdpi/btn_dial_action_right_selected.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_normal.9.png b/res/drawable-hdpi/btn_dial_normal.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_normal.9.png
rename to res/drawable-hdpi/btn_dial_normal.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_pressed.9.png b/res/drawable-hdpi/btn_dial_pressed.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_pressed.9.png
rename to res/drawable-hdpi/btn_dial_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_selected.9.png b/res/drawable-hdpi/btn_dial_selected.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_selected.9.png
rename to res/drawable-hdpi/btn_dial_selected.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_textfield_activated.9.png b/res/drawable-hdpi/btn_dial_textfield_activated.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_textfield_activated.9.png
rename to res/drawable-hdpi/btn_dial_textfield_activated.9.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_dial_textfield_normal.9.png b/res/drawable-hdpi/btn_dial_textfield_normal.9.png
new file mode 100644
index 0000000..1718372
--- /dev/null
+++ b/res/drawable-hdpi/btn_dial_textfield_normal.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_textfield_pressed.9.png b/res/drawable-hdpi/btn_dial_textfield_pressed.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_textfield_pressed.9.png
rename to res/drawable-hdpi/btn_dial_textfield_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_dial_textfield_selected.9.png b/res/drawable-hdpi/btn_dial_textfield_selected.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_dial_textfield_selected.9.png
rename to res/drawable-hdpi/btn_dial_textfield_selected.9.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_minus_disabled.png b/res/drawable-hdpi/btn_minus_disabled.png
new file mode 100644
index 0000000..f58c35d
--- /dev/null
+++ b/res/drawable-hdpi/btn_minus_disabled.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_minus_disabled_focused.png b/res/drawable-hdpi/btn_minus_disabled_focused.png
new file mode 100644
index 0000000..0c0d117
--- /dev/null
+++ b/res/drawable-hdpi/btn_minus_disabled_focused.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_minus_focused.png b/res/drawable-hdpi/btn_minus_focused.png
new file mode 100644
index 0000000..9c41031
--- /dev/null
+++ b/res/drawable-hdpi/btn_minus_focused.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_minus_normal.png b/res/drawable-hdpi/btn_minus_normal.png
new file mode 100644
index 0000000..cc92b82
--- /dev/null
+++ b/res/drawable-hdpi/btn_minus_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_minus_pressed.png b/res/drawable-hdpi/btn_minus_pressed.png
new file mode 100644
index 0000000..63219f9
--- /dev/null
+++ b/res/drawable-hdpi/btn_minus_pressed.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_plus_disabled.png b/res/drawable-hdpi/btn_plus_disabled.png
new file mode 100644
index 0000000..5c659e4
--- /dev/null
+++ b/res/drawable-hdpi/btn_plus_disabled.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_plus_disabled_focused.png b/res/drawable-hdpi/btn_plus_disabled_focused.png
new file mode 100644
index 0000000..b2defec
--- /dev/null
+++ b/res/drawable-hdpi/btn_plus_disabled_focused.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_plus_focused.png b/res/drawable-hdpi/btn_plus_focused.png
new file mode 100644
index 0000000..01710dd
--- /dev/null
+++ b/res/drawable-hdpi/btn_plus_focused.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_plus_normal.png b/res/drawable-hdpi/btn_plus_normal.png
new file mode 100644
index 0000000..de34ba8
--- /dev/null
+++ b/res/drawable-hdpi/btn_plus_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/btn_plus_pressed.png b/res/drawable-hdpi/btn_plus_pressed.png
new file mode 100644
index 0000000..a8bc7c5
--- /dev/null
+++ b/res/drawable-hdpi/btn_plus_pressed.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_search_dialog_default.9.png b/res/drawable-hdpi/btn_search_dialog_default.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_search_dialog_default.9.png
rename to res/drawable-hdpi/btn_search_dialog_default.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_search_dialog_pressed.9.png b/res/drawable-hdpi/btn_search_dialog_pressed.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_search_dialog_pressed.9.png
rename to res/drawable-hdpi/btn_search_dialog_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/btn_search_dialog_selected.9.png b/res/drawable-hdpi/btn_search_dialog_selected.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/btn_search_dialog_selected.9.png
rename to res/drawable-hdpi/btn_search_dialog_selected.9.png
Binary files differ
diff --git a/res/drawable-hdpi/cab_divider_holo_light.png b/res/drawable-hdpi/cab_divider_holo_light.png
new file mode 100644
index 0000000..ecaa019
--- /dev/null
+++ b/res/drawable-hdpi/cab_divider_holo_light.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/contact_picture_border_highlight.9.png b/res/drawable-hdpi/contact_picture_border_highlight.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/contact_picture_border_highlight.9.png
rename to res/drawable-hdpi/contact_picture_border_highlight.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/contact_picture_border_normal.9.png b/res/drawable-hdpi/contact_picture_border_normal.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/contact_picture_border_normal.9.png
rename to res/drawable-hdpi/contact_picture_border_normal.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/contact_picture_border_pressed.9.png b/res/drawable-hdpi/contact_picture_border_pressed.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/contact_picture_border_pressed.9.png
rename to res/drawable-hdpi/contact_picture_border_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi/contact_view_bg.9.png b/res/drawable-hdpi/contact_view_bg.9.png
new file mode 100644
index 0000000..4e5f824
--- /dev/null
+++ b/res/drawable-hdpi/contact_view_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_0_blk.png b/res/drawable-hdpi/dial_num_0_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_0_blk.png
rename to res/drawable-hdpi/dial_num_0_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_0_blk.png b/res/drawable-hdpi/dial_num_0_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_0_blk.png
copy to res/drawable-hdpi/dial_num_0_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_1_no_vm_blk.png b/res/drawable-hdpi/dial_num_1_no_vm_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_1_no_vm_blk.png
rename to res/drawable-hdpi/dial_num_1_no_vm_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_1_no_vm_blk.png b/res/drawable-hdpi/dial_num_1_no_vm_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_1_no_vm_blk.png
copy to res/drawable-hdpi/dial_num_1_no_vm_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_2_blk.png b/res/drawable-hdpi/dial_num_2_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_2_blk.png
rename to res/drawable-hdpi/dial_num_2_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_2_blk.png b/res/drawable-hdpi/dial_num_2_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_2_blk.png
copy to res/drawable-hdpi/dial_num_2_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_3_blk.png b/res/drawable-hdpi/dial_num_3_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_3_blk.png
rename to res/drawable-hdpi/dial_num_3_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_3_blk.png b/res/drawable-hdpi/dial_num_3_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_3_blk.png
copy to res/drawable-hdpi/dial_num_3_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_4_blk.png b/res/drawable-hdpi/dial_num_4_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_4_blk.png
rename to res/drawable-hdpi/dial_num_4_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_4_blk.png b/res/drawable-hdpi/dial_num_4_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_4_blk.png
copy to res/drawable-hdpi/dial_num_4_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_5_blk.png b/res/drawable-hdpi/dial_num_5_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_5_blk.png
rename to res/drawable-hdpi/dial_num_5_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_5_blk.png b/res/drawable-hdpi/dial_num_5_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_5_blk.png
copy to res/drawable-hdpi/dial_num_5_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_6_blk.png b/res/drawable-hdpi/dial_num_6_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_6_blk.png
rename to res/drawable-hdpi/dial_num_6_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_6_blk.png b/res/drawable-hdpi/dial_num_6_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_6_blk.png
copy to res/drawable-hdpi/dial_num_6_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_7_blk.png b/res/drawable-hdpi/dial_num_7_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_7_blk.png
rename to res/drawable-hdpi/dial_num_7_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_7_blk.png b/res/drawable-hdpi/dial_num_7_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_7_blk.png
copy to res/drawable-hdpi/dial_num_7_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_8_blk.png b/res/drawable-hdpi/dial_num_8_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_8_blk.png
rename to res/drawable-hdpi/dial_num_8_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_8_blk.png b/res/drawable-hdpi/dial_num_8_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_8_blk.png
copy to res/drawable-hdpi/dial_num_8_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_9_blk.png b/res/drawable-hdpi/dial_num_9_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_9_blk.png
rename to res/drawable-hdpi/dial_num_9_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_9_blk.png b/res/drawable-hdpi/dial_num_9_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_9_blk.png
copy to res/drawable-hdpi/dial_num_9_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_pound_blk.png b/res/drawable-hdpi/dial_num_pound_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_pound_blk.png
rename to res/drawable-hdpi/dial_num_pound_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_pound_blk.png b/res/drawable-hdpi/dial_num_pound_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_pound_blk.png
copy to res/drawable-hdpi/dial_num_pound_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_star_blk.png b/res/drawable-hdpi/dial_num_star_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/dial_num_star_blk.png
rename to res/drawable-hdpi/dial_num_star_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/dial_num_star_blk.png b/res/drawable-hdpi/dial_num_star_wht.png
similarity index 100%
copy from res/drawable-hdpi-finger/dial_num_star_blk.png
copy to res/drawable-hdpi/dial_num_star_wht.png
Binary files differ
diff --git a/res/drawable-hdpi/directory_bg.9.png b/res/drawable-hdpi/directory_bg.9.png
new file mode 100644
index 0000000..f0a92d4
--- /dev/null
+++ b/res/drawable-hdpi/directory_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi/directory_bg_holo.9.png b/res/drawable-hdpi/directory_bg_holo.9.png
new file mode 100644
index 0000000..7f7209d
--- /dev/null
+++ b/res/drawable-hdpi/directory_bg_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/divider_vertical_dark.9.png b/res/drawable-hdpi/divider_vertical_dark.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/divider_vertical_dark.9.png
rename to res/drawable-hdpi/divider_vertical_dark.9.png
Binary files differ
diff --git a/res/drawable-hdpi/edit_rawcontact_bg.png b/res/drawable-hdpi/edit_rawcontact_bg.png
new file mode 100644
index 0000000..84bd50b
--- /dev/null
+++ b/res/drawable-hdpi/edit_rawcontact_bg.png
Binary files differ
diff --git a/res/drawable-hdpi/edit_rawcontact_bottom.png b/res/drawable-hdpi/edit_rawcontact_bottom.png
new file mode 100644
index 0000000..58ae4b2
--- /dev/null
+++ b/res/drawable-hdpi/edit_rawcontact_bottom.png
Binary files differ
diff --git a/res/drawable-hdpi/edit_rawcontact_top.png b/res/drawable-hdpi/edit_rawcontact_top.png
new file mode 100644
index 0000000..6ca737d
--- /dev/null
+++ b/res/drawable-hdpi/edit_rawcontact_top.png
Binary files differ
diff --git a/res/drawable-hdpi/filter_selector_corner.png b/res/drawable-hdpi/filter_selector_corner.png
new file mode 100644
index 0000000..964dd75
--- /dev/null
+++ b/res/drawable-hdpi/filter_selector_corner.png
Binary files differ
diff --git a/res/drawable-hdpi/group_membership_edit_background.9.png b/res/drawable-hdpi/group_membership_edit_background.9.png
new file mode 100644
index 0000000..1292ebf
--- /dev/null
+++ b/res/drawable-hdpi/group_membership_edit_background.9.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_aggregated.png b/res/drawable-hdpi/ic_aggregated.png
new file mode 100644
index 0000000..7ca15b1
--- /dev/null
+++ b/res/drawable-hdpi/ic_aggregated.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_btn_round_less.png b/res/drawable-hdpi/ic_btn_round_less.png
new file mode 100644
index 0000000..819440e
--- /dev/null
+++ b/res/drawable-hdpi/ic_btn_round_less.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_btn_round_more.png b/res/drawable-hdpi/ic_btn_round_more.png
new file mode 100755
index 0000000..9883d55
--- /dev/null
+++ b/res/drawable-hdpi/ic_btn_round_more.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_call_log_header_incoming_call.png b/res/drawable-hdpi/ic_call_log_header_incoming_call.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_call_log_header_incoming_call.png
rename to res/drawable-hdpi/ic_call_log_header_incoming_call.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_call_log_header_missed_call.png b/res/drawable-hdpi/ic_call_log_header_missed_call.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_call_log_header_missed_call.png
rename to res/drawable-hdpi/ic_call_log_header_missed_call.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_call_log_header_outgoing_call.png b/res/drawable-hdpi/ic_call_log_header_outgoing_call.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_call_log_header_outgoing_call.png
rename to res/drawable-hdpi/ic_call_log_header_outgoing_call.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_call_log_list_incoming_call.png b/res/drawable-hdpi/ic_call_log_list_incoming_call.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_call_log_list_incoming_call.png
rename to res/drawable-hdpi/ic_call_log_list_incoming_call.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_call_log_list_missed_call.png b/res/drawable-hdpi/ic_call_log_list_missed_call.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_call_log_list_missed_call.png
rename to res/drawable-hdpi/ic_call_log_list_missed_call.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_call_log_list_outgoing_call.png b/res/drawable-hdpi/ic_call_log_list_outgoing_call.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_call_log_list_outgoing_call.png
rename to res/drawable-hdpi/ic_call_log_list_outgoing_call.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_contact_list_filter_all.png b/res/drawable-hdpi/ic_contact_list_filter_all.png
new file mode 100644
index 0000000..67981a9
--- /dev/null
+++ b/res/drawable-hdpi/ic_contact_list_filter_all.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_contact_list_filter_custom.png b/res/drawable-hdpi/ic_contact_list_filter_custom.png
new file mode 100644
index 0000000..3f48be3
--- /dev/null
+++ b/res/drawable-hdpi/ic_contact_list_filter_custom.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_contact_list_filter_starred.png b/res/drawable-hdpi/ic_contact_list_filter_starred.png
new file mode 100644
index 0000000..4213050
--- /dev/null
+++ b/res/drawable-hdpi/ic_contact_list_filter_starred.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_contact_list_picture.png b/res/drawable-hdpi/ic_contact_list_picture.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_contact_list_picture.png
rename to res/drawable-hdpi/ic_contact_list_picture.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_contact_picture.png b/res/drawable-hdpi/ic_contact_picture.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_contact_picture.png
rename to res/drawable-hdpi/ic_contact_picture.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_contact_picture_2.png b/res/drawable-hdpi/ic_contact_picture_2.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_contact_picture_2.png
rename to res/drawable-hdpi/ic_contact_picture_2.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_contact_picture_3.png b/res/drawable-hdpi/ic_contact_picture_3.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_contact_picture_3.png
rename to res/drawable-hdpi/ic_contact_picture_3.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_default_number.png b/res/drawable-hdpi/ic_default_number.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_default_number.png
rename to res/drawable-hdpi/ic_default_number.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_dial_action_call.png b/res/drawable-hdpi/ic_dial_action_call.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_dial_action_call.png
rename to res/drawable-hdpi/ic_dial_action_call.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_dial_action_delete.png b/res/drawable-hdpi/ic_dial_action_delete.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_dial_action_delete.png
rename to res/drawable-hdpi/ic_dial_action_delete.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_dial_action_voice_mail.png b/res/drawable-hdpi/ic_dial_action_voice_mail.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_dial_action_voice_mail.png
rename to res/drawable-hdpi/ic_dial_action_voice_mail.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_dial_number_blk.png b/res/drawable-hdpi/ic_dial_number_blk.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_dial_number_blk.png
rename to res/drawable-hdpi/ic_dial_number_blk.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_dial_number_wht.png b/res/drawable-hdpi/ic_dial_number_wht.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_dial_number_wht.png
rename to res/drawable-hdpi/ic_dial_number_wht.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_dialer_fork_add_call.png b/res/drawable-hdpi/ic_dialer_fork_add_call.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_dialer_fork_add_call.png
rename to res/drawable-hdpi/ic_dialer_fork_add_call.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_dialer_fork_current_call.png b/res/drawable-hdpi/ic_dialer_fork_current_call.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_dialer_fork_current_call.png
rename to res/drawable-hdpi/ic_dialer_fork_current_call.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_dialer_fork_tt_keypad.png b/res/drawable-hdpi/ic_dialer_fork_tt_keypad.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_dialer_fork_tt_keypad.png
rename to res/drawable-hdpi/ic_dialer_fork_tt_keypad.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_join.png b/res/drawable-hdpi/ic_join.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_join.png
rename to res/drawable-hdpi/ic_join.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher_phone.png b/res/drawable-hdpi/ic_launcher_phone.png
index 7739546..0943ce5 100644
--- a/res/drawable-hdpi/ic_launcher_phone.png
+++ b/res/drawable-hdpi/ic_launcher_phone.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_2sec_pause.png b/res/drawable-hdpi/ic_menu_2sec_pause.png
new file mode 100644
index 0000000..3951948
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_2sec_pause.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_accounts_normal_holo.png b/res/drawable-hdpi/ic_menu_accounts_normal_holo.png
new file mode 100644
index 0000000..682b0fc
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_accounts_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_accounts_pressed_holo.png b/res/drawable-hdpi/ic_menu_accounts_pressed_holo.png
new file mode 100644
index 0000000..2047a14
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_accounts_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_add_contact_normal_holo.png b/res/drawable-hdpi/ic_menu_add_contact_normal_holo.png
new file mode 100644
index 0000000..d548ade
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_add_contact_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_add_contact_pressed_holo.png b/res/drawable-hdpi/ic_menu_add_contact_pressed_holo.png
new file mode 100644
index 0000000..1c1f737
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_add_contact_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_menu_add_picture.png b/res/drawable-hdpi/ic_menu_add_picture.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_menu_add_picture.png
rename to res/drawable-hdpi/ic_menu_add_picture.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_cancel_normal_holo.png b/res/drawable-hdpi/ic_menu_cancel_normal_holo.png
new file mode 100644
index 0000000..5f68c62
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_cancel_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_cancel_pressed_holo.png b/res/drawable-hdpi/ic_menu_cancel_pressed_holo.png
new file mode 100644
index 0000000..917a19d
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_cancel_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_compose_normal_holo.png b/res/drawable-hdpi/ic_menu_compose_normal_holo.png
new file mode 100644
index 0000000..ff8f862
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_compose_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_compose_pressed_holo.png b/res/drawable-hdpi/ic_menu_compose_pressed_holo.png
new file mode 100644
index 0000000..c045226
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_compose_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_display_all.png b/res/drawable-hdpi/ic_menu_display_all.png
new file mode 100755
index 0000000..563083c
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_display_all.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_display_selected.png b/res/drawable-hdpi/ic_menu_display_selected.png
new file mode 100644
index 0000000..76b2e22
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_display_selected.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_done_normal_holo.png b/res/drawable-hdpi/ic_menu_done_normal_holo.png
new file mode 100644
index 0000000..39ad5b9
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_done_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_done_pressed_holo.png b/res/drawable-hdpi/ic_menu_done_pressed_holo.png
new file mode 100644
index 0000000..c7e1338
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_done_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_import_export_normal_holo.png b/res/drawable-hdpi/ic_menu_import_export_normal_holo.png
new file mode 100644
index 0000000..2602e5f
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_import_export_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_import_export_pressed_holo.png b/res/drawable-hdpi/ic_menu_import_export_pressed_holo.png
new file mode 100644
index 0000000..c4d5e3b
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_import_export_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_merge_normal_holo.png b/res/drawable-hdpi/ic_menu_merge_normal_holo.png
new file mode 100644
index 0000000..4e6ff36
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_merge_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_merge_pressed_holo.png b/res/drawable-hdpi/ic_menu_merge_pressed_holo.png
new file mode 100644
index 0000000..583e7ec
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_merge_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_select.png b/res/drawable-hdpi/ic_menu_select.png
new file mode 100644
index 0000000..c5bb503
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_select.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_settings_normal_holo.png b/res/drawable-hdpi/ic_menu_settings_normal_holo.png
new file mode 100644
index 0000000..30cb132
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_settings_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_settings_pressed_holo.png b/res/drawable-hdpi/ic_menu_settings_pressed_holo.png
new file mode 100644
index 0000000..03ea60b
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_settings_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_share_normal_holo.png b/res/drawable-hdpi/ic_menu_share_normal_holo.png
new file mode 100644
index 0000000..d18adaf
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_share_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_share_pressed_holo.png b/res/drawable-hdpi/ic_menu_share_pressed_holo.png
new file mode 100644
index 0000000..aee9001
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_share_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_split_normal_holo.png b/res/drawable-hdpi/ic_menu_split_normal_holo.png
new file mode 100644
index 0000000..29c8c38
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_split_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_split_pressed_holo.png b/res/drawable-hdpi/ic_menu_split_pressed_holo.png
new file mode 100644
index 0000000..ad5de95
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_split_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_trash_normal_holo.png b/res/drawable-hdpi/ic_menu_trash_normal_holo.png
new file mode 100644
index 0000000..6e601c8
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_trash_normal_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_trash_pressed_holo.png b/res/drawable-hdpi/ic_menu_trash_pressed_holo.png
new file mode 100644
index 0000000..9579c53
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_trash_pressed_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_unselect.png b/res/drawable-hdpi/ic_menu_unselect.png
new file mode 100644
index 0000000..178f314
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_unselect.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_wait.png b/res/drawable-hdpi/ic_menu_wait.png
new file mode 100644
index 0000000..6886e5d
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_wait.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_tab_selected_contacts.png b/res/drawable-hdpi/ic_tab_selected_contacts.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_tab_selected_contacts.png
rename to res/drawable-hdpi/ic_tab_selected_contacts.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_tab_selected_dialer.png b/res/drawable-hdpi/ic_tab_selected_dialer.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_tab_selected_dialer.png
rename to res/drawable-hdpi/ic_tab_selected_dialer.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_tab_selected_friends_list.png b/res/drawable-hdpi/ic_tab_selected_friends_list.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_tab_selected_friends_list.png
rename to res/drawable-hdpi/ic_tab_selected_friends_list.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_tab_selected_recent.png b/res/drawable-hdpi/ic_tab_selected_recent.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_tab_selected_recent.png
rename to res/drawable-hdpi/ic_tab_selected_recent.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_tab_selected_starred.png b/res/drawable-hdpi/ic_tab_selected_starred.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_tab_selected_starred.png
rename to res/drawable-hdpi/ic_tab_selected_starred.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_tab_unselected_contacts.png b/res/drawable-hdpi/ic_tab_unselected_contacts.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_tab_unselected_contacts.png
rename to res/drawable-hdpi/ic_tab_unselected_contacts.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_tab_unselected_dialer.png b/res/drawable-hdpi/ic_tab_unselected_dialer.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_tab_unselected_dialer.png
rename to res/drawable-hdpi/ic_tab_unselected_dialer.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_tab_unselected_friends_list.png b/res/drawable-hdpi/ic_tab_unselected_friends_list.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_tab_unselected_friends_list.png
rename to res/drawable-hdpi/ic_tab_unselected_friends_list.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_tab_unselected_recent.png b/res/drawable-hdpi/ic_tab_unselected_recent.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_tab_unselected_recent.png
rename to res/drawable-hdpi/ic_tab_unselected_recent.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/ic_tab_unselected_starred.png b/res/drawable-hdpi/ic_tab_unselected_starred.png
similarity index 100%
rename from res/drawable-hdpi-finger/ic_tab_unselected_starred.png
rename to res/drawable-hdpi/ic_tab_unselected_starred.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/infobar_dark.9.png b/res/drawable-hdpi/infobar_dark.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/infobar_dark.9.png
rename to res/drawable-hdpi/infobar_dark.9.png
Binary files differ
diff --git a/res/drawable-hdpi/list_item_activated_bg.9.png b/res/drawable-hdpi/list_item_activated_bg.9.png
new file mode 100644
index 0000000..dd82c22
--- /dev/null
+++ b/res/drawable-hdpi/list_item_activated_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi/list_item_divider.9.png b/res/drawable-hdpi/list_item_divider.9.png
new file mode 100644
index 0000000..60e2cb2
--- /dev/null
+++ b/res/drawable-hdpi/list_item_divider.9.png
Binary files differ
diff --git a/res/drawable-hdpi/list_item_divider_holo.9.png b/res/drawable-hdpi/list_item_divider_holo.9.png
new file mode 100644
index 0000000..f5130d5
--- /dev/null
+++ b/res/drawable-hdpi/list_item_divider_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/list_item_pressed_bg.9.png b/res/drawable-hdpi/list_item_pressed_bg.9.png
new file mode 100644
index 0000000..74d8e53
--- /dev/null
+++ b/res/drawable-hdpi/list_item_pressed_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_arrow_down.png b/res/drawable-hdpi/quickcontact_arrow_down.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_arrow_down.png
rename to res/drawable-hdpi/quickcontact_arrow_down.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_arrow_up.png b/res/drawable-hdpi/quickcontact_arrow_up.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_arrow_up.png
rename to res/drawable-hdpi/quickcontact_arrow_up.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_bottom_frame.9.png b/res/drawable-hdpi/quickcontact_bottom_frame.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_bottom_frame.9.png
rename to res/drawable-hdpi/quickcontact_bottom_frame.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_disambig_bottom_bg.9.png b/res/drawable-hdpi/quickcontact_disambig_bottom_bg.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_disambig_bottom_bg.9.png
rename to res/drawable-hdpi/quickcontact_disambig_bottom_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_disambig_checkbox_off.png b/res/drawable-hdpi/quickcontact_disambig_checkbox_off.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_disambig_checkbox_off.png
rename to res/drawable-hdpi/quickcontact_disambig_checkbox_off.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_disambig_checkbox_on.png b/res/drawable-hdpi/quickcontact_disambig_checkbox_on.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_disambig_checkbox_on.png
rename to res/drawable-hdpi/quickcontact_disambig_checkbox_on.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_disambig_divider.9.png b/res/drawable-hdpi/quickcontact_disambig_divider.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_disambig_divider.9.png
rename to res/drawable-hdpi/quickcontact_disambig_divider.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_drop_shadow.9.png b/res/drawable-hdpi/quickcontact_drop_shadow.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_drop_shadow.9.png
rename to res/drawable-hdpi/quickcontact_drop_shadow.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_photo_frame.9.png b/res/drawable-hdpi/quickcontact_photo_frame.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_photo_frame.9.png
rename to res/drawable-hdpi/quickcontact_photo_frame.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_background.png b/res/drawable-hdpi/quickcontact_slider_background.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_background.png
rename to res/drawable-hdpi/quickcontact_slider_background.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_btn_normal.9.png b/res/drawable-hdpi/quickcontact_slider_btn_normal.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_btn_normal.9.png
rename to res/drawable-hdpi/quickcontact_slider_btn_normal.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_btn_on.9.png b/res/drawable-hdpi/quickcontact_slider_btn_on.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_btn_on.9.png
rename to res/drawable-hdpi/quickcontact_slider_btn_on.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_btn_pressed.9.png b/res/drawable-hdpi/quickcontact_slider_btn_pressed.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_btn_pressed.9.png
rename to res/drawable-hdpi/quickcontact_slider_btn_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_btn_selected.9.png b/res/drawable-hdpi/quickcontact_slider_btn_selected.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_btn_selected.9.png
rename to res/drawable-hdpi/quickcontact_slider_btn_selected.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_grip_left.png b/res/drawable-hdpi/quickcontact_slider_grip_left.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_grip_left.png
rename to res/drawable-hdpi/quickcontact_slider_grip_left.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_grip_right.png b/res/drawable-hdpi/quickcontact_slider_grip_right.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_grip_right.png
rename to res/drawable-hdpi/quickcontact_slider_grip_right.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_presence_active.png b/res/drawable-hdpi/quickcontact_slider_presence_active.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_presence_active.png
rename to res/drawable-hdpi/quickcontact_slider_presence_active.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_presence_away.png b/res/drawable-hdpi/quickcontact_slider_presence_away.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_presence_away.png
rename to res/drawable-hdpi/quickcontact_slider_presence_away.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_presence_busy.png b/res/drawable-hdpi/quickcontact_slider_presence_busy.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_presence_busy.png
rename to res/drawable-hdpi/quickcontact_slider_presence_busy.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_slider_presence_inactive.png b/res/drawable-hdpi/quickcontact_slider_presence_inactive.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_slider_presence_inactive.png
rename to res/drawable-hdpi/quickcontact_slider_presence_inactive.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/quickcontact_top_frame.9.png b/res/drawable-hdpi/quickcontact_top_frame.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/quickcontact_top_frame.9.png
rename to res/drawable-hdpi/quickcontact_top_frame.9.png
Binary files differ
diff --git a/res/drawable-hdpi/section_header.9.png b/res/drawable-hdpi/section_header.9.png
new file mode 100644
index 0000000..8cd231b
--- /dev/null
+++ b/res/drawable-hdpi/section_header.9.png
Binary files differ
diff --git a/res/drawable-hdpi/section_header_holo.9.png b/res/drawable-hdpi/section_header_holo.9.png
new file mode 100644
index 0000000..de12d0e
--- /dev/null
+++ b/res/drawable-hdpi/section_header_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/social_bubble.9.png b/res/drawable-hdpi/social_bubble.9.png
new file mode 100644
index 0000000..8a28fd3
--- /dev/null
+++ b/res/drawable-hdpi/social_bubble.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/sym_action_add.png b/res/drawable-hdpi/sym_action_add.png
similarity index 100%
rename from res/drawable-hdpi-finger/sym_action_add.png
rename to res/drawable-hdpi/sym_action_add.png
Binary files differ
diff --git a/res/drawable-hdpi/sym_action_email.png b/res/drawable-hdpi/sym_action_email.png
new file mode 100644
index 0000000..edd7a7d
--- /dev/null
+++ b/res/drawable-hdpi/sym_action_email.png
Binary files differ
diff --git a/res/drawable-hdpi/sym_action_map.png b/res/drawable-hdpi/sym_action_map.png
new file mode 100644
index 0000000..8dd61dc
--- /dev/null
+++ b/res/drawable-hdpi/sym_action_map.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/sym_action_view_contact.png b/res/drawable-hdpi/sym_action_view_contact.png
similarity index 100%
rename from res/drawable-hdpi-finger/sym_action_view_contact.png
rename to res/drawable-hdpi/sym_action_view_contact.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/tab_focused.9.png b/res/drawable-hdpi/tab_focused.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/tab_focused.9.png
rename to res/drawable-hdpi/tab_focused.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/tab_focused_bottom.9.png b/res/drawable-hdpi/tab_focused_bottom.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/tab_focused_bottom.9.png
rename to res/drawable-hdpi/tab_focused_bottom.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/tab_left_arrow.png b/res/drawable-hdpi/tab_left_arrow.png
similarity index 100%
rename from res/drawable-hdpi-finger/tab_left_arrow.png
rename to res/drawable-hdpi/tab_left_arrow.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/tab_pressed.9.png b/res/drawable-hdpi/tab_pressed.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/tab_pressed.9.png
rename to res/drawable-hdpi/tab_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/tab_pressed_bottom.9.png b/res/drawable-hdpi/tab_pressed_bottom.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/tab_pressed_bottom.9.png
rename to res/drawable-hdpi/tab_pressed_bottom.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/tab_right_arrow.png b/res/drawable-hdpi/tab_right_arrow.png
similarity index 100%
rename from res/drawable-hdpi-finger/tab_right_arrow.png
rename to res/drawable-hdpi/tab_right_arrow.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/tab_selected.9.png b/res/drawable-hdpi/tab_selected.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/tab_selected.9.png
rename to res/drawable-hdpi/tab_selected.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/tab_selected_bottom.9.png b/res/drawable-hdpi/tab_selected_bottom.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/tab_selected_bottom.9.png
rename to res/drawable-hdpi/tab_selected_bottom.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/tab_unselected.9.png b/res/drawable-hdpi/tab_unselected.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/tab_unselected.9.png
rename to res/drawable-hdpi/tab_unselected.9.png
Binary files differ
diff --git a/res/drawable-hdpi/title_bar_medium.9.png b/res/drawable-hdpi/title_bar_medium.9.png
new file mode 100644
index 0000000..311a54a
--- /dev/null
+++ b/res/drawable-hdpi/title_bar_medium.9.png
Binary files differ
diff --git a/res/drawable-hdpi-finger/title_bar_shadow.9.png b/res/drawable-hdpi/title_bar_shadow.9.png
similarity index 100%
rename from res/drawable-hdpi-finger/title_bar_shadow.9.png
rename to res/drawable-hdpi/title_bar_shadow.9.png
Binary files differ
diff --git a/res/drawable-hdpi/type_selector_background.9.png b/res/drawable-hdpi/type_selector_background.9.png
new file mode 100644
index 0000000..f4e1753
--- /dev/null
+++ b/res/drawable-hdpi/type_selector_background.9.png
Binary files differ
diff --git a/res/drawable-hdpi/unknown_source.png b/res/drawable-hdpi/unknown_source.png
new file mode 100644
index 0000000..0a8f37d
--- /dev/null
+++ b/res/drawable-hdpi/unknown_source.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_left_disable.9.png b/res/drawable-mdpi-finger/btn_dial_action_left_disable.9.png
deleted file mode 100644
index ea6cd80..0000000
--- a/res/drawable-mdpi-finger/btn_dial_action_left_disable.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_middle_disable.9.png b/res/drawable-mdpi-finger/btn_dial_action_middle_disable.9.png
deleted file mode 100644
index 07c9e78..0000000
--- a/res/drawable-mdpi-finger/btn_dial_action_middle_disable.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_right_disable.9.png b/res/drawable-mdpi-finger/btn_dial_action_right_disable.9.png
deleted file mode 100644
index bca80bb..0000000
--- a/res/drawable-mdpi-finger/btn_dial_action_right_disable.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_textfield_normal.9.png b/res/drawable-mdpi-finger/btn_dial_textfield_normal.9.png
deleted file mode 100644
index 3def8c0..0000000
--- a/res/drawable-mdpi-finger/btn_dial_textfield_normal.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_0_wht.png b/res/drawable-mdpi-finger/dial_num_0_wht.png
deleted file mode 100644
index 44c38d2..0000000
--- a/res/drawable-mdpi-finger/dial_num_0_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_1_no_vm_wht.png b/res/drawable-mdpi-finger/dial_num_1_no_vm_wht.png
deleted file mode 100644
index 267bed5..0000000
--- a/res/drawable-mdpi-finger/dial_num_1_no_vm_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_2_wht.png b/res/drawable-mdpi-finger/dial_num_2_wht.png
deleted file mode 100644
index f1f27a3..0000000
--- a/res/drawable-mdpi-finger/dial_num_2_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_3_wht.png b/res/drawable-mdpi-finger/dial_num_3_wht.png
deleted file mode 100644
index b229202..0000000
--- a/res/drawable-mdpi-finger/dial_num_3_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_4_wht.png b/res/drawable-mdpi-finger/dial_num_4_wht.png
deleted file mode 100644
index 8c9af62..0000000
--- a/res/drawable-mdpi-finger/dial_num_4_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_5_wht.png b/res/drawable-mdpi-finger/dial_num_5_wht.png
deleted file mode 100644
index bac9b8f..0000000
--- a/res/drawable-mdpi-finger/dial_num_5_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_6_wht.png b/res/drawable-mdpi-finger/dial_num_6_wht.png
deleted file mode 100644
index c76a988..0000000
--- a/res/drawable-mdpi-finger/dial_num_6_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_7_wht.png b/res/drawable-mdpi-finger/dial_num_7_wht.png
deleted file mode 100644
index 4fe6992..0000000
--- a/res/drawable-mdpi-finger/dial_num_7_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_8_wht.png b/res/drawable-mdpi-finger/dial_num_8_wht.png
deleted file mode 100644
index 0481eb4..0000000
--- a/res/drawable-mdpi-finger/dial_num_8_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_9_wht.png b/res/drawable-mdpi-finger/dial_num_9_wht.png
deleted file mode 100644
index b54c6c2..0000000
--- a/res/drawable-mdpi-finger/dial_num_9_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_pound_wht.png b/res/drawable-mdpi-finger/dial_num_pound_wht.png
deleted file mode 100644
index 2186b31..0000000
--- a/res/drawable-mdpi-finger/dial_num_pound_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_star_wht.png b/res/drawable-mdpi-finger/dial_num_star_wht.png
deleted file mode 100644
index 3c75031..0000000
--- a/res/drawable-mdpi-finger/dial_num_star_wht.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_btn_round_less.png b/res/drawable-mdpi-finger/ic_btn_round_less.png
deleted file mode 100644
index 96fc42e..0000000
--- a/res/drawable-mdpi-finger/ic_btn_round_less.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_btn_round_minus.png b/res/drawable-mdpi-finger/ic_btn_round_minus.png
deleted file mode 100644
index 96dbb17..0000000
--- a/res/drawable-mdpi-finger/ic_btn_round_minus.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_btn_round_more.png b/res/drawable-mdpi-finger/ic_btn_round_more.png
deleted file mode 100644
index e3355cc..0000000
--- a/res/drawable-mdpi-finger/ic_btn_round_more.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_btn_round_plus.png b/res/drawable-mdpi-finger/ic_btn_round_plus.png
deleted file mode 100644
index 1ec8a95..0000000
--- a/res/drawable-mdpi-finger/ic_btn_round_plus.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_menu_account_list.png b/res/drawable-mdpi-finger/ic_menu_account_list.png
deleted file mode 100644
index f0945b2..0000000
--- a/res/drawable-mdpi-finger/ic_menu_account_list.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_menu_import_export.png b/res/drawable-mdpi-finger/ic_menu_import_export.png
deleted file mode 100644
index 1cefb7c..0000000
--- a/res/drawable-mdpi-finger/ic_menu_import_export.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_menu_merge.png b/res/drawable-mdpi-finger/ic_menu_merge.png
deleted file mode 100644
index b448c27..0000000
--- a/res/drawable-mdpi-finger/ic_menu_merge.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_menu_split.png b/res/drawable-mdpi-finger/ic_menu_split.png
deleted file mode 100644
index 9d69e4c..0000000
--- a/res/drawable-mdpi-finger/ic_menu_split.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/sym_action_map.png b/res/drawable-mdpi-finger/sym_action_map.png
deleted file mode 100644
index 12719cc..0000000
--- a/res/drawable-mdpi-finger/sym_action_map.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/sym_action_organization.png b/res/drawable-mdpi-finger/sym_action_organization.png
deleted file mode 100644
index 994d3f5..0000000
--- a/res/drawable-mdpi-finger/sym_action_organization.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-finger/sym_note.png b/res/drawable-mdpi-finger/sym_note.png
deleted file mode 100644
index e4dbdf5..0000000
--- a/res/drawable-mdpi-finger/sym_note.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/aggregation_suggestions_bg.9.png b/res/drawable-mdpi/aggregation_suggestions_bg.9.png
new file mode 100644
index 0000000..687cc08
--- /dev/null
+++ b/res/drawable-mdpi/aggregation_suggestions_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/aggregation_suggestions_bg_light_holo.9.png b/res/drawable-mdpi/aggregation_suggestions_bg_light_holo.9.png
new file mode 100644
index 0000000..03e24c6
--- /dev/null
+++ b/res/drawable-mdpi/aggregation_suggestions_bg_light_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/aizy_knob.png b/res/drawable-mdpi/aizy_knob.png
new file mode 100644
index 0000000..daa8242
--- /dev/null
+++ b/res/drawable-mdpi/aizy_knob.png
Binary files differ
diff --git a/res/drawable-mdpi/aizy_label.9.png b/res/drawable-mdpi/aizy_label.9.png
new file mode 100644
index 0000000..695b000
--- /dev/null
+++ b/res/drawable-mdpi/aizy_label.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_1.9.png b/res/drawable-mdpi/appointment_indicator_leftside_1.9.png
new file mode 100644
index 0000000..5e40235
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_1.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_10.9.png b/res/drawable-mdpi/appointment_indicator_leftside_10.9.png
new file mode 100644
index 0000000..d0cb144
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_10.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_11.9.png b/res/drawable-mdpi/appointment_indicator_leftside_11.9.png
new file mode 100644
index 0000000..034f496
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_11.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_12.9.png b/res/drawable-mdpi/appointment_indicator_leftside_12.9.png
new file mode 100644
index 0000000..6371b3a
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_12.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_13.9.png b/res/drawable-mdpi/appointment_indicator_leftside_13.9.png
new file mode 100644
index 0000000..a8b42c6
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_13.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_14.9.png b/res/drawable-mdpi/appointment_indicator_leftside_14.9.png
new file mode 100644
index 0000000..a69e519
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_14.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_15.9.png b/res/drawable-mdpi/appointment_indicator_leftside_15.9.png
new file mode 100644
index 0000000..5d68470
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_15.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_16.9.png b/res/drawable-mdpi/appointment_indicator_leftside_16.9.png
new file mode 100644
index 0000000..d9420c1
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_16.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_17.9.png b/res/drawable-mdpi/appointment_indicator_leftside_17.9.png
new file mode 100644
index 0000000..d0875c4
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_17.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_18.9.png b/res/drawable-mdpi/appointment_indicator_leftside_18.9.png
new file mode 100644
index 0000000..fc152f7
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_18.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_19.9.png b/res/drawable-mdpi/appointment_indicator_leftside_19.9.png
new file mode 100644
index 0000000..6506a94
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_19.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_2.9.png b/res/drawable-mdpi/appointment_indicator_leftside_2.9.png
new file mode 100644
index 0000000..3baf5cc
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_2.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_20.9.png b/res/drawable-mdpi/appointment_indicator_leftside_20.9.png
new file mode 100644
index 0000000..28340ba
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_20.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_21.9.png b/res/drawable-mdpi/appointment_indicator_leftside_21.9.png
new file mode 100644
index 0000000..5319f07
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_21.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_3.9.png b/res/drawable-mdpi/appointment_indicator_leftside_3.9.png
new file mode 100644
index 0000000..9850791
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_3.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_4.9.png b/res/drawable-mdpi/appointment_indicator_leftside_4.9.png
new file mode 100644
index 0000000..e344ccb
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_4.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_5.9.png b/res/drawable-mdpi/appointment_indicator_leftside_5.9.png
new file mode 100644
index 0000000..11b4dfb
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_5.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_6.9.png b/res/drawable-mdpi/appointment_indicator_leftside_6.9.png
new file mode 100644
index 0000000..7419d47
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_6.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_7.9.png b/res/drawable-mdpi/appointment_indicator_leftside_7.9.png
new file mode 100644
index 0000000..0a3a272
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_7.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_8.9.png b/res/drawable-mdpi/appointment_indicator_leftside_8.9.png
new file mode 100644
index 0000000..db18d27
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_8.9.png
Binary files differ
diff --git a/res/drawable-mdpi/appointment_indicator_leftside_9.9.png b/res/drawable-mdpi/appointment_indicator_leftside_9.9.png
new file mode 100644
index 0000000..5037de8
--- /dev/null
+++ b/res/drawable-mdpi/appointment_indicator_leftside_9.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/badge_action_call.png b/res/drawable-mdpi/badge_action_call.png
similarity index 100%
rename from res/drawable-mdpi-finger/badge_action_call.png
rename to res/drawable-mdpi/badge_action_call.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/badge_action_sms.png b/res/drawable-mdpi/badge_action_sms.png
similarity index 100%
rename from res/drawable-mdpi-finger/badge_action_sms.png
rename to res/drawable-mdpi/badge_action_sms.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/bg_blk_search_contact.9.png b/res/drawable-mdpi/bg_blk_search_contact.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/bg_blk_search_contact.9.png
rename to res/drawable-mdpi/bg_blk_search_contact.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_circle_disable.png b/res/drawable-mdpi/btn_circle_disable.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_circle_disable.png
rename to res/drawable-mdpi/btn_circle_disable.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_circle_disable_focused.png b/res/drawable-mdpi/btn_circle_disable_focused.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_circle_disable_focused.png
rename to res/drawable-mdpi/btn_circle_disable_focused.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_circle_normal.png b/res/drawable-mdpi/btn_circle_normal.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_circle_normal.png
rename to res/drawable-mdpi/btn_circle_normal.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_circle_pressed.png b/res/drawable-mdpi/btn_circle_pressed.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_circle_pressed.png
rename to res/drawable-mdpi/btn_circle_pressed.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_circle_selected.png b/res/drawable-mdpi/btn_circle_selected.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_circle_selected.png
rename to res/drawable-mdpi/btn_circle_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_dial_action_left_disable.9.png b/res/drawable-mdpi/btn_dial_action_left_disable.9.png
new file mode 100644
index 0000000..8eb45c8
--- /dev/null
+++ b/res/drawable-mdpi/btn_dial_action_left_disable.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_left_disable_focused.9.png b/res/drawable-mdpi/btn_dial_action_left_disable_focused.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_left_disable_focused.9.png
rename to res/drawable-mdpi/btn_dial_action_left_disable_focused.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_left_normal.9.png b/res/drawable-mdpi/btn_dial_action_left_normal.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_left_normal.9.png
rename to res/drawable-mdpi/btn_dial_action_left_normal.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_left_pressed.9.png b/res/drawable-mdpi/btn_dial_action_left_pressed.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_left_pressed.9.png
rename to res/drawable-mdpi/btn_dial_action_left_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_left_selected.9.png b/res/drawable-mdpi/btn_dial_action_left_selected.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_left_selected.9.png
rename to res/drawable-mdpi/btn_dial_action_left_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_dial_action_middle_disable.9.png b/res/drawable-mdpi/btn_dial_action_middle_disable.9.png
new file mode 100644
index 0000000..e13b958
--- /dev/null
+++ b/res/drawable-mdpi/btn_dial_action_middle_disable.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_middle_disable_focused.9.png b/res/drawable-mdpi/btn_dial_action_middle_disable_focused.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_middle_disable_focused.9.png
rename to res/drawable-mdpi/btn_dial_action_middle_disable_focused.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_middle_normal.9.png b/res/drawable-mdpi/btn_dial_action_middle_normal.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_middle_normal.9.png
rename to res/drawable-mdpi/btn_dial_action_middle_normal.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_middle_pressed.9.png b/res/drawable-mdpi/btn_dial_action_middle_pressed.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_middle_pressed.9.png
rename to res/drawable-mdpi/btn_dial_action_middle_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_middle_selected.9.png b/res/drawable-mdpi/btn_dial_action_middle_selected.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_middle_selected.9.png
rename to res/drawable-mdpi/btn_dial_action_middle_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_dial_action_right_disable.9.png b/res/drawable-mdpi/btn_dial_action_right_disable.9.png
new file mode 100644
index 0000000..de5c271
--- /dev/null
+++ b/res/drawable-mdpi/btn_dial_action_right_disable.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_right_disable_focused.9.png b/res/drawable-mdpi/btn_dial_action_right_disable_focused.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_right_disable_focused.9.png
rename to res/drawable-mdpi/btn_dial_action_right_disable_focused.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_right_normal.9.png b/res/drawable-mdpi/btn_dial_action_right_normal.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_right_normal.9.png
rename to res/drawable-mdpi/btn_dial_action_right_normal.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_right_pressed.9.png b/res/drawable-mdpi/btn_dial_action_right_pressed.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_right_pressed.9.png
rename to res/drawable-mdpi/btn_dial_action_right_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_action_right_selected.9.png b/res/drawable-mdpi/btn_dial_action_right_selected.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_action_right_selected.9.png
rename to res/drawable-mdpi/btn_dial_action_right_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_normal.9.png b/res/drawable-mdpi/btn_dial_normal.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_normal.9.png
rename to res/drawable-mdpi/btn_dial_normal.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_pressed.9.png b/res/drawable-mdpi/btn_dial_pressed.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_pressed.9.png
rename to res/drawable-mdpi/btn_dial_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_selected.9.png b/res/drawable-mdpi/btn_dial_selected.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_selected.9.png
rename to res/drawable-mdpi/btn_dial_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_textfield_activated.9.png b/res/drawable-mdpi/btn_dial_textfield_activated.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_textfield_activated.9.png
rename to res/drawable-mdpi/btn_dial_textfield_activated.9.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_dial_textfield_normal.9.png b/res/drawable-mdpi/btn_dial_textfield_normal.9.png
new file mode 100644
index 0000000..277400b
--- /dev/null
+++ b/res/drawable-mdpi/btn_dial_textfield_normal.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_textfield_pressed.9.png b/res/drawable-mdpi/btn_dial_textfield_pressed.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_textfield_pressed.9.png
rename to res/drawable-mdpi/btn_dial_textfield_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_dial_textfield_selected.9.png b/res/drawable-mdpi/btn_dial_textfield_selected.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_dial_textfield_selected.9.png
rename to res/drawable-mdpi/btn_dial_textfield_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_minus_disabled.png b/res/drawable-mdpi/btn_minus_disabled.png
new file mode 100644
index 0000000..abe3b7b
--- /dev/null
+++ b/res/drawable-mdpi/btn_minus_disabled.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_minus_disabled_focused.png b/res/drawable-mdpi/btn_minus_disabled_focused.png
new file mode 100644
index 0000000..0e4b66c
--- /dev/null
+++ b/res/drawable-mdpi/btn_minus_disabled_focused.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_minus_focused.png b/res/drawable-mdpi/btn_minus_focused.png
new file mode 100644
index 0000000..321365c
--- /dev/null
+++ b/res/drawable-mdpi/btn_minus_focused.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_minus_normal.png b/res/drawable-mdpi/btn_minus_normal.png
new file mode 100644
index 0000000..8c00936
--- /dev/null
+++ b/res/drawable-mdpi/btn_minus_normal.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_minus_pressed.png b/res/drawable-mdpi/btn_minus_pressed.png
new file mode 100644
index 0000000..bffe6f3
--- /dev/null
+++ b/res/drawable-mdpi/btn_minus_pressed.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_plus_disabled.png b/res/drawable-mdpi/btn_plus_disabled.png
new file mode 100644
index 0000000..c71bb10
--- /dev/null
+++ b/res/drawable-mdpi/btn_plus_disabled.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_plus_disabled_focused.png b/res/drawable-mdpi/btn_plus_disabled_focused.png
new file mode 100644
index 0000000..5060b3e
--- /dev/null
+++ b/res/drawable-mdpi/btn_plus_disabled_focused.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_plus_focused.png b/res/drawable-mdpi/btn_plus_focused.png
new file mode 100644
index 0000000..3a49acc
--- /dev/null
+++ b/res/drawable-mdpi/btn_plus_focused.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_plus_normal.png b/res/drawable-mdpi/btn_plus_normal.png
new file mode 100644
index 0000000..b88d0b9
--- /dev/null
+++ b/res/drawable-mdpi/btn_plus_normal.png
Binary files differ
diff --git a/res/drawable-mdpi/btn_plus_pressed.png b/res/drawable-mdpi/btn_plus_pressed.png
new file mode 100644
index 0000000..e4fc529
--- /dev/null
+++ b/res/drawable-mdpi/btn_plus_pressed.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_search_dialog_default.9.png b/res/drawable-mdpi/btn_search_dialog_default.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_search_dialog_default.9.png
rename to res/drawable-mdpi/btn_search_dialog_default.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_search_dialog_pressed.9.png b/res/drawable-mdpi/btn_search_dialog_pressed.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_search_dialog_pressed.9.png
rename to res/drawable-mdpi/btn_search_dialog_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/btn_search_dialog_selected.9.png b/res/drawable-mdpi/btn_search_dialog_selected.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/btn_search_dialog_selected.9.png
rename to res/drawable-mdpi/btn_search_dialog_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi/cab_divider_holo_light.png b/res/drawable-mdpi/cab_divider_holo_light.png
new file mode 100644
index 0000000..4a77a85
--- /dev/null
+++ b/res/drawable-mdpi/cab_divider_holo_light.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/contact_picture_border_highlight.9.png b/res/drawable-mdpi/contact_picture_border_highlight.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/contact_picture_border_highlight.9.png
rename to res/drawable-mdpi/contact_picture_border_highlight.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/contact_picture_border_normal.9.png b/res/drawable-mdpi/contact_picture_border_normal.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/contact_picture_border_normal.9.png
rename to res/drawable-mdpi/contact_picture_border_normal.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/contact_picture_border_pressed.9.png b/res/drawable-mdpi/contact_picture_border_pressed.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/contact_picture_border_pressed.9.png
rename to res/drawable-mdpi/contact_picture_border_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_0_blk.png b/res/drawable-mdpi/dial_num_0_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_0_blk.png
rename to res/drawable-mdpi/dial_num_0_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_0_wht.png b/res/drawable-mdpi/dial_num_0_wht.png
new file mode 100644
index 0000000..c3b3f2c
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_0_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_1_no_vm_blk.png b/res/drawable-mdpi/dial_num_1_no_vm_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_1_no_vm_blk.png
rename to res/drawable-mdpi/dial_num_1_no_vm_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_1_no_vm_wht.png b/res/drawable-mdpi/dial_num_1_no_vm_wht.png
new file mode 100644
index 0000000..a5bdb41
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_1_no_vm_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_2_blk.png b/res/drawable-mdpi/dial_num_2_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_2_blk.png
rename to res/drawable-mdpi/dial_num_2_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_2_wht.png b/res/drawable-mdpi/dial_num_2_wht.png
new file mode 100644
index 0000000..ac99cec
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_2_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_3_blk.png b/res/drawable-mdpi/dial_num_3_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_3_blk.png
rename to res/drawable-mdpi/dial_num_3_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_3_wht.png b/res/drawable-mdpi/dial_num_3_wht.png
new file mode 100644
index 0000000..69170b9
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_3_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_4_blk.png b/res/drawable-mdpi/dial_num_4_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_4_blk.png
rename to res/drawable-mdpi/dial_num_4_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_4_wht.png b/res/drawable-mdpi/dial_num_4_wht.png
new file mode 100644
index 0000000..48a02a5
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_4_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_5_blk.png b/res/drawable-mdpi/dial_num_5_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_5_blk.png
rename to res/drawable-mdpi/dial_num_5_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_5_wht.png b/res/drawable-mdpi/dial_num_5_wht.png
new file mode 100644
index 0000000..e3c9940
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_5_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_6_blk.png b/res/drawable-mdpi/dial_num_6_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_6_blk.png
rename to res/drawable-mdpi/dial_num_6_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_6_wht.png b/res/drawable-mdpi/dial_num_6_wht.png
new file mode 100644
index 0000000..ab12781
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_6_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_7_blk.png b/res/drawable-mdpi/dial_num_7_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_7_blk.png
rename to res/drawable-mdpi/dial_num_7_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_7_wht.png b/res/drawable-mdpi/dial_num_7_wht.png
new file mode 100644
index 0000000..9e66205
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_7_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_8_blk.png b/res/drawable-mdpi/dial_num_8_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_8_blk.png
rename to res/drawable-mdpi/dial_num_8_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_8_wht.png b/res/drawable-mdpi/dial_num_8_wht.png
new file mode 100644
index 0000000..2af30fa
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_8_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_9_blk.png b/res/drawable-mdpi/dial_num_9_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_9_blk.png
rename to res/drawable-mdpi/dial_num_9_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_9_wht.png b/res/drawable-mdpi/dial_num_9_wht.png
new file mode 100644
index 0000000..1c99b61
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_9_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_pound_blk.png b/res/drawable-mdpi/dial_num_pound_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_pound_blk.png
rename to res/drawable-mdpi/dial_num_pound_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_pound_wht.png b/res/drawable-mdpi/dial_num_pound_wht.png
new file mode 100644
index 0000000..e17f2bf
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_pound_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/dial_num_star_blk.png b/res/drawable-mdpi/dial_num_star_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/dial_num_star_blk.png
rename to res/drawable-mdpi/dial_num_star_blk.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_star_wht.png b/res/drawable-mdpi/dial_num_star_wht.png
new file mode 100644
index 0000000..86113ed
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_star_wht.png
Binary files differ
diff --git a/res/drawable-mdpi/directory_bg.9.png b/res/drawable-mdpi/directory_bg.9.png
new file mode 100644
index 0000000..80578cd
--- /dev/null
+++ b/res/drawable-mdpi/directory_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/directory_bg_holo.9.png b/res/drawable-mdpi/directory_bg_holo.9.png
new file mode 100644
index 0000000..7f7209d
--- /dev/null
+++ b/res/drawable-mdpi/directory_bg_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/divider_vertical_dark.9.png b/res/drawable-mdpi/divider_vertical_dark.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/divider_vertical_dark.9.png
rename to res/drawable-mdpi/divider_vertical_dark.9.png
Binary files differ
diff --git a/res/drawable-mdpi/filter_selector_corner.png b/res/drawable-mdpi/filter_selector_corner.png
new file mode 100644
index 0000000..964dd75
--- /dev/null
+++ b/res/drawable-mdpi/filter_selector_corner.png
Binary files differ
diff --git a/res/drawable-mdpi/group_membership_edit_background.9.png b/res/drawable-mdpi/group_membership_edit_background.9.png
new file mode 100644
index 0000000..36003cf
--- /dev/null
+++ b/res/drawable-mdpi/group_membership_edit_background.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_aggregated.png b/res/drawable-mdpi/ic_aggregated.png
new file mode 100644
index 0000000..7c2e2b0
--- /dev/null
+++ b/res/drawable-mdpi/ic_aggregated.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_btn_round_less.png b/res/drawable-mdpi/ic_btn_round_less.png
new file mode 100644
index 0000000..a9b5bed
--- /dev/null
+++ b/res/drawable-mdpi/ic_btn_round_less.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_btn_round_more.png b/res/drawable-mdpi/ic_btn_round_more.png
new file mode 100644
index 0000000..ebdc55c
--- /dev/null
+++ b/res/drawable-mdpi/ic_btn_round_more.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_call_log_header_incoming_call.png b/res/drawable-mdpi/ic_call_log_header_incoming_call.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_call_log_header_incoming_call.png
rename to res/drawable-mdpi/ic_call_log_header_incoming_call.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_call_log_header_missed_call.png b/res/drawable-mdpi/ic_call_log_header_missed_call.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_call_log_header_missed_call.png
rename to res/drawable-mdpi/ic_call_log_header_missed_call.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_call_log_header_outgoing_call.png b/res/drawable-mdpi/ic_call_log_header_outgoing_call.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_call_log_header_outgoing_call.png
rename to res/drawable-mdpi/ic_call_log_header_outgoing_call.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_call_log_list_incoming_call.png b/res/drawable-mdpi/ic_call_log_list_incoming_call.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_call_log_list_incoming_call.png
rename to res/drawable-mdpi/ic_call_log_list_incoming_call.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_call_log_list_missed_call.png b/res/drawable-mdpi/ic_call_log_list_missed_call.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_call_log_list_missed_call.png
rename to res/drawable-mdpi/ic_call_log_list_missed_call.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_call_log_list_outgoing_call.png b/res/drawable-mdpi/ic_call_log_list_outgoing_call.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_call_log_list_outgoing_call.png
rename to res/drawable-mdpi/ic_call_log_list_outgoing_call.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_contact_list_filter_all.png b/res/drawable-mdpi/ic_contact_list_filter_all.png
new file mode 100644
index 0000000..67981a9
--- /dev/null
+++ b/res/drawable-mdpi/ic_contact_list_filter_all.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_contact_list_filter_custom.png b/res/drawable-mdpi/ic_contact_list_filter_custom.png
new file mode 100644
index 0000000..3f48be3
--- /dev/null
+++ b/res/drawable-mdpi/ic_contact_list_filter_custom.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_contact_list_filter_starred.png b/res/drawable-mdpi/ic_contact_list_filter_starred.png
new file mode 100755
index 0000000..a9bdb05
--- /dev/null
+++ b/res/drawable-mdpi/ic_contact_list_filter_starred.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_contact_list_picture.png b/res/drawable-mdpi/ic_contact_list_picture.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_contact_list_picture.png
rename to res/drawable-mdpi/ic_contact_list_picture.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_contact_picture.png b/res/drawable-mdpi/ic_contact_picture.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_contact_picture.png
rename to res/drawable-mdpi/ic_contact_picture.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_contact_picture_2.png b/res/drawable-mdpi/ic_contact_picture_2.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_contact_picture_2.png
rename to res/drawable-mdpi/ic_contact_picture_2.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_contact_picture_3.png b/res/drawable-mdpi/ic_contact_picture_3.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_contact_picture_3.png
rename to res/drawable-mdpi/ic_contact_picture_3.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_default_number.png b/res/drawable-mdpi/ic_default_number.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_default_number.png
rename to res/drawable-mdpi/ic_default_number.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_dial_action_call.png b/res/drawable-mdpi/ic_dial_action_call.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_dial_action_call.png
rename to res/drawable-mdpi/ic_dial_action_call.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_dial_action_delete.png b/res/drawable-mdpi/ic_dial_action_delete.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_dial_action_delete.png
rename to res/drawable-mdpi/ic_dial_action_delete.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_dial_action_voice_mail.png b/res/drawable-mdpi/ic_dial_action_voice_mail.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_dial_action_voice_mail.png
rename to res/drawable-mdpi/ic_dial_action_voice_mail.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_dial_number_blk.png b/res/drawable-mdpi/ic_dial_number_blk.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_dial_number_blk.png
rename to res/drawable-mdpi/ic_dial_number_blk.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_dial_number_wht.png b/res/drawable-mdpi/ic_dial_number_wht.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_dial_number_wht.png
rename to res/drawable-mdpi/ic_dial_number_wht.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_dialer_fork_add_call.png b/res/drawable-mdpi/ic_dialer_fork_add_call.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_dialer_fork_add_call.png
rename to res/drawable-mdpi/ic_dialer_fork_add_call.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_dialer_fork_current_call.png b/res/drawable-mdpi/ic_dialer_fork_current_call.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_dialer_fork_current_call.png
rename to res/drawable-mdpi/ic_dialer_fork_current_call.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_dialer_fork_tt_keypad.png b/res/drawable-mdpi/ic_dialer_fork_tt_keypad.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_dialer_fork_tt_keypad.png
rename to res/drawable-mdpi/ic_dialer_fork_tt_keypad.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_join.png b/res/drawable-mdpi/ic_join.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_join.png
rename to res/drawable-mdpi/ic_join.png
Binary files differ
diff --git a/res/drawable/ic_menu_2sec_pause.png b/res/drawable-mdpi/ic_menu_2sec_pause.png
similarity index 100%
rename from res/drawable/ic_menu_2sec_pause.png
rename to res/drawable-mdpi/ic_menu_2sec_pause.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_accounts_normal_holo.png b/res/drawable-mdpi/ic_menu_accounts_normal_holo.png
new file mode 100644
index 0000000..32e1d44
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_accounts_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_accounts_pressed_holo.png b/res/drawable-mdpi/ic_menu_accounts_pressed_holo.png
new file mode 100644
index 0000000..051bd5d
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_accounts_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_add_contact_normal_holo.png b/res/drawable-mdpi/ic_menu_add_contact_normal_holo.png
new file mode 100644
index 0000000..a881568
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_add_contact_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_add_contact_pressed_holo.png b/res/drawable-mdpi/ic_menu_add_contact_pressed_holo.png
new file mode 100644
index 0000000..0dd8682
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_add_contact_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_menu_add_picture.png b/res/drawable-mdpi/ic_menu_add_picture.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_menu_add_picture.png
rename to res/drawable-mdpi/ic_menu_add_picture.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_cancel_normal_holo.png b/res/drawable-mdpi/ic_menu_cancel_normal_holo.png
new file mode 100644
index 0000000..2de790f
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_cancel_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_cancel_pressed_holo.png b/res/drawable-mdpi/ic_menu_cancel_pressed_holo.png
new file mode 100644
index 0000000..0bd6a5c
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_cancel_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_compose_normal_holo.png b/res/drawable-mdpi/ic_menu_compose_normal_holo.png
new file mode 100644
index 0000000..2d58037
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_compose_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_compose_pressed_holo.png b/res/drawable-mdpi/ic_menu_compose_pressed_holo.png
new file mode 100644
index 0000000..c54be2b
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_compose_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_display_all.png b/res/drawable-mdpi/ic_menu_display_all.png
new file mode 100644
index 0000000..61a9e35
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_display_all.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_display_selected.png b/res/drawable-mdpi/ic_menu_display_selected.png
new file mode 100644
index 0000000..b4ec7a8
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_display_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_done_normal_holo.png b/res/drawable-mdpi/ic_menu_done_normal_holo.png
new file mode 100644
index 0000000..f00a0fd
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_done_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_done_pressed_holo.png b/res/drawable-mdpi/ic_menu_done_pressed_holo.png
new file mode 100644
index 0000000..cc89b49
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_done_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_import_export_normal_holo.png b/res/drawable-mdpi/ic_menu_import_export_normal_holo.png
new file mode 100644
index 0000000..bf18852
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_import_export_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_import_export_pressed_holo.png b/res/drawable-mdpi/ic_menu_import_export_pressed_holo.png
new file mode 100644
index 0000000..b7c5547
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_import_export_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_merge_normal_holo.png b/res/drawable-mdpi/ic_menu_merge_normal_holo.png
new file mode 100644
index 0000000..79c92f9
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_merge_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_merge_pressed_holo.png b/res/drawable-mdpi/ic_menu_merge_pressed_holo.png
new file mode 100644
index 0000000..939014d
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_merge_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_select.png b/res/drawable-mdpi/ic_menu_select.png
new file mode 100644
index 0000000..29e3d7e
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_select.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_settings_normal_holo.png b/res/drawable-mdpi/ic_menu_settings_normal_holo.png
new file mode 100644
index 0000000..c5d6db2
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_settings_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_settings_pressed_holo.png b/res/drawable-mdpi/ic_menu_settings_pressed_holo.png
new file mode 100644
index 0000000..9d5299a
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_settings_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_share_normal_holo.png b/res/drawable-mdpi/ic_menu_share_normal_holo.png
new file mode 100644
index 0000000..200dc06
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_share_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_share_pressed_holo.png b/res/drawable-mdpi/ic_menu_share_pressed_holo.png
new file mode 100644
index 0000000..7eeee98
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_share_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_split_normal_holo.png b/res/drawable-mdpi/ic_menu_split_normal_holo.png
new file mode 100644
index 0000000..c061104
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_split_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_split_pressed_holo.png b/res/drawable-mdpi/ic_menu_split_pressed_holo.png
new file mode 100644
index 0000000..269d24d
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_split_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_trash_normal_holo.png b/res/drawable-mdpi/ic_menu_trash_normal_holo.png
new file mode 100644
index 0000000..7e354c1
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_trash_normal_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_trash_pressed_holo.png b/res/drawable-mdpi/ic_menu_trash_pressed_holo.png
new file mode 100644
index 0000000..ee42881
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_trash_pressed_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_unselect.png b/res/drawable-mdpi/ic_menu_unselect.png
new file mode 100644
index 0000000..2b69bc8
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_unselect.png
Binary files differ
diff --git a/res/drawable/ic_menu_wait.png b/res/drawable-mdpi/ic_menu_wait.png
similarity index 100%
rename from res/drawable/ic_menu_wait.png
rename to res/drawable-mdpi/ic_menu_wait.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_tab_selected_contacts.png b/res/drawable-mdpi/ic_tab_selected_contacts.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_tab_selected_contacts.png
rename to res/drawable-mdpi/ic_tab_selected_contacts.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_tab_selected_dialer.png b/res/drawable-mdpi/ic_tab_selected_dialer.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_tab_selected_dialer.png
rename to res/drawable-mdpi/ic_tab_selected_dialer.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_tab_selected_friends_list.png b/res/drawable-mdpi/ic_tab_selected_friends_list.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_tab_selected_friends_list.png
rename to res/drawable-mdpi/ic_tab_selected_friends_list.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_tab_selected_recent.png b/res/drawable-mdpi/ic_tab_selected_recent.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_tab_selected_recent.png
rename to res/drawable-mdpi/ic_tab_selected_recent.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_tab_selected_starred.png b/res/drawable-mdpi/ic_tab_selected_starred.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_tab_selected_starred.png
rename to res/drawable-mdpi/ic_tab_selected_starred.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_tab_unselected_contacts.png b/res/drawable-mdpi/ic_tab_unselected_contacts.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_tab_unselected_contacts.png
rename to res/drawable-mdpi/ic_tab_unselected_contacts.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_tab_unselected_dialer.png b/res/drawable-mdpi/ic_tab_unselected_dialer.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_tab_unselected_dialer.png
rename to res/drawable-mdpi/ic_tab_unselected_dialer.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_tab_unselected_friends_list.png b/res/drawable-mdpi/ic_tab_unselected_friends_list.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_tab_unselected_friends_list.png
rename to res/drawable-mdpi/ic_tab_unselected_friends_list.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_tab_unselected_recent.png b/res/drawable-mdpi/ic_tab_unselected_recent.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_tab_unselected_recent.png
rename to res/drawable-mdpi/ic_tab_unselected_recent.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/ic_tab_unselected_starred.png b/res/drawable-mdpi/ic_tab_unselected_starred.png
similarity index 100%
rename from res/drawable-mdpi-finger/ic_tab_unselected_starred.png
rename to res/drawable-mdpi/ic_tab_unselected_starred.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/infobar_dark.9.png b/res/drawable-mdpi/infobar_dark.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/infobar_dark.9.png
rename to res/drawable-mdpi/infobar_dark.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_item_activated_bg.9.png b/res/drawable-mdpi/list_item_activated_bg.9.png
new file mode 100644
index 0000000..dd82c22
--- /dev/null
+++ b/res/drawable-mdpi/list_item_activated_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_item_divider.9.png b/res/drawable-mdpi/list_item_divider.9.png
new file mode 100644
index 0000000..60e2cb2
--- /dev/null
+++ b/res/drawable-mdpi/list_item_divider.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_item_divider_holo.9.png b/res/drawable-mdpi/list_item_divider_holo.9.png
new file mode 100644
index 0000000..f5130d5
--- /dev/null
+++ b/res/drawable-mdpi/list_item_divider_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_item_pressed_bg.9.png b/res/drawable-mdpi/list_item_pressed_bg.9.png
new file mode 100644
index 0000000..74d8e53
--- /dev/null
+++ b/res/drawable-mdpi/list_item_pressed_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_arrow_down.png b/res/drawable-mdpi/quickcontact_arrow_down.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_arrow_down.png
rename to res/drawable-mdpi/quickcontact_arrow_down.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_arrow_up.png b/res/drawable-mdpi/quickcontact_arrow_up.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_arrow_up.png
rename to res/drawable-mdpi/quickcontact_arrow_up.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_bottom_frame.9.png b/res/drawable-mdpi/quickcontact_bottom_frame.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_bottom_frame.9.png
rename to res/drawable-mdpi/quickcontact_bottom_frame.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_disambig_bottom_bg.9.png b/res/drawable-mdpi/quickcontact_disambig_bottom_bg.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_disambig_bottom_bg.9.png
rename to res/drawable-mdpi/quickcontact_disambig_bottom_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_disambig_checkbox_off.png b/res/drawable-mdpi/quickcontact_disambig_checkbox_off.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_disambig_checkbox_off.png
rename to res/drawable-mdpi/quickcontact_disambig_checkbox_off.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_disambig_checkbox_on.png b/res/drawable-mdpi/quickcontact_disambig_checkbox_on.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_disambig_checkbox_on.png
rename to res/drawable-mdpi/quickcontact_disambig_checkbox_on.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_disambig_divider.9.png b/res/drawable-mdpi/quickcontact_disambig_divider.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_disambig_divider.9.png
rename to res/drawable-mdpi/quickcontact_disambig_divider.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_drop_shadow.9.png b/res/drawable-mdpi/quickcontact_drop_shadow.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_drop_shadow.9.png
rename to res/drawable-mdpi/quickcontact_drop_shadow.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_photo_frame.9.png b/res/drawable-mdpi/quickcontact_photo_frame.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_photo_frame.9.png
rename to res/drawable-mdpi/quickcontact_photo_frame.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_background.png b/res/drawable-mdpi/quickcontact_slider_background.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_background.png
rename to res/drawable-mdpi/quickcontact_slider_background.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_btn_normal.9.png b/res/drawable-mdpi/quickcontact_slider_btn_normal.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_btn_normal.9.png
rename to res/drawable-mdpi/quickcontact_slider_btn_normal.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_btn_on.9.png b/res/drawable-mdpi/quickcontact_slider_btn_on.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_btn_on.9.png
rename to res/drawable-mdpi/quickcontact_slider_btn_on.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_btn_pressed.9.png b/res/drawable-mdpi/quickcontact_slider_btn_pressed.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_btn_pressed.9.png
rename to res/drawable-mdpi/quickcontact_slider_btn_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_btn_selected.9.png b/res/drawable-mdpi/quickcontact_slider_btn_selected.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_btn_selected.9.png
rename to res/drawable-mdpi/quickcontact_slider_btn_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_grip_left.png b/res/drawable-mdpi/quickcontact_slider_grip_left.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_grip_left.png
rename to res/drawable-mdpi/quickcontact_slider_grip_left.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_grip_right.png b/res/drawable-mdpi/quickcontact_slider_grip_right.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_grip_right.png
rename to res/drawable-mdpi/quickcontact_slider_grip_right.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_presence_active.png b/res/drawable-mdpi/quickcontact_slider_presence_active.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_presence_active.png
rename to res/drawable-mdpi/quickcontact_slider_presence_active.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_presence_away.png b/res/drawable-mdpi/quickcontact_slider_presence_away.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_presence_away.png
rename to res/drawable-mdpi/quickcontact_slider_presence_away.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_presence_busy.png b/res/drawable-mdpi/quickcontact_slider_presence_busy.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_presence_busy.png
rename to res/drawable-mdpi/quickcontact_slider_presence_busy.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_slider_presence_inactive.png b/res/drawable-mdpi/quickcontact_slider_presence_inactive.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_slider_presence_inactive.png
rename to res/drawable-mdpi/quickcontact_slider_presence_inactive.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/quickcontact_top_frame.9.png b/res/drawable-mdpi/quickcontact_top_frame.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/quickcontact_top_frame.9.png
rename to res/drawable-mdpi/quickcontact_top_frame.9.png
Binary files differ
diff --git a/res/drawable-mdpi/section_header.9.png b/res/drawable-mdpi/section_header.9.png
new file mode 100644
index 0000000..ac906cd
--- /dev/null
+++ b/res/drawable-mdpi/section_header.9.png
Binary files differ
diff --git a/res/drawable-mdpi/section_header_holo.9.png b/res/drawable-mdpi/section_header_holo.9.png
new file mode 100644
index 0000000..de12d0e
--- /dev/null
+++ b/res/drawable-mdpi/section_header_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/social_bubble.9.png b/res/drawable-mdpi/social_bubble.9.png
new file mode 100644
index 0000000..c9026eb
--- /dev/null
+++ b/res/drawable-mdpi/social_bubble.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/sym_action_add.png b/res/drawable-mdpi/sym_action_add.png
similarity index 100%
rename from res/drawable-mdpi-finger/sym_action_add.png
rename to res/drawable-mdpi/sym_action_add.png
Binary files differ
diff --git a/res/drawable-mdpi/sym_action_audiochat.png b/res/drawable-mdpi/sym_action_audiochat.png
new file mode 100644
index 0000000..9bbaa37
--- /dev/null
+++ b/res/drawable-mdpi/sym_action_audiochat.png
Binary files differ
diff --git a/res/drawable-mdpi/sym_action_email.png b/res/drawable-mdpi/sym_action_email.png
new file mode 100644
index 0000000..caf2c65
--- /dev/null
+++ b/res/drawable-mdpi/sym_action_email.png
Binary files differ
diff --git a/res/drawable-mdpi/sym_action_map.png b/res/drawable-mdpi/sym_action_map.png
new file mode 100644
index 0000000..f34b2f5
--- /dev/null
+++ b/res/drawable-mdpi/sym_action_map.png
Binary files differ
diff --git a/res/drawable-mdpi/sym_action_videochat.png b/res/drawable-mdpi/sym_action_videochat.png
new file mode 100644
index 0000000..84e1b98
--- /dev/null
+++ b/res/drawable-mdpi/sym_action_videochat.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/sym_action_view_contact.png b/res/drawable-mdpi/sym_action_view_contact.png
similarity index 100%
rename from res/drawable-mdpi-finger/sym_action_view_contact.png
rename to res/drawable-mdpi/sym_action_view_contact.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/tab_focused.9.png b/res/drawable-mdpi/tab_focused.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/tab_focused.9.png
rename to res/drawable-mdpi/tab_focused.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/tab_focused_bottom.9.png b/res/drawable-mdpi/tab_focused_bottom.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/tab_focused_bottom.9.png
rename to res/drawable-mdpi/tab_focused_bottom.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/tab_left_arrow.png b/res/drawable-mdpi/tab_left_arrow.png
similarity index 100%
rename from res/drawable-mdpi-finger/tab_left_arrow.png
rename to res/drawable-mdpi/tab_left_arrow.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/tab_pressed.9.png b/res/drawable-mdpi/tab_pressed.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/tab_pressed.9.png
rename to res/drawable-mdpi/tab_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/tab_pressed_bottom.9.png b/res/drawable-mdpi/tab_pressed_bottom.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/tab_pressed_bottom.9.png
rename to res/drawable-mdpi/tab_pressed_bottom.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/tab_right_arrow.png b/res/drawable-mdpi/tab_right_arrow.png
similarity index 100%
rename from res/drawable-mdpi-finger/tab_right_arrow.png
rename to res/drawable-mdpi/tab_right_arrow.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/tab_selected.9.png b/res/drawable-mdpi/tab_selected.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/tab_selected.9.png
rename to res/drawable-mdpi/tab_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/tab_selected_bottom.9.png b/res/drawable-mdpi/tab_selected_bottom.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/tab_selected_bottom.9.png
rename to res/drawable-mdpi/tab_selected_bottom.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/tab_unselected.9.png b/res/drawable-mdpi/tab_unselected.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/tab_unselected.9.png
rename to res/drawable-mdpi/tab_unselected.9.png
Binary files differ
diff --git a/res/drawable-mdpi/title_bar_medium.9.png b/res/drawable-mdpi/title_bar_medium.9.png
new file mode 100644
index 0000000..2d41d02
--- /dev/null
+++ b/res/drawable-mdpi/title_bar_medium.9.png
Binary files differ
diff --git a/res/drawable-mdpi-finger/title_bar_shadow.9.png b/res/drawable-mdpi/title_bar_shadow.9.png
similarity index 100%
rename from res/drawable-mdpi-finger/title_bar_shadow.9.png
rename to res/drawable-mdpi/title_bar_shadow.9.png
Binary files differ
diff --git a/res/drawable-mdpi/type_selector_background.9.png b/res/drawable-mdpi/type_selector_background.9.png
new file mode 100644
index 0000000..7f4f3fe
--- /dev/null
+++ b/res/drawable-mdpi/type_selector_background.9.png
Binary files differ
diff --git a/res/drawable/unknown_source.png b/res/drawable-mdpi/unknown_source.png
similarity index 100%
rename from res/drawable/unknown_source.png
rename to res/drawable-mdpi/unknown_source.png
Binary files differ
diff --git a/res/drawable-mdpi/view_bg.9.png b/res/drawable-mdpi/view_bg.9.png
new file mode 100644
index 0000000..b78c56d
--- /dev/null
+++ b/res/drawable-mdpi/view_bg.9.png
Binary files differ
diff --git a/res/drawable-xlarge-hdpi/panel_message.9.png b/res/drawable-xlarge-hdpi/panel_message.9.png
new file mode 100644
index 0000000..796a8fa
--- /dev/null
+++ b/res/drawable-xlarge-hdpi/panel_message.9.png
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/panel_message.9.png b/res/drawable-xlarge-mdpi/panel_message.9.png
new file mode 100644
index 0000000..529c61d
--- /dev/null
+++ b/res/drawable-xlarge-mdpi/panel_message.9.png
Binary files differ
diff --git a/res/drawable-xlarge/contact_list_bg.png b/res/drawable-xlarge/contact_list_bg.png
new file mode 100644
index 0000000..ead9603
--- /dev/null
+++ b/res/drawable-xlarge/contact_list_bg.png
Binary files differ
diff --git a/res/drawable-xlarge/divider_vertical_dark.9.png b/res/drawable-xlarge/divider_vertical_dark.9.png
new file mode 100644
index 0000000..38b794b
--- /dev/null
+++ b/res/drawable-xlarge/divider_vertical_dark.9.png
Binary files differ
diff --git a/res/drawable-finger/btn_circle.xml b/res/drawable/btn_circle.xml
similarity index 100%
rename from res/drawable-finger/btn_circle.xml
rename to res/drawable/btn_circle.xml
diff --git a/res/drawable-finger/btn_contact_picture.xml b/res/drawable/btn_contact_picture.xml
similarity index 100%
rename from res/drawable-finger/btn_contact_picture.xml
rename to res/drawable/btn_contact_picture.xml
diff --git a/res/drawable-finger/btn_dial.xml b/res/drawable/btn_dial.xml
similarity index 100%
rename from res/drawable-finger/btn_dial.xml
rename to res/drawable/btn_dial.xml
diff --git a/res/drawable-finger/btn_dial_action.xml b/res/drawable/btn_dial_action.xml
similarity index 100%
rename from res/drawable-finger/btn_dial_action.xml
rename to res/drawable/btn_dial_action.xml
diff --git a/res/drawable-finger/btn_dial_delete.xml b/res/drawable/btn_dial_delete.xml
similarity index 100%
rename from res/drawable-finger/btn_dial_delete.xml
rename to res/drawable/btn_dial_delete.xml
diff --git a/res/drawable-finger/btn_dial_voicemail.xml b/res/drawable/btn_dial_voicemail.xml
similarity index 100%
rename from res/drawable-finger/btn_dial_voicemail.xml
rename to res/drawable/btn_dial_voicemail.xml
diff --git a/res/drawable/btn_minus.xml b/res/drawable/btn_minus.xml
new file mode 100644
index 0000000..78277f4
--- /dev/null
+++ b/res/drawable/btn_minus.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_window_focused="false" android:state_enabled="true"
+        android:drawable="@drawable/btn_minus_normal" />
+    <item android:state_window_focused="false" android:state_enabled="false"
+        android:drawable="@drawable/btn_minus_disabled" />
+    <item android:state_pressed="true" 
+        android:drawable="@drawable/btn_minus_pressed" />
+    <item android:state_focused="true" android:state_enabled="true"
+        android:drawable="@drawable/btn_minus_focused" />
+    <item android:state_enabled="true"
+        android:drawable="@drawable/btn_minus_normal" />
+    <item android:state_focused="true"
+        android:drawable="@drawable/btn_minus_disabled_focused" />
+    <item
+         android:drawable="@drawable/btn_minus_disabled" />
+</selector>
diff --git a/res/drawable/btn_plus.xml b/res/drawable/btn_plus.xml
new file mode 100644
index 0000000..33a7f53
--- /dev/null
+++ b/res/drawable/btn_plus.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_window_focused="false" android:state_enabled="true"
+        android:drawable="@drawable/btn_plus_normal" />
+    <item android:state_window_focused="false" android:state_enabled="false"
+        android:drawable="@drawable/btn_plus_disabled" />
+    <item android:state_pressed="true" 
+        android:drawable="@drawable/btn_plus_pressed" />
+    <item android:state_focused="true" android:state_enabled="true"
+        android:drawable="@drawable/btn_plus_focused" />
+    <item android:state_enabled="true"
+        android:drawable="@drawable/btn_plus_normal" />
+    <item android:state_focused="true"
+        android:drawable="@drawable/btn_plus_disabled_focused" />
+    <item
+         android:drawable="@drawable/btn_plus_disabled" />
+</selector>
diff --git a/res/drawable-finger/dial_num_0.xml b/res/drawable/dial_num_0.xml
similarity index 100%
rename from res/drawable-finger/dial_num_0.xml
rename to res/drawable/dial_num_0.xml
diff --git a/res/drawable-finger/dial_num_1_no_vm.xml b/res/drawable/dial_num_1_no_vm.xml
similarity index 100%
rename from res/drawable-finger/dial_num_1_no_vm.xml
rename to res/drawable/dial_num_1_no_vm.xml
diff --git a/res/drawable-finger/dial_num_2.xml b/res/drawable/dial_num_2.xml
similarity index 100%
rename from res/drawable-finger/dial_num_2.xml
rename to res/drawable/dial_num_2.xml
diff --git a/res/drawable-finger/dial_num_3.xml b/res/drawable/dial_num_3.xml
similarity index 100%
rename from res/drawable-finger/dial_num_3.xml
rename to res/drawable/dial_num_3.xml
diff --git a/res/drawable-finger/dial_num_4.xml b/res/drawable/dial_num_4.xml
similarity index 100%
rename from res/drawable-finger/dial_num_4.xml
rename to res/drawable/dial_num_4.xml
diff --git a/res/drawable-finger/dial_num_5.xml b/res/drawable/dial_num_5.xml
similarity index 100%
rename from res/drawable-finger/dial_num_5.xml
rename to res/drawable/dial_num_5.xml
diff --git a/res/drawable-finger/dial_num_6.xml b/res/drawable/dial_num_6.xml
similarity index 100%
rename from res/drawable-finger/dial_num_6.xml
rename to res/drawable/dial_num_6.xml
diff --git a/res/drawable-finger/dial_num_7.xml b/res/drawable/dial_num_7.xml
similarity index 100%
rename from res/drawable-finger/dial_num_7.xml
rename to res/drawable/dial_num_7.xml
diff --git a/res/drawable-finger/dial_num_8.xml b/res/drawable/dial_num_8.xml
similarity index 100%
rename from res/drawable-finger/dial_num_8.xml
rename to res/drawable/dial_num_8.xml
diff --git a/res/drawable-finger/dial_num_9.xml b/res/drawable/dial_num_9.xml
similarity index 100%
rename from res/drawable-finger/dial_num_9.xml
rename to res/drawable/dial_num_9.xml
diff --git a/res/drawable-finger/dial_num_pound.xml b/res/drawable/dial_num_pound.xml
similarity index 100%
rename from res/drawable-finger/dial_num_pound.xml
rename to res/drawable/dial_num_pound.xml
diff --git a/res/drawable-finger/dial_num_star.xml b/res/drawable/dial_num_star.xml
similarity index 100%
rename from res/drawable-finger/dial_num_star.xml
rename to res/drawable/dial_num_star.xml
diff --git a/res/drawable/filter_selector_background.xml b/res/drawable/filter_selector_background.xml
new file mode 100644
index 0000000..16464f6
--- /dev/null
+++ b/res/drawable/filter_selector_background.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@color/filter_selector_selected_background" />
+    <item android:drawable="@android:color/transparent"/>
+</selector>
diff --git a/res/drawable/ic_menu_accounts.xml b/res/drawable/ic_menu_accounts.xml
new file mode 100644
index 0000000..5ae423a
--- /dev/null
+++ b/res/drawable/ic_menu_accounts.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/ic_menu_accounts_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_accounts_normal_holo" />
+</selector>
diff --git a/res/drawable/ic_menu_add_contact.xml b/res/drawable/ic_menu_add_contact.xml
new file mode 100644
index 0000000..4a6c7d9
--- /dev/null
+++ b/res/drawable/ic_menu_add_contact.xml
@@ -0,0 +1,21 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true"
+        android:drawable="@drawable/ic_menu_add_contact_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_add_contact_normal_holo" />
+</selector>
diff --git a/res/drawable/ic_menu_cancel.xml b/res/drawable/ic_menu_cancel.xml
new file mode 100644
index 0000000..c528dac
--- /dev/null
+++ b/res/drawable/ic_menu_cancel.xml
@@ -0,0 +1,21 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true"
+        android:drawable="@drawable/ic_menu_cancel_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_cancel_normal_holo" />
+</selector>
diff --git a/res/drawable/ic_menu_compose.xml b/res/drawable/ic_menu_compose.xml
new file mode 100644
index 0000000..c53fbdc
--- /dev/null
+++ b/res/drawable/ic_menu_compose.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/ic_menu_compose_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_compose_normal_holo" />
+</selector>
diff --git a/res/drawable/ic_menu_done.xml b/res/drawable/ic_menu_done.xml
new file mode 100644
index 0000000..7674e1e
--- /dev/null
+++ b/res/drawable/ic_menu_done.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/ic_menu_done_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_done_normal_holo" />
+</selector>
diff --git a/res/drawable/ic_menu_import_export.xml b/res/drawable/ic_menu_import_export.xml
new file mode 100644
index 0000000..1167ea1
--- /dev/null
+++ b/res/drawable/ic_menu_import_export.xml
@@ -0,0 +1,21 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true"
+        android:drawable="@drawable/ic_menu_import_export_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_import_export_normal_holo" />
+</selector>
diff --git a/res/drawable/ic_menu_merge.xml b/res/drawable/ic_menu_merge.xml
new file mode 100644
index 0000000..329f573
--- /dev/null
+++ b/res/drawable/ic_menu_merge.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/ic_menu_merge_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_merge_normal_holo" />
+</selector>
diff --git a/res/drawable/ic_menu_settings.xml b/res/drawable/ic_menu_settings.xml
new file mode 100644
index 0000000..4e21d05
--- /dev/null
+++ b/res/drawable/ic_menu_settings.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/ic_menu_settings_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_settings_normal_holo" />
+</selector>
diff --git a/res/drawable/ic_menu_share.xml b/res/drawable/ic_menu_share.xml
new file mode 100644
index 0000000..ff6f2b9
--- /dev/null
+++ b/res/drawable/ic_menu_share.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/ic_menu_share_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_share_normal_holo" />
+</selector>
diff --git a/res/drawable/ic_menu_split.xml b/res/drawable/ic_menu_split.xml
new file mode 100644
index 0000000..4a88455
--- /dev/null
+++ b/res/drawable/ic_menu_split.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/ic_menu_split_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_split_normal_holo" />
+</selector>
diff --git a/res/drawable/ic_menu_trash.xml b/res/drawable/ic_menu_trash.xml
new file mode 100644
index 0000000..e383ded
--- /dev/null
+++ b/res/drawable/ic_menu_trash.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/ic_menu_trash_pressed_holo" />
+    <item android:drawable="@drawable/ic_menu_trash_normal_holo" />
+</selector>
diff --git a/res/drawable-finger/ic_tab_contacts.xml b/res/drawable/ic_tab_contacts.xml
similarity index 100%
rename from res/drawable-finger/ic_tab_contacts.xml
rename to res/drawable/ic_tab_contacts.xml
diff --git a/res/drawable-finger/ic_tab_dialer.xml b/res/drawable/ic_tab_dialer.xml
similarity index 100%
rename from res/drawable-finger/ic_tab_dialer.xml
rename to res/drawable/ic_tab_dialer.xml
diff --git a/res/drawable-finger/ic_tab_recent.xml b/res/drawable/ic_tab_recent.xml
similarity index 100%
rename from res/drawable-finger/ic_tab_recent.xml
rename to res/drawable/ic_tab_recent.xml
diff --git a/res/drawable-finger/ic_tab_starred.xml b/res/drawable/ic_tab_starred.xml
similarity index 100%
rename from res/drawable-finger/ic_tab_starred.xml
rename to res/drawable/ic_tab_starred.xml
diff --git a/res/drawable-finger/quickcontact_disambig_checkbox.xml b/res/drawable/quickcontact_disambig_checkbox.xml
similarity index 100%
rename from res/drawable-finger/quickcontact_disambig_checkbox.xml
rename to res/drawable/quickcontact_disambig_checkbox.xml
diff --git a/res/drawable-finger/quickcontact_slider_btn.xml b/res/drawable/quickcontact_slider_btn.xml
similarity index 100%
rename from res/drawable-finger/quickcontact_slider_btn.xml
rename to res/drawable/quickcontact_slider_btn.xml
diff --git a/res/drawable-finger/tab_bottom.xml b/res/drawable/tab_bottom.xml
similarity index 100%
rename from res/drawable-finger/tab_bottom.xml
rename to res/drawable/tab_bottom.xml
diff --git a/res/drawable-finger/tab_indicator_bg.xml b/res/drawable/tab_indicator_bg.xml
similarity index 100%
rename from res/drawable-finger/tab_indicator_bg.xml
rename to res/drawable/tab_indicator_bg.xml
diff --git a/res/layout-finger/contacts_list_content.xml b/res/layout-finger/contacts_list_content.xml
deleted file mode 100644
index 36c03ce..0000000
--- a/res/layout-finger/contacts_list_content.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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:id="@+id/pinned_header_list_layout"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical"
-        >
-
-    <view
-        class="com.android.contacts.PinnedHeaderListView" 
-        android:id="@android:id/list"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:fastScrollEnabled="true"
-    />
-
-    <include layout="@layout/contacts_list_empty"/>
-
-</LinearLayout>
diff --git a/res/layout-finger/contacts_list_content_join.xml b/res/layout-finger/contacts_list_content_join.xml
deleted file mode 100644
index b50713b..0000000
--- a/res/layout-finger/contacts_list_content_join.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical">
-
-    <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" 
-            android:orientation="horizontal"
-            android:background="@*android:drawable/title_bar_medium"
-            android:paddingLeft="5dip"
-            android:paddingRight="5dip"
-            android:gravity="center_vertical"
-            >
-    
-        <ImageView
-            android:layout_width="48dip"
-            android:layout_height="48dip"
-            android:src="@drawable/ic_join"
-            android:gravity="center"
-            android:scaleType="fitCenter"
-        />
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:paddingLeft="10dip">
-            <TextView
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:text="@string/titleJoinContactDataWith"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:shadowColor="#BB000000"
-                android:shadowRadius="2.75"
-            />
-            <TextView
-                android:id="@+id/join_contact_blurb"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="-2dip"
-                android:maxLines="2"
-                android:textAppearance="?android:attr/textAppearanceSmall"
-            />
-        </LinearLayout>
-    </LinearLayout>
-
-    <ListView android:id="@android:id/list"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:fastScrollEnabled="true"
-    />
-</LinearLayout>
-
diff --git a/res/layout-finger/contacts_list_empty.xml b/res/layout-finger/contacts_list_empty.xml
deleted file mode 100644
index 195da1e..0000000
--- a/res/layout-finger/contacts_list_empty.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?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.
--->
-<ScrollView 
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@android:id/empty"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:fillViewport="true"
->
-    <LinearLayout 
-      android:layout_width="match_parent"
-      android:layout_height="wrap_content"
-      android:orientation="vertical">
-      
-      <TextView android:id="@+id/emptyText"
-          android:layout_width="match_parent"
-          android:layout_height="wrap_content"
-          android:text="@string/noContacts"
-          android:textSize="20sp"
-          android:textColor="?android:attr/textColorSecondary"
-          android:paddingLeft="10dip"
-          android:paddingRight="10dip"
-          android:paddingTop="10dip"
-          android:lineSpacingMultiplier="0.92"
-      />
-      
-      <LinearLayout android:id="@+id/import_failure"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:gravity="fill_horizontal"
-        android:padding="20dip"
-        android:visibility="gone">
-        
-        <Button
-            android:id="@+id/import_failure_uninstall_apps"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"            
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:text="@string/upgrade_out_of_memory_uninstall"/>
-            
-        <Button
-            android:id="@+id/import_failure_retry_upgrade"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="10dip"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:text="@string/upgrade_out_of_memory_retry"/>
-      </LinearLayout>
-    </LinearLayout>
-</ScrollView>
diff --git a/res/layout-finger/contacts_list_search_results.xml b/res/layout-finger/contacts_list_search_results.xml
deleted file mode 100644
index 244ca80..0000000
--- a/res/layout-finger/contacts_list_search_results.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?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.
--->
-
-<LinearLayout
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@+id/pinned_header_list_layout"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical"
-        >
-
-    <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:background="@*android:drawable/title_bar_medium"
-            android:paddingLeft="10dip"
-            android:paddingRight="10dip"
-            android:gravity="center_vertical"
-            >
-
-        <TextView
-            android:id="@+id/search_results_for"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/titleJoinContactDataWith"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:shadowColor="#BB000000"
-            android:shadowRadius="2.75"
-        />
-
-        <TextView
-            android:id="@+id/search_results_found"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="-2dip"
-            android:textAppearance="?android:attr/textAppearanceSmall"
-        />
-
-    </LinearLayout>
-
-    <view
-        class="com.android.contacts.PinnedHeaderListView"
-        android:id="@android:id/list"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:fastScrollEnabled="true"
-    />
-
-    <include layout="@layout/contacts_list_empty"/>
-
-</LinearLayout>
diff --git a/res/layout-finger/contacts_search_content.xml b/res/layout-finger/contacts_search_content.xml
deleted file mode 100644
index ae72376..0000000
--- a/res/layout-finger/contacts_search_content.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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.
--->
-
-<LinearLayout
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@+id/pinned_header_list_layout"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical"
-        android:background="@color/translucent_search_background"
-        >
-
-    <include android:id="@+id/searchView"
-        layout="@layout/search_bar"/>
-
-    <ListView
-        android:id="@android:id/list"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:fastScrollEnabled="true"
-        android:background="@android:color/background_dark"
-    />
-
-    <!-- Transparent filler -->
-    <View android:id="@android:id/empty"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-    />
-</LinearLayout>
diff --git a/res/layout-finger/list_item_text_icons.xml b/res/layout-finger/list_item_text_icons.xml
deleted file mode 100644
index 69e064e..0000000
--- a/res/layout-finger/list_item_text_icons.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright 2009, 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:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:minHeight="?android:attr/listPreferredItemHeight"
-    android:orientation="horizontal"
-    android:paddingLeft="9dip"
-    android:gravity="center_vertical"
->
-
-    <LinearLayout
-        android:layout_width="0dip"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:layout_marginLeft="5dip"
-        android:orientation="vertical"
-        android:paddingTop="5dip"
-        android:paddingBottom="7dip"
-        android:gravity="center_vertical"
-    >
-
-        <TextView android:id="@android:id/text1"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textAppearance="?android:attr/textAppearanceLarge"
-        />
-
-        <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-        >
-            
-            <TextView android:id="@android:id/text2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_vertical"
-                android:textAppearance="?android:attr/textAppearanceSmall"
-            />
-    
-            <ImageView android:id="@+id/primary_icon"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_vertical"
-                android:paddingLeft="3dip"
-                android:src="@drawable/ic_default_number"
-            />
-
-        </LinearLayout>
-
-        <TextView
-            android:id="@+id/footer"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:visibility="gone" />
-
-    </LinearLayout>
-
-    <ImageView android:id="@+id/presence_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginLeft="5dip"
-        android:gravity="center"
-        android:scaleType="centerInside"
-    />
-
-    <ImageView android:id="@+id/action_icon"
-        android:layout_width="30dip"
-        android:layout_height="30dip"
-        android:layout_marginLeft="14dip"
-        android:layout_marginRight="14dip"
-        android:gravity="center"
-        android:scaleType="centerInside"
-    />
-    
-    <View android:id="@+id/divider"
-        android:layout_width="1px"
-        android:layout_height="match_parent"
-        android:layout_marginTop="5dip"
-        android:layout_marginBottom="5dip"
-        android:background="@drawable/divider_vertical_dark"
-    />
-
-    <ImageView android:id="@+id/secondary_action_button"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:layout_centerVertical="true"
-        android:paddingLeft="14dip"
-        android:paddingRight="14dip"
-        android:gravity="center"
-        android:scaleType="center"
-        android:background="@android:drawable/list_selector_background"
-    />
-
-</LinearLayout>
diff --git a/res/layout-finger/list_section.xml b/res/layout-finger/list_section.xml
deleted file mode 100644
index f7ba693..0000000
--- a/res/layout-finger/list_section.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<!-- Layout used for list section separators. -->
-<RelativeLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="25dip"
-    android:background="@*android:drawable/dark_header"
-    >
-    <TextView
-        android:id="@+id/header_text"
-        android:layout_width="56dip"
-        android:layout_height="wrap_content"
-        android:layout_centerVertical="true"
-        android:layout_alignParentLeft="true"
-        android:textStyle="bold"
-        android:textColor="@*android:color/dim_foreground_dark"
-        android:textSize="14sp"
-        android:gravity="center"
-    />
-</RelativeLayout>
diff --git a/res/layout-finger/quickcontact.xml b/res/layout-finger/quickcontact.xml
deleted file mode 100644
index 340ca3f..0000000
--- a/res/layout-finger/quickcontact.xml
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<view
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    class="com.android.contacts.ui.QuickContactWindow$RootLayout"
-    android:id="@+id/root"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:paddingLeft="@dimen/quickcontact_shadow_horiz"
-    android:paddingRight="@dimen/quickcontact_shadow_horiz"
-    android:background="@drawable/quickcontact_drop_shadow">
-
-    <FrameLayout
-        android:id="@+id/header"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="10dip">
-
-        <ViewStub
-            android:id="@+id/header_small"
-            android:inflatedId="@+id/header_small"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout="@layout/quickcontact_header_small" />
-
-        <ViewStub
-            android:id="@+id/header_medium"
-            android:inflatedId="@+id/header_medium"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout="@layout/quickcontact_header_med" />
-
-        <ViewStub
-            android:id="@+id/header_large"
-            android:inflatedId="@+id/header_large"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout="@layout/quickcontact_header_large" />
-
-    </FrameLayout>
-
-    <HorizontalScrollView
-        android:id="@+id/scroll"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/header"
-        android:fadingEdgeLength="0dip"
-        android:background="@drawable/quickcontact_slider_background"
-        android:scrollbars="none">
-
-        <LinearLayout
-            android:id="@+id/quickcontact"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:paddingTop="4dip"
-            android:paddingBottom="4dip"
-            android:orientation="horizontal">
-
-            <ImageView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:src="@drawable/quickcontact_slider_grip_left" />
-
-            <ImageView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:src="@drawable/quickcontact_slider_grip_right" />
-
-        </LinearLayout>
-
-    </HorizontalScrollView>
-
-    <FrameLayout
-        android:id="@+id/footer"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/scroll"
-        android:background="@drawable/quickcontact_bottom_frame" />
-
-    <LinearLayout
-        android:id="@+id/footer_disambig"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/scroll"
-        android:background="@drawable/quickcontact_disambig_bottom_bg"
-        android:orientation="vertical"
-        android:visibility="gone">
-
-        <ListView
-            android:id="@android:id/list"
-            android:layout_width="match_parent"
-            android:layout_height="0dip"
-            android:layout_weight="1"
-            android:background="@color/quickcontact_disambig"
-            android:divider="@drawable/quickcontact_disambig_divider"
-            android:cacheColorHint="@null" />
-
-        <CheckBox
-            android:id="@android:id/checkbox"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="19dip"
-            android:layout_marginRight="19dip"
-            android:minHeight="60dip"
-            android:textColor="#f000"
-            android:textStyle="bold"
-            android:text="@string/quickcontact_remember_choice"
-            android:textAppearance="?android:attr/textAppearanceSmallInverse"
-            android:button="@drawable/quickcontact_disambig_checkbox" />
-
-    </LinearLayout>
-
-    <ImageView
-        android:id="@+id/arrow_up"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:src="@drawable/quickcontact_arrow_up" />
-
-    <ImageView
-        android:id="@+id/arrow_down"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="-1dip"
-        android:layout_below="@id/footer"
-        android:src="@drawable/quickcontact_arrow_down" />
-
-    <ImageView
-        android:id="@+id/arrow_down_stub"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="-1dip"
-        android:layout_below="@id/footer_disambig"
-        android:visibility="invisible"
-        android:src="@drawable/quickcontact_arrow_down" />
-
-</view>
diff --git a/res/layout-finger/quickcontact_item.xml b/res/layout-finger/quickcontact_item.xml
deleted file mode 100644
index 8580ac5..0000000
--- a/res/layout-finger/quickcontact_item.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<com.android.contacts.ui.widget.CheckableImageView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="59dip"
-    android:layout_height="51dip"
-    android:paddingLeft="12dip"
-    android:paddingRight="12dip"
-    android:paddingTop="8dip"
-    android:paddingBottom="8dip"
-    android:scaleType="centerInside"
-    android:focusable="true"
-    android:clickable="true"
-    android:background="@drawable/quickcontact_slider_btn" />
diff --git a/res/layout-finger/recent_calls_list_child_item.xml b/res/layout-finger/recent_calls_list_child_item.xml
deleted file mode 100644
index 14eb24d..0000000
--- a/res/layout-finger/recent_calls_list_child_item.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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.
--->
-
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="?android:attr/listPreferredItemHeight"
-    android:paddingLeft="7dip"
-    android:background="@drawable/list_item_background_secondary"
->
-
-    <com.android.contacts.ui.widget.DontPressWithParentImageView android:id="@+id/call_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:paddingLeft="14dip"
-        android:paddingRight="14dip"
-        android:layout_alignParentRight="true"
-
-        android:gravity="center_vertical"
-        android:src="@android:drawable/sym_action_call"
-        android:background="@drawable/call_background_secondary"
-    />
-
-    <include layout="@layout/recent_calls_list_item_layout"/>
-
-</RelativeLayout>
diff --git a/res/layout-finger/recent_calls_list_group_item.xml b/res/layout-finger/recent_calls_list_group_item.xml
deleted file mode 100644
index 79e7bb9..0000000
--- a/res/layout-finger/recent_calls_list_group_item.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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.
--->
-
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="?android:attr/listPreferredItemHeight"
-    android:paddingLeft="7dip"
->
-
-    <com.android.contacts.ui.widget.DontPressWithParentImageView android:id="@+id/call_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:paddingLeft="14dip"
-        android:paddingRight="14dip"
-        android:layout_alignParentRight="true"
-
-        android:gravity="center_vertical"
-        android:src="@android:drawable/sym_action_call"
-        android:background="@drawable/call_background"
-    />
-
-    <View android:id="@+id/divider"
-        android:layout_width="1px"
-        android:layout_height="match_parent"
-        android:layout_marginTop="5dip"
-        android:layout_marginBottom="5dip"
-        android:layout_toLeftOf="@id/call_icon"
-        android:layout_marginLeft="11dip"
-        android:background="@drawable/divider_vertical_dark"
-    />
-
-    <TextView android:id="@+id/date"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_toLeftOf="@id/divider"
-        android:layout_alignParentBottom="true"
-        android:layout_marginBottom="8dip"
-        android:layout_marginLeft="10dip"
-
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:singleLine="true"
-    />
-
-    <TextView android:id="@+id/label"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentBottom="true"
-        android:layout_marginLeft="36dip"
-        android:layout_marginRight="5dip"
-        android:layout_alignBaseline="@id/date"
-
-        android:singleLine="true"
-        android:ellipsize="marquee"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textStyle="bold"
-    />
-
-    <TextView android:id="@+id/number"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_toRightOf="@id/label"
-        android:layout_toLeftOf="@id/date"
-        android:layout_alignBaseline="@id/label"
-        android:layout_alignWithParentIfMissing="true"
-
-        android:singleLine="true"
-        android:ellipsize="marquee"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-    />
-
-    <TextView android:id="@+id/groupSize"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:layout_toLeftOf="@id/divider"
-        android:layout_above="@id/date"
-        android:layout_alignWithParentIfMissing="true"
-        android:layout_marginBottom="-10dip"
-
-        android:textAppearance="?android:attr/textAppearanceLarge"
-        android:singleLine="true"
-        android:gravity="center_vertical"
-    />
-
-    <TextView android:id="@+id/line1"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:layout_toLeftOf="@+id/groupSize"
-        android:layout_above="@id/date"
-        android:layout_alignWithParentIfMissing="true"
-        android:layout_marginLeft="36dip"
-        android:layout_marginBottom="-10dip"
-
-        android:textAppearance="?android:attr/textAppearanceLarge"
-        android:singleLine="true"
-        android:ellipsize="marquee"
-        android:gravity="center_vertical"
-    />
-
-    <ImageView
-        android:id="@+id/groupIndicator"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_centerVertical="true"
-        android:src="@*android:drawable/expander_ic_minimized"
-        android:gravity="center_vertical"
-    />
-</RelativeLayout>
diff --git a/res/layout-finger/recent_calls_list_item.xml b/res/layout-finger/recent_calls_list_item.xml
deleted file mode 100644
index 8efa23c..0000000
--- a/res/layout-finger/recent_calls_list_item.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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.
--->
-
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="?android:attr/listPreferredItemHeight"
-    android:paddingLeft="7dip"
->
-
-    <com.android.contacts.ui.widget.DontPressWithParentImageView android:id="@+id/call_icon"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:paddingLeft="14dip"
-        android:paddingRight="14dip"
-        android:layout_alignParentRight="true"
-
-        android:gravity="center_vertical"
-        android:src="@android:drawable/sym_action_call"
-        android:background="@drawable/call_background"
-    />
-
-    <include layout="@layout/recent_calls_list_item_layout"/>
-
-</RelativeLayout>
diff --git a/res/layout-finger/search_bar.xml b/res/layout-finger/search_bar.xml
deleted file mode 100644
index d322948..0000000
--- a/res/layout-finger/search_bar.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?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.
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/search_bar"
-    android:layout_width="match_parent"
-    android:layout_height="64dip"
-    android:orientation="vertical"
-    android:focusable="true"
-    android:descendantFocusability="afterDescendants"
-    android:background="@drawable/bg_blk_search_contact">
-
-    <!-- Outer layout defines the entire search bar at the top of the screen -->
-    <LinearLayout
-        android:id="@+id/search_plate"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:paddingLeft="4dip"
-        android:paddingRight="10dip"
-        android:paddingTop="6dip"
-        android:paddingBottom="0dip"        
-        >
-
-        <!-- Inner layout contains the app icon, button(s) and EditText -->
-        <LinearLayout
-            android:id="@+id/search_edit_frame"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal">
-
-            <ImageView 
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" 
-                android:src="@drawable/ic_launcher_contacts"
-                android:layout_marginRight="7dip"
-                android:layout_gravity="center_vertical"
-                android:scaleType="centerInside" />
-              
-            <view
-                class="com.android.contacts.SearchEditText"
-                android:id="@+id/search_src_text"
-                android:layout_height="wrap_content"
-                android:layout_width="0dip"
-                android:layout_weight="1.0"
-                android:layout_marginLeft="4dip"
-                android:layout_marginBottom="0dip"
-                android:singleLine="true"
-                android:ellipsize="end"
-                android:inputType="textNoSuggestions"
-                android:imeOptions="flagNoExtractUi"
-                android:hint="@string/search_bar_hint"
-                android:drawableRight="@drawable/magnifying_glass"
-                android:freezesText="true"
-            />
-        </LinearLayout>
-        
-    </LinearLayout>
-
-</LinearLayout>
diff --git a/res/layout-land-finger/twelve_key_dialer.xml b/res/layout-land/twelve_key_dialer.xml
similarity index 100%
rename from res/layout-land-finger/twelve_key_dialer.xml
rename to res/layout-land/twelve_key_dialer.xml
diff --git a/res/layout-long-land-finger/twelve_key_dialer.xml b/res/layout-long-land/twelve_key_dialer.xml
similarity index 100%
rename from res/layout-long-land-finger/twelve_key_dialer.xml
rename to res/layout-long-land/twelve_key_dialer.xml
diff --git a/res/layout-long-finger/dialpad.xml b/res/layout-long/dialpad.xml
similarity index 100%
rename from res/layout-long-finger/dialpad.xml
rename to res/layout-long/dialpad.xml
diff --git a/res/layout-long-finger/twelve_key_dialer.xml b/res/layout-long/twelve_key_dialer.xml
similarity index 100%
rename from res/layout-long-finger/twelve_key_dialer.xml
rename to res/layout-long/twelve_key_dialer.xml
diff --git a/res/layout-long-finger/voicemail_dial_delete.xml b/res/layout-long/voicemail_dial_delete.xml
similarity index 100%
rename from res/layout-long-finger/voicemail_dial_delete.xml
rename to res/layout-long/voicemail_dial_delete.xml
diff --git a/res/layout-xlarge/aggregation_suggestions.xml b/res/layout-xlarge/aggregation_suggestions.xml
new file mode 100644
index 0000000..81b4edd
--- /dev/null
+++ b/res/layout-xlarge/aggregation_suggestions.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 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.
+ */
+-->
+
+<com.android.contacts.widget.InterpolatingLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:paddingBottom="20dip">
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:background="@drawable/aggregation_suggestions_bg_light_holo"
+        android:minWidth="100dip"
+        android:paddingBottom="10dip"
+        ex:layout_narrowParentWidth="600dip"
+        ex:layout_narrowWidth="400dip"
+        ex:layout_wideParentWidth="300dip"
+        ex:layout_wideWidth="240dip">
+        <TextView
+            android:id="@+id/aggregation_suggestion_title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentTop="true"
+            android:layout_alignParentLeft="true"
+            android:layout_marginLeft="5dip"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="?android:attr/textColorTertiary"
+            android:textStyle="bold" />
+
+        <LinearLayout
+            android:id="@+id/aggregation_suggestions"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical" />
+    </LinearLayout>
+</com.android.contacts.widget.InterpolatingLayout>
\ No newline at end of file
diff --git a/res/layout-xlarge/aggregation_suggestions_item.xml b/res/layout-xlarge/aggregation_suggestions_item.xml
new file mode 100644
index 0000000..865c492
--- /dev/null
+++ b/res/layout-xlarge/aggregation_suggestions_item.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 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.
+ */
+-->
+
+<view xmlns:android="http://schemas.android.com/apk/res/android"
+    class="com.android.contacts.views.editor.AggregationSuggestionView"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal"
+    android:paddingLeft="5dip"
+    android:paddingRight="15dip"
+>
+    <Button
+        android:id="@+id/aggregation_suggestion_join_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/aggregation_suggestion_join_button"
+        android:layout_centerInParent="true"
+        android:layout_alignParentRight="true"
+    />
+
+    <Button
+        android:id="@+id/aggregation_suggestion_edit_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/aggregation_suggestion_edit_button"
+        android:layout_centerInParent="true"
+        android:layout_alignParentRight="true"
+    />
+
+    <ImageView
+        android:id="@+id/aggregation_suggestion_photo"
+        android:layout_width="@dimen/aggregation_suggestion_icon_size"
+        android:layout_height="@dimen/aggregation_suggestion_icon_size"
+        android:layout_alignParentLeft="true"
+        android:layout_centerInParent="true"
+        android:layout_marginTop="4dip"
+        android:scaleType="fitCenter"
+    />
+
+    <TextView
+        android:id="@+id/aggregation_suggestion_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@id/aggregation_suggestion_photo"
+        android:layout_toLeftOf="@id/aggregation_suggestion_join_button"
+        android:layout_marginLeft="10dip"
+        android:layout_marginTop="4dip"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="?android:attr/textColorSecondary"
+    />
+
+    <TextView
+        android:id="@+id/aggregation_suggestion_data"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@id/aggregation_suggestion_photo"
+        android:layout_toLeftOf="@id/aggregation_suggestion_join_button"
+        android:layout_below="@id/aggregation_suggestion_name"
+        android:layout_marginLeft="10dip"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="?android:attr/textColorSecondary"
+    />
+</view>
diff --git a/res/layout-xlarge/contact_browser.xml b/res/layout-xlarge/contact_browser.xml
new file mode 100644
index 0000000..b04fab0
--- /dev/null
+++ b/res/layout-xlarge/contact_browser.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<com.android.contacts.widget.InterpolatingLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
+    android:id="@+id/two_pane_activity"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:splitMotionEvents="true">
+
+    <FrameLayout
+        android:id="@+id/list_container"
+        android:layout_height="match_parent"
+        android:layout_width="wrap_content"
+        android:minWidth="100dip"
+        ex:layout_narrowParentWidth="800dip"
+        ex:layout_narrowWidth="310dip"
+        ex:layout_wideParentWidth="1280dip"
+        ex:layout_wideWidth="430dip"
+    />
+
+    <!--  Holder for detail- or editor-fragment. -->
+    <FrameLayout
+        android:id="@+id/detail_container"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:paddingBottom="48dip"
+        ex:layout_narrowParentWidth="800dip"
+        ex:layout_narrowRightMargin="0dip"
+        ex:layout_wideParentWidth="1280dip"
+        ex:layout_wideRightMargin="48dip"
+        />
+
+</com.android.contacts.widget.InterpolatingLayout>
diff --git a/res/layout-xlarge/contact_detail_fragment.xml b/res/layout-xlarge/contact_detail_fragment.xml
new file mode 100644
index 0000000..b01789e
--- /dev/null
+++ b/res/layout-xlarge/contact_detail_fragment.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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"
+    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
+    android:id="@+id/contact_detail"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@drawable/panel_message">
+
+    <!-- Header View (including social status) -->
+    <com.android.contacts.widget.InterpolatingLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <com.android.contacts.views.detail.ContactDetailHeaderView
+            android:id="@+id/contact_header_widget"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            ex:layout_wideParentWidth="800dip"
+            ex:layout_wideLeftMargin="80dip"
+            ex:layout_narrowParentWidth="500dip"
+            ex:layout_narrowLeftMargin="15dip"
+        />
+    </com.android.contacts.widget.InterpolatingLayout>
+
+    <!-- Placeholder for empty list -->
+    <com.android.contacts.widget.InterpolatingLayout
+        android:id="@android:id/empty"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:visibility="gone">
+        <TextView android:id="@+id/emptyText"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/no_contact_details"
+            android:textSize="20sp"
+            android:textColor="?android:attr/textColorSecondary"
+            ex:layout_wideParentWidth="800dip"
+            ex:layout_wideLeftMargin="144dip"
+            ex:layout_narrowParentWidth="500dip"
+            ex:layout_narrowLeftMargin="42dip"
+            android:paddingTop="10dip"
+            android:lineSpacingMultiplier="0.92"
+        />
+    </com.android.contacts.widget.InterpolatingLayout>
+
+    <!-- Real list -->
+    <com.android.contacts.widget.InterpolatingLayout
+        android:layout_width="match_parent"
+        android:layout_height="0px"
+        android:layout_weight="1">
+        <ListView android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            ex:layout_wideParentWidth="800dip"
+            ex:layout_wideLeftMargin="124dip"
+            ex:layout_wideRightMargin="64dip"
+            ex:layout_narrowParentWidth="500dip"
+            ex:layout_narrowLeftMargin="32dip"
+            ex:layout_narrowRightMargin="0dip"
+            android:cacheColorHint="#00000000"
+            android:divider="#ffe5e5e5"
+            android:dividerHeight="1px"
+        />
+    </com.android.contacts.widget.InterpolatingLayout>
+    
+    <!-- "Copy to my contacts"- button -->
+    <Button
+        android:id="@+id/copyLocal"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/menu_copyContact"
+        android:visibility="gone"
+        android:layout_gravity="right"
+        android:layout_marginRight="40dip"
+        android:layout_marginTop="20dip"
+        android:layout_marginBottom="20dip" />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-xlarge/contact_detail_header_view.xml b/res/layout-xlarge/contact_detail_header_view.xml
new file mode 100644
index 0000000..f2ddd52
--- /dev/null
+++ b/res/layout-xlarge/contact_detail_header_view.xml
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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:id="@+id/banner"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal"
+    android:paddingTop="40dip"
+    android:paddingRight="5dip">
+
+    <ImageView android:id="@+id/photo"
+        android:layout_marginRight="8dip"
+        android:layout_marginLeft="-1dip"
+        android:layout_width="96dip"
+        android:layout_height="96dip"
+        android:src="@*android:drawable/ic_contact_picture"
+    />
+
+    <LinearLayout
+        android:layout_width="0px"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="vertical">
+
+        <!-- Name, PhoneticName, Directory -->
+        <LinearLayout
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:paddingLeft="64dip"
+            android:orientation="vertical" >
+
+            <TextView android:id="@+id/name"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:ellipsize="end"
+                android:textSize="26sp"
+            />
+
+            <TextView android:id="@+id/phonetic_name"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textAppearance="?android:attr/textAppearanceSmall"
+                android:singleLine="true"
+                android:ellipsize="end"
+                android:layout_marginTop="-2dip"
+                android:visibility="gone"
+            />
+
+            <TextView android:id="@+id/organization"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:ellipsize="end"
+                android:layout_marginTop="-2dip"
+                android:visibility="gone"
+                android:textColor="#999999"
+                android:textAppearance="?android:attr/textAppearanceLarge"
+            />
+
+            <TextView android:id="@+id/directory_name"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textAppearance="?android:attr/textAppearanceSmall"
+                android:textColor="?android:attr/textColorSecondary"
+                android:singleLine="true"
+                android:ellipsize="end"
+                android:layout_marginTop="-2dip"
+                android:visibility="gone"
+            />
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+            <!-- Status info -->
+            <LinearLayout
+                android:id="@+id/status_container"
+                android:layout_width="0px"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:orientation="vertical"
+                android:background="@drawable/social_bubble"
+                android:layout_marginTop="30dip"
+                android:paddingLeft="64dip"
+                android:paddingTop="16dip"
+                android:paddingRight="16dip"
+                android:paddingBottom="16dip"
+                android:visibility="gone">
+    
+                <TextView android:id="@+id/status"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:textColor="#66666666"
+                    android:maxLines="2"
+                    android:ellipsize="end"
+                    android:visibility="gone"
+                />
+    
+                <TextView android:id="@+id/status_date"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dip"
+                    android:layout_weight="1"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:textColor="#66666666"
+                    android:visibility="gone"
+                />
+            </LinearLayout>
+
+            <!-- Presence -->
+            <ImageView
+                android:id="@+id/presence"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_vertical"
+                android:paddingLeft="3dip"
+                android:paddingRight="6dip"
+                android:visibility="gone"
+            />
+
+            <!-- Star -->
+            <CheckBox
+                android:id="@+id/star"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_vertical"
+                android:contentDescription="@string/description_star"
+                style="?android:attr/starStyle" />
+        </LinearLayout>
+    </LinearLayout>
+</LinearLayout>
diff --git a/res/layout-xlarge/contact_detail_list_item.xml b/res/layout-xlarge/contact_detail_list_item.xml
new file mode 100644
index 0000000..8de118c
--- /dev/null
+++ b/res/layout-xlarge/contact_detail_list_item.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 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.
+ */
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:orientation="horizontal"
+    android:paddingLeft="9dip"
+    android:gravity="center_vertical"
+>
+    <TextView android:id="@+id/kind"
+        android:layout_width="120dip"
+        android:layout_height="wrap_content"
+        android:textColor="#7F7F7F"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+    />
+
+    <TextView android:id="@+id/type"
+        android:layout_width="100dip"
+        android:layout_height="wrap_content"
+        android:textColor="#999999"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+    />
+
+    <TextView android:id="@+id/data"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:layout_weight="1"
+        android:layout_marginLeft="8dip"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+    />
+
+    <ImageView android:id="@+id/primary_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:paddingLeft="3dip"
+        android:src="@drawable/ic_default_number"
+    />
+
+    <TextView
+        android:id="@+id/footer"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:visibility="gone" />
+
+    <ImageView android:id="@+id/presence_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="5dip"
+        android:gravity="center"
+        android:scaleType="centerInside"
+    />
+
+    <ImageView android:id="@+id/action_icon"
+        android:layout_width="30dip"
+        android:layout_height="30dip"
+        android:layout_marginLeft="14dip"
+        android:layout_marginRight="14dip"
+        android:gravity="center"
+        android:scaleType="centerInside"
+    />
+    
+    <View android:id="@+id/divider"
+        android:layout_width="1px"
+        android:layout_height="match_parent"
+        android:layout_marginTop="5dip"
+        android:layout_marginBottom="5dip"
+        android:background="@drawable/divider_vertical_dark"
+    />
+
+    <ImageView android:id="@+id/secondary_action_button"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_centerVertical="true"
+        android:paddingLeft="14dip"
+        android:paddingRight="14dip"
+        android:gravity="center"
+        android:scaleType="center"
+        android:background="@android:drawable/list_selector_background"
+    />
+
+</LinearLayout>
diff --git a/res/layout-xlarge/contact_editor_activity.xml b/res/layout-xlarge/contact_editor_activity.xml
new file mode 100644
index 0000000..61c526f
--- /dev/null
+++ b/res/layout-xlarge/contact_editor_activity.xml
@@ -0,0 +1,38 @@
+<?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.
+-->
+
+<ScrollView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:fillViewport="true">
+    <com.android.contacts.widget.InterpolatingLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+        <fragment class="com.android.contacts.views.editor.ContactEditorFragment"
+            android:id="@+id/contact_editor_fragment"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            ex:layout_wideParentWidth="1280dip"
+            ex:layout_wideLeftMargin="160dip"
+            ex:layout_wideRightMargin="160dip"
+            ex:layout_narrowParentWidth="800dip"
+            ex:layout_narrowLeftMargin="0dip"
+            ex:layout_narrowRightMargin="0dip"
+         />
+    </com.android.contacts.widget.InterpolatingLayout>
+</ScrollView>
diff --git a/res/layout-xlarge/contact_editor_fragment.xml b/res/layout-xlarge/contact_editor_fragment.xml
new file mode 100644
index 0000000..0d01214
--- /dev/null
+++ b/res/layout-xlarge/contact_editor_fragment.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 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"
+    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
+    android:id="@+id/editors"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@drawable/panel_message"
+    android:orientation="vertical"
+/>
diff --git a/res/layout-xlarge/contact_picker_content.xml b/res/layout-xlarge/contact_picker_content.xml
new file mode 100644
index 0000000..9112073
--- /dev/null
+++ b/res/layout-xlarge/contact_picker_content.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal"
+    >
+
+    <view
+        class="com.android.contacts.list.ContactListAizyView"
+        android:id="@+id/contacts_list_aizy"
+        android:layout_width="40dip"
+        android:layout_height="match_parent"
+    />
+
+    <LinearLayout
+        android:layout_width="0px"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:layout_weight="1"
+        >
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="2dip"
+            android:layout_marginTop="1dip"
+            android:layout_marginBottom="1dip"
+            android:background="#7e7e87"
+        />
+
+        <view
+            class="com.android.contacts.list.ContactEntryListView"
+            android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:fastScrollEnabled="true"
+            android:layout_weight="1"
+            android:scrollingCache="false"
+        />
+
+        <include layout="@layout/contacts_list_empty"/>
+
+        <ViewStub android:id="@+id/footer_stub"
+            android:layout="@layout/footer_panel"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+        />
+    </LinearLayout>
+</LinearLayout>
diff --git a/res/layout-xlarge/contacts_list_content.xml b/res/layout-xlarge/contacts_list_content.xml
new file mode 100644
index 0000000..a025751
--- /dev/null
+++ b/res/layout-xlarge/contacts_list_content.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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:id="@+id/pinned_header_list_layout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal"
+    >
+
+    <view
+        class="com.android.contacts.list.ContactListAizyView"
+        android:id="@+id/contacts_list_aizy"
+        android:layout_width="40dip"
+        android:layout_height="match_parent"
+    />
+
+    <LinearLayout
+        android:layout_width="0px"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:layout_weight="1"
+        >
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="2dip"
+            android:layout_marginTop="1dip"
+            android:layout_marginBottom="1dip"
+            android:background="#7e7e87"
+        />
+
+        <view
+            class="com.android.contacts.list.ContactEntryListView"
+            android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:fastScrollEnabled="true"
+            android:layout_weight="1"
+            android:scrollingCache="false"
+        />
+
+        <include layout="@layout/contacts_list_empty"/>
+
+        <ViewStub android:id="@+id/footer_stub"
+            android:layout="@layout/footer_panel"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+        />
+    </LinearLayout>
+</LinearLayout>
diff --git a/res/layout-xlarge/item_contact_editor.xml b/res/layout-xlarge/item_contact_editor.xml
new file mode 100644
index 0000000..f44e4c3
--- /dev/null
+++ b/res/layout-xlarge/item_contact_editor.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 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.
+-->
+
+<com.android.contacts.views.editor.RawContactEditorView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+>
+
+    <!-- Account info header -->
+    <RelativeLayout android:id="@+id/header"
+        android:layout_height="64dip"
+        android:layout_width="match_parent"
+        android:background="@android:drawable/list_selector_background"
+    >
+
+        <ImageView android:id="@+id/header_color_bar"
+            android:layout_width="match_parent"
+            android:layout_height="4dip"
+            android:layout_marginBottom="5dip"
+            android:background="@color/edit_divider"
+        />
+
+        <ImageView android:id="@+id/header_icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="7dip"
+            android:layout_marginRight="7dip"
+            android:layout_centerVertical="true"
+            android:layout_alignParentRight="true"
+            android:layout_below="@id/header_color_bar"
+        />
+
+        <TextView android:id="@+id/header_account_type"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_toLeftOf="@+id/header_icon"
+            android:layout_alignTop="@id/header_icon"
+            android:layout_marginTop="-4dip"
+
+            android:textSize="24sp"
+            android:textColor="?android:attr/textColorPrimary"
+            android:singleLine="true"
+        />
+
+        <TextView android:id="@+id/header_account_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_toLeftOf="@+id/header_icon"
+            android:layout_alignBottom="@+id/header_icon"
+            android:layout_marginBottom="2dip"
+
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textColor="?android:attr/textColorPrimary"
+            android:singleLine="true"
+        />
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:layout_alignParentBottom="true"
+
+            android:background="?android:attr/listDivider"
+        />
+    </RelativeLayout>
+
+    <LinearLayout
+        android:id="@+id/body"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:paddingTop="10dip"
+        >
+
+        <com.android.contacts.widget.InterpolatingLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+            <FrameLayout
+                android:id="@+id/stub_photo"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                ex:layout_wideParentWidth="960dip"
+                ex:layout_wideLeftMargin="128dip"
+                ex:layout_narrowParentWidth="800dip"
+                ex:layout_narrowLeftMargin="15dip"
+                >
+
+                <include
+                    android:id="@+id/edit_photo"
+                    layout="@layout/item_photo_editor" />
+
+            </FrameLayout>
+        </com.android.contacts.widget.InterpolatingLayout>
+
+        <com.android.contacts.widget.InterpolatingLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                ex:layout_wideParentWidth="960dip"
+                ex:layout_wideLeftMargin="230dip"
+                ex:layout_wideRightMargin="50dip"
+                ex:layout_narrowParentWidth="800dip"
+                ex:layout_narrowLeftMargin="160dip"
+                ex:layout_narrowRightMargin="50dip"
+                >
+
+                <com.android.contacts.views.editor.FieldEditorView
+                    android:id="@+id/edit_name"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:paddingRight="?android:attr/scrollbarSize"
+                    android:layout_below="@id/stub_photo"
+                    android:layout_marginTop="6dip"
+                    android:layout_marginBottom="4dip" />
+
+                <ViewStub android:id="@+id/aggregation_suggestion_stub"
+                    android:inflatedId="@+id/aggregation_suggestion"
+                    android:layout="@layout/aggregation_suggestions"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:visibility="visible"/>
+
+                <LinearLayout
+                    android:id="@+id/sect_fields"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:orientation="vertical"
+                    android:paddingRight="?android:attr/scrollbarSize"
+                />
+            </LinearLayout>
+        </com.android.contacts.widget.InterpolatingLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:layout_alignParentBottom="true"
+            android:background="?android:attr/listDivider"
+        />
+
+        <Button
+            android:id="@+id/button_add_field"
+            android:text="@string/add_field"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="right"
+            android:layout_marginTop="10dip"
+        />
+    </LinearLayout>
+</com.android.contacts.views.editor.RawContactEditorView>
diff --git a/res/layout-xlarge/item_group_membership.xml b/res/layout-xlarge/item_group_membership.xml
new file mode 100644
index 0000000..4ce0eb4
--- /dev/null
+++ b/res/layout-xlarge/item_group_membership.xml
@@ -0,0 +1,44 @@
+<?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.
+-->
+
+<!-- the body surrounding all editors for a specific kind -->
+
+<com.android.contacts.views.editor.GroupMembershipView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:orientation="horizontal">
+
+    <TextView
+        android:id="@+id/kind_title"
+        android:layout_width="100dip"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:singleLine="true"
+        android:ellipsize="marquee" />
+
+    <TextView
+        android:id="@+id/group_list"
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:background="@drawable/group_membership_edit_background"
+        android:gravity="left"
+        android:ellipsize="end"
+    />
+</com.android.contacts.views.editor.GroupMembershipView>
diff --git a/res/layout-xlarge/item_kind_section.xml b/res/layout-xlarge/item_kind_section.xml
new file mode 100644
index 0000000..9ab5d97
--- /dev/null
+++ b/res/layout-xlarge/item_kind_section.xml
@@ -0,0 +1,53 @@
+<?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.
+-->
+
+<!-- the body surrounding all editors for a specific kind -->
+
+<com.android.contacts.views.editor.KindSectionView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal">
+
+    <TextView
+        android:id="@+id/kind_title"
+        android:layout_width="100dip"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:singleLine="true"
+        android:ellipsize="marquee" />
+
+    <LinearLayout
+        android:id="@+id/kind_editors"
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:layout_gravity="bottom"
+        android:orientation="vertical" />
+
+    <ImageButton
+        android:id="@+id/kind_plus"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="bottom"
+        android:paddingLeft="@dimen/editor_round_button_padding_left"
+        android:paddingRight="@dimen/editor_round_button_padding_right"
+        android:paddingTop="@dimen/editor_round_button_padding_top"
+        android:paddingBottom="@dimen/editor_round_button_padding_bottom"
+        android:src="@drawable/btn_plus"
+        android:background="@null"
+        android:contentDescription="@string/description_plus_button" />
+</com.android.contacts.views.editor.KindSectionView>
diff --git a/res/layout-xlarge/item_photo_editor.xml b/res/layout-xlarge/item_photo_editor.xml
new file mode 100644
index 0000000..35ade24
--- /dev/null
+++ b/res/layout-xlarge/item_photo_editor.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 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.
+-->
+
+<com.android.contacts.views.editor.PhotoEditorView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="@dimen/edit_photo_size"
+    android:layout_height="@dimen/edit_photo_size"
+    android:clickable="true"
+    android:focusable="true"
+    android:src="@drawable/ic_menu_add_picture"
+    android:cropToPadding="true"
+    android:scaleType="center"
+    android:background="@drawable/btn_contact_picture"
+    android:contentDescription="@string/description_contact_photo"
+    android:gravity="center" />
diff --git a/res/layout-xlarge/list_section.xml b/res/layout-xlarge/list_section.xml
new file mode 100644
index 0000000..c684a0f
--- /dev/null
+++ b/res/layout-xlarge/list_section.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<!-- Layout used for list section separators. -->
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="37dip"
+    android:background="@drawable/section_header_holo"
+    >
+    <TextView
+        android:id="@+id/header_text"
+        android:layout_width="56dip"
+        android:layout_height="wrap_content"
+        android:layout_centerVertical="true"
+        android:layout_alignParentLeft="true"
+        android:textStyle="bold"
+        android:textColor="@color/section_header_text_color"
+        android:textSize="14sp"
+        android:gravity="center"
+    />
+</RelativeLayout>
diff --git a/res/layout-xlarge/search_header.xml b/res/layout-xlarge/search_header.xml
new file mode 100644
index 0000000..e543883
--- /dev/null
+++ b/res/layout-xlarge/search_header.xml
@@ -0,0 +1,42 @@
+<?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.
+-->
+
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    style="DirectoryHeader"
+    android:layout_width="match_parent"
+    android:layout_height="56dip">
+    <TextView
+        android:id="@+id/totalContactsText"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:layout_centerVertical="true"
+        android:layout_alignParentLeft="true"
+        android:layout_marginLeft="8dip"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="?android:attr/textColorTertiary"
+        android:textStyle="bold" />
+
+    <ProgressBar
+        android:id="@+id/progress"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        style="?android:attr/progressBarStyleSmall"
+        android:layout_alignParentRight="true"
+        android:layout_centerVertical="true"
+        android:layout_marginRight="10dip" />
+
+</RelativeLayout>
diff --git a/res/layout-xlarge/total_contacts.xml b/res/layout-xlarge/total_contacts.xml
new file mode 100644
index 0000000..8c05119
--- /dev/null
+++ b/res/layout-xlarge/total_contacts.xml
@@ -0,0 +1,36 @@
+<?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.
+-->
+
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="47dip"
+    android:paddingLeft="5dp"
+    android:paddingRight="7dp"
+    >
+
+    <TextView
+        android:id="@+id/totalContactsText"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:textColor="#ff666666"
+        android:textSize="14sp"
+        android:textStyle="normal"
+        android:layout_alignParentLeft="true"
+        android:gravity="center_vertical"
+    />
+
+</RelativeLayout>
diff --git a/res/layout/account_selector_list_item.xml b/res/layout/account_selector_list_item.xml
new file mode 100644
index 0000000..38acfc5
--- /dev/null
+++ b/res/layout/account_selector_list_item.xml
@@ -0,0 +1,45 @@
+<?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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+>
+    <ImageView android:id="@android:id/icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="6dip"
+        android:layout_centerVertical="true"
+    />
+
+    <TextView android:id="@android:id/text1"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="6dip"
+        android:layout_marginTop="6dip"
+        android:layout_toRightOf="@android:id/icon"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+    />
+
+    <TextView android:id="@android:id/text2"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@android:id/text1"
+        android:layout_alignLeft="@android:id/text1"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+    />
+</RelativeLayout>
diff --git a/res/layout/act_edit.xml b/res/layout/act_edit.xml
deleted file mode 100644
index 2a71717..0000000
--- a/res/layout/act_edit.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical"
->
-
-    <ScrollView 
-        android:layout_width="match_parent"
-        android:layout_height="1px"
-        android:layout_weight="1"
-        android:fillViewport="true"
-    >
-
-        <LinearLayout android:id="@+id/editors"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical"
-        />
-
-    </ScrollView>
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        style="@android:style/ButtonBar"
-    >
-
-        <Button android:id="@+id/btn_done"
-            android:layout_width="0dip"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:text="@string/menu_done"
-        />
-
-        <Button android:id="@+id/btn_discard"
-            android:layout_width="0dip"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:text="@string/menu_doNotSave"
-        />
-
-    </LinearLayout>
-
-</LinearLayout>
diff --git a/res/layout/aggregation_suggestions.xml b/res/layout/aggregation_suggestions.xml
new file mode 100644
index 0000000..0542daa
--- /dev/null
+++ b/res/layout/aggregation_suggestions.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 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.
+ */
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:background="@drawable/aggregation_suggestions_bg">
+    <TextView
+        android:id="@+id/aggregation_suggestion_title"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentLeft="true"
+        android:layout_marginLeft="5dip"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="?android:attr/textColorPrimary"
+        android:textStyle="bold"
+    />
+
+    <LinearLayout
+        android:id="@+id/aggregation_suggestions"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+    />
+</LinearLayout>
diff --git a/res/layout/aggregation_suggestions_item.xml b/res/layout/aggregation_suggestions_item.xml
new file mode 100644
index 0000000..988508b
--- /dev/null
+++ b/res/layout/aggregation_suggestions_item.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 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.
+ */
+-->
+
+<view xmlns:android="http://schemas.android.com/apk/res/android"
+    class="com.android.contacts.views.editor.AggregationSuggestionView"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal"
+    android:paddingLeft="5dip"
+    android:paddingRight="15dip"
+>
+    <Button
+        android:id="@+id/aggregation_suggestion_join_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/aggregation_suggestion_join_button"
+        android:layout_centerInParent="true"
+        android:layout_alignParentRight="true"
+    />
+
+    <Button
+        android:id="@+id/aggregation_suggestion_edit_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/aggregation_suggestion_edit_button"
+        android:layout_centerInParent="true"
+        android:layout_alignParentRight="true"
+    />
+
+    <ImageView
+        android:id="@+id/aggregation_suggestion_photo"
+        android:layout_width="@dimen/aggregation_suggestion_icon_size"
+        android:layout_height="@dimen/aggregation_suggestion_icon_size"
+        android:layout_alignParentLeft="true"
+        android:layout_centerInParent="true"
+        android:layout_marginTop="4dip"
+        android:scaleType="fitCenter"
+    />
+
+    <TextView
+        android:id="@+id/aggregation_suggestion_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@id/aggregation_suggestion_photo"
+        android:layout_toLeftOf="@id/aggregation_suggestion_join_button"
+        android:layout_marginLeft="10dip"
+        android:layout_marginTop="4dip"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="?android:attr/textColorSecondary"
+    />
+
+    <TextView
+        android:id="@+id/aggregation_suggestion_data"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@id/aggregation_suggestion_photo"
+        android:layout_toLeftOf="@id/aggregation_suggestion_join_button"
+        android:layout_below="@id/aggregation_suggestion_name"
+        android:layout_marginLeft="10dip"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="?android:attr/textColorSecondary"
+    />
+</view>
diff --git a/res/layout/aizy_popup_window.xml b/res/layout/aizy_popup_window.xml
new file mode 100644
index 0000000..4b3668f
--- /dev/null
+++ b/res/layout/aizy_popup_window.xml
@@ -0,0 +1,25 @@
+<?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="@dimen/aizy_preview_width"
+    android:layout_height="@dimen/aizy_preview_height"
+    android:background="@drawable/aizy_label"
+    android:paddingTop="0dip"
+    android:id="@+id/caption"
+    android:textSize="55sp"
+    android:gravity="center"
+    android:textColor="#ffffffff" />
diff --git a/res/layout-finger/call_detail.xml b/res/layout/call_detail.xml
similarity index 100%
rename from res/layout-finger/call_detail.xml
rename to res/layout/call_detail.xml
diff --git a/res/layout-finger/call_detail_list_item.xml b/res/layout/call_detail_list_item.xml
similarity index 100%
rename from res/layout-finger/call_detail_list_item.xml
rename to res/layout/call_detail_list_item.xml
diff --git a/res/layout/contact_browser.xml b/res/layout/contact_browser.xml
new file mode 100644
index 0000000..0b4bb63
--- /dev/null
+++ b/res/layout/contact_browser.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/list_container"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+</FrameLayout>
diff --git a/res/layout-finger/contact_card_layout.xml b/res/layout/contact_card_layout.xml
similarity index 100%
rename from res/layout-finger/contact_card_layout.xml
rename to res/layout/contact_card_layout.xml
diff --git a/res/layout/contact_detail_activity.xml b/res/layout/contact_detail_activity.xml
new file mode 100644
index 0000000..ab5ec69
--- /dev/null
+++ b/res/layout/contact_detail_activity.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <fragment class="com.android.contacts.views.detail.ContactDetailFragment"
+            android:id="@+id/contact_detail_fragment"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
+</FrameLayout>
diff --git a/res/layout/contact_detail_fragment.xml b/res/layout/contact_detail_fragment.xml
new file mode 100644
index 0000000..a3ca198
--- /dev/null
+++ b/res/layout/contact_detail_fragment.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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:id="@+id/contact_detail"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    
+    <com.android.contacts.views.detail.ContactDetailHeaderView
+        android:id="@+id/contact_header_widget"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"/>
+        
+    <ListView android:id="@android:id/list"
+        android:layout_width="match_parent"
+        android:layout_height="0px"
+        android:layout_weight="1"
+        android:background="@drawable/title_bar_shadow"
+    />
+
+    <ScrollView android:id="@android:id/empty"
+        android:layout_width="match_parent"
+        android:layout_height="0px"
+        android:layout_weight="1"
+        android:visibility="gone"
+    >
+        <TextView android:id="@+id/emptyText"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/no_contact_details"
+            android:textSize="20sp"
+            android:textColor="?android:attr/textColorSecondary"
+            android:paddingLeft="10dip"
+            android:paddingRight="10dip"
+            android:paddingTop="10dip"
+            android:lineSpacingMultiplier="0.92"
+        />
+    </ScrollView>
+
+    <!-- "Copy to my contacts"- button -->
+    <Button
+        android:id="@+id/copyLocal"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/menu_copyContact"
+        android:visibility="gone"
+        android:layout_gravity="right"
+        android:layout_marginRight="40dip"
+        android:layout_marginTop="20dip"
+        android:layout_marginBottom="20dip" />
+</LinearLayout>
+
diff --git a/res/layout/contact_detail_header_view.xml b/res/layout/contact_detail_header_view.xml
new file mode 100644
index 0000000..cc0372c
--- /dev/null
+++ b/res/layout/contact_detail_header_view.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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:id="@+id/banner"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal"
+    android:background="@drawable/title_bar_medium"
+    android:paddingRight="5dip">
+
+    <ImageView android:id="@+id/photo"
+        android:layout_gravity="center_vertical"
+        android:layout_marginLeft="-1dip"
+        android:layout_marginTop="4dip"
+        android:layout_marginBottom="4dip"
+        android:layout_marginRight="8dip"
+        android:layout_width="64dip"
+        android:layout_height="64dip"
+        android:src="@*android:drawable/ic_contact_picture"
+    />
+
+    <LinearLayout
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="vertical"
+        android:layout_gravity="center_vertical" >
+
+        <TextView android:id="@+id/name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textStyle="bold"
+            android:shadowColor="#BB000000"
+            android:shadowRadius="2.75"
+         />
+
+        <TextView android:id="@+id/phonetic_name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+
+        <TextView android:id="@+id/organization"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+
+        <TextView android:id="@+id/directory_name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textColor="?android:attr/textColorSecondary"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+
+        <TextView android:id="@+id/status"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+
+        <TextView android:id="@+id/status_date"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:layout_weight="1"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textSize="12sp"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+    </LinearLayout>
+
+    <ImageView
+        android:id="@+id/presence"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:paddingLeft="3dip"
+        android:paddingRight="6dip"
+        android:visibility="gone"
+    />
+
+    <CheckBox
+        android:id="@+id/star"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:contentDescription="@string/description_star"
+        style="?android:attr/starStyle" />
+</LinearLayout>
diff --git a/res/layout/contact_detail_list_item.xml b/res/layout/contact_detail_list_item.xml
new file mode 100644
index 0000000..a110ec2
--- /dev/null
+++ b/res/layout/contact_detail_list_item.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2009, 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:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:orientation="horizontal"
+    android:paddingLeft="9dip"
+    android:gravity="center_vertical"
+>
+
+    <LinearLayout
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:layout_marginLeft="5dip"
+        android:orientation="vertical"
+        android:paddingTop="5dip"
+        android:paddingBottom="7dip"
+        android:gravity="center_vertical"
+    >
+
+        <TextView android:id="@+id/kind_and_type"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceLarge"
+        />
+
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+        >
+            
+            <TextView android:id="@+id/data"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_vertical"
+                android:textAppearance="?android:attr/textAppearanceSmall"
+            />
+    
+            <ImageView android:id="@+id/primary_icon"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_vertical"
+                android:paddingLeft="3dip"
+                android:src="@drawable/ic_default_number"
+            />
+
+        </LinearLayout>
+
+        <TextView
+            android:id="@+id/footer"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:visibility="gone" />
+
+    </LinearLayout>
+
+    <ImageView android:id="@+id/presence_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="5dip"
+        android:gravity="center"
+        android:scaleType="centerInside"
+    />
+
+    <ImageView android:id="@+id/action_icon"
+        android:layout_width="30dip"
+        android:layout_height="30dip"
+        android:layout_marginLeft="14dip"
+        android:layout_marginRight="14dip"
+        android:gravity="center"
+        android:scaleType="centerInside"
+    />
+    
+    <View android:id="@+id/divider"
+        android:layout_width="1px"
+        android:layout_height="match_parent"
+        android:layout_marginTop="5dip"
+        android:layout_marginBottom="5dip"
+        android:background="@drawable/divider_vertical_dark"
+    />
+
+    <ImageView android:id="@+id/secondary_action_button"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_centerVertical="true"
+        android:paddingLeft="14dip"
+        android:paddingRight="14dip"
+        android:gravity="center"
+        android:scaleType="center"
+        android:background="@android:drawable/list_selector_background"
+    />
+
+</LinearLayout>
diff --git a/res/layout/contact_editor_activity.xml b/res/layout/contact_editor_activity.xml
new file mode 100644
index 0000000..e51869b
--- /dev/null
+++ b/res/layout/contact_editor_activity.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <fragment class="com.android.contacts.views.editor.ContactEditorFragment"
+            android:id="@+id/contact_editor_fragment"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="50dip"
+        android:orientation="horizontal"
+        android:gravity="center_horizontal">
+
+        <Button
+            android:id="@+id/done"
+            android:layout_width="150dip"
+            android:layout_height="match_parent"
+            android:text="@string/menu_done" />
+        <Button
+            android:id="@+id/revert"
+            android:layout_width="150dip"
+            android:layout_height="match_parent"
+            android:text="@string/menu_doNotSave" />
+    </LinearLayout>
+</FrameLayout>
diff --git a/res/layout/contact_editor_fragment.xml b/res/layout/contact_editor_fragment.xml
new file mode 100644
index 0000000..602f7f9
--- /dev/null
+++ b/res/layout/contact_editor_fragment.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 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.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+>
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:fillViewport="true"
+    >
+
+        <LinearLayout android:id="@+id/editors"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+        />
+
+    </ScrollView>
+</FrameLayout>
diff --git a/res/layout/contact_editor_header_view.xml b/res/layout/contact_editor_header_view.xml
new file mode 100644
index 0000000..fb5596e
--- /dev/null
+++ b/res/layout/contact_editor_header_view.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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:id="@+id/banner"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal"
+    android:background="@drawable/title_bar_medium"
+    android:paddingRight="5dip">
+
+    <TextView android:id="@+id/caption"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:singleLine="true"
+        android:ellipsize="end"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textStyle="bold"
+        android:shadowColor="#BB000000"
+        android:shadowRadius="2.75"
+        android:text="@string/edit_contact"
+        android:layout_gravity="center_vertical"
+        />
+
+    <LinearLayout
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="vertical"
+        android:layout_gravity="center_vertical" />
+
+    <TextView android:id="@+id/merge_info"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:singleLine="true"
+        android:ellipsize="end"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textStyle="bold"
+        android:shadowColor="#BB000000"
+        android:shadowRadius="2.75"
+        android:layout_gravity="center_vertical"
+        />
+</LinearLayout>
diff --git a/res/layout/contact_list_filter_custom.xml b/res/layout/contact_list_filter_custom.xml
new file mode 100644
index 0000000..6c34fec
--- /dev/null
+++ b/res/layout/contact_list_filter_custom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 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"
+    style="@style/CustomContactListFilterView"
+    android:orientation="vertical"
+    android:fillViewport="true">
+
+    <ExpandableListView
+        android:id="@android:id/list"
+        android:layout_width="match_parent"
+        android:layout_height="0dip"
+        android:layout_weight="1" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        style="@android:style/ButtonBar">
+
+        <Button
+            android:id="@+id/btn_done"
+            android:layout_width="0dip"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@android:string/ok" />
+
+        <Button
+            android:id="@+id/btn_discard"
+            android:layout_width="0dip"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@android:string/cancel" />
+
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/res/layout-finger/display_options_phones_only.xml b/res/layout/contact_list_filter_phones_only.xml
similarity index 100%
rename from res/layout-finger/display_options_phones_only.xml
rename to res/layout/contact_list_filter_phones_only.xml
diff --git a/res/layout/contact_none_fragment.xml b/res/layout/contact_none_fragment.xml
new file mode 100644
index 0000000..6617427
--- /dev/null
+++ b/res/layout/contact_none_fragment.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+>
+
+<!-- TODO: need an image -->
+<!--  <ImageView-->
+<!--    android:layout_width="wrap_content"-->
+<!--    android:layout_height="wrap_content"-->
+<!--    android:src="@drawable/contact_none"-->
+<!--    android:layout_centerInParent="true"/>-->
+    
+</RelativeLayout>
diff --git a/res/layout-finger/contact_options.xml b/res/layout/contact_options.xml
similarity index 100%
rename from res/layout-finger/contact_options.xml
rename to res/layout/contact_options.xml
diff --git a/res/layout/contact_picker.xml b/res/layout/contact_picker.xml
new file mode 100644
index 0000000..4fa8c8e
--- /dev/null
+++ b/res/layout/contact_picker.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+
+<FrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    style="@style/ContactPickerLayout"
+    android:id="@+id/list_container"
+    >
+</FrameLayout>
diff --git a/res/layout/contact_picker_content.xml b/res/layout/contact_picker_content.xml
new file mode 100644
index 0000000..56e8340
--- /dev/null
+++ b/res/layout/contact_picker_content.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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:id="@+id/pinned_header_list_layout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="horizontal"
+        >
+
+    <LinearLayout
+            android:layout_width="0px"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:layout_weight="1"
+            >
+
+        <view
+            class="com.android.contacts.list.ContactEntryListView"
+            android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:fastScrollEnabled="true"
+            android:layout_weight="1"
+        />
+
+        <include layout="@layout/contacts_list_empty"/>
+
+        <ViewStub android:id="@+id/footer_stub"
+            android:layout="@layout/footer_panel"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+        />
+    </LinearLayout>
+    <view
+        class="com.android.contacts.list.ContactListAizyView"
+        android:id="@+id/contacts_list_aizy"
+        android:layout_width="30dip"
+        android:layout_height="match_parent"
+    />
+</LinearLayout>
diff --git a/res/layout/contacts_list_content.xml b/res/layout/contacts_list_content.xml
new file mode 100644
index 0000000..56e8340
--- /dev/null
+++ b/res/layout/contacts_list_content.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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:id="@+id/pinned_header_list_layout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="horizontal"
+        >
+
+    <LinearLayout
+            android:layout_width="0px"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:layout_weight="1"
+            >
+
+        <view
+            class="com.android.contacts.list.ContactEntryListView"
+            android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:fastScrollEnabled="true"
+            android:layout_weight="1"
+        />
+
+        <include layout="@layout/contacts_list_empty"/>
+
+        <ViewStub android:id="@+id/footer_stub"
+            android:layout="@layout/footer_panel"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+        />
+    </LinearLayout>
+    <view
+        class="com.android.contacts.list.ContactListAizyView"
+        android:id="@+id/contacts_list_aizy"
+        android:layout_width="30dip"
+        android:layout_height="match_parent"
+    />
+</LinearLayout>
diff --git a/res/layout/contacts_list_content_join.xml b/res/layout/contacts_list_content_join.xml
new file mode 100644
index 0000000..de285fa
--- /dev/null
+++ b/res/layout/contacts_list_content_join.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+    <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" 
+            android:orientation="horizontal"
+            android:background="@*android:drawable/title_bar_medium"
+            android:paddingLeft="5dip"
+            android:paddingRight="5dip"
+            android:gravity="center_vertical"
+            >
+    
+        <ImageView
+            android:layout_width="48dip"
+            android:layout_height="48dip"
+            android:src="@drawable/ic_join"
+            android:gravity="center"
+            android:scaleType="fitCenter"
+        />
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            android:paddingLeft="10dip">
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/titleJoinContactDataWith"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:shadowColor="#BB000000"
+                android:shadowRadius="2.75"
+            />
+            <TextView
+                android:id="@+id/join_contact_blurb"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="-2dip"
+                android:maxLines="2"
+                android:textAppearance="?android:attr/textAppearanceSmall"
+            />
+        </LinearLayout>
+    </LinearLayout>
+
+    <LinearLayout
+            android:id="@+id/pinned_header_list_layout"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="horizontal"
+            >
+
+        <com.android.contacts.list.ContactListAizyView
+            android:id="@+id/contacts_list_aizy"
+            android:layout_width="50dip"
+            android:layout_height="match_parent"
+        />
+
+        <view
+            class="com.android.contacts.list.ContactEntryListView" 
+            android:id="@android:id/list"
+            android:layout_width="0px"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:fastScrollEnabled="true"
+        />
+    </LinearLayout>
+</LinearLayout>
+
diff --git a/res/layout/contacts_list_empty.xml b/res/layout/contacts_list_empty.xml
new file mode 100644
index 0000000..d655899
--- /dev/null
+++ b/res/layout/contacts_list_empty.xml
@@ -0,0 +1,66 @@
+<?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.
+-->
+<view 
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    class="com.android.contacts.ContactListEmptyView"
+    android:id="@android:id/empty"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:fillViewport="true"
+>
+    <LinearLayout 
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:orientation="vertical">
+      
+      <TextView android:id="@+id/emptyText"
+          android:layout_width="match_parent"
+          android:layout_height="wrap_content"
+          android:text="@string/noContacts"
+          android:textSize="20sp"
+          android:textColor="?android:attr/textColorSecondary"
+          android:paddingLeft="10dip"
+          android:paddingRight="10dip"
+          android:paddingTop="10dip"
+          android:lineSpacingMultiplier="0.92"
+          android:visibility="gone"
+      />
+      
+      <LinearLayout android:id="@+id/import_failure"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:gravity="fill_horizontal"
+        android:padding="20dip"
+        android:visibility="gone">
+        
+        <Button
+            android:id="@+id/import_failure_uninstall_apps"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"            
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/upgrade_out_of_memory_uninstall"/>
+            
+        <Button
+            android:id="@+id/import_failure_retry_upgrade"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dip"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:text="@string/upgrade_out_of_memory_retry"/>
+      </LinearLayout>
+    </LinearLayout>
+</view>
diff --git a/res/layout-finger/contacts_list_search_all_item.xml b/res/layout/contacts_list_search_all_item.xml
similarity index 100%
rename from res/layout-finger/contacts_list_search_all_item.xml
rename to res/layout/contacts_list_search_all_item.xml
diff --git a/res/layout-finger/contacts_list_show_all_item.xml b/res/layout/contacts_list_show_all_item.xml
similarity index 100%
rename from res/layout-finger/contacts_list_show_all_item.xml
rename to res/layout/contacts_list_show_all_item.xml
diff --git a/res/layout/contacts_preferences.xml b/res/layout/contacts_preferences.xml
deleted file mode 100644
index c8a1bcf..0000000
--- a/res/layout/contacts_preferences.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical"
-    android:fillViewport="true">
-
-    <ExpandableListView
-        android:id="@android:id/list"
-        android:layout_width="match_parent"
-        android:layout_height="0dip"
-        android:layout_weight="1" />
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        style="@android:style/ButtonBar">
-
-        <Button
-            android:id="@+id/btn_done"
-            android:layout_width="0dip"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:text="@string/menu_done" />
-
-        <Button
-            android:id="@+id/btn_discard"
-            android:layout_width="0dip"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:text="@string/menu_doNotSave" />
-
-    </LinearLayout>
-
-</LinearLayout>
diff --git a/res/layout/contacts_search_content.xml b/res/layout/contacts_search_content.xml
new file mode 100644
index 0000000..d36ad00
--- /dev/null
+++ b/res/layout/contacts_search_content.xml
@@ -0,0 +1,50 @@
+<?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.
+-->
+
+<LinearLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/pinned_header_list_layout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:background="@color/translucent_search_background"
+        >
+
+    <include android:id="@+id/searchView"
+        layout="@layout/search_bar"/>
+
+    <FrameLayout
+        android:id="@+id/list_container"
+        android:layout_width="match_parent"
+        android:layout_height="0dip"
+        android:layout_weight="1"
+        android:fastScrollEnabled="true"
+        android:background="@android:color/background_dark"
+    />
+
+    <!-- Transparent filler -->
+    <View android:id="@android:id/empty"
+        android:layout_width="match_parent"
+        android:layout_height="0dip"
+        android:layout_weight="1"
+        android:visibility="gone"
+    />
+    <ViewStub android:id="@+id/footer_stub"
+        android:layout="@layout/footer_panel"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+    />
+</LinearLayout>
diff --git a/res/layout-finger/create_new_contact.xml b/res/layout/create_new_contact.xml
similarity index 100%
rename from res/layout-finger/create_new_contact.xml
rename to res/layout/create_new_contact.xml
diff --git a/res/layout/custom_list_filter.xml b/res/layout/custom_list_filter.xml
new file mode 100644
index 0000000..2b029a7
--- /dev/null
+++ b/res/layout/custom_list_filter.xml
@@ -0,0 +1,62 @@
+<?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.
+-->
+
+<LinearLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/pinned_header_list_layout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="horizontal"
+        >
+
+    <LinearLayout
+            android:layout_width="0px"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:layout_weight="1"
+            >
+
+        <Spinner
+            android:id="@+id/filter_spinner"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:prompt="@string/list_filter_prompt"
+            android:visibility="gone"
+        />
+
+        <view
+            class="com.android.contacts.list.ContactEntryListView"
+            android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:fastScrollEnabled="true"
+            android:layout_weight="1"
+        />
+
+        <include layout="@layout/contacts_list_empty"/>
+
+        <ViewStub android:id="@+id/footer_stub"
+            android:layout="@layout/footer_panel"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+        />
+    </LinearLayout>
+    <com.android.contacts.list.ContactListAizyView
+        android:id="@+id/contacts_list_aizy"
+        android:layout_width="30dip"
+        android:layout_height="match_parent"
+    />
+</LinearLayout>
diff --git a/res/layout-finger/dialer_activity.xml b/res/layout/dialer_activity.xml
similarity index 100%
rename from res/layout-finger/dialer_activity.xml
rename to res/layout/dialer_activity.xml
diff --git a/res/layout-finger/dialpad.xml b/res/layout/dialpad.xml
similarity index 100%
rename from res/layout-finger/dialpad.xml
rename to res/layout/dialpad.xml
diff --git a/res/layout-finger/dialpad_chooser_list_item.xml b/res/layout/dialpad_chooser_list_item.xml
similarity index 100%
rename from res/layout-finger/dialpad_chooser_list_item.xml
rename to res/layout/dialpad_chooser_list_item.xml
diff --git a/res/layout/directory_header.xml b/res/layout/directory_header.xml
new file mode 100644
index 0000000..63d8297
--- /dev/null
+++ b/res/layout/directory_header.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<!-- Layout used for list section separators. -->
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    style="@style/DirectoryHeader"
+    android:layout_width="match_parent"
+    android:layout_height="56dip"
+    >
+    <TextView
+        android:id="@+id/count"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:layout_centerVertical="true"
+        android:layout_alignParentRight="true"
+        android:layout_marginRight="8dip"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="?android:attr/textColorTertiary"
+        android:textStyle="bold"
+    />
+    <TextView
+        android:id="@+id/label"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignBaseline="@id/count"
+        android:layout_marginLeft="8dip"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="?android:attr/textColorTertiary"
+        android:textStyle="bold"
+    />
+    <TextView
+        android:id="@+id/display_name"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:layout_toRightOf="@id/label"
+        android:layout_toLeftOf="@id/count"
+        android:layout_alignBaseline="@id/count"
+        android:layout_marginLeft="6dip"
+        android:layout_marginRight="6dip"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="?android:attr/textColorTertiary"
+        android:singleLine="true"
+        android:ellipsize="end"
+    />
+</RelativeLayout>
diff --git a/res/layout-finger/display_child.xml b/res/layout/display_child.xml
similarity index 100%
rename from res/layout-finger/display_child.xml
rename to res/layout/display_child.xml
diff --git a/res/layout-finger/display_group.xml b/res/layout/display_group.xml
similarity index 100%
rename from res/layout-finger/display_group.xml
rename to res/layout/display_group.xml
diff --git a/res/layout-finger/edit_contact_entry_voicemail.xml b/res/layout/edit_contact_entry_voicemail.xml
similarity index 100%
rename from res/layout-finger/edit_contact_entry_voicemail.xml
rename to res/layout/edit_contact_entry_voicemail.xml
diff --git a/res/layout-finger/edit_divider.xml b/res/layout/edit_divider.xml
similarity index 100%
rename from res/layout-finger/edit_divider.xml
rename to res/layout/edit_divider.xml
diff --git a/res/layout-finger/edit_phonetic_name.xml b/res/layout/edit_phonetic_name.xml
similarity index 100%
rename from res/layout-finger/edit_phonetic_name.xml
rename to res/layout/edit_phonetic_name.xml
diff --git a/res/layout-finger/empty.xml b/res/layout/empty.xml
similarity index 100%
rename from res/layout-finger/empty.xml
rename to res/layout/empty.xml
diff --git a/res/layout/filter_spinner_item.xml b/res/layout/filter_spinner_item.xml
new file mode 100644
index 0000000..9a3ca98
--- /dev/null
+++ b/res/layout/filter_spinner_item.xml
@@ -0,0 +1,54 @@
+<?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.
+-->
+
+<view
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    class="com.android.contacts.list.ContactListFilterView"
+    android:layout_height="52dip"
+    android:layout_width="fill_parent"
+    android:paddingLeft="7dip"
+    android:paddingRight="7dip"
+    android:paddingTop="2dip"
+    android:paddingBottom="2dip"
+    android:gravity="left">
+
+    <ImageView
+        android:id="@+id/icon"
+        android:scaleType="fitCenter"
+        android:layout_width="24dip"
+        android:layout_height="24dip"
+        android:layout_marginLeft="8dip"
+        android:layout_marginRight="7dip"
+        android:layout_gravity="center_vertical" />
+
+    <TextView
+        android:id="@+id/label"
+        android:layout_width="wrap_content"
+        android:layout_height="fill_parent"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:gravity="center_vertical"
+        android:ellipsize="end" />
+
+    <TextView
+        android:id="@+id/indented_label"
+        android:layout_width="wrap_content"
+        android:layout_height="fill_parent"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:gravity="center_vertical"
+        android:ellipsize="end"
+        android:paddingLeft="40dip" />
+</view>
+
diff --git a/res/layout/footer_panel.xml b/res/layout/footer_panel.xml
new file mode 100644
index 0000000..2625a43
--- /dev/null
+++ b/res/layout/footer_panel.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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:id="@+id/footer"
+    android:orientation="horizontal"
+    android:visibility="gone"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:gravity="center"
+    style="@android:style/ButtonBar"
+>
+
+    <Button android:id="@+id/done"
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:text="@string/menu_done"
+    />
+
+    <Button android:id="@+id/revert"
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:text="@string/menu_doNotSave"
+    />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-finger/horizontal_divider.xml b/res/layout/horizontal_divider.xml
similarity index 100%
rename from res/layout-finger/horizontal_divider.xml
rename to res/layout/horizontal_divider.xml
diff --git a/res/layout/item_contact_editor.xml b/res/layout/item_contact_editor.xml
index f5e7bd3..4d9e26b 100644
--- a/res/layout/item_contact_editor.xml
+++ b/res/layout/item_contact_editor.xml
@@ -14,85 +14,74 @@
      limitations under the License.
 -->
 
-<!-- placed inside act_edit as tabcontent -->
-<com.android.contacts.ui.widget.ContactEditorView
+<com.android.contacts.views.editor.RawContactEditorView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="horizontal"
+    android:orientation="vertical"
 >
 
-    <!-- Left side color bar -->
-    <ImageView
-        android:id="@+id/color_bar"
-        android:layout_width="4dip"
-        android:layout_height="match_parent"
-        android:visibility="gone"
-    />
-
-    <!-- The content -->
-    <LinearLayout
-        android:layout_width="0dip"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:orientation="vertical"
+    <!-- Account info header -->
+    <RelativeLayout android:id="@+id/header"
+        android:layout_height="64dip"
+        android:layout_width="match_parent"
+        android:background="@android:drawable/list_selector_background"
     >
 
-        <!-- Account info header -->
-        <RelativeLayout android:id="@+id/header"
-            android:layout_height="64dip"
+        <ImageView android:id="@+id/header_color_bar"
             android:layout_width="match_parent"
-        >
+            android:layout_height="4dip"
+            android:layout_marginBottom="5dip"
+            android:background="@color/edit_divider"
+        />
 
-            <ImageView android:id="@+id/header_color_bar"
-                android:layout_width="match_parent"
-                android:layout_height="4dip"
-                android:layout_marginBottom="5dip"
-                android:background="@color/edit_divider"
-            />
+        <ImageView android:id="@+id/header_icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="7dip"
+            android:layout_marginRight="7dip"
+            android:layout_centerVertical="true"
+            android:layout_below="@id/header_color_bar"
+        />
 
-            <ImageView android:id="@+id/header_icon"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="7dip"
-                android:layout_marginRight="7dip"
-                android:layout_centerVertical="true"
-                android:layout_below="@id/header_color_bar"
-            />
+        <TextView android:id="@+id/header_account_type"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_toRightOf="@+id/header_icon"
+            android:layout_alignTop="@id/header_icon"
+            android:layout_marginTop="-4dip"
 
-            <TextView android:id="@+id/header_account_type"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toRightOf="@+id/header_icon"
-                android:layout_alignTop="@id/header_icon"
-                android:layout_marginTop="-4dip"
+            android:textSize="24sp"
+            android:textColor="?android:attr/textColorPrimary"
+            android:singleLine="true"
+        />
 
-                android:textSize="24sp"
-                android:textColor="?android:attr/textColorPrimary"
-                android:singleLine="true"
-            />
+        <TextView android:id="@+id/header_account_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_toRightOf="@+id/header_icon"
+            android:layout_alignBottom="@+id/header_icon"
+            android:layout_marginBottom="2dip"
 
-            <TextView android:id="@+id/header_account_name"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toRightOf="@+id/header_icon"
-                android:layout_alignBottom="@+id/header_icon"
-                android:layout_marginBottom="2dip"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textColor="?android:attr/textColorPrimary"
+            android:singleLine="true"
+        />
 
-                android:textAppearance="?android:attr/textAppearanceSmall"
-                android:textColor="?android:attr/textColorPrimary"
-                android:singleLine="true"
-            />
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:layout_alignParentBottom="true"
 
-            <View
-                android:layout_width="match_parent"
-                android:layout_height="1px"
-                android:layout_alignParentBottom="true"
+            android:background="?android:attr/listDivider"
+        />
+    </RelativeLayout>
 
-                android:background="?android:attr/listDivider"
-            />
-
-        </RelativeLayout>
+    <LinearLayout
+        android:id="@+id/body"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
 
         <FrameLayout
             android:id="@+id/stub_photo"
@@ -107,74 +96,43 @@
 
         </FrameLayout>
 
-        <include
+        <com.android.contacts.views.editor.FieldEditorView
             android:id="@+id/edit_name"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:paddingRight="?android:attr/scrollbarSize"
             android:layout_below="@id/stub_photo"
             android:layout_marginTop="6dip"
-            android:layout_marginBottom="4dip"
-            layout="@layout/item_generic_editor" />
+            android:layout_marginBottom="4dip" />
 
-        <TextView android:id="@+id/read_only_name"
+        <ViewStub android:id="@+id/aggregation_suggestion_stub"
+            android:inflatedId="@+id/aggregation_suggestion"
+            android:layout="@layout/aggregation_suggestions"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="6dip"
-            android:layout_marginBottom="6dip"
-            android:layout_marginLeft="10dip"
-
-            android:textAppearance="?android:attr/textAppearanceLarge"
-        />
+            android:visibility="visible"/>
 
         <LinearLayout
-            android:id="@+id/sect_general"
+            android:id="@+id/sect_fields"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical"
         />
 
-        <View android:id="@+id/head_secondary_divider"
+        <View
             android:layout_width="match_parent"
             android:layout_height="1px"
-            android:background="?android:attr/listDivider" />
-
-        <TextView
-            android:id="@+id/head_secondary"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-
-            android:gravity="center_vertical"
-            android:minHeight="?android:attr/listPreferredItemHeight"
-            android:text="@string/edit_secondary_collapse"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textColor="@color/kind_title"
-            android:singleLine="true"
-            android:ellipsize="marquee"
-            android:focusable="true"
-            android:clickable="true"
-            android:paddingLeft="10dip"
-            android:drawablePadding="10dip" />
-
-        <LinearLayout
-            android:id="@+id/sect_secondary"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical" />
-
-        <TextView
-            android:id="@+id/edit_read_only"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="10dip"
-            android:layout_marginBottom="10dip"
-            android:layout_marginLeft="10dip"
-
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:textColor="?android:attr/textColorPrimary"
-            android:drawableLeft="@android:drawable/ic_dialog_alert"
-            android:drawablePadding="10dip"
+            android:layout_alignParentBottom="true"
+            android:background="?android:attr/listDivider"
         />
 
+        <Button
+            android:id="@+id/button_add_field"
+            android:text="@string/add_field"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="right"
+            android:layout_marginTop="10dip"
+        />
     </LinearLayout>
-
-</com.android.contacts.ui.widget.ContactEditorView>
+</com.android.contacts.views.editor.RawContactEditorView>
diff --git a/res/layout/item_editor_field.xml b/res/layout/item_editor_field.xml
deleted file mode 100644
index 9ad8689..0000000
--- a/res/layout/item_editor_field.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<EditText
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content" />
diff --git a/res/layout/item_generic_editor.xml b/res/layout/item_generic_editor.xml
deleted file mode 100644
index e672eba..0000000
--- a/res/layout/item_generic_editor.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<com.android.contacts.ui.widget.GenericEditorView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:baselineAligned="false"
-    android:paddingRight="?android:attr/scrollbarSize">
-
-    <Button
-        android:id="@+id/edit_label"
-        android:layout_width="100dip"
-        android:layout_height="wrap_content"
-        android:visibility="gone"
-        android:gravity="left|center_vertical" />
-
-    <ImageButton
-        android:id="@+id/edit_delete"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentRight="true"
-        style="@style/MinusButton" />
-
-    <LinearLayout
-        android:id="@+id/edit_fields"
-        android:layout_width="0dip"
-        android:layout_height="wrap_content"
-        android:layout_marginLeft="4dip"
-        android:layout_alignWithParentIfMissing="true"
-        android:layout_toRightOf="@id/edit_label"
-        android:layout_toLeftOf="@id/edit_delete"
-        android:orientation="vertical"
-        android:baselineAligned="false"
-        android:gravity="center_vertical" />
-
-    <ImageButton
-        android:id="@+id/edit_more"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentRight="true"
-        android:layout_alignBottom="@id/edit_fields"
-        android:visibility="gone"
-        style="@style/MoreButton" />
-
-    <ImageButton
-        android:id="@+id/edit_less"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentRight="true"
-        android:layout_alignBottom="@id/edit_fields"
-        android:visibility="gone"
-        style="@style/LessButton" />
-
-</com.android.contacts.ui.widget.GenericEditorView>
diff --git a/res/layout/item_group_membership.xml b/res/layout/item_group_membership.xml
new file mode 100644
index 0000000..b349390
--- /dev/null
+++ b/res/layout/item_group_membership.xml
@@ -0,0 +1,65 @@
+<?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.
+-->
+
+<com.android.contacts.views.editor.GroupMembershipView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:orientation="vertical">
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="1px"
+        android:background="?android:attr/listDivider" />
+
+    <LinearLayout
+        android:id="@+id/kind_header"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:layout_marginLeft="14dip"
+        android:layout_marginTop="2dip"
+        android:layout_marginBottom="2dip"
+        android:layout_marginRight="?android:attr/scrollbarSize"
+        android:orientation="horizontal"
+        android:gravity="center_vertical"
+        android:focusable="true"
+        android:clickable="true">
+
+        <TextView
+            android:id="@+id/kind_title"
+            android:layout_width="0dip"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="@color/kind_title"
+            android:singleLine="true"
+            android:ellipsize="marquee"
+            android:fadingEdge="horizontal" />
+
+    </LinearLayout>
+
+    <Button
+        android:id="@+id/group_list"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:ellipsize="end"
+        android:gravity="left"
+    />
+
+</com.android.contacts.views.editor.GroupMembershipView>
diff --git a/res/layout/item_kind_section.xml b/res/layout/item_kind_section.xml
index d1dec5e..0b0656d 100644
--- a/res/layout/item_kind_section.xml
+++ b/res/layout/item_kind_section.xml
@@ -16,7 +16,7 @@
 
 <!-- the body surrounding all editors for a specific kind -->
 
-<com.android.contacts.ui.widget.KindSectionView
+<com.android.contacts.views.editor.KindSectionView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
@@ -25,7 +25,7 @@
 
     <View
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="1px"
         android:background="?android:attr/listDivider" />
 
     <LinearLayout
@@ -53,12 +53,17 @@
             android:ellipsize="marquee"
             android:fadingEdge="horizontal" />
 
-        <ImageView
+        <ImageButton
             android:id="@+id/kind_plus"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:duplicateParentState="true"
-            style="@style/PlusButton" />
+            android:background="@drawable/btn_plus"
+            android:paddingLeft="@dimen/editor_round_button_padding_left"
+            android:paddingRight="@dimen/editor_round_button_padding_right"
+            android:paddingTop="@dimen/editor_round_button_padding_top"
+            android:paddingBottom="@dimen/editor_round_button_padding_bottom"
+            android:contentDescription="@string/description_plus_button" />
 
     </LinearLayout>
 
@@ -69,4 +74,4 @@
         android:paddingBottom="6dip"
         android:orientation="vertical" />
 
-</com.android.contacts.ui.widget.KindSectionView>
+</com.android.contacts.views.editor.KindSectionView>
diff --git a/res/layout/item_photo_editor.xml b/res/layout/item_photo_editor.xml
index b981131..35ade24 100644
--- a/res/layout/item_photo_editor.xml
+++ b/res/layout/item_photo_editor.xml
@@ -14,7 +14,7 @@
      limitations under the License.
 -->
 
-<com.android.contacts.ui.widget.PhotoEditorView
+<com.android.contacts.views.editor.PhotoEditorView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="@dimen/edit_photo_size"
     android:layout_height="@dimen/edit_photo_size"
diff --git a/res/layout/item_read_only_contact_editor.xml b/res/layout/item_read_only_contact_editor.xml
index df442c8..eb8ec7f 100644
--- a/res/layout/item_read_only_contact_editor.xml
+++ b/res/layout/item_read_only_contact_editor.xml
@@ -15,7 +15,7 @@
 -->
 
 <!-- placed inside act_edit as tabcontent -->
-<com.android.contacts.ui.widget.ReadOnlyContactEditorView
+<com.android.contacts.views.editor.ReadOnlyRawContactEditorView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
@@ -150,4 +150,4 @@
         />
     </LinearLayout>
 
-</com.android.contacts.ui.widget.ReadOnlyContactEditorView>
+</com.android.contacts.views.editor.ReadOnlyRawContactEditorView>
diff --git a/res/layout/list_section.xml b/res/layout/list_section.xml
new file mode 100644
index 0000000..e920673
--- /dev/null
+++ b/res/layout/list_section.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<!-- Layout used for list section separators. -->
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="25dip"
+    android:background="@drawable/section_header"
+    >
+    <TextView
+        android:id="@+id/header_text"
+        android:layout_width="56dip"
+        android:layout_height="wrap_content"
+        android:layout_centerVertical="true"
+        android:layout_alignParentLeft="true"
+        android:textStyle="bold"
+        android:textColor="@color/section_header_text_color"
+        android:textSize="14sp"
+        android:gravity="center"
+    />
+</RelativeLayout>
diff --git a/res/layout-finger/list_separator.xml b/res/layout/list_separator.xml
similarity index 100%
rename from res/layout-finger/list_separator.xml
rename to res/layout/list_separator.xml
diff --git a/res/layout/navigation_bar.xml b/res/layout/navigation_bar.xml
new file mode 100644
index 0000000..f30cc58
--- /dev/null
+++ b/res/layout/navigation_bar.xml
@@ -0,0 +1,107 @@
+<?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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/navigation_bar"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal">
+
+    <LinearLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/filter_container"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:orientation="horizontal"
+        android:layout_marginLeft="8dip">
+        <FrameLayout
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:minWidth="220dip"
+            android:background="@drawable/filter_selector_background">
+            <TextView
+                android:id="@+id/search_label"
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:gravity="center_vertical"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/search_label" />
+
+            <view
+                class="com.android.contacts.list.ContactListFilterView"
+                android:id="@+id/filter_view"
+                android:layout_height="match_parent"
+                android:layout_width="wrap_content">
+                <FrameLayout
+                    android:layout_height="match_parent"
+                    android:layout_width="wrap_content">
+                    <TextView
+                        android:id="@+id/label"
+                        android:layout_height="match_parent"
+                        android:layout_width="wrap_content"
+                        android:gravity="center_vertical"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:ellipsize="end" />
+                    <LinearLayout
+                        android:id="@+id/group"
+                        android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:orientation="vertical"
+                        android:layout_gravity="center_vertical">
+                        <TextView
+                            android:id="@+id/group_label"
+                            android:layout_height="wrap_content"
+                            android:layout_width="wrap_content"
+                            android:textAppearance="?android:attr/textAppearanceMedium"
+                            android:ellipsize="end" />
+                        <TextView
+                            android:id="@+id/account_label"
+                            android:layout_height="wrap_content"
+                            android:layout_width="wrap_content"
+                            android:textAppearance="?android:attr/textAppearanceSmall"
+                            android:ellipsize="end" />
+                    </LinearLayout>
+                </FrameLayout>
+            </view>
+        </FrameLayout>
+
+        <ImageView
+            android:id="@+id/filter_indicator"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="8dip"
+            android:layout_marginBottom="13dip"
+            android:layout_gravity="bottom"
+            android:src="@drawable/filter_selector_corner" />
+    </LinearLayout>
+
+    <View
+        android:layout_width="3dip"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="7dip"
+        android:layout_marginRight="7dip"
+        android:background="@drawable/cab_divider_holo_light" />
+    <view
+        class="android.widget.SearchView"
+        android:id="@+id/search_view"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:maxWidth="300dip" />
+    />
+
+</LinearLayout>
diff --git a/res/layout-finger/phone_disambig_item.xml b/res/layout/phone_disambig_item.xml
similarity index 100%
rename from res/layout-finger/phone_disambig_item.xml
rename to res/layout/phone_disambig_item.xml
diff --git a/res/layout/pinned_header_list_demo.xml b/res/layout/pinned_header_list_demo.xml
new file mode 100644
index 0000000..9a26e98
--- /dev/null
+++ b/res/layout/pinned_header_list_demo.xml
@@ -0,0 +1,33 @@
+<?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.
+-->
+
+<LinearLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/pinned_header_list_layout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        >
+
+    <view
+        class="com.android.contacts.widget.PinnedHeaderListView"
+        android:id="@android:id/list"
+        android:layout_width="match_parent"
+        android:layout_height="0dip"
+        android:fastScrollEnabled="true"
+        android:layout_weight="1"
+    />
+</LinearLayout>
diff --git a/res/layout-finger/preference_with_more_button.xml b/res/layout/preference_with_more_button.xml
similarity index 100%
rename from res/layout-finger/preference_with_more_button.xml
rename to res/layout/preference_with_more_button.xml
diff --git a/res/layout/quickcontact.xml b/res/layout/quickcontact.xml
new file mode 100644
index 0000000..34bbc9a
--- /dev/null
+++ b/res/layout/quickcontact.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<view
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    class="com.android.contacts.quickcontact.QuickContactWindow$RootLayout"
+    android:id="@+id/root"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:paddingLeft="@dimen/quickcontact_shadow_horiz"
+    android:paddingRight="@dimen/quickcontact_shadow_horiz"
+    android:background="@drawable/quickcontact_drop_shadow">
+
+    <FrameLayout
+        android:id="@+id/header"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dip">
+
+        <ViewStub
+            android:id="@+id/header_small"
+            android:inflatedId="@+id/header_small"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout="@layout/quickcontact_header_small" />
+
+        <ViewStub
+            android:id="@+id/header_medium"
+            android:inflatedId="@+id/header_medium"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout="@layout/quickcontact_header_med" />
+
+        <ViewStub
+            android:id="@+id/header_large"
+            android:inflatedId="@+id/header_large"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout="@layout/quickcontact_header_large" />
+
+    </FrameLayout>
+
+    <HorizontalScrollView
+        android:id="@+id/scroll"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/header"
+        android:fadingEdgeLength="0dip"
+        android:background="@drawable/quickcontact_slider_background"
+        android:scrollbars="none">
+
+        <LinearLayout
+            android:id="@+id/quickcontact"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:paddingTop="4dip"
+            android:paddingBottom="4dip"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:src="@drawable/quickcontact_slider_grip_left" />
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:src="@drawable/quickcontact_slider_grip_right" />
+
+        </LinearLayout>
+
+    </HorizontalScrollView>
+
+    <FrameLayout
+        android:id="@+id/footer"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/scroll"
+        android:background="@drawable/quickcontact_bottom_frame" />
+
+    <LinearLayout
+        android:id="@+id/footer_disambig"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/scroll"
+        android:background="@drawable/quickcontact_disambig_bottom_bg"
+        android:orientation="vertical"
+        android:visibility="gone">
+
+        <ListView
+            android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:layout_weight="1"
+            android:background="@color/quickcontact_disambig"
+            android:divider="@drawable/quickcontact_disambig_divider"
+            android:cacheColorHint="@null" />
+
+        <CheckBox
+            android:id="@android:id/checkbox"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="19dip"
+            android:layout_marginRight="19dip"
+            android:minHeight="60dip"
+            android:textColor="#f000"
+            android:textStyle="bold"
+            android:text="@string/quickcontact_remember_choice"
+            android:textAppearance="?android:attr/textAppearanceSmallInverse"
+            android:button="@drawable/quickcontact_disambig_checkbox" />
+
+    </LinearLayout>
+
+    <ImageView
+        android:id="@+id/arrow_up"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/quickcontact_arrow_up" />
+
+    <ImageView
+        android:id="@+id/arrow_down"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="-1dip"
+        android:layout_below="@id/footer"
+        android:src="@drawable/quickcontact_arrow_down" />
+
+    <ImageView
+        android:id="@+id/arrow_down_stub"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="-1dip"
+        android:layout_below="@id/footer_disambig"
+        android:visibility="invisible"
+        android:src="@drawable/quickcontact_arrow_down" />
+
+</view>
diff --git a/res/layout-finger/quickcontact_header_large.xml b/res/layout/quickcontact_header_large.xml
similarity index 100%
rename from res/layout-finger/quickcontact_header_large.xml
rename to res/layout/quickcontact_header_large.xml
diff --git a/res/layout-finger/quickcontact_header_med.xml b/res/layout/quickcontact_header_med.xml
similarity index 100%
rename from res/layout-finger/quickcontact_header_med.xml
rename to res/layout/quickcontact_header_med.xml
diff --git a/res/layout-finger/quickcontact_header_small.xml b/res/layout/quickcontact_header_small.xml
similarity index 100%
rename from res/layout-finger/quickcontact_header_small.xml
rename to res/layout/quickcontact_header_small.xml
diff --git a/res/layout/quickcontact_item.xml b/res/layout/quickcontact_item.xml
new file mode 100644
index 0000000..ca57d66
--- /dev/null
+++ b/res/layout/quickcontact_item.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<com.android.contacts.quickcontact.CheckableImageView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="59dip"
+    android:layout_height="51dip"
+    android:paddingLeft="12dip"
+    android:paddingRight="12dip"
+    android:paddingTop="8dip"
+    android:paddingBottom="8dip"
+    android:scaleType="centerInside"
+    android:focusable="true"
+    android:clickable="true"
+    android:background="@drawable/quickcontact_slider_btn" />
diff --git a/res/layout-finger/quickcontact_resolve_item.xml b/res/layout/quickcontact_resolve_item.xml
similarity index 100%
rename from res/layout-finger/quickcontact_resolve_item.xml
rename to res/layout/quickcontact_resolve_item.xml
diff --git a/res/layout-finger/recent_calls.xml b/res/layout/recent_calls.xml
similarity index 100%
rename from res/layout-finger/recent_calls.xml
rename to res/layout/recent_calls.xml
diff --git a/res/layout/recent_calls_list_child_item.xml b/res/layout/recent_calls_list_child_item.xml
new file mode 100644
index 0000000..527e259
--- /dev/null
+++ b/res/layout/recent_calls_list_child_item.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="?android:attr/listPreferredItemHeight"
+    android:paddingLeft="7dip"
+    android:background="@drawable/list_item_background_secondary"
+>
+
+    <ImageView android:id="@+id/call_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:paddingLeft="14dip"
+        android:paddingRight="14dip"
+        android:layout_alignParentRight="true"
+
+        android:gravity="center_vertical"
+        android:src="@android:drawable/sym_action_call"
+        android:background="@drawable/call_background_secondary"
+    />
+
+    <include layout="@layout/recent_calls_list_item_layout"/>
+
+</RelativeLayout>
diff --git a/res/layout/recent_calls_list_group_item.xml b/res/layout/recent_calls_list_group_item.xml
new file mode 100644
index 0000000..79423fa
--- /dev/null
+++ b/res/layout/recent_calls_list_group_item.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="?android:attr/listPreferredItemHeight"
+    android:paddingLeft="7dip"
+>
+
+    <ImageView android:id="@+id/call_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:paddingLeft="14dip"
+        android:paddingRight="14dip"
+        android:layout_alignParentRight="true"
+
+        android:gravity="center_vertical"
+        android:src="@android:drawable/sym_action_call"
+        android:background="@drawable/call_background"
+    />
+
+    <View android:id="@+id/divider"
+        android:layout_width="1px"
+        android:layout_height="match_parent"
+        android:layout_marginTop="5dip"
+        android:layout_marginBottom="5dip"
+        android:layout_toLeftOf="@id/call_icon"
+        android:layout_marginLeft="11dip"
+        android:background="@drawable/divider_vertical_dark"
+    />
+
+    <TextView android:id="@+id/date"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_toLeftOf="@id/divider"
+        android:layout_alignParentBottom="true"
+        android:layout_marginBottom="8dip"
+        android:layout_marginLeft="10dip"
+
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:singleLine="true"
+    />
+
+    <TextView android:id="@+id/label"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentBottom="true"
+        android:layout_marginLeft="36dip"
+        android:layout_marginRight="5dip"
+        android:layout_alignBaseline="@id/date"
+
+        android:singleLine="true"
+        android:ellipsize="marquee"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textStyle="bold"
+    />
+
+    <TextView android:id="@+id/number"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@id/label"
+        android:layout_toLeftOf="@id/date"
+        android:layout_alignBaseline="@id/label"
+        android:layout_alignWithParentIfMissing="true"
+
+        android:singleLine="true"
+        android:ellipsize="marquee"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+    />
+
+    <TextView android:id="@+id/groupSize"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_toLeftOf="@id/divider"
+        android:layout_above="@id/date"
+        android:layout_alignWithParentIfMissing="true"
+        android:layout_marginBottom="-10dip"
+
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:singleLine="true"
+        android:gravity="center_vertical"
+    />
+
+    <TextView android:id="@+id/line1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentTop="true"
+        android:layout_toLeftOf="@+id/groupSize"
+        android:layout_above="@id/date"
+        android:layout_alignWithParentIfMissing="true"
+        android:layout_marginLeft="36dip"
+        android:layout_marginBottom="-10dip"
+
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:singleLine="true"
+        android:ellipsize="marquee"
+        android:gravity="center_vertical"
+    />
+
+    <ImageView
+        android:id="@+id/groupIndicator"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_centerVertical="true"
+        android:src="@*android:drawable/expander_ic_minimized"
+        android:gravity="center_vertical"
+    />
+</RelativeLayout>
diff --git a/res/layout/recent_calls_list_item.xml b/res/layout/recent_calls_list_item.xml
new file mode 100644
index 0000000..2c519d6
--- /dev/null
+++ b/res/layout/recent_calls_list_item.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="?android:attr/listPreferredItemHeight"
+    android:paddingLeft="7dip"
+>
+
+    <ImageView android:id="@+id/call_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:paddingLeft="14dip"
+        android:paddingRight="14dip"
+        android:layout_alignParentRight="true"
+
+        android:gravity="center_vertical"
+        android:src="@android:drawable/sym_action_call"
+        android:background="@drawable/call_background"
+    />
+
+    <include layout="@layout/recent_calls_list_item_layout"/>
+
+</RelativeLayout>
diff --git a/res/layout-finger/recent_calls_list_item_layout.xml b/res/layout/recent_calls_list_item_layout.xml
similarity index 100%
rename from res/layout-finger/recent_calls_list_item_layout.xml
rename to res/layout/recent_calls_list_item_layout.xml
diff --git a/res/layout/search_bar.xml b/res/layout/search_bar.xml
new file mode 100644
index 0000000..304c35d
--- /dev/null
+++ b/res/layout/search_bar.xml
@@ -0,0 +1,74 @@
+<?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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/search_bar"
+    android:layout_width="match_parent"
+    android:layout_height="64dip"
+    android:orientation="vertical"
+    android:focusable="true"
+    android:descendantFocusability="afterDescendants"
+    android:background="@drawable/bg_blk_search_contact">
+
+    <!-- Outer layout defines the entire search bar at the top of the screen -->
+    <LinearLayout
+        android:id="@+id/search_plate"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:paddingLeft="4dip"
+        android:paddingRight="10dip"
+        android:paddingTop="6dip"
+        android:paddingBottom="0dip"        
+        >
+
+        <!-- Inner layout contains the app icon, button(s) and EditText -->
+        <LinearLayout
+            android:id="@+id/search_edit_frame"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <ImageView 
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content" 
+                android:src="@drawable/ic_launcher_contacts"
+                android:layout_marginRight="7dip"
+                android:layout_gravity="center_vertical"
+                android:scaleType="centerInside" />
+              
+            <view
+                class="com.android.contacts.widget.SearchEditText"
+                android:id="@+id/search_src_text"
+                android:layout_height="wrap_content"
+                android:layout_width="0dip"
+                android:layout_weight="1.0"
+                android:layout_marginLeft="4dip"
+                android:layout_marginBottom="0dip"
+                android:singleLine="true"
+                android:ellipsize="end"
+                android:inputType="textNoSuggestions"
+                android:imeOptions="flagNoExtractUi"
+                android:hint="@string/search_bar_hint"
+                android:drawableRight="@drawable/magnifying_glass"
+                android:freezesText="true"
+            />
+        </LinearLayout>
+        
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/res/layout/search_header.xml b/res/layout/search_header.xml
new file mode 100644
index 0000000..1eaa4e0
--- /dev/null
+++ b/res/layout/search_header.xml
@@ -0,0 +1,42 @@
+<?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.
+-->
+
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="28dip"
+    android:background="@drawable/infobar_dark">
+    <TextView
+        android:id="@+id/totalContactsText"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:layout_centerVertical="true"
+        android:layout_alignParentLeft="true"
+        android:layout_marginLeft="8dip"
+        android:textColor="#ffbfbfbf"
+        android:textSize="14sp"
+        android:textStyle="normal" />
+
+    <ProgressBar
+        android:id="@+id/progress"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        style="?android:attr/progressBarStyleSmall"
+        android:layout_alignParentRight="true"
+        android:layout_centerVertical="true"
+        android:layout_marginRight="10dip" />
+
+</RelativeLayout>
diff --git a/res/layout-finger/set_primary_checkbox.xml b/res/layout/set_primary_checkbox.xml
similarity index 100%
rename from res/layout-finger/set_primary_checkbox.xml
rename to res/layout/set_primary_checkbox.xml
diff --git a/res/layout/social_widget.xml b/res/layout/social_widget.xml
new file mode 100644
index 0000000..b6d662b
--- /dev/null
+++ b/res/layout/social_widget.xml
@@ -0,0 +1,76 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="horizontal"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:background="#ff222222"
+>
+    <ImageView
+        android:id="@+id/image"
+        android:layout_width="72dip"
+        android:layout_height="72dip"
+        android:layout_marginRight="8dip" />
+    <LinearLayout
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="vertical"
+        android:layout_gravity="center_vertical" >
+
+        <TextView android:id="@+id/name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textStyle="bold"
+            android:shadowColor="#BB000000"
+            android:shadowRadius="2.75"
+         />
+
+        <TextView android:id="@+id/phonetic_name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+
+        <TextView android:id="@+id/status"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+
+        <TextView android:id="@+id/status_date"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:layout_weight="1"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textSize="12sp"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+    </LinearLayout>
+</LinearLayout>
diff --git a/res/layout-finger/split_aggregate_list_item.xml b/res/layout/split_aggregate_list_item.xml
similarity index 100%
rename from res/layout-finger/split_aggregate_list_item.xml
rename to res/layout/split_aggregate_list_item.xml
diff --git a/res/layout/status_bar_ongoing_event_progress_bar.xml b/res/layout/status_bar_ongoing_event_progress_bar.xml
new file mode 100644
index 0000000..3c7530a
--- /dev/null
+++ b/res/layout/status_bar_ongoing_event_progress_bar.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 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.
+ /
+TODO: This is copied from DownloadProvider, and looks similar to Bluetooth's.
+      It might be better to have this in framework.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="@android:drawable/status_bar_item_app_background"
+    >
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="horizontal"
+        >
+        <LinearLayout
+            android:layout_width="40dp"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:paddingTop="8dp"
+            android:focusable="true"
+            >
+            <ImageView
+                android:id="@+id/status_icon"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:src="@android:drawable/sym_def_app_icon"
+                />
+            <TextView android:id="@+id/status_progress_text"
+                android:layout_width="wrap_content" 
+                android:layout_height="wrap_content"
+                android:textColor="#ff000000"
+                android:singleLine="true"
+                android:textSize="14sp"
+                android:layout_gravity="center_horizontal" />
+        </LinearLayout>
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:focusable="true">
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:focusable="true"
+                android:layout_alignParentTop="true"
+                android:paddingTop="10dp">
+                <TextView android:id="@+id/status_description"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textColor="#ff000000"
+                    android:singleLine="true"
+                    android:textSize="18sp"
+                    android:paddingLeft="5dp" />
+            </LinearLayout>
+            <ProgressBar
+               android:id="@+id/status_progress_bar"
+               style="?android:attr/progressBarStyleHorizontal"
+               android:layout_width="match_parent"
+               android:layout_height="wrap_content"
+               android:layout_alignParentBottom="true"
+               android:paddingBottom="8dp"
+               android:paddingRight="25dp" />
+        </RelativeLayout>
+    </LinearLayout>
+
+    <ImageView
+       android:layout_width="match_parent"
+       android:layout_height="wrap_content"
+       android:src="@android:drawable/divider_horizontal_bright"
+       />
+</LinearLayout>
+
diff --git a/res/layout-finger/tab_account_name.xml b/res/layout/tab_account_name.xml
similarity index 100%
rename from res/layout-finger/tab_account_name.xml
rename to res/layout/tab_account_name.xml
diff --git a/res/layout-finger/tab_indicator.xml b/res/layout/tab_indicator.xml
similarity index 100%
rename from res/layout-finger/tab_indicator.xml
rename to res/layout/tab_indicator.xml
diff --git a/res/layout-finger/tab_layout.xml b/res/layout/tab_layout.xml
similarity index 100%
rename from res/layout-finger/tab_layout.xml
rename to res/layout/tab_layout.xml
diff --git a/res/layout-finger/tab_left_arrow.xml b/res/layout/tab_left_arrow.xml
similarity index 100%
rename from res/layout-finger/tab_left_arrow.xml
rename to res/layout/tab_left_arrow.xml
diff --git a/res/layout-finger/tab_right_arrow.xml b/res/layout/tab_right_arrow.xml
similarity index 100%
rename from res/layout-finger/tab_right_arrow.xml
rename to res/layout/tab_right_arrow.xml
diff --git a/res/layout-finger/total_contacts.xml b/res/layout/total_contacts.xml
similarity index 100%
rename from res/layout-finger/total_contacts.xml
rename to res/layout/total_contacts.xml
diff --git a/res/layout-finger/twelve_key_dialer.xml b/res/layout/twelve_key_dialer.xml
similarity index 100%
rename from res/layout-finger/twelve_key_dialer.xml
rename to res/layout/twelve_key_dialer.xml
diff --git a/res/layout-finger/voicemail_dial_delete.xml b/res/layout/voicemail_dial_delete.xml
similarity index 100%
rename from res/layout-finger/voicemail_dial_delete.xml
rename to res/layout/voicemail_dial_delete.xml
diff --git a/res/menu/actions.xml b/res/menu/actions.xml
new file mode 100644
index 0000000..f431a97
--- /dev/null
+++ b/res/menu/actions.xml
@@ -0,0 +1,36 @@
+<?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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:id="@+id/menu_add"
+        android:showAsAction="always" />
+
+    <item
+        android:id="@+id/menu_settings"
+        android:icon="@drawable/ic_menu_settings"
+        android:title="@string/menu_settings" />
+
+    <item
+        android:id="@+id/menu_accounts"
+        android:icon="@drawable/ic_menu_accounts"
+        android:title="@string/menu_accounts" />
+
+    <item
+        android:id="@+id/menu_import_export"
+        android:icon="@drawable/ic_menu_import_export"
+        android:title="@string/menu_import_export" />
+
+</menu>
diff --git a/res/menu/edit.xml b/res/menu/edit.xml
index 6fafbcf..40fbf2d 100644
--- a/res/menu/edit.xml
+++ b/res/menu/edit.xml
@@ -18,23 +18,24 @@
     <item
         android:id="@+id/menu_done"
         android:alphabeticShortcut="\n"
-        android:icon="@android:drawable/ic_menu_save"
-        android:title="@string/menu_done" />
+        android:icon="@drawable/ic_menu_done"
+        android:title="@string/menu_done"
+        android:showAsAction="always" />
 
     <item
         android:id="@+id/menu_discard"
         android:alphabeticShortcut="q"
-        android:icon="@android:drawable/ic_menu_close_clear_cancel"
+        android:icon="@drawable/ic_menu_cancel"
         android:title="@string/menu_doNotSave" />
 
     <item
-        android:id="@+id/menu_add"
-        android:icon="@android:drawable/ic_menu_add"
+        android:id="@+id/menu_add_raw_contact"
+        android:icon="@drawable/ic_menu_add_contact"
         android:title="@string/menu_newContact" />
 
     <item
         android:id="@+id/menu_delete"
-        android:icon="@android:drawable/ic_menu_delete"
+        android:icon="@drawable/ic_menu_trash"
         android:title="@string/menu_deleteContact" />
 
     <item
diff --git a/res/menu/list.xml b/res/menu/list.xml
index b8f9b76..327c3ca 100644
--- a/res/menu/list.xml
+++ b/res/menu/list.xml
@@ -22,7 +22,7 @@
 
     <item
         android:id="@+id/menu_add"
-        android:icon="@android:drawable/ic_menu_add"
+        android:icon="@drawable/ic_menu_add_contact"
         android:title="@string/menu_newContact"
         android:alphabeticShortcut="n" />
 
@@ -33,7 +33,7 @@
 
     <item
         android:id="@+id/menu_accounts"
-        android:icon="@drawable/ic_menu_account_list"
+        android:icon="@drawable/ic_menu_accounts"
         android:title="@string/menu_accounts" />
 
     <item
diff --git a/res/menu/pick.xml b/res/menu/pick.xml
new file mode 100644
index 0000000..5302dd9
--- /dev/null
+++ b/res/menu/pick.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item
+        android:id="@+id/menu_display_selected"
+        android:icon="@drawable/ic_menu_display_selected"
+        android:title="@string/menu_display_selected" />
+
+    <item
+        android:id="@+id/menu_display_all"
+        android:icon="@drawable/ic_menu_display_all"
+        android:title="@string/menu_display_all" />
+
+    <item
+        android:id="@+id/menu_select_all"
+        android:icon="@drawable/ic_menu_select"
+        android:title="@string/menu_select_all" />
+
+    <item
+        android:id="@+id/menu_select_none"
+        android:icon="@drawable/ic_menu_unselect"
+        android:title="@string/menu_select_none" />
+
+</menu>
diff --git a/res/menu/search.xml b/res/menu/search.xml
new file mode 100644
index 0000000..4e2e8e3
--- /dev/null
+++ b/res/menu/search.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item
+        android:id="@+id/menu_search"
+        android:icon="@android:drawable/ic_menu_search"
+        android:title="@string/menu_search" />
+
+</menu>
diff --git a/res/menu/view.xml b/res/menu/view.xml
index 428434d..f33a3f1 100644
--- a/res/menu/view.xml
+++ b/res/menu/view.xml
@@ -17,13 +17,14 @@
 <menu xmlns:android="http://schemas.android.com/apk/res/android">
     <item
         android:id="@+id/menu_edit"
-        android:icon="@android:drawable/ic_menu_edit"
+        android:icon="@drawable/ic_menu_compose"
         android:title="@string/menu_editContact"
-        android:alphabeticShortcut="e" />
+        android:alphabeticShortcut="e"
+        android:showAsAction="always" />
 
     <item
         android:id="@+id/menu_share"
-        android:icon="@android:drawable/ic_menu_share"
+        android:icon="@drawable/ic_menu_share"
         android:title="@string/menu_share"
         android:alphabeticShortcut="s" />
 
@@ -34,7 +35,6 @@
 
     <item
         android:id="@+id/menu_delete"
-        android:icon="@android:drawable/ic_menu_delete"
+        android:icon="@drawable/ic_menu_trash"
         android:title="@string/menu_deleteContact" />
-
 </menu>
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 48a7c61..de3841e 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Kontaktní informace"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Zobrazit kontakt"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Upravit kontakt"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"E-mailová adresa:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Typ:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Vytvořit kontakt"</string>
     <string name="searchHint" msgid="8482945356247760701">"Vyhledat kontakty"</string>
     <string name="menu_search" msgid="9147752853603483719">"Hledat"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Nový kontakt"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Foneticky"</string>
     <string name="label_notes" msgid="8337354953278341042">"Poznámky"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Internetový hovor"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Vyzváněcí tón"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Jméno a příjmení"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Jméno (foneticky)"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Žádné kontakty nejsou viditelné"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"Nalezen 1 kontakt"</item>
-    <item quantity="other" msgid="7752927996850263152">"Počet nalezených kontaktů: <xliff:g id="COUNT">%d</xliff:g>"</item>
+    <item quantity="one" msgid="5517063038754171134">"Počet nalezených položek: 1"</item>
+    <item quantity="other" msgid="3852668542926965042">"Počet nalezených položek: <xliff:g id="COUNT">%d</xliff:g>"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Kontakt nebyl nalezen"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Nenalezeno"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 kontakt"</item>
-    <item quantity="other" msgid="5660384247071761844">"Počet kontaktů: <xliff:g id="COUNT">%d</xliff:g>"</item>
+    <item quantity="one" msgid="4826918429708286628">"Počet nalezených položek: 1"</item>
+    <item quantity="other" msgid="7988132539476575389">"Počet nalezených položek: <xliff:g id="COUNT">%d</xliff:g>"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Kontakty"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Oblíbené"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Kontakty na kartě SIM"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Nemáte uloženy žádné kontakty, které by bylo možno zobrazit. (Pokud jste účet přidali právě teď, může synchronizace kontaktů trvat několik minut.)"</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Nemáte uloženy žádné kontakty, které by bylo možno zobrazit."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Nemáte žádné kontakty, které by bylo možné zobrazit."\n\n"Chcete-li přidat kontakty, stiskněte tlačítko "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" a dotkněte se položky:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Účty"</b></font>", pokud chcete přidat nebo nakonfigurovat účet a kontakty v něm synchronizovat s telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nový kontakt"</b></font>", pokud chcete vytvořit úplně nový kontakt;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importovat nebo exportovat"</b></font>"."\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Nemáte žádné kontakty, které by bylo možné zobrazit. (Pokud jste právě přidali účet, může synchronizace kontaktů trvat několik minut.)"\n\n"Chcete-li přidat kontakty, stiskněte tlačítko "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" a dotkněte se položky:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Účty"</b></font>", pokud chcete přidat nebo nakonfigurovat účet a kontakty v něm synchronizovat s telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Možnosti zobrazení"</b></font>", pokud chcete změnit, které kontakty budou zobrazeny;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nový kontakt"</b></font>", pokud chcete vytvořit úplně nový kontakt;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importovat nebo exportovat"</b></font>"."\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Nemáte žádné kontakty, které by bylo možné zobrazit."\n\n"Chcete-li přidat kontakty, stiskněte tlačítko "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" a dotkněte se položky:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Účty"</b></font>", pokud chcete přidat nebo nakonfigurovat účet a kontakty v něm synchronizovat s telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nový kontakt"</b></font>", pokud chcete vytvořit úplně nový kontakt;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importovat nebo exportovat"</b></font>"."\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Nemáte žádné kontakty, které by bylo možné zobrazit. (Pokud jste právě přidali účet, může synchronizace kontaktů trvat několik minut.)"\n\n"Chcete-li přidat kontakty, stiskněte tlačítko "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" a dotkněte se položky:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Účty"</b></font>", pokud chcete přidat nebo nakonfigurovat účet a kontakty v něm synchronizovat s telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Možnosti zobrazení"</b></font>", pokud chcete změnit, které kontakty budou zobrazeny;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nový kontakt"</b></font>", pokud chcete vytvořit úplně nový kontakt;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importovat nebo exportovat"</b></font>"."\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"Nemáte žádné kontakty, které by bylo možné zobrazit."\n\n"Chcete-li přidat kontakty, stiskněte tlačítko "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" a dotkněte se položky:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Účty"</b></font>", pokud chcete přidat nebo nakonfigurovat účet a kontakty v něm synchronizovat s telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nový kontakt"</b></font>", pokud chcete vytvořit úplně nový kontakt;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importovat nebo exportovat"</b></font>", pokud chcete importovat kontakty z karty SIM nebo SD."\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Nemáte žádné kontakty, které by bylo možné zobrazit. (Pokud jste právě přidali účet, může synchronizace kontaktů trvat několik minut.)"\n\n"Chcete-li přidat kontakty, stiskněte tlačítko "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" a dotkněte se položky:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Účty"</b></font>", pokud chcete přidat nebo nakonfigurovat účet a kontakty v něm synchronizovat s telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Možnosti zobrazení"</b></font>", pokud chcete změnit, které kontakty budou zobrazeny;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nový kontakt"</b></font>", pokud chcete vytvořit úplně nový kontakt;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importovat nebo exportovat"</b></font>", pokud chcete importovat kontakty z karty SIM nebo SD."\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"Nemáte žádné kontakty, které by bylo možné zobrazit."\n\n"Chcete-li přidat kontakty, stiskněte tlačítko "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" a dotkněte se položky:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Účty"</b></font>", pokud chcete přidat nebo nakonfigurovat účet a kontakty v něm synchronizovat s telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nový kontakt"</b></font>", pokud chcete vytvořit úplně nový kontakt;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importovat nebo exportovat"</b></font>", pokud chcete importovat kontakty z karty SD."\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Nemáte žádné kontakty, které by bylo možné zobrazit. (Pokud jste právě přidali účet, může synchronizace kontaktů trvat několik minut.)"\n\n"Chcete-li přidat kontakty, stiskněte tlačítko "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" a dotkněte se položky:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Účty"</b></font>", pokud chcete přidat nebo nakonfigurovat účet a kontakty v něm synchronizovat s telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Možnosti zobrazení"</b></font>", pokud chcete změnit, které kontakty budou zobrazeny;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nový kontakt"</b></font>", pokud chcete vytvořit úplně nový kontakt;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importovat nebo exportovat"</b></font>", pokud chcete importovat kontakty z karty SD."\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Nemáte žádné oblíbené kontakty."\n\n"Přidání kontaktu do seznamu oblíbených:"\n\n"        "<li>"Dotkněte se karty "<b>"Kontakty"</b>"."\n</li>" "\n<li>"Dotkněte se kontaktu, který chcete přidat mezi oblíbené."\n</li>" "\n<li>"Dotkněte se hvězdičky vedle jména kontaktu."\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Všechny kontakty"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Označené hvězdičkou"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Zavolat zpět"</string>
     <string name="callAgain" msgid="3197312117049874778">"Zavolat znovu"</string>
     <string name="returnCall" msgid="8171961914203617813">"Zpětné volání"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> min <xliff:g id="SECONDS">%2$s</xliff:g> s"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> min <xliff:g id="SECONDS">%s</xliff:g> s"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Nejčastěji používané kontakty"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Přidat kontakt"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Chcete přidat „<xliff:g id="EMAIL">%s</xliff:g>“ do kontaktů?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"fotografie kontaktu"</string>
     <string name="description_minus_button" msgid="387136707700230172">"mínus"</string>
     <string name="description_plus_button" msgid="515164827856229880">"plus"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Sdíl. úložiště nedostupné"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Žádná karta SD"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Sdílené úložiště nenalezeno"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Nebyla zjištěna žádná karta SD"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Žádná karta SD"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Nebyla zjištěna žádná karta SD"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Vyhledávání karty vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importovat z karty SIM"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Import ze sdíl. úložiště"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importovat z karty SD"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Export do sdíl. úložiště"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Exportovat na kartu SD"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importovat z karty SD"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Exportovat na kartu SD"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Sdílet viditelné kontakty"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importovat jeden soubor vCard"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importovat několik souborů vCard"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importovat všechny soubory vCard"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Vyhledávání dat karty vCard ve sdíleném úložišti"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Vyhledávání dat karty vCard na kartě SD"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Vyhledávání ve sdíleném úložišti se nezdařilo"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Vyhledávání na kartě SD se nezdařilo"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Vyhledávání ve sdíleném úložišti se nezdařilo (Důvod: <xliff:g id="FAIL_REASON">%s</xliff:g>)"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Vyhledávání na kartě SD se nezdařilo. (Důvod: <xliff:g id="FAIL_REASON">%s</xliff:g>)"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Vyhledávání dat karty vCard na kartě SD"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Vyhledávání na kartě SD se nezdařilo"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Vyhledávání na kartě SD se nezdařilo. (Důvod: <xliff:g id="FAIL_REASON">%s</xliff:g>)"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Chyba V/V"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Není k dispozici dostatek paměti (soubor může být příliš velký)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Analýza karty vCard se z neznámého důvodu nezdařila."</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Analýza karty vCard se nezdařila. Přestože se zřejmě jedná o správný formát, aktuální implementace jej nepodporuje."</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Ve sdíleném úložišti nebyl nalezen žádný soubor vCard"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Na kartě SD nebyl nalezen žádný soubor vCard"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Na kartě SD nebyl nalezen žádný soubor vCard"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Shromáždění metainformací zadaných souborů vCard se nezdařilo."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Import jednoho nebo více souborů se nezdařil (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Neznámá chyba"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Výběr souboru vCard"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Čtení karty vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Čtení souborů vCard"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Čtení dat karty vCard se nezdařilo"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> z <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> kontaktů"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> z <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> souborů"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Načítání vizitek vCard do mezipaměti místního dočasného úložiště"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"Nástroj pro import načítá vizitky vCard do mezipaměti místního dočasného úložiště. Vlastní import bude zahájen v krátké době."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Čtení dat vizitky vCard se nezdařilo."</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Čtení dat vizitky vCard bylo zrušeno"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Import vizitky vCard byl dokončen"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Nástroj pro import vizitky vCard byl spuštěn."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"Nástroj pro import vizitek vCard za okamžik importuje vizitku vCard."</string>
+    <string name="percentage" msgid="34897865327092209">"%s %%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Potvrdit export"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Opravdu chcete exportovat seznam kontaktů do souboru <xliff:g id="VCARD_FILENAME">%s</xliff:g>?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Export dat kontaktů se nezdařil"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Export dat kontaktů se nezdařil."\n"Příčina chyby: <xliff:g id="FAIL_REASON">%s</xliff:g>"</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Žádný kontakt nelze exportovat"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Ve sdíleném úložišti je příliš mnoho souborů vCard"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Na kartě SD je příliš mnoho souborů vCard"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Na kartě SD je příliš mnoho souborů vCard"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Požadovaný název souboru (<xliff:g id="FILENAME">%s</xliff:g>) je příliš dlouhý"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Nástroj pro export vizitky vCard byl spuštěn."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Export vizitky vCard byl dokončen"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Export dat kontaktů"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Probíhá export dat kontaktů do souboru <xliff:g id="FILE_NAME">%s</xliff:g>"</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Nelze spustit exportní program: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Načtení informací z databáze se nezdařilo"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Nelze exportovat žádné kontakty. Pokud máte v telefonu skutečně uložené kontakty, je možné, že některý poskytovatel datových služeb zakázal jejich export mimo telefon."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"Editor karty vCard není správně inicializován"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Soubor <xliff:g id="FILE_NAME">%1$s</xliff:g> nelze otevřít: <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> z <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> kontaktů"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Soubor <xliff:g id="FILE_NAME">%s</xliff:g> nelze otevřít: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> z <xliff:g id="TOTAL_NUMBER">%s</xliff:g> kontaktů"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Jména vašich kontaktů"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Přidat 2s pauzu"</string>
     <string name="add_wait" msgid="3360818652790319634">"Přidat čekání"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Aplikace potřebná k provedení této akce nebyla nalezena"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Zapamatovat tuto volbu"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Neznámé"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Žádná data"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Účty"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importovat/Exportovat"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importovat nebo exportovat kontakty"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Všechny ostatní kontakty"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Všechny kontakty"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Odebráním skupiny <xliff:g id="GROUP">%s</xliff:g> ze synchronizace odeberete ze synchronizace také všechny kontakty mimo skupinu."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Pouze v telefonu (nesynchronizováno)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Pouze v telefonu (nesynchronizováno)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Volat kontakt <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Volat domů"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Volat mobil"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Chatovat pomocí ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Chatovat pomocí Jabberu"</string>
     <string name="chat" msgid="9025361898797412245">"Chat"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Adresa"</string>
     <string name="postal_street" msgid="8133143961580058972">"Ulice"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Číslo poštovní schránky"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Čtvrť"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Stát"</string>
     <string name="postal_postcode" msgid="572136414136673751">"PSČ"</string>
     <string name="postal_country" msgid="7638264508416368690">"Země"</string>
+    <string name="full_name" msgid="6602579550613988977">"Jméno"</string>
     <string name="name_given" msgid="1687286314106019813">"Křestní jméno"</string>
     <string name="name_family" msgid="3416695586119999058">"Příjmení"</string>
     <string name="name_prefix" msgid="59756378548779822">"Titul před jménem"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Příjmení (foneticky)"</string>
     <string name="account_type_format" msgid="718948015590343010">"Kontakt ze zdroje <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
     <string name="from_account_format" msgid="687567483928582084">"z účtu <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"Kontakt služby <xliff:g id="SOURCE_0">%1$s</xliff:g> od uživatele <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Použít tuto fotografii"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"Kontaktní informace ze zdroje <xliff:g id="SOURCE">%1$s</xliff:g> není možné na tomto zařízení upravit."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"U tohoto kontaktu nejsou uvedeny dodatečné informace"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Vybrat fotografii z galerie"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"V souvislosti se změnou jazyka probíhá aktualizace seznamu kontaktů."\n\n"Čekejte prosím..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Aktualizace seznamu kontaktů."\n\n"Čekejte prosím..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Probíhá upgrade kontaktů. "\n\n"Upgrade vyžaduje přibližně <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB vnitřní paměti telefonu. "\n\n"Zvolte jednu z následujících možností:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Probíhá upgrade kontaktů. "\n\n"Upgrade vyžaduje přibližně <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB vnitřní paměti telefonu. "\n\n"Zvolte jednu z následujících možností:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Odinstalovat některé aplikace"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Zkusit upgradovat znovu"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Výsledky vyhledávání pro dotaz: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Vyhledávání..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Načítání…"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Zobrazit vybrané"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Zobrazit vše"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Vybrat vše"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Zrušit výběr všech"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"Počet vybraných příjemců: 1"</item>
+    <item quantity="other" msgid="4608837420986126229">"Počet vybraných příjemců: <xliff:g id="COUNT">%d</xliff:g>"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Neznámé kontakty"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Nevybrali jste žádné kontakty."</string>
+    <string name="add_field" msgid="5257149039253569615">"Přidat informace"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"pomocí služby <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> prostřednictvím služby <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"upravit"</string>
+    <string name="description_star" msgid="2605854427360036550">"oblíbené"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Upravit kontakt"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"sloučení se nezdařilo"</item>
+    <item quantity="other" msgid="425683718017380845">"sloučeno ze <xliff:g id="COUNT">%0$d</xliff:g> zdrojů"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Smazat"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Chyba při ukládání"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Ostatní"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;Č;D;E;F;G;H;CH;I;J;K;L;M;N;O;P;Q;R;Ř;S;Š;T;U;V;W;X;Y;Z;Ž"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index 2f30611..19848d4 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Kontaktoplysninger"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Vis kontakt"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Rediger kontakt"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"E-mail-adresse:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Type: "</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Opret kontakt"</string>
     <string name="searchHint" msgid="8482945356247760701">"Søg i kontakter"</string>
     <string name="menu_search" msgid="9147752853603483719">"Søg"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Ny kontakt"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Fonetisk"</string>
     <string name="label_notes" msgid="8337354953278341042">"Noter"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Internetopkald"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Ringetone"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Fornavn og efternavn"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Fonetisk navn"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Ingen synlige kontakter"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"Fandt 1 kontakt"</item>
-    <item quantity="other" msgid="7752927996850263152">"Fandt <xliff:g id="COUNT">%d</xliff:g> kontaktpersoner"</item>
+    <item quantity="one" msgid="5517063038754171134">"1 fundet"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> fundet"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Kontakten blev ikke fundet"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Ikke fundet"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 kontaktperson"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> kontaktpersoner"</item>
+    <item quantity="one" msgid="4826918429708286628">"1 fundet"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> fundet"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Kontakter"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favorit"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Kontakter på SIM-kort"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Du har ingen kontaktpersoner. (Hvis du lige har tilføjet en konto, kan det tage et par minutter at synkronisere kontaktpersoner)."</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Du har ingen kontaktpersoner."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Du har ingen kontaktpersoner, der kan vises."\n\n"Hvis du vil tilføje kontaktpersoner, skal du trykke på "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" og på"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konti"</b></font>" for at tilføje eller konfigurere en konto med kontaktpersoner, som du kan synkronisere med telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontaktperson"</b></font>" for at oprette en ny kontaktperson helt fra bunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/eksporter"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Du har ingen kontaktpersoner, der kan vises. (Hvis du lige har tilføjet en konto, kan det tage et par minutter at synkronisere kontaktpersoner)."\n\n"Hvis du vil tilføje kontaktpersoner, skal du trykke på "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" og på"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konti"</b></font>" for at tilføje eller konfigurere en konto med kontaktpersoner, du kan synkronisere til telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsindstillinger"</b></font>" for at ændre, hvilke kontaktpersoner der er synlige"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontaktperson"</b></font>" for at oprette en ny kontaktperson fra bunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/eksporter"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Du har ingen kontaktpersoner, der kan vises."\n\n"Hvis du vil tilføje kontaktpersoner, skal du trykke på "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" og på"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konti"</b></font>" for at tilføje eller konfigurere en konto med kontaktpersoner, du kan synkronisere med telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontaktperson"</b></font>" for at oprette en ny kontaktperson fra bunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/eksporter"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Du har ingen kontaktpersoner, der kan vises. (Hvis du lige har tilføjet en konto, kan det tage et par minutter at synkronisere kontaktpersonerne)."\n\n"Hvis du vil tilføje kontaktpersoner, skal du trykke på "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" og på"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konti"</b></font>" for at tilføje eller konfigurere en konto med kontaktpersoner, du kan synkronisere til telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsindstillinger"</b></font>" for at ændre, hvilke kontaktpersoner der er synlige"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontaktperson"</b></font>" for at oprette en ny kontaktperson fra bunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/eksporter"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"Du har ingen kontaktpersoner."\n\n"Hvis du vil tilføje kontaktpersoner, skal du trykke på "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" og "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konti"</b></font>" for at tilføje eller konfigurere en konto med kontaktpersoner, som du kan synkronisere med telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontaktperson"</b></font>" for at oprette en helt ny kontaktperson"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/eksporter"</b></font>" for at importere kontaktpersoner fra dit SIM-kort eller SD-kort"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Du har ingen kontaktpersoner. (Hvis du lige har tilføjet en konto, kan det tage et par minutter at synkronisere kontaktpersoner)."\n\n"Hvis du vil tilføje kontaktpersoner, skal du trykke på "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" og "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konti"</b></font>" for at tilføje eller konfigurere en konto med kontaktpersoner, som du kan synkronisere til telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsindstillinger"</b></font>" for at ændre, hvilke kontaktpersoner der er synlige"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontaktperson"</b></font>" for at oprette en helt ny kontaktperson"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/eksporter"</b></font>" for at importere kontaktpersoner fra dit SIM-kort eller SD.kort"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"Du har ingen kontaktpersoner."\n\n"Hvis du vil tilføje kontaktpersoner, skal du trykke på "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" og "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konti"</b></font>" for at tilføje eller konfigurere en konto med kontaktpersoner, som du kan synkronisere med telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontaktperson"</b></font>" for at oprette en helt ny kontaktperson "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/eksporter"</b></font>" for at importere kontaktpersoner fra dit SD-kort"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Du har ingen kontaktpersoner. (Hvis du lige har tilføjet en konto, kan det tage et par minutter at synkronisere kontaktpersoner)."\n\n"Hvis du vil tilføje kontaktpersoner, skal du trykke på "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" og "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konti"</b></font>" for at tilføje eller konfigurere en konto med kontaktpersoner, som du kan synkronisere til telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsindstillinger"</b></font>" for at ændre, hvilke kontaktpersoner der er synlige"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontaktperson"</b></font>" for at oprette en ny kontaktperson fra bunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/eksporter"</b></font>" for at importere kontaktpersoner fra dit SD-kort"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Du har ingen favoritter."\n\n"Sådan føjer du en kontaktperson til din liste over favoritter:"\n\n"        "<li>"Tryk på fanen "<b>"Kontaktpersoner"</b>\n</li>" "\n<li>"Tryk på den kontaktperson, du ønsker at føje til dine foretrukne"\n</li>" "\n<li>"Tryk på stjerne ud for kontaktpersonens navn"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Alle kontakter"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Stjernemarkerede"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Ring tilbage"</string>
     <string name="callAgain" msgid="3197312117049874778">"Ring op igen"</string>
     <string name="returnCall" msgid="8171961914203617813">"Ring tilbage"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> min. <xliff:g id="SECONDS">%2$s</xliff:g> sek."</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> min. <xliff:g id="SECONDS">%s</xliff:g> sek."</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Jævnligt kontaktet"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Tilføj kontakt"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Føj \"<xliff:g id="EMAIL">%s</xliff:g>\" til kontaktpersoner?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"kontaktpersonfoto"</string>
     <string name="description_minus_button" msgid="387136707700230172">"minus"</string>
     <string name="description_plus_button" msgid="515164827856229880">"plus"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Delt hukommelse utilgæng."</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Der er intet SD-kort"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Ingen delt hukommelse fundet"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Der blev ikke fundet noget SD-kort"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Der er intet SD-kort"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Der blev ikke fundet noget SD-kort"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Søger efter vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importer fra SIM-kort"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Importer fra delt hukom."</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importer fra SD-kort"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Eksporter til delt hukommelse"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Eksporter til SD-kort"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importer fra SD-kort"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Eksporter til SD-kort"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Del synlige kontaktpersoner"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importer en VCard-fil"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importer flere VCard-filer"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importer alle VCard-filer"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Søger efter vCard-filer i delt hukommelse"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Søger efter vCard-kort på SD-kortet"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Scanningen af delt hukommelse mislykkedes"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Scanningen af SD-kortet mislykkedes"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Scanningen af delt hukommelse mislykkedes (årsag: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Scanningen af SD-kortet mislykkedes: (Årsag: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Søger efter vCard-kort på SD-kortet"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Scanningen af SD-kortet mislykkedes"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Scanningen af SD-kortet mislykkedes: (Årsag: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"I/O-fejl"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Der er ikke nok hukommelse (filen er muligvis for stor)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"vCard kunne ikke parses pga. en uventet årsag"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"vCard kunne ikke parses, selv om det ser ud til at være et gyldigt format, da den nuværende implementering ikke understøtter det"</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Der blev ikke fundet nogen vCard-fil i den delte hukommelse."</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Der blev ikke fundet nogen VCard-fil på SD-kortet"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Der blev ikke fundet nogen VCard-fil på SD-kortet"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Metaoplysninger om angivne vCard-filer kunne ikke hentes."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"En eller flere filer blev ikke importeret (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Ukendt fejl"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Vælg vCard-fil"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Læser vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Læser vCard-fil(er)"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Læsning af vCard-data mislykkedes"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> af <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> kontakter"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> af <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> filer"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Gemmer vCard-fil(er) midlertidigt på lokal lagerplads"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"Importøren gemmer vCard-fil(er) midlertidigt på lokal lagerplads. Den egentlige import begynder snart."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"vCard-data kunne ikke læses"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Læsning af vCard-data blev annulleret"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Import af vCard afsluttet"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Import af vCard startet."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"vCard-importøren importerer vCard-filen efter et stykke tid."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Bekræft eksport"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Er du sikker på, at du vil eksportere listen over kontaktpersoner til  \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\"?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Eksport af kontaktdata mislykkedes"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Eksport af kontaktpersondata mislykkedes."\n"Årsag til fejl: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Der er ingen kontakter, der kan eksporteres"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Der er for mange vCard-data på den delte hukommelse"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Der er for mange vCard-data på SD-kortet"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Der er for mange vCard-data på SD-kortet"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Det krævede filnavn er for langt (\"<xliff:g id="FILENAME">%s</xliff:g>\")"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Eksport af vCard startet."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Eksport af vCard afsluttet"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Eksporterer kontaktdata"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Kontaktdata eksporteres til \"<xliff:g id="FILE_NAME">%s</xliff:g>\""</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Eksportfunktionen kunne ikke startes: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Kunne ikke hente databaseoplysninger"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Der er ingen kontaktpersoner, der kan eksporteres. Hvis du har kontaktpersoner på din telefon, har en dataudbyder muligvis forbudt, at kontaktpersonerne eksporteres fra telefonen."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"vCard-oprettelse ikke korrekt initialiseret"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\"<xliff:g id="FILE_NAME">%1$s</xliff:g>\" kunne ikke åbnes: <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> af <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> kontakter"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\"<xliff:g id="FILE_NAME">%s</xliff:g>\" kunne ikke åbnes: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> af <xliff:g id="TOTAL_NUMBER">%s</xliff:g> kontakter"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Navne på dine kontakter"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Tilføj pause på 2 sek."</string>
     <string name="add_wait" msgid="3360818652790319634">"Tilføj Vent"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Der blev ikke fundet noget program til denne handling"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Husk dette valg"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Ukendte"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Ingen data"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Konti"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Import/eksport"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importer/eksporter kontakter"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Alle andre kontakter"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Alle kontakter"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Hvis \'<xliff:g id="GROUP">%s</xliff:g>\' fjernes fra synkronisering, vil kontaktpersoner, der ikke er i grupper, også fjernes fra synkroniseringen."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Kun telefon (ikke synkroniseret)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Kun telefon (ikke synkroniseret)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Ring til <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Ring hjem"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Ring til mobil"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Chat ved hjælp af ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Chat ved hjælp af Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Chat"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Adresse"</string>
     <string name="postal_street" msgid="8133143961580058972">"Gade"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Postboks"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Nabolag"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Stat"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Postnummer"</string>
     <string name="postal_country" msgid="7638264508416368690">"Land"</string>
+    <string name="full_name" msgid="6602579550613988977">"Navn"</string>
     <string name="name_given" msgid="1687286314106019813">"Fornavn"</string>
     <string name="name_family" msgid="3416695586119999058">"Efternavn"</string>
     <string name="name_prefix" msgid="59756378548779822">"Navnepræfiks"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Fonetisk efternavn"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g> kontaktperson"</string>
     <string name="from_account_format" msgid="687567483928582084">"fra<xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"<xliff:g id="SOURCE_0">%1$s</xliff:g> kontaktperson fra <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Brug dette billede"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"<xliff:g id="SOURCE">%1$s</xliff:g> kontaktoplysninger kan ikke redigeres på denne enhed."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Ingen yderligere oplysninger for denne kontakt"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Vælg foto fra Galleri"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"Kontaktlisten opdateres for at afspejle ændringen af sprog."\n\n"Vent et øjeblik..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Listen over kontaktpersoner opdateres."\n\n"Vent et øjeblik ..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Kontaktpersonerne er ved at blive opgraderet. "\n\n"Opgraderingen kræver ca. <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB intern lagerplads på telefonen."\n\n"Vælg et af følgende:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Kontaktpersonerne er ved at blive opgraderet. "\n\n"Opgraderingen kræver ca. <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB intern lagerplads på telefonen."\n\n"Vælg et af følgende:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Afinstaller nogle programmer"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Prøv at opgradere igen"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Søgeresultater for: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Søger ..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Indlæser…"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Vis valgte"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Vis alle"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Vælg alle"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Fravælg alle"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"1 modtager er valgt"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> modtagere er valgt"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Ukendte kontaktpersoner"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Ingen kontaktpersoner er valgt."</string>
+    <string name="add_field" msgid="5257149039253569615">"Tilføj oplysninger"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"via <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> via <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"rediger"</string>
+    <string name="description_star" msgid="2605854427360036550">"foretrukken"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Rediger kontaktperson"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"blev ikke flettet"</item>
+    <item quantity="other" msgid="425683718017380845">"flettet fra <xliff:g id="COUNT">%0$d</xliff:g> kilder "</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Slet"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Fejl ved lagring"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Andre"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;Æ;Ø;Å"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index ddb6c95..9d093c2 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Kontaktinformationen"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Kontakt anzeigen"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Kontakt bearbeiten"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"E-Mail-Adresse:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Typ:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Kontakt erstellen"</string>
     <string name="searchHint" msgid="8482945356247760701">"Kontakte durchsuchen"</string>
     <string name="menu_search" msgid="9147752853603483719">"Suche"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Neuer Kontakt"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Phonetisch"</string>
     <string name="label_notes" msgid="8337354953278341042">"Notizen"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Internetanruf"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Klingelton"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Vor- und Nachname"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Phonetischer Name"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Keine sichtbaren Kontakte"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"1 Kontakt gefunden"</item>
-    <item quantity="other" msgid="7752927996850263152">"<xliff:g id="COUNT">%d</xliff:g> Kontakte gefunden"</item>
+    <item quantity="one" msgid="5517063038754171134">"1 gefunden"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> gefunden"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Kein Kontakt gefunden"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Nicht gefunden"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 Kontakt"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> Kontakte"</item>
+    <item quantity="one" msgid="4826918429708286628">"1 gefunden"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> gefunden"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Kontakte"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favoriten"</string>
@@ -141,7 +144,7 @@
     <string name="liveFolderPhone" msgid="3739376066610926780">"Kontakte mit Telefonnummern"</string>
     <string name="menu_sendTextMessage" msgid="6937343460284499306">"Textnachricht senden"</string>
     <string name="recentCalls_callNumber" msgid="1756372533999226126">"<xliff:g id="NAME">%s</xliff:g> anrufen"</string>
-    <string name="recentCalls_editNumberBeforeCall" msgid="7756171675833267857">"Nr. vor Anruf bearbeiten"</string>
+    <string name="recentCalls_editNumberBeforeCall" msgid="7756171675833267857">"Nummer vor Anruf bearbeiten"</string>
     <string name="recentCalls_addToContact" msgid="1429899535546487008">"Zu Kontakten hinzufügen"</string>
     <string name="recentCalls_removeFromRecentList" msgid="401662244636511330">"Aus Anrufliste entfernen"</string>
     <string name="recentCalls_deleteAll" msgid="6352364392762163704">"Anrufliste löschen"</string>
@@ -160,11 +163,11 @@
     <string name="simContacts_title" msgid="27341688347689769">"Kontakte auf SIM-Karte"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Sie haben keine Kontakte. Wenn Sie gerade ein Konto hinzugefügt haben, kann die Synchronisierung der Kontakte einige Minuten dauern."</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Sie haben keine Kontakte."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Es sind keine Kontakte vorhanden."\n\n"Drücken Sie zum Hinzufügen von Kontakten die "<font fgcolor="#ffffffff"><b>"Menütaste"</b></font>" und berühren Sie anschließend "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konten"</b></font>", um ein Konto mit Kontakten, die Sie mit dem Telefon synchronisieren möchten, hinzuzufügen oder zu konfigurieren."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Neuer Kontakt"</b></font>", um einen neuen Kontakt von Grund auf zu erstellen."\n</li>\n<li><font fgcolor="#ffffffff"><b>"Importieren/Exportieren"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Es sind keine Kontakte vorhanden. Wenn Sie gerade ein Konto hinzugefügt haben, kann es einige Minuten dauern, bis die Kontakte synchronisiert sind."\n\n"Drücken Sie zum Hinzufügen von Kontakten die "<font fgcolor="#ffffffff"><b>"Menütaste"</b></font>" und tippen Sie anschließend auf "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konten"</b></font>", um ein Konto mit Kontakten, die Sie mit dem Telefon synchronisieren möchten, hinzuzufügen oder zu konfigurieren."\n" "</li>\n<li><font fgcolor="#ffffffff"><b>"Anzeigeoptionen"</b></font>", um zu ändern, welche Kontakte angezeigt werden."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Neuer Kontakt"</b></font>", um einen neuen Kontakt von Grund auf zu erstellen."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importieren/Exportieren"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Es sind keine Kontakte vorhanden."\n\n"Drücken Sie zum Hinzufügen von Kontakten die "<font fgcolor="#ffffffff"><b>"Menütaste"</b></font>" und berühren Sie anschließend "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konten"</b></font>", um ein Konto mit Kontakten, die Sie mit dem Telefon synchronisieren möchten, hinzuzufügen oder zu konfigurieren."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Neuer Kontakt"</b></font>", um einen neuen Kontakt von Grund auf zu erstellen."\n</li>\n<li><font fgcolor="#ffffffff"><b>"Importieren/Exportieren"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Es sind keine Kontakte vorhanden. Wenn Sie gerade ein Konto hinzugefügt haben, kann es einige Minuten dauern, bis die Kontakte synchronisiert sind."\n\n"Drücken Sie zum Hinzufügen von Kontakten die "<font fgcolor="#ffffffff"><b>"Menütaste"</b></font>" und berühren Sie anschließend "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konten"</b></font>", um ein Konto mit Kontakten, die Sie mit dem Telefon synchronisieren möchten, hinzuzufügen oder zu konfigurieren."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Anzeigeoptionen"</b></font>", um zu ändern, welche Kontakte angezeigt werden."\n</li>\n<li><font fgcolor="#ffffffff"><b>"Neuer Kontakt"</b></font>", um einen neuen Kontakt von Grund auf zu erstellen."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importieren/Exportieren"</b></font>\n</li></string>
-    <string name="noFavoritesHelpText" msgid="3744655776704833277">"Es sind keine Favoriten vorhanden."\n\n"So fügen Sie einen Kontakt zu Ihrer Favoritenliste hinzu:"\n\n" "<li>"Berühren Sie den Tab "<b>"Kontakte"</b>"."\n</li>" "\n<li>"Berühren Sie den Kontakt, den Sie zu Ihren Favoriten hinzufügen möchten."\n</li>" "\n<li>"Berühren Sie den Stern neben dem Kontaktnamen."\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"Es können keine Kontakte angezeigt werden."\n\n"Tippen Sie zum Hinzufügen von Kontakten auf "<font fgcolor="#ffffffff"><b>"Menü"</b></font>" und dann auf "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konten"</b></font>", um ein Konto hinzuzufügen oder mit Kontakten für die Synchronisierung mit dem Telefon zu konfigurieren"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Neuer Kontakt"</b></font>", um einen Kontakt neu zu erstellen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Import/Export"</b></font>", um Kontakte aus Ihrer SIM- oder SD-Karte zu importieren"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Es können keine Kontakte angezeigt werden. Wenn Sie gerade ein Konto hinzugefügt haben, kann die Kontaktsynchronisierung etwas dauern."\n\n"Zum Hinzufügen von Kontakten drücken Sie auf "<font fgcolor="#ffffffff"><b>"Menü"</b></font>" und tippen auf "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konten"</b></font>", um ein Konto hinzuzufügen oder mit Kontakten für die Synchronisierung mit dem Telefon zu konfigurieren."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Anzeigeoptionen"</b></font>", um zu ändern, welche Kontakte angezeigt werden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Neuer Kontakt"</b></font>", um einen Kontakt neu zu erstellen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Import/Export"</b></font>", um Kontakte aus Ihrer SIM- oder SD-Karte zu importieren"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"Es können keine Kontakte angezeigt werden."\n\n"Tippen Sie zum Hinzufügen von Kontakten auf "<font fgcolor="#ffffffff"><b>"Menü"</b></font>" und dann auf "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konten"</b></font>", um ein Konto hinzuzufügen oder mit Kontakten für die Synchronisierung mit dem Telefon zu konfigurieren."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Neuer Kontakt"</b></font>", um einen Kontakt neu zu erstellen"\n</li>"."\n<li><font fgcolor="#ffffffff"><b>"Import/Export"</b></font>", um Kontakte aus Ihrer SD-Karte zu importieren"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Es können keine Kontakte angezeigt werden. Wenn Sie gerade ein Konto hinzugefügt haben, kann die Kontaktsynchronisierung etwas dauern."\n\n"Zum Hinzufügen von Kontakten drücken Sie auf "<font fgcolor="#ffffffff"><b>"Menü"</b></font>" und tippen dann auf "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konten"</b></font>", um ein Konto hinzuzufügen oder mit Kontakten für die Synchronisierung mit dem Telefon zu konfigurieren."\n" "</li>\n<li><font fgcolor="#ffffffff"><b>"Anzeigeoptionen"</b></font>", um zu ändern, welche Kontakte angezeigt werden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Neuer Kontakt"</b></font>", um einen Kontakt neu zu erstellen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Import/Export"</b></font>\n</li></string>
+    <string name="noFavoritesHelpText" msgid="3744655776704833277">"Es sind keine Favoriten vorhanden."\n\n"So fügen Sie einen Kontakt zu Ihrer Favoritenliste hinzu:"\n\n"        "<li>"Tippen Sie auf den Tab "<b>"Kontakte"</b>"."\n</li>" "\n<li>"Tippen Sie auf den Kontakt, den Sie zu Ihren Favoriten hinzufügen möchten."\n</li>" "\n<li>"Tippen Sie auf die Markierung neben dem Kontaktnamen."\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Alle Kontakte"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Markiert"</string>
     <string name="liveFolder_phones_label" msgid="1709786878793436245">"Nummern"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Rückruf"</string>
     <string name="callAgain" msgid="3197312117049874778">"Erneut anrufen"</string>
     <string name="returnCall" msgid="8171961914203617813">"Zurückrufen"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> Minuten, <xliff:g id="SECONDS">%2$s</xliff:g> Sekunden"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> Minuten, <xliff:g id="SECONDS">%s</xliff:g> Sekunden"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Häufig kontaktiert"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Kontakt hinzufügen"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"\"<xliff:g id="EMAIL">%s</xliff:g>\" zu den Kontakten hinzufügen?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"Kontaktbild"</string>
     <string name="description_minus_button" msgid="387136707700230172">"minus"</string>
     <string name="description_plus_button" msgid="515164827856229880">"plus"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Kein freigeg. Speicher"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Keine SD-Karte"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Keinen freigegebenen Speicher gefunden"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Keine SD-Karte gefunden"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Keine SD-Karte"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Keine SD-Karte gefunden"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"vCard wird gesucht."</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Von SIM-Karte importieren"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Import aus freig. Speicher"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Von SD-Karte importieren"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Export in freig. Speicher"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"An SD-Karte exportieren"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Von SD-Karte importieren"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"An SD-Karte exportieren"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Sichtbare Kontakte weiterleiten"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Eine VCard-Datei importieren"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Mehrere VCard-Dateien importieren"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Alle VCard-Dateien importieren"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Suche nach vCard-Daten in freigegebenem Speicher"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Suche nach einer vCard-Information auf der SD-Karte"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Scannen des freigegebenen Speichers fehlgeschlagen"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Fehler beim Lesen der SD-Karte"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Scannen des freigegebenen Speichers fehlgeschlagen. Grund: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Fehler beim Lesen der SD-Karte. Grund: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Suche nach einer vCard-Information auf der SD-Karte"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Fehler beim Lesen der SD-Karte"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Fehler beim Lesen der SD-Karte. Grund: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"E/A-Fehler"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Zu wenig Speicherplatz (Datei ist eventuell zu groß)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Die vCard konnte aus einem unbekannten Grund nicht geparst werden."</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Beim Parsen der vCard ist ein Fehler aufgetreten. Obwohl die vCard anscheinend ein gültiges Format aufweist, wird sie von der aktuellen Implementierung nicht unterstützt."</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Im freigegebenen Speicher wurde keine vCard-Datei gefunden."</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Keine VCard-Datei auf der SD-Karte gefunden"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Keine VCard-Datei auf der SD-Karte gefunden"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Metainformationen konnten nicht von den angegebenen vCards abgerufen werden."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Fehler beim Import einer oder mehrerer Dateien (%s)"</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Unbekannter Fehler"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"vCard-Datei auswählen"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"vCard wird gelesen."</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"vCard-Dateien werden gelesen."</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Fehler beim Lesen der vCard-Daten"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> von <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> Kontakten"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> von <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> Dateien"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Caching von vCards in lokalen temporären Speicher"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"Importprogramm führt gerade Caching der vCard(s) in lokalen temporären Speicher durch. Der eigentliche Import beginnt gleich."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Fehler beim Lesen von vCard-Daten"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Lesen von vCard-Daten abgebrochen"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Import der vCard abgeschlossen"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"vCard-Importprogramm gestartet"</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"Das vCard-Importprogramm importiert nach kurzer Zeit die vCard."</string>
+    <string name="percentage" msgid="34897865327092209">"%s %%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Export bestätigen"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Soll Ihre Kontaktliste wirklich an \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\" exportiert werden?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Fehler beim Exportieren von Kontaktdaten"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Fehler beim Exportieren der Kontaktdaten."\n"Fehlerursache: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Es ist kein exportierbarer Kontakt vorhanden"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Zu viele vCard-Dateien im freigegebenen Speicher"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Zu viele vCard-Dateien auf der SD-Karte"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Zu viele vCard-Dateien auf der SD-Karte"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Erforderlicher Dateiname ist zu lang (\"<xliff:g id="FILENAME">%s</xliff:g>\")"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"vCard-Exportprogramm gestartet"</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Export der vCard abgeschlossen"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Kontaktdaten werden exportiert."</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Kontaktdaten werden in \"<xliff:g id="FILE_NAME">%s</xliff:g>\" exportiert."</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Exportprogramm konnte nicht initialisiert werden: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Fehler bei der Ermittlung von Datenbank-Informationen"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Es ist kein exportierbarer Kontakt vorhanden. Falls sich Kontakte auf Ihrem Telefon befinden, ist das Exportieren der Kontakte möglicherweise durch einen Datenanbieter gesperrt."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"Das Programm zum Erstellen der vCard wurde nicht richtig initialisiert."</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\"<xliff:g id="FILE_NAME">%1$s</xliff:g>\" konnte nicht geöffnet werden: <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> von <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> Kontakten"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\"<xliff:g id="FILE_NAME">%s</xliff:g>\" konnte nicht geöffnet werden: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> von <xliff:g id="TOTAL_NUMBER">%s</xliff:g> Kontakten"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Namen meiner Kontakte"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"2 Sekunden Pause hinzufügen"</string>
     <string name="add_wait" msgid="3360818652790319634">"Warten hinzufügen"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Für diese Aktion wurde keine Anwendung gefunden."</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Diese Auswahl speichern"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Unbekannt"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Keine Daten"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Konten"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importieren/Exportieren"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Kontakte importieren/exportieren"</string>
@@ -290,13 +301,13 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Alle weiteren Kontakte"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Alle Kontakte"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Wenn \"<xliff:g id="GROUP">%s</xliff:g>\" aus der Synchronisierung entfernt wird, werden auch alle nicht gruppierten Kontakte aus der Synchronisierung entfernt."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Nur Telefon (nicht synchronisiert)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Nur Telefon (nicht synchronisiert)"</string>
     <string name="call_custom" msgid="7756571794763171802">"<xliff:g id="CUSTOM">%s</xliff:g> anrufen"</string>
     <string name="call_home" msgid="1990519474420545392">"Anruf (privat)"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Anruf (mobil)"</string>
-    <string name="call_work" msgid="5328785911463744028">"Anruf (geschäftl.)"</string>
-    <string name="call_fax_work" msgid="7467763592359059243">"Anruf (Fax, geschäftl.)"</string>
-    <string name="call_fax_home" msgid="8342175628887571876">"Anruf Fax (privat)"</string>
+    <string name="call_work" msgid="5328785911463744028">"Anruf (Arbeit)"</string>
+    <string name="call_fax_work" msgid="7467763592359059243">"Anruf (Fax, Arbeit)"</string>
+    <string name="call_fax_home" msgid="8342175628887571876">"Faxanruf (privat)"</string>
     <string name="call_pager" msgid="9003902812293983281">"Anruf (Pager)"</string>
     <string name="call_other" msgid="8563753966926932052">"Anruf bei"</string>
     <string name="call_callback" msgid="1910165691349426858">"Rückrufnummer anrufen"</string>
@@ -308,16 +319,16 @@
     <string name="call_radio" msgid="8296755876398357063">"Anruf (Mobilfunk)"</string>
     <string name="call_telex" msgid="2223170774548648114">"Telexnummer anrufen"</string>
     <string name="call_tty_tdd" msgid="8951266948204379604">"TTY/TDD anrufen"</string>
-    <string name="call_work_mobile" msgid="8707874281430105394">"Anruf Handy (geschäftl.)"</string>
-    <string name="call_work_pager" msgid="3419348514157949008">"Anruf Pager (geschäftl.)"</string>
+    <string name="call_work_mobile" msgid="8707874281430105394">"Mobilfunknummer (geschäftlich) anrufen"</string>
+    <string name="call_work_pager" msgid="3419348514157949008">"Pager (beruflich) anrufen"</string>
     <string name="call_assistant" msgid="2141641383068514308">"<xliff:g id="ASSISTANT">%s</xliff:g> anrufen"</string>
     <string name="call_mms" msgid="6274041545876221437">"Anruf (MMS)"</string>
     <string name="sms_custom" msgid="5932736853732191825">"Text <xliff:g id="CUSTOM">%s</xliff:g>"</string>
-    <string name="sms_home" msgid="7524332261493162995">"SMS (privat)"</string>
+    <string name="sms_home" msgid="7524332261493162995">"Text (privat)"</string>
     <string name="sms_mobile" msgid="5200107250451030769">"Text (mobil)"</string>
-    <string name="sms_work" msgid="2269624156655267740">"SMS (geschäftl.)"</string>
-    <string name="sms_fax_work" msgid="8028189067816907075">"SMS an Fax (geschäftl.)"</string>
-    <string name="sms_fax_home" msgid="9204042076306809634">"SMS an Fax (privat)"</string>
+    <string name="sms_work" msgid="2269624156655267740">"Text (Arbeit)"</string>
+    <string name="sms_fax_work" msgid="8028189067816907075">"Text (Fax, Arbeit)"</string>
+    <string name="sms_fax_home" msgid="9204042076306809634">"Text (Fax, privat)"</string>
     <string name="sms_pager" msgid="7730404569637015192">"Text-Pager"</string>
     <string name="sms_other" msgid="806127844607642331">"Textnachricht an"</string>
     <string name="sms_callback" msgid="5004824430094288752">"Textnachricht an Rückrufnummer"</string>
@@ -329,29 +340,30 @@
     <string name="sms_radio" msgid="3329166673433967820">"Text (Mobilfunk)"</string>
     <string name="sms_telex" msgid="9034802430065267848">"Textnachricht an Telex"</string>
     <string name="sms_tty_tdd" msgid="6782284969132531532">"Textnachricht an TTY/TDD"</string>
-    <string name="sms_work_mobile" msgid="2459939960512702560">"SMS an Handy (geschäftl.)"</string>
-    <string name="sms_work_pager" msgid="5566924423316960597">"SMS an Pager (geschäftl.)"</string>
+    <string name="sms_work_mobile" msgid="2459939960512702560">"Textnachricht an Mobilfunknummer (geschäftlich)"</string>
+    <string name="sms_work_pager" msgid="5566924423316960597">"Textnachricht an Pager (geschäftlich)"</string>
     <string name="sms_assistant" msgid="2773424339923116234">"Textnachricht an <xliff:g id="ASSISTANT">%s</xliff:g>"</string>
     <string name="sms_mms" msgid="4069352461380762677">"Text (MMS)"</string>
     <string name="email_home" msgid="8573740658148184279">"E-Mail (privat)"</string>
     <string name="email_mobile" msgid="2042889209787989814">"E-Mail (mobil)"</string>
-    <string name="email_work" msgid="2807430017302722689">"E-Mail (geschäftl.)"</string>
+    <string name="email_work" msgid="2807430017302722689">"E-Mail (Arbeit)"</string>
     <string name="email_other" msgid="3454004077967657109">"E-Mail an"</string>
     <string name="email_custom" msgid="7548003991586214105">"E-Mail <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="email" msgid="5668400997660065897">"E-Mail"</string>
     <string name="map_home" msgid="1243547733423343982">"Privatadresse anzeigen"</string>
-    <string name="map_work" msgid="1360474076921878088">"Geschäftsadresse anzeigen"</string>
+    <string name="map_work" msgid="1360474076921878088">"Arbeitsadresse anzeigen"</string>
     <string name="map_other" msgid="3817820803587012641">"Adresse anzeigen"</string>
     <string name="map_custom" msgid="6184363799976265281">"<xliff:g id="CUSTOM">%s</xliff:g>-Adresse anzeigen"</string>
     <string name="chat_aim" msgid="2588492205291249142">"Chat über AIM"</string>
     <string name="chat_msn" msgid="8041633440091073484">"Chat über Windows Live"</string>
-    <string name="chat_yahoo" msgid="6629211142719943666">"Chat über Yahoo!"</string>
+    <string name="chat_yahoo" msgid="6629211142719943666">"Chat über Yahoo"</string>
     <string name="chat_skype" msgid="1210045020427480566">"Chat über Skype"</string>
     <string name="chat_qq" msgid="4294637812847719693">"Chat über QQ"</string>
     <string name="chat_gtalk" msgid="981575737258117697">"Chat über Google Talk"</string>
     <string name="chat_icq" msgid="8438405386153745775">"Chat über ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Chat über Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Chat"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Adresse"</string>
     <string name="postal_street" msgid="8133143961580058972">"Straße"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Postfach"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Nachbarschaft"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Bundesland"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Postleitzahl"</string>
     <string name="postal_country" msgid="7638264508416368690">"Land"</string>
+    <string name="full_name" msgid="6602579550613988977">"Name"</string>
     <string name="name_given" msgid="1687286314106019813">"Vorname"</string>
     <string name="name_family" msgid="3416695586119999058">"Nachname"</string>
     <string name="name_prefix" msgid="59756378548779822">"Namenpräfix"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Phonetischer Nachname"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g>-Kontakt"</string>
     <string name="from_account_format" msgid="687567483928582084">"von <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"<xliff:g id="SOURCE_0">%1$s</xliff:g>-Kontakt aus <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Dieses Foto verwenden"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"<xliff:g id="SOURCE">%1$s</xliff:g>-Kontaktinformationen können auf diesem Gerät nicht bearbeitet werden."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Keine Zusatzinformationen zu diesem Kontakt"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Foto aus Galerie auswählen"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"Die Kontaktliste wird an die geänderte Sprache angepasst."\n\n"Bitte warten..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Die Kontaktliste wird aktualisiert."\n\n"Bitte warten..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Kontakte werden gerade aktualisiert. "\n\n"Das Upgrade erfordert etwa <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g>MB des internen Telefonspeichers."\n\n"Wählen Sie eine der folgenden Optionen:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Kontakte werden gerade aktualisiert. "\n\n"Das Upgrade erfordert etwa <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB des internen Telefonspeichers."\n\n"Wählen Sie eine der folgenden Optionen:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Einige Anwendungen deinstallieren"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Upgrade wiederholen"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Suchergebnisse für: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Suche..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Wird geladen..."</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Auswahl anzeigen"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Alle anzeigen"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Alles auswählen"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Auswahl für alle aufheben"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"Ein Empfänger ausgewählt"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> Empfänger ausgewählt"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Unbekannte Kontakte"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Kein Kontakt ausgewählt"</string>
+    <string name="add_field" msgid="5257149039253569615">"Informationen hinzufügen"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"über <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> über <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"bearbeiten"</string>
+    <string name="description_star" msgid="2605854427360036550">"Favorit"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Kontakt bearbeiten"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"nicht zusammengeführt"</item>
+    <item quantity="other" msgid="425683718017380845">"aus <xliff:g id="COUNT">%0$d</xliff:g> Quellen zusammengeführt"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Löschen"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Fehler beim Speichern"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Andere"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml
index 52efedb..358325e 100644
--- a/res/values-el/strings.xml
+++ b/res/values-el/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Λεπτομέρειες επαφής"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Προβολή επαφής"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Επεξεργασία επαφής"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"Διεύθυνση ηλεκτρονικού ταχυδρομείου:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Τύπος:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Δημιουργία επαφής"</string>
     <string name="searchHint" msgid="8482945356247760701">"Αναζήτηση επαφών"</string>
     <string name="menu_search" msgid="9147752853603483719">"Αναζήτηση"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Νέα επαφή"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Φωνητική"</string>
     <string name="label_notes" msgid="8337354953278341042">"Σημειώσεις"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Κλήση Internet"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Ήχος κλήσης"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Όνομα και επίθετο"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Φωνητικό όνομα"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Δεν υπάρχουν ορατές επαφές"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"Βρέθηκε 1 επαφή"</item>
-    <item quantity="other" msgid="7752927996850263152">"Βρέθηκαν <xliff:g id="COUNT">%d</xliff:g> επαφές"</item>
+    <item quantity="one" msgid="5517063038754171134">"Βρέθηκε 1"</item>
+    <item quantity="other" msgid="3852668542926965042">"Βρέθηκαν <xliff:g id="COUNT">%d</xliff:g>"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Δεν βρέθηκε η επαφή"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Δεν βρέθηκε"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 επαφή"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> επαφές"</item>
+    <item quantity="one" msgid="4826918429708286628">"Βρέθηκε 1"</item>
+    <item quantity="other" msgid="7988132539476575389">"Βρέθηκαν <xliff:g id="COUNT">%d</xliff:g>"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Επαφές"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Αγαπ."</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Επαφές στην κάρτα SIM"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Δεν υπάρχουν επαφές για προβολή. (Εάν προσθέσατε τώρα ένα λογαριασμό, ο συγχρονισμός των επαφών μπορεί να καθυστερήσει μερικά λεπτά.)"</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Δεν υπάρχουν επαφές για προβολή."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Δεν έχετε επαφές προς προβολή."\n\n"Για προσθήκη επαφών, πατήστε "<font fgcolor="#ffffffff"><b>"Μενού"</b></font>" και αγγίξτε:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Λογαριασμοί"</b></font>" για προσθήκη ή διαμόρφωση λογαριασμού με επαφές που μπορείτε να συγχρονίσετε στο τηλέφωνο"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Νέα επαφή"</b></font>" για δημιουργία νέας επαφής από το μηδέν"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Εισαγωγή/Εξαγωγή"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Δεν έχετε επαφές προς προβολή. (Αν προσθέσατε κάποιον λογαριασμό μόλις τώρα, θα χρειαστούν λίγα λεπτά έως ότου γίνει ο συγχρονισμός.)"\n\n"Για την προσθήκη επαφών, πατήστε "<font fgcolor="#ffffffff"><b>"Μενού"</b></font>" και αγγίξτε την επιλογή:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Λογαριασμοί"</b></font>" για την προσθήκη ή διαμόρφωση λογαριασμού με επαφές τις οποίες μπορείτε να συγχρονίσετε στο τηλέφωνο"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Επιλογές προβολής"</b></font>" για να αλλάξετε τις επαφές που είναι ορατές"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Νέα επαφή"</b></font>" για δημιουργία νέας επαφής από το μηδέν"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Εισαγωγή/Εξαγωγή"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Δεν έχετε επαφές προς προβολή."\n\n"Για προσθήκη επαφών, πατήστε "<font fgcolor="#ffffffff"><b>"Μενού"</b></font>" και αγγίξτε την επιλογή:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Λογαριασμοί"</b></font>" για προσθήκη ή διαμόρφωση λογαριασμού με επαφές που μπορείτε να συγχρονίσετε στο τηλέφωνο"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Νέα επαφή"</b></font>" για δημιουργία νέας επαφής από το μηδέν"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Εισαγωγή/Εξαγωγή"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Δεν έχετε επαφές προς προβολή. (Αν προσθέσατε κάποιον λογαριασμό μόλις τώρα, θα χρειαστούν λίγα λεπτά έως ότου γίνει ο συγχρονισμός.)"\n\n"Για την προσθήκη επαφών, πατήστε "<font fgcolor="#ffffffff"><b>"Μενού"</b></font>" και αγγίξτε την επιλογή:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Λογαριασμοί"</b></font>" για την προσθήκη ή διαμόρφωση λογαριασμού με επαφές τις οποίες μπορείτε να συγχρονίσετε στο τηλέφωνο"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Προβολή επιλογών"</b></font>" για να αλλάξετε τις επαφές που είναι ορατές"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Νέα επαφή"</b></font>" για δημιουργία νέας επαφής από το μηδέν"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Εισαγωγή/Εξαγωγή"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"Δεν έχετε επαφές προς προβολή."\n\n"Για προσθήκη επαφών, πατήστε "<font fgcolor="#ffffffff"><b>"Μενού"</b></font>" και αγγίξτε την επιλογή:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Λογαριασμοί"</b></font>" για προσθήκη ή διαμόρφωση λογαριασμού με επαφές που μπορείτε να συγχρονίσετε στο τηλέφωνο"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Νέα επαφή"</b></font>" για δημιουργία νέας επαφής από το μηδέν"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Εισαγωγή/Εξαγωγή"</b></font>" για την εισαγωγή επαφών από την κάρτα SIM ή SD"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Δεν έχετε επαφές προς προβολή. (Αν προσθέσατε κάποιο λογαριασμό μόλις τώρα, θα χρειαστούν λίγα λεπτά έως ότου γίνει ο συγχρονισμός.)"\n\n"Για την προσθήκη επαφών, πατήστε "<font fgcolor="#ffffffff"><b>"Μενού"</b></font>" και αγγίξτε την επιλογή:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Λογαριασμοί"</b></font>" για την προσθήκη ή διαμόρφωση λογαριασμού με επαφές τις οποίες μπορείτε να συγχρονίσετε στο τηλέφωνο"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Προβολή επιλογών"</b></font>" για να αλλάξετε τις επαφές που είναι ορατές"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Νέα επαφή"</b></font>" για δημιουργία νέας επαφής από το μηδέν"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Εισαγωγή/Εξαγωγή"</b></font>" για την εισαγωγή επαφών από την κάρτα SIM ή SD"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"Δεν έχετε επαφές προς προβολή."\n\n"Για προσθήκη επαφών, πατήστε "<font fgcolor="#ffffffff"><b>"Μενού"</b></font>" και αγγίξτε την επιλογή:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Λογαριασμοί"</b></font>" για προσθήκη ή διαμόρφωση λογαριασμού με επαφές που μπορείτε να συγχρονίσετε στο τηλέφωνο"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Νέα επαφή"</b></font>" για δημιουργία νέας επαφής από το μηδέν"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Εισαγωγή/Εξαγωγή"</b></font>" για την εισαγωγή επαφών από την κάρτα SD"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Δεν έχετε επαφές προς προβολή. (Αν προσθέσατε κάποιον λογαριασμό μόλις τώρα, θα χρειαστούν λίγα λεπτά έως ότου γίνει ο συγχρονισμός.)"\n\n"Για την προσθήκη επαφών, πατήστε "<font fgcolor="#ffffffff"><b>"Μενού"</b></font>" και αγγίξτε την επιλογή:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Λογαριασμοί"</b></font>" για την προσθήκη ή διαμόρφωση λογαριασμού με επαφές τις οποίες μπορείτε να συγχρονίσετε στο τηλέφωνο"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Προβολή επιλογών"</b></font>" για να αλλάξετε τις επαφές που είναι ορατές"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Νέα επαφή"</b></font>" για δημιουργία νέας επαφής από το μηδέν"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Εισαγωγή/Εξαγωγή"</b></font>" για την εισαγωγή επαφών από την κάρτα SD"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Δεν έχετε αγαπημένα."\n\n"Για προσθήκη επαφής στη λίστα των αγαπημένων σας:"\n\n"        "<li>"Αγγίξτε την καρτέλα "<b>"Επαφές"</b>\n</li>" "\n<li>"Αγγίξτε το όνομα της επαφής που θέλετε να προσθέσετε στα αγαπημένα σας"\n</li>" "\n<li>"Αγγίξτε το αστέρι πλάι στο όνομα της επαφής"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Όλες οι επαφές"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Με αστέρι"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Επανάκληση"</string>
     <string name="callAgain" msgid="3197312117049874778">"Επανάληψη κλήσης"</string>
     <string name="returnCall" msgid="8171961914203617813">"Επιστροφή κλήσης"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> λεπτά <xliff:g id="SECONDS">%2$s</xliff:g> δευτερόλεπτα"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> λεπτά <xliff:g id="SECONDS">%s</xliff:g> δευτερόλεπτα"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Επαφές με τις οποίες έχετε συχνή επικοινωνία"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Προσθήκη επαφής"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Προσθήκη του \"<xliff:g id="EMAIL">%s</xliff:g>\" στις επαφές?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"φωτογραφία επαφής"</string>
     <string name="description_minus_button" msgid="387136707700230172">"μείον"</string>
     <string name="description_plus_button" msgid="515164827856229880">"συν"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Χωρίς κοινόχρ. αποθ. χώρο"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Δεν υπάρχει κάρτα SD"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Δεν βρέθηκε κοινός χώρος"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Δεν ανιχνεύθηκε κάρτα SD"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Δεν υπάρχει κάρτα SD"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Δεν ανιχνεύθηκε κάρτα SD"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Αναζήτηση κάρτας vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Εισαγωγή από κάρτα SIM"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Εισαγωγή από κοινό χώρο"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Εισαγωγή από κάρτα SD"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Εξαγωγή σε κοινό χώρο"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Εξαγωγή σε κάρτα SD"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Εισαγωγή από κάρτα SD"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Εξαγωγή σε κάρτα SD"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Κοινή χρήση ορατών επαφών"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Εισαγωγή ενός αρχείου VCard"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Εισαγωγή πολλαπλών αρχείων vCard"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Εισαγωγή όλων των αρχείων vCard"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Αναζήτηση δεδομένων vCard στον κοινόχρηστο αποθηκευτικό χώρο"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Αναζήτηση για δεδομένα vCard στην κάρτα SD"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Η σάρωση του κοινόχρηστου αποθηκευτικού χώρου απέτυχε"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Η σάρωση της κάρτας SD απέτυχε"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Η σάρωση του κοινόχρηστου αποθηκευτικού χώρου απέτυχε (Αιτία: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Η σάρωση της κάρτας SD απέτυχε (Αιτία:\"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Αναζήτηση για δεδομένα vCard στην κάρτα SD"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Η σάρωση της κάρτας SD απέτυχε"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Η σάρωση της κάρτας SD απέτυχε (Αιτία:\"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Σφάλμα I/O"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Η μνήμη είναι ανεπαρκής (το αρχείο μπορεί να είναι πολύ μεγάλο)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Η ανάλυση της κάρτας vCard απέτυχε εξαιτίας μη αναμενόμενου συμβάντος"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Αν και το VCard φαίνεται να βρίσκεται σε έγκυρη μορφή, η ανάλυσή του απέτυχε, εφόσον η τρέχουσα εφαρμογή δεν το υποστηρίζει"</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Δεν βρέθηκαν αρχεία vCard στον κοινόχρηστο αποθηκευτικό σας χώρο"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Δεν βρέθηκε αρχείο VCard στην κάρτα SD"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Δεν βρέθηκε αρχείο VCard στην κάρτα SD"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Η συλλογή μετα-πληροφοριών του δεδομένου αρχείου(ων) vCard απέτυχε."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Η εισαγωγή ενός ή περισσοτέρων αρχείων απέτυχε (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Άγνωστο σφάλμα"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Επιλογή αρχείου vCard"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Ανάγνωση vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Ανάγνωση αρχείου(ων) vCard"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Η ανάγνωση των δεδομένων vCard απέτυχε"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> από <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> επαφές"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> από <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> αρχεία"</string>
-    <string name="confirm_export_title" msgid="7648747763127442983">"Επιβεβαίωση εξαγωγής"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Αποθήκευση vCard(s) σε τοπικό προσωρινό χώρο αποθήκευσης"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"Το πρόγραμμα εισαγωγής αποθηκεύει προσωρινά vCard(s) σε τοπικό χώρο προσωρινής αποθήκευσης. Η κανονική εισαγωγή θα ξεκινήσει σύντομα."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Αποτυχία ανάγνωσης δεδομένων vCard"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Η ανάγνωση των δεδομένων vCard ακυρώθηκε"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Η εισαγωγή vCard ολοκληρώθηκε"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Έγινε εκκίνηση του προγράμματος εισαγωγής vCard."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"Το πρόγραμμα εισαγωγής vCard θα εισαγάγει την vCard μετά από λίγο."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
+    <string name="confirm_export_title" msgid="7648747763127442983">"Επιβεβαίωση\nεξαγωγής"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Είστε σίγουροι ότι θέλετε να εξαγάγετε τη λίστα των επαφών σας στο \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\";"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Αποτυχία εξαγωγής δεδομένων επαφής"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Αποτυχία εξαγωγής δεδομένων επαφής."\n"Αιτία αποτυχίας: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Δεν υπάρχει επαφή με δυνατότητα εξαγωγής"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Υπερβολικά μεγάλος όγκος αρχείων VCard στον κοινόχρηστο αποθηκευτικό χώρο"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Υπερβολικά μεγάλος όγκος αρχείων VCard στην κάρτα SD"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Υπερβολικά μεγάλος όγκος αρχείων VCard στην κάρτα SD"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Το απαιτούμενο όνομα αρχείου είναι υπερβολικά μεγάλο (\"<xliff:g id="FILENAME">%s</xliff:g>\")"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Εκκινήθηκε το πρόγραμμα εξαγωγής vCard."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Η εξαγωγή της vCard ολοκληρώθηκε"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Εξαγωγή δεδομένων επαφών"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Εξαγωγή δεδομένων επαφών προς \"<xliff:g id="FILE_NAME">%s</xliff:g>\""</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Δεν ήταν δυνατή η εκκίνηση της εξαγωγής: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Αποτυχία λήψης πληροφοριών βάσης δεδομένων"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Δεν υπάρχει επαφή με δυνατότητα εξαγωγής. Αν έχετε επαφές στο τηλέφωνό σας, ενδέχεται να μην επιτρέπεται η εξαγωγή όλων των επαφών εκτός του τηλεφώνου από κάποιον πάροχο δεδομένων."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"Δεν έχει γίνει σωστή εκκίνηση του προγράμματος σύνθεσης της vCard"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Δεν ήταν δυνατό το άνοιγμα του \"<xliff:g id="FILE_NAME">%1$s</xliff:g>\": <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> από <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> επαφές"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Δεν ήταν δυνατό το άνοιγμα του \"<xliff:g id="FILE_NAME">%s</xliff:g>\": <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> από <xliff:g id="TOTAL_NUMBER">%s</xliff:g> επαφές"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Ονόματα ων επαφών σας"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Προσθήκη παύσης 2 δευτερολέπτων"</string>
     <string name="add_wait" msgid="3360818652790319634">"Προσθήκη αναμονής"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Δεν βρέθηκε εφαρμογή για τη διαχείριση αυτής της ενέργειας"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Διατήρηση αυτής της επιλογής"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Άγνωστος"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Δεν υπάρχουν δεδομένα"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Λογαριασμοί"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Εισαγωγή/Εξαγωγή"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Εισαγωγή/Εξαγωγή επαφών"</string>
@@ -283,14 +294,14 @@
     <string name="edit_read_only" msgid="8158629550655830981">"Αυτή η επαφή είναι μόνο για ανάγνωση"</string>
     <string name="edit_secondary_collapse" msgid="5371618426594477103">"Περισσότερα"</string>
     <string name="dialog_primary_name" msgid="5521591005692614833">"Κύριο όνομα"</string>
-    <string name="dialog_new_contact_account" msgid="9044704073286262197">"Δημιουργία επαφής στον λογαριασμό"</string>
+    <string name="dialog_new_contact_account" msgid="9044704073286262197">"Δημιουργία επαφής\nστον λογαριασμό"</string>
     <string name="menu_sync_remove" msgid="3266725887008450161">"Κατάργηση ομάδας συγχρονισμού"</string>
     <string name="dialog_sync_add" msgid="8267045393119375803">"Προσθήκη ομάδας συγχρονισμού"</string>
     <string name="display_more_groups" msgid="2682547080423434170">"Περισσότερες ομάδες…"</string>
     <string name="display_ungrouped" msgid="4602580795576261158">"Όλες οι άλλες επαφές"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Όλες οι επαφές"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Η κατάργηση της ομάδας \"<xliff:g id="GROUP">%s</xliff:g>\" από τον συγχρονισμό θα καταργήσει επίσης και τις επαφές χωρίς ομαδοποίηση από τον συγχρονισμό."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Μόνο στο τηλέφωνο (Χωρίς συγχρονισμό)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Μόνο στο τηλέφωνο (Χωρίς συγχρονισμό)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Κλήση <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Κλήση οικίας"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Κλήση κινητής συσκευής"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Συζήτηση μέσω ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Συζήτηση μέσω Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Συζήτηση"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Διεύθυνση"</string>
     <string name="postal_street" msgid="8133143961580058972">"Οδός"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Ταχυδρομική θυρίδα"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Γειτονιά"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Πολιτεία"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Ταχυδρομικός κώδικας"</string>
     <string name="postal_country" msgid="7638264508416368690">"Χώρα"</string>
+    <string name="full_name" msgid="6602579550613988977">"Όνομα"</string>
     <string name="name_given" msgid="1687286314106019813">"Όνομα"</string>
     <string name="name_family" msgid="3416695586119999058">"Επίθετο"</string>
     <string name="name_prefix" msgid="59756378548779822">"Πρόθεμα ονόματος"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Φωνητική γραφή επιθέτου"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g> επαφή"</string>
     <string name="from_account_format" msgid="687567483928582084">"από <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"Επαφή <xliff:g id="SOURCE_0">%1$s</xliff:g> από <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Χρήση αυτής της φωτογραφίας"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"Τα στοιχεία επικοινωνίας της επαφής <xliff:g id="SOURCE">%1$s</xliff:g> δεν μπορούν να υποβληθούν σε επεξεργασία σε αυτήν τη συσκευή."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Δεν υπάρχουν πρόσθετες πληροφορίες για αυτήν την επαφή"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Επιλογή φωτογραφίας από τη συλλογή"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"Η λίστα επαφών ενημερώνεται ώστε να αντικατοπτρίζει την αλλαγή γλώσσας."\n\n"Περιμένετε..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Γίνεται ενημέρωση της λίστας επαφών."\n\n"Περιμένετε..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Γίνεται αναβάθμιση των επαφών. "\n\n"Η διαδικασία αναβάθμισης απαιτεί περίπου <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g>Mb από τον εσωτερικό χώρο αποθήκευσης του τηλεφώνου."\n\n"Ορίστε μία από τις παρακάτω επιλογές:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Γίνεται αναβάθμιση των επαφών. "\n\n"Η διαδικασία αναβάθμισης απαιτεί περίπου <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g>Mb από τον εσωτερικό χώρο αποθήκευσης του τηλεφώνου."\n\n"Ορίστε μία από τις παρακάτω επιλογές:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Καταργήστε την εγκατάσταση ορισμένων εφαρμογών"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Επανάληψη αναβάθμισης"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Αποτελέσματα αναζήτησης για: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Αναζήτηση..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Φόρτωση …"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Εμφάνιση επιλεγμένων"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Εμφάνιση όλων\n"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Επιλογή όλων"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Αποεπιλογή όλων"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"επιλέχθηκε 1 παραλήπτης"</item>
+    <item quantity="other" msgid="4608837420986126229">"επιλέχθηκαν <xliff:g id="COUNT">%d</xliff:g> παραλήπτες"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Άγνωστες επαφές"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Δεν έχουν επιλεγεί επαφές."</string>
+    <string name="add_field" msgid="5257149039253569615">"Προσθήκη πληροφοριών"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"μέσω <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> μέσω <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"επεξεργασία"</string>
+    <string name="description_star" msgid="2605854427360036550">"αγαπημένο"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Επεξεργασία επαφής"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"δεν συγχωνεύθηκαν"</item>
+    <item quantity="other" msgid="425683718017380845">"συγχώνευση από <xliff:g id="COUNT">%0$d</xliff:g> προελεύσεις"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Διαγραφή"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Σφάλμα κατά την αποθήκευση"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Άλλο"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"Α;Β;Γ;Δ;Ε;Ζ;Η;Θ;Ι;Κ;Λ;Μ;Ν;Ξ;Ο;Π;Ρ;Σ;Τ;Υ;Φ;Χ;Ψ;Ω"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml
index ce15ff2..23d7884 100644
--- a/res/values-es-rUS/strings.xml
+++ b/res/values-es-rUS/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Detalles de contacto"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Ver contacto"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Editar contacto"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"Dirección de correo electrónico:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Tipo:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Crear contacto"</string>
     <string name="searchHint" msgid="8482945356247760701">"Buscar contactos"</string>
     <string name="menu_search" msgid="9147752853603483719">"Buscar"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Nuevo contacto"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Fonético"</string>
     <string name="label_notes" msgid="8337354953278341042">"Notas"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Llamada de Internet"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Tono de llamada"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Primero y último"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Nombre fonético"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"No hay contactos visibles"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"Se encontró 1 contacto"</item>
-    <item quantity="other" msgid="7752927996850263152">"Se encontraron <xliff:g id="COUNT">%d</xliff:g> contactos"</item>
+    <item quantity="one" msgid="5517063038754171134">"Se encontró uno (1)"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g>Se encontró un "</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"No se ha encontrado este contacto."</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"No se ha encontrado"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 contacto"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> contactos"</item>
+    <item quantity="one" msgid="4826918429708286628">"Se encontró uno (1)"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g>Se encontró un "</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Contactos"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favoritos"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Contactos de tarjeta SIM"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"No tienes ningún contacto para mostrar. (Si has agregado una cuenta recientemente, la sincronización de los contactos puede demorar algunos minutos)."</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"No tienes ningún contacto para mostrar."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"No tienes ningún contacto para mostrar."\n\n"Para agregar contactos, presiona "<font fgcolor="#ffffffff"><b>"Menú"</b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para agregar o configurar una cuenta con contactos que puedes sincronizar en el teléfono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear tú mismo un contacto nuevo"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"No tienes ningún contacto para mostrar. (Si has agregado una cuenta, la sincronización de contactos puede demorar pocos minutos)."\n\n"Para agregar contactos, presiona "<font fgcolor="#ffffffff"><b>"Menú"</b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para agregar y configurar una cuenta con contactos que puedes sincronizar en el teléfono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Mostrar opciones"</b></font>" para cambiar los contactos que sean visibles"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear tú mismo un contacto nuevo"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"No tienes ningún contacto para mostrar."\n\n"Para agregar contactos, presiona "<font fgcolor="#ffffffff"><b>"Menú"</b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para agregar o configurar una cuenta con contactos que puedes sincronizar en el teléfono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear tú mismo un contacto nuevo"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"No tienes ningún contacto para mostrar. (Si has agregado una cuenta, la sincronización de contactos puede demorar pocos minutos)."\n\n"Para agregar contactos, presiona "<font fgcolor="#ffffffff"><b>"Menú"</b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para agregar y configurar una cuenta con contactos que puedes sincronizar en el teléfono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Mostrar opciones"</b></font>" para cambiar los contactos que sean visibles"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear tú mismo un contacto nuevo"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"No tienes ningún contacto para mostrar."\n\n"Para agregar contactos, presiona "<font fgcolor="#ffffffff"><b>"Menú"</b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para agregar o configurar una cuenta con contacto que puedas sincronizar en el teléfono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear un contacto desde cero"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contactos desde tu tarjeta SIM o SD"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"No tienes ningún contacto para mostrar. (Si has agregado una cuenta, la sincronización de contactos puede demorar algunos minutos)."\n\n"Para agregar contactos, presiona "<font fgcolor="#ffffffff"><b>"Menú"</b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para agregar y configurar una cuenta con contactos que puedes sincronizar en el teléfono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Mostrar opciones"</b></font>" para cambiar los contactos que sean visibles"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear tú mismo un contacto nuevo"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contactos de tu tarjeta SIM o SD"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"No tienes ningún contacto para mostrar."\n\n"Para agregar contactos, presiona "<font fgcolor="#ffffffff"><b>"Menú"</b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para agregar o configurar una cuenta con contactos que puedes sincronizar en el teléfono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear tú mismo un contacto nuevo"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contactos desde tu tarjeta SD"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"No tienes ningún contacto para mostrar. (Si has agregado una cuenta, la sincronización de contactos puede demorar algunos minutos)."\n\n"Para agregar contactos, presiona "<font fgcolor="#ffffffff"><b>"Menú"</b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para agregar y configurar una cuenta con contactos que puedes sincronizar en el teléfono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Mostrar opciones"</b></font>" para cambiar los contactos que sean visibles"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear tú mismo un contacto nuevo"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contactos desde tu tarjeta SD"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"No tienes ningún favorito."\n\n"Para agregar un contacto a tu lista de favoritos:"\n\n<li>"toca la pestaña "<b>"Contactos"</b>" "\n</li>" "\n<li>"toca el contacto que deseas agregar a tus favoritos"\n</li>" "\n<li>"toca el asterisco situado junto al nombre del contacto"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Todos los contactos"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Marcado con asterisco"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Volver a llamar"</string>
     <string name="callAgain" msgid="3197312117049874778">"Llamar nuevamente"</string>
     <string name="returnCall" msgid="8171961914203617813">"Regresar llamada"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> mins <xliff:g id="SECONDS">%2$s</xliff:g> s"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> mins <xliff:g id="SECONDS">%s</xliff:g> s"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Contactado con frecuencia"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Agregar contacto"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"¿Deseas agregar \"<xliff:g id="EMAIL">%s</xliff:g>\" a los contactos?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"foto de contacto"</string>
     <string name="description_minus_button" msgid="387136707700230172">"negativo"</string>
     <string name="description_plus_button" msgid="515164827856229880">"más"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Alm. comp. no disp."</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"No hay tarjeta SD"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"No se detectó el alm. comp."</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"No se ha detectado ninguna tarjeta SD"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"No hay tarjeta SD"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"No se ha detectado ninguna tarjeta SD"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Buscando vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importar de la tarjeta SIM"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Importar desde alm. comp."</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importar de la tarjeta SD"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Exportar a alm. compartido"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Exportar a la tarjeta SD"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importar de la tarjeta SD"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Exportar a la tarjeta SD"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Compartir contactos visibles"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importar un archivo de vCard"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importar múltiples archivos de vCard"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importar todos los archivos de vCard"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Buscando datos de vCard en el almacenamiento compartido"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Buscando datos de vCard en la tarjeta SD"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Explorando falla en el almacenamiento compartido"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"No se ha podido explorar la tarjeta SD"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Explorando falla en el almacenamiento compartido (Razón: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"No se ha podido explorar la tarjeta SD. (Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Buscando datos de vCard en la tarjeta SD"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"No se ha podido explorar la tarjeta SD"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"No se ha podido explorar la tarjeta SD. (Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Error de E/S"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Memoria insuficiente (es probable que el archivo sea muy grande)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"No se ha podido analizar vCard debido a un motivo inesperado"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"No se ha podido analizar vCard aunque el formato parece válido, ya que la implementación actual no lo admite"</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"No se encontró un archivo vCard en el almacenamiento compartido."</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"No se ha encontrado un archivo de vCard en la Tarjeta SD."</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"No se ha encontrado un archivo de vCard en la Tarjeta SD."</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Error al recopilar metadatos de un archivo específico de la vCard."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"No se pudieron importar uno o más archivos (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Error desconocido"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Seleccionar archivo de vCard"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"Segmento <xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Leyendo vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Leyendo archivo(s) de vCard"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"No se han podido leer los datos de vCard"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contactos"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> archivos"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Almacenando vCard(s) en caché local temporal"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"El importador está almacenando la(s) vCard(s) en un caché local temporal. La importación comenzará pronto."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Error al leer los datos de la vCard"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Se canceló la lectura de datos de la vCard"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Finalizó la importación de la vCard"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Importador de vCard iniciado."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"El Importador de vCard importará la vCard en un momento."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Confirmar exportación"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"¿Estás seguro de que deseas exportar tu lista de contactos a \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\"?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"No se han podido exportar los datos de contacto"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"No se han podido exportar los datos de contacto."\n"Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"No hay ningún contacto exportable"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Demasiados archivos de vCard en el almacenamiento compartido"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Demasiados archivos de vCard en la tarjeta SD"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Demasiados archivos de vCard en la tarjeta SD"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"El nombre de archivo requerido es demasiado largo (\"<xliff:g id="FILENAME">%s</xliff:g>\")"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Exportador de vCard iniciado."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Finalizó la importación de vCard"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Exportando datos de contacto"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Exportando datos de contacto a \"<xliff:g id="FILE_NAME">%s</xliff:g>\""</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"No se ha podido inicializar el exportador: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"No se ha podido obtener información de la base de datos"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"No hay ningún contacto exportable. Si en realidad tienes contactos en tu teléfono, es posible que algún proveedor de datos prohíba la exportación de todos los contactos."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"El redactor de vCard no se ha inicializado correctamente"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"No se pudo abrir \"<xliff:g id="FILE_NAME">%1$s</xliff:g>\": <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contactos"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"No se pudo abrir \"<xliff:g id="FILE_NAME">%s</xliff:g>\": <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%s</xliff:g> contactos"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Nombres de tus contactos"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Agregar pausa de 2 segundos"</string>
     <string name="add_wait" msgid="3360818652790319634">"Agregar espera"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"No se encontró una aplicación para manejar esta acción."</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Recuerda esta opción."</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Desconocido"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Sin datos"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Cuentas"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importar/Exportar"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importar/Exportar contactos"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Todos los otros contactos"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Todos los contactos"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Al suprimir \"<xliff:g id="GROUP">%s</xliff:g>\" de sincronización también se suprimirá cualquier contacto no agrupado de la sincronización."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Sólo telefónicamente (no sincronizado)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Sólo telefónicamente (no sincronizado)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Llamar a <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Llamar al hogar"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Llamar al celular"</string>
@@ -301,7 +312,7 @@
     <string name="call_other" msgid="8563753966926932052">"Llamar"</string>
     <string name="call_callback" msgid="1910165691349426858">"Llamar a devolución de llamada"</string>
     <string name="call_car" msgid="3280537320306436445">"Llamar al auto"</string>
-    <string name="call_company_main" msgid="6105120947138711257">"Llamar empresa principal"</string>
+    <string name="call_company_main" msgid="6105120947138711257">"Llamar empresa principal "</string>
     <string name="call_isdn" msgid="1541590690193403411">"Llamar a ISDN"</string>
     <string name="call_main" msgid="6082900571803441339">"Llamada principal"</string>
     <string name="call_other_fax" msgid="5745314124619636674">"Llamar a fax"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Chat mediante ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Chat mediante Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Chat"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Dirección"</string>
     <string name="postal_street" msgid="8133143961580058972">"Dirección postal"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Apartado postal"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Barrio"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Estado"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Código POSTAL"</string>
     <string name="postal_country" msgid="7638264508416368690">"País"</string>
+    <string name="full_name" msgid="6602579550613988977">"Nombre"</string>
     <string name="name_given" msgid="1687286314106019813">"Nombre de pila"</string>
     <string name="name_family" msgid="3416695586119999058">"Nombre familiar"</string>
     <string name="name_prefix" msgid="59756378548779822">"Prefijo del nombre"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Nombre familiar fonético"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g> contacto"</string>
     <string name="from_account_format" msgid="687567483928582084">"de <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"Contacto <xliff:g id="SOURCE_0">%1$s</xliff:g> de <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Usar esta foto"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"La información de <xliff:g id="SOURCE">%1$s</xliff:g> contactos no se puede editar en este dispositivo."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"No hay información adicional para este contacto."</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Seleccionar foto de la galería"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"La lista de contactos se está actualizando para reflejar el cambio de idioma."\n\n" Espera."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"La lista de contactos se está actualizando."\n\n" Espera..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"La actualización de los contactos está en proceso. "\n\n"El proceso de actualización requiere aproximadamente <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> Mb de almacenamiento interno en el teléfono."\n\n" Elije una de las siguientes opciones:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"La actualización de los contactos está en proceso. "\n\n"El proceso de actualización requiere aproximadamente <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> Mb de almacenamiento interno en el teléfono."\n\n" Elije una de las siguientes opciones:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Desinstalar algunas aplicaciones"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Intentar actualizar nuevamente"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Resultados de búsqueda para: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Buscando..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Cargando …"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Mostrar los seleccionados"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Mostrar todos"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Seleccionar todo"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Desmarcar todos"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"1 destinatario seleccionado"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> destinatarios seleccionados"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Contactos desconocidos"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"No hay contactos seleccionados."</string>
+    <string name="add_field" msgid="5257149039253569615">"Agregar información"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"a través de <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> a través de <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"editar"</string>
+    <string name="description_star" msgid="2605854427360036550">"favorito"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Editar contacto"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"no se combinó"</item>
+    <item quantity="other" msgid="425683718017380845">"combinado a partir de fuentes <xliff:g id="COUNT">%0$d</xliff:g> "</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Eliminar"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Error al guardar"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Otro"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index e63c171..48ed391 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Detalles del contacto"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Ver contacto"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Editar contacto"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"Correo electrónico:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Tipo:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Crear contacto"</string>
     <string name="searchHint" msgid="8482945356247760701">"Buscar contactos"</string>
     <string name="menu_search" msgid="9147752853603483719">"Buscar"</string>
@@ -65,13 +67,14 @@
     <string name="readOnlyContactDeleteConfirmation" msgid="2137170726670196909">"Este contacto contiene información de varias cuentas. La información de las cuentas de solo lectura se ocultará en las listas de contactos, pero no se eliminará."</string>
     <string name="multipleContactDeleteConfirmation" msgid="938900978442960800">"Si se elimina este contacto, se eliminará la información de varias cuentas."</string>
     <string name="deleteConfirmation" msgid="811706994761610640">"El contacto se eliminará."</string>
-    <string name="menu_done" msgid="796017761764190697">"OK"</string>
+    <string name="menu_done" msgid="796017761764190697">"Listo"</string>
     <string name="menu_doNotSave" msgid="2174577548513895144">"Volver"</string>
     <string name="editContact_title_edit" msgid="7678695190666836093">"Editar contacto"</string>
     <string name="editContact_title_insert" msgid="9125600232291405757">"Contacto nuevo"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Pronunciación"</string>
     <string name="label_notes" msgid="8337354953278341042">"Notas"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Llamada por Internet"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Tono"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Nombre y apellido"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Transcripción fonética del nombre"</string>
@@ -124,18 +127,18 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"No hay contactos visibles."</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"Se ha encontrado un contacto."</item>
-    <item quantity="other" msgid="7752927996850263152">"Se han encontrado <xliff:g id="COUNT">%d</xliff:g> contactos."</item>
+    <item quantity="one" msgid="5517063038754171134">"1 encontrado"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> encontrados"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"No se ha encontrado el contacto."</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"No se ha encontrado."</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 contacto"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> contactos"</item>
+    <item quantity="one" msgid="4826918429708286628">"1 encontrado"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> encontrados"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Contactos"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favoritos"</string>
     <string name="dialerIconLabel" msgid="6500826552823403796">"Teléfono"</string>
-    <string name="recentCallsIconLabel" msgid="1419116422359067949">"Llamadas"</string>
+    <string name="recentCallsIconLabel" msgid="1419116422359067949">"Registro"</string>
     <string name="liveFolderAll" msgid="4789010460767506206">"Todos los contactos"</string>
     <string name="liveFolderFavorites" msgid="3100957542927222282">"Contactos destacados"</string>
     <string name="liveFolderPhone" msgid="3739376066610926780">"Contactos con números de teléfono"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Contactos de tarjeta SIM"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"No tienes ningún contacto que mostrar. (Si acabas de añadir una cuenta, es posible que la sincronización de contactos tarde algunos minutos)."</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"No tienes ningún contacto que mostrar."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"No tienes ningún contacto que mostrar."\n\n"Para añadir contactos, pulsa la tecla de "<font fgcolor="#ffffffff"><b>"menú"</b></font>" y toca en:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para añadir o configurar una cuenta con los contactos que puedes sincronizar en el teléfono,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear un nuevo contacto,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/exportar."</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"No tienes ningún contacto que mostrar. (Si acabas de añadir una cuenta, es posible que la sincronización de contactos tarde algunos minutos)."\n\n"Para añadir contactos, pulsa la tecla de "<font fgcolor="#ffffffff"><b>"menú"</b></font>" y toca en:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para añadir o configurar una cuenta con contactos que puedes sincronizar en el teléfono,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opciones de visualización"</b></font>" para modificar los contactos visibles,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear un nuevo contacto,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/exportar."</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"No tienes ningún contacto que mostrar."\n\n"Para añadir contactos, pulsa la tecla de "<font fgcolor="#ffffffff"><b>"menú"</b></font>" y toca en:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para añadir o configurar una cuenta con los contactos que puedes sincronizar en el teléfono,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear un nuevo contacto,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/exportar."</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"No tienes ningún contacto que mostrar. (Si acabas de añadir una cuenta, es posible que la sincronización de contactos tarde algunos minutos)."\n\n"Para añadir contactos, pulsa la tecla de "<font fgcolor="#ffffffff"><b>"menú"</b></font>" y toca en:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para añadir o configurar una cuenta con contactos que puedes sincronizar en el teléfono,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opciones de visualización"</b></font>" para modificar los contactos visibles,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear un nuevo contacto,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/exportar."</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"No tienes contactos."\n\n"Para añadir uno, pulsa la tecla de menú"<font fgcolor="#ffffffff"><b></b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para añadir o configurar una cuenta con los contactos que puedes sincronizar,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear un nuevo contacto,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/exportar"</b></font>" para importar contactos desde la tarjeta SIM o SD"\n</li>"."</string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"No tienes contactos. Si acabas de añadir una cuenta, la sincronización puede tardar."\n\n"Para añadir contactos, pulsa la tecla de menú"<font fgcolor="#ffffffff"><b></b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para añadir o configurar una cuenta con contactos que puedes sincronizar,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opciones de visualización"</b></font>" para modificar los contactos visibles,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear un nuevo contacto,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/exportar"</b></font>" para importar contactos desde la tarjeta SIM o SD"\n</li>"."</string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"No tienes contactos."\n\n"Para añadir uno, pulsa la tecla de menú"<font fgcolor="#ffffffff"><b></b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para añadir o configurar una cuenta con los contactos que puedes sincronizar,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear un nuevo contacto,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/exportar"</b></font>" para importar contactos desde la tarjeta SD"\n</li>"."</string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"No tienes contactos. Si acabas de añadir una cuenta, la sincronización puede tardar."\n\n"Para añadir contactos, pulsa la tecla de menú"<font fgcolor="#ffffffff"><b></b></font>" y toca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Cuentas"</b></font>" para añadir o configurar una cuenta con contactos que puedes sincronizar,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opciones de visualización"</b></font>" para modificar los contactos visibles,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Contacto nuevo"</b></font>" para crear un nuevo contacto,"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/exportar"</b></font>" para importar contactos desde la tarjeta SD"\n</li>"."</string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"No tienes favoritos."\n\n"Para añadir un contacto a tu lista de favoritos, sigue estos pasos:"\n\n"        "<li>"Toca en la pestaña "<b>"Contactos"</b>"."\n</li>" "\n<li>"Selecciona el contacto que quieras añadir a tus favoritos."\n</li>" "\n<li>"Toca la estrella situada junto al nombre del contacto."\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Todos los contactos"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Destacados"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Volver a llamar"</string>
     <string name="callAgain" msgid="3197312117049874778">"Volver a llamar"</string>
     <string name="returnCall" msgid="8171961914203617813">"Devolver llamada"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> min. y <xliff:g id="SECONDS">%2$s</xliff:g> seg."</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> min. y <xliff:g id="SECONDS">%s</xliff:g> seg."</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Contactos frecuentes"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Añadir contacto"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"¿Deseas añadir \"<xliff:g id="EMAIL">%s</xliff:g>\" a Contactos?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"foto de contacto"</string>
     <string name="description_minus_button" msgid="387136707700230172">"menos"</string>
     <string name="description_plus_button" msgid="515164827856229880">"más"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Almac comp no disponible"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Falta la tarjeta SD."</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Almacenam comp no detectado"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"No se ha detectado ninguna tarjeta SD."</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Falta la tarjeta SD."</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"No se ha detectado ninguna tarjeta SD."</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Buscando vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importar contactos desde la tarjeta SIM"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Importar de almacenam comp"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importar contactos desde la tarjeta SD"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Exportar a almacenam comp"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Exportar contactos a la tarjeta SD"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importar contactos desde la tarjeta SD"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Exportar contactos a la tarjeta SD"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Compartir contactos visibles"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importar un archivo de vCard"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importar varios archivos de vCard"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importar todos los archivos de vCard"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Buscando datos de vCard en almacenamiento compartido"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Buscando datos de vCard en la tarjeta SD"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Error al analizar almacenamiento compartido"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Error al buscar en la tarjeta SD"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Error al analizar almacenamiento compartido (Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Error al buscar en la tarjeta SD (motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Buscando datos de vCard en la tarjeta SD"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Error al buscar en la tarjeta SD"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Error al buscar en la tarjeta SD (motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Error de E/S"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Memoria insuficiente (el archivo puede ser demasiado grande)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"No se ha podido analizar el archivo de vCard debido a un error inesperado."</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"No se ha podido analizar el archivo de vCard (a pesar de que su formato parece ser válido) porque no es compatible con la implementación actual."</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"No se ha encontrado el archivo de vCard en el almacenamiento compartido."</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"No se ha encontrado ningún archivo de vCard en la tarjeta SD."</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"No se ha encontrado ningún archivo de vCard en la tarjeta SD."</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Error al recopilar metainformación de los archivos vCard"</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"No ha sido posible importar uno o varios archivos (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Error desconocido"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Seleccionar archivo de vCard"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Leyendo vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Leyendo archivos de vCard"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Error al leer datos de vCard"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contactos"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> archivos"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Almacenamiento temporal local de vCard(s) en caché"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"El importador está almacenando de forma temporal local vCard(s). La importación empezará pronto."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Error al leer los datos de vCard"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Lectura de vCard cancelada"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Importación de vCard terminada"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Importador de vCard iniciado"</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"El importador de vCard importará vCard transcurrido un tiempo."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Confirmar la exportación"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"¿Estás seguro de que quieres exportar tu lista de contactos a \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\"?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Error al exportar los datos del contacto"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Se ha producido un error al exportar los datos del contacto."\n"Motivo del error: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"No hay contactos que exportar."</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Hay demasiados archivos de vCard en el almacenamiento compartido."</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Hay demasiados archivos de vCard en la tarjeta SD."</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Hay demasiados archivos de vCard en la tarjeta SD."</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"El nombre de archivo necesario es demasiado largo (\"<xliff:g id="FILENAME">%s</xliff:g>\")."</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Exportador de vCard iniciado"</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Exportación de vCard finalizada"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Exportando datos de contacto"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Exportando datos de contacto a \"<xliff:g id="FILE_NAME">%s</xliff:g>\"..."</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"No se ha podido inicializar el exportador: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Error al obtener información de la base de datos"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"No hay contactos que exportar. Si ya tienes contactos en el teléfono, es posible que algunos proveedores de datos no permitan que se exporten todos los contactos a otros dispositivos."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"El redactor de vCard no se ha inicializado correctamente."</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"No se ha podido abrir el archivo \"<xliff:g id="FILE_NAME">%1$s</xliff:g>\": <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contactos"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"No se ha podido abrir el archivo \"<xliff:g id="FILE_NAME">%s</xliff:g>\": <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%s</xliff:g> contactos"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Nombres de tus contactos"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Añadir pausa de dos segundos"</string>
     <string name="add_wait" msgid="3360818652790319634">"Añadir espera"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"No se ha encontrado ninguna aplicación que pueda realizar esta acción."</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Recordar esta opción"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Desconocido"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Ningún dato"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Cuentas"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importar/exportar"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importar/exportar contactos"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Todos los demás contactos"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Todos los contactos"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Si eliminas \"<xliff:g id="GROUP">%s</xliff:g>\" de la sincronización, también se eliminarán todos los contactos no agrupados."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Solo en el teléfono (no sincronizado)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Solo en el teléfono (no sincronizado)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Llamar a <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Llamar a casa"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Llamar al móvil"</string>
@@ -336,7 +347,7 @@
     <string name="email_home" msgid="8573740658148184279">"Enviar email a casa"</string>
     <string name="email_mobile" msgid="2042889209787989814">"Enviar email al móvil"</string>
     <string name="email_work" msgid="2807430017302722689">"Enviar email a trabajo"</string>
-    <string name="email_other" msgid="3454004077967657109">"Enviar email"</string>
+    <string name="email_other" msgid="3454004077967657109">"Enviar correo electrónico"</string>
     <string name="email_custom" msgid="7548003991586214105">"Correo electrónico <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="email" msgid="5668400997660065897">"Correo electrónico"</string>
     <string name="map_home" msgid="1243547733423343982">"Ver dirección de casa"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Chatear con ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Chatear con Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Chat"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Dirección"</string>
     <string name="postal_street" msgid="8133143961580058972">"Calle"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Apartado postal"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Vecindario"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Provincia/Estado"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Código postal"</string>
     <string name="postal_country" msgid="7638264508416368690">"País"</string>
+    <string name="full_name" msgid="6602579550613988977">"Nombre"</string>
     <string name="name_given" msgid="1687286314106019813">"Nombre"</string>
     <string name="name_family" msgid="3416695586119999058">"Apellidos"</string>
     <string name="name_prefix" msgid="59756378548779822">"Prefijo del nombre"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Apellido fonético"</string>
     <string name="account_type_format" msgid="718948015590343010">"Contacto de <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
     <string name="from_account_format" msgid="687567483928582084">"de <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"Contacto de <xliff:g id="SOURCE_0">%1$s</xliff:g> de <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Utilizar esta foto"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"No se puede editar la información del contacto de <xliff:g id="SOURCE">%1$s</xliff:g> en este dispositivo."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"No hay información adicional para este contacto."</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Seleccionar foto de la galería"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"La lista de contactos se está actualizando para reflejar el cambio de idioma."\n\n"Por favor, espera..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"La lista de contactos se está actualizando."\n\n"Por favor, espera..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Los contactos se están actualizando. "\n\n"El proceso de actualización necesita aproximadamente <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB de almacenamiento interno del teléfono."\n\n"Selecciona una de las siguientes opciones:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Los contactos se están actualizando. "\n\n"El proceso de actualización necesita aproximadamente <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB de almacenamiento interno."\n\n"Selecciona una de las siguientes opciones:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Desinstalar algunas aplicaciones"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Reintentar actualización"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Resultados de la búsqueda de: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Buscando..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Cargando..."</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Mostrar seleccionados"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Mostrar todos"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Seleccionar todo"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Desmarcar todo"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"Un destinatario seleccionado"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> destinatarios seleccionados"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Contactos desconocidos"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"No hay ningún contacto seleccionado."</string>
+    <string name="add_field" msgid="5257149039253569615">"Añadir información"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"con <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> con <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"editar"</string>
+    <string name="description_star" msgid="2605854427360036550">"favoritos"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Editar contacto"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"sin fusionar"</item>
+    <item quantity="other" msgid="425683718017380845">"fusionados desde <xliff:g id="COUNT">%0$d</xliff:g> fuentes"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Eliminar"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Error al guardar"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Otro"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;Ñ;O;P;Q;R;S;T;U;V;W;X;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index d98d553..8791455 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Détails du contact"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Afficher le contact"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Modifier le contact"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"Adresse e-mail :"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Type :"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Créer un contact"</string>
     <string name="searchHint" msgid="8482945356247760701">"Rech. des contacts"</string>
     <string name="menu_search" msgid="9147752853603483719">"Rechercher"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Nouveau contact"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Prononciation phonétique"</string>
     <string name="label_notes" msgid="8337354953278341042">"Notes"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Appel VoIP"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Sonnerie"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Nom et prénom"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Nom phonétique"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Aucun contact visible"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"1 contact trouvé"</item>
-    <item quantity="other" msgid="7752927996850263152">"<xliff:g id="COUNT">%d</xliff:g> contacts trouvés"</item>
+    <item quantity="one" msgid="5517063038754171134">"1 contact trouvé"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> contact(s) trouvé(s)"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Contact introuvable"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Introuvable"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 contact"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> contacts"</item>
+    <item quantity="one" msgid="4826918429708286628">"1 contact trouvé"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> contact(s) trouvé(s)"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Contacts"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favoris"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Contacts de carte SIM"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Vous n\'avez aucun contact à afficher. Si vous venez d\'ajouter un compte, la synchronisation des contacts peut prendre quelques minutes."</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Vous n\'avez aucun contact à afficher."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Vous n\'avez aucun contact à afficher."\n\n"Pour ajouter des contacts, appuyez sur "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" et sélectionnez :"\n" "\n<li><font fgcolor="#ffffffff"><b>"Comptes"</b></font>" pour ajouter ou configurer un compte dont vous pourrez synchroniser les contacts sur le téléphone ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nouveau contact"</b></font>" pour créer un contact ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/Exporter."</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Vous n\'avez aucun contact à afficher (si vous venez d\'ajouter un compte, la synchronisation des contacts peut prendre quelques minutes)."\n\n"Pour ajouter des contacts, appuyez sur "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" et sélectionnez :"\n" "\n<li><font fgcolor="#ffffffff"><b>"Comptes"</b></font>" pour ajouter ou configurer un compte comportant des contacts que vous pourrez synchroniser sur le téléphone ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Options d\'affichage"</b></font>" pour modifier le paramètre de visibilité des contacts ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nouveau contact"</b></font>" pour créer une entrée ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/Exporter."</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Vous n\'avez aucun contact à afficher."\n\n"Pour ajouter des contacts, appuyez sur "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" et sélectionnez :"\n" "\n<li><font fgcolor="#ffffffff"><b>"Comptes"</b></font>" pour ajouter ou configurer un compte dont vous pourrez synchroniser les contacts sur le téléphone ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nouveau contact"</b></font>" pour créer un contact ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/Exporter."</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Vous n\'avez aucun contact à afficher (si vous venez d\'ajouter un compte, la synchronisation des contacts peut prendre quelques minutes)."\n\n"Pour ajouter des contacts, appuyez sur "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" et sélectionnez :"\n" "\n<li><font fgcolor="#ffffffff"><b>"Comptes"</b></font>" pour ajouter ou configurer un compte comportant des contacts que vous pourrez synchroniser sur le téléphone ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Options d\'affichage"</b></font>" pour modifier le paramètre de visibilité des contacts ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nouveau contact"</b></font>" pour créer une entrée ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/Exporter."</b></font>\n</li></string>
+    <!-- syntax error in translation for noContactsHelpText (7633826236417884130) org.xmlpull.v1.XmlPullParserException: expected: /b read: font (position:END_TAG </font>@1:549 in java.io.StringReader@4506411)  -->
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Vous n\'avez aucun contact à afficher (si vous venez d\'ajouter un compte, la synchronisation des contacts peut prendre quelques minutes)."\n\n"Pour ajouter des contacts, appuyez sur "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" et sélectionnez :"\n" "\n<li><font fgcolor="#ffffffff"><b>"Comptes"</b></font>" pour ajouter ou configurer un compte dont vous pourrez synchroniser les contacts sur le téléphone ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Options d\'affichage"</b></font>" pour modifier le paramètre de visibilité des contacts ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nouveau contact"</b></font>" pour créer un contact ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/Exporter"</b></font>" pour importer des contacts depuis votre carte SIM ou SD."\n</li></string>
+    <!-- syntax error in translation for noContactsNoSimHelpText (467658807711582876) org.xmlpull.v1.XmlPullParserException: expected: /b read: font (position:END_TAG </font>@1:553 in java.io.StringReader@39d99a4d)  -->
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Vous n\'avez aucun contact à afficher (si vous venez d\'ajouter un compte, la synchronisation des contacts peut prendre quelques minutes)."\n\n"Pour ajouter des contacts, appuyez sur "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" et sélectionnez :"\n" "\n<li><font fgcolor="#ffffffff"><b>"Comptes"</b></font>" pour ajouter ou configurer un compte dont vous pourrez synchroniser les contacts sur le téléphone ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Options d\'affichage"</b></font>" pour modifier le paramètre de visibilité des contacts ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nouveau contact"</b></font>" pour créer un contact ;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importer/Exporter"</b></font>" pour importer des contacts depuis votre carte SD."\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Vous ne disposez d\'aucun favoris."\n\n"Pour ajouter un contact à la liste de favoris :"\n\n"        "<li>"Appuyez sur l\'onglet "<b>"Contacts"</b>"."\n</li>" "\n<li>"Appuyez sur le contact à ajouter à vos favoris."\n</li>" "\n<li>"Appuyez sur l\'étoile en regard du nom du contact."\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Tous les contacts"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Suivis"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Rappeler"</string>
     <string name="callAgain" msgid="3197312117049874778">"Renouveler l\'appel"</string>
     <string name="returnCall" msgid="8171961914203617813">"Rappeler"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> mn <xliff:g id="SECONDS">%2$s</xliff:g> s"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> mn <xliff:g id="SECONDS">%s</xliff:g> s"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Contactés fréquemment"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Ajouter un contact"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Ajouter \"<xliff:g id="EMAIL">%s</xliff:g>\" aux contacts ?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"photo du contact"</string>
     <string name="description_minus_button" msgid="387136707700230172">"moins"</string>
     <string name="description_plus_button" msgid="515164827856229880">"plus"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Stockage partagé non disponible"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Aucune carte SD trouvée"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Aucun stockage partagé n\'a été détecté."</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Aucune carte SD n\'a été détectée."</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Aucune carte SD trouvée"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Aucune carte SD n\'a été détectée."</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Recherche des données VCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importer à partir de la carte SIM"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Importer depuis le stockage partagé"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importer à partir de la carte SD"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Exporter vers le stockage partagé"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Exporter vers la carte SD"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importer à partir de la carte SD"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Exporter vers la carte SD"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Partager les contacts visibles"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importer un fichier vCard"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importer plusieurs fichiers vCard"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importer tous les fichiers vCard"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Recherche de données VCard sur le stockage partagé"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Recherche de données VCard sur la carte SD"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Échec de l\'analyse du stockage partagé"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Échec de l\'analyse de la carte SD"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Échec de l\'analyse du stockage partagé (Raison : \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Échec de l\'analyse de la carte SD (Raison : \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Recherche de données VCard sur la carte SD"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Échec de l\'analyse de la carte SD"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Échec de l\'analyse de la carte SD (Raison : \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Erreur d\'E/S"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Mémoire insuffisante (fichier probablement trop volumineux)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Échec de l\'analyse des données VCard pour une raison inattendue"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Échec de l\'analyse des données VCard. Le format semble valide, mais l\'implémentation actuelle ne le prend pas en charge."</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Aucun fichier VCard n\'a été trouvé sur le stockage partagé."</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Aucun fichier VCard n\'a été trouvé sur la carte SD."</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Aucun fichier VCard n\'a été trouvé sur la carte SD."</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Échec de la collecte des métadonnées contenues dans le(s) fichier(s) vCard"</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Échec de l\'importation d\'un ou de plusieurs fichiers (%s)"</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Erreur inconnue"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Sélectionner un fichier VCard"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Lecture des données VCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Lecture des fichiers VCard"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Échec de la lecture des données VCard"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> sur <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contacts"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> sur <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> fichiers"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Mise en cache de fichier(s) vCard dans l\'espace de stockage temporaire local"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"Le programme d\'importation met en cache le(s) fichier(s) vCard dans l\'espace de stockage temporaire local. L\'importation effective va bientôt commencer."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Échec de la lecture des données vCard"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Lecture des données vCard annulée"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Importation du fichier vCard annulée"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Programme d\'importation de fichiers vCard démarré"</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"Le fichier vCard sera importé dans quelques instants."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Confirmer l\'exportation"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Voulez-vous vraiment exporter la liste de contacts vers \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\" ?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Échec lors de l\'exportation des données du contact"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Échec lors de l\'exportation des données du contact."\n"Motif : \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Aucun contact exportable"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Le stockage partagé contient trop de fichiers VCard."</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"La carte SD contient trop de fichiers VCard."</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"La carte SD contient trop de fichiers VCard."</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Le nom de fichier requis est trop long (\"<xliff:g id="FILENAME">%s</xliff:g>\")."</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Programme d\'exportation de fichiers vCard démarré"</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Exportation du fichier vCard interrompue"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Exportation des données des contacts"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Exportation des données des contacts vers \"<xliff:g id="FILE_NAME">%s</xliff:g>\""</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Échec de l\'initialisation du module d\'exportation : \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Impossible d\'obtenir les informations concernant la base de données"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Aucun contact n\'est exportable. Si votre téléphone comporte actuellement des contacts, il se peut qu\'un fournisseur de données empêche leur exportation hors de votre téléphone."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"Le système de composition vCard n\'est pas correctement initialisé."</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Impossible d\'ouvrir \"<xliff:g id="FILE_NAME">%1$s</xliff:g>\" : <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> sur <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contacts"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Impossible d\'ouvrir \"<xliff:g id="FILE_NAME">%s</xliff:g>\" : <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> sur <xliff:g id="TOTAL_NUMBER">%s</xliff:g> contacts"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Noms de vos contacts"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Ajouter une pause de 2 s"</string>
     <string name="add_wait" msgid="3360818652790319634">"Ajouter Attendre"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Aucune application pour gérer cette action"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Mémoriser ce choix"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Inconnu"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Aucune donnée"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Comptes"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importer/Exporter"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importer/Exporter les contacts"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Tous les autres contacts"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Tous les contacts"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Le retrait du groupe \"<xliff:g id="GROUP">%s</xliff:g>\" de la synchronisation entraîne également la suppression de tous les contacts non groupés de la synchronisation."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Téléphone uniquement (sans synchronisation)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Téléphone uniquement (sans synchronisation)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Appeler <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Appeler domicile"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Appeler mobile"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Chatter via ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Chatter via Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Chatter"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Adresse"</string>
     <string name="postal_street" msgid="8133143961580058972">"Rue"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Boîte postale"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Voisinage"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"État"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Code postal"</string>
     <string name="postal_country" msgid="7638264508416368690">"Pays"</string>
+    <string name="full_name" msgid="6602579550613988977">"Nom"</string>
     <string name="name_given" msgid="1687286314106019813">"Prénom"</string>
     <string name="name_family" msgid="3416695586119999058">"Nom de famille"</string>
     <string name="name_prefix" msgid="59756378548779822">"Préfixe du nom"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Phonétique du nom de famille"</string>
     <string name="account_type_format" msgid="718948015590343010">"Contact <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
     <string name="from_account_format" msgid="687567483928582084">"de <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"Contact <xliff:g id="SOURCE_0">%1$s</xliff:g> de <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Utiliser cette photo"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"Vous ne pouvez pas modifier les informations du contact <xliff:g id="SOURCE">%1$s</xliff:g> sur cet appareil."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Aucune autre information pour ce contact"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Sélectionner une photo dans la galerie"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"Mise à jour de la liste des contacts en cours suite au changement de langue."\n\n"Veuillez patienter..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Mise à jour de la liste des contacts en cours."\n\n"Veuillez patienter..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Les contacts sont en cours de mise à niveau. "\n\n"La mise à niveau requiert environ <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> Mo de mémoire interne du téléphone."\n\n"Choisissez l\'une des options suivantes :"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Les contacts sont en cours de mise à niveau. "\n\n"La mise à niveau requiert environ <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> Mo de mémoire interne du téléphone."\n\n"Choisissez l\'une des options suivantes :"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Désinstaller certaines applications"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Réessayer la mise à niveau"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Résultats de recherche pour : <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Recherche en cours..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Chargement en cours…"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Afficher la sélection"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Tout afficher"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Tout sélectionner"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Tout désélectionner"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"1 destinataire sélectionné"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> destinataires sélectionnés"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Contacts inconnus"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Aucun contact sélectionné"</string>
+    <string name="add_field" msgid="5257149039253569615">"Ajouter des informations"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"via <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> via <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"modifier"</string>
+    <string name="description_star" msgid="2605854427360036550">"favori"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Modifier le contact"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"1 contact non fusionné"</item>
+    <item quantity="other" msgid="425683718017380845">"1 contact fusionné à partir de <xliff:g id="COUNT">%0$d</xliff:g> sources"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Supprimer"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Erreur d\'enregistrement"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Autre"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 829e2aa..c55bfe4 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Dettagli contatto"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Visualizza contatto"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Modifica contatto"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"Indirizzo email:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Tipo:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Crea contatto"</string>
     <string name="searchHint" msgid="8482945356247760701">"Cerca contatti"</string>
     <string name="menu_search" msgid="9147752853603483719">"Cerca"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Nuovo contatto"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Fonetica"</string>
     <string name="label_notes" msgid="8337354953278341042">"Note"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Chiamata Internet"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Suoneria"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Nome e cognome"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Nome fonetico"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Nessun contatto visibile"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"1 contatto trovato"</item>
-    <item quantity="other" msgid="7752927996850263152">"<xliff:g id="COUNT">%d</xliff:g> contatti trovati"</item>
+    <item quantity="one" msgid="5517063038754171134">"1 trovato"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> trovati"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Contatto non trovato"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Non trovati"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 contatto"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> contatti"</item>
+    <item quantity="one" msgid="4826918429708286628">"1 trovato"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> trovati"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Contatti"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Preferiti"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Contatti SIM"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Non ci sono contatti da visualizzare (se hai appena aggiunto un account, la sincronizzazione dei contatti potrebbe richiedere alcuni minuti)."</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Non ci sono contatti da visualizzare."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Non sono presenti contatti da visualizzare."\n\n"Per aggiungere contatti, premi "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e tocca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Account"</b></font>" per aggiungere o configurare un account con contatti sincronizzabili con il telefono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nuovo contatto"</b></font>" per creare da zero un nuovo contatto"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importa/esporta"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Non sono presenti contatti da visualizzare (se hai appena aggiunto un account, la sincronizzazione dei contatti potrebbe richiedere alcuni minuti)."\n\n"Per aggiungere contatti, premi "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e tocca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Account"</b></font>" per aggiungere o configurare un account con contatti sincronizzabili con il telefono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opzioni di visualizzazione"</b></font>" per modificare i contatti visibili"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nuovo contatto"</b></font>" per creare da zero un nuovo contatto"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importa/esporta"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Non sono presenti contatti da visualizzare."\n\n"Per aggiungere contatti, premi "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e tocca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Account"</b></font>" per aggiungere o configurare un account con contatti sincronizzabili con il telefono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nuovo contatto"</b></font>" per creare da zero un nuovo contatto"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importa/esporta"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Non sono presenti contatti da visualizzare (se hai appena aggiunto un account, la sincronizzazione dei contatti potrebbe richiedere alcuni minuti)."\n\n"Per aggiungere contatti, premi "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e tocca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Account"</b></font>" per aggiungere o configurare un account con contatti sincronizzabili con il telefono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opzioni di visualizzazione"</b></font>" per modificare i contatti visibili"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nuovo contatto"</b></font>" per creare da zero un nuovo contatto"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importa/esporta"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"Non sono presenti contatti da visualizzare."\n\n"Per aggiungere contatti, premi "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e tocca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Account"</b></font>" per aggiungere o configurare un account con contatti sincronizzabili con il telefono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nuovo contatto"</b></font>" per creare da zero un nuovo contatto"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importa/esporta"</b></font>" per importare contatti dalla SIM o dalla scheda SD"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Non sono presenti contatti da visualizzare (se hai appena aggiunto un account, la sincronizzazione dei contatti potrebbe richiedere alcuni minuti)."\n\n"Per aggiungere contatti, premi "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e tocca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Account"</b></font>" per aggiungere o configurare un account con contatti sincronizzabili con il telefono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opzioni di visualizzazione"</b></font>" per modificare i contatti visibili"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nuovo contatto"</b></font>" per creare da zero un nuovo contatto"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importa/esporta"</b></font>" per importare contatti dalla SIM o dalla scheda SD"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"Non sono presenti contatti da visualizzare."\n\n"Per aggiungere contatti, premi "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e tocca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Account"</b></font>" per aggiungere o configurare un account con contatti sincronizzabili con il telefono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nuovo contatto"</b></font>" per creare da zero un nuovo contatto"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importa/esporta"</b></font>" per importare contatti dalla scheda SD"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Non sono presenti contatti da visualizzare (se hai appena aggiunto un account, la sincronizzazione dei contatti potrebbe richiedere alcuni minuti)."\n\n"Per aggiungere contatti, premi "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e tocca:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Account"</b></font>" per aggiungere o configurare un account con contatti sincronizzabili con il telefono"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opzioni di visualizzazione"</b></font>" per modificare i contatti visibili"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nuovo contatto"</b></font>" per creare da zero un nuovo contatto"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importa/esporta"</b></font>" per importare contatti dalla scheda SD"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Non sono presenti preferiti."\n\n"Per aggiungere un contatto al tuo elenco di preferiti:"\n\n<li>"Tocca la scheda "<b>"Contatti."</b>\n</li>" "\n<li>"Tocca il contatto da aggiungere ai preferiti."\n</li>" "\n<li>"Tocca la stella accanto al nome del contatto."\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Tutti i contatti"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Speciali"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Richiama"</string>
     <string name="callAgain" msgid="3197312117049874778">"Richiama"</string>
     <string name="returnCall" msgid="8171961914203617813">"Chiama numero"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> min. <xliff:g id="SECONDS">%2$s</xliff:g> sec."</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> min. <xliff:g id="SECONDS">%s</xliff:g> sec."</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Contattati spesso"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Aggiungi contatto"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Aggiungi \"<xliff:g id="EMAIL">%s</xliff:g>\" ai contatti?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"foto contatto"</string>
     <string name="description_minus_button" msgid="387136707700230172">"meno"</string>
     <string name="description_plus_button" msgid="515164827856229880">"più"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Archivio condiviso non disp."</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Nessuna scheda SD"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Nessun archivio condiviso rilev."</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Nessuna scheda SD rilevata"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Nessuna scheda SD"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Nessuna scheda SD rilevata"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Ricerca vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importa da scheda SIM"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Importa da archivio cond."</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importa da scheda SD"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Esporta in archivio cond."</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Esporta su scheda SD"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importa da scheda SD"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Esporta su scheda SD"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Condividi contatti visibili"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importa un file vCard"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importa più file vCard"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importa tutti i file vCard"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Ricerca di dati vCard nell\'archivio condiviso"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Ricerca dati vCard su scheda SD"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Scansione dell\'archivio condiviso non riuscita"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Analisi scheda SD non riuscita"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Scansione dell\'archivio condiviso non riuscita (motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Analisi scheda SD non riuscita (motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Ricerca dati vCard su scheda SD"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Analisi scheda SD non riuscita"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Analisi scheda SD non riuscita (motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Errore I/O"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Memoria insufficiente (il file potrebbe essere di dimensioni eccessive)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Impossibile analizzare la vCard per motivi imprevisti"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Impossibile analizzare la vCard nonostante sembri avere un formato valido perché l\'implementazione corrente non la supporta"</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Nessun file vCard trovato nell\'archivio condiviso."</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Nessun file vCard trovato sulla scheda SD"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Nessun file vCard trovato sulla scheda SD"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Raccolta dei metadati dei file vCard forniti non riuscita."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Impossibile importare uno o più file (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Errore sconosciuto"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Seleziona file vCard"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Lettura vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Lettura file vCard"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Lettura dati vCard non riuscita"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> contatti su <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> file su <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Memorizzazione delle vCard nella cache di archiviazione temporanea locale"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"L\'importazione memorizzerà le vCard nella cache di archiviazione temporanea locale. L\'importazione reale inizierà a breve."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Lettura dati vCard non riuscita"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Lettura dati vCard annullata"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Importazione vCard terminata"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Importazione vCard avviata."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"La vCard verrà importata successivamente."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Conferma esportazione"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Esportare l\'elenco di contatti in \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\"?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Esportazione dati contatti non riuscita"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Esportazione dati contatti non riuscita."\n"Motivo dell\'errore: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Nessun contatto esportabile"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Troppi file vCard nell\'archivio condiviso"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Troppi dati vCard sulla scheda SD"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Troppi dati vCard sulla scheda SD"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Il nome file richiesto è troppo lungo (\"<xliff:g id="FILENAME">%s</xliff:g>\")"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Esportazione vCard avviata."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Esportazione vCard terminata"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Esportazione dati di contatto"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Esportazione dati di contatto in \"<xliff:g id="FILE_NAME">%s</xliff:g>\""</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Impossibile inizializzare l\'utilità di esportazione: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Recupero informazioni database non riuscito"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Nessun contatto esportabile. Se nel tuo telefono sono presenti dei contatti, qualche provider di dati potrebbe impedire l\'esportazione di tutti i contatti all\'esterno del telefono."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"Il compositore di vCard non è correttamente inizializzato"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Impossibile aprire \"<xliff:g id="FILE_NAME">%1$s</xliff:g>\": <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> contatti su <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Impossibile aprire \"<xliff:g id="FILE_NAME">%s</xliff:g>\": <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> contatti su <xliff:g id="TOTAL_NUMBER">%s</xliff:g>"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"I nomi dei tuoi contatti"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Aggiungi pausa 2 sec"</string>
     <string name="add_wait" msgid="3360818652790319634">"Aggiungi attesa"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Nessuna applicazione trovata in grado di gestire questa azione"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Memorizza questa scelta"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Sconosciuto"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Nessun dato"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Account"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importa/esporta"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importa/esporta contatti"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Tutti gli altri contatti"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Tutti i contatti"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Se rimuovi \"<xliff:g id="GROUP">%s</xliff:g>\" dalla sincronizzazione, verranno rimossi anche tutti i contatti separati."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Solo su telefono (non sincronizzato)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Solo su telefono (non sincronizzato)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Chiama n. <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Chiama casa"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Chiama cellulare"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Chatta su ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Chatta su Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Chatta"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Indirizzo"</string>
     <string name="postal_street" msgid="8133143961580058972">"Indirizzo postale"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Casella postale"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Zona"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Provincia"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Codice postale"</string>
     <string name="postal_country" msgid="7638264508416368690">"Paese"</string>
+    <string name="full_name" msgid="6602579550613988977">"Nome"</string>
     <string name="name_given" msgid="1687286314106019813">"Nome fornito"</string>
     <string name="name_family" msgid="3416695586119999058">"Cognome"</string>
     <string name="name_prefix" msgid="59756378548779822">"Prefisso nome"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Cognome fonetico"</string>
     <string name="account_type_format" msgid="718948015590343010">"Contatto da <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
     <string name="from_account_format" msgid="687567483928582084">"da <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"Contatto <xliff:g id="SOURCE_0">%1$s</xliff:g> da <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Utilizza questa foto"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"Informazioni del contatto da <xliff:g id="SOURCE">%1$s</xliff:g> non modificabili su questo dispositivo."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Nessuna informazione aggiuntiva per questo contatto"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Seleziona foto da galleria"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"L\'elenco contatti verrà aggiornato per rispecchiare il cambio di lingua."\n\n"Attendi..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Elenco contatti in fase di aggiornamento."\n\n"Attendi..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Contatti in fase di aggiornamento. "\n\n"Il processo di aggiornamento richiede circa <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB di memoria interna del telefono."\n\n"Scegli una delle seguenti opzioni:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Contatti in fase di aggiornamento. "\n\n"Il processo di aggiornamento richiede circa <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB di memoria interna del telefono."\n\n"Scegli una delle seguenti opzioni:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Disinstalla alcune applicazioni"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Riprova l\'aggiornamento"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Risultati di ricerca per: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Ricerca in corso..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Caricamento in corso…"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Mostra selezionati"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Mostra tutto"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Seleziona tutto"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Deseleziona tutto"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"1 destinatario selezionato"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> destinatari selezionati"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Contatti sconosciuti"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Nessun contatto selezionato."</string>
+    <string name="add_field" msgid="5257149039253569615">"Aggiungi informazioni"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"tramite <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> tramite <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"modifica"</string>
+    <string name="description_star" msgid="2605854427360036550">"preferiti"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Modifica contatto"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"non uniti"</item>
+    <item quantity="other" msgid="425683718017380845">"uniti da <xliff:g id="COUNT">%0$d</xliff:g> origini"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Elimina"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Errore di salvataggio"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Altro"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;L;M;N;O;P;Q;R;S;T;U;V;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml
index fc2d701..597fb19 100644
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"連絡先情報"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"連絡先を表示"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"連絡先を編集"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"メールアドレス:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"種類:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"連絡先を新規登録"</string>
     <string name="searchHint" msgid="8482945356247760701">"連絡先を検索"</string>
     <string name="menu_search" msgid="9147752853603483719">"検索"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"連絡先を新規登録"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"読み"</string>
     <string name="label_notes" msgid="8337354953278341042">"メモ"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"インターネット通話"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"着信音"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"名前"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"よみがな"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"表示可能な連絡先はありません"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"連絡先が1件あります"</item>
-    <item quantity="other" msgid="7752927996850263152">"連絡先が<xliff:g id="COUNT">%d</xliff:g>件あります"</item>
+    <item quantity="one" msgid="5517063038754171134">"1件見つかりました"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g>件見つかりました"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"連絡先が見つかりません"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"見つかりませんでした"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"連絡先1件"</item>
-    <item quantity="other" msgid="5660384247071761844">"連絡先<xliff:g id="COUNT">%d</xliff:g>件"</item>
+    <item quantity="one" msgid="4826918429708286628">"1件見つかりました"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g>件見つかりました"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"連絡先"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"お気入り"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"SIMカードの連絡先"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"表示する連絡先がありません(アカウントを追加した直後の場合は、連絡先の同期に数分かかることがあります)。"</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"表示する連絡先がありません。"</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"表示できる連絡先がありません。"\n\n"連絡先を追加するには、まず"<font fgcolor="#ffffffff"><b>"MENU"</b></font>"キーを押し: "\n" "\n<li>"電話との同期が可能な連絡先のアカウントを追加または設定する場合は["<font fgcolor="#ffffffff"><b>"アカウント"</b></font>"]をタップします"\n</li>" "\n<li>"新しい連絡先を一から作成する場合は["<font fgcolor="#ffffffff"><b>"連絡先を新規登録"</b></font>"]をタップします"\n</li>" "\n<li>"["<font fgcolor="#ffffffff"><b>"インポート/エクスポート"</b></font>"]"\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"表示できる連絡先がありません(アカウントを追加した場合は、連絡先が同期されるまでに数分かかることがあります)。"\n\n"連絡先を追加するには、まず"<font fgcolor="#ffffffff"><b>"MENU"</b></font>"キーを押し: "\n" "\n<li>"電話との同期が可能な連絡先のアカウントを追加または設定する場合は["<font fgcolor="#ffffffff"><b>"アカウント"</b></font>"]をタップします"\n</li>" "\n<li>"表示される連絡先を変更するには["<font fgcolor="#ffffffff"><b>"表示オプション"</b></font>"]をタップします"\n</li>" "\n<li>"新しい連絡先を最初から作成する場合は["<font fgcolor="#ffffffff"><b>"連絡先を新規登録"</b></font>"]をタップします"\n</li>" "\n<li>"["<font fgcolor="#ffffffff"><b>"インポート/エクスポート"</b></font>"]"\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"表示できる連絡先がありません。"\n\n"連絡先を追加するには、まず"<font fgcolor="#ffffffff"><b>"MENU"</b></font>"キーを押し: "\n" "\n<li>"電話との同期が可能な連絡先のアカウントを追加または設定する場合は["<font fgcolor="#ffffffff"><b>"アカウント"</b></font>"]をタップします"\n</li>" "\n<li>"新しい連絡先を最初から作成する場合は["<font fgcolor="#ffffffff"><b>"連絡先を新規登録"</b></font>"]をタップします"\n</li>" "\n<li>"["<font fgcolor="#ffffffff"><b>"インポート/エクスポート"</b></font>"]"\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"表示できる連絡先がありません(アカウントを追加した場合は、連絡先が同期されるまでに数分かかることがあります)。"\n\n"連絡先を追加するには、まず"<font fgcolor="#ffffffff"><b>"MENU"</b></font>"キーを押し: "\n" "\n<li>"電話との同期が可能な連絡先のアカウントを追加または設定する場合は["<font fgcolor="#ffffffff"><b>"アカウント"</b></font>"]をタップします"\n</li>" "\n<li>"表示される連絡先を変更するには["<font fgcolor="#ffffffff"><b>"表示オプション"</b></font>"]をタップします"\n</li>" "\n<li>"新しい連絡先を最初から作成する場合は["<font fgcolor="#ffffffff"><b>"連絡先を新規登録"</b></font>"]をタップします"\n</li>" "\n<li>"["<font fgcolor="#ffffffff"><b>"インポート/エクスポート"</b></font>"]"\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"表示できる連絡先がありません。"\n\n"連絡先を追加するには、まず"<font fgcolor="#ffffffff"><b>"MENU"</b></font>"キーを押し:"\n\n<li>"電話との同期が可能な連絡先のアカウントを追加または設定する場合は["<font fgcolor="#ffffffff"><b>"アカウント"</b></font>"]をタップします"\n</li>\n<li>"新しい連絡先を最初から作成する場合は["<font fgcolor="#ffffffff"><b>"連絡先を新規登録"</b></font>"]をタップします"\n</li>" "\n<li>"SIMまたはSDカードから連絡先をインポートする場合は["<font fgcolor="#ffffffff"><b>"インポート/エクスポート"</b></font>"]をタップします"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"表示できる連絡先がありません(アカウントを追加した場合は、連絡先が同期されるまでに数分かかることがあります)。"\n\n"連絡先を追加するには、まず"<font fgcolor="#ffffffff"><b>"MENU"</b></font>"キーを押し:"\n\n<li>"電話との同期が可能な連絡先のアカウントを追加または設定する場合は["<font fgcolor="#ffffffff"><b>"アカウント"</b></font>"]をタップします"\n</li>\n<li>"表示される連絡先を変更するには["<font fgcolor="#ffffffff"><b>"表示オプション"</b></font>"]をタップします"\n</li>" "\n<li>"新しい連絡先を最初から作成する場合は["<font fgcolor="#ffffffff"><b>"連絡先を新規登録"</b></font>"]をタップします"\n</li>" "\n<li>"SIMまたはSDカードから連絡先をインポートする場合は["<font fgcolor="#ffffffff"><b>"インポート/エクスポート"</b></font>"]をタップします"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"表示できる連絡先がありません。"\n\n"連絡先を追加するには、まず"<font fgcolor="#ffffffff"><b>"MENU"</b></font>"キーを押し:"\n\n<li>"電話との同期が可能な連絡先のアカウントを追加または設定する場合は["<font fgcolor="#ffffffff"><b>"アカウント"</b></font>"]をタップします"\n</li>\n<li>"新しい連絡先を最初から作成する場合は["<font fgcolor="#ffffffff"><b>"連絡先を新規登録"</b></font>"]をタップします"\n</li>" "\n<li>"SDカードから連絡先をインポートする場合は["<font fgcolor="#ffffffff"><b>"インポート/エクスポート"</b></font>"]をタップします"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"表示できる連絡先がありません(アカウントを追加した場合は、連絡先が同期されるまでに数分かかることがあります)。"\n\n"連絡先を追加するには、まず"<font fgcolor="#ffffffff"><b>"MENU"</b></font>"キーを押し:"\n\n<li>"電話との同期が可能な連絡先のアカウントを追加または設定する場合は["<font fgcolor="#ffffffff"><b>"アカウント"</b></font>"]をタップします"\n</li>\n<li>"表示される連絡先を変更するには["<font fgcolor="#ffffffff"><b>"表示オプション"</b></font>"]をタップします"\n</li>" "\n<li>"新しい連絡先を最初から作成する場合は["<font fgcolor="#ffffffff"><b>"連絡先を新規登録"</b></font>"]をタップします"\n</li>" "\n<li>"SDカードから連絡先をインポートする場合は["<font fgcolor="#ffffffff"><b>"インポート/エクスポート"</b></font>"]をタップします"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"お気に入りはありません。"\n\n"お気に入りのリストに連絡先を追加するには: "\n\n"        "<li>"["<b>"連絡先"</b>"]タブをタップします"\n</li>" "\n<li>"お気に入りに追加する連絡先をタップします"\n</li>" "\n<li>"連絡先名の横にあるスターをタップします"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"すべての連絡先"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"スター付き"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"コールバック"</string>
     <string name="callAgain" msgid="3197312117049874778">"再発信"</string>
     <string name="returnCall" msgid="8171961914203617813">"発信"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g>分<xliff:g id="SECONDS">%2$s</xliff:g>秒"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g>分<xliff:g id="SECONDS">%s</xliff:g>秒"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"よく使う連絡先"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"連絡先を追加"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"<xliff:g id="EMAIL">%s</xliff:g> を連絡先に追加しますか?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"連絡先の写真"</string>
     <string name="description_minus_button" msgid="387136707700230172">"マイナス"</string>
     <string name="description_plus_button" msgid="515164827856229880">"プラス"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"共有ストレージ使用不可"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"SDカードがありません"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"共有ストレージがありません"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"SDカードを検出できませんでした"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"SDカードがありません"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"SDカードを検出できませんでした"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"vCardを検索中"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"SIMカードからインポート"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"共有ストレージからインポート"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"SDカードからインポート"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"共有ストレージにエクスポート"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"SDカードにエクスポート"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"SDカードからインポート"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"SDカードにエクスポート"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"表示可能な連絡先を共有"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"vCardファイルを1つインポート"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"複数のvCardファイルをインポート"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"すべてのvCardファイルをインポート"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"共有ストレージ内でvCardデータを検索中"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"SDカードのvCardデータを検索しています"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"共有ストレージのスキャンエラー"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"SDカードのスキャンに失敗しました"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"共有ストレージをスキャンできませんでした(理由: 「<xliff:g id="FAIL_REASON">%s</xliff:g>」)"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"SDカードのスキャンに失敗しました(理由: <xliff:g id="FAIL_REASON">%s</xliff:g>)"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"SDカードのvCardデータを検索しています"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"SDカードのスキャンに失敗しました"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"SDカードのスキャンに失敗しました(理由: <xliff:g id="FAIL_REASON">%s</xliff:g>)"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"送受信エラー"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"メモリが不足しています(ファイルが大きすぎる可能性があります)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"予期しない理由によりvCardの解析に失敗しました"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"vCardの解析に失敗しました。正しいフォーマットですが、現在サポートされていません。"</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"共有ストレージ内にvCardファイルが見つかりません"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"SDカードでvCardファイルが見つかりません"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"SDカードでvCardファイルが見つかりません"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"指定されたvCardファイルのメタ情報を取得できませんでした。"</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"1つ以上のファイルをインポートできませんでした(%s)。"</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"不明なエラー"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"vCardファイルの選択"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"vCardを読み取り中"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"vCardファイルを読み取り中"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"vCardデータの読み取りに失敗しました"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g>/<xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>件の連絡先"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g>/<xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>件のファイル"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"vCardをローカル一時ストレージにキャッシュしています"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"vCardをローカル一時ストレージにキャッシュしています。間もなくインポート処理を開始します。"</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"vCardデータを読み取れませんでした"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"vCardの読み取りがキャンセルされました"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"vCardのインポートを停止しました"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"vCardインポータが起動しました。"</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"vCardは後ほどvCardインポータによってインポートされます。"</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"エクスポートの確認"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"連絡先リストを「<xliff:g id="VCARD_FILENAME">%s</xliff:g>」にエクスポートしますか?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"連絡先データのエクスポートに失敗しました"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"連絡先データのエクスポートに失敗しました。"\n"理由: 「<xliff:g id="FAIL_REASON">%s</xliff:g>」"</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"エクスポートできる連絡先がありません"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"共有ストレージ内のvCardファイルが多すぎます"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"SDカードのvCardファイルが多すぎます"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"SDカードのvCardファイルが多すぎます"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"指定したファイル名が長すぎます(「<xliff:g id="FILENAME">%s</xliff:g>」)"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"vCardエクスポータが起動しました。"</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"vCardのエクスポートを停止しました"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"連絡先データのエクスポート"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"連絡先データを\"<xliff:g id="FILE_NAME">%s</xliff:g>\"にエクスポートしています"</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"エクスポータを初期化できませんでした: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"データベース情報の取得に失敗しました"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"エクスポートできる連絡先がありません。携帯電話に連絡先を登録している場合、データプロバイダが外部への連絡先のエクスポートをすべて禁止している可能性があります。"</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"vCardコンポーザーが正しく初期化されていません"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\"<xliff:g id="FILE_NAME">%1$s</xliff:g>\"を開けませんでした: <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g>/<xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>件のファイル"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\"<xliff:g id="FILE_NAME">%s</xliff:g>\"を開けませんでした: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g>/<xliff:g id="TOTAL_NUMBER">%s</xliff:g>件のファイル"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"連絡先の名前"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"2秒間の停止を追加"</string>
     <string name="add_wait" msgid="3360818652790319634">"着信を追加"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"この操作を行うアプリケーションが見つかりません"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"この選択を保存"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"不明"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"データがありません"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"アカウント"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"インポート/エクスポート"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"連絡先のインポート/エクスポート"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"その他の連絡先"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"すべての連絡先"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"「<xliff:g id="GROUP">%s</xliff:g>」を同期から除外すると、グループに含まれない連絡先もすべて同期から除外されます。"</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"電話のみ(非同期)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"電話のみ(非同期)"</string>
     <string name="call_custom" msgid="7756571794763171802">"<xliff:g id="CUSTOM">%s</xliff:g>に発信"</string>
     <string name="call_home" msgid="1990519474420545392">"自宅に発信"</string>
     <string name="call_mobile" msgid="7502236805487609178">"携帯電話に発信"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"ICQでチャット"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Jabberでチャット"</string>
     <string name="chat" msgid="9025361898797412245">"チャット"</string>
+    <string name="postal_address" msgid="8765560217149624536">"住所"</string>
     <string name="postal_street" msgid="8133143961580058972">"番地"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"私書箱"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"街区 (中国等で使用)"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"都道府県"</string>
     <string name="postal_postcode" msgid="572136414136673751">"郵便番号"</string>
     <string name="postal_country" msgid="7638264508416368690">"国"</string>
+    <string name="full_name" msgid="6602579550613988977">"名前"</string>
     <string name="name_given" msgid="1687286314106019813">"名"</string>
     <string name="name_family" msgid="3416695586119999058">"姓"</string>
     <string name="name_prefix" msgid="59756378548779822">"敬称(名前の前)"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"姓のよみがな"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g>からの連絡先"</string>
     <string name="from_account_format" msgid="687567483928582084">"<xliff:g id="SOURCE">%1$s</xliff:g>からの連絡先"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"<xliff:g id="SOURCE_1">%2$s</xliff:g>からの<xliff:g id="SOURCE_0">%1$s</xliff:g>連絡先"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"この写真を使用"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"<xliff:g id="SOURCE">%1$s</xliff:g>からの連絡先情報はこの携帯端末では編集できません。"</string>
     <string name="no_contact_details" msgid="6754415338321837001">"この連絡先の詳細情報はありません"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"ギャラリーから写真を選ぶ"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"言語の変更に伴い連絡先リストを更新しています。"\n\n"しばらくお待ちください..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"連絡先リストを更新しています。"\n\n"お待ちください..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"連絡先をアップグレードしています。"\n\n"アップグレード処理には約<xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g>MBの内部ストレージが必要です。"\n\n"次のいずれかのオプションを選択してください:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"連絡先をアップグレードしています。"\n\n"アップグレード処理には約<xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g>MBの内部ストレージが必要です。"\n\n"次のいずれかのオプションを選択してください:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"一部のアプリケーションをアンインストール"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"アップグレードを再試行"</string>
     <string name="search_results_for" msgid="8705490885073188513">"検索結果: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"検索中..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"読み込み中..."</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"選択した連絡先を表示"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"すべて表示"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"すべて選択"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"選択をすべて解除"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"1件の宛先を選択済み"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g>件の宛先を選択済み"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"不明な連絡先"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"連絡先が選択されていません。"</string>
+    <string name="add_field" msgid="5257149039253569615">"情報を追加"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"<xliff:g id="SOURCE">%1$s</xliff:g>経由"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g>、<xliff:g id="SOURCE">%2$s</xliff:g>経由"</string>
+    <string name="description_edit" msgid="1601490950771217014">"編集"</string>
+    <string name="description_star" msgid="2605854427360036550">"お気に入り"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"連絡先の編集"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"結合する連絡先はありません"</item>
+    <item quantity="other" msgid="425683718017380845">"<xliff:g id="COUNT">%0$d</xliff:g>件の連絡先が結合されました"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"削除"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"保存エラー"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"その他"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767"></string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml
index 915e06b..3c10538 100644
--- a/res/values-ko/strings.xml
+++ b/res/values-ko/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"연락처 세부정보"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"연락처 보기"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"연락처 수정"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"이메일 주소:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"유형:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"연락처 만들기"</string>
     <string name="searchHint" msgid="8482945356247760701">"주소록 검색"</string>
     <string name="menu_search" msgid="9147752853603483719">"검색"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"새 연락처"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"소리나는 대로"</string>
     <string name="label_notes" msgid="8337354953278341042">"메모"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"인터넷 통화"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"벨소리"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"이름"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"이름(소리나는 대로)"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"표시할 수 있는 주소록이 없습니다."</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"연락처 1개를 찾았습니다."</item>
-    <item quantity="other" msgid="7752927996850263152">"연락처 <xliff:g id="COUNT">%d</xliff:g>개를 찾았습니다."</item>
+    <item quantity="one" msgid="5517063038754171134">"1개를 찾았습니다."</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g>개를 찾았습니다."</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"연락처를 찾을 수 없습니다."</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"찾을 수 없음"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1개의 연락처"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g>개의 연락처"</item>
+    <item quantity="one" msgid="4826918429708286628">"1개를 찾았습니다."</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g>개를 찾았습니다."</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"주소록"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"즐겨찾기"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"SIM 카드 주소록"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"표시할 연락처가 없습니다. 방금 계정을 추가한 경우 연락처를 동기화하는 데 몇 분 정도 걸릴 수 있습니다."</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"표시할 연락처가 없습니다."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"표시할 연락처가 없습니다."\n\n"연락처를 추가하려면 "<font fgcolor="#ffffffff"><b>"메뉴"</b></font>"를 누르고 다음을 터치합니다. "\n" "\n<li><font fgcolor="#ffffffff"><b>"계정"</b></font>": 휴대전화에 동기화할 수 있는 연락처가 있는 계정을 구성하거나 추가하려면 터치합니다. "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"새 연락처"</b></font>": 연락처를 새로 만들려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"가져오기/내보내기"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"표시할 연락처가 없습니다. 방금 계정을 추가한 경우 연락처를 동기화하는 데 몇 분 정도 걸릴 수 있습니다."\n\n"연락처를 추가하려면 "<font fgcolor="#ffffffff"><b>"메뉴"</b></font>"를 누르고 다음을 터치합니다. "\n" "\n<li><font fgcolor="#ffffffff"><b>"계정"</b></font>": 휴대전화에 동기화할 수 있는 연락처가 있는 계정을 구성하거나 추가하려면 터치합니다. "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"표시 옵션"</b></font>": 표시되는 연락처를 변경하려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"새 연락처"</b></font>": 연락처를 새로 만들려면 터치합니다. "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"가져오기/내보내기"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"표시할 연락처가 없습니다"\n\n"연락처를 추가하려면 "<font fgcolor="#ffffffff"><b>"메뉴"</b></font>"를 누르고 다음을 터치합니다. "\n" "\n<li><font fgcolor="#ffffffff"><b>"계정"</b></font>": 휴대전화에 동기화할 수 있는 연락처가 있는 계정을 구성하거나 추가하려는 경우 터치합니다. "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"새 연락처"</b></font>": 연락처를 새로 만들려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"가져오기/내보내기"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"표시할 연락처가 없습니다. 방금 계정을 추가한 경우 연락처를 동기화하는 데 몇 분 정도 걸릴 수 있습니다."\n\n"연락처를 추가하려면 "<font fgcolor="#ffffffff"><b>"메뉴"</b></font>"를 누르고 다음을 터치합니다. "\n" "\n<li><font fgcolor="#ffffffff"><b>"계정"</b></font>": 휴대전화에 동기화할 수 있는 연락처가 있는 계정을 구성하거나 추가하려면 터치합니다. "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"표시 옵션"</b></font>": 표시되는 연락처를 변경하려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"새 연락처"</b></font>": 연락처를 새로 만들려면 터치합니다. "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"가져오기/내보내기"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"표시할 연락처가 없습니다."\n\n"연락처를 추가하려면 "<font fgcolor="#ffffffff"><b>"메뉴"</b></font>"를 누르고 다음을 터치합니다."\n" "\n<li><font fgcolor="#ffffffff"><b>"계정"</b></font>": 휴대전화에 동기화할 수 있는 연락처가 있는 계정을 구성하거나 추가하려는 경우 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"새 연락처"</b></font>": 연락처를 새로 만들려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"가져오기/내보내기"</b></font>": SIM 또는 SD 카드에서 연락처를 가져오려면 터치합니다."\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"표시할 연락처가 없습니다. 방금 계정을 추가한 경우 연락처를 동기화하는 데 몇 분 정도 걸릴 수 있습니다."\n\n"연락처를 추가하려면 "<font fgcolor="#ffffffff"><b>"메뉴"</b></font>"를 누르고 다음을 터치합니다."\n" "\n<li><font fgcolor="#ffffffff"><b>"계정"</b></font>": 휴대전화에 동기화할 수 있는 연락처가 있는 계정을 구성하거나 추가하려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"표시 옵션"</b></font>": 표시할 연락처를 변경하려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"새 연락처"</b></font>": 연락처를 새로 만들려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"가져오기/내보내기"</b></font>": SIM 또는 SD 카드에서 연락처를 가져오려면 터치합니다."\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"표시할 연락처가 없습니다."\n\n"연락처를 추가하려면 "<font fgcolor="#ffffffff"><b>"메뉴"</b></font>"를 누르고 다음을 터치합니다."\n" "\n<li><font fgcolor="#ffffffff"><b>"계정"</b></font>": 휴대전화에 동기화할 수 있는 연락처가 있는 계정을 구성하거나 추가하려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"새 연락처"</b></font>": 연락처를 새로 만들려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"가져오기/내보내기"</b></font>": SD 카드에서 연락처를 가져오려면 터치합니다."\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"표시할 연락처가 없습니다. 방금 계정을 추가한 경우 연락처를 동기화하는 데 몇 분 정도 걸릴 수 있습니다."\n\n"연락처를 추가하려면 "<font fgcolor="#ffffffff"><b>"메뉴"</b></font>"를 누르고 다음을 터치합니다."\n" "\n<li><font fgcolor="#ffffffff"><b>"계정"</b></font>": 휴대전화에 동기화할 수 있는 연락처가 있는 계정을 구성하거나 추가하려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"표시 옵션"</b></font>": 표시되는 연락처를 변경하려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"새 연락처"</b></font>": 연락처를 새로 만들려면 터치합니다."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"가져오기/내보내기"</b></font>": SD 카드에서 연락처를 가져오려면 터치합니다."\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"즐겨찾기가 없습니다. "\n\n"즐겨찾기 목록에 연락처를 추가하려면 "\n\n<li><b>"주소록"</b>" 탭을 터치하고"\n</li>" "\n<li>"즐겨찾기에 추가할 연락처를 터치하고"\n</li>" "\n<li>"연락처 이름 옆의 별표를 터치합니다."\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"모든 연락처"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"중요 주소록"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"전화 걸기"</string>
     <string name="callAgain" msgid="3197312117049874778">"다시 걸기"</string>
     <string name="returnCall" msgid="8171961914203617813">"전화 걸기"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g>분 <xliff:g id="SECONDS">%2$s</xliff:g>초"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g>분 <xliff:g id="SECONDS">%s</xliff:g>초"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"자주 연락하는 사람들의 연락처"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"연락처 추가"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"\'<xliff:g id="EMAIL">%s</xliff:g>\'을(를) 주소록에 추가하겠습니까?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"주소록 사진"</string>
     <string name="description_minus_button" msgid="387136707700230172">"빼기"</string>
     <string name="description_plus_button" msgid="515164827856229880">"더하기"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"공유 저장장치를 사용할 수 없음"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"SD 카드 없음"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"공유 저장장치가 없습니다."</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"SD 카드가 발견되지 않았습니다."</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"SD 카드 없음"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"SD 카드가 발견되지 않았습니다."</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"vCard 검색"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"SIM 카드에서 가져오기"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"공유 저장장치에서 가져오기"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"SD 카드에서 가져오기"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"공유 저장장치으로 내보내기"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"SD 카드로 내보내기"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"SD 카드에서 가져오기"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"SD 카드로 내보내기"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"표시되는 연락처 공유"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"vCard 파일 한 개 가져오기"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"vCard 파일 여러 개 가져오기"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"모든 vCard 파일 가져오기"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"공유 저장장치에서 vCard 데이터 검색"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"SD 카드의 vCard 데이터 검색"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"공유 저장장치 스캔 실패"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"SD 카드 스캔 실패"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"공유 저장장치 스캔 실패(이유: \'<xliff:g id="FAIL_REASON">%s</xliff:g>\')"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"SD 카드 스캔 실패(이유: \'<xliff:g id="FAIL_REASON">%s</xliff:g>\')"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"SD 카드의 vCard 데이터 검색"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"SD 카드 스캔 실패"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"SD 카드 스캔 실패(이유: \'<xliff:g id="FAIL_REASON">%s</xliff:g>\')"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"I/O 오류"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"메모리가 부족합니다. 파일이 너무 크기 때문일 수 있습니다."</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"예기치 못한 이유로 인해 vCard를 구문분석하지 못했습니다."</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"올바른 형식처럼 보이지만 현재 구현 환경에서는 VCard를 지원하지 않기 때문에 VCard 구문 분석에 실패했습니다."</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"vCard 파일이 공유 저장장치에 없습니다."</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"SD 카드에 VCard 파일이 없습니다."</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"SD 카드에 VCard 파일이 없습니다."</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"지정한 vCard 파일에 대한 메타 정보를 수집하지 못했습니다."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"하나 이상의 파일을 가져오지 못했습니다(%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"알 수 없는 오류"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"vCard 파일 선택"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"vCard 읽는 중"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"vCard 파일 읽는 중"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"vCard 데이터를 읽어오지 못했습니다."</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"연락처 <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g>개(총 <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>개) 내보내는 중"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"파일 <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>개 중 <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g>개"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"vCard를 로컬 임시 저장공간에 캐시하는 중"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"가져오기 도구가 vCard를 로컬 임시 저장공간에 캐시하는 중입니다. 곧 실제 가져오기가 시작됩니다."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"vCard 데이터를 읽지 못했습니다."</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"vCard 데이터 읽기가 취소되었습니다."</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"vCard 가져오기 완료됨"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"vCard 가져오기 도구가 시작되었습니다."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"잠시 후에 vCard 가져오기 도구가 vCard를 가져옵니다."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"내보내기 확인"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"\'<xliff:g id="VCARD_FILENAME">%s</xliff:g>\'(으)로 연락처 목록을 내보내시겠습니까?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"연락처 데이터를 내보내지 못했습니다."</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"연락처 데이터를 내보내지 못했습니다."\n"실패 이유: \'<xliff:g id="FAIL_REASON">%s</xliff:g>\'"</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"내보낼 수 있는 연락처가 없습니다."</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"공유 저장장치에 vCard 파일이 너무 많습니다."</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"SD 카드에 vCard 파일이 너무 많습니다."</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"SD 카드에 vCard 파일이 너무 많습니다."</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"필수 파일 이름이 너무 깁니다(\'<xliff:g id="FILENAME">%s</xliff:g>\')."</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"vCard 내보내기 도구가 시작되었습니다."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"vCard 내보내기 완료됨"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"연락처 데이터 내보내기"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"연락처 데이터를 \'<xliff:g id="FILE_NAME">%s</xliff:g>\'(으)로 내보내는 중"</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"내보내기를 초기화하지 못했습니다. \'<xliff:g id="EXACT_REASON">%s</xliff:g>\'"</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"데이터베이스 정보를 가져오지 못했습니다."</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"내보낼 수 있는 연락처가 없습니다. 휴대전화에 실제로 연락처가 있다면 일부 데이터 제공업체에서 모든 연락처를 휴대전화 외부로 내보내지 못하도록 금지했을 수 있습니다."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"vCard 작성기가 바르게 초기화되지 않았습니다."</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\'<xliff:g id="FILE_NAME">%1$s</xliff:g>\'을(를) 열 수 없습니다. <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"연락처 <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g>개(총 <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>개) 내보내는 중"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\'<xliff:g id="FILE_NAME">%s</xliff:g>\'을(를) 열 수 없습니다. <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"연락처 <xliff:g id="CURRENT_NUMBER">%s</xliff:g>개(총 <xliff:g id="TOTAL_NUMBER">%s</xliff:g>개) 내보내는 중"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"연락처 명단"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"2초 간 일시 정지 추가"</string>
     <string name="add_wait" msgid="3360818652790319634">"대기 시간 추가"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"이 작업을 처리하는 애플리케이션을 찾을 수 없습니다."</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"이 선택사항 저장"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"알 수 없음"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"데이터가 없습니다."</string>
     <string name="menu_accounts" msgid="8499114602017077970">"계정"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"가져오기/내보내기"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"연락처 가져오기/내보내기"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"다른 모든 연락처"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"모든 연락처"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"\'<xliff:g id="GROUP">%s</xliff:g>\'을(를) 동기화에서 제거하면 그룹화되지 않은 연락처도 동기화에서 제거됩니다."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"전화기 전용(동기화되지 않음)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"전화기 전용(동기화되지 않음)"</string>
     <string name="call_custom" msgid="7756571794763171802">"<xliff:g id="CUSTOM">%s</xliff:g>(으)로 전화걸기"</string>
     <string name="call_home" msgid="1990519474420545392">"집으로 전화걸기"</string>
     <string name="call_mobile" msgid="7502236805487609178">"휴대전화로 전화걸기"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"ICQ로 채팅"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Jabber로 채팅"</string>
     <string name="chat" msgid="9025361898797412245">"채팅"</string>
+    <string name="postal_address" msgid="8765560217149624536">"주소"</string>
     <string name="postal_street" msgid="8133143961580058972">"번지"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"사서함"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"인근 지역"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"시/도"</string>
     <string name="postal_postcode" msgid="572136414136673751">"우편번호"</string>
     <string name="postal_country" msgid="7638264508416368690">"국가"</string>
+    <string name="full_name" msgid="6602579550613988977">"이름"</string>
     <string name="name_given" msgid="1687286314106019813">"이름"</string>
     <string name="name_family" msgid="3416695586119999058">"성"</string>
     <string name="name_prefix" msgid="59756378548779822">"경칭"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"성(소리나는 대로)"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g> 연락처"</string>
     <string name="from_account_format" msgid="687567483928582084">"출처: <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"<xliff:g id="SOURCE_1">%2$s</xliff:g>에서 가져온 <xliff:g id="SOURCE_0">%1$s</xliff:g> 연락처"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"사진 사용"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"<xliff:g id="SOURCE">%1$s</xliff:g> 연락처 정보는 이 기기에서 수정할 수 없습니다."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"연락처에 대한 추가 정보가 없습니다."</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"갤러리에서 사진 선택"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"변경된 언어를 반영하도록 연락처 목록을 업데이트하는 중입니다."\n\n"잠시 기다려 주세요."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"연락처 목록을 업데이트하고 있습니다."\n\n"잠시 기다려 주세요..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"연락처를 업그레이드하는 중입니다. "\n\n"업그레이드 프로세스에는 약 <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g>Mb의 휴대전화 내부 저장공간이 필요합니다."\n\n"다음 옵션 중 하나를 선택하세요."</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"주소록을 업그레이드하는 중입니다. "\n\n"업그레이드 프로세스에는 약 <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g>MB의 휴대전화 내부 저장공간이 필요합니다."\n\n"다음 옵션 중 하나를 선택하세요."</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"일부 애플리케이션 제거"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"업그레이드 다시 시도"</string>
     <string name="search_results_for" msgid="8705490885073188513">"<xliff:g id="QUERY">%s</xliff:g>에 대한 검색결과"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"검색 중..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"로드 중..."</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"선택한 항목 표시"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"모두 표시"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"모두 선택"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"모두 선택취소"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"수신자 1명이 선택됨"</item>
+    <item quantity="other" msgid="4608837420986126229">"수신자 <xliff:g id="COUNT">%d</xliff:g>명이 선택됨"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"알 수 없는 연락처"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"선택한 연락처가 없습니다."</string>
+    <string name="add_field" msgid="5257149039253569615">"정보 추가"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"출처: <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g>(출처: <xliff:g id="SOURCE">%2$s</xliff:g>)"</string>
+    <string name="description_edit" msgid="1601490950771217014">"수정"</string>
+    <string name="description_star" msgid="2605854427360036550">"즐겨찾기"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"연락처 수정"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"병합되지 않았습니다."</item>
+    <item quantity="other" msgid="425683718017380845">"<xliff:g id="COUNT">%0$d</xliff:g>개 출처에서 병합했습니다."</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"삭제"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"저장하는 중에 오류가 발생했습니다."</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"기타"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
index a3c1d39..8285b5a 100644
--- a/res/values-nb/strings.xml
+++ b/res/values-nb/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Egenskaper for kontakt"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Se på kontakt"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Rediger kontakt"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"E-postadresse:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Type: "</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Opprett kontakt"</string>
     <string name="searchHint" msgid="8482945356247760701">"Søk i kontakter"</string>
     <string name="menu_search" msgid="9147752853603483719">"Søk"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Ny kontakt"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Fonetisk"</string>
     <string name="label_notes" msgid="8337354953278341042">"Notater"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Internett-anrop"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Ringetone"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"For- og etternavn"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Fonetisk navn"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Ingen synlige kontakter"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"Fant 1 kontakt"</item>
-    <item quantity="other" msgid="7752927996850263152">"Fant <xliff:g id="COUNT">%d</xliff:g> kontakter"</item>
+    <item quantity="one" msgid="5517063038754171134">"1 funnet"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> funnet"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Fant ingen kontakter"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Ikke funnet"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 kontakt"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> kontakter"</item>
+    <item quantity="one" msgid="4826918429708286628">"1 funnet"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> funnet"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Kontakter"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favoritter"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Kontakter på SIM-kort"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Du har ingen kontakter å vise. (Hvis du nettopp har lagt til en konto, kan det ta noen minutter å synkronisere kontaktene.)"</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Du har ingen kontakter å vise."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Du har ingen kontakter å vise. "\n\n"Slik legger du til en kontakt: Trykk på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" og trykk deretter på:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Kontoer"</b></font>" for å legge til eller konfigurere en konto med kontakter som kan synkroniseres til telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" for å opprette en ny kontakt"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importér/eksportér"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Du har ingen kontakter å vise. (Hvis du nylig la til en konto, kan det ta noen minutter å synkronisere kontaktene.)"\n\n"Slik legger du til kontakter: Trykk på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" og trykk deretter på: "\n" "\n<li><font fgcolor="#ffffffff"><b>"Kontoer "</b></font>" for å legge til eller konfigurere en konto med kontakter som kan synkroniseres til telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsalternativer"</b></font>" for å endre hvilke kontakter som vises"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" for å opprette en ny kontakt"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importér/Eksportér"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Du har ingen kontakter å vise. "\n\n"Slik legger du til en kontakt: Trykk på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" og trykk deretter på:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Kontoer"</b></font>" for å legge til eller konfigurere en konto med kontakter som kan synkroniseres til telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" for å opprette en ny kontakt"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importér/eksportér"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Du har ingen kontakter å vise. (Hvis du nylig la til en konto, kan det ta noen minutter å synkronisere kontaktene.)"\n\n"Slik legger du til kontakter: Trykk på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" og trykk deretter på: "\n" "\n<li><font fgcolor="#ffffffff"><b>"Kontoer "</b></font>" for å legge til eller konfigurere en konto med kontakter som kan synkroniseres til telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsalternativer"</b></font>" for å endre hvilke kontakter som vises"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" for å opprette en ny kontakt"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importér/Eksportér"</b></font>\n</li></string>
+    <!-- syntax error in translation for noContactsHelpText (7633826236417884130) org.xmlpull.v1.XmlPullParserException: expected: /li read: font (position:END_TAG </font>@1:275 in java.io.StringReader@4506411)  -->
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Du har ingen kontakter å vise. (Hvis du nylig la til en konto, kan det ta noen minutter å synkronisere kontaktene.)"\n\n"Slik legger du til kontakter: Trykk på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" og trykk deretter på: "\n" "\n<li><font fgcolor="#ffffffff"><b>"Kontoer "</b></font>" for å legge til eller konfigurere en konto med kontakter som kan synkroniseres til telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsalternativer"</b></font>" for å endre hvilke kontakter som vises"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" for å opprette en ny kontakt"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importér/Eksportér"</b></font>" for å importere kontakter fra SIM- eller SD-kort"\n</li></string>
+    <!-- syntax error in translation for noContactsNoSimHelpText (467658807711582876) org.xmlpull.v1.XmlPullParserException: expected: /li read: font (position:END_TAG </font>@1:279 in java.io.StringReader@39d99a4d)  -->
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Du har ingen kontakter å vise. (Hvis du nylig la til en konto, kan det ta noen minutter å synkronisere kontaktene.)"\n\n"Slik legger du til kontakter: Trykk på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" og trykk deretter på: "\n" "\n<li><font fgcolor="#ffffffff"><b>"Kontoer "</b></font>" for å legge til eller konfigurere en konto med kontakter som kan synkroniseres til telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsalternativer"</b></font>" for å endre hvilke kontakter som vises"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" for å opprette en ny kontakt"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importér/eksportér"</b></font>" for å importere kontakter fra SD-kortet"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Du har ingen favoritter."\n\n"Slik legger du til en kontakt i favorittlisten:"\n\n" "<li>"Trykk på fanen "<b>"Kontakter"</b>" "\n</li>" "\n<li>"Trykk på kontakten du vil legge til i favoritter"\n</li>" "\n<li>"Trykk på stjernen ved siden av kontaktnavnet"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Alle kontakter"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Med stjerne"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Ring tilbake"</string>
     <string name="callAgain" msgid="3197312117049874778">"Ring på nytt"</string>
     <string name="returnCall" msgid="8171961914203617813">"Ring tilbake"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> min <xliff:g id="SECONDS">%2$s</xliff:g> sek"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> min <xliff:g id="SECONDS">%s</xliff:g> sek"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Ofte kontaktet"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Legg til kontakt"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Legg til «<xliff:g id="EMAIL">%s</xliff:g>» som kontakt?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"kontaktens bilde"</string>
     <string name="description_minus_button" msgid="387136707700230172">"minusknapp"</string>
     <string name="description_plus_button" msgid="515164827856229880">"plussknapp"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Delt lagring utilgj."</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Mangler minnekort"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Finner ikke delt lagring"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Fant ikke noe minnekort"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Mangler minnekort"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Fant ikke noe minnekort"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Leter etter VCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importér fra SIM-kort"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Importer fra delt lagr."</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importér fra minnekort"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Eksportér til delt lagr."</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Eksportér til minnekort"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importér fra minnekort"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Eksportér til minnekort"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Del synlige kontakter"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importer én VCard-fil"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importer flere vCard-filer"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importer alle vCard-filer"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Søker etter vCard-data i delt lagring"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Leter etter VCard-data på minnekort"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Skanning av delt lagring mislyktes"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Kunne ikke scanne minnekort"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Skanning av delt lagring mislyktes (årsak: <xliff:g id="FAIL_REASON">%s</xliff:g>)"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Kunne ikke skanne minnekort (grunn: «<xliff:g id="FAIL_REASON">%s</xliff:g>»)"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Leter etter VCard-data på minnekort"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Kunne ikke scanne minnekort"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Kunne ikke skanne minnekort (grunn: «<xliff:g id="FAIL_REASON">%s</xliff:g>»)"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Inn/ut-feil (årsak: «FAIL_REASON»)"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Ikke tilstrekkelig minne (filen kan være for stor)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Kan ikke analysere VCard av uventet årsak"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Kan ikke analysere VCard selv om det ser ut til å være i riktig format, fordi den aktuelle implementeringen ikke støtter det."</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Finner ingen vCard-filer i delt lagring"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Fant ingen VCard-filer på minnekortet"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Fant ingen VCard-filer på minnekortet"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Kan ikke hente inn metainformasjon for de(n) aktuelle vCard-filen(e)."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Importeringen av én eller flere filer mislyktes (%s)"</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Ukjent feil"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Velg VCard-fil"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Leser VCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Leser VCard-fil(er)"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Kunne ikke lese VCard-data"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> av <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> kontakter"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> av <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> filer"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Bufrer vCard-fil(er) til lokal midlertidig lagring"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"Importprogrammet bufrer vCard-filen(e) til lokal midlertidig lagring. Importen av selve filen starter snart."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Kan ikke lese vCard-data"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Lesing av vCard-data ble avbrutt"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Import av vCard-fil fullført"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Importprogrammet for vCard er startet."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"Importprogrammet for vCard importerer vCard-filen etter kort tid."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Eksportbekreftelse"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Vil du eksportere kontaktlisten din til «<xliff:g id="VCARD_FILENAME">%s</xliff:g>»?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Kunne ikke eksportere kontaktlisten"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Eksport av kontaktdata mislyktes"\n"Årsak til feil: «<xliff:g id="FAIL_REASON">%s</xliff:g>»"</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Det finnes ingen eksporterbar kontakt."</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"For mange VCard-filer på delt lagring"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"For mange VCard-datafiler på minnekortet"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"For mange VCard-datafiler på minnekortet"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"For langt filnavn kreves («<xliff:g id="FILENAME">%s</xliff:g>»)"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Eksportprogrammet for vCard er startet."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Eksport av vCard-fil fullført"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Eksporterer kontaktdata"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Eksporterer kontaktdata til «<xliff:g id="FILE_NAME">%s</xliff:g>»"</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Kunne ikke starte eksporteringen: «<xliff:g id="EXACT_REASON">%s</xliff:g>»"</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Klarte ikke å hente databaseinformasjon"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Det finnes ingen eksporterbare kontakter. Hvis du har kontakter på telefonen, kan disse i enkelte tilfeller ikke eksporteres. Dette skyldes i så fall at dataleverandøren ikke tillater det."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"Objektet for vCard-redigering er ikke riktig initialisert"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Kunne ikke åpne «<xliff:g id="FILE_NAME">%1$s</xliff:g>»: <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> av <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> kontakter"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Kunne ikke åpne «<xliff:g id="FILE_NAME">%s</xliff:g>»: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> av <xliff:g id="TOTAL_NUMBER">%s</xliff:g> kontakter"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Navn på kontakter"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Legg til pause på 2 sek."</string>
     <string name="add_wait" msgid="3360818652790319634">"Legg til Vent"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Ingen programmer som kan utføre denne handlingen ble funnet"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Husk dette valget"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Ukjent"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Ingen data"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Kontoer"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Import/eksport"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importér/eksportér kontakter"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"(Ugrupperte kontakter)"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Alle kontakter"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Hvis «<xliff:g id="GROUP">%s</xliff:g>» fjernes·fra synkroniseringen, vil også alle ugrupperte kontakter fjernes fra synkroniseringen."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Kun telefon (usynkronisert)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Kun telefon (usynkronisert)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Ring <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Ring (privat)"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Ring mobil"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Nettprat med ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Nettprat med Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Nettprat"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Adresse"</string>
     <string name="postal_street" msgid="8133143961580058972">"Gate"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Postboks"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Nabolag"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Poststed"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Postnummer"</string>
     <string name="postal_country" msgid="7638264508416368690">"Land"</string>
+    <string name="full_name" msgid="6602579550613988977">"Navn"</string>
     <string name="name_given" msgid="1687286314106019813">"Fornavn"</string>
     <string name="name_family" msgid="3416695586119999058">"Etternavn"</string>
     <string name="name_prefix" msgid="59756378548779822">"Første del av navn"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Fonetisk etternavn"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g>-kontakt"</string>
     <string name="from_account_format" msgid="687567483928582084">"fra <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"<xliff:g id="SOURCE_0">%1$s</xliff:g> kontakt fra <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Bruk dette bildet"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"<xliff:g id="SOURCE">%1$s</xliff:g>-kontaktinformasjon kan ikke redigeres på denne enheten."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Ingen utfyllende informasjon for denne kontakten"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Velg bilde fra galleriet"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"Kontaktlisten er oppdatert med nytt språk."\n\n"Vent litt ..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Kontaktlisten oppdateres."\n\n"Vent litt ..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Oppgradering av kontakter pågår. "\n\n"Oppgraderingsprosessen krever cirka <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB internt minne på telefonen."\n\n"Velg ett av følgende alternativer:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Oppgradering av kontakter pågår. "\n\n"Oppgraderingsprosessen krever cirka <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB internt minne på telefonen."\n\n"Velg ett av følgende alternativer:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Avinstaller noen programmer"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Prøv å oppgradere på nytt"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Søkeresultater for <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Søker ..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Laster inn ..."</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Vis valgte"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Vis alle"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Marker alle"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Fjern alle markeringer"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"Én mottager valgt"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> mottagere valgt"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Ukjente kontakter"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Ingen kontakter valgt."</string>
+    <string name="add_field" msgid="5257149039253569615">"Legg til informasjon"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"via <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> via <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"rediger"</string>
+    <string name="description_star" msgid="2605854427360036550">"favoritt"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Rediger kontakt"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"ikke slått sammen"</item>
+    <item quantity="other" msgid="425683718017380845">"sammenslått fra <xliff:g id="COUNT">%0$d</xliff:g> kilder"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Slett"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Feil ved lagring"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Andre"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;Æ;Ø;Å"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml
index c067ca0..7a48313 100644
--- a/res/values-nl/strings.xml
+++ b/res/values-nl/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Details van contact"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Contact weergeven"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Contact bewerken"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"E-mailadres:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Type:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Contact maken"</string>
     <string name="searchHint" msgid="8482945356247760701">"Contacten zoeken"</string>
     <string name="menu_search" msgid="9147752853603483719">"Zoeken"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Nieuw contact"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Fonetisch"</string>
     <string name="label_notes" msgid="8337354953278341042">"Opmerkingen"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Internetoproep"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Beltoon"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Voor- en achternaam"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Fonetisch gespelde naam"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Geen zichtbare contacten"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"1 contact gevonden"</item>
-    <item quantity="other" msgid="7752927996850263152">"<xliff:g id="COUNT">%d</xliff:g> contacten gevonden"</item>
+    <item quantity="one" msgid="5517063038754171134">"1 gevonden"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> gevonden"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Contact niet gevonden"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Niet gevonden"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 contact"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> contacten"</item>
+    <item quantity="one" msgid="4826918429708286628">"1 gevonden"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> gevonden"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Contact"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favoriet"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Contacten op SIM-kaart"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"U heeft geen contacten om weer te geven. Als u zojuist een account heeft toegevoegd, kan het enkele minuten duren voordat de contacten zijn gesynchroniseerd."</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"U heeft geen contacten om weer te geven."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"U heeft geen contacten om weer te geven."\n\n"Als u contacten wilt toevoegen, drukt u op "<font fgcolor="#ffffffff"><b>"\'Menu\'"</b></font>" en raakt u de volgende opties aan:"\n" "\n<li><font fgcolor="#ffffffff"><b>"\'Accounts\'"</b></font>" om een account toe te voegen of een account te configureren met contacten die u kunt synchroniseren met de telefoon"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Nieuw contact\'"</b></font>" om een geheel nieuw contact te maken"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Importeren/exporteren\'"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"U heeft geen contacten om weer te geven. (Als u net een account heeft toegevoegd, kan het enkele minuten duren voordat de contacten zijn gesynchroniseerd.)"\n\n"Als u contacten wilt toevoegen, drukt u op "<font fgcolor="#ffffffff"><b>"\'Menu\'"</b></font>" en raakt u de volgende opties aan:"\n" "\n<li><font fgcolor="#ffffffff"><b>"\'Accounts\'"</b></font>" om een account toe te voegen of een account te configureren met contacten die u kunt synchroniseren met de telefoon"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Weergaveopties\'"</b></font>" om de zichtbaarheid van contacten te wijzigen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Nieuw contact\'"</b></font>" om een geheel nieuw contact te maken"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Importeren/exporteren\'"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"U heeft geen contacten om weer te geven."\n\n"Als u contacten wilt toevoegen, drukt u op "<font fgcolor="#ffffffff"><b>"\'Menu\'"</b></font>" en raakt u de volgende opties aan:"\n" "\n<li><font fgcolor="#ffffffff"><b>"\'Account "</b></font>" om een account toe te voegen of een account te configureren met contacten die u kunt synchroniseren met de telefoon"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Nieuw contact\'"</b></font>" om een geheel nieuw contact te maken"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Importeren/exporteren\'"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"U heeft geen contacten om weer te geven. (Als u net een account heeft toegevoegd, kan het enkele minuten duren voordat de contacten zijn gesynchroniseerd.)"\n\n"Als u contacten wilt toevoegen, drukt u op "<font fgcolor="#ffffffff"><b>"\'Menu\'"</b></font>" en raakt u de volgende opties aan:"\n" "\n<li><font fgcolor="#ffffffff"><b>"\'Accounts\'"</b></font>" om een account toe te voegen of een account te configureren met contacten die u kunt synchroniseren met de telefoon"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Weergaveopties\'"</b></font>" om de zichtbaarheid van contacten te wijzigen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Nieuw contact\'"</b></font>" om een geheel nieuw contact te maken"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Importeren/exporteren\'"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"U heeft geen contacten om weer te geven."\n\n"Als u contacten wilt toevoegen, drukt u op "<font fgcolor="#ffffffff"><b>"\'Menu\'"</b></font>" en raakt u de volgende opties aan:"\n" "\n<li><font fgcolor="#ffffffff"><b>"\'Accounts\'"</b></font>" om een account toe te voegen of te configureren met contacten die u kunt synchroniseren met de telefoon"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Nieuw contact\'"</b></font>" om een geheel nieuw contact te maken"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Importeren/exporteren\'"</b></font>" om contacten te importeren van uw SIM- of SD-kaart"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"U heeft geen contacten om weer te geven. (Als u net een account heeft toegevoegd, kan het enkele minuten duren voordat de contacten zijn gesynchroniseerd.)"\n\n"Als u contacten wilt toevoegen, drukt u op "<font fgcolor="#ffffffff"><b>"\'Menu\'"</b></font>" en raakt u de volgende opties aan:"\n" "\n<li><font fgcolor="#ffffffff"><b>"\'Accounts\'"</b></font>" om een account toe te voegen of te configureren met contacten die u kunt synchroniseren met de telefoon"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Weergaveopties\'"</b></font>" om de zichtbaarheid van contacten te wijzigen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Nieuw contact\'"</b></font>" om een geheel nieuw contact toe te voegen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Importeren/exporteren\'"</b></font>" om contacten van uw SIM- of SD-kaart te importeren"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"U heeft geen contacten om weer te geven."\n\n"Als u contacten wilt toevoegen, drukt u op "<font fgcolor="#ffffffff"><b>"\'Menu\'"</b></font>" en raakt u de volgende opties aan:"\n" "\n<li><font fgcolor="#ffffffff"><b>"\'Accounts\'"</b></font>" om een account toe te voegen of te configureren met contacten die u kunt synchroniseren met de telefoon"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Nieuw contact\'"</b></font>" om een geheel nieuw contact te maken"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Importeren/exporteren\'"</b></font>" om contacten van uw SD-kaart te importeren"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"U heeft geen contacten om weer te geven. (Als u net een account heeft toegevoegd, kan het enkele minuten duren voordat de contacten zijn gesynchroniseerd.)"\n\n"Als u contacten wilt toevoegen, drukt u op "<font fgcolor="#ffffffff"><b>"\'Menu\'"</b></font>" en raakt u de volgende opties aan:"\n" "\n<li><font fgcolor="#ffffffff"><b>"\'Accounts\'"</b></font>" om een account toe te voegen of te configureren met contacten die u kunt synchroniseren met de telefoon"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Weergaveopties\'"</b></font>" om de zichtbaarheid van contacten te wijzigen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Nieuw contact\'"</b></font>" om een geheel nieuw contact te maken"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"\'Importeren/exporteren\'"</b></font>" om contacten van uw SD-kaart te importeren"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"U heeft geen favorieten."\n\n"U kunt als volgt een contact toevoegen aan uw lijst met favorieten:"\n\n"        "<li>"Raak het tabblad \'"<b>"Contacten"</b>"\' aan."\n</li>" "\n<li>"Raak het contact aan dat u wilt toevoegen aan uw favorieten."\n</li>" "\n<li>"Raak de ster aan die wordt weergegeven naast de naam van het contact."\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Alle contacten"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Met ster"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Terugbellen"</string>
     <string name="callAgain" msgid="3197312117049874778">"Opnieuw bellen"</string>
     <string name="returnCall" msgid="8171961914203617813">"Terugbellen"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> min. <xliff:g id="SECONDS">%2$s</xliff:g> sec."</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> min. <xliff:g id="SECONDS">%s</xliff:g> sec."</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Regelmatig contact"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Contact toevoegen"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Voeg \"<xliff:g id="EMAIL">%s</xliff:g>\" toe aan contactpersonen?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"contactfoto"</string>
     <string name="description_minus_button" msgid="387136707700230172">"min"</string>
     <string name="description_plus_button" msgid="515164827856229880">"plus"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Gedeelde opslag niet besch."</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Geen SD-kaart"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Geen gedeelde opslag gevonden"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Geen SD-kaart gedetecteerd"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Geen SD-kaart"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Geen SD-kaart gedetecteerd"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Zoeken naar vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importeren van SIM-kaart"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Importeren uit gedeelde opslag"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importeren van SD-kaart"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Exporteren naar gedeelde opslag"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Exporteren naar SD-kaart"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importeren van SD-kaart"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Exporteren naar SD-kaart"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Zichtbare contacten delen"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Eén vCard-bestand importeren"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Meerdere vCard-bestanden importeren"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Alle vCard-bestanden importeren"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Zoeken naar vCard-gegevens in gedeelde opslag"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Zoeken naar vCard-gegevens op SD-kaart"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Scannen van gedeelde opslag is mislukt"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Scannen van SD-kaart is mislukt"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Scannen van gedeelde opslag is mislukt (reden: \'<xliff:g id="FAIL_REASON">%s</xliff:g>\')"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Scannen van SD-kaart is mislukt: (Reden: \'<xliff:g id="FAIL_REASON">%s</xliff:g>\')"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Zoeken naar vCard-gegevens op SD-kaart"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Scannen van SD-kaart is mislukt"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Scannen van SD-kaart is mislukt: (Reden: \'<xliff:g id="FAIL_REASON">%s</xliff:g>\')"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"I/O-fout"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Onvoldoende geheugen (het bestand is mogelijk te groot)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Parseren van vCard is mislukt om onbekende reden"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Kan vCard niet parseren, ook al lijkt de indeling geldig. vCard wordt niet ondersteund door de huidige implementatie"</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Geen vCard-bestand gevonden in gedeelde opslag"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Geen vCard-bestand gevonden op SD-kaart"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Geen vCard-bestand gevonden op SD-kaart"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Verzamelen van metagegevens van betreffende vCard-bestanden is mislukt."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Een of meer bestanden kunnen niet worden geïmporteerd (%s)"</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Onbekende fout"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"vCard-bestand selecteren"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"vCard lezen"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"vCard-bestand(en) lezen"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Lezen van vCard-gegevens is mislukt"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> van <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contacten"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> van <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> bestanden"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"vCard(s) cachen in lokale tijdelijke opslag"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"De importer cacht vCard(s) in de lokale tijdelijke opslag. Daadwerkelijk importeren begint gauw."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Lezen van vCard-gegevens is mislukt"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Lezen van vCard-gegevens is geannuleerd"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Importeren van vCard voltooid"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"vCard-importer gestart."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"Na enige tijd wordt de vCard geïmporteerd door de vCard-importer."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Exporteren bevestigen"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Weet u zeker dat u uw lijst met contacten wilt exporteren naar \'<xliff:g id="VCARD_FILENAME">%s</xliff:g>\'?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Exporteren van contactgegevens mislukt"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Exporteren van contactgegevens mislukt."\n"Reden voor de fout: \'<xliff:g id="FAIL_REASON">%s</xliff:g>\'"</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Er is geen contact dat geëxporteerd kan worden"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Te veel vCard-bestanden in de gedeelde opslag"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Te veel vCard-gegevens op de SD-kaart"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Te veel vCard-gegevens op de SD-kaart"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Vereiste bestandsnaam is te lang (\'<xliff:g id="FILENAME">%s</xliff:g>\')"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"vCard-exporter gestart."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Exporteren van vCard voltooid"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Contactgegevens exporteren"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Contactgegevens exporteren naar \'<xliff:g id="FILE_NAME">%s</xliff:g>\'"</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Kan het exportprogramma niet initialiseren: \'<xliff:g id="EXACT_REASON">%s</xliff:g>\'"</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Databasegegevens ophalen mislukt"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Er is geen contact dat kan worden geëxporteerd. Als er contacten op uw telefoon staan, kan het exporteren van alle contacten vanaf uw telefoon mogelijk worden geblokkeerd door een gegevensprovider."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"De vCard-editor is niet juist geïnitialiseerd"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Kan \'<xliff:g id="FILE_NAME">%1$s</xliff:g>\' niet openen: <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> van <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contacten"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Kan \'<xliff:g id="FILE_NAME">%s</xliff:g>\' niet openen: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> van <xliff:g id="TOTAL_NUMBER">%s</xliff:g> contacten"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Namen van uw contacten"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Pauze van 2 seconden toevoegen"</string>
     <string name="add_wait" msgid="3360818652790319634">"Wachten toevoegen"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Er is geen toepassing gevonden om deze actie uit te voeren"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Deze keuze onthouden"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Onbekend"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Geen gegevens"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Accounts"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importeren/exporteren"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Contacten importeren/exporteren"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Alle andere contacten"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Alle contacten"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Als u \'<xliff:g id="GROUP">%s</xliff:g>\' verwijdert uit de synchronisatie, worden ook contacten die niet bij een groep horen uit de synchronisatie verwijderd."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Alleen voor telefoon (niet gesynchroniseerd)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Alleen voor telefoon (niet gesynchroniseerd)"</string>
     <string name="call_custom" msgid="7756571794763171802">"<xliff:g id="CUSTOM">%s</xliff:g> bellen"</string>
     <string name="call_home" msgid="1990519474420545392">"Bellen naar huis"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Bellen naar mobiel"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Chatten via ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Chatten via Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Chat"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Adres"</string>
     <string name="postal_street" msgid="8133143961580058972">"Straat"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Postbus"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Wijk"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Staat"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Postcode"</string>
     <string name="postal_country" msgid="7638264508416368690">"Land"</string>
+    <string name="full_name" msgid="6602579550613988977">"Naam"</string>
     <string name="name_given" msgid="1687286314106019813">"Roepnaam"</string>
     <string name="name_family" msgid="3416695586119999058">"Achternaam"</string>
     <string name="name_prefix" msgid="59756378548779822">"Voorvoegsel"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Fonetische achternaam"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g> contact"</string>
     <string name="from_account_format" msgid="687567483928582084">"van <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"<xliff:g id="SOURCE_0">%1$s</xliff:g> contact uit <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Deze foto gebruiken"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"Contactgegevens van <xliff:g id="SOURCE">%1$s</xliff:g> kunnen niet worden bewerkt op dit apparaat."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Geen extra gegevens voor dit contact"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Foto selecteren in Galerij"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"Lijst met contacten wordt bijgewerkt om de gewijzigde taal te weerspiegelen."\n\n"Een ogenblik geduld..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Lijst met contacten wordt bijgewerkt."\n\n"Een ogenblik geduld..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Contacten worden bijgewerkt. "\n\n"Voor het upgradeproces is ongeveer <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB interne telefoonopslag vereist."\n\n"Kies een van de volgende opties:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Contacten worden bijgewerkt. "\n\n"Voor het upgradeproces is ongeveer <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB interne telefoonopslag vereist."\n\n"Kies een van de volgende opties:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Verwijder enkele toepassingen"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Upgrade opnieuw proberen"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Zoekresultaten voor: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Zoeken..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Laden…"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Selectie weergeven"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Alles weergeven"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Alles selecteren"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Selectie ongedaan maken"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"1 ontvanger geselecteerd"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> ontvangers geselecteerd"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Onbekende contacten"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Geen contacten geselecteerd."</string>
+    <string name="add_field" msgid="5257149039253569615">"Informatie toevoegen"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"via <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> via <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"bewerken"</string>
+    <string name="description_star" msgid="2605854427360036550">"favoriet"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Contact bewerken"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"niet samengevoegd"</item>
+    <item quantity="other" msgid="425683718017380845">"samengevoegd uit <xliff:g id="COUNT">%0$d</xliff:g> bronnen"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Verwijderen"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Fout bij opslaan"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Overig"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml
index 56bef15..83524fb 100644
--- a/res/values-pl/strings.xml
+++ b/res/values-pl/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Szczegóły kontaktu"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Wyświetl kontakt"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Edytuj kontakt"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"Adres e-mail:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Typ:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Utwórz kontakt"</string>
     <string name="searchHint" msgid="8482945356247760701">"Przeszukuj kontakty"</string>
     <string name="menu_search" msgid="9147752853603483719">"Szukaj"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Nowy kontakt"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Fonetycznie"</string>
     <string name="label_notes" msgid="8337354953278341042">"Notatki"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Rozmowa internetowa"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Dzwonek"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Imię i nazwisko"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Nazwisko (fonetycznie)"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Brak widocznych kontaktów"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"Znaleziono 1 kontakt"</item>
-    <item quantity="other" msgid="7752927996850263152">"Znalezionych kontaktów: <xliff:g id="COUNT">%d</xliff:g>"</item>
+    <item quantity="one" msgid="5517063038754171134">"Znaleziono: 1"</item>
+    <item quantity="other" msgid="3852668542926965042">"Znaleziono: <xliff:g id="COUNT">%d</xliff:g>"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Nie znaleziono kontaktu"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Nie znaleziono"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"Liczba kontaktów: 1"</item>
-    <item quantity="other" msgid="5660384247071761844">"Liczba kontaktów: <xliff:g id="COUNT">%d</xliff:g>"</item>
+    <item quantity="one" msgid="4826918429708286628">"Znaleziono: 1"</item>
+    <item quantity="other" msgid="7988132539476575389">"Znaleziono: <xliff:g id="COUNT">%d</xliff:g>"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Kontakty"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Ulubione"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Kontakty z karty SIM"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Nie masz żadnych kontaktów do wyświetlenia (jeśli konto zostało dopiero dodane, synchronizacja kontaktów może potrwać kilka minut)."</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Nie masz żadnych kontaktów do wyświetlenia."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Nie masz żadnych kontaktów do wyświetlenia."\n\n"Aby dodać kontakty, naciśnij przycisk "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" i dotknij opcji:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konta"</b></font>", aby dodać lub skonfigurować konto zawierające kontakty, które można synchronizować z telefonem."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nowy kontakt"</b></font>", aby utworzyć nowy kontakt od początku."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importuj/eksportuj"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Nie masz żadnych kontaktów do wyświetlenia. (Jeśli przed chwilą dodano konto, synchronizacja kontaktów może potrwać kilka minut)."\n\n"Aby dodać kontakty, naciśnij przycisk "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" i dotknij opcji:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konta"</b></font>", aby dodać lub skonfigurować konto zawierające kontakty, które można synchronizować z telefonem."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opcje wyświetlania"</b></font>", aby zmienić widoczne typy kontaktów."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nowy kontakt"</b></font>", aby utworzyć nowy kontakt od początku."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importuj/eksportuj"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Nie masz żadnych kontaktów do wyświetlenia."\n\n"Aby dodać kontakty, naciśnij przycisk "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" i dotknij opcji:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konta"</b></font>", aby dodać lub skonfigurować konto zawierające kontakty, które można synchronizować z telefonem."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nowy kontakt"</b></font>", aby utworzyć nowy kontakt od początku."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importuj/eksportuj"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Nie masz żadnych kontaktów do wyświetlenia. (Jeśli przed chwilą dodano konto, synchronizacja kontaktów może potrwać kilka minut)."\n\n"Aby dodać kontakty, naciśnij przycisk "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" i dotknij opcji:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konta"</b></font>", aby dodać lub skonfigurować konto zawierające kontakty, które można synchronizować z telefonem."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opcje wyświetlania"</b></font>", aby zmienić widoczne typy kontaktów."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nowy kontakt"</b></font>", aby utworzyć nowy kontakt od początku."\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importuj/eksportuj"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"Nie masz żadnych kontaktów do wyświetlenia."\n\n"Aby dodać kontakty, naciśnij przycisk "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" i dotknij opcji:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konta"</b></font>", aby dodać lub skonfigurować konto zawierające kontakty, które można synchronizować z telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nowy kontakt"</b></font>", aby utworzyć nowy kontakt od początku;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importuj/eksportuj"</b></font>", aby zaimportować kontakty z karty SIM lub SD."\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Nie masz żadnych kontaktów do wyświetlenia. (Jeśli przed chwilą dodano konto, synchronizacja kontaktów może potrwać kilka minut)."\n\n"Aby dodać kontakty, naciśnij przycisk "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" i dotknij opcji:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konta"</b></font>", aby dodać lub skonfigurować konto zawierające kontakty, które można synchronizować z telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opcje wyświetlania"</b></font>", aby zmienić widoczne typy kontaktów;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nowy kontakt"</b></font>", aby utworzyć nowy kontakt od początku;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importuj/eksportuj"</b></font>", aby zaimportować kontakty z karty SIM lub SD."\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"Nie masz żadnych kontaktów do wyświetlenia."\n\n"Aby dodać kontakty, naciśnij przycisk "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" i dotknij opcji:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konta"</b></font>", aby dodać lub skonfigurować konto zawierające kontakty, które można synchronizować z telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nowy kontakt"</b></font>", aby utworzyć nowy kontakt od początku;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importuj/eksportuj"</b></font>", aby zaimportować kontakty z karty SD."\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Nie masz żadnych kontaktów do wyświetlenia. (Jeśli przed chwilą dodano konto, synchronizacja kontaktów może potrwać kilka minut)."\n\n"Aby dodać kontakty, naciśnij przycisk "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" i dotknij opcji: "\n" "\n<li><font fgcolor="#ffffffff"><b>"Konta"</b></font>", aby dodać lub skonfigurować konto zawierające kontakty, które można synchronizować z telefonem;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opcje wyświetlania"</b></font>", aby zmienić widoczne typy kontaktów;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Nowy kontakt"</b></font>", aby utworzyć nowy kontakt od początku;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importuj/eksportuj"</b></font>", aby zaimportować kontakty z karty SD."\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Nie masz żadnych ulubionych kontaktów."\n\n"Aby dodać kontakt do listy ulubionych:"\n\n"        "<li>"Dotknij karty "<b>"Kontakty"</b>"."\n</li>" "\n<li>"Dotknij kontaktu, który chcesz dodać do ulubionych."\n</li>" "\n<li>"Dotknij ikony gwiazdki obok nazwy kontaktu."\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Wszystkie kontakty"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Oznaczone gwiazdką"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Oddzwoń"</string>
     <string name="callAgain" msgid="3197312117049874778">"Zadzwoń ponownie"</string>
     <string name="returnCall" msgid="8171961914203617813">"Połączenie zwrotne"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> min <xliff:g id="SECONDS">%2$s</xliff:g> s"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> min <xliff:g id="SECONDS">%s</xliff:g> s"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Częste kontakty"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Dodaj kontakt"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Czy dodać adres „<xliff:g id="EMAIL">%s</xliff:g>” do kontaktów?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"zdjęcie kontaktu"</string>
     <string name="description_minus_button" msgid="387136707700230172">"minus"</string>
     <string name="description_plus_button" msgid="515164827856229880">"plus"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Pamięć udostępniona niedostępna"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Brak karty SD"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Nie wykryto pamięci udostępnionej"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Nie wykryto karty SD"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Brak karty SD"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Nie wykryto karty SD"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Wyszukiwanie danych vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importuj z karty SIM"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Importuj z pamięci udostępnionej"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importuj z karty SD"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Eksportuj do pamięci udostępnionej"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Eksportuj na kartę SD"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importuj z karty SD"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Eksportuj na kartę SD"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Udostępnij widoczne kontakty"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importuj jeden plik vCard"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importuj wiele plików vCard"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importuj wszystkie pliki vCard"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Wyszukiwanie danych vCard w pamięci udostępnionej"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Wyszukiwanie danych vCard na karcie SD"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Skanowanie pamięci udostępnionej nie powiodło się"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Skanowanie karty SD nie powiodło się"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Skanowanie pamięci udostępnionej nie powiodło się (przyczyna: „<xliff:g id="FAIL_REASON">%s</xliff:g>”)"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Skanowanie karty SD nie powiodło się (przyczyna: „<xliff:g id="FAIL_REASON">%s</xliff:g>”)"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Wyszukiwanie danych vCard na karcie SD"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Skanowanie karty SD nie powiodło się"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Skanowanie karty SD nie powiodło się (przyczyna: „<xliff:g id="FAIL_REASON">%s</xliff:g>”)"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Błąd wejścia/wyjścia"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Niewystarczająca ilość pamięci (plik może być zbyt duży)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Nie można zanalizować pliku vCard z nieoczekiwanego powodu"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Nie można zanalizować pliku vCard, mimo że prawdopodobnie ma on prawidłowy format. Bieżąca wersja go nie obsługuje."</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"W pamięci udostępnionej nie znaleziono pliku vCard"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Na karcie SD nie znaleziono żadnego pliku vCard"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Na karcie SD nie znaleziono żadnego pliku vCard"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Nie można zebrać metainformacji z podanych plików vCard."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Nie można zaimportować co najmniej jednego pliku (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Nieznany błąd"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Wybierz plik vCard"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Odczytywanie danych vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Odczytywanie plików vCard"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Odczytywanie danych vCard nie powiodło się"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"Kontakt <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> z <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"plik <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> z <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Buforowanie kart vCard w lokalnym obszarze tymczasowym"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"Program importujący buforuje karty vCard w lokalnym obszarze tymczasowym. Rzeczywisty proces importowania rozpocznie się za chwilę."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Nie można odczytać danych karty vCard"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Odczytywanie danych kart vCard zostało anulowane"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Zakończono importowanie kart vCard"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Uruchomiono program importujący karty vCard."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"Program importujący karty vCard zaimportuje za chwilę karty vCard."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Potwierdź eksport"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Czy na pewno chcesz wyeksportować listę kontaktów do pliku „<xliff:g id="VCARD_FILENAME">%s</xliff:g>”?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Nie można wyeksportować danych kontaktu"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Nie można wyeksportować danych kontaktu."\n"Przyczyna niepowodzenia: „<xliff:g id="FAIL_REASON">%s</xliff:g>”."</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Brak kontaktów, które można wyeksportować"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Zbyt wiele plików vCard w pamięci udostępnionej"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Zbyt dużo plików vCard na karcie SD"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Zbyt dużo plików vCard na karcie SD"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Wymagana nazwa pliku jest zbyt długa („<xliff:g id="FILENAME">%s</xliff:g>”)"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Uruchomiono program eksportujący karty vCard."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Zakończono eksportowanie kart vCard"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Eksportowanie danych kontaktowych"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Eksportowanie danych kontaktowych do pliku „<xliff:g id="FILE_NAME">%s</xliff:g>”"</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Nie można zainicjować programu eksportującego: „<xliff:g id="EXACT_REASON">%s</xliff:g>”"</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Nie można pobrać informacji o bazie danych"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Brak kontaktów, które można wyeksportować. Jeśli faktycznie masz kontakty w telefonie, wyeksportowanie któregokolwiek z nich poza telefon może być zabronione przez dostawcę danych."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"Obiekt tworzenia danych vCard nie został poprawnie zainicjowany"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Nie można otworzyć pliku „<xliff:g id="FILE_NAME">%1$s</xliff:g>”: <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"Kontakt <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> z <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Nie można otworzyć pliku „<xliff:g id="FILE_NAME">%s</xliff:g>”: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"Kontakt <xliff:g id="CURRENT_NUMBER">%s</xliff:g> z <xliff:g id="TOTAL_NUMBER">%s</xliff:g>"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Imiona i nazwiska oraz nazwy w Twoich kontaktach"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Dodaj 2-sekundową pauzę"</string>
     <string name="add_wait" msgid="3360818652790319634">"Dodaj oczekiwanie"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Nie znaleziono aplikacji do obsługi tej akcji"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Zapamiętaj ten wybór"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Nieznane"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Brak danych"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Konta"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importuj/eksportuj"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importuj/eksportuj kontakty"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Wszystkie inne kontakty"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Wszystkie kontakty"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Usunięcie grupy „<xliff:g id="GROUP">%s</xliff:g>” z ustawień synchronizacji spowoduje również usunięcie wszelkich rozgrupowanych kontaktów z tych ustawień."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Tylko telefon (brak synchronizacji)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Tylko telefon (brak synchronizacji)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Połącz – <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Połącz – domowy"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Połącz – komórka"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Czat w ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Czat w Jabberze"</string>
     <string name="chat" msgid="9025361898797412245">"Czat"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Adres"</string>
     <string name="postal_street" msgid="8133143961580058972">"Ulica"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Skrytka pocztowa"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Dzielnica"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Województwo"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Kod pocztowy"</string>
     <string name="postal_country" msgid="7638264508416368690">"Kraj"</string>
+    <string name="full_name" msgid="6602579550613988977">"Imię i nazwisko"</string>
     <string name="name_given" msgid="1687286314106019813">"Imię"</string>
     <string name="name_family" msgid="3416695586119999058">"Nazwisko"</string>
     <string name="name_prefix" msgid="59756378548779822">"Przedrostek nazwiska"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Nazwisko (fonetycznie)"</string>
     <string name="account_type_format" msgid="718948015590343010">"Kontakt <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
     <string name="from_account_format" msgid="687567483928582084">"z <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"Kontakt <xliff:g id="SOURCE_0">%1$s</xliff:g> z <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Użyj tego zdjęcia"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"W tym urządzeniu nie można edytować informacji kontaktowych <xliff:g id="SOURCE">%1$s</xliff:g>."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Brak dodatkowych informacji dla tego kontaktu"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Wybierz zdjęcie z galerii"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"Lista kontaktów jest aktualizowana, aby odzwierciedlić zmianę języka."\n\n"Czekaj..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Lista kontaktów jest aktualizowana."\n\n"Czekaj..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Trwa proces uaktualniania kontaktów. "\n\n"Proces uaktualniania wymaga w przybliżeniu <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB wewnętrznej pamięci telefonu."\n\n"Wybierz jedną z następujących opcji:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Trwa proces uaktualniania kontaktów. "\n\n"Proces uaktualniania wymaga w przybliżeniu <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB wewnętrznej pamięci telefonu."\n\n"Wybierz jedną z następujących opcji:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Odinstaluj część aplikacji"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Ponów próbę uaktualnienia"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Wyniki wyszukiwania dla: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Trwa wyszukiwanie..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Wczytywanie…"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Pokaż wybrane"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Pokaż wszystkie"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Wybierz wszystko"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Anuluj wybór wszystkich\n"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"Wybrano 1 odbiorcę"</item>
+    <item quantity="other" msgid="4608837420986126229">"Liczba wybranych odbiorców: <xliff:g id="COUNT">%d</xliff:g>"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Nieznane kontakty"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Nie wybrano kontaktów."</string>
+    <string name="add_field" msgid="5257149039253569615">"Dodaj informacje"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"za pośrednictwem: <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g>, za pośrednictwem: <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"edytuj"</string>
+    <string name="description_star" msgid="2605854427360036550">"ulubione"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Edytuj kontakt"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"nie scalono"</item>
+    <item quantity="other" msgid="425683718017380845">"scalono z <xliff:g id="COUNT">%0$d</xliff:g> źródeł"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Usuń"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Błąd podczas zapisywania"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Inne"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;Ą;B;C;Ć;D;E;Ę;F;G;H;I;J;K;L;Ł;M;N;Ń;O;Ó;P;Q;R;S;Ś;T;U;V;W;X;Y;Z;Ź;Ż"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml
index 565fd6c..408c4b2 100644
--- a/res/values-pt-rPT/strings.xml
+++ b/res/values-pt-rPT/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Detalhes de contacto"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Visualizar contacto"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Editar contacto"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"Endereço de e-mail:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Tipo: "</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Criar contacto"</string>
     <string name="searchHint" msgid="8482945356247760701">"Pesquisar contactos"</string>
     <string name="menu_search" msgid="9147752853603483719">"Pesquisar"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Novo contacto"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Fonético"</string>
     <string name="label_notes" msgid="8337354953278341042">"Notas"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Chamada por internet"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Toque"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Primeiro e último"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Nome fonético"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Sem contactos visíveis"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"Foi encontrado 1 contacto"</item>
-    <item quantity="other" msgid="7752927996850263152">"Foram encontrados <xliff:g id="COUNT">%d</xliff:g> contactos"</item>
+    <item quantity="one" msgid="5517063038754171134">"1 encontrado"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> encontrado(s)"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Contacto não encontrado"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Não encontrado"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 contacto"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> contactos"</item>
+    <item quantity="one" msgid="4826918429708286628">"1 encontrado"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> encontrado(s)"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Contactos"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favoritos"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Contactos no cartão SIM"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Não existem contactos a apresentar. (Se acabou de adicionar uma conta, pode demorar alguns minutos a sincronizar os contactos.)"</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Não existem contactos a apresentar."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Não tem contactos para apresentar."\n\n"Para adicionar contactos, prima "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contactos que pode sincronizar no telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contacto"</b></font>" para criar um novo contacto de raiz"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Não tem contactos para apresentar (se acabou de adicionar uma conta, pode demorar alguns minutos a sincronizar os contactos)."\n\n"Para adicionar contactos, prima "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com os contactos que pode sincronizar no telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opções de visualização"</b></font>" para alterar os contactos visíveis"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contacto"</b></font>" para criar uma nova conta de raiz"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Não tem contactos para apresentar."\n\n"Para adicionar contactos, prima "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contactos que pode sincronizar no telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contacto"</b></font>" para criar um novo contacto de raiz"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Não tem contactos para apresentar (se acabou de adicionar uma conta, pode demorar alguns minutos a sincronizar os contactos)."\n\n"Para adicionar contactos, prima "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com os contactos que pode sincronizar no telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opções de visualização"</b></font>" para alterar os contactos visíveis"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contacto"</b></font>" para criar uma nova conta de raiz"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"Não tem contactos para apresentar."\n\n"Para adicionar contactos, prima "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contactos que pode sincronizar com o telemóvel"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contacto"</b></font>" para criar um novo contacto de raiz"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contactos do SIM ou do cartão SD"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Não tem contactos para apresentar (se acabou de adicionar uma conta, a sincronização dos contactos pode demorar alguns minutos)."\n\n"Para adicionar contactos, prima "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contactos que pode sincronizar com o telemóvel"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opções de visualização"</b></font>" para alterar os contactos visíveis"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contacto"</b></font>" para criar um novo contacto de raiz"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contactos do SIM ou do cartão SD"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"Não tem contactos para apresentar."\n\n"Para adicionar contactos, prima "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contactos que pode sincronizar com o telemóvel"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contacto"</b></font>" para criar um novo contacto de raiz"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contactos do cartão SD"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Não tem contactos para apresentar (se acabou de adicionar uma conta, a sincronização dos contactos pode demorar alguns minutos)."\n\n"Para adicionar contactos, prima "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contactos que pode sincronizar com o telemóvel"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opções de visualização"</b></font>" para alterar os contactos visíveis"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contacto"</b></font>" para criar um novo contacto de raiz"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contactos do cartão SD"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Não tem favoritos."\n\n"Para adicionar um contacto à sua lista de favoritos:"\n\n"        "<li>"Toque no separador "<b>"Contactos"</b>" "\n</li>" "\n<li>"Toque no contacto que pretende adicionar aos favoritos"\n</li>" "\n<li>"Toque na estrela junto ao nome do contacto"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Todos os contactos"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Marcado com estrela"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Chamada de retorno"</string>
     <string name="callAgain" msgid="3197312117049874778">"Ligar novamente"</string>
     <string name="returnCall" msgid="8171961914203617813">"Devolver chamada"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> min <xliff:g id="SECONDS">%2$s</xliff:g> seg"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> min <xliff:g id="SECONDS">%s</xliff:g> seg"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Contactos frequentes"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Adicionar contacto"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Adicionar \"<xliff:g id="EMAIL">%s</xliff:g>\" aos contactos?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"fotografia do contacto"</string>
     <string name="description_minus_button" msgid="387136707700230172">"menos"</string>
     <string name="description_plus_button" msgid="515164827856229880">"mais"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Armaz. partilhado indisp."</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Nenhum cartão SD"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Armaz. partilhado não detectado"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Não foi detectado nenhum cartão SD"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Nenhum cartão SD"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Não foi detectado nenhum cartão SD"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"A procurar vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importar do cartão SIM"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Imp. do armaz. partilhado"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importar do cartão SD"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Exp. p/ armaz. partilhado"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Exportar para cartão SD"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importar do cartão SD"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Exportar para cartão SD"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Partilhar contactos visíveis"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importar um ficheiro VCard"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importar vários ficheiros vCard"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importar todos os ficheiros VCard"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"A pesquisar dados do vCard no armazenamento partilhado"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Procurar dados do vCard no cartão SD"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Falha ao procurar armazenamento partilhado"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Falha na análise do cartão SD"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Falha ao procurar armazenamento partilhado (Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Falha na análise do cartão SD (Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Procurar dados do vCard no cartão SD"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Falha na análise do cartão SD"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Falha na análise do cartão SD (Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Erro de E/S"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"A memória não é suficiente (o ficheiro pode ser demasiado grande)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Falha na análise do vCard por motivo inesperado"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Falha na análise do vCard embora o formato pareça válido, uma vez que não é suportado pela implementação actual"</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Não foi encontrado nenhum ficheiro vCard no armazenamento partilhado"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Não foi encontrado nenhum ficheiro vCard no cartão SD"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Não foi encontrado nenhum ficheiro vCard no cartão SD"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"A recolha de meta informações de ficheiro(s) vCard específicado(s) falhou."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"A importação de um ou vários ficheiros falhou (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Erro desconhecido"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Seleccionar ficheiro vCard"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"A ler vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"A ler ficheiro(s) vCard"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Falha na leitura de dados do vCard"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contactos"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> ficheiros"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"A colocar vCard(s) em cache no armazenamento temporário local"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"O importador está a colocar vCard(s) em cache no armazenamento temporário local. A importação efectiva começará brevemente."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"A leitura dos dados vCard falhou"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"A leitura de dados vCard foi cancelada"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"A importação do vCard terminou"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Importador vCard iniciado."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"O importador vCard importará o vCard dentro de algum tempo."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Confirmar exportação"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Tem a certeza de que pretende exportar a lista de contactos para \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\"?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Falha ao exportar dados de contacto"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Falha na exportação de dados de contacto."\n"Motivo da falha: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Não existe um contacto exportável"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Existem demasiados ficheiros vCard no armazenamento partilhado"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Demasiados ficheiros vCard no cartão SD"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Demasiados ficheiros vCard no cartão SD"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Nome de ficheiro demasiado longo (\"<xliff:g id="FILENAME">%s</xliff:g>\")"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Exportador vCard iniciado."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"A exportação do vCard terminou"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Exportar dados do contacto"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Exportar dados do contacto para \"<xliff:g id="FILE_NAME">%s</xliff:g>\""</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Não foi possível iniciar o exportador: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Falha na obtenção de informações da base de dados"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Não existe nenhum contacto exportável. Se tiver realmente contactos no telefone, a sua exportação para fora do telefone por parte de alguns fornecedores de dados pode não ser autorizada."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"O compositor vCard não foi inicializado correctamente"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Não foi possível abrir \"<xliff:g id="FILE_NAME">%1$s</xliff:g>\": <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contactos"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Não foi possível abrir \"<xliff:g id="FILE_NAME">%s</xliff:g>\": <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%s</xliff:g> contactos"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Nomes dos contactos"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Adicionar pausa de 2 seg."</string>
     <string name="add_wait" msgid="3360818652790319634">"Adicionar espera"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Não foram encontradas aplicações para executar esta acção"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Memorizar esta escolha"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Desconhecido"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Sem dados"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Contas"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importar/Exportar"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importar/Exportar contactos"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Todos os outros contactos"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Todos os contactos"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Ao remover \"<xliff:g id="GROUP">%s</xliff:g>\" da sincronização, removerá também quaisquer contactos não agrupados."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Apenas telefone (não sincronizado)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Apenas telefone (não sincronizado)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Ligar para <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Ligar para residência"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Ligar para telemóvel"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Chat utilizando ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Chat utilizando Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Chat"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Endereço"</string>
     <string name="postal_street" msgid="8133143961580058972">"Rua"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Apartado"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Vizinhança"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Região"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Código postal"</string>
     <string name="postal_country" msgid="7638264508416368690">"País"</string>
+    <string name="full_name" msgid="6602579550613988977">"Nome"</string>
     <string name="name_given" msgid="1687286314106019813">"Segundo nome"</string>
     <string name="name_family" msgid="3416695586119999058">"Segundo apelido"</string>
     <string name="name_prefix" msgid="59756378548779822">"Título académico ou profissional"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Fonética do segundo apelido"</string>
     <string name="account_type_format" msgid="718948015590343010">"Contacto de <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
     <string name="from_account_format" msgid="687567483928582084">"de <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"contacto <xliff:g id="SOURCE_0">%1$s</xliff:g> de <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Utilizar esta fotografia"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"Não é possível editar as informações de contacto do <xliff:g id="SOURCE">%1$s</xliff:g> neste dispositivo."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Não há informações adicionais para este contacto"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Seleccionar fotografia da Galeria"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"A lista de contactos está a ser actualizada para reflectir a alteração do idioma."\n\n"Aguarde..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"A lista de contactos está a ser actualizada."\n\n"Aguarde..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Os contactos estão no processo de serem actualizados. "\n\n"O processo de actualização requer aproximadamente <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB de armazenamento de telefone interno."\n\n"Escolha uma das seguintes opções:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Os contactos estão em processo de actualização. "\n\n"O processo de actualização requer aproximadamente <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB de armazenamento interno no telemóvel."\n\n"Escolha uma das seguintes opções:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Desinstalar algumas aplicações"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Repetir actualização"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Resultados de pesquisa para: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"A pesquisar..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"A carregar …"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Mostrar seleccionados"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Mostrar tudo"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Seleccionar tudo"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Desmarcar tudo"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"1 destinatário seleccionado"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> destinatários seleccionados"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Contactos desconhecidos"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Nenhum contacto seleccionado."</string>
+    <string name="add_field" msgid="5257149039253569615">"Adicionar informações"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"através do <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> através do <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"editar"</string>
+    <string name="description_star" msgid="2605854427360036550">"favorito"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Editar contacto"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"não intercalado(s)"</item>
+    <item quantity="other" msgid="425683718017380845">"intercalado a partir de <xliff:g id="COUNT">%0$d</xliff:g> origens"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Eliminar"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Erro ao guardar"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Outro"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
index 953e73e..29e88a5 100644
--- a/res/values-pt/strings.xml
+++ b/res/values-pt/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Detalhes do contato"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Ver contato"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Editar contato"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"Endereço de e-mail:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Tipo: "</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Criar contato"</string>
     <string name="searchHint" msgid="8482945356247760701">"Pesquisar contatos"</string>
     <string name="menu_search" msgid="9147752853603483719">"Pesquisa"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Novo contato"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Fonética"</string>
     <string name="label_notes" msgid="8337354953278341042">"Observações"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Chamada da internet"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Toque"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Nome e sobrenome"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Nome fonético"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Não há contatos visíveis"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"1 contato encontrado"</item>
-    <item quantity="other" msgid="7752927996850263152">"<xliff:g id="COUNT">%d</xliff:g> contatos encontrados"</item>
+    <item quantity="one" msgid="5517063038754171134">"Um encontrado"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> encontrados"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Contato não encontrado"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Não encontrado"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 contato"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> contatos"</item>
+    <item quantity="one" msgid="4826918429708286628">"Um encontrado"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> encontrados"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Contatos"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favoritos"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Contatos do cartão SIM"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Você não tem contatos para exibir. Se você acabou de adicionar uma conta, pode levar alguns minutos para sincronizar os contatos."</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Você não tem contatos para exibir."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Você não tem nenhum contato para exibir."\n\n"Para adicionar contatos, pressione "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contatos que possam ser sincronizados com o telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contato"</b></font>" para criar um novo contato do início"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Você não tem contatos para exibir (se acabou de adicionar uma conta, pode levar alguns minutos para sincronizar os contatos.)"\n\n"Para adicionar contatos, pressione"<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contatos que possam ser sincronizados com o telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opções de exibição"</b></font>" para alterar quais contatos ficam visíveis"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contato"</b></font>" para criar um novo contato do início"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Você não tem nenhum contato para exibir."\n\n"Para adicionar contatos, pressione "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contatos que possam ser sincronizados com o telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contato"</b></font>" para criar um novo contato do início"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Você não tem contatos para exibir (se acabou de adicionar uma conta, pode levar alguns minutos para sincronizar os contatos.)"\n\n"Para adicionar contatos, pressione"<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contatos que possam ser sincronizados com o telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opções de exibição"</b></font>" para alterar quais contatos ficam visíveis"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contato"</b></font>" para criar um novo contato do início"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"Você não tem contatos para exibir."\n\n"Para adicionar contatos, pressione "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contatos que possam ser sincronizados com o telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contato"</b></font>" para criar um novo contato do início"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contatos do chip ou cartão SD"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Você não tem contatos para exibir (caso tenha acabado de adicionar uma conta, pode levar alguns minutos para sincronizar os contatos)."\n\n"Para adicionar contatos, pressione "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contatos que possam ser sincronizados com o telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opções de exibição"</b></font>" para alterar quais contatos ficam visíveis"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contato"</b></font>" para criar um novo contato do início"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contatos do chip ou cartão SD"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"Você não tem contatos para exibir."\n\n"Para adicionar contatos, pressione "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contatos que possam ser sincronizados com o telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contato"</b></font>" para criar um novo contato do início"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contatos do chip ou cartão SD"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Você não tem contatos para exibir (se acabou de adicionar uma conta, pode levar alguns minutos para sincronizar os contatos)."\n\n"Para adicionar contatos, pressione "<font fgcolor="#ffffffff"><b>"Menu"</b></font>" e toque em:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Contas"</b></font>" para adicionar ou configurar uma conta com contatos que possam ser sincronizados com o telefone"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Opções de exibição"</b></font>" para alterar quais contatos ficam visíveis"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Novo contato"</b></font>" para criar um novo contato do início"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importar/Exportar"</b></font>" para importar contatos do chip ou cartão SD"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Você não tem nenhum favorito."\n\n"Para adicionar um contato à sua lista de favoritos:"\n\n"        "<li>"Toque na guia "<b>"Contatos"</b>\n</li>" "\n<li>"Toque no contato que deseja adicionar aos seus favoritos"\n</li>" "\n<li>"Toque na estrela ao lado do nome do contato"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Todos os contatos"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Com estrela"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Retornar chamada"</string>
     <string name="callAgain" msgid="3197312117049874778">"Chamar novamente"</string>
     <string name="returnCall" msgid="8171961914203617813">"Retornar chamada"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> min. <xliff:g id="SECONDS">%2$s</xliff:g> s"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> min. <xliff:g id="SECONDS">%s</xliff:g> s"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Chamados frequentemente"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Adicionar contato"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Adicionar \"<xliff:g id="EMAIL">%s</xliff:g>\" aos contatos?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"foto do contato"</string>
     <string name="description_minus_button" msgid="387136707700230172">"menos"</string>
     <string name="description_plus_button" msgid="515164827856229880">"mais"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Armaz. compart. não disp."</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Nenhum cartão SD"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Nenhum armaz. compart. detect."</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Nenhum cartão SD detectado"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Nenhum cartão SD"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Nenhum cartão SD detectado"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Pesquisando vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importar do cartão SIM"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Importar do armaz. comp."</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importar do cartão SD"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Exportar p/ armaz. comp."</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Exportar para cartão SD"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importar do cartão SD"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Exportar para cartão SD"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Compartilhar contatos visíveis"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importar um arquivo do vCard"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importar vários arquivos do vCard"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importar todos os arquivos do vCard"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Procurando dados do vCard no armazenamento compartilhado"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Procurando dados do vCard no cartão SD"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Falha na verificação do armazenamento compartilhado"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Falha na verificação do cartão SD"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Falha na verificação do armazenamento compartilhado (Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Falha na verificação do cartão SD (Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Procurando dados do vCard no cartão SD"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Falha na verificação do cartão SD"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Falha na verificação do cartão SD (Motivo: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Erro E/S"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Memória insuficiente (o arquivo talvez seja muito grande)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Falha ao analisar o vCard por razão inesperada"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Falha ao analisar o vCard. Embora o formato pareça ser válido, a implementação atual não oferece suporte a ele."</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Nenhum arquivo de vCard encontrado no armazenamento compartilhado"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Nenhum arquivo de vCard encontrado no cartão SD"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Nenhum arquivo de vCard encontrado no cartão SD"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Falha ao coletar metainformações dos arquivos de vCard fornecidos."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Falha na importação de um ou mais arquivos (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Erro desconhecido"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Selecionar arquivo do vCard"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Lendo vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Lendo os arquivos do vCard"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"A leitura dos dados do vCard falhou"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contatos"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> arquivos"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Armazenando vCard(s) em cache no armazenamento temporário local"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"O importador está armazenando vCard(s) em cache no armazenamento temporário local. A importação real começará em breve."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Falha ao ler dados de vCard"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"A leitura dos dados do vCard foi cancelada"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Importação de vCard concluída"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Importador de vCard iniciado."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"O importador de vCard importará o vCard depois de alguns instantes."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Confirmar exportação"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Tem certeza de que deseja exportar a sua lista de contatos para \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\"?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Falha ao exportar dados do contato"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Falha ao exportar dados dos contatos."\n"Motivo da falha: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Não há contatos exportáveis"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Muitos arquivos do vCard no armazenamento compartilhado"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Muitos arquivos do vCard no cartão SD"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Muitos arquivos do vCard no cartão SD"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"O nome de arquivo exigido é muito longo (\"<xliff:g id="FILENAME">%s</xliff:g>\")"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Exportador de vCard iniciado."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Exportação de vCard concluída"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Exportando dados do contato"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Exportando dados do contato para \"<xliff:g id="FILE_NAME">%s</xliff:g>\""</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Não foi possível iniciar o exportador: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Falha ao acessar informações do banco de dados"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Não há contatos exportáveis. Se você realmente tiver contatos no seu telefone, talvez a exportação não seja permitida por algum provedor de dados."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"O vCard não foi iniciado corretamente"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Não foi possível abrir \"<xliff:g id="FILE_NAME">%1$s</xliff:g>\": <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> contatos"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Não foi possível abrir \"<xliff:g id="FILE_NAME">%s</xliff:g>\": <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> de <xliff:g id="TOTAL_NUMBER">%s</xliff:g> contatos"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Nomes dos seus contatos"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Adicionar pausa de 2 segundos"</string>
     <string name="add_wait" msgid="3360818652790319634">"Adicionar espera"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Nenhum aplicativo foi encontrado para executar esta ação."</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Lembrar desta escolha"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Desconhecido"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Nenhum dado"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Contas"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importar/Exportar"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importar/Exportar contatos"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Todos os outros contatos"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Todos os contatos"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"A remoção de \'<xliff:g id="GROUP">%s</xliff:g>\' da sincronização também removerá todos os contatos não agrupados da sincronização."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Somente telefone (não sincronizado)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Somente telefone (não sincronizado)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Chamar <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Chamar residência"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Chamar celular"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Bater papo usando o ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Bater papo usando o Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Bate-papo"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Endereço"</string>
     <string name="postal_street" msgid="8133143961580058972">"Rua"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Caixa postal"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Vizinhança"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Estado"</string>
     <string name="postal_postcode" msgid="572136414136673751">"CEP"</string>
     <string name="postal_country" msgid="7638264508416368690">"País"</string>
+    <string name="full_name" msgid="6602579550613988977">"Nome"</string>
     <string name="name_given" msgid="1687286314106019813">"Nome"</string>
     <string name="name_family" msgid="3416695586119999058">"Sobrenome"</string>
     <string name="name_prefix" msgid="59756378548779822">"Prefixo do nome"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Sobrenome fonético"</string>
     <string name="account_type_format" msgid="718948015590343010">"Contato de <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
     <string name="from_account_format" msgid="687567483928582084">"de <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"contato do <xliff:g id="SOURCE_0">%1$s</xliff:g> de <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Usar esta foto"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"As informações de contato de <xliff:g id="SOURCE">%1$s</xliff:g> não podem ser editadas neste aparelho."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Não há informações adicionais para este contato"</string>
@@ -378,15 +392,57 @@
     <string name="display_options_view_names_as" msgid="18022868169627979">"Visualizar nomes de contato como"</string>
     <string name="display_options_view_given_name_first" msgid="6968288511197363292">"Nome primeiro"</string>
     <string name="display_options_view_family_name_first" msgid="1447288164951453714">"Sobrenome primeiro"</string>
-    <string name="search_bar_hint" msgid="1012756309632856553">"Pesquisar contatos"</string>
+    <string name="search_bar_hint" msgid="1012756309632856553">"Pesquisar contatos "</string>
     <string name="search_for_all_contacts" msgid="6644963335787294131">"Pesquisar em todos os contatos"</string>
     <string name="take_photo" msgid="7496128293167402354">"Tirar foto"</string>
     <string name="pick_photo" msgid="448886509158039462">"Selecionar foto da Galeria"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"A lista de contatos está sendo atualizada para refletir a alteração do idioma."\n\n"Aguarde..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"A lista de contatos está sendo atualizada."\n\n"Aguarde..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Os contatos estão sendo atualizados no momento. "\n\n"O processo de atualização requer aproximadamente <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB de armazenamento interno do telefone."\n\n"Escolha uma das seguintes opções:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Os contatos estão sendo atualizados no momento. "\n\n"O processo de atualização requer aproximadamente <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB de armazenamento interno do telefone."\n\n"Escolha uma das seguintes opções:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Desinstalar alguns aplicativos"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Tentar atualizar novamente"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Resultados da pesquisa para: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Pesquisando..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Carregando…"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Mostrar selecionados"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Mostrar todos"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Selecionar todos"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Desmarcar todos"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"1 destinatário selecionado"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> destinatários selecionados"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Contatos selecionados"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Nenhum contato selecionado."</string>
+    <string name="add_field" msgid="5257149039253569615">"Adicionar informações"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"por meio de <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> via <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"editar"</string>
+    <string name="description_star" msgid="2605854427360036550">"favorito"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Editar contato "</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"não mesclado"</item>
+    <item quantity="other" msgid="425683718017380845">"mesclado a partir de <xliff:g id="COUNT">%0$d</xliff:g> origens"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Excluir"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Erro ao salvar"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Outros"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-rm/strings.xml b/res/values-rm/strings.xml
new file mode 100644
index 0000000..15abeeb
--- /dev/null
+++ b/res/values-rm/strings.xml
@@ -0,0 +1,483 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--  Copyright (C) 2006 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.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- no translation found for sharedUserLabel (7965035505237135241) -->
+    <skip />
+    <string name="contactsList" msgid="8661624236494819731">"Contacts"</string>
+    <string name="launcherDialer" msgid="8636288196618486553">"Telefon"</string>
+    <string name="shortcutContact" msgid="749243779392912958">"Contact"</string>
+    <string name="shortcutDialContact" msgid="746622101599186779">"Cumposiziun directa"</string>
+    <string name="shortcutMessageContact" msgid="2460337253595976198">"Messadi direct"</string>
+    <string name="shortcutActivityTitle" msgid="6642877210643565436">"Tscherner in contact per la scursanida"</string>
+    <string name="callShortcutActivityTitle" msgid="6065749861423648991">"Tscherner il numer per telefonar"</string>
+    <string name="messageShortcutActivityTitle" msgid="3084542316620335911">"Tscherner il numer per il messadi"</string>
+    <string name="starredList" msgid="4817256136413959463">"Cun staila"</string>
+    <string name="frequentList" msgid="7154768136473953056">"Contacts frequents"</string>
+    <string name="strequentList" msgid="5640192862059373511">"Favurits"</string>
+    <string name="viewContactTitle" msgid="7989394521836644384">"Detagls dal contact"</string>
+    <string name="viewContactDesription" msgid="214186610887547860">"Mussar il contact"</string>
+    <string name="editContactDescription" msgid="2947202828256214947">"Modifitgar il contact"</string>
+    <!-- no translation found for edit_email_caption (2401084399676154272) -->
+    <skip />
+    <!-- no translation found for edit_email_type_caption (66331218163770698) -->
+    <skip />
+    <string name="insertContactDescription" msgid="4709878105452681987">"Crear in contact"</string>
+    <string name="searchHint" msgid="8482945356247760701">"Retschertgar ils contacts"</string>
+    <string name="menu_search" msgid="9147752853603483719">"Tschertgar"</string>
+    <string name="menu_newContact" msgid="1209922412763274638">"Nov contact"</string>
+    <string name="menu_viewContact" msgid="2795575601596468581">"Mussar il contact"</string>
+    <string name="menu_callNumber" msgid="5142851348489387516">"Telefonar a(d) <xliff:g id="NAME">%s</xliff:g>"</string>
+    <string name="menu_addStar" msgid="2908478235715404876">"Agiuntar als favurits"</string>
+    <string name="menu_removeStar" msgid="5844227078364227030">"Allontanar dals favurits"</string>
+    <string name="menu_editContact" msgid="3452858480713561396">"Modifitgar il contact"</string>
+    <string name="menu_deleteContact" msgid="1916555454274101750">"Stizzar il contact"</string>
+    <string name="menu_call" msgid="3992595586042260618">"Telefonar al contact"</string>
+    <string name="menu_sendSMS" msgid="5535886767547006515">"Trametter in SMS al contact"</string>
+    <string name="menu_sendEmail" msgid="7293508859242926187">"Trametter in e-mail"</string>
+    <string name="menu_viewAddress" msgid="1814744325763202024">"Adressa sin la charta"</string>
+    <string name="menu_makeDefaultNumber" msgid="4838759253316649534">"Numer da telefon da standard"</string>
+    <string name="menu_makeDefaultEmail" msgid="2599044610375789994">"E-mail predefinì"</string>
+    <string name="menu_splitAggregate" msgid="8368636463748691868">"Divider"</string>
+    <string name="contactsSplitMessage" msgid="5253490235863170269">"Contacts dividids"</string>
+    <string name="splitConfirmation_title" msgid="6716467920283502570">"Divider il contact"</string>
+    <string name="splitConfirmation" msgid="1150797297503944823">"Vulais Vus propi divider quest contact en plirs contacts (in per mintga detagl da contact)?"</string>
+    <string name="menu_joinAggregate" msgid="5027981918265667970">"Unir"</string>
+    <string name="titleJoinContactDataWith" msgid="7684875775798635354">"Unir contacts"</string>
+    <string name="blurbJoinContactDataWith" msgid="995870557595050304">"Tschernì il contact che Vus vulais associar cun <xliff:g id="NAME">%s</xliff:g>."</string>
+    <string name="showAllContactsJoinItem" msgid="2189695051430392383">"Mussar tut ils contacts"</string>
+    <string name="separatorJoinAggregateSuggestions" msgid="2831414448851313345">"Contacts proponids"</string>
+    <string name="separatorJoinAggregateAll" msgid="7939932265026181043">"Tut ils contacts"</string>
+    <string name="contactsJoinedMessage" msgid="7208148163607047389">"Contacts unids"</string>
+    <string name="menu_contactOptions" msgid="1957061455705020617">"Opziuns"</string>
+    <string name="contactOptionsTitle" msgid="8259347644090700915">"Opziuns"</string>
+    <string name="deleteConfirmation_title" msgid="6394309508930335204">"Stizzar"</string>
+    <string name="readOnlyContactWarning" msgid="1390849295342594265">"\"Impussibel da stizzar contacts da contos mo per lectura, ma Vus als pudais zuppentar en la glista da contacts.\""</string>
+    <string name="readOnlyContactDeleteConfirmation" msgid="2137170726670196909">"\"Quest contact cuntegna infurmaziuns da plirs contos. Infurmaziuns da contos mo per lectura vegnan betg stizzadas, mabain zuppentadas en Vossas glistas da contacts.\""</string>
+    <string name="multipleContactDeleteConfirmation" msgid="938900978442960800">"\"Sche Vus stizzais quest contact, vegnan infurmaziuns en plirs contos stizzads.\""</string>
+    <string name="deleteConfirmation" msgid="811706994761610640">"Quest contact vegn stizzà."</string>
+    <string name="menu_done" msgid="796017761764190697">"Finì"</string>
+    <string name="menu_doNotSave" msgid="2174577548513895144">"Annullar"</string>
+    <string name="editContact_title_edit" msgid="7678695190666836093">"Modifitgar il contact"</string>
+    <string name="editContact_title_insert" msgid="9125600232291405757">"Nov contact"</string>
+    <string name="label_phonetic_name" msgid="2288082649573927286">"Fonetic"</string>
+    <string name="label_notes" msgid="8337354953278341042">"Notizias"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
+    <string name="label_ringtone" msgid="8833166825330686244">"Tun da scalin"</string>
+    <string name="ghostData_name" msgid="6490954238641157585">"Prenum e num"</string>
+    <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Num fonetic"</string>
+    <string name="ghostData_company" msgid="5414421120553765775">"Interpresa"</string>
+    <string name="ghostData_title" msgid="7496735200318496110">"Titel"</string>
+    <string name="invalidContactMessage" msgid="5816991830260044593">"Quest contact n\'exista betg."</string>
+    <string name="pickerNewContactHeader" msgid="7750705279843568147">"Crear in nov contact"</string>
+    <string name="selectLabel" msgid="4255424123394910733">"Tscherni ina etichetta"</string>
+    <string name="phoneLabelsGroup" msgid="6468091477851199285">"Telefon"</string>
+    <string name="emailLabelsGroup" msgid="8389931313045344406">"E-mail"</string>
+    <string name="imLabelsGroup" msgid="3898238486262614027">"Chat"</string>
+    <string name="postalLabelsGroup" msgid="1618078212734693682">"Adressa postala"</string>
+  <string-array name="otherLabels">
+    <item msgid="8287841928119937597">"Firma/Organisaziun"</item>
+    <item msgid="7196592230748086755">"Notizia"</item>
+  </string-array>
+    <string name="photoPickerNotFoundText" msgid="431331662154342581">"Nagin maletg disponibel sin il telefon."</string>
+    <string name="attachToContact" msgid="8820530304406066714">"Simbol da contact"</string>
+    <string name="customLabelPickerTitle" msgid="1081475101983255212">"Num da l\'etichetta persunalisada"</string>
+    <string name="menu_displayGroup" msgid="5655505437727616553">"Opziuns da vista"</string>
+    <string name="displayGroups" msgid="2278964020773993336">"Opziuns da vista"</string>
+    <string name="send_to_voicemail_checkbox" msgid="9001686764070676353">"Renviar ils cloms directamain sin la mailbox"</string>
+    <string name="default_ringtone" msgid="9099988849649827972">"Standard"</string>
+    <string name="changePicture" msgid="2943329047610967714">"Midar il simbol"</string>
+    <string name="removePicture" msgid="3041230993155966350">"Allontanar il simbol"</string>
+    <string name="noContacts" msgid="8579310973261953559">"Nagins contacts"</string>
+    <string name="noMatchingContacts" msgid="4266283206853990471">"Betg chattà in contact correspundent."</string>
+    <string name="noContactsWithPhoneNumbers" msgid="1605457050218824269">"Nagin contact dispona d\'in numer da telefon."</string>
+    <string name="showFilterPhones" msgid="4184858075465653970">"Mo contacts cun telefon"</string>
+    <string name="showFilterPhonesDescrip" msgid="6644443248815191067">"Mo mussar contacts cun numer da telefon"</string>
+    <string name="headerContactGroups" msgid="2426134991932503843">"Tscherner ils contacts che duain vegnir mussads"</string>
+  <plurals name="groupDescrip">
+    <item quantity="other" msgid="3507881585720628389">"<xliff:g id="COUNT">%0$d</xliff:g> contacts"</item>
+  </plurals>
+  <plurals name="groupDescripPhones">
+    <item quantity="other" msgid="3816047547470490208">"\"<xliff:g id="COUNT_0">%1$d</xliff:g> contacts, <xliff:g id="COUNTWITHPHONES">%2$d</xliff:g> cun numer da telefon\""</item>
+  </plurals>
+    <string name="savingContact" msgid="4075751076741924939">"Il contact vegn memorisà…"</string>
+    <string name="savingDisplayGroups" msgid="2133152192716475939">"Las opziuns da vista vegnan memorisadas…"</string>
+    <string name="contactSavedToast" msgid="7152589189385441091">"Contact memorisà."</string>
+    <string name="contactSavedErrorToast" msgid="9189098776225004666">"Errur: impussibel da memorisar las modificaziuns dal contact"</string>
+  <plurals name="listTotalPhoneContacts">
+    <item quantity="one" msgid="8721111084815668845">"1 contact cun numer da telefon vegn mussà"</item>
+    <item quantity="other" msgid="6133262880804110289">"<xliff:g id="COUNT">%d</xliff:g> contacts cun numer da telefon vegnan mussads"</item>
+  </plurals>
+    <string name="listTotalPhoneContactsZero" msgid="2756295259674938869">"Nagins contacts visibels cun numer da telefon"</string>
+  <plurals name="listTotalAllContacts">
+    <item quantity="one" msgid="1096068709488455155">"1 contact vegn mussà"</item>
+    <item quantity="other" msgid="2865867557378939630">"<xliff:g id="COUNT">%d</xliff:g> contacts vegnan mussads."</item>
+  </plurals>
+    <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Nagins contacts visibels"</string>
+    <!-- no translation found for listFoundAllContacts:one (5517063038754171134) -->
+    <!-- no translation found for listFoundAllContacts:other (3852668542926965042) -->
+    <!-- no translation found for listFoundAllContactsZero (777952841930508289) -->
+    <skip />
+    <!-- no translation found for searchFoundContacts:one (4826918429708286628) -->
+    <!-- no translation found for searchFoundContacts:other (7988132539476575389) -->
+    <string name="contactsIconLabel" msgid="7666609097606552806">"Contacts"</string>
+    <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favurits"</string>
+    <string name="dialerIconLabel" msgid="6500826552823403796">"Telefon"</string>
+    <string name="recentCallsIconLabel" msgid="1419116422359067949">"Cloms"</string>
+    <string name="liveFolderAll" msgid="4789010460767506206">"Tut ils contacts"</string>
+    <string name="liveFolderFavorites" msgid="3100957542927222282">"Contacts marcads"</string>
+    <string name="liveFolderPhone" msgid="3739376066610926780">"Contacts cun numers da telefon"</string>
+    <string name="menu_sendTextMessage" msgid="6937343460284499306">"Trametter in SMS"</string>
+    <string name="recentCalls_callNumber" msgid="1756372533999226126">"Telefonar a(d) <xliff:g id="NAME">%s</xliff:g>"</string>
+    <string name="recentCalls_editNumberBeforeCall" msgid="7756171675833267857">"Modifitgar il numer avant che telefonar"</string>
+    <string name="recentCalls_addToContact" msgid="1429899535546487008">"Agiuntar als contacts"</string>
+    <string name="recentCalls_removeFromRecentList" msgid="401662244636511330">"Allontanar da la glista da cloms"</string>
+    <string name="recentCalls_deleteAll" msgid="6352364392762163704">"Stizzar la glista da cloms"</string>
+    <string name="recentCalls_empty" msgid="247053222448663107">"La glista da cloms e vida"</string>
+    <string name="clearCallLogConfirmation_title" msgid="718072843006222703">"Stizzar il protocol da cloms"</string>
+    <string name="clearCallLogConfirmation" msgid="7625927669136267636">"Vulais Vus propi stizzar il protocol da cloms?"</string>
+    <string name="imei" msgid="3045126336951684285">"IMEI"</string>
+    <string name="meid" msgid="6210568493746275750">"MEID"</string>
+    <string name="voicemail" msgid="3851469869202611441">"Mailbox"</string>
+    <string name="unknown" msgid="740067747858270469">"Nunenconuschent"</string>
+    <string name="private_num" msgid="6374339738119166953">"Numer privat"</string>
+    <string name="payphone" msgid="4864313342828942922">"Cabina da telefon"</string>
+    <string name="dialerKeyboardHintText" msgid="5401660096579787344">"Utilisai la tastatura per cumponer il numer"</string>
+    <string name="dialerDialpadHintText" msgid="5824490365898349041">"Cumponer il numer"</string>
+    <string name="simContacts_emptyLoading" msgid="6700035985448642408">"Chargiar da la carta SIM…"</string>
+    <string name="simContacts_title" msgid="27341688347689769">"Contacts sin la carta SIM"</string>
+    <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Vus n\'avais nagins contacts per mussar. (I po cuzzar in pèr minutas per sincronisar ils contacts en cas che Vus avais gist agiuntà in conto.)"</string>
+    <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Vus n\'avais nagins contacts per mussar."</string>
+    <!-- no translation found for noContactsHelpText (7633826236417884130) -->
+    <skip />
+    <!-- no translation found for noContactsHelpTextWithSync (3017521127042216243) -->
+    <skip />
+    <!-- no translation found for noContactsNoSimHelpText (467658807711582876) -->
+    <skip />
+    <!-- no translation found for noContactsNoSimHelpTextWithSync (9040060730467973050) -->
+    <skip />
+    <string name="noFavoritesHelpText" msgid="3744655776704833277">"Vus n\'avais nagins favurits."\n\n"Per agiuntar in contact a la glista da favurits:"\n\n" "<li>"Smatgai sin il register "<b>"Contacts"</b>"."\n</li>" "\n<li>"Smatgai sin il contact che duai vegnir agiuntà a Voss favurits."\n</li>" "\n<li>"Smatgai sin la staila dal contact correspundent."\n</li></string>
+    <string name="liveFolder_all_label" msgid="5961411940473276616">"Tut ils contacts"</string>
+    <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Cun staila"</string>
+    <string name="liveFolder_phones_label" msgid="1709786878793436245">"Numers"</string>
+    <string name="dialer_useDtmfDialpad" msgid="1707548397435075040">"Utilisar la tastatura dal telefon"</string>
+    <string name="dialer_returnToInCallScreen" msgid="3719386377550913067">"Enavos al clom actual"</string>
+    <string name="dialer_addAnotherCall" msgid="4205688819890074468">"Agiuntar in clom"</string>
+    <string name="callDetailTitle" msgid="5340227785196217938">"Detagls dal clom"</string>
+    <string name="toast_call_detail_error" msgid="7200975244804730096">"Impussibel da leger ils detagls dal clom dumandà."</string>
+    <string name="type_incoming" msgid="6502076603836088532">"Clom entrant"</string>
+    <string name="type_outgoing" msgid="343108709599392641">"Clom sortint"</string>
+    <string name="type_missed" msgid="2720502601640509542">"Clom manchentà"</string>
+    <string name="actionIncomingCall" msgid="6028930669817038600">"Cloms entrants"</string>
+    <string name="callBack" msgid="5498224409038809224">"Telefonar enavos"</string>
+    <string name="callAgain" msgid="3197312117049874778">"Telefonar anc ina giada"</string>
+    <string name="returnCall" msgid="8171961914203617813">"Telefonar enavos"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> min <xliff:g id="SECONDS">%s</xliff:g> sec"</string>
+    <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Contactà savens"</string>
+    <string name="add_contact_dlg_title" msgid="2896685845822146494">"Agiuntar in contact"</string>
+    <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Agiuntar «<xliff:g id="EMAIL">%s</xliff:g>» als contacts?"</string>
+    <string name="all_tab_label" msgid="4003124364397916826">"Tuts"</string>
+    <string name="description_image_button_one" msgid="1740638037139856139">"in"</string>
+    <string name="description_image_button_two" msgid="5882638439003731308">"dus"</string>
+    <string name="description_image_button_three" msgid="8709731759376015180">"trais"</string>
+    <string name="description_image_button_four" msgid="3530239685642246130">"quatter"</string>
+    <string name="description_image_button_five" msgid="1182465427501188413">"tschintg"</string>
+    <string name="description_image_button_six" msgid="2093656269261415475">"sis"</string>
+    <string name="description_image_button_seven" msgid="2450357020447676481">"set"</string>
+    <string name="description_image_button_eight" msgid="6969435115163287801">"otg"</string>
+    <string name="description_image_button_nine" msgid="7857248695662558323">"nov"</string>
+    <string name="description_image_button_star" msgid="3365919907520767866">"staila"</string>
+    <string name="description_image_button_zero" msgid="4133108949401820710">"nulla"</string>
+    <string name="description_image_button_pound" msgid="3039765597595889230">"glivra"</string>
+    <string name="description_voicemail_button" msgid="3402506823655455591">"Mailbox"</string>
+    <string name="description_dial_button" msgid="1274091017188142646">"cumponer"</string>
+    <string name="description_delete_button" msgid="6263102114033407382">"tasta da return"</string>
+    <string name="description_digits_edittext" msgid="8760207516497016437">"numer da cumponer"</string>
+    <string name="description_contact_photo" msgid="3387458082667894062">"foto dal contact"</string>
+    <string name="description_minus_button" msgid="387136707700230172">"minus"</string>
+    <string name="description_plus_button" msgid="515164827856229880">"plus"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Nagina carta SD"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Betg chattà ina carta SD."</string>
+    <string name="searching_vcard_title" msgid="4970508055399376813">"Tschertgar datas vCard"</string>
+    <string name="import_from_sim" msgid="3859272228033941659">"Importar da la carta SIM"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importar da la carta SD"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Exportar sin la carta SD"</string>
+    <string name="share_visible_contacts" msgid="890150378880783797">"Cundivider ils contacts visibels"</string>
+    <string name="import_one_vcard_string" msgid="9059163467020328433">"Importar ina datoteca vCard"</string>
+    <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importar pliras datotecas vCard"</string>
+    <string name="import_all_vcard_string" msgid="5518136113853448474">"Importar tut las datotecas vCard"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Tschertgar datas vCard sin la carta SD"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Errur cun leger la carta SD"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Errur cun leger la carta SD. Il motiv: «<xliff:g id="FAIL_REASON">%s</xliff:g>»"</string>
+    <string name="fail_reason_io_error" msgid="5922864781066136340">"Errur I/O"</string>
+    <!-- no translation found for fail_reason_low_memory_during_import (7514918659342886381) -->
+    <skip />
+    <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"L\'analisa da las datas vCard n\'è betg reussida per motiv nunenconuschent."</string>
+    <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"\"Durant l\'analisa da las datas vCard è cumparida ina errur. Schebain che la vCard para dad esser d\'in format valid, na la sustegna l\'implementaziun actuala betg.\""</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Chattà nagina datoteca vCard sin la carta SD"</string>
+    <!-- no translation found for fail_reason_failed_to_collect_vcard_meta_info (4154492282316067754) -->
+    <skip />
+    <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Errur cun importar ina u pliras datotecas (%s)."</string>
+    <string name="fail_reason_unknown" msgid="999034019513096768">"Errur nunenconuschenta"</string>
+    <string name="select_vcard_title" msgid="3968948173786172468">"Tscherner ina datoteca vCard"</string>
+    <!-- no translation found for caching_vcard_title (5009556022082659780) -->
+    <skip />
+    <!-- no translation found for caching_vcard_message (2380844718093378900) -->
+    <skip />
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <!-- no translation found for reading_vcard_failed_title (2162610359561887043) -->
+    <skip />
+    <!-- no translation found for reading_vcard_canceled_title (1770608329958463131) -->
+    <skip />
+    <!-- no translation found for importing_vcard_finished_title (3213257229785702182) -->
+    <skip />
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <!-- no translation found for vcard_importer_start_message (5520549352987753320) -->
+    <skip />
+    <!-- no translation found for vcard_importer_will_start_message (2055145402481822160) -->
+    <skip />
+    <!-- no translation found for percentage (34897865327092209) -->
+    <skip />
+    <string name="confirm_export_title" msgid="7648747763127442983">"Confermar l\'export"</string>
+    <string name="confirm_export_message" msgid="3875683519257829750">"Vulais Vus propi exportar la glista da contacts en «<xliff:g id="VCARD_FILENAME">%s</xliff:g>»?"</string>
+    <string name="exporting_contact_failed_title" msgid="585823094820602526">"Errur cun exportar las datas da contact"</string>
+    <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Errur cun exportar las datas da contact. "\n"Il motiv: «<xliff:g id="FAIL_REASON">%s</xliff:g>»"</string>
+    <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Nagin contact exportabel"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"La carta SD cuntegna memia bleras datotecas vCard"</string>
+    <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Il num da datoteca necessari è memia lung («<xliff:g id="FILENAME">%s</xliff:g>»)"</string>
+    <!-- no translation found for vcard_exporter_start_message (6497218576519292369) -->
+    <skip />
+    <!-- no translation found for exporting_vcard_finished_title (1268425436375550862) -->
+    <skip />
+    <string name="exporting_contact_list_title" msgid="9072240631534457415">"Datas da contact vegnan exportadas."</string>
+    <string name="exporting_contact_list_message" msgid="5640326540405486055">"Exportaziun da las datas da contact en «<xliff:g id="FILE_NAME">%s</xliff:g>»"</string>
+    <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Errur cun inizialisar il program d\'export: «<xliff:g id="EXACT_REASON">%s</xliff:g>»"</string>
+    <string name="fail_reason_error_occurred_during_export" msgid="2151165129433831202">"Errur cun exportar: «<xliff:g id="EXACT_REASON">%s</xliff:g>»"</string>
+    <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Impussibel dad obtegnair las infurmaziuns concernent la banca da datas"</string>
+    <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"\"Nagin contact exportabel è avant maun. Sche Vus avais memorisà contacts sin Voss telefonin, ha in purschider da datas eventualmain protegì els cunter l\'export dal telefon.\""</string>
+    <string name="composer_not_initialized" msgid="8041534450748388843">"Il program per crear la vCard n\'è betg inizialisà correctamain."</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Impussibel dad avrir «<xliff:g id="FILE_NAME">%s</xliff:g>»: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> da <xliff:g id="TOTAL_NUMBER">%s</xliff:g> contacts"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
+    <string name="search_settings_description" msgid="2675223022992445813">"Num da Voss contacts"</string>
+    <string name="add_2sec_pause" msgid="9214012315201040129">"Agiuntar ina pausa da 2 secundas"</string>
+    <string name="add_wait" msgid="3360818652790319634">"Agiuntar Spetgar"</string>
+    <string name="call_disambig_title" msgid="1911302597959335178">"Telefonar cun"</string>
+    <string name="sms_disambig_title" msgid="4675399294513152364">"Trametter in SMS sur"</string>
+    <string name="make_primary" msgid="5829291915305113983">"Memorisar questa tscherna"</string>
+    <string name="quickcontact_missing_app" msgid="4600366393134289038">"Betg chattà in\'applicaziun per elavurar questa acziun"</string>
+    <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Memorisar questa tscherna"</string>
+    <string name="quickcontact_missing_name" msgid="5590266114306996632">"Nunenconuschent"</string>
+    <!-- no translation found for quickcontact_no_data (2098000859125253675) -->
+    <skip />
+    <string name="menu_accounts" msgid="8499114602017077970">"Contos"</string>
+    <string name="menu_import_export" msgid="3765725645491577190">"Importar/exportar"</string>
+    <string name="dialog_import_export" msgid="4771877268244096596">"Importar/exportar ils contacts"</string>
+    <string name="menu_share" msgid="943789700636542260">"Cundivider"</string>
+    <string name="share_via" msgid="563121028023030093">"Cundivider in contact sur"</string>
+    <string name="share_error" msgid="4374508848981697170">"Quest contact na po betg vegnir cundividì."</string>
+    <string name="nameLabelsGroup" msgid="2034640839640477827">"Num"</string>
+    <string name="nicknameLabelsGroup" msgid="2891682101053358010">"Alias"</string>
+    <string name="organizationLabelsGroup" msgid="2478611760751832035">"Firma/Organisaziun"</string>
+    <string name="websiteLabelsGroup" msgid="4202998982804009261">"Website"</string>
+    <string name="eventLabelsGroup" msgid="8069912895912714412">"Termin"</string>
+    <string name="type_short_home" msgid="7770424864090605384">"P"</string>
+    <string name="type_short_mobile" msgid="1655473281466676216">"M"</string>
+    <string name="type_short_work" msgid="4925330752504537861">"F"</string>
+    <string name="type_short_pager" msgid="2613818970827594238">"P"</string>
+    <string name="type_short_other" msgid="5669407180177236769">"A"</string>
+    <string name="edit_read_only" msgid="8158629550655830981">"Quest contact è mo per lectura."</string>
+    <string name="edit_secondary_collapse" msgid="5371618426594477103">"Dapli"</string>
+    <string name="dialog_primary_name" msgid="5521591005692614833">"Num principal"</string>
+    <string name="dialog_new_contact_account" msgid="9044704073286262197">"Crear in contact sut il conto"</string>
+    <string name="menu_sync_remove" msgid="3266725887008450161">"Allontanar la gruppa da sincronisaziun"</string>
+    <string name="dialog_sync_add" msgid="8267045393119375803">"Agiuntar ina gruppa da sincronisaziun"</string>
+    <string name="display_more_groups" msgid="2682547080423434170">"Ulteriuras gruppas…"</string>
+    <string name="display_ungrouped" msgid="4602580795576261158">"Tut ils ulteriurs contacts"</string>
+    <string name="display_all_contacts" msgid="6846131371214707956">"Tut ils contacts"</string>
+    <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"\"Sche «<xliff:g id="GROUP">%s</xliff:g>» vegn allontanà da la sincronisaziun, vegnan era tut ils contacts betg gruppads allontanads da la sincronisaziun.\""</string>
+    <string name="account_phone" msgid="4025734638492419713">"Mo telefon (senza sincronisaziun)"</string>
+    <string name="call_custom" msgid="7756571794763171802">"Telefonar a(d) <xliff:g id="CUSTOM">%s</xliff:g>"</string>
+    <string name="call_home" msgid="1990519474420545392">"Telefonar (privat)"</string>
+    <string name="call_mobile" msgid="7502236805487609178">"Clom (telefonin)"</string>
+    <string name="call_work" msgid="5328785911463744028">"Clom (fatschenta)"</string>
+    <string name="call_fax_work" msgid="7467763592359059243">"\"Telefonar (fax, fatschenta)\""</string>
+    <string name="call_fax_home" msgid="8342175628887571876">"Cumponer in fax (privat)"</string>
+    <string name="call_pager" msgid="9003902812293983281">"Telefonar (pager)"</string>
+    <string name="call_other" msgid="8563753966926932052">"Telefonar"</string>
+    <string name="call_callback" msgid="1910165691349426858">"Telefonar al numer da reclom"</string>
+    <string name="call_car" msgid="3280537320306436445">"Telefonar a l\'auto"</string>
+    <string name="call_company_main" msgid="6105120947138711257">"Telefonar ad ina firma (principal)"</string>
+    <string name="call_isdn" msgid="1541590690193403411">"Telefonar ad in numer ISDN"</string>
+    <string name="call_main" msgid="6082900571803441339">"Telefonar sin il numer principal"</string>
+    <string name="call_other_fax" msgid="5745314124619636674">"Telefonar a quest numer da fax"</string>
+    <string name="call_radio" msgid="8296755876398357063">"Telefon (mobil)"</string>
+    <string name="call_telex" msgid="2223170774548648114">"Telefonar ad in numer telex"</string>
+    <string name="call_tty_tdd" msgid="8951266948204379604">"Telefonar TTY/TTD"</string>
+    <string name="call_work_mobile" msgid="8707874281430105394">"Telefonar al numer da telefonin (fatschenta)"</string>
+    <string name="call_work_pager" msgid="3419348514157949008">"Telefonar ad in pager (fatschenta)"</string>
+    <string name="call_assistant" msgid="2141641383068514308">"Telefonar a <xliff:g id="ASSISTANT">%s</xliff:g>"</string>
+    <string name="call_mms" msgid="6274041545876221437">"Clom (MMS)"</string>
+    <string name="sms_custom" msgid="5932736853732191825">"SMS a <xliff:g id="CUSTOM">%s</xliff:g>"</string>
+    <string name="sms_home" msgid="7524332261493162995">"Text (privat)"</string>
+    <string name="sms_mobile" msgid="5200107250451030769">"Trametter in SMS al telefonin"</string>
+    <string name="sms_work" msgid="2269624156655267740">"Trametter in SMS (fatschenta)"</string>
+    <string name="sms_fax_work" msgid="8028189067816907075">"Trametter in SMS al fax (fatschenta)"</string>
+    <string name="sms_fax_home" msgid="9204042076306809634">"SMS al fax (privat)"</string>
+    <string name="sms_pager" msgid="7730404569637015192">"Trametter in SMS ad in pager"</string>
+    <string name="sms_other" msgid="806127844607642331">"Trametter in SMS"</string>
+    <string name="sms_callback" msgid="5004824430094288752">"Trametter in SMS ad in numer da reclom"</string>
+    <string name="sms_car" msgid="7444227058437359641">"Text (auto)"</string>
+    <string name="sms_company_main" msgid="118970873419678087">"Text (numer principal da la firma)"</string>
+    <string name="sms_isdn" msgid="8153785037515047845">"SMS ad in numer ISDN"</string>
+    <string name="sms_main" msgid="8621625784504541679">"SMS al numer principal"</string>
+    <string name="sms_other_fax" msgid="3888842199855843152">"Trametter in SMS ad in fax"</string>
+    <string name="sms_radio" msgid="3329166673433967820">"SMS a mobil"</string>
+    <string name="sms_telex" msgid="9034802430065267848">"SMS a telex"</string>
+    <string name="sms_tty_tdd" msgid="6782284969132531532">"Trametter in SMS ad in numer TTY/TDD"</string>
+    <string name="sms_work_mobile" msgid="2459939960512702560">"SMS al numer da telefonin (fatschenta)"</string>
+    <string name="sms_work_pager" msgid="5566924423316960597">"SMS ad in pager (fatschenta)"</string>
+    <string name="sms_assistant" msgid="2773424339923116234">"Trametter in messadi da text a <xliff:g id="ASSISTANT">%s</xliff:g>"</string>
+    <string name="sms_mms" msgid="4069352461380762677">"Trametter in MMS"</string>
+    <string name="email_home" msgid="8573740658148184279">"E-mail (privat)"</string>
+    <string name="email_mobile" msgid="2042889209787989814">"E-mail (telefonin)"</string>
+    <string name="email_work" msgid="2807430017302722689">"E-mail (fatschenta)"</string>
+    <string name="email_other" msgid="3454004077967657109">"Trametter in e-mail"</string>
+    <string name="email_custom" msgid="7548003991586214105">"E-mail a <xliff:g id="CUSTOM">%s</xliff:g>"</string>
+    <string name="email" msgid="5668400997660065897">"E-mail"</string>
+    <string name="map_home" msgid="1243547733423343982">"Mussar l\'adressa da chasa"</string>
+    <string name="map_work" msgid="1360474076921878088">"Mussar l\'adressa da fatschenta"</string>
+    <string name="map_other" msgid="3817820803587012641">"Mussar l\'adressa"</string>
+    <string name="map_custom" msgid="6184363799976265281">"Mussar adressa <xliff:g id="CUSTOM">%s</xliff:g>"</string>
+    <string name="chat_aim" msgid="2588492205291249142">"Chat sur AIM"</string>
+    <string name="chat_msn" msgid="8041633440091073484">"Chat sur Windows Live"</string>
+    <string name="chat_yahoo" msgid="6629211142719943666">"Chat sur Yahoo"</string>
+    <string name="chat_skype" msgid="1210045020427480566">"Chat sur Skype"</string>
+    <string name="chat_qq" msgid="4294637812847719693">"Chat sur QQ"</string>
+    <string name="chat_gtalk" msgid="981575737258117697">"Chat sur Google Talk"</string>
+    <string name="chat_icq" msgid="8438405386153745775">"Chat sur ICQ"</string>
+    <string name="chat_jabber" msgid="7561444230307829609">"Chat sur Jabber"</string>
+    <string name="chat" msgid="9025361898797412245">"Chat"</string>
+    <!-- no translation found for postal_address (8765560217149624536) -->
+    <skip />
+    <string name="postal_street" msgid="8133143961580058972">"Via"</string>
+    <string name="postal_pobox" msgid="4431938829180269821">"Chascha postala"</string>
+    <string name="postal_neighborhood" msgid="1450783874558956739">"Vischinanza"</string>
+    <string name="postal_city" msgid="6597491300084895548">"Citad"</string>
+    <string name="postal_region" msgid="6045263193478437672">"Chantun"</string>
+    <string name="postal_postcode" msgid="572136414136673751">"Numer postal"</string>
+    <string name="postal_country" msgid="7638264508416368690">"Pajais"</string>
+    <!-- no translation found for full_name (6602579550613988977) -->
+    <skip />
+    <string name="name_given" msgid="1687286314106019813">"Prenum"</string>
+    <string name="name_family" msgid="3416695586119999058">"Num da famiglia"</string>
+    <string name="name_prefix" msgid="59756378548779822">"Prefix dal num"</string>
+    <string name="name_middle" msgid="8467433655992690326">"Segund prenum"</string>
+    <string name="name_suffix" msgid="3855278445375651441">"Suffix dal num"</string>
+    <string name="name_phonetic_given" msgid="6853570431394449191">"Prenum fonetic"</string>
+    <string name="name_phonetic_middle" msgid="8643721493320405200">"Segund prenum fonetic"</string>
+    <string name="name_phonetic_family" msgid="462095502140180305">"Num da famiglia fonetic"</string>
+    <string name="account_type_format" msgid="718948015590343010">"Contact <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="from_account_format" msgid="687567483928582084">"da <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <!-- no translation found for account_type_and_name (2876220035411512934) -->
+    <skip />
+    <string name="use_photo_as_primary" msgid="8807110122951157246">"Utilisar quest foto"</string>
+    <string name="contact_read_only" msgid="1203216914575723978">"Vus na pudais betg modifitgar las infurmaziuns dal contact <xliff:g id="SOURCE">%1$s</xliff:g> sin quest apparat."</string>
+    <string name="no_contact_details" msgid="6754415338321837001">"Naginas infurmaziuns supplementaras per quest contact"</string>
+    <string name="display_options_sort_list_by" msgid="6080091755852211076">"Zavrar la glista tenor"</string>
+    <string name="display_options_sort_by_given_name" msgid="184916793466387067">"Prenum"</string>
+    <string name="display_options_sort_by_family_name" msgid="7857986975275712622">"Num da famiglia"</string>
+    <string name="display_options_view_names_as" msgid="18022868169627979">"Mussar ils nums da contacts sco"</string>
+    <string name="display_options_view_given_name_first" msgid="6968288511197363292">"L\'emprim il prenum"</string>
+    <string name="display_options_view_family_name_first" msgid="1447288164951453714">"L\'emprim il num da famiglia"</string>
+    <string name="search_bar_hint" msgid="1012756309632856553">"Retschertgar ils contacts"</string>
+    <string name="search_for_all_contacts" msgid="6644963335787294131">"Tschertgar en tut ils contacts"</string>
+    <string name="take_photo" msgid="7496128293167402354">"Far ina foto"</string>
+    <string name="pick_photo" msgid="448886509158039462">"Tscherner ina foto ord il catalog"</string>
+    <string name="locale_change_in_progress" msgid="1124266507671178413">"La glista da contacts vegn adattada a la midada da lingua."\n\n"Spetgai per plaschair…"</string>
+    <string name="upgrade_in_progress" msgid="7530893673211750223">"La glista da contacts vegn actualisada. "\n\n"Spetgai per plaschair…"</string>
+    <!-- no translation found for upgrade_out_of_memory (6713914687111678777) -->
+    <skip />
+    <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Deinstallar in pèr applicaziuns"</string>
+    <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Empruvar anc ina giada d\'actualisar"</string>
+    <string name="search_results_for" msgid="8705490885073188513">"Resultats da tschertga da: <xliff:g id="QUERY">%s</xliff:g>"</string>
+    <string name="search_results_searching" msgid="7755623475227227314">"Tschertgar…"</string>
+    <!-- no translation found for adding_recipients (5123647646892106631) -->
+    <skip />
+    <!-- no translation found for menu_display_selected (6470001164297969034) -->
+    <skip />
+    <!-- no translation found for menu_display_all (8887488642609786198) -->
+    <skip />
+    <!-- no translation found for menu_select_all (621719255150713545) -->
+    <skip />
+    <!-- no translation found for menu_select_none (7093222469852132345) -->
+    <skip />
+    <!-- no translation found for multiple_picker_title:one (4761009734586319101) -->
+    <!-- no translation found for multiple_picker_title:other (4608837420986126229) -->
+    <!-- no translation found for unknown_contacts_separator (2490675836664397214) -->
+    <skip />
+    <!-- no translation found for no_contacts_selected (5877803471037324613) -->
+    <skip />
+    <!-- no translation found for add_field (5257149039253569615) -->
+    <skip />
+    <!-- no translation found for contact_status_update_attribution (752179367353018597) -->
+    <skip />
+    <!-- no translation found for contact_status_update_attribution_with_date (7358045508107825068) -->
+    <skip />
+    <!-- no translation found for description_edit (1601490950771217014) -->
+    <skip />
+    <!-- no translation found for description_star (2605854427360036550) -->
+    <skip />
+    <!-- no translation found for edit_contact (7529281274005689512) -->
+    <skip />
+    <!-- no translation found for merge_info:one (148365587896371969) -->
+    <!-- no translation found for merge_info:other (425683718017380845) -->
+    <!-- no translation found for edit_delete_rawcontact (5054644778227879148) -->
+    <skip />
+    <!-- no translation found for edit_error_saving (2153949392245240166) -->
+    <skip />
+    <!-- no translation found for edit_structured_editor_button (3830078388142808106) -->
+    <skip />
+    <!-- no translation found for local_invisible_directory (6046691709127661065) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <!-- no translation found for visualScrollerAlphabet (4697722110414354767) -->
+    <skip />
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
+</resources>
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index d6a2cab..131033d 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Сведения о контакте"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Просмотреть контакт"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Изменить контакт"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"Адрес электронной почты:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Тип:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Создать контакт"</string>
     <string name="searchHint" msgid="8482945356247760701">"Поиск контактов"</string>
     <string name="menu_search" msgid="9147752853603483719">"Поиск"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Новый контакт"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Произношение"</string>
     <string name="label_notes" msgid="8337354953278341042">"Примечания"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Интернет-вызов"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Мелодия"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Имя и фамилия"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Произношение имени"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Видимые контакты отсутствуют."</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"Найден 1 контакт"</item>
-    <item quantity="other" msgid="7752927996850263152">"Найдено контактов: <xliff:g id="COUNT">%d</xliff:g>"</item>
+    <item quantity="one" msgid="5517063038754171134">"Найдено: 1"</item>
+    <item quantity="other" msgid="3852668542926965042">"Найдено: <xliff:g id="COUNT">%d</xliff:g>"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Контакт не найден."</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Не найдено"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 контакт"</item>
-    <item quantity="other" msgid="5660384247071761844">"Контактов: <xliff:g id="COUNT">%d</xliff:g>"</item>
+    <item quantity="one" msgid="4826918429708286628">"Найдено: 1"</item>
+    <item quantity="other" msgid="7988132539476575389">"Найдено: <xliff:g id="COUNT">%d</xliff:g>"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Контакты"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Избранное"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Контакты на SIM-карте"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Отсутствуют контакты для отображения. (Если аккаунт был только что добавлен, потребуется несколько минут для синхронизации контактов.)"</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Отсутствуют контакты для отображения."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"У вас нет контактов."\n\n"Чтобы добавить контакты, нажмите "<font fgcolor="#ffffffff"><b>"Меню"</b></font>" и выберите:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Аккаунты"</b></font>", чтобы добавить или настроить аккаунт с контактами, которые можно будет синхронизировать с телефоном;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Новый контакт"</b></font>", чтобы создать контакт \"с нуля\";"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Импорт/Экспорт."</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"У вас нет контактов. (Если вы только что добавили аккаунт, синхронизация контактов может занять несколько минут.)"\n\n"Чтобы добавить контакты, нажмите "<font fgcolor="#ffffffff"><b>"Меню"</b></font>" и выберите:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Аккаунты"</b></font>", чтобы добавить или настроить аккаунт с контактами, которые можно будет синхронизировать с телефоном;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Варианты отображения"</b></font>", чтобы выбрать, какие контакты будут видны; "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Новый контакт"</b></font>", чтобы создать контакт \"с нуля\";"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Импорт/Экспорт."</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"У вас нет контактов."\n\n"Чтобы добавить контакты, нажмите "<font fgcolor="#ffffffff"><b>"Меню"</b></font>" и выберите:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Аккаунты"</b></font>", чтобы добавить или настроить аккаунт с контактами, которые можно будет синхронизировать с телефоном;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Новый контакт"</b></font>", чтобы создать контакт \"с нуля\";"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Импорт/Экспорт."</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"У вас нет контактов. (Если вы только что добавили аккаунт, синхронизация контактов может занять несколько минут.)"\n\n"Чтобы добавить контакты, нажмите "<font fgcolor="#ffffffff"><b>"Меню"</b></font>" и выберите:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Аккаунты"</b></font>", чтобы добавить или настроить аккаунт с контактами, которые можно будет синхронизировать с телефоном;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Варианты отображения"</b></font>", чтобы выбрать, какие контакты будут видны; "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Новый контакт"</b></font>", чтобы создать контакт \"с нуля\";"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Импорт/Экспорт."</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"У вас нет контактов."\n\n"Чтобы добавить контакты, нажмите "<font fgcolor="#ffffffff"><b>"Меню"</b></font>" и выберите:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Аккаунты,"</b></font>" чтобы добавить или настроить аккаунт с контактами, которые можно будет синхронизировать с телефоном;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Новый контакт,"</b></font>" чтобы создать новый контакт;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Импорт/Экспорт,"</b></font>" чтобы импортировать контакты с SIM-карты или SD-карты."\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"У вас нет контактов (если вы добавили аккаунт только что, подожите несколько минут, пока идет их синхронизация с телефоном). "\n\n"Чтобы добавить контакты, нажмите "<font fgcolor="#ffffffff"><b>"Меню"</b></font>" и выберите:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Аккаунты"</b></font>", чтобы добавить или настроить аккаунт с контактами, которые можно будет синхронизировать с телефоном;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Варианты отображения"</b></font>", чтобы выбрать, какие контакты будут видны; "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Новый контакт"</b></font>", чтобы создать новый контакт;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Импорт/Экспорт"</b></font>", чтобы импортировать контакты с SIM-карты или SD-карты."\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"У вас нет контактов."\n\n"Чтобы добавить контакты, нажмите "<font fgcolor="#ffffffff"><b>"Меню"</b></font>" и выберите:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Аккаунты"</b></font>", чтобы добавить или настроить аккаунт с контактами, которые можно будет синхронизировать с телефоном;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Новый контакт"</b></font>", чтобы создать новый контакт;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Импорт/Экспорт"</b></font>", чтобы импортировать контакты с SD-карты."\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"У вас нет контактов (если вы добавили аккаунт только что, подожите несколько минут, пока идет их синхронизация с телефоном). "\n\n"Чтобы добавить контакты, нажмите "<font fgcolor="#ffffffff"><b>"Меню"</b></font>" и выберите:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Аккаунты"</b></font>", чтобы добавить или настроить аккаунт с контактами, которые можно будет синхронизировать с телефоном;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Варианты отображения"</b></font>", чтобы выбрать, какие контакты будут видны; "\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Новый контакт"</b></font>", чтобы создать новый контакт;"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Импорт/Экспорт"</b></font>", чтобы импортировать контакты с SD-карты."\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"У вас нет избранных контактов."\n\n"Чтобы сделать контакт избранным,"\n\n"        "<li>"нажмите вкладку "<b>"Контакты"</b>";"\n</li>" "\n<li>"нажмите контакт, который нужно сделать избранным;"\n</li>" "\n<li>"нажмите звездочку возле имени контакта."\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Все контакты"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Помеченные"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Перезвонить"</string>
     <string name="callAgain" msgid="3197312117049874778">"Позвонить снова"</string>
     <string name="returnCall" msgid="8171961914203617813">"Перезвонить"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g>:<xliff:g id="SECONDS">%2$s</xliff:g>"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g>:<xliff:g id="SECONDS">%s</xliff:g>"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Часто набираемые"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Добавить контакт"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Добавить в контакты <xliff:g id="EMAIL">%s</xliff:g>?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"фотография контакта"</string>
     <string name="description_minus_button" msgid="387136707700230172">"минус"</string>
     <string name="description_plus_button" msgid="515164827856229880">"плюс"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Накопитель недоступен"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Нет SD-карты"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Общий накопитель не найден"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"SD-карта не обнаружена"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Нет SD-карты"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"SD-карта не обнаружена"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Поиск vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Импортировать с SIM-карты"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Импорт с общ. накопителя"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Импортировать с SD-карты"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Экспорт в общ. накопитель"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Экспортировать на SD-карту"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Импортировать с SD-карты"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Экспортировать на SD-карту"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Передать видимые контакты"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Импорт одного файла VCard"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Импорт нескольких файлов vCard"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Импорт всех файлов VCard"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Поиск данных vCard на общем накопителе"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Поиск данных vCard на SD-карте"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Не удалось просканировать общий накопитель"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Не удалось сканировать SD-карту."</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Не удалось просканировать общий накопитель (<xliff:g id="FAIL_REASON">%s</xliff:g>)"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Не удалось просканировать SD-карту (причина: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Поиск данных vCard на SD-карте"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Не удалось сканировать SD-карту."</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Не удалось просканировать SD-карту (причина: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"Ошибка ввода-вывода"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Недостаточно памяти (возможно, файл слишком велик)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Не удалось обработать vCard по неизвестной причине."</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Не удалось обработать vCard. Файл правильного формата, но не поддерживается в текущей реализации."</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"На общем накопителе отсутствуют файлы vCard"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"На SD-карте не найдены файлы VCard"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"На SD-карте не найдены файлы VCard"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Не удалось собрать метаинформацию файлов VCard."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"Не удалось импортировать один или несколько файлов (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Неизвестная ошибка"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Выберите файл vCard"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Чтение vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Чтение файлов VCard"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Не удается считать данные vCard"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"Контакт <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> из <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"Файл <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> из <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Кэширование файлов vCard в локальное временное хранилище"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"Импортер кэширует файлы vCard в локальное временное хранилище. Фактический импорт начнется в ближайшее время."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Не удалось прочитать данные из файла vCard"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Чтение данных vCard отменено"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"Импорт файлов vCard завершен"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"Импорт файлов vCard запущен."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"Импортер vCard начнет передачу файлов в ближайшее время."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Подтверждение·экспорта"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Вы действительно хотите экспортировать контакты в файл <xliff:g id="VCARD_FILENAME">%s</xliff:g>?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Не удалось экспортировать данные контакта."</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Не удалось экспортировать данные контакта."\n"Причина: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Нет контактов, которые можно экспортировать."</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Слишком много файлов vCard на общем накопителе"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"Слишком много файлов VCard на SD-карте."</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"Слишком много файлов VCard на SD-карте."</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Название файла слишком длинное (<xliff:g id="FILENAME">%s</xliff:g>)."</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"Экспорт файлов vCard запущен."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"Экспорт файлов vCard завершен"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Экспорт данных контакта"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Экспорт данных контакта в \"<xliff:g id="FILE_NAME">%s</xliff:g>\""</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Не удается запустить функцию экспорта: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Не удалось получить информацию из базы данных."</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Нет контактов для экспорта. Если в вашем телефоне имеются контакты, возможно они защищены от экспорта оператором услуг."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"Редактор vCard запущен некорректно"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Не удается открыть \"<xliff:g id="FILE_NAME">%1$s</xliff:g>\": <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"Контакт <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> из <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g>"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Не удается открыть \"<xliff:g id="FILE_NAME">%s</xliff:g>\": <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"Контакт <xliff:g id="CURRENT_NUMBER">%s</xliff:g> из <xliff:g id="TOTAL_NUMBER">%s</xliff:g>"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Имена контактов"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Добавить двухсекундную паузу"</string>
     <string name="add_wait" msgid="3360818652790319634">"Добавить паузу"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Отсутствует приложение для обработки этого действия"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Запомнить выбранное"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Неизвестно"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Нет данных"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Аккаунты"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Импорт/Экспорт"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Импорт и экспорт контактов"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Остальные контакты"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Все контакты"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Удаление группы \"<xliff:g id="GROUP">%s</xliff:g>\" из синхронизации приведет к удалению любых несгруппированных контактов из синхронизации."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Только телефон (несинхронизирован)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Только телефон (несинхронизирован)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Позвонить (<xliff:g id="CUSTOM">%s</xliff:g>)"</string>
     <string name="call_home" msgid="1990519474420545392">"Домашний тел."</string>
     <string name="call_mobile" msgid="7502236805487609178">"Мобильный тел."</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Чат через ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Чат через Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Чат"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Адрес"</string>
     <string name="postal_street" msgid="8133143961580058972">"Улица"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Почтовый ящик"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Окружение"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Регион"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Почтовый индекс"</string>
     <string name="postal_country" msgid="7638264508416368690">"Страна"</string>
+    <string name="full_name" msgid="6602579550613988977">"Имя"</string>
     <string name="name_given" msgid="1687286314106019813">"Имя"</string>
     <string name="name_family" msgid="3416695586119999058">"Фамилия"</string>
     <string name="name_prefix" msgid="59756378548779822">"Форма обращения"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Фамилия (транскрипция)"</string>
     <string name="account_type_format" msgid="718948015590343010">"Контакт <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
     <string name="from_account_format" msgid="687567483928582084">"из <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"Контакт <xliff:g id="SOURCE_0">%1$s</xliff:g> из источника <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Использовать эту фотографию"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"Невозможно изменить контактную информацию <xliff:g id="SOURCE">%1$s</xliff:g> на этом устройстве."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Отсутствует дополнительная информация об этом контакте."</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Выбрать фото из галереи"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"Выполняется обновление списка контактов, чтобы изменение языка вступило в силу."\n\n"Подождите..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Обновляется список контактов."\n\n"Подождите..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Контакты обновляются. "\n\n" Для обновления требуется около <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> МБ внутренней памяти телефона."\n\n"Выберите один из следующих вариантов:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Контакты обновляются. "\n\n" Для обновления требуется около <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> МБ внутренней памяти телефона."\n\n"Выберите один из следующих вариантов:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Удалить некоторые приложения"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Повторить попытку обновления"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Результаты поиска для: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Поиск..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Загрузка…"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Показать выбранные"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Показать все"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Выбрать все"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Снять все выделения"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"Выбран 1 получатель"</item>
+    <item quantity="other" msgid="4608837420986126229">"Выбрано получателей: <xliff:g id="COUNT">%d</xliff:g>"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Неизвестные контакты"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Контакты не выбраны."</string>
+    <string name="add_field" msgid="5257149039253569615">"Добавить информацию"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"с помощью <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> с помощью <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"изменить"</string>
+    <string name="description_star" msgid="2605854427360036550">"избранное"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Изменить контакт"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"не объединен"</item>
+    <item quantity="other" msgid="425683718017380845">"объединено из нескольких источников (<xliff:g id="COUNT">%0$d</xliff:g>)"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Удалить"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Ошибка при сохранении"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Другое"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"А;Б;В;Г;Д;Е;Ё;Ж;З;И;Й;К;Л;М;Н;О;П;Р;С;Т;У;Ф;Х;Ц;Ч;Ш;Щ;Э;Ю;Я"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml
index 56ed993..e9e45e0 100644
--- a/res/values-sv/strings.xml
+++ b/res/values-sv/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Kontaktuppgifter"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Visa kontakt"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Redigera kontakt"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"E-postadress:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Typ:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Skapa kontakt"</string>
     <string name="searchHint" msgid="8482945356247760701">"Sök efter kontakter"</string>
     <string name="menu_search" msgid="9147752853603483719">"Sök"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Ny kontakt"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Fonetiskt"</string>
     <string name="label_notes" msgid="8337354953278341042">"Anteckningar"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"Internetsamtal"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Ringsignal"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"För- och efternamn"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Fonetiskt namn"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Det finns inga synliga kontakter"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"En kontakt hittades"</item>
-    <item quantity="other" msgid="7752927996850263152">"<xliff:g id="COUNT">%d</xliff:g> kontakter hittades"</item>
+    <item quantity="one" msgid="5517063038754171134">"1 hittades"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> hittades"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Kontakten hittades inte"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Hittades inte"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 kontakt"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> kontakter"</item>
+    <item quantity="one" msgid="4826918429708286628">"1 hittades"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> hittades"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Kontakter"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Favoriter"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"Kontakter från SIM-kort"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Du har inga kontakter att visa. (Om du nyss lade till ett konto kan det ta några minuter innan kontakterna synkroniserats.)"</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Du har inga kontakter att visa."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Det finns inga kontakter att visa."\n\n"Om du vill lägga till kontakter trycker du på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" och sedan på:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konton"</b></font>" om du vill lägga till eller konfigurera ett konto med kontakter som kan synkroniseras till telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" om du vill skapa en ny kontakt från grunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importera/exportera"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Det finns inga kontakter att visa (om du nyss har lagt till ett konto kan det ta några minuter att synkronisera kontakter)."\n\n"Om du vill lägga till kontakter trycker du på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" och sedan på:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konton"</b></font>" om du vill lägga till eller konfigurera ett konto med kontakter som kan synkroniseras till telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsalternativ"</b></font>" om du vill ändra vilka kontakter som är synliga"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" om du vill skapa en ny kontakt från grunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importera/exportera"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Det finns inga kontakter att visa."\n\n"Om du vill lägga till kontakter trycker du på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" och sedan på:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konton"</b></font>" om du vill lägga till eller konfigurera ett konto med kontakter som kan synkroniseras till telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" om du vill skapa en ny kontakt från grunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importera/exportera"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Det finns inga kontakter att visa (om du nyss har lagt till ett konto kan det ta några minuter att synkronisera kontakter)."\n\n"Om du vill lägga till kontakter trycker du på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" och sedan på:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konton"</b></font>" om du vill lägga till eller konfigurera ett konto med kontakter som kan synkroniseras till telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsalternativ"</b></font>" om du vill ändra vilka kontakter som är synliga"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" om du vill skapa en ny kontakt från grunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importera/exportera"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"Det finns inga kontakter att visa."\n\n"Om du vill lägga till kontakter trycker du på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" och sedan på:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konton"</b></font>" om du vill lägga till eller konfigurera ett konto med kontakter som kan synkroniseras till telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" om du vill skapa en ny kontakt från grunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importera/exportera"</b></font>" om du vill importera kontakter från SIM- eller SD-kortet"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Det finns inga kontakter att visa (om du nyss har lagt till ett konto kan det ta några minuter att synkronisera kontakter)."\n\n"Om du vill lägga till kontakter trycker du på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" och sedan på:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konton"</b></font>" om du vill lägga till eller konfigurera ett konto med kontakter som kan synkroniseras till telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsalternativ"</b></font>" om du vill ändra vilka kontakter som är synliga"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" om du vill skapa en ny kontakt från grunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importera/exportera"</b></font>" om du vill importera kontakter från SIM-kortet eller SD-kortet"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"Det finns inga kontakter att visa."\n\n"Om du vill lägga till kontakter trycker du på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" och sedan på:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konton"</b></font>" om du vill lägga till eller konfigurera ett konto med kontakter som kan synkroniseras till telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" om du vill skapa en ny kontakt från grunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importera/exportera"</b></font>" om du vill importera kontakter från SD-kortet"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Det finns inga kontakter att visa (om du nyss har lagt till ett konto kan det ta några minuter att synkronisera kontakter)."\n\n"Om du vill lägga till kontakter trycker du på "<font fgcolor="#ffffffff"><b>"Meny"</b></font>" och sedan på:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Konton"</b></font>" om du vill lägga till eller konfigurera ett konto med kontakter som kan synkroniseras till telefonen"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Visningsalternativ"</b></font>" om du vill ändra vilka kontakter som är synliga"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Ny kontakt"</b></font>" om du vill skapa en ny kontakt från grunden"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Importera/exportera"</b></font>" om du vill importera kontakter från SD-kortet"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Du har inte några favoriter."\n\n"Så här lägger du till kontakter i favoritlistan:"\n\n"        "<li>"Tryck på fliken "<b>"Kontakter"</b>\n</li>" "\n<li>"Tryck på den kontakt du vill lägga till i favoriterna"\n</li>" "\n<li>"Tryck på stjärnan bredvid kontaktens namn"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Alla kontakter"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Stjärnmärkt"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Ring upp"</string>
     <string name="callAgain" msgid="3197312117049874778">"Ring igen"</string>
     <string name="returnCall" msgid="8171961914203617813">"Ring upp"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> minuter <xliff:g id="SECONDS">%2$s</xliff:g> sekunder"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> minuter <xliff:g id="SECONDS">%s</xliff:g> sekunder"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Ofta kontaktade"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Lägg till kontakt"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"Vill du lägga till <xliff:g id="EMAIL">%s</xliff:g> i Kontakter?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"kontaktbild"</string>
     <string name="description_minus_button" msgid="387136707700230172">"minus"</string>
     <string name="description_plus_button" msgid="515164827856229880">"plus"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Ingen delad lagringsenhet"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"Inget SD-kort"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Ingen delad lagringsenhet"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Inget SD-kort hittades"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"Inget SD-kort"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Inget SD-kort hittades"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"Söker efter vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"Importera från SIM-kort"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Import från delad enhet"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"Importera från SD-kort"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Export till delad enhet"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"Exportera till SD-kort"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"Importera från SD-kort"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"Exportera till SD-kort"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Dela synliga kontakter"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Importera en vCard-fil"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Importera flera vCard-filer"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Importera alla vCard-filer"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Söker efter vCard-data på den delade lagringsenheten"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"Söker efter vCard-data på SD-kort"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Det gick inte att skanna den delade lagringsenheten"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"Det gick inte att läsa SD-kort"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Det gick inte att skanna den delade lagringsenheten (orsak: <xliff:g id="FAIL_REASON">%s</xliff:g>)"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"Det gick inte att skanna SD-kortet (orsak: <xliff:g id="FAIL_REASON">%s</xliff:g>)"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"Söker efter vCard-data på SD-kort"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"Det gick inte att läsa SD-kort"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"Det gick inte att skanna SD-kortet (orsak: <xliff:g id="FAIL_REASON">%s</xliff:g>)"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"I/O-fel"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Det finns för lite minne (filen kan vara för stor)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Det gick inte att analysera vCard av okänd anledning"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Det gick inte att analysera vCard trots att formatet verkar vara giltigt. Den aktuella implementeringen stöder inte det."</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Det finns ingen vCard-fil på den delade lagringsenheten"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"Ingen vCard-fil hittades på SD-kortet"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"Ingen vCard-fil hittades på SD-kortet"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Det går inte att samla in metainformation för den eller de givna vCard-filerna."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"En eller flera filer kunde inte importeras: (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Okänt fel"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"Välj vCard-fil"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"Läser vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"Läser vCard-filer"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"Det gick inte att läsa vCard-data"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> av <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> kontakter"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> av <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> filer"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"Cachelagrar vCard i lokalt tillfälligt utrymme"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"Importfunktionen cachelagrar vCard-fil(er) i lokalt tillfälligt utrymme. Den faktiska importen börjar snart."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"Det går inte att läsa vCard-data"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"Läsning av vCard-data avbröts"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"vCard-importen har slutförts"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"vCard-import har startat."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"Importfunktionen för vCard importerar vCard-filen efter en stund."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Bekräfta export"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Vill du exportera kontaktlistan till \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\"?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Det gick inte att exportera kontaktdata"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Det gick inte att exportera kontaktdata."\n"Orsak: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Det finns ingen kontakt som kan exporteras"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"För många vCard-filer på den delade lagringsenheten"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"För många vCard-filer på SD-kortet"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"För många vCard-filer på SD-kortet"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Det obligatoriska filnamnet är för långt (\"<xliff:g id="FILENAME">%s</xliff:g>\")"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"vCard-export har startat."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"vCard-exporten har slutförts"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Exporterar kontaktuppgifter"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Exporterar kontaktuppgifter till: <xliff:g id="FILE_NAME">%s</xliff:g>"</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Det gick inte att starta exportverktyget: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Det gick inte att hämta databasinformation"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Det finns ingen kontakt som kan exporteras. Om du vet att du har kontakter i din telefon kan problemet vara att en leverantör förhindrar att kontakterna exporteras från telefonen."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"vCard-kompositören är inte korrekt initierad"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Det gick inte att öppna <xliff:g id="FILE_NAME">%1$s</xliff:g>: <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> av <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> kontakter"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"Det gick inte att öppna <xliff:g id="FILE_NAME">%s</xliff:g>: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> av <xliff:g id="TOTAL_NUMBER">%s</xliff:g> kontakter"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Dina kontakters namn"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"Lägg till en paus på 2 sek."</string>
     <string name="add_wait" msgid="3360818652790319634">"Lägg till väntetid"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Inget program som kan hantera åtgärden hittades"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Kom ihåg det här valet"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Okänd"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Inga data"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Konton"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"Importera/exportera"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Importera/exportera kontakter"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Alla andra kontakter"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Alla kontakter"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"Om du tar bort \"<xliff:g id="GROUP">%s</xliff:g>\" från synkroniseringen tas även alla kontakter som inte tillhör grupper bort från synkroniseringen."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Bara telefon (osynkad)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Bara telefon (osynkad)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Ring <xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"Ring hem"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Ring mobilen"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"Chatta med ICQ"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Chatta med Jabber"</string>
     <string name="chat" msgid="9025361898797412245">"Chatt"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Adress"</string>
     <string name="postal_street" msgid="8133143961580058972">"Gata"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Postbox"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Område"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Delstat"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Postnummer"</string>
     <string name="postal_country" msgid="7638264508416368690">"Land"</string>
+    <string name="full_name" msgid="6602579550613988977">"Namn"</string>
     <string name="name_given" msgid="1687286314106019813">"Förnamn"</string>
     <string name="name_family" msgid="3416695586119999058">"Efternamn"</string>
     <string name="name_prefix" msgid="59756378548779822">"Namnprefix"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Fonetiskt efternamn"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g>-kontakt"</string>
     <string name="from_account_format" msgid="687567483928582084">"från <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"<xliff:g id="SOURCE_0">%1$s</xliff:g> kontakt från <xliff:g id="SOURCE_1">%2$s</xliff:g>"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Använd det här fotot"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"Kontaktinformation för <xliff:g id="SOURCE">%1$s</xliff:g> kan inte redigeras i den här enheten."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Det finns ingen mer information för kontakten"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Välj ett foto från galleriet"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"Kontaktlistan uppdateras så att språkändringen visas."\n\n"Vänta..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Kontaktlistan uppdateras."\n\n"Vänta..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Kontakter håller på att uppgraderas. "\n\n"Uppgraderingen kräver ungefär <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g>MB av telefonens internminne."\n\n"Välj något av följande alternativ:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Kontakter håller på att uppgraderas. "\n\n"Uppgraderingen kräver ungefär <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g>MB av telefonens internminne."\n\n"Välj något av följande alternativ:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Avinstallera några program"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Försök uppgradera igen"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Sökresultat för: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Söker..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Läser in …"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Visa markerade"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Visa alla"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Markera alla"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Avmarkera alla"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"1 mottagare har markerats"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> mottagare har markerats"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Okända kontakter"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Inga kontakter har markerats."</string>
+    <string name="add_field" msgid="5257149039253569615">"Lägg till information"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"via <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> via <xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"redigera"</string>
+    <string name="description_star" msgid="2605854427360036550">"favorit"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Redigera kontakt"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"inte kombinerade"</item>
+    <item quantity="other" msgid="425683718017380845">"kombinerade från <xliff:g id="COUNT">%0$d</xliff:g> källor"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Ta bort"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Det gick inte att spara"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Övrigt"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;Å;Ä;Ö"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
index e754c3f..9e94660 100644
--- a/res/values-tr/strings.xml
+++ b/res/values-tr/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"Kişi ayrıntıları"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"Kişiyi görüntüle"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"Kişiyi düzenle"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"E-posta adresi:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"Tür: "</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"Kişi oluştur"</string>
     <string name="searchHint" msgid="8482945356247760701">"Kişileri ara"</string>
     <string name="menu_search" msgid="9147752853603483719">"Ara"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"Yeni kişi"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"Fonetik"</string>
     <string name="label_notes" msgid="8337354953278341042">"Notlar"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"İnternet çağrısı"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"Zil sesi"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"Adı ve Soyadı"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"Fonetik adı"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"Görülebilir kişi yok"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"1 kişi bulundu"</item>
-    <item quantity="other" msgid="7752927996850263152">"<xliff:g id="COUNT">%d</xliff:g> kişi bulundu"</item>
+    <item quantity="one" msgid="5517063038754171134">"1 kişi bulundu"</item>
+    <item quantity="other" msgid="3852668542926965042">"<xliff:g id="COUNT">%d</xliff:g> kişi bulundu"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"Kişi bulunamadı"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"Bulunamadı"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 kişi"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> kişi"</item>
+    <item quantity="one" msgid="4826918429708286628">"1 kişi bulundu"</item>
+    <item quantity="other" msgid="7988132539476575389">"<xliff:g id="COUNT">%d</xliff:g> kişi bulundu"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"Kişiler"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"Sık Kullanılanlar"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"SIM kart kişileri"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"Görüntülenecek kişiniz yok. (Hesabı yeni eklediyseniz, kişilerin senkronize edilmesi birkaç dakika sürebilir.)"</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"Görüntülenecek kişiniz yok."</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"Görüntülenecek hiçbir kişiniz yok."\n\n"Kişi eklemek için, "<font fgcolor="#ffffffff"><b>"Menü"</b></font>"\'ye basın ve şunlara dokunun:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Hesaplar"</b></font>" (telefon ile senkronize edebileceğiniz kişilere sahip olan bir hesap eklemek veya yapılandırmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Yeni kişi"</b></font>" (en baştan yeni bir kişi eklemek için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"İçe/Dışa Aktar"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"Görüntülenecek hiçbir kişiniz yok. (Kısa süre önce bir hesap eklediyseniz, kişileri senkronize etmek birkaç dakika sürebilir.)"\n\n"Kişi eklemek için, "<font fgcolor="#ffffffff"><b>"Menü"</b></font>"\'ye basın ve şunlara dokunun:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Hesaplar"</b></font>" (telefon ile senkronize edebileceğiniz kişilere sahip olan bir hesap eklemek veya yapılandırmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Seçenekleri görüntüle"</b></font>" (görülebilir kişileri değiştirmek için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Yeni kişi"</b></font>" (en baştan yeni bir kişi oluşturmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"İçe/Dışa Aktar"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"Görüntülenecek hiçbir kişiniz yok."\n\n"Kişi eklemek için, "<font fgcolor="#ffffffff"><b>"Menü"</b></font>"\'ye basın ve şunlara dokunun:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Hesaplar"</b></font>" (telefon ile senkronize edebileceğiniz kişilere sahip olan bir hesap eklemek veya yapılandırmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Yeni kişi"</b></font>" (en baştan yeni bir kişi eklemek için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"İçe/Dışa Aktar"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"Görüntülenecek hiçbir kişiniz yok. (Kısa süre önce bir hesap eklediyseniz, kişileri senkronize etmek birkaç dakika sürebilir.)"\n\n"Kişi eklemek için, "<font fgcolor="#ffffffff"><b>"Menü"</b></font>"\'ye basın ve şunlara dokunun:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Hesaplar"</b></font>" (telefon ile senkronize edebileceğiniz kişilere sahip olan bir hesap eklemek veya yapılandırmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Seçenekleri görüntüle"</b></font>" (görülebilir kişileri değiştirmek için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Yeni kişi"</b></font>" (en baştan yeni bir kişi oluşturmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"İçe/Dışa Aktar"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"Görüntülenecek kişiniz yok."\n\n"Kişi eklemek için, "<font fgcolor="#ffffffff"><b>"Menü"</b></font>"\'ye basın ve şunlara dokunun:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Hesaplar"</b></font>" (telefon ile senkronize edebileceğiniz kişilere sahip bir hesap eklemek veya yapılandırmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Yeni kişi"</b></font>" (en baştan yeni bir kişi eklemek için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"İçe/Dışa Aktar"</b></font>\n</li>"(SIM veya SD kartınızdaki kişileri aktarmak için)"</string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"Görüntülenecek kişiniz yok. (Kısa bir süre önce hesap eklediyseniz, kişileri senkronize etmek birkaç dakika sürebilir.)"\n\n"Kişi eklemek için, "<font fgcolor="#ffffffff"><b>"Menü"</b></font>"\'ye basın ve şunlara dokunun:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Hesaplar"</b></font>" (telefon ile senkronize edebileceğiniz kişilere sahip olan bir hesap eklemek veya yapılandırmak için"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Seçenekleri görüntüle"</b></font>" (görülebilir kişileri değiştirmek için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Yeni kişi"</b></font>" (en baştan yeni bir kişi oluşturmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"İçe/Dışa Aktar"</b></font>" (SIM veya SD kartınızdaki kişileri aktarmak için)"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"Görüntülenecek kişiniz yok."\n\n"Kişi eklemek için, "<font fgcolor="#ffffffff"><b>"Menü"</b></font>"\'ye basın ve şunlara dokunun:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Hesaplar"</b></font>" (telefon ile senkronize edebileceğiniz kişilere sahip olan bir hesap eklemek veya yapılandırmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Yeni kişi"</b></font>" (en baştan yeni bir kişi eklemek için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"İçe/Dışa Aktar"</b></font>" (kişileri SD kartınızdan içe aktarmak için)"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"Görüntülenecek kişiniz yok. (Kısa süre önce bir hesap eklediyseniz kişileri senkronize etmek birkaç dakika sürebilir.)"\n\n"Kişi eklemek için, "<font fgcolor="#ffffffff"><b>"Menü"</b></font>"\'ye basın ve şunlara dokunun:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Hesaplar"</b></font>" (telefon ile senkronize edebileceğiniz kişilere sahip bir hesap eklemek veya yapılandırmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Seçenekleri görüntüle"</b></font>" (görülebilir kişileri değiştirmek için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"Yeni kişi"</b></font>" (en baştan yeni bir kişi oluşturmak için)"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"İçe/Dışa Aktar"</b></font>\n</li>"(SIM veya SD kartınızdaki kişileri içe aktarmak için)"</string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"Favoriniz bulunmuyor."\n\n"Favoriler listenize kişi eklemek için:"\n\n"        "<li><b>"Kişiler"</b>" sekmesine dokunun"\n</li>" "\n<li>"Favorilerinize eklemek istediğiniz kişiye dokunun"\n</li>" "\n<li>"Kişi adının yanındaki yıldız simgesine dokunun"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"Tüm kişiler"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"Yıldızlı"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"Geri ara"</string>
     <string name="callAgain" msgid="3197312117049874778">"Tekrar çağrı yap"</string>
     <string name="returnCall" msgid="8171961914203617813">"Geri ara"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> dak <xliff:g id="SECONDS">%2$s</xliff:g> sn"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> dak <xliff:g id="SECONDS">%s</xliff:g> sn"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"Sık iletişim kurulanlar"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"Kişi ekle"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"\"<xliff:g id="EMAIL">%s</xliff:g>\" adresi kişilere eklensin mi?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"kişi fotoğrafı"</string>
     <string name="description_minus_button" msgid="387136707700230172">"eksi"</string>
     <string name="description_plus_button" msgid="515164827856229880">"artı"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"Payl dep birm kullnlmıyor"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"SD kart yok"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"Paylaşılan depolama birimi algılanmadı"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"Hiçbir SD kart tespit edilmedi"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"SD kart yok"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"Hiçbir SD kart tespit edilmedi"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"vCard aranıyor"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"SIM karttan içe aktar"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"Payl deplm birmnden aktar"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"SD karttan içe aktar"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"Payl deplm birimine aktar"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"SD karta dışa aktar"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"SD karttan içe aktar"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"SD karta dışa aktar"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"Görülebilir kişileri paylaş"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"Bir vCard dosyasını içe aktar"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"Birden fazla vCard dosyasını içe aktar"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"Tüm vCard dosyalarını içe aktar"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"Paylaşılan depolama birimindeki vCard verileri aranıyor"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"SD kartta vCard verileri aranıyor"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"Paylaşılan depolama birimi taraması başarısız oldu"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"SD kart taranamadı"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"Paylaşılan depolama birimi taraması başarısız oldu (Nedeni: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"SD kart taraması başarısız oldu (Neden: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"SD kartta vCard verileri aranıyor"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"SD kart taranamadı"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"SD kart taraması başarısız oldu (Neden: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\")"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"G/Ç Hatası"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"Bellek yetersiz (dosya çok büyük olabilir)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"Beklenmedik bir nedenden dolayı vCard ayrıştırılamadı"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"Geçerli biçimde görünmesine rağmen vCard ayrıştırılamadı, çünkü şu anki uygulama vCard\'ı desteklemiyor"</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"Paylaşılan depolama biriminde vCard dosyası bulunamadı"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"SD kartta hiçbir vCard dosyası bulunamadı"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"SD kartta hiçbir vCard dosyası bulunamadı"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"Belirtilen vCard dosyalarının meta bilgileri toplanamıyor."</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"İçe aktarılamayan bir veya birden fazla dosya (%s)."</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"Bilinmeyen hata"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"vCard dosyasını seç"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"vCard okunuyor"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"vCard dosyaları okunuyor"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"vCard verileri okunamadı"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"Toplam <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> kişiden <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> kişi"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"toplam <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> dosyadan <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g>. dosya"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"vCard\'lar yerel geçici depolamada önbelleğe kaydediliyor"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"İçe aktarma aracı vCard\'ları yerel geçici depolama alanına önbelleğe kaydediyor. Asıl içe aktarma işlemi kısa süre içinde başlayacak."</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"vCard verileri Okunamadı"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"vCard verilerini okuma işlemi iptal edildi."</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"vCard içe aktarma işlemi tamamlandı"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"vCard içe aktarma aracı başlatıldı."</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"vCard içe aktarma aracı vCard\'ı bir süre sonra içe aktaracaktır."</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"Dışa aktarımı onayla"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"Kişi listenizi \"<xliff:g id="VCARD_FILENAME">%s</xliff:g>\" için dışa aktarmak istediğinizden emin misiniz?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"Kişi verileri dışa aktarılamadı"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"Kişi verileri dışa aktarılamadı."\n"Hata nedeni: \"<xliff:g id="FAIL_REASON">%s</xliff:g>\""</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"Dışa aktarılabilen hiçbir kişi yok"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"Paylaşılan depolama biriminde çok fazla vCard dosyası var"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"SD kartta çok fazla vCard dosyası var"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"SD kartta çok fazla vCard dosyası var"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"Gereken dosya adı çok uzun (\"<xliff:g id="FILENAME">%s</xliff:g>\")"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"vCard dışa aktarma aracı başlatıldı."</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"vCard dışa aktarma işlemi tamamlandı"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"Kişi verileri dışa aktarılıyor"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"Kişi verileri \"<xliff:g id="FILE_NAME">%s</xliff:g>\" dosyasına dışa aktarılıyor"</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"Dışa aktarıcı başlatılamadı: \"<xliff:g id="EXACT_REASON">%s</xliff:g>\""</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"Veri tabanı bilgileri alınamadı"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"Dışa aktarılabilir kişi yok. Telefonunuzda aslında kişi kayıtları varsa, veri sağlayıcısı tarafından tüm kişilerin telefon dışına aktarılması yasaklanmış olabilir."</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"vCard oluşturucu doğru bir şekilde başlatılmamış"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\"<xliff:g id="FILE_NAME">%1$s</xliff:g>\" dosyası açılamadı: <xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"Toplam <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> kişiden <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> kişi"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\"<xliff:g id="FILE_NAME">%s</xliff:g>\" dosyası açılamadı: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"Toplam <xliff:g id="TOTAL_NUMBER">%s</xliff:g> kişiden <xliff:g id="CURRENT_NUMBER">%s</xliff:g> kişi"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"Kişilerinizin adları"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"2 saniyelik duraklama ekle"</string>
     <string name="add_wait" msgid="3360818652790319634">"Bekleme ekle"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"Bu işlemi gerçekleştirecek bir uygulama bulunamadı"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"Bu tercihi anımsa"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"Bilinmiyor"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"Veri yok"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"Hesaplar"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"İçe/Dışa Aktar"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"Kişileri içe/dışa aktar"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"Diğer Tüm Kişiler"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"Tüm Kişiler"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"\'<xliff:g id="GROUP">%s</xliff:g>\' grubunu senkronizasyondan kaldırmak, gruplandırılmamış tüm kişileri de senkronizasyondan kaldırır."</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"Yalnızca telefon (senkronize edilmemiş)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"Yalnızca telefon (senkronize edilmemiş)"</string>
     <string name="call_custom" msgid="7756571794763171802">"Ara (<xliff:g id="CUSTOM">%s</xliff:g>)"</string>
     <string name="call_home" msgid="1990519474420545392">"Çağrı yap (ev)"</string>
     <string name="call_mobile" msgid="7502236805487609178">"Çağrı yap (mobil)"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"ICQ kullanarak sohbet et"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"Jabber kullanarak sohbet et"</string>
     <string name="chat" msgid="9025361898797412245">"Sohbet"</string>
+    <string name="postal_address" msgid="8765560217149624536">"Adres"</string>
     <string name="postal_street" msgid="8133143961580058972">"Cadde"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"Posta kutusu"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"Mahalle"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"Eyalet"</string>
     <string name="postal_postcode" msgid="572136414136673751">"Alan kodu"</string>
     <string name="postal_country" msgid="7638264508416368690">"Ülke"</string>
+    <string name="full_name" msgid="6602579550613988977">"Ad"</string>
     <string name="name_given" msgid="1687286314106019813">"Adı"</string>
     <string name="name_family" msgid="3416695586119999058">"Soyadı"</string>
     <string name="name_prefix" msgid="59756378548779822">"Ad öneki"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"Fonetik soyadı"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g> kişi"</string>
     <string name="from_account_format" msgid="687567483928582084">"kaynak: <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"<xliff:g id="SOURCE_1">%2$s</xliff:g> kaynağına ait <xliff:g id="SOURCE_0">%1$s</xliff:g> kişisi"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"Bu fotoğrafı kullan"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"<xliff:g id="SOURCE">%1$s</xliff:g> kişi bilgileri bu cihazda düzenlenemez."</string>
     <string name="no_contact_details" msgid="6754415338321837001">"Bu kişi için ek bilgi yok"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"Galeri\'den fotoğraf seç"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"Kişi listesi, dil değişikliğini yansıtmak üzere güncelleniyor."\n\n"Lütfen bekleyin..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"Kişi listesi güncelleniyor."\n\n"Lütfen bekleyin..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"Kişiler yeni sürüme geçiriliyor. "\n\n"Yeni sürüme geçirme işlemi yaklaşık <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g>Mb dahili telefon depolama alanı gerektirir."\n\n"Aşağıdaki seçeneklerden birini belirleyin:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"Kişiler yeni sürüme geçiriliyor. "\n\n"Yeni sürüme geçirme işlemi yaklaşık <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB dahili telefon depolama alanı gerektirir."\n\n"Aşağıdaki seçeneklerden birini belirleyin:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"Bazı uygulamaları kaldır"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"Yeni sürüme geçmeyi tekrar dene"</string>
     <string name="search_results_for" msgid="8705490885073188513">"Şunun için arama sonuçları: <xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"Aranıyor..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"Yükleniyor …"</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"Seçileni göster"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"Tümünü göster\n"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"Tümünü seç"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"Tümünün seçimini kaldır"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"1 alıcı seçildi"</item>
+    <item quantity="other" msgid="4608837420986126229">"<xliff:g id="COUNT">%d</xliff:g> alıcı seçildi"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"Bilinmeyen kişiler"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"Seçili kişi yok."</string>
+    <string name="add_field" msgid="5257149039253569615">"Bilgi ekle"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"<xliff:g id="SOURCE">%1$s</xliff:g> aracılığıyla"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="SOURCE">%2$s</xliff:g> üzerinden şu saatte: <xliff:g id="DATE">%1$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"düzenle"</string>
+    <string name="description_star" msgid="2605854427360036550">"favori"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"Kişiyi düzenle"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"birleştirilmemiş"</item>
+    <item quantity="other" msgid="425683718017380845">"<xliff:g id="COUNT">%0$d</xliff:g> kaynaktan birleştirildi"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"Sil"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"Kaydetme hatası"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"Diğer"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;Ç;D;E;F;G;H;I;İ;J;K;L;M;N;O;Ö;P;R;S;Ş;T;U;Ü;V;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-xlarge/colors.xml b/res/values-xlarge/colors.xml
new file mode 100644
index 0000000..0f8f8de
--- /dev/null
+++ b/res/values-xlarge/colors.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+
+<resources>
+
+    <!-- Color used for the letter in the A-Z section header -->
+    <color name="section_header_text_color">#ff000000</color>
+
+</resources>
diff --git a/res/values-xlarge/dimens.xml b/res/values-xlarge/dimens.xml
new file mode 100644
index 0000000..8f81240
--- /dev/null
+++ b/res/values-xlarge/dimens.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<resources>
+    <!-- Size of the text in the aizy visual scroll control -->
+    <dimen name="aizy_text_size">12sp</dimen>
+
+    <dimen name="edit_photo_size">96dip</dimen>
+
+    <dimen name="aggregation_suggestion_icon_size">64dip</dimen>
+</resources>
diff --git a/res/values-xlarge/styles.xml b/res/values-xlarge/styles.xml
new file mode 100644
index 0000000..5b920d6
--- /dev/null
+++ b/res/values-xlarge/styles.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<resources>
+    <style name="ContactBrowserTheme" parent="@android:Theme.Light.Holo">
+        <item name="pressedBackground">@drawable/list_item_pressed_bg</item>
+        <item name="android:windowBackground">@drawable/contact_list_bg</item>
+        <item name="android:windowContentOverlay">@null</item>
+        <item name="android:actionBarStyle">@style/TransparentActionBarStyle</item>
+        <item name="section_header_background">@drawable/section_header_holo</item>
+        <item name="list_item_divider">@drawable/list_item_divider_holo</item>
+        <item name="list_item_padding_top">0dip</item>
+        <item name="list_item_padding_right">11dip</item>
+        <item name="list_item_padding_bottom">0dip</item>
+        <item name="list_item_padding_left">4dip</item>
+        <item name="list_item_gap_between_image_and_text">8dip</item>
+        <item name="list_item_gap_between_label_and_data">5dip</item>
+        <item name="list_item_call_button_padding">14dip</item>
+        <item name="list_item_vertical_divider_margin">5dip</item>
+        <item name="list_item_presence_icon_margin">5dip</item>
+        <item name="list_item_header_text_width">56dip</item>
+        <item name="list_item_photo_size">64dip</item>
+        <item name="list_item_prefix_highlight_color">#729a27</item>
+        <item name="contact_filter_popup_width">320dip</item>
+    </style>
+
+    <style name="ContactPickerTheme" parent="@android:Theme.Holo.Light.Dialog">
+        <item name="section_header_background">@drawable/section_header_holo</item>
+        <item name="list_item_divider">@drawable/list_item_divider_holo</item>
+        <item name="list_item_padding_top">0dip</item>
+        <item name="list_item_padding_right">11dip</item>
+        <item name="list_item_padding_bottom">0dip</item>
+        <item name="list_item_padding_left">4dip</item>
+        <item name="list_item_gap_between_image_and_text">8dip</item>
+        <item name="list_item_gap_between_label_and_data">5dip</item>
+        <item name="list_item_call_button_padding">14dip</item>
+        <item name="list_item_vertical_divider_margin">5dip</item>
+        <item name="list_item_presence_icon_margin">5dip</item>
+        <item name="list_item_header_text_width">56dip</item>
+        <item name="list_item_photo_size">64dip</item>
+    </style>
+    
+    <style name="SocialWidgetConfigureTheme" parent="ContactPickerTheme">
+    </style>
+
+    <style name="ContactsSearchTheme" parent="ContactPickerTheme">
+    </style>
+
+    <style name="ContactsPreferencesTheme" parent="@android:Theme.Light.Holo">
+    </style>
+
+    <style name="CustomContactListFilterTheme" parent="@android:Theme.Holo.Light.Dialog">
+    </style>
+
+    <style name="CustomContactListFilterView" parent="CustomContactListFilterTheme">
+        <item name="android:layout_width">400dip</item>
+        <item name="android:layout_height">600dip</item>
+    </style>
+
+    <style name="ContactPickerLayout" parent="ContactPickerTheme">
+        <item name="android:layout_width">480dip</item>
+        <item name="android:layout_height">650dip</item>
+    </style>
+
+    <style name="CallDetailActivityTheme" parent="@android:Theme.Dialog">
+        <item name="android:windowContentOverlay">@null</item>
+    </style>
+
+    <style name="ContactDetailActivityTheme" parent="@android:Theme.Dialog">
+        <item name="android:windowContentOverlay">@null</item>
+    </style>
+
+    <style name="ContactEditorActivityTheme" parent="@android:Theme.Light.Holo">
+        <item name="android:actionBarStyle">@style/TransparentActionBarStyle</item>
+        <item name="android:windowBackground">@drawable/contact_list_bg</item>
+        <item name="android:windowContentOverlay">@null</item>
+    </style>
+
+    <style name="TransparentActionBarStyle" parent="android:Widget.Holo.Light.ActionBar">
+        <item name="android:background">@null</item>
+    </style>
+
+    <style name="DirectoryHeader" parent="ContactBrowserTheme">
+        <item name="android:background">@drawable/directory_bg_holo</item>
+    </style>
+</resources>
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 6009d50..ae917eb 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"联系人详情"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"查看联系人"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"编辑联系人"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"电子邮件地址:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"类型:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"创建联系人"</string>
     <string name="searchHint" msgid="8482945356247760701">"搜索联系人"</string>
     <string name="menu_search" msgid="9147752853603483719">"搜索"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"新建联系人"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"拼音"</string>
     <string name="label_notes" msgid="8337354953278341042">"备注"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"互联网通话"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"铃声"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"姓名"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"姓名拼音"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"未显示任何联系人"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"找到 1 位联系人"</item>
-    <item quantity="other" msgid="7752927996850263152">"找到 <xliff:g id="COUNT">%d</xliff:g> 位联系人"</item>
+    <item quantity="one" msgid="5517063038754171134">"找到 1 个联系人"</item>
+    <item quantity="other" msgid="3852668542926965042">"找到 <xliff:g id="COUNT">%d</xliff:g> 个联系人"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"未找到联系人"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"找不到"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 位联系人"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> 位联系人"</item>
+    <item quantity="one" msgid="4826918429708286628">"找到 1 个联系人"</item>
+    <item quantity="other" msgid="7988132539476575389">"找到 <xliff:g id="COUNT">%d</xliff:g> 个联系人"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"通讯录"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"收藏"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"SIM 卡联系人"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"没有任何联系人可供显示。(如果您刚刚添加了一个帐户,则系统需要几分钟的时间同步联系人。)"</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"没有任何联系人可供显示。"</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"您没有可显示的联系人。"\n\n"要添加联系人,请按"<font fgcolor="#ffffffff"><b>"菜单"</b></font>",然后触摸:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Google 帐户"</b></font>"以添加或配置可同步到手机的联系人的帐户"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"新建联系人"</b></font>"以从头开始创建新联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"导入/导出"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"您没有可显示的联系人。(如果您刚刚添加了一个帐户,则需要几分钟时间同步联系人。)"\n\n"要添加联系人,请按"<font fgcolor="#ffffffff"><b>"菜单"</b></font>",然后触摸:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Google 帐户"</b></font>"以添加或配置可同步到手机的联系人的帐户"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"显示选项"</b></font>"以更改可见的联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"新建联系人"</b></font>"以从头开始创建新联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"导入/导出"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"您没有可显示的联系人。"\n\n"要添加联系人,请按"<font fgcolor="#ffffffff"><b>"菜单"</b></font>",然后触摸:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Google 帐户"</b></font>"以添加或配置可同步到手机的联系人的帐户"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"新建联系人"</b></font>"以从头开始创建新联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"导入/导出"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"您没有可显示的联系人。(如果您刚刚添加了一个帐户,则需要几分钟时间同步联系人。)"\n\n"要添加联系人,请按"<font fgcolor="#ffffffff"><b>"菜单"</b></font>",然后触摸:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Google 帐户"</b></font>"以添加或配置可同步到手机的联系人的帐户"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"显示选项"</b></font>"以更改可见的联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"新建联系人"</b></font>"以从头开始创建新联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"导入/导出"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"您没有可显示的联系人。"\n\n"要添加联系人,请按"<font fgcolor="#ffffffff"><b>"菜单"</b></font>",然后触摸以下按钮执行操作:"\n\n<li><font fgcolor="#ffffffff"><b>"Google 帐户"</b></font>"以添加或配置帐户,您可以将该帐户中包含的联系人同步到手机"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"新建联系人"</b></font>"以从头开始创建新联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"导入/导出"</b></font>"以导入 SIM 卡或 SD 卡上的联系人"\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"您没有可显示的联系人。(如果您刚刚添加了一个帐户,则需要几分钟时间同步联系人。)"\n\n"要添加联系人,请按"<font fgcolor="#ffffffff"><b>"菜单"</b></font>",然后触摸:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Google 帐户"</b></font>"以添加或配置帐户,您可以将该帐户中包含的联系人同步到手机"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"显示选项"</b></font>"以更改可见的联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"新建联系人"</b></font>"以从头开始创建新联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"导入/导出"</b></font>"以导入 SIM 卡或 SD 卡上的联系人"\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"您没有可显示的联系人。"\n\n"要添加联系人,请按"<font fgcolor="#ffffffff"><b>"菜单"</b></font>",然后触摸:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Google 帐户"</b></font>"以添加或配置帐户,您可以将该帐户中包含的联系人同步到手机"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"新建联系人"</b></font>"以从头开始创建新联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"导入/导出"</b></font>"以导入 SIM 卡或 SD 卡上的联系人"\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"您没有可显示的联系人。(如果您刚刚添加了一个帐户,则需要几分钟时间同步联系人。)"\n\n"要添加联系人,请按"<font fgcolor="#ffffffff"><b>"菜单"</b></font>",然后触摸:"\n" "\n<li><font fgcolor="#ffffffff"><b>"Google 帐户"</b></font>"以添加或配置帐户,您可以将该帐户中包含的联系人同步到手机"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"显示选项"</b></font>"以更改可见的联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"新建联系人"</b></font>"以从头开始创建新联系人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"导入/导出"</b></font>"以导入 SD 卡上的联系人"\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"您未收藏任何联系人。"\n\n"要向您的收藏列表添加联系人,请执行以下操作:"\n\n"        "<li>"触摸"<b>"联系人"</b>"标签"\n</li>\n<li>"触摸您要加入收藏的联系人"\n</li>\n<li>"触摸联系人姓名旁边的星标"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"所有联系人"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"已加星标的内容"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"回电"</string>
     <string name="callAgain" msgid="3197312117049874778">"重拨"</string>
     <string name="returnCall" msgid="8171961914203617813">"回拨"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> 分 <xliff:g id="SECONDS">%2$s</xliff:g> 秒"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> 分 <xliff:g id="SECONDS">%s</xliff:g> 秒"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"常用联系人"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"添加联系人"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"将“<xliff:g id="EMAIL">%s</xliff:g>”添加到联系人?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"联系人照片"</string>
     <string name="description_minus_button" msgid="387136707700230172">"删除"</string>
     <string name="description_plus_button" msgid="515164827856229880">"添加"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"共享存储设备不可用"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"无 SD 卡"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"未检测到共享存储设备"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"未检测到 SD 卡"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"无 SD 卡"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"未检测到 SD 卡"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"正在搜索 vCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"从 SIM 卡导入"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"从共享存储设备导入"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"从 SD 卡导入"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"导出到共享存储设备"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"导出到 SD 卡"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"从 SD 卡导入"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"导出到 SD 卡"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"分享可见的联系人"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"导入一个 vCard 文件"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"导入多个 vCard 文件"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"导入所有 vCard 文件"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"正在共享存储设备中搜索 vCard 文件"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"正在 SD 卡中搜索 vCard 数据"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"扫描共享存储设备时失败"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"扫描 SD 卡失败"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"扫描共享存储设备时失败(原因:“<xliff:g id="FAIL_REASON">%s</xliff:g>”)"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"扫描 SD 卡失败(原因:“<xliff:g id="FAIL_REASON">%s</xliff:g>”)"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"正在 SD 卡中搜索 vCard 数据"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"扫描 SD 卡失败"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"扫描 SD 卡失败(原因:“<xliff:g id="FAIL_REASON">%s</xliff:g>”)"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"I/O 错误"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"存储器空间不足(文件可能过大)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"由于意外原因而无法解析 vCard"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"虽然 vCard 似乎使用了有效的格式,但系统无法对其进行解析,因为当前的实现方案不支持该格式。"</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"未在共享存储设备中找到 vCard 文件"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"未在 SD 卡上找到 vCard 文件"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"未在 SD 卡上找到 vCard 文件"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"无法收集指定的 vCard 文件的元信息。"</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"一个或多个文件导入失败 (%s)。"</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"未知错误"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"选择 vCard 文件"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"正在读取 vCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"正在读取 vCard 文件"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"读取 vCard 数据失败"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"第 <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> 个联系人(共 <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> 个)"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"第 <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> 个,共 <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> 个文件"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"正在将 vCard 缓存到本地临时存储"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"导入程序正在将 vCard 缓存到本地临时存储。很快将会开始真正的导入。"</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"无法读取 vCard 数据"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"已取消读取 vCard 数据"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"导入 vCard 已完成"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"vCard 导入程序已启动。"</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"vCard 导入程序会在稍后导入该 vCard。"</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"确认导出"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"确定要将您的联系人列表导出到“<xliff:g id="VCARD_FILENAME">%s</xliff:g>”中吗?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"导出联系人数据失败"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"导出联系人数据失败。"\n"失败原因:“<xliff:g id="FAIL_REASON">%s</xliff:g>”"</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"没有可导出的联系人"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"共享存储设备中的 vCard 文件太多"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"SD 卡中的 vCard 文件太多"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"SD 卡中的 vCard 文件太多"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"所需文件名太长(“<xliff:g id="FILENAME">%s</xliff:g>”)"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"vCard 导出程序已启动。"</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"导出 vCard 已完成"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"正在导出联系人数据"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"正在向“<xliff:g id="FILE_NAME">%s</xliff:g>”导出联系人数据"</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"无法初始化导出程序:“<xliff:g id="EXACT_REASON">%s</xliff:g>”"</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"获取数据库信息失败"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"没有可导出的联系人。如果您的手机中确实有联系人,则可能是某个数据提供程序禁止您从手机中导出任何联系人。"</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"vCard 制作程序未正确初始化"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"无法打开“<xliff:g id="FILE_NAME">%1$s</xliff:g>”:<xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"第 <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> 个联系人(共 <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> 个)"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"无法打开“<xliff:g id="FILE_NAME">%s</xliff:g>”:<xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"第 <xliff:g id="CURRENT_NUMBER">%s</xliff:g> 个联系人(共 <xliff:g id="TOTAL_NUMBER">%s</xliff:g> 个)"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"联系人姓名"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"暂停时间延长 2 秒"</string>
     <string name="add_wait" msgid="3360818652790319634">"延长等待时间"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"未找到可处理此操作的应用程序"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"记住此选择"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"未知"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"无数据"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"帐户"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"导入/导出"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"导入/导出联系人"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"其他所有联系人"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"所有联系人"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"如果从同步中删除群组“<xliff:g id="GROUP">%s</xliff:g>”,则会同时删除其中所有未分组的联系人。"</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"仅保存在手机中(不同步)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"仅保存在手机中(不同步)"</string>
     <string name="call_custom" msgid="7756571794763171802">"呼叫<xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"呼叫住宅电话"</string>
     <string name="call_mobile" msgid="7502236805487609178">"呼叫手机"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"使用 ICQ 聊天"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"使用 Jabber 聊天"</string>
     <string name="chat" msgid="9025361898797412245">"聊天"</string>
+    <string name="postal_address" msgid="8765560217149624536">"地址"</string>
     <string name="postal_street" msgid="8133143961580058972">"街道"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"信箱"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"街区"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"省/直辖市/自治区"</string>
     <string name="postal_postcode" msgid="572136414136673751">"邮政编码"</string>
     <string name="postal_country" msgid="7638264508416368690">"国家/地区"</string>
+    <string name="full_name" msgid="6602579550613988977">"姓名"</string>
     <string name="name_given" msgid="1687286314106019813">"名字"</string>
     <string name="name_family" msgid="3416695586119999058">"姓氏"</string>
     <string name="name_prefix" msgid="59756378548779822">"名称前缀"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"姓氏拼音"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g> 联系人"</string>
     <string name="from_account_format" msgid="687567483928582084">"来自 <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"来自 <xliff:g id="SOURCE_1">%2$s</xliff:g> 的 <xliff:g id="SOURCE_0">%1$s</xliff:g> 联系人"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"使用此照片"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"<xliff:g id="SOURCE">%1$s</xliff:g> 联系人信息在此设备上不可编辑。"</string>
     <string name="no_contact_details" msgid="6754415338321837001">"无此联系人的其他信息"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"从图库中选择照片"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"正在更新联系人列表,以反映语言的变更。"\n\n"请稍候..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"正在更新联系人列表。"\n\n"请稍候..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"正在升级联系人。"\n\n"升级过程需要约 <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> Mb 的手机内存。"\n\n"请选择以下选项之一:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"正在升级联系人。"\n\n"升级过程需要约 <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB 的手机内存。"\n\n"请选择以下选项之一:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"卸载一些应用程序"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"重新尝试升级"</string>
     <string name="search_results_for" msgid="8705490885073188513">"“<xliff:g id="QUERY">%s</xliff:g>”的搜索结果"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"正在搜索..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"正在载入..."</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"已选收件人"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"全部收件人"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"全选"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"取消全选"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"已选择 1 个收件人"</item>
+    <item quantity="other" msgid="4608837420986126229">"已选择 <xliff:g id="COUNT">%d</xliff:g> 个收件人"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"未知联系人"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"未选择联系人。"</string>
+    <string name="add_field" msgid="5257149039253569615">"添加信息"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"来源:<xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"时间:<xliff:g id="DATE">%1$s</xliff:g>,来源:<xliff:g id="SOURCE">%2$s</xliff:g>"</string>
+    <string name="description_edit" msgid="1601490950771217014">"编辑"</string>
+    <string name="description_star" msgid="2605854427360036550">"收藏"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"编辑联系人"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"未合并"</item>
+    <item quantity="other" msgid="425683718017380845">"合并自 <xliff:g id="COUNT">%0$d</xliff:g> 个来源"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"删除"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"保存出错"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"其他"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index dd502c2..f0901e3 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -31,6 +31,8 @@
     <string name="viewContactTitle" msgid="7989394521836644384">"聯絡人詳細資料"</string>
     <string name="viewContactDesription" msgid="214186610887547860">"檢視聯絡人"</string>
     <string name="editContactDescription" msgid="2947202828256214947">"編輯聯絡人"</string>
+    <string name="edit_email_caption" msgid="2401084399676154272">"電子郵件地址:"</string>
+    <string name="edit_email_type_caption" msgid="66331218163770698">"類型:"</string>
     <string name="insertContactDescription" msgid="4709878105452681987">"建立聯絡人"</string>
     <string name="searchHint" msgid="8482945356247760701">"搜尋聯絡人"</string>
     <string name="menu_search" msgid="9147752853603483719">"搜尋"</string>
@@ -71,7 +73,8 @@
     <string name="editContact_title_insert" msgid="9125600232291405757">"新增聯絡人"</string>
     <string name="label_phonetic_name" msgid="2288082649573927286">"拼音"</string>
     <string name="label_notes" msgid="8337354953278341042">"附註"</string>
-    <string name="label_sip_address" msgid="124073911714324974">"網路電話"</string>
+    <!-- no translation found for label_sip_address (124073911714324974) -->
+    <skip />
     <string name="label_ringtone" msgid="8833166825330686244">"鈴聲"</string>
     <string name="ghostData_name" msgid="6490954238641157585">"姓名"</string>
     <string name="ghostData_phonetic_name" msgid="7852749081984070902">"姓名拼音"</string>
@@ -124,13 +127,13 @@
   </plurals>
     <string name="listTotalAllContactsZero" msgid="6811347506748072822">"沒有可顯示的聯絡人"</string>
   <plurals name="listFoundAllContacts">
-    <item quantity="one" msgid="2830107332033967280">"已找到 1 位聯絡人"</item>
-    <item quantity="other" msgid="7752927996850263152">"已找到 <xliff:g id="COUNT">%d</xliff:g> 位聯絡人"</item>
+    <item quantity="one" msgid="5517063038754171134">"找到 1 位聯絡人"</item>
+    <item quantity="other" msgid="3852668542926965042">"找到 <xliff:g id="COUNT">%d</xliff:g> 位聯絡人"</item>
   </plurals>
-    <string name="listFoundAllContactsZero" msgid="5554368784319460828">"找不到聯絡人"</string>
+    <string name="listFoundAllContactsZero" msgid="777952841930508289">"找不到"</string>
   <plurals name="searchFoundContacts">
-    <item quantity="one" msgid="916648718690661777">"1 位聯絡人"</item>
-    <item quantity="other" msgid="5660384247071761844">"<xliff:g id="COUNT">%d</xliff:g> 位聯絡人"</item>
+    <item quantity="one" msgid="4826918429708286628">"找到 1 位聯絡人"</item>
+    <item quantity="other" msgid="7988132539476575389">"找到 <xliff:g id="COUNT">%d</xliff:g> 位聯絡人"</item>
   </plurals>
     <string name="contactsIconLabel" msgid="7666609097606552806">"聯絡人"</string>
     <string name="contactsFavoritesLabel" msgid="8417039765586853670">"我的最愛"</string>
@@ -160,10 +163,10 @@
     <string name="simContacts_title" msgid="27341688347689769">"SIM 卡聯絡人"</string>
     <string name="noContactsHelpTextWithSyncForCreateShortcut" msgid="801504710275614594">"您沒有任何聯絡人可供顯示 (如果您剛剛才新增帳戶,系統需要幾分鐘的時間才能同步聯絡人資訊)。"</string>
     <string name="noContactsHelpTextForCreateShortcut" msgid="3081286388667108335">"您沒有任何聯絡人可供顯示。"</string>
-    <string name="noContactsHelpText" msgid="6788487368878712350">"您沒有任何聯絡人。"\n\n"如要新增聯絡人,請按下 ["<font fgcolor="#ffffffff">"選單"<b></b></font>"] 並輕觸:"\n" "\n<li>"["<font fgcolor="#ffffffff">"帳戶"<b></b></font>" 來新增或設定您可以同步處理手機資料的聯絡人帳戶"\n</li>" "\n<li>"["<font fgcolor="#ffffffff">"新增聯絡人"<b></b></font>"] 從頭開始建立聯絡人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"匯入/匯出"</b></font>\n</li></string>
-    <string name="noContactsHelpTextWithSync" msgid="3734101165712848179">"您沒有任何聯絡人 (如果您剛剛才新增帳戶,系統需要幾分鐘的時間才能同步聯絡人資訊)。"\n\n"如要新增聯絡人,請按下 ["<font fgcolor="#ffffffff">"選單"</font><b></b>"] 並輕觸:"\n\n"["<li><font fgcolor="#ffffffff">"帳戶"<b></b></font>"] 來新增或設定您可以同步處理手機資料的聯絡人帳戶"\n</li>" "\n<li>"["<font fgcolor="#ffffffff">"顯示選項"<b></b></font>"] 來變更聯絡人的顯示狀態"\n</li>" "\n<li>"["<font fgcolor="#ffffffff">"新增聯絡人"<b></b></font>"] 從頭開始建立聯絡人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"匯入/匯出"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpText" msgid="6553845386917463292">"您沒有任何聯絡人。"\n\n"如要新增聯絡人,請按下 ["<font fgcolor="#ffffffff">"選單"<b></b></font>"] 並輕觸:"\n" "\n<li>"["<font fgcolor="#ffffffff">"帳戶"<b></b></font>" 來新增或設定您可以同步處理手機資料的聯絡人帳戶"\n</li>" "\n<li>"["<font fgcolor="#ffffffff">"新增聯絡人"<b></b></font>"] 從頭開始建立聯絡人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"匯入/匯出"</b></font>\n</li></string>
-    <string name="noContactsNoSimHelpTextWithSync" msgid="1122296298361373488">"您沒有任何聯絡人 (如果您剛剛才新增帳戶,系統需要幾分鐘的時間才能同步聯絡人資訊)。"\n\n"如要新增聯絡人,請按下 ["<font fgcolor="#ffffffff">"選單"</font><b></b>"] 並輕觸:"\n\n"["<li><font fgcolor="#ffffffff">"帳戶"<b></b></font>"] 來新增或設定您可以同步處理手機資料的聯絡人帳戶"\n</li>" "\n<li>"["<font fgcolor="#ffffffff">"顯示選項"<b></b></font>"] 來變更聯絡人的顯示狀態"\n</li>" "\n<li>"["<font fgcolor="#ffffffff">"新增聯絡人"<b></b></font>"] 從頭開始建立聯絡人"\n</li>" "\n<li><font fgcolor="#ffffffff"><b>"匯入/匯出"</b></font>\n</li></string>
+    <string name="noContactsHelpText" msgid="7633826236417884130">"您沒有任何聯絡人可以顯示。"\n\n"如要新增聯絡人,請按下 [選單] 並輕觸:"\n\n"[帳戶] 以新增或設定含有聯絡人的帳戶,您可以將其聯絡人資料同步傳送到手機"\n" "\n"[新增聯絡人] 以從頭開始建立聯絡人"\n" "\n"[匯入/匯出] 以從 SIM 卡或 SD 卡匯入聯絡人"<font fgcolor="#ffffffff"><b></b></font><li><font fgcolor="#ffffffff"><b></b></font></li><li><font fgcolor="#ffffffff"><b></b></font></li><li><font fgcolor="#ffffffff"><b></b></font>\n</li></string>
+    <string name="noContactsHelpTextWithSync" msgid="3017521127042216243">"您沒有任何聯絡人 (如果您剛剛才新增帳戶,系統需要幾分鐘的時間才能同步處理聯絡人資訊)。"\n\n"如要新增聯絡人,請按下 [選單] 並輕觸:"\n\n"[帳戶] 以新增或設定含有聯絡人的帳戶,您可以將其聯絡人資料同步傳送到手機"\n" "\n"[顯示選項] 以變更聯絡人的顯示狀態"\n" "\n"[新增聯絡人] 以從頭開始建立聯絡人"\n" "\n"[匯入/匯出] 以從 SIM 卡或 SD 卡匯入聯絡人"<font fgcolor="#ffffffff"><b></b></font><li><font fgcolor="#ffffffff"><b></b></font></li><li><font fgcolor="#ffffffff"><b></b></font></li><li><font fgcolor="#ffffffff"><b></b></font></li><li><font fgcolor="#ffffffff"><b></b></font>\n</li></string>
+    <string name="noContactsNoSimHelpText" msgid="467658807711582876">"您沒有任何聯絡人。"\n\n"如要新增聯絡人,請按下 [選單] 並輕觸:"\n" "\n"[帳戶] 以新增或設定含有聯絡人的帳戶,您可以將其聯絡人資料同步傳送到手機帳戶"\n" "\n"[新增聯絡人] 從頭開始建立聯絡人"\n" "\n"[匯入/匯出] 從 SD 卡匯入聯絡人"<font fgcolor="#ffffffff"><b></b></font><li><font fgcolor="#ffffffff"><b></b></font></li><li><font fgcolor="#ffffffff"><b></b></font></li><li><font fgcolor="#ffffffff"><b></b></font>\n</li></string>
+    <string name="noContactsNoSimHelpTextWithSync" msgid="9040060730467973050">"您沒有任何聯絡人 (如果您剛剛才新增帳戶,系統需要幾分鐘的時間才能同步處理聯絡人資訊)。"\n\n"如要新增聯絡人,請按下 [選單] 並輕觸:"\n\n"[帳戶] 以新增或設定含有聯絡人的帳戶,您可以將其聯絡人資料同步傳送到手機"\n" "\n"[顯示選項] 以變更聯絡人的顯示狀態"\n" "\n"[新增聯絡人] 以從頭開始建立聯絡人"\n" "\n"[匯入/匯出] 以從 SD 卡匯入聯絡人"<font fgcolor="#ffffffff"><b></b></font><li><font fgcolor="#ffffffff"><b></b></font></li><li><font fgcolor="#ffffffff"><b></b></font></li><li><font fgcolor="#ffffffff"><b></b></font></li><li><font fgcolor="#ffffffff"><b></b></font>\n</li></string>
     <string name="noFavoritesHelpText" msgid="3744655776704833277">"您沒有任何最愛。"\n\n"如要將聯絡人新增至最愛清單:"\n\n<li>"輕觸 [聯絡人"<b></b>"] 標籤"\n</li>" "\n<li>"輕觸要新增至最愛的聯絡人"\n</li>" "\n<li>"輕觸聯絡人名稱旁邊的星號圖示"\n</li></string>
     <string name="liveFolder_all_label" msgid="5961411940473276616">"所有聯絡人"</string>
     <string name="liveFolder_favorites_label" msgid="2674341514070517105">"已加星號"</string>
@@ -180,7 +183,7 @@
     <string name="callBack" msgid="5498224409038809224">"回播電話"</string>
     <string name="callAgain" msgid="3197312117049874778">"重撥"</string>
     <string name="returnCall" msgid="8171961914203617813">"回電"</string>
-    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%1$s</xliff:g> 分 <xliff:g id="SECONDS">%2$s</xliff:g> 秒"</string>
+    <string name="callDetailsDurationFormat" msgid="8157706382818184268">"<xliff:g id="MINUTES">%s</xliff:g> 分 <xliff:g id="SECONDS">%s</xliff:g> 秒"</string>
     <string name="favoritesFrquentSeparator" msgid="8107518433381283736">"常用聯絡人"</string>
     <string name="add_contact_dlg_title" msgid="2896685845822146494">"新增聯絡人"</string>
     <string name="add_contact_dlg_message_fmt" msgid="7986472669444326576">"要將「<xliff:g id="EMAIL">%s</xliff:g>」新增為聯絡人嗎?"</string>
@@ -204,48 +207,51 @@
     <string name="description_contact_photo" msgid="3387458082667894062">"聯絡人相片"</string>
     <string name="description_minus_button" msgid="387136707700230172">"負號"</string>
     <string name="description_plus_button" msgid="515164827856229880">"加號"</string>
-    <!-- outdated translation 1432254751491952259 -->     <string name="no_sdcard_title" product="nosdcard" msgid="5362631473262100989">"沒有可用的共用儲存裝置"</string>
-    <string name="no_sdcard_title" product="default" msgid="5911758680339949273">"無 SD 卡"</string>
-    <!-- outdated translation 545247788569631436 -->     <string name="no_sdcard_message" product="nosdcard" msgid="8045830739790534254">"未偵測到共用儲存裝置"</string>
-    <string name="no_sdcard_message" product="default" msgid="6019391476490445358">"未偵測到 SD 卡"</string>
+    <string name="no_sdcard_title" msgid="5911758680339949273">"無 SD 卡"</string>
+    <string name="no_sdcard_message" msgid="6019391476490445358">"未偵測到 SD 卡"</string>
     <string name="searching_vcard_title" msgid="4970508055399376813">"正在搜尋 VCard"</string>
     <string name="import_from_sim" msgid="3859272228033941659">"從 SIM 卡匯入"</string>
-    <!-- outdated translation 7450489361553523938 -->     <string name="import_from_sdcard" product="nosdcard" msgid="8294728696808674154">"從共用儲存裝置匯入"</string>
-    <string name="import_from_sdcard" product="default" msgid="8550360976693202816">"從 SD 卡匯入"</string>
-    <!-- outdated translation 2322839933356280686 -->     <string name="export_to_sdcard" product="nosdcard" msgid="7201274701382901259">"匯出到共用儲存裝置"</string>
-    <string name="export_to_sdcard" product="default" msgid="2597105442616166277">"匯出至 SD 卡"</string>
+    <string name="import_from_sdcard" msgid="8550360976693202816">"從 SD 卡匯入"</string>
+    <string name="export_to_sdcard" msgid="2597105442616166277">"匯出至 SD 卡"</string>
     <string name="share_visible_contacts" msgid="890150378880783797">"分享正常顯示的聯絡人"</string>
     <string name="import_one_vcard_string" msgid="9059163467020328433">"匯入一個 vCard 檔案"</string>
     <string name="import_multiple_vcard_string" msgid="3810226492811062392">"匯入多個 vCard 檔案"</string>
     <string name="import_all_vcard_string" msgid="5518136113853448474">"匯入所有 vCard 檔案"</string>
-    <!-- outdated translation 8987993391730721760 -->     <string name="searching_vcard_message" product="nosdcard" msgid="8214795338181412751">"正在共用儲存裝置中搜尋 vCard 資料"</string>
-    <string name="searching_vcard_message" product="default" msgid="6917522333561434546">"在 SD 卡上搜尋 VCard 資料"</string>
-    <!-- outdated translation 5451697520220712906 -->     <string name="scanning_sdcard_failed_title" product="nosdcard" msgid="7447077516493667568">"掃描共用儲存裝置失敗"</string>
-    <string name="scanning_sdcard_failed_title" product="default" msgid="3506782007953167180">"無法掃描 SD 卡"</string>
-    <!-- outdated translation 264566842682850873 -->     <string name="scanning_sdcard_failed_message" product="nosdcard" msgid="5645544323676912703">"掃描共用儲存裝置失敗 (原因:「<xliff:g id="FAIL_REASON">%s</xliff:g>」)"</string>
-    <string name="scanning_sdcard_failed_message" product="default" msgid="3761992500690182922">"無法掃描 SD 卡 (原因:「<xliff:g id="FAIL_REASON">%s</xliff:g>」)"</string>
+    <string name="searching_vcard_message" msgid="6917522333561434546">"在 SD 卡上搜尋 VCard 資料"</string>
+    <string name="scanning_sdcard_failed_title" msgid="3506782007953167180">"無法掃描 SD 卡"</string>
+    <string name="scanning_sdcard_failed_message" msgid="3761992500690182922">"無法掃描 SD 卡 (原因:「<xliff:g id="FAIL_REASON">%s</xliff:g>」)"</string>
     <string name="fail_reason_io_error" msgid="5922864781066136340">"I/O 錯誤"</string>
+    <string name="fail_reason_low_memory_during_import" msgid="7514918659342886381">"記憶體不足 (檔案可能過大)"</string>
     <string name="fail_reason_vcard_parse_error" msgid="1201233722762680214">"因未預期原因,無法剖析 VCard"</string>
     <string name="fail_reason_vcard_not_supported_error" msgid="655208100451286027">"VCard 格式正確,但目前的實作系統不支援此格式,因此無法剖析"</string>
-    <!-- outdated translation 6099852462800299180 -->     <string name="fail_reason_no_vcard_file" product="nosdcard" msgid="4231528180481838813">"在共用儲存裝置中找不到 vCard 檔案"</string>
-    <string name="fail_reason_no_vcard_file" product="default" msgid="6376516175882881595">"SD 卡上沒有 vCard 檔案"</string>
+    <string name="fail_reason_no_vcard_file" msgid="6376516175882881595">"SD 卡上沒有 vCard 檔案"</string>
+    <string name="fail_reason_failed_to_collect_vcard_meta_info" msgid="4154492282316067754">"無法從指定的 vCard 檔案收集中繼資料。"</string>
     <string name="fail_reason_failed_to_read_files" msgid="3659521123567134029">"無法匯入一或多個檔案 (%s)。"</string>
     <string name="fail_reason_unknown" msgid="999034019513096768">"未知的錯誤"</string>
     <string name="select_vcard_title" msgid="3968948173786172468">"選取 VCard 檔案"</string>
-    <string name="progress_shower_message" msgid="5636525578293752526">"<xliff:g id="ACTION">%1$s</xliff:g>"\n"<xliff:g id="FILENAME">%2$s</xliff:g>"</string>
-    <string name="reading_vcard_title" msgid="4723433501579653199">"正在讀取 VCard"</string>
-    <string name="reading_vcard_message" msgid="6381368920030748743">"正在讀取 VCard 檔案"</string>
-    <string name="reading_vcard_failed_title" msgid="4923008144735294994">"無法讀取 VCard 資料"</string>
-    <string name="reading_vcard_contacts" msgid="3066834102042012868">"第 <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> 位聯絡人,共 <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> 位"</string>
-    <string name="reading_vcard_files" msgid="34180143726972661">"第 <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> 個檔案,共 <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> 個"</string>
+    <string name="caching_vcard_title" msgid="5009556022082659780">"正在將 vCard 資料快取至本機暫存空間"</string>
+    <string name="caching_vcard_message" msgid="2380844718093378900">"匯入工具正在將 vCard 的資料快取至本機暫存空間,隨即將啟動實際的匯入作業。"</string>
+    <!-- no translation found for progress_notifier_message (2311011466908220528) -->
+    <skip />
+    <!-- no translation found for importing_vcard_description (4245275224298571351) -->
+    <skip />
+    <string name="reading_vcard_failed_title" msgid="2162610359561887043">"無法讀取 vCard 資料"</string>
+    <string name="reading_vcard_canceled_title" msgid="1770608329958463131">"已取消讀取 vCard 資料"</string>
+    <string name="importing_vcard_finished_title" msgid="3213257229785702182">"已結束 vCard 匯入作業"</string>
+    <!-- no translation found for importing_vcard_canceled_title (2963132079200382269) -->
+    <skip />
+    <string name="vcard_importer_start_message" msgid="5520549352987753320">"vCard 匯入工具已啟動。"</string>
+    <string name="vcard_importer_will_start_message" msgid="2055145402481822160">"vCard 匯入工具將於稍後匯入該 vCard。"</string>
+    <string name="percentage" msgid="34897865327092209">"%s%%"</string>
     <string name="confirm_export_title" msgid="7648747763127442983">"確認匯出"</string>
     <string name="confirm_export_message" msgid="3875683519257829750">"確定要將聯絡人清單匯出至「<xliff:g id="VCARD_FILENAME">%s</xliff:g>」嗎?"</string>
     <string name="exporting_contact_failed_title" msgid="585823094820602526">"無法匯出聯絡人資料"</string>
     <string name="exporting_contact_failed_message" msgid="4151348002470298092">"匯出聯絡人資料失敗。"\n"失敗原因:「<xliff:g id="FAIL_REASON">%s</xliff:g>」"</string>
     <string name="fail_reason_no_exportable_contact" msgid="4919714086648344495">"沒有可匯出的聯絡人"</string>
-    <!-- outdated translation 6603952032405558414 -->     <string name="fail_reason_too_many_vcard" product="nosdcard" msgid="2638638826954895225">"共用儲存裝置中的 vCard 檔案過多"</string>
-    <string name="fail_reason_too_many_vcard" product="default" msgid="7084146295639672658">"SD 卡中的 VCard 檔案過多"</string>
+    <string name="fail_reason_too_many_vcard" msgid="7084146295639672658">"SD 卡中的 VCard 檔案過多"</string>
     <string name="fail_reason_too_long_filename" msgid="1915716071321839166">"要求的檔案名稱過長 (「<xliff:g id="FILENAME">%s</xliff:g>」)"</string>
+    <string name="vcard_exporter_start_message" msgid="6497218576519292369">"vCard 匯出工具已啟動。"</string>
+    <string name="exporting_vcard_finished_title" msgid="1268425436375550862">"已結束 vCard 匯出作業"</string>
     <string name="exporting_contact_list_title" msgid="9072240631534457415">"正在匯出聯絡人資料"</string>
     <string name="exporting_contact_list_message" msgid="5640326540405486055">"正在將聯絡人資料匯出至「<xliff:g id="FILE_NAME">%s</xliff:g>」"</string>
     <string name="fail_reason_could_not_initialize_exporter" msgid="4943708332700987376">"無法初始化匯出程式:「<xliff:g id="EXACT_REASON">%s</xliff:g>」"</string>
@@ -253,8 +259,12 @@
     <string name="composer_failed_to_get_database_infomation" msgid="3723109558155169053">"無法取得資料庫資訊"</string>
     <string name="composer_has_no_exportable_contact" msgid="754734132189369094">"沒有可匯出的聯絡人。如果您的手機中確實存有聯絡人資料,這可能是因為某些資料提供者禁止您將所有聯絡人匯出手機。"</string>
     <string name="composer_not_initialized" msgid="8041534450748388843">"VCard 編輯器並未正確初始化"</string>
-    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"無法開啟「<xliff:g id="FILE_NAME">%1$s</xliff:g>」:<xliff:g id="EXACT_REASON">%2$s</xliff:g>"</string>
-    <string name="exporting_contact_list_progress" msgid="560522409559101193">"第 <xliff:g id="CURRENT_NUMBER">%1$s</xliff:g> 位聯絡人,共 <xliff:g id="TOTAL_NUMBER">%2$s</xliff:g> 位"</string>
+    <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"無法開啟「<xliff:g id="FILE_NAME">%s</xliff:g>」:<xliff:g id="EXACT_REASON">%s</xliff:g>"</string>
+    <string name="exporting_contact_list_progress" msgid="560522409559101193">"第 <xliff:g id="CURRENT_NUMBER">%s</xliff:g> 位聯絡人,共 <xliff:g id="TOTAL_NUMBER">%s</xliff:g> 位"</string>
+    <!-- no translation found for cancel_import_confirmation_title (1311741984719347665) -->
+    <skip />
+    <!-- no translation found for cancel_import_confirmation_message (3737315228484332088) -->
+    <skip />
     <string name="search_settings_description" msgid="2675223022992445813">"您的聯絡人姓名"</string>
     <string name="add_2sec_pause" msgid="9214012315201040129">"新增 2 秒暫停功能"</string>
     <string name="add_wait" msgid="3360818652790319634">"新增插播功能"</string>
@@ -264,6 +274,7 @@
     <string name="quickcontact_missing_app" msgid="4600366393134289038">"找不到可以處理這個動作的應用程式"</string>
     <string name="quickcontact_remember_choice" msgid="5964536411579749424">"記住這個選擇"</string>
     <string name="quickcontact_missing_name" msgid="5590266114306996632">"不明"</string>
+    <string name="quickcontact_no_data" msgid="2098000859125253675">"無資料"</string>
     <string name="menu_accounts" msgid="8499114602017077970">"帳戶"</string>
     <string name="menu_import_export" msgid="3765725645491577190">"匯入/匯出"</string>
     <string name="dialog_import_export" msgid="4771877268244096596">"匯入/匯出聯絡人"</string>
@@ -290,7 +301,7 @@
     <string name="display_ungrouped" msgid="4602580795576261158">"所有其他聯絡人"</string>
     <string name="display_all_contacts" msgid="6846131371214707956">"所有聯絡人"</string>
     <string name="display_warn_remove_ungrouped" msgid="2314043155909167610">"如果從同步處理群組中移除「<xliff:g id="GROUP">%s</xliff:g>」群組,系統也會從同步處理群組中移除所有未分組的聯絡人。"</string>
-    <!-- outdated translation 4025734638492419713 -->     <string name="account_phone" msgid="3682950835276226870">"僅儲存於手機 (不會同步處理)"</string>
+    <string name="account_phone" msgid="4025734638492419713">"僅儲存於手機 (不會同步處理)"</string>
     <string name="call_custom" msgid="7756571794763171802">"去電<xliff:g id="CUSTOM">%s</xliff:g>"</string>
     <string name="call_home" msgid="1990519474420545392">"去電住家電話"</string>
     <string name="call_mobile" msgid="7502236805487609178">"去電行動裝置"</string>
@@ -352,6 +363,7 @@
     <string name="chat_icq" msgid="8438405386153745775">"使用 ICQ 進行即時通訊"</string>
     <string name="chat_jabber" msgid="7561444230307829609">"使用 Jabber 進行即時通訊"</string>
     <string name="chat" msgid="9025361898797412245">"即時通訊"</string>
+    <string name="postal_address" msgid="8765560217149624536">"地址"</string>
     <string name="postal_street" msgid="8133143961580058972">"街道"</string>
     <string name="postal_pobox" msgid="4431938829180269821">"郵政信箱"</string>
     <string name="postal_neighborhood" msgid="1450783874558956739">"鄰"</string>
@@ -359,6 +371,7 @@
     <string name="postal_region" msgid="6045263193478437672">"州/省"</string>
     <string name="postal_postcode" msgid="572136414136673751">"郵遞區號"</string>
     <string name="postal_country" msgid="7638264508416368690">"國家/地區"</string>
+    <string name="full_name" msgid="6602579550613988977">"姓名"</string>
     <string name="name_given" msgid="1687286314106019813">"名字"</string>
     <string name="name_family" msgid="3416695586119999058">"姓氏"</string>
     <string name="name_prefix" msgid="59756378548779822">"姓名前稱銜"</string>
@@ -369,6 +382,7 @@
     <string name="name_phonetic_family" msgid="462095502140180305">"姓氏 (拼音)"</string>
     <string name="account_type_format" msgid="718948015590343010">"<xliff:g id="SOURCE">%1$s</xliff:g> 聯絡人"</string>
     <string name="from_account_format" msgid="687567483928582084">"來自 <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="account_type_and_name" msgid="2876220035411512934">"來自 <xliff:g id="SOURCE_1">%2$s</xliff:g> 的 <xliff:g id="SOURCE_0">%1$s</xliff:g> 聯絡人"</string>
     <string name="use_photo_as_primary" msgid="8807110122951157246">"使用此相片"</string>
     <string name="contact_read_only" msgid="1203216914575723978">"無法在此裝置編輯 <xliff:g id="SOURCE">%1$s</xliff:g> 的聯絡人資訊"</string>
     <string name="no_contact_details" msgid="6754415338321837001">"沒有此聯絡人的其他資訊"</string>
@@ -384,9 +398,51 @@
     <string name="pick_photo" msgid="448886509158039462">"從圖片庫選取相片"</string>
     <string name="locale_change_in_progress" msgid="1124266507671178413">"正在更新聯絡人清單以反映語言變更。"\n\n"請稍候..."</string>
     <string name="upgrade_in_progress" msgid="7530893673211750223">"正在更新聯絡人清單。"\n\n"請稍候..."</string>
-    <string name="upgrade_out_of_memory" msgid="492151063059824962">"正在進行聯絡人升級。"\n\n"升級程序需要大約 <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB 的手機內部儲存空間。"\n\n"請選擇下列其中一個選項:"</string>
+    <string name="upgrade_out_of_memory" msgid="6713914687111678777">"正在進行聯絡人升級。"\n\n"升級程序需要大約 <xliff:g id="SIZE_IN_MEGABYTES">%d</xliff:g> MB 的手機內部儲存空間。"\n\n"請選擇下列其中一個選項:"</string>
     <string name="upgrade_out_of_memory_uninstall" msgid="1721798828992091432">"解除安裝一些應用程式"</string>
     <string name="upgrade_out_of_memory_retry" msgid="8431289830472724609">"重試升級"</string>
     <string name="search_results_for" msgid="8705490885073188513">"此項目之搜尋結果:<xliff:g id="QUERY">%s</xliff:g>"</string>
     <string name="search_results_searching" msgid="7755623475227227314">"搜尋中..."</string>
+    <string name="adding_recipients" msgid="5123647646892106631">"載入中..."</string>
+    <string name="menu_display_selected" msgid="6470001164297969034">"顯示已選取的項目"</string>
+    <string name="menu_display_all" msgid="8887488642609786198">"全部顯示"</string>
+    <string name="menu_select_all" msgid="621719255150713545">"全選"</string>
+    <string name="menu_select_none" msgid="7093222469852132345">"全部取消選取"</string>
+  <plurals name="multiple_picker_title">
+    <item quantity="one" msgid="4761009734586319101">"已選取 1 位收件者"</item>
+    <item quantity="other" msgid="4608837420986126229">"已選取 <xliff:g id="COUNT">%d</xliff:g> 位收件者"</item>
+  </plurals>
+    <string name="unknown_contacts_separator" msgid="2490675836664397214">"不明聯絡人"</string>
+    <string name="no_contacts_selected" msgid="5877803471037324613">"未選取任何聯絡人。"</string>
+    <string name="add_field" msgid="5257149039253569615">"新增資訊"</string>
+    <string name="contact_status_update_attribution" msgid="752179367353018597">"透過 <xliff:g id="SOURCE">%1$s</xliff:g>"</string>
+    <string name="contact_status_update_attribution_with_date" msgid="7358045508107825068">"<xliff:g id="DATE">%1$s</xliff:g> (透過 <xliff:g id="SOURCE">%2$s</xliff:g>)"</string>
+    <string name="description_edit" msgid="1601490950771217014">"編輯"</string>
+    <string name="description_star" msgid="2605854427360036550">"我的最愛"</string>
+    <string name="edit_contact" msgid="7529281274005689512">"編輯聯絡人"</string>
+  <plurals name="merge_info">
+    <item quantity="one" msgid="148365587896371969">"未合併"</item>
+    <item quantity="other" msgid="425683718017380845">"從 <xliff:g id="COUNT">%0$d</xliff:g> 個來源合併"</item>
+  </plurals>
+    <string name="edit_delete_rawcontact" msgid="5054644778227879148">"刪除"</string>
+    <string name="edit_error_saving" msgid="2153949392245240166">"儲存時發生錯誤"</string>
+    <string name="edit_structured_editor_button" msgid="3830078388142808106">"..."</string>
+    <string name="local_invisible_directory" msgid="6046691709127661065">"其他"</string>
+    <!-- no translation found for aggregation_suggestion_title:one (7676930148670768645) -->
+    <!-- no translation found for aggregation_suggestion_title:other (3744098467672876675) -->
+    <!-- no translation found for aggregation_suggestion_joined_title (5342738708069602301) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_join_button (7248325487963514260) -->
+    <skip />
+    <!-- no translation found for aggregation_suggestion_view_button (8232061564083962522) -->
+    <skip />
+    <string name="visualScrollerAlphabet" msgid="4697722110414354767">"A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"</string>
+    <!-- no translation found for menu_copyContact (8960980032631007658) -->
+    <skip />
+    <!-- no translation found for contact_directory_description (7071885390570890999) -->
+    <skip />
+    <!-- no translation found for contact_directory_account_description (7674700530474108835) -->
+    <skip />
+    <!-- no translation found for toast_making_personal_copy (7905283986345263275) -->
+    <skip />
 </resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 5f39532..cea3573 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -23,7 +23,16 @@
 
     <color name="edit_divider">#ff666666</color>
     <color name="background_secondary">#ff202020</color>
-    <color name="pinned_header_background">#ff202020</color>
 
     <color name="translucent_search_background">#cc000000</color>
+
+    <!-- Color used in the Aizy visual scroll control for empty section -->
+    <color name="aizy_line_color">#ff689afe</color>
+
+    <!-- Color used for the letter in the A-Z section header -->
+    <color name="section_header_text_color">#ff999999</color>
+
+    <!-- Color used as a selected background for the account/group selection widget -->
+    <color name="filter_selector_selected_background">#66ffffff</color>
+
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 4a7a743..d92154c 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -24,19 +24,26 @@
     <!-- The height of the ScrollingTabWidget -->
     <dimen name="tab_height">40dip</dimen>
     <dimen name="account_name_height">25dip</dimen>
-    
+
     <dimen name="contact_shortcut_frame_width">50dip</dimen>    
     <dimen name="contact_shortcut_frame_height">56dip</dimen>    
+
+    <dimen name="aggregation_suggestion_icon_size">40dip</dimen>
+
+    <dimen name="account_selector_popup_width">400dip</dimen>
+
+    <!-- Size of the text in the aizy visual scroll control -->
+    <dimen name="aizy_text_size">13dip</dimen>
+    <dimen name="aizy_preview_width">80dip</dimen>
+    <dimen name="aizy_preview_height">80dip</dimen>
     
-    <!-- Dimensions for a list item -->
-    <dimen name="list_item_padding_top">4dip</dimen>    
-    <dimen name="list_item_padding_right">11dip</dimen>    
-    <dimen name="list_item_padding_bottom">4dip</dimen>    
-    <dimen name="list_item_padding_left">4dip</dimen>    
-    <dimen name="list_item_gap_between_image_and_text">8dip</dimen>    
-    <dimen name="list_item_gap_between_label_and_data">5dip</dimen>    
-    <dimen name="list_item_call_button_padding">14dip</dimen>    
-    <dimen name="list_item_vertical_divider_margin">5dip</dimen>    
-    <dimen name="list_item_presence_icon_margin">5dip</dimen>    
-    <dimen name="list_item_header_text_width">56dip</dimen>    
+    <!-- Padding of the rounded plus/minus buttons in the editor (the minus button is created
+    in code) -->
+    <dimen name="editor_round_button_padding_left">5dip</dimen>
+    <dimen name="editor_round_button_padding_right">5dip</dimen>
+    <dimen name="editor_round_button_padding_top">10dip</dimen>
+    <dimen name="editor_round_button_padding_bottom">10dip</dimen>
+
+    <!-- Width of the Type-Label in the Editor -->
+    <dimen name="editor_type_label_width">150dip</dimen>
 </resources>
diff --git a/res/values/donottranslate_config.xml b/res/values/donottranslate_config.xml
index f1c6951..e41e153 100644
--- a/res/values/donottranslate_config.xml
+++ b/res/values/donottranslate_config.xml
@@ -18,6 +18,9 @@
 -->
 
 <resources>
+    <!-- Indicates whether the dialer activity is enabled in the build -->
+    <bool name="dialerEnabled">true</bool>
+
     <!-- Flag indicating whether Contacts app is allowed to import contacts from SDCard -->
     <bool name="config_allow_import_from_sdcard">true</bool>
     <!-- If true, all vcard files are imported from SDCard without asking a user.
@@ -53,7 +56,7 @@
     <string name="config_export_vcard_type" translatable="false">default</string>
 
     <!-- Directory in which exported VCard file is stored -->
-    <string name="config_export_dir" translatable="false">/sdcard</string>
+    <string name="config_export_dir" translatable="false">/mnt/sdcard</string>
 
     <!-- Prefix of exported VCard file -->
     <string name="config_export_file_prefix" translatable="false"></string>
diff --git a/res/values/ids.xml b/res/values/ids.xml
index ceb10f8..1b381ab 100644
--- a/res/values/ids.xml
+++ b/res/values/ids.xml
@@ -14,32 +14,50 @@
      limitations under the License.
 -->
 <resources>
-    <!-- The EditText for entries in the EditContactActivity -->
+    <!-- The EditText for entries in the ContactEditFragment -->
     <item type="id" name="data"/>
     <item type="id" name="header_phones"/>
     <item type="id" name="dialog_sync_add"/>
     <item type="id" name="dialog_import_export"/>
 
-    <!-- For ImportVCardActivity -->
+    <!-- For vcard.ImportVCardActivity -->
     <item type="id" name="dialog_searching_vcard"/>
     <item type="id" name="dialog_sdcard_not_found"/>
     <item type="id" name="dialog_vcard_not_found"/>
     <item type="id" name="dialog_select_import_type"/>
     <item type="id" name="dialog_select_one_vcard"/>
     <item type="id" name="dialog_select_multiple_vcard"/>
-    <item type="id" name="dialog_reading_vcard"/>
+    <item type="id" name="dialog_cache_vcard"/>
     <item type="id" name="dialog_io_exception"/>
     <item type="id" name="dialog_error_with_message"/>
 
-    <!-- For ContactsListActivity -->
-    <item type="id" name="dialog_delete_contact_confirmation"/>
-    <item type="id" name="dialog_readonly_contact_hide_confirmation"/>
-    <item type="id" name="dialog_multiple_contact_delete_confirmation"/>
-    <item type="id" name="dialog_readonly_contact_delete_confirmation"/>
+    <!-- For vcard.CancelImportActivity -->
+    <item type="id" name="dialog_cancel_import_confirmation"/>
 
-    <!-- For ExportVCard -->
+    <!-- For ContactDeletionInteraction -->
+    <item type="id" name="dialog_delete_contact_confirmation"/>
+
+    <!-- For ImportExportInteraction -->
+    <item type="id" name="dialog_import_export_options"/>
+
+    <!-- For ExportVCardActivity -->
     <item type="id" name="dialog_export_confirmation"/>
     <item type="id" name="dialog_exporting_vcard"/>
     <item type="id" name="dialog_fail_to_export_with_reason"/>
 
+    <!-- For PhoneNumberInteraction -->
+    <item type="id" name="dialog_phone_number_call_disambiguation"/>
+
+    <!-- For PhoneNumberMessageSendInteraction -->
+    <item type="id" name="dialog_phone_number_message_disambiguation"/>
+
+    <!-- Dialog Manager Ids -->
+    <item type="id" name="dialog_manager_id_1"/>
+    <item type="id" name="dialog_manager_id_2"/>
+
+    <!-- ContactDetailFragment ContextMenu Ids -->
+    <item type="id" name="menu_detail_makeDefault" />
+
+    <!-- Loader ID for contact filters -->
+    <item type="id" name="contact_list_filter_loader" />
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5d275aa..cd39508 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -47,6 +47,9 @@
     <!-- Activity title when the user is selecting a contact for a direct message shortcut. -->
     <string name="messageShortcutActivityTitle">Choose a number to message</string>
 
+    <!-- Activity title when the user is selecting a contact.  [CHAR LIMIT=128] -->
+    <string name="contactPickerActivityTitle">Select a contact</string>
+
     <!-- Title for the activity that shows only starred contacts -->
     <string name="starredList">Starred</string>
 
@@ -68,6 +71,12 @@
          editing a contact. This string represents the built in way to edit the contact. -->
     <string name="editContactDescription">Edit contact</string>
 
+    <!-- The caption in the edit-email screen -->
+    <string name="edit_email_caption">Email address:</string>
+
+    <!-- The caption of the custom type -->
+    <string name="edit_email_type_caption">Type:</string>
+
     <!-- The description presented to the user in the Intent choose when there are multiple activities that allow
          creating a new contact. This string represents the built in way to create the contact. -->
     <string name="insertContactDescription">Create contact</string>
@@ -219,9 +228,6 @@
          list that allows the user to create a new contact, which this string is used for -->
     <string name="pickerNewContactHeader">Create new contact</string>
 
-    <!-- Dialog title when you select a label when creating or edit a contact -->
-    <string name="selectLabel">Select label</string>
-
     <!-- Header that expands to list all of the types of phone numbers when editing or creating a phone number for a contact -->
     <string name="phoneLabelsGroup">Phone</string>
 
@@ -232,7 +238,7 @@
     <string name="imLabelsGroup">IM</string>
 
     <!-- Header that expands to list all of the types of postal addresses when editing or creating an postal address for a contact -->
-    <string name="postalLabelsGroup">Postal address</string>
+    <string name="postalLabelsGroup">Address</string>
 
     <!-- The order of the items below is important, don't reorder without changing EditContactActivity.java -->
     <skip/>
@@ -254,12 +260,6 @@
          For example, this may be used to set a phone number's label to "Vaction house" -->
     <string name="customLabelPickerTitle">Custom label name</string>
 
-    <!-- The menu item to open the list of groups to display -->
-    <string name="menu_displayGroup">Display options</string>
-
-    <!-- Title of activity that lets user pick which contact groups to display -->
-    <string name="displayGroups">Display options</string>
-
     <!-- Check box label that allows calls to the contact to be sent directly to voicemail -->
     <string name="send_to_voicemail_checkbox">Send calls directly to voicemail</string>
 
@@ -314,8 +314,8 @@
 
     <!-- Displayed at the top of the contacts showing the total number of contacts visible when "Only contacts with phones" is selected -->
     <plurals name="listTotalPhoneContacts">
-        <item quantity="one">Displaying 1 contact with phone number</item>
-        <item quantity="other">Displaying <xliff:g id="count">%d</xliff:g> contacts with phone numbers</item>
+        <item quantity="one">1 contact with phone number</item>
+        <item quantity="other"><xliff:g id="count">%d</xliff:g> contacts with phone numbers</item>
     </plurals>
 
     <!-- Displayed at the top of the contacts showing the zero as total number of contacts visible when "Only contacts with phones" is selected -->
@@ -323,8 +323,8 @@
 
     <!-- Displayed at the top of the contacts showing the total number of contacts visible when "Only contacts with phones" not selected -->
     <plurals name="listTotalAllContacts">
-        <item quantity="one">Displaying 1 contact</item>
-        <item quantity="other">Displaying <xliff:g id="count">%d</xliff:g> contacts</item>
+        <item quantity="one">1 contact</item>
+        <item quantity="other"><xliff:g id="count">%d</xliff:g> contacts</item>
     </plurals>
 
     <!-- Displayed at the top of the contacts showing the zero total number of contacts visible when "Only contacts with phones" not selected -->
@@ -332,17 +332,20 @@
 
     <!-- Displayed at the top of the contacts showing the total number of contacts found when "Only contacts with phones" not selected -->
     <plurals name="listFoundAllContacts">
-        <item quantity="one">Found 1 contact</item>
-        <item quantity="other">Found <xliff:g id="count">%d</xliff:g> contacts</item>
+        <item quantity="one">1 found</item>
+        <item quantity="other"><xliff:g id="count">%d</xliff:g> found</item>
     </plurals>
 
+    <!-- Displayed at the top of search results indicating that more contacts were found than shown [CHAR LIMIT=64] -->
+    <string name="foundTooManyContacts">more than <xliff:g id="count">%d</xliff:g> found</string>
+
     <!-- Displayed at the top of the contacts showing the zero total number of contacts found when "Only contacts with phones" not selected -->
-    <string name="listFoundAllContactsZero">Contact not found</string>
+    <string name="listFoundAllContactsZero">Not found</string>
 
     <!-- Displayed at the top of the contacts showing the total number of contacts found when typing search query -->
     <plurals name="searchFoundContacts">
-        <item quantity="one">1 contact</item>
-        <item quantity="other"><xliff:g id="count">%d</xliff:g> contacts</item>
+        <item quantity="one">1 found</item>
+        <item quantity="other"><xliff:g id="count">%d</xliff:g> found</item>
     </plurals>
 
     <!-- The description text for the contacts tab. Space is limited for this string, so the shorter the better -->
@@ -431,7 +434,7 @@
     <string name="noContactsHelpText">"You don't have any contacts to display.\n\nTo add contacts, press <font fgcolor="#ffffffff"><b>Menu</b></font> and touch:\n
         \n<li><font fgcolor="#ffffffff"><b>Accounts</b></font> to add or configure an account with contacts you can sync to the phone\n</li>
         \n<li><font fgcolor="#ffffffff"><b>New contact</b></font> to create a new contact from scratch\n</li>
-        \n<li><font fgcolor="#ffffffff"><b>Import/Export</b></font>\n</li>"
+        \n<li><font fgcolor="#ffffffff"><b>Import/Export</b></font> to import contacts from your SIM or SD card\n</li>"
     </string>
 
     <!-- Displayed full screen when the user has no contacts and they are displaying the My Contacts group, and contact syncing is enabled -->
@@ -439,14 +442,14 @@
         \n<li><font fgcolor="#ffffffff"><b>Accounts</b></font> to add or configure an account with contacts you can sync to the phone\n</li>
         \n<li><font fgcolor="#ffffffff"><b>Display options</b></font> to change which contacts are visible\n</li>
         \n<li><font fgcolor="#ffffffff"><b>New contact</b></font> to create a new contact from scratch\n</li>
-        \n<li><font fgcolor="#ffffffff"><b>Import/Export</b></font>\n</li>"
+        \n<li><font fgcolor="#ffffffff"><b>Import/Export</b></font> to import contacts from your SIM or SD card\n</li>"
     </string>
 
     <!-- Displayed full screen when the user has no contacts and they are displaying the My Contacts group, and contact syncing is disabled, and there is no sim card (cdma)-->
     <string name="noContactsNoSimHelpText">"You don't have any contacts to display.\n\nTo add contacts, press <font fgcolor="#ffffffff"><b>Menu</b></font> and touch:\n
         \n<li><font fgcolor="#ffffffff"><b>Accounts</b></font> to add or configure an account with contacts you can sync to the phone\n</li>
         \n<li><font fgcolor="#ffffffff"><b>New contact</b></font> to create a new contact from scratch\n</li>
-        \n<li><font fgcolor="#ffffffff"><b>Import/Export</b></font>\n</li>"
+        \n<li><font fgcolor="#ffffffff"><b>Import/Export</b></font> to import contacts from your SD card\n</li>"
     </string>
 
     <!-- Displayed full screen when the user has no contacts and they are displaying the My Contacts group, and contact syncing is enabled, and there is no sim card (cdma) -->
@@ -454,7 +457,7 @@
         \n<li><font fgcolor="#ffffffff"><b>Accounts</b></font> to add or configure an account with contacts you can sync to the phone\n</li>
         \n<li><font fgcolor="#ffffffff"><b>Display options</b></font> to change which contacts are visible\n</li>
         \n<li><font fgcolor="#ffffffff"><b>New contact</b></font> to create a new contact from scratch\n</li>
-        \n<li><font fgcolor="#ffffffff"><b>Import/Export</b></font>\n</li>"
+        \n<li><font fgcolor="#ffffffff"><b>Import/Export</b></font> to import contacts from your SD card\n</li>"
     </string>
 
     <!-- Displayed full screen when the user has no favorites and they are displaying the favorites tab -->
@@ -519,7 +522,7 @@
     <string name="returnCall">Return call</string>
 
     <!-- A nicely formatted call duration displayed when viewing call details. For example "42 mins 28 secs" -->
-    <string name="callDetailsDurationFormat"><xliff:g id="minutes" example="42">%1$s</xliff:g> mins <xliff:g id="seconds" example="28">%2$s</xliff:g> secs</string>
+    <string name="callDetailsDurationFormat"><xliff:g id="minutes" example="42">%s</xliff:g> mins <xliff:g id="seconds" example="28">%s</xliff:g> secs</string>
 
     <!-- A list separator for the Favorites tab indicating that items below it are frequently contacted contacts rather than starred contacts -->
     <string name="favoritesFrquentSeparator">Frequently contacted</string>
@@ -669,7 +672,7 @@
     <!-- Dialog message shown when SDcard does not exist -->
     <string name="no_sdcard_message" product="default">No SD card detected</string>
 
-    <!-- Dialog title shown when searching VCard data from SD Card -->
+    <!-- Dialog title shown when searching vCard data from SD Card -->
     <string name="searching_vcard_title">Searching for vCard</string>
 
     <!-- Action string for selecting SIM for importing contacts -->
@@ -724,6 +727,10 @@
          emitted some I/O error. Exact reason will be appended by the system. -->
     <string name="fail_reason_io_error">I/O Error</string>
 
+    <!-- Failure reason show when Contacts app (especially vCard importer) encountered
+         low memory problem and could not proceed its import procedure. -->
+    <string name="fail_reason_low_memory_during_import">Memory is insufficient (the file may be too large)</string>
+
     <!-- The failed reason shown when vCard parser was not able to be parsed by the current vCard
          implementation. This might happen even when the input vCard is completely valid, though
          we believe it is rather rare in the actual world. -->
@@ -742,6 +749,9 @@
          (with extension ".vcf" in SDCard.) -->
     <string name="fail_reason_no_vcard_file" product="default">No vCard file found on the SD card</string>
 
+    <!-- Fail reason shown when vCard importer failed to look over meta information stored in vCard file(s). -->
+    <string name="fail_reason_failed_to_collect_vcard_meta_info">Failed to collect meta information of given vCard file(s).</string>
+
     <!-- The failed reason shown when the import of some of vCard files failed during multiple vCard
          files import. It includes the case where all files were failed to be imported. -->
     <string name="fail_reason_failed_to_read_files">One or more files failed to be imported (%s).</string>
@@ -749,28 +759,51 @@
     <!-- The failed reason which should not be shown but it may in some buggy condition. -->
     <string name="fail_reason_unknown">Unknown error</string>
 
-    <!-- Dialog title shown when a user is asked to select VCard file -->
+    <!-- Dialog title shown when a user is asked to select vCard file -->
     <string name="select_vcard_title">Select vCard file</string>
 
-    <!-- The message shown while reading a vCard file/entry. The first argument is like
-    "Reading VCard" or "Reading VCard files" and the second is the display name of the current
-    data being parsed -->
-    <string name="progress_shower_message"><xliff:g id="action" example="Reading VCard">%1$s</xliff:g>\n<xliff:g id="filename" example="foo.vcf">%2$s</xliff:g></string>
+    <!-- The title shown when vCard importer is caching files to be imported into local temporary
+         data storage. -->
+    <string name="caching_vcard_title">Caching vCard(s) to local temporary storage</string>
 
-    <!-- Dialog title shown when reading VCard data -->
-    <string name="reading_vcard_title">Reading vCard</string>
+    <!-- The message shown when vCard importer is caching files to be imported into local temporary
+         data storage. -->
+    <string name="caching_vcard_message">Importer is caching vCard(s) to local temporary storage. Actual import will start soon.</string>
 
-    <!-- Dialog message shown when reading a VCard file -->
-    <string name="reading_vcard_message">Reading vCard file(s)</string>
+    <!-- The message shown while importing vCard(s).
+         First argument is current index of contacts to be imported.
+         Second argument is the total number of contacts.
+         Third argument is the name of a contact which is being read.
+         [CHAR LIMIT=20] -->
+    <string name="progress_notifier_message">Importing <xliff:g id="current_number">%s</xliff:g>/<xliff:g id="total_number">%s</xliff:g>: <xliff:g id="name" example="Joe Due">%s</xliff:g></string>
 
-    <!-- Dialog title shown when reading VCard data failed -->
-    <string name="reading_vcard_failed_title">Reading of vCard data has failed</string>
+    <!-- Description shown when importing vCard data.
+         The argument is the name of a contact which is being read.
+         [CHAR LIMIT=20] -->
+    <string name="importing_vcard_description">Importing <xliff:g id="name" example="Joe Due">%s</xliff:g></string>
 
-    <!-- Message while reading one vCard file "(current number) of (total number) contacts" The order of "current number" and "total number" cannot be changed (like "total: (total number), current: (current number)")-->
-    <string name="reading_vcard_contacts"><xliff:g id="current_number">%1$s</xliff:g> of <xliff:g id="total_number">%2$s</xliff:g> contacts</string>
+    <!-- Dialog title shown when reading vCard data failed [CHAR LIMIT=40] -->
+    <string name="reading_vcard_failed_title">Failed to Read vCard data</string>
 
-    <!-- Message while reading multiple vCard files "(current number) of (total number) files" The order of "current number" and "total number" cannot be changed (like "total: (total number), current: (current number)")-->
-    <string name="reading_vcard_files"><xliff:g id="current_number">%1$s</xliff:g> of <xliff:g id="total_number">%2$s</xliff:g> files</string>
+    <!-- The title shown when reading vCard is canceled (probably by a user)
+         [CHAR LIMIT=40] -->
+    <string name="reading_vcard_canceled_title">Reading vCard data was canceled</string>
+
+    <!-- The title shown when reading vCard finished -->
+    <string name="importing_vcard_finished_title">Finished importing vCard</string>
+
+    <!-- The title shown when importing vCard is canceled (probably by a user)
+         [CHAR LIMIT=40] -->
+    <string name="importing_vcard_canceled_title">Reading vCard data was canceled</string>
+
+    <!-- The message shown when vCard importer started running. -->
+    <string name="vcard_importer_start_message">vCard importer started.</string>
+
+    <!-- The message shown when additional vCard to be imported is given during the import for others -->
+    <string name="vcard_importer_will_start_message">vCard importer will import the vCard after a while.</string>
+
+    <!-- The percentage, used for expressing the progress of vCard import/export. -->
+    <string name="percentage">%s%%</string>
 
     <!-- Dialog title shown when a user confirms whether he/she export Contact data -->
     <string name="confirm_export_title">Confirm export</string>
@@ -801,6 +834,12 @@
          mention it here. -->
     <string name="fail_reason_too_long_filename">Required filename is too long (\"<xliff:g id="filename">%s</xliff:g>\")</string>
 
+    <!-- The message shown when vCard importer started running. -->
+    <string name="vcard_exporter_start_message">vCard exporter started.</string>
+
+    <!-- The title shown when reading vCard is canceled (probably by a user) -->
+    <string name="exporting_vcard_finished_title">Finished exporting vCard</string>
+
     <!-- Dialog title shown when the application is exporting contact data outside -->
     <string name="exporting_contact_list_title">Exporting contact data</string>
 
@@ -831,10 +870,19 @@
 
     <!-- The failed reason shown when vCard importer/exporter could not open the file
          specified by a user. The file name should be in the message. -->
-    <string name="fail_reason_could_not_open_file">Could not open \"<xliff:g id="file_name">%1$s</xliff:g>\": <xliff:g id="exact_reason">%2$s</xliff:g></string>
+    <string name="fail_reason_could_not_open_file">Could not open \"<xliff:g id="file_name">%s</xliff:g>\": <xliff:g id="exact_reason">%s</xliff:g></string>
 
     <!-- Message in progress bar while exporting contact list to a file "(current number) of (total number) contacts" The order of "current number" and "total number" cannot be changed (like "total: (total number), current: (current number)")-->
-    <string name="exporting_contact_list_progress"><xliff:g id="current_number">%1$s</xliff:g> of <xliff:g id="total_number">%2$s</xliff:g> contacts</string>
+    <string name="exporting_contact_list_progress"><xliff:g id="current_number">%s</xliff:g> of <xliff:g id="total_number">%s</xliff:g> contacts</string>
+
+    <!-- Title shown in a Dialog confirming a user's cancel request toward existing vCard import. [CHAR LIMIT=40] -->
+    <string name="cancel_import_confirmation_title">Canceling import vCard</string>
+
+    <!-- Message shown in a Dialog confirming a user's cancel request toward existing vCard import.
+         The argument is the Uri for the vCard import the user wants to cancel.
+         [CHAR LIMIT=70]
+      -->
+    <string name="cancel_import_confirmation_message">Are you sure to cancel importing vCard?</string>
 
     <!-- The string used to describe Contacts as a searchable item within system search settings. -->
     <string name="search_settings_description">Names of your contacts</string>
@@ -895,6 +943,8 @@
     <string name="websiteLabelsGroup">Website</string>
     <!-- Header that expands to list all event types when editing an event of a contact -->
     <string name="eventLabelsGroup">Event</string>
+    <!-- Header for the list of all groups for a contact -->
+    <string name="groupsLabel">Groups</string>
 
     <!-- Single-character overlay for home phone numbers when creating desktop shortcuts -->
     <string name="type_short_home">H</string>
@@ -1066,6 +1116,8 @@
     <!-- Generic action string for starting an IM chat -->
     <string name="chat">Chat</string>
 
+    <!-- Field title for the full postal address of a contact [CHAR LIMIT=64]-->
+    <string name="postal_address">Address</string>
     <!-- Field title for the street of a structured postal address of a contact -->
     <string name="postal_street">Street</string>
     <!-- Field title for the PO box of a structured postal address of a contact -->
@@ -1081,6 +1133,8 @@
     <!-- Field title for the country of a structured postal address of a contact -->
     <string name="postal_country">Country</string>
 
+    <!-- Field title for the full name of a contact [CHAR LIMIT=64]-->
+    <string name="full_name">Name</string>
     <!-- Field title for the given name of a contact -->
     <string name="name_given">Given name</string>
     <!-- Field title for the family name of a contact -->
@@ -1104,6 +1158,9 @@
     <!-- String describing which account a contact came from when editing it -->
     <string name="from_account_format">from <xliff:g id="source" example="user@gmail.com">%1$s</xliff:g></string>
 
+    <!-- String describing both account type and account name -->
+    <string name="account_type_and_name"><xliff:g id="source" example="Gmail">%1$s</xliff:g> contact from <xliff:g id="source" example="user@gmail.com">%2$s</xliff:g></string>
+
     <!-- Checkbox asking the user if they want to display a particular photo for a contact -->
     <string name="use_photo_as_primary">Use this photo</string>
 
@@ -1165,4 +1222,152 @@
 
     <!-- Title shown in the search result activity of contacts app while searching -->
     <string name="search_results_searching">Searching...</string>
+
+    <!-- Message of progress dialog for multiple picker -->
+    <string name="adding_recipients">"Loading \u2026"</string>
+
+    <!-- Label to display only selection in multiple picker -->
+    <string name="menu_display_selected">"Show selected"</string>
+
+    <!-- Label to display all recipients in multiple picker -->
+    <string name="menu_display_all">"Show all"</string>
+
+    <!-- Label to select all contacts in multiple picker -->
+    <string name="menu_select_all">"Select all"</string>
+
+    <!-- Label to clear all selection in multiple picker -->
+    <string name="menu_select_none">"Unselect all"</string>
+
+    <!-- Label to display how many selected in multiple picker -->
+    <plurals name="multiple_picker_title">
+        <!-- number of selected recipients is one -->
+        <item quantity="one">"1 recipient selected"</item>
+        <!-- number of selected recipients is not equal to one -->
+        <item quantity="other"><xliff:g id="count">%d</xliff:g>" recipients selected"</item>
+    </plurals>
+
+    <!-- Separator label to display unknown recipients in multiple picker -->
+    <string name="unknown_contacts_separator">"Unknown contacts"</string>
+
+    <!-- The text displayed when the contacts list is empty while displaying only selected contacts in multiple picker -->
+    <string name="no_contacts_selected">"No contacts selected."</string>
+
+    <!-- The add field button shown in the editor under each editable Raw Contact -->
+    <string name="add_field">Add information</string>
+
+    <!-- Attbution of a contact status update, when the time of update is unknown -->
+    <string name="contact_status_update_attribution">via <xliff:g id="source" example="Google Talk">%1$s</xliff:g></string>
+
+    <!-- Attbution of a contact status update, when the time of update is known -->
+    <string name="contact_status_update_attribution_with_date"><xliff:g id="date" example="3 hours ago">%1$s</xliff:g> via <xliff:g id="source" example="Google Talk">%2$s</xliff:g></string>
+
+    <!-- String describing the Edit push button
+
+         Used by AccessibilityService to announce the purpose of the view.
+    -->
+    <string name="description_edit">edit</string>
+
+    <!-- String describing the Star/Favorite checkbox
+
+         Used by AccessibilityService to announce the purpose of the view.
+    -->
+    <string name="description_star">favorite</string>
+
+    <!-- The title of the Edit-Contact screen -->
+    <string name="edit_contact">Edit contact</string>
+
+    <!-- Shows how many contacts have been merged. The value 1 is not shown but should be translated
+         anyway if we change our mind later -->
+    <plurals name="merge_info">
+        <item quantity="one">not merged</item>
+        <item quantity="other">merged from <xliff:g id="count">%0$d</xliff:g> sources</item>
+    </plurals>
+
+    <!-- Command to delete a RawContact (a Fragment of a Contact) -->
+    <string name="edit_delete_rawcontact">Delete</string>
+
+    <!-- Shown in a Toast to indicate an error while trying to save the Data -->
+    <string name="edit_error_saving">Error saving</string>
+
+    <!-- Text in the editor to show the structured editor -->
+    <string name="edit_structured_editor_button">...</string>
+
+    <!-- The name of the invisible local contact directory -->
+    <string name="local_invisible_directory">Other</string>
+
+    <!-- The heading of the contact aggregation suggestions section in Contact editor. [CHAR LIMIT=128]-->
+    <plurals name="aggregation_suggestion_title">
+        <item quantity="one">Similar contact</item>
+        <item quantity="other">Similar contacts</item>
+    </plurals>
+
+    <!-- The heading of the aggregation suggestion section of the Contact editor
+        indicating the contact that will be joined with the current contact. [CHAR LIMIT=128]-->
+    <string name="aggregation_suggestion_joined_title">Joined contact:</string>
+
+    <!-- The button next to a contact aggregation suggestion in Contact editor. Causes a logical
+      join with the suggested contact. [CHAR LIMIT=12]-->
+    <string name="aggregation_suggestion_join_button">Join</string>
+
+    <!-- The button next to a contact aggregation suggestion in Contact editor. Causes the UI
+    to switch to the suggested contact in the editor. [CHAR LIMIT=12]-->
+    <string name="aggregation_suggestion_edit_button">Edit</string>
+
+    <!-- The menu item (or button) that creates a local copy of a corporate contact. [CHAR LIMIT=40]-->
+    <string name="menu_copyContact">Copy to my contacts</string>
+
+    <!-- The description of the directory where the contact was found [CHAR LIMIT=100]-->
+    <string name="contact_directory_description">from <xliff:g id="type" example="Corporate Directory">%1$s</xliff:g></string>
+
+    <!-- The description of the directory where the contact was found [CHAR LIMIT=100]-->
+    <string name="contact_directory_account_description">from <xliff:g id="type" example="Corporate Directory">%1$s</xliff:g> (<xliff:g id="name" example="me@acme.com">%2$s</xliff:g>)</string>
+
+    <!-- The label displayed in the Contacts action bar when in search mode [CHAR LIMIT=64] -->
+    <string name="search_label">Searching all contacts</string>
+
+    <!-- The label in section header in the contact list for a contact directory [CHAR LIMIT=128] -->
+    <string name="directory_search_label">Directory</string>
+
+    <!-- The label in section header in the contact list for a local contacts [CHAR LIMIT=128] -->
+    <string name="local_search_label">Contacts</string>
+
+    <!-- Toast shown when creating a personal copy of a contact [CHAR LIMIT=100] -->
+    <string name="toast_making_personal_copy">Creating a personal copy</string>
+
+    <!-- Prompt for selection of a contact list filter [CHAR LIMIT=64] -->
+    <string name="list_filter_prompt">Choose contact list</string>
+
+    <!-- Contact list filter label indicating that the list is showing all available accounts [CHAR LIMIT=64] -->
+    <string name="list_filter_all_accounts">All contacts</string>
+
+    <!-- Contact list filter label indicating that the list is showing all starred contacts [CHAR LIMIT=64] -->
+    <string name="list_filter_all_starred">Starred</string>
+
+    <!-- Contact list filter label indicating that the list is showing starred contacts for the account [CHAR LIMIT=64] -->
+    <string name="list_filter_starred">Starred</string>
+
+    <!-- Contact list filter indicating that the list shows groups chosen by the user [CHAR LIMIT=64] -->
+    <string name="list_filter_custom">Custom</string>
+
+    <!-- Contact list filter selection indicating that the list shows groups chosen by the user [CHAR LIMIT=64] -->
+    <string name="list_filter_customize">Customize...</string>
+
+    <!-- Contact list filter selection indicating that the list shows all contacts with phone numbers [CHAR LIMIT=64] -->
+    <string name="list_filter_phones">Contacts with phone numbers</string>
+
+    <!-- Title of the activity that allows the user to customize filtering of contact list [CHAR LIMIT=128] -->
+    <string name="custom_list_filter">Define custom view</string>
+
+    <!-- Title of the settings activity [CHAR LIMIT=64] -->
+    <string name="activity_title_settings">Settings</string>
+
+    <!-- Menu item for the settings activity [CHAR LIMIT=64] -->
+    <string name="menu_settings">Settings</string>
+
+    <!-- The preference section title for contact display options [CHAR LIMIT=128] -->
+    <string name="preference_displayOptions">Display options</string>
+
+    <!-- Text used to show a organization that has both a company and title. This is used in the Detail-View
+    of a Contact. This is mostly about the formatting of the two elements, so it should be kept small [CHAR LIMIT=79] -->
+    <string name="organization_company_and_title"><xliff:g id="company" example="Technical Program Manager">%2$s</xliff:g>, <xliff:g id="company" example="Google Inc.">%1$s</xliff:g></string>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ad4f4f6..5f64e27 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -24,16 +24,9 @@
         <item name="android:windowAnimationStyle">@style/ContactsSearchAnimation</item>
     </style>
 
-    <style name="MinusButton">
+    <!-- TODO: Once there are assets for More/Less buttons, remove these styles -->
+    <style name="EmptyButton">
         <item name="android:background">@drawable/btn_circle</item>
-        <item name="android:src">@drawable/ic_btn_round_minus</item>
-        <item name="android:contentDescription">@string/description_minus_button</item>
-    </style>
-
-    <style name="PlusButton">
-        <item name="android:background">@drawable/btn_circle</item>
-        <item name="android:src">@drawable/ic_btn_round_plus</item>
-        <item name="android:contentDescription">@string/description_plus_button</item>
     </style>
 
     <style name="MoreButton">
@@ -46,7 +39,13 @@
         <item name="android:src">@drawable/ic_btn_round_less</item>
     </style>
 
-    <style name="TallTitleBarTheme" parent="android:Theme.NoTitleBar">
+    <style name="CallDetailActivityTheme" parent="android:Theme.NoTitleBar">
+        <item name="android:windowContentOverlay">@null</item>
+    </style>
+    <style name="ContactDetailActivityTheme" parent="android:Theme.NoTitleBar">
+        <item name="android:windowContentOverlay">@null</item>
+    </style>
+    <style name="ContactEditorActivityTheme" parent="android:Theme.NoTitleBar">
         <item name="android:windowContentOverlay">@null</item>
     </style>
 
@@ -97,7 +96,119 @@
         <item name="android:windowExitAnimation">@anim/search_bar_exit</item>
     </style>
 
+    <style name="AizyPreviewPopupAnimation"> 
+        <item name="android:windowEnterAnimation">@anim/aizy_preview_popup_enter</item> 
+        <item name="android:windowExitAnimation">@anim/aizy_preview_popup_exit</item> 
+    </style> 
+
     <style name="DummyAnimation">
         <item name="android:windowExitAnimation">@anim/dummy_animation</item>
     </style>
+
+    <declare-styleable name="ContactBrowser">
+        <attr name="contact_filter_popup_width" format="dimension"/>
+    </declare-styleable>
+
+    <declare-styleable name="ContactListItemView">
+        <!-- An attribute that specifies a custom drawable for the pressed state in the contact list-->
+        <attr name="pressedBackground" format="reference"/>
+        <attr name="section_header_background" format="reference"/>
+        <attr name="list_item_divider" format="reference"/>
+        <attr name="list_item_padding_top" format="dimension"/>
+        <attr name="list_item_padding_right" format="dimension"/>
+        <attr name="list_item_padding_bottom" format="dimension"/>
+        <attr name="list_item_padding_left" format="dimension"/>
+        <attr name="list_item_gap_between_image_and_text" format="dimension"/>
+        <attr name="list_item_gap_between_label_and_data" format="dimension"/>
+        <attr name="list_item_call_button_padding" format="dimension"/>
+        <attr name="list_item_vertical_divider_margin" format="dimension"/>
+        <attr name="list_item_presence_icon_margin" format="dimension"/>
+        <attr name="list_item_header_text_width" format="dimension"/>
+        <attr name="list_item_photo_size" format="dimension"/>
+        <attr name="list_item_prefix_highlight_color" format="color"/>
+    </declare-styleable>
+
+    <declare-styleable name="MultiplePhonePickerItemView">
+        <attr name="list_item_header_chip_width" format="dimension"/>
+        <attr name="list_item_header_chip_right_margin" format="dimension"/>
+        <attr name="list_item_header_checkbox_margin" format="dimension"/>
+    </declare-styleable>
+
+    <style name="ContactBrowserTheme" parent="@android:Theme">
+        <item name="pressedBackground">@*android:drawable/list_selector_background</item>
+        <item name="section_header_background">@drawable/section_header</item>
+        <item name="list_item_divider">@drawable/list_item_divider</item>
+        <item name="list_item_padding_top">4dip</item>
+        <item name="list_item_padding_right">11dip</item>
+        <item name="list_item_padding_bottom">4dip</item>
+        <item name="list_item_padding_left">4dip</item>
+        <item name="list_item_gap_between_image_and_text">8dip</item>
+        <item name="list_item_gap_between_label_and_data">5dip</item>
+        <item name="list_item_call_button_padding">14dip</item>
+        <item name="list_item_vertical_divider_margin">5dip</item>
+        <item name="list_item_presence_icon_margin">5dip</item>
+        <item name="list_item_header_text_width">56dip</item>
+        <item name="list_item_photo_size">56dip</item>
+        <item name="list_item_prefix_highlight_color">#729a27</item>
+        <item name="contact_filter_popup_width">320dip</item>
+    </style>
+
+    <style name="ContactPickerTheme" parent="@android:Theme">
+        <item name="section_header_background">@drawable/section_header</item>
+        <item name="list_item_divider">@drawable/list_item_divider</item>
+        <item name="list_item_padding_top">4dip</item>
+        <item name="list_item_padding_right">11dip</item>
+        <item name="list_item_padding_bottom">4dip</item>
+        <item name="list_item_padding_left">4dip</item>
+        <item name="list_item_gap_between_image_and_text">8dip</item>
+        <item name="list_item_gap_between_label_and_data">5dip</item>
+        <item name="list_item_call_button_padding">14dip</item>
+        <item name="list_item_vertical_divider_margin">5dip</item>
+        <item name="list_item_presence_icon_margin">5dip</item>
+        <item name="list_item_header_text_width">56dip</item>
+        <item name="list_item_photo_size">56dip</item>
+        <item name="list_item_prefix_highlight_color">#729a27</item>
+        <item name="list_item_header_chip_width">4dip</item>
+        <item name="list_item_header_chip_right_margin">4dip</item>
+        <item name="list_item_header_checkbox_margin">5dip</item>
+    </style>
+
+    <style name="SocialWidgetConfigureTheme" parent="ContactPickerTheme">
+    </style>
+
+    <style name="JoinContactActivityTheme" parent="ContactPickerTheme">
+        <item name="android:windowNoTitle">true</item>
+        <item name="android:windowContentOverlay">@null</item>
+    </style>
+
+    <style name="ContactsPreferencesTheme" parent="@android:Theme">
+    </style>
+
+    <style name="CustomContactListFilterTheme" parent="@android:Theme">
+    </style>
+
+    <style name="ContactPickerLayout" parent="ContactPickerTheme">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">match_parent</item>
+    </style>
+
+    <style name="CustomContactListFilterView" parent="CustomContactListFilterTheme">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">match_parent</item>
+    </style>
+
+    <declare-styleable name="InterpolatingLayout_Layout">
+        <attr name="layout_narrowParentWidth" format="dimension"/>
+        <attr name="layout_narrowWidth" format="dimension"/>
+        <attr name="layout_narrowLeftMargin" format="dimension"/>
+        <attr name="layout_narrowRightMargin" format="dimension"/>
+        <attr name="layout_wideParentWidth" format="dimension"/>
+        <attr name="layout_wideWidth" format="dimension"/>
+        <attr name="layout_wideLeftMargin" format="dimension"/>
+        <attr name="layout_wideRightMargin" format="dimension"/>
+    </declare-styleable>
+    
+    <style name="DirectoryHeader" parent="ContactBrowserTheme">
+        <item name="android:background">@drawable/directory_bg</item>
+    </style>
 </resources>
diff --git a/res/xml/preference_display_options.xml b/res/xml/preference_display_options.xml
new file mode 100644
index 0000000..a662efa
--- /dev/null
+++ b/res/xml/preference_display_options.xml
@@ -0,0 +1,30 @@
+<?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.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+    <PreferenceCategory
+        android:title="@string/preference_displayOptions">
+        <com.android.contacts.preference.SortOrderPreference
+            android:key="sortOrder"
+            android:title="@string/display_options_sort_list_by"
+            android:dialogTitle="@string/display_options_sort_list_by" />
+
+        <com.android.contacts.preference.DisplayOrderPreference
+            android:key="sortOrder"
+            android:title="@string/display_options_view_names_as"
+            android:dialogTitle="@string/display_options_view_names_as" />
+    </PreferenceCategory>
+</PreferenceScreen>
diff --git a/res/xml/preference_headers.xml b/res/xml/preference_headers.xml
new file mode 100644
index 0000000..ed709fc
--- /dev/null
+++ b/res/xml/preference_headers.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<preference-headers
+    xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <header
+        android:fragment="com.android.contacts.preference.DisplayOptionsPreferenceFragment"
+        android:title="@string/preference_displayOptions" />
+
+</preference-headers>
diff --git a/res/xml/social_widget_info.xml b/res/xml/social_widget_info.xml
new file mode 100644
index 0000000..330ddc7
--- /dev/null
+++ b/res/xml/social_widget_info.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
+    android:minWidth="294dip"
+    android:minHeight="72dip"
+    android:updatePeriodMillis="3600000"
+    android:initialLayout="@layout/social_widget"
+    android:configure="com.android.contacts.socialwidget.SocialWidgetConfigureActivity" >
+</appwidget-provider>
diff --git a/src/com/android/contacts/AttachImage.java b/src/com/android/contacts/AttachImage.java
index 6970842..ba1892a 100644
--- a/src/com/android/contacts/AttachImage.java
+++ b/src/com/android/contacts/AttachImage.java
@@ -36,8 +36,8 @@
 import android.provider.ContactsContract.CommonDataKinds.Photo;
 import android.widget.Toast;
 
-import com.android.contacts.model.ExchangeSource;
-import com.android.contacts.model.GoogleSource;
+import com.android.contacts.model.ExchangeAccountType;
+import com.android.contacts.model.GoogleAccountType;
 
 import java.io.ByteArrayOutputStream;
 import java.util.ArrayList;
@@ -189,8 +189,8 @@
             operations.add(ContentProviderOperation.newAssertQuery(rawContactDataUri)
                     .withSelection(Photo.MIMETYPE + "=? AND "
                             + RawContacts.ACCOUNT_TYPE + " IN (?,?)",
-                            new String[] {Photo.CONTENT_ITEM_TYPE, GoogleSource.ACCOUNT_TYPE,
-                            ExchangeSource.ACCOUNT_TYPE})
+                            new String[] {Photo.CONTENT_ITEM_TYPE, GoogleAccountType.ACCOUNT_TYPE,
+                            ExchangeAccountType.ACCOUNT_TYPE})
                             .withExpectedCount(0).build());
         }
 
diff --git a/src/com/android/contacts/CallContactActivity.java b/src/com/android/contacts/CallContactActivity.java
new file mode 100644
index 0000000..76f0892
--- /dev/null
+++ b/src/com/android/contacts/CallContactActivity.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2009 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.contacts;
+
+import com.android.contacts.interactions.PhoneNumberInteraction;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnDismissListener;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract.Contacts;
+
+/**
+ * An interstitial activity used when the user selects a QSB search suggestion using
+ * a call button.
+ */
+public class CallContactActivity extends Activity implements OnDismissListener {
+
+    private PhoneNumberInteraction mPhoneNumberInteraction;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mPhoneNumberInteraction = new PhoneNumberInteraction(this, false, this);
+
+        Uri contactUri = getIntent().getData();
+        if (contactUri == null) {
+            finish();
+        }
+
+        // If we are being invoked with a saved state, rely on Activity to restore it
+        if (savedInstanceState != null) {
+            return;
+        }
+
+        if (Contacts.CONTENT_ITEM_TYPE.equals(getContentResolver().getType(contactUri))) {
+            mPhoneNumberInteraction.startInteraction(contactUri);
+        } else {
+            startActivity(new Intent(Intent.ACTION_CALL_PRIVILEGED, contactUri));
+            finish();
+        }
+    }
+
+    public void onDismiss(DialogInterface dialog) {
+        if (!isChangingConfigurations()) {
+            finish();
+        }
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int id, Bundle args) {
+        return mPhoneNumberInteraction.onCreateDialog(id, args);
+    }
+
+    @Override
+    protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
+        mPhoneNumberInteraction.onPrepareDialog(id, dialog, args);
+    }
+}
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index 9f027bb..b3c68ef 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -63,6 +63,7 @@
     private TextView mCallDuration;
 
     private String mNumber = null;
+    private String mDefaultCountryIso;
 
     /* package */ LayoutInflater mInflater;
     /* package */ Resources mResources;
@@ -72,12 +73,14 @@
         CallLog.Calls.DURATION,
         CallLog.Calls.NUMBER,
         CallLog.Calls.TYPE,
+        CallLog.Calls.COUNTRY_ISO,
     };
 
     static final int DATE_COLUMN_INDEX = 0;
     static final int DURATION_COLUMN_INDEX = 1;
     static final int NUMBER_COLUMN_INDEX = 2;
     static final int CALL_TYPE_COLUMN_INDEX = 3;
+    static final int COUNTRY_ISO_COLUMN_INDEX = 4;
 
     static final String[] PHONES_PROJECTION = new String[] {
         PhoneLookup._ID,
@@ -85,12 +88,14 @@
         PhoneLookup.TYPE,
         PhoneLookup.LABEL,
         PhoneLookup.NUMBER,
+        PhoneLookup.NORMALIZED_NUMBER,
     };
     static final int COLUMN_INDEX_ID = 0;
     static final int COLUMN_INDEX_NAME = 1;
     static final int COLUMN_INDEX_TYPE = 2;
     static final int COLUMN_INDEX_LABEL = 3;
     static final int COLUMN_INDEX_NUMBER = 4;
+    static final int COLUMN_INDEX_NORMALIZED_NUMBER = 5;
 
     @Override
     protected void onCreate(Bundle icicle) {
@@ -105,6 +110,7 @@
         mCallTypeIcon = (ImageView) findViewById(R.id.icon);
         mCallTime = (TextView) findViewById(R.id.time);
         mCallDuration = (TextView) findViewById(R.id.duration);
+        mDefaultCountryIso = ContactsUtils.getCurrentCountryIso(this);
 
         getListView().setOnItemClickListener(this);
     }
@@ -126,7 +132,6 @@
                     Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
                             Uri.fromParts("tel", mNumber, null));
                     startActivity(callIntent);
-                    StickyTabs.saveTab(this, getIntent());
                     return true;
                 }
             }
@@ -150,7 +155,10 @@
                 long date = callCursor.getLong(DATE_COLUMN_INDEX);
                 long duration = callCursor.getLong(DURATION_COLUMN_INDEX);
                 int callType = callCursor.getInt(CALL_TYPE_COLUMN_INDEX);
-
+                String countryIso = callCursor.getString(COUNTRY_ISO_COLUMN_INDEX);
+                if (TextUtils.isEmpty(countryIso)) {
+                    countryIso = mDefaultCountryIso;
+                }
                 // Pull out string in format [relative], [date]
                 CharSequence dateClause = DateUtils.formatDateRange(this, date, date,
                         DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE |
@@ -210,12 +218,14 @@
                             callText = getString(R.string.recentCalls_callNumber,
                                     phonesCursor.getString(COLUMN_INDEX_NAME));
                             mNumber = PhoneNumberUtils.formatNumber(
-                                    phonesCursor.getString(COLUMN_INDEX_NUMBER));
+                                    phonesCursor.getString(COLUMN_INDEX_NUMBER),
+                                    phonesCursor.getString(COLUMN_INDEX_NORMALIZED_NUMBER),
+                                    countryIso);
                             callLabel = Phone.getDisplayLabel(this,
                                     phonesCursor.getInt(COLUMN_INDEX_TYPE),
                                     phonesCursor.getString(COLUMN_INDEX_LABEL)).toString();
                         } else {
-                            mNumber = PhoneNumberUtils.formatNumber(mNumber);
+                            mNumber = PhoneNumberUtils.formatNumber(mNumber, countryIso);
                         }
                     } finally {
                         if (phonesCursor != null) phonesCursor.close();
@@ -241,7 +251,6 @@
                     // to create new contact from this number.
                     if (personUri != null) {
                         Intent viewIntent = new Intent(Intent.ACTION_VIEW, personUri);
-                        StickyTabs.setTab(viewIntent, getIntent());
                         actions.add(new ViewEntry(R.drawable.sym_action_view_contact,
                                 getString(R.string.menu_viewContact), viewIntent));
                     } else {
@@ -364,9 +373,6 @@
         if (view.getTag() instanceof ViewEntry) {
             ViewEntry entry = (ViewEntry) view.getTag();
             if (entry.intent != null) {
-                if (Intent.ACTION_CALL_PRIVILEGED.equals(entry.intent.getAction())) {
-                    StickyTabs.saveTab(this, getIntent());
-                }
                 startActivity(entry.intent);
             }
         }
diff --git a/src/com/android/contacts/Collapser.java b/src/com/android/contacts/Collapser.java
index 3872dfd..d072dce 100644
--- a/src/com/android/contacts/Collapser.java
+++ b/src/com/android/contacts/Collapser.java
@@ -16,7 +16,6 @@
 
 package com.android.contacts;
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.ArrayList;
 
@@ -44,7 +43,7 @@
 
     /**
      * Collapses a list of Collapsible items into a list of collapsed items. Items are collapsed
-     * if {@link Collapsible#shouldCollapseWith(Object) return strue, and are collapsed
+     * if {@link Collapsible#shouldCollapseWith(Object)} returns strue, and are collapsed
      * through the {@Link Collapsible#collapseWith(Object)} function implemented by the data item.
      *
      * @param list ArrayList of Objects of type <T extends Collapsible<T>> to be collapsed.
diff --git a/src/com/android/contacts/ContactEntryAdapter.java b/src/com/android/contacts/ContactEntryAdapter.java
deleted file mode 100644
index 34ee505..0000000
--- a/src/com/android/contacts/ContactEntryAdapter.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (C) 2007 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.contacts;
-
-import android.content.Context;
-import android.net.Uri;
-import android.os.Parcel;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Data;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-
-import java.util.ArrayList;
-
-public abstract class ContactEntryAdapter<E extends ContactEntryAdapter.Entry>
-        extends BaseAdapter {
-
-    protected ArrayList<ArrayList<E>> mSections;
-    protected LayoutInflater mInflater;
-    protected Context mContext;
-    protected boolean mSeparators;
-
-    /**
-     * Base class for adapter entries.
-     */
-    public static class Entry {
-        public int type = -1;
-        public String label;
-        public String data;
-        public Uri uri;
-        public long id = 0;
-        public long contactId;
-        public int maxLines = 1;
-        public String mimetype;
-
-        /**
-         * Helper for making subclasses parcelable.
-         */
-        protected void writeToParcel(Parcel p) {
-            p.writeInt(type);
-            p.writeString(label);
-            p.writeString(data);
-            p.writeParcelable(uri, 0);
-            p.writeLong(id);
-            p.writeInt(maxLines);
-            p.writeString(mimetype);
-        }
-
-        /**
-         * Helper for making subclasses parcelable.
-         */
-        protected void readFromParcel(Parcel p) {
-            final ClassLoader loader = getClass().getClassLoader();
-            type = p.readInt();
-            label = p.readString();
-            data = p.readString();
-            uri = p.readParcelable(loader);
-            id = p.readLong();
-            maxLines = p.readInt();
-            mimetype = p.readString();
-        }
-    }
-
-    ContactEntryAdapter(Context context, ArrayList<ArrayList<E>> sections, boolean separators) {
-        mContext = context;
-        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        mSections = sections;
-        mSeparators = separators;
-    }
-
-    /**
-     * Resets the section data.
-     *
-     * @param sections the section data
-     */
-    public final void setSections(ArrayList<ArrayList<E>> sections, boolean separators) {
-        mSections = sections;
-        mSeparators = separators;
-        notifyDataSetChanged();
-    }
-
-    /**
-     * Resets the section data and returns the position of the given entry.
-     *
-     * @param sections the section data
-     * @param entry the entry to return the position for
-     * @return the position of entry, or -1 if it isn't found
-     */
-    public final int setSections(ArrayList<ArrayList<E>> sections, E entry) {
-        mSections = sections;
-        notifyDataSetChanged();
-
-        int numSections = mSections.size();
-        int position = 0;
-        for (int i = 0; i < numSections; i++) {
-            ArrayList<E> section = mSections.get(i);
-            int sectionSize = section.size();
-            for (int j = 0; j < sectionSize; j++) {
-                E e = section.get(j);
-                if (e.equals(entry)) {
-                    position += j;
-                    return position;
-                }
-            }
-            position += sectionSize;
-        }
-        return -1;
-    }
-
-    /**
-     * @see android.widget.ListAdapter#getCount()
-     */
-    public final int getCount() {
-        return countEntries(mSections, mSeparators);
-    }
-
-    /**
-     * @see android.widget.ListAdapter#hasSeparators()
-     */
-    @Override
-    public final boolean areAllItemsEnabled() {
-        return mSeparators == false;
-    }
-
-    /**
-     * @see android.widget.ListAdapter#isSeparator(int)
-     */
-    @Override
-    public final boolean isEnabled(int position) {
-        if (!mSeparators) {
-            return true;
-        }
-
-        int numSections = mSections.size();
-        for (int i = 0; i < numSections; i++) {
-            ArrayList<E> section = mSections.get(i);
-            int sectionSize = section.size();
-            if (sectionSize == 1) {
-                // The section only contains a separator and nothing else, skip it
-                continue;
-            }
-            if (position == 0) {
-                // The first item in a section is always the separator
-                return false;
-            }
-            position -= sectionSize;
-        }
-        return true;
-    }
-
-    /**
-     * @see android.widget.ListAdapter#getItem(int)
-     */
-    public final Object getItem(int position) {
-        return getEntry(mSections, position, mSeparators);
-    }
-
-    /**
-     * Get the entry for the given position.
-     *
-     * @param sections the list of sections
-     * @param position the position for the desired entry
-     * @return the ContactEntry for the given position
-     */
-    public final static <T extends Entry> T getEntry(ArrayList<ArrayList<T>> sections,
-            int position, boolean separators) {
-        int numSections = sections.size();
-        for (int i = 0; i < numSections; i++) {
-            ArrayList<T> section = sections.get(i);
-            int sectionSize = section.size();
-            if (separators && sectionSize == 1) {
-                // The section only contains a separator and nothing else, skip it
-                continue;
-            }
-            if (position < section.size()) {
-                return section.get(position);
-            }
-            position -= section.size();
-        }
-        return null;
-    }
-
-    /**
-     * Get the count of entries in all sections
-     *
-     * @param sections the list of sections
-     * @return the count of entries in all sections
-     */
-    public static <T extends Entry> int countEntries(ArrayList<ArrayList<T>> sections,
-            boolean separators) {
-        int count = 0;
-        int numSections = sections.size();
-        for (int i = 0; i < numSections; i++) {
-            ArrayList<T> section = sections.get(i);
-            int sectionSize = section.size();
-            if (separators && sectionSize == 1) {
-                // The section only contains a separator and nothing else, skip it
-                continue;
-            }
-            count += sections.get(i).size();
-        }
-        return count;
-    }
-
-    /**
-     * @see android.widget.ListAdapter#getItemId(int)
-     */
-    public final long getItemId(int position) {
-        Entry entry = getEntry(mSections, position, mSeparators);
-        if (entry != null) {
-            return entry.id;
-        } else {
-            return -1;
-        }
-    }
-
-    /**
-     * @see android.widget.ListAdapter#getView(int, View, ViewGroup)
-     */
-    public View getView(int position, View convertView, ViewGroup parent) {
-        View v;
-        if (convertView == null) {
-            v = newView(position, parent);
-        } else {
-            v = convertView;
-        }
-        bindView(v, getEntry(mSections, position, mSeparators));
-        return v;
-    }
-
-    /**
-     * Create a new view for an entry.
-     *
-     * @parent the parent ViewGroup
-     * @return the newly created view
-     */
-    protected abstract View newView(int position, ViewGroup parent);
-
-    /**
-     * Binds the data from an entry to a view.
-     *
-     * @param view the view to display the entry in
-     * @param entry the data to bind
-     */
-    protected abstract void bindView(View view, E entry);
-}
diff --git a/src/com/android/contacts/ContactListEmptyView.java b/src/com/android/contacts/ContactListEmptyView.java
new file mode 100644
index 0000000..40d5152
--- /dev/null
+++ b/src/com/android/contacts/ContactListEmptyView.java
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.IContentService;
+import android.os.RemoteException;
+import android.provider.ContactsContract;
+import android.telephony.TelephonyManager;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.widget.ScrollView;
+import android.widget.TextView;
+
+/**
+ * Displays a message when there is nothing to display in a contact list.
+ */
+public class ContactListEmptyView extends ScrollView {
+
+    private static final String TAG = "ContactListEmptyView";
+
+    public ContactListEmptyView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public void hide() {
+        TextView empty = (TextView) findViewById(R.id.emptyText);
+        empty.setVisibility(GONE);
+    }
+
+    public void show(boolean searchMode, boolean displayOnlyPhones,
+            boolean isFavoritesMode, boolean isQueryMode, boolean isShortcutAction,
+            boolean isMultipleSelectionEnabled, boolean showSelectedOnly) {
+        if (searchMode) {
+            return;
+        }
+
+        TextView empty = (TextView) findViewById(R.id.emptyText);
+        Context context = getContext();
+        if (displayOnlyPhones) {
+            empty.setText(context.getText(R.string.noContactsWithPhoneNumbers));
+        } else if (isFavoritesMode) {
+            empty.setText(context.getText(R.string.noFavoritesHelpText));
+        } else if (isQueryMode) {
+            empty.setText(context.getText(R.string.noMatchingContacts));
+        } if (isMultipleSelectionEnabled) {
+            if (showSelectedOnly) {
+                empty.setText(context.getText(R.string.no_contacts_selected));
+            } else {
+                empty.setText(context.getText(R.string.noContactsWithPhoneNumbers));
+            }
+        } else {
+            TelephonyManager telephonyManager =
+                    (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+            boolean hasSim = telephonyManager.hasIccCard();
+            if (isSyncActive()) {
+                if (isShortcutAction) {
+                    // Help text is the same no matter whether there is SIM or not.
+                    empty.setText(
+                            context.getText(R.string.noContactsHelpTextWithSyncForCreateShortcut));
+                } else if (hasSim) {
+                    empty.setText(context.getText(R.string.noContactsHelpTextWithSync));
+                } else {
+                    empty.setText(context.getText(R.string.noContactsNoSimHelpTextWithSync));
+                }
+            } else {
+                if (isShortcutAction) {
+                    // Help text is the same no matter whether there is SIM or not.
+                    empty.setText(context.getText(R.string.noContactsHelpTextForCreateShortcut));
+                } else if (hasSim) {
+                    empty.setText(context.getText(R.string.noContactsHelpText));
+                } else {
+                    empty.setText(context.getText(R.string.noContactsNoSimHelpText));
+                }
+            }
+        }
+        empty.setVisibility(VISIBLE);
+    }
+
+    private boolean isSyncActive() {
+        Account[] accounts = AccountManager.get(getContext()).getAccounts();
+        if (accounts != null && accounts.length > 0) {
+            IContentService contentService = ContentResolver.getContentService();
+            for (Account account : accounts) {
+                try {
+                    if (contentService.isSyncActive(account, ContactsContract.AUTHORITY)) {
+                        return true;
+                    }
+                } catch (RemoteException e) {
+                    Log.e(TAG, "Could not get the sync status");
+                }
+            }
+        }
+        return false;
+    }
+}
diff --git a/src/com/android/contacts/ContactListItemView.java b/src/com/android/contacts/ContactListItemView.java
deleted file mode 100644
index 89e4265..0000000
--- a/src/com/android/contacts/ContactListItemView.java
+++ /dev/null
@@ -1,595 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.contacts;
-
-import com.android.contacts.ui.widget.DontPressWithParentImageView;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Typeface;
-import android.graphics.drawable.Drawable;
-import android.provider.ContactsContract.Contacts;
-import android.text.TextUtils;
-import android.text.TextUtils.TruncateAt;
-import android.util.AttributeSet;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.QuickContactBadge;
-import android.widget.TextView;
-import android.widget.ImageView.ScaleType;
-
-/**
- * A custom view for an item in the contact list.
- */
-public class ContactListItemView extends ViewGroup {
-
-    private static final int QUICK_CONTACT_BADGE_STYLE =
-            com.android.internal.R.attr.quickContactBadgeStyleWindowMedium;
-
-    private final Context mContext;
-
-    private final int mPreferredHeight;
-    private final int mVerticalDividerMargin;
-    private final int mPaddingTop;
-    private final int mPaddingRight;
-    private final int mPaddingBottom;
-    private final int mPaddingLeft;
-    private final int mGapBetweenImageAndText;
-    private final int mGapBetweenLabelAndData;
-    private final int mCallButtonPadding;
-    private final int mPresenceIconMargin;
-    private final int mHeaderTextWidth;
-
-    private boolean mHorizontalDividerVisible;
-    private Drawable mHorizontalDividerDrawable;
-    private int mHorizontalDividerHeight;
-
-    private boolean mVerticalDividerVisible;
-    private Drawable mVerticalDividerDrawable;
-    private int mVerticalDividerWidth;
-
-    private boolean mHeaderVisible;
-    private Drawable mHeaderBackgroundDrawable;
-    private int mHeaderBackgroundHeight;
-    private TextView mHeaderTextView;
-
-    private QuickContactBadge mQuickContact;
-    private ImageView mPhotoView;
-    private TextView mNameTextView;
-    private DontPressWithParentImageView mCallButton;
-    private TextView mLabelView;
-    private TextView mDataView;
-    private TextView mSnippetView;
-    private ImageView mPresenceIcon;
-
-    private int mPhotoViewWidth;
-    private int mPhotoViewHeight;
-    private int mLine1Height;
-    private int mLine2Height;
-    private int mLine3Height;
-
-    private OnClickListener mCallButtonClickListener;
-
-    public ContactListItemView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        mContext = context;
-
-        // Obtain preferred item height from the current theme
-        TypedArray a = context.obtainStyledAttributes(null, com.android.internal.R.styleable.Theme);
-        mPreferredHeight =
-                a.getDimensionPixelSize(android.R.styleable.Theme_listPreferredItemHeight, 0);
-        a.recycle();
-
-        Resources resources = context.getResources();
-        mVerticalDividerMargin =
-                resources.getDimensionPixelOffset(R.dimen.list_item_vertical_divider_margin);
-        mPaddingTop =
-                resources.getDimensionPixelOffset(R.dimen.list_item_padding_top);
-        mPaddingBottom =
-                resources.getDimensionPixelOffset(R.dimen.list_item_padding_bottom);
-        mPaddingLeft =
-                resources.getDimensionPixelOffset(R.dimen.list_item_padding_left);
-        mPaddingRight =
-                resources.getDimensionPixelOffset(R.dimen.list_item_padding_right);
-        mGapBetweenImageAndText =
-                resources.getDimensionPixelOffset(R.dimen.list_item_gap_between_image_and_text);
-        mGapBetweenLabelAndData =
-                resources.getDimensionPixelOffset(R.dimen.list_item_gap_between_label_and_data);
-        mCallButtonPadding =
-                resources.getDimensionPixelOffset(R.dimen.list_item_call_button_padding);
-        mPresenceIconMargin =
-                resources.getDimensionPixelOffset(R.dimen.list_item_presence_icon_margin);
-        mHeaderTextWidth =
-                resources.getDimensionPixelOffset(R.dimen.list_item_header_text_width);
-    }
-
-    /**
-     * Installs a call button listener.
-     */
-    public void setOnCallButtonClickListener(OnClickListener callButtonClickListener) {
-        mCallButtonClickListener = callButtonClickListener;
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        // We will match parent's width and wrap content vertically, but make sure
-        // height is no less than listPreferredItemHeight.
-        int width = resolveSize(0, widthMeasureSpec);
-        int height = 0;
-
-        mLine1Height = 0;
-        mLine2Height = 0;
-        mLine3Height = 0;
-
-        // Obtain the natural dimensions of the name text (we only care about height)
-        mNameTextView.measure(0, 0);
-
-        mLine1Height = mNameTextView.getMeasuredHeight();
-
-        if (isVisible(mLabelView)) {
-            mLabelView.measure(0, 0);
-            mLine2Height = mLabelView.getMeasuredHeight();
-        }
-
-        if (isVisible(mDataView)) {
-            mDataView.measure(0, 0);
-            mLine2Height = Math.max(mLine2Height, mDataView.getMeasuredHeight());
-        }
-
-        if (isVisible(mSnippetView)) {
-            mSnippetView.measure(0, 0);
-            mLine3Height = mSnippetView.getMeasuredHeight();
-        }
-
-        height += mLine1Height + mLine2Height + mLine3Height;
-
-        if (isVisible(mCallButton)) {
-            mCallButton.measure(0, 0);
-        }
-        if (isVisible(mPresenceIcon)) {
-            mPresenceIcon.measure(0, 0);
-        }
-
-        ensurePhotoViewSize();
-
-        height = Math.max(height, mPhotoViewHeight);
-        height = Math.max(height, mPreferredHeight);
-
-        if (mHeaderVisible) {
-            ensureHeaderBackground();
-            mHeaderTextView.measure(
-                    MeasureSpec.makeMeasureSpec(mHeaderTextWidth, MeasureSpec.EXACTLY),
-                    MeasureSpec.makeMeasureSpec(mHeaderBackgroundHeight, MeasureSpec.EXACTLY));
-            height += mHeaderBackgroundDrawable.getIntrinsicHeight();
-        }
-
-        setMeasuredDimension(width, height);
-    }
-
-    @Override
-    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
-        int height = bottom - top;
-        int width = right - left;
-
-        // Determine the vertical bounds by laying out the header first.
-        int topBound = 0;
-
-        if (mHeaderVisible) {
-            mHeaderBackgroundDrawable.setBounds(
-                    0,
-                    0,
-                    width,
-                    mHeaderBackgroundHeight);
-            mHeaderTextView.layout(0, 0, width, mHeaderBackgroundHeight);
-            topBound += mHeaderBackgroundHeight;
-        }
-
-        // Positions of views on the left are fixed and so are those on the right side.
-        // The stretchable part of the layout is in the middle.  So, we will start off
-        // by laying out the left and right sides. Then we will allocate the remainder
-        // to the text fields in the middle.
-
-        // Left side
-        int leftBound = mPaddingLeft;
-        View photoView = mQuickContact != null ? mQuickContact : mPhotoView;
-        if (photoView != null) {
-            // Center the photo vertically
-            int photoTop = topBound + (height - topBound - mPhotoViewHeight) / 2;
-            photoView.layout(
-                    leftBound,
-                    photoTop,
-                    leftBound + mPhotoViewWidth,
-                    photoTop + mPhotoViewHeight);
-            leftBound += mPhotoViewWidth + mGapBetweenImageAndText;
-        }
-
-        // Right side
-        int rightBound = right;
-        if (isVisible(mCallButton)) {
-            int buttonWidth = mCallButton.getMeasuredWidth();
-            rightBound -= buttonWidth;
-            mCallButton.layout(
-                    rightBound,
-                    topBound,
-                    rightBound + buttonWidth,
-                    height);
-            mVerticalDividerVisible = true;
-            ensureVerticalDivider();
-            rightBound -= mVerticalDividerWidth;
-            mVerticalDividerDrawable.setBounds(
-                    rightBound,
-                    topBound + mVerticalDividerMargin,
-                    rightBound + mVerticalDividerWidth,
-                    height - mVerticalDividerMargin);
-        } else {
-            mVerticalDividerVisible = false;
-        }
-
-        if (isVisible(mPresenceIcon)) {
-            int iconWidth = mPresenceIcon.getMeasuredWidth();
-            rightBound -= mPresenceIconMargin + iconWidth;
-            mPresenceIcon.layout(
-                    rightBound,
-                    topBound,
-                    rightBound + iconWidth,
-                    height);
-        }
-
-        if (mHorizontalDividerVisible) {
-            ensureHorizontalDivider();
-            mHorizontalDividerDrawable.setBounds(
-                    0,
-                    height - mHorizontalDividerHeight,
-                    width,
-                    height);
-        }
-
-        topBound += mPaddingTop;
-        int bottomBound = height - mPaddingBottom;
-
-        // Text lines, centered vertically
-        rightBound -= mPaddingRight;
-
-        // Center text vertically
-        int totalTextHeight = mLine1Height + mLine2Height + mLine3Height;
-        int textTopBound = (bottomBound + topBound - totalTextHeight) / 2;
-
-        mNameTextView.layout(leftBound,
-                textTopBound,
-                rightBound,
-                textTopBound + mLine1Height);
-
-        int dataLeftBound = leftBound;
-        if (isVisible(mLabelView)) {
-            dataLeftBound = leftBound + mLabelView.getMeasuredWidth();
-            mLabelView.layout(leftBound,
-                    textTopBound + mLine1Height,
-                    dataLeftBound,
-                    textTopBound + mLine1Height + mLine2Height);
-            dataLeftBound += mGapBetweenLabelAndData;
-        }
-
-        if (isVisible(mDataView)) {
-            mDataView.layout(dataLeftBound,
-                    textTopBound + mLine1Height,
-                    rightBound,
-                    textTopBound + mLine1Height + mLine2Height);
-        }
-
-        if (isVisible(mSnippetView)) {
-            mSnippetView.layout(leftBound,
-                    textTopBound + mLine1Height + mLine2Height,
-                    rightBound,
-                    textTopBound + mLine1Height + mLine2Height + mLine3Height);
-        }
-    }
-
-    private boolean isVisible(View view) {
-        return view != null && view.getVisibility() == View.VISIBLE;
-    }
-
-    /**
-     * Loads the drawable for the vertical divider if it has not yet been loaded.
-     */
-    private void ensureVerticalDivider() {
-        if (mVerticalDividerDrawable == null) {
-            mVerticalDividerDrawable = mContext.getResources().getDrawable(
-                    R.drawable.divider_vertical_dark);
-            mVerticalDividerWidth = mVerticalDividerDrawable.getIntrinsicWidth();
-        }
-    }
-
-    /**
-     * Loads the drawable for the horizontal divider if it has not yet been loaded.
-     */
-    private void ensureHorizontalDivider() {
-        if (mHorizontalDividerDrawable == null) {
-            mHorizontalDividerDrawable = mContext.getResources().getDrawable(
-                    com.android.internal.R.drawable.divider_horizontal_dark_opaque);
-            mHorizontalDividerHeight = mHorizontalDividerDrawable.getIntrinsicHeight();
-        }
-    }
-
-    /**
-     * Loads the drawable for the header background if it has not yet been loaded.
-     */
-    private void ensureHeaderBackground() {
-        if (mHeaderBackgroundDrawable == null) {
-            mHeaderBackgroundDrawable = mContext.getResources().getDrawable(
-                    android.R.drawable.dark_header);
-            mHeaderBackgroundHeight = mHeaderBackgroundDrawable.getIntrinsicHeight();
-        }
-    }
-
-    /**
-     * Extracts width and height from the style
-     */
-    private void ensurePhotoViewSize() {
-        if (mPhotoViewWidth == 0 && mPhotoViewHeight == 0) {
-            TypedArray a = mContext.obtainStyledAttributes(null,
-                    com.android.internal.R.styleable.ViewGroup_Layout,
-                    QUICK_CONTACT_BADGE_STYLE, 0);
-            mPhotoViewWidth = a.getLayoutDimension(
-                    android.R.styleable.ViewGroup_Layout_layout_width,
-                    ViewGroup.LayoutParams.WRAP_CONTENT);
-            mPhotoViewHeight = a.getLayoutDimension(
-                    android.R.styleable.ViewGroup_Layout_layout_height,
-                    ViewGroup.LayoutParams.WRAP_CONTENT);
-            a.recycle();
-        }
-    }
-
-    @Override
-    public void dispatchDraw(Canvas canvas) {
-        if (mHeaderVisible) {
-            mHeaderBackgroundDrawable.draw(canvas);
-        }
-        if (mHorizontalDividerVisible) {
-            mHorizontalDividerDrawable.draw(canvas);
-        }
-        if (mVerticalDividerVisible) {
-            mVerticalDividerDrawable.draw(canvas);
-        }
-        super.dispatchDraw(canvas);
-    }
-
-    /**
-     * Sets the flag that determines whether a divider should drawn at the bottom
-     * of the view.
-     */
-    public void setDividerVisible(boolean visible) {
-        mHorizontalDividerVisible = visible;
-    }
-
-    /**
-     * Sets section header or makes it invisible if the title is null.
-     */
-    public void setSectionHeader(String title) {
-        if (!TextUtils.isEmpty(title)) {
-            if (mHeaderTextView == null) {
-                mHeaderTextView = new TextView(mContext);
-                mHeaderTextView.setTypeface(mHeaderTextView.getTypeface(), Typeface.BOLD);
-                mHeaderTextView.setTextColor(mContext.getResources()
-                        .getColor(com.android.internal.R.color.dim_foreground_dark));
-                mHeaderTextView.setTextSize(14);
-                mHeaderTextView.setGravity(Gravity.CENTER);
-                addView(mHeaderTextView);
-            }
-            mHeaderTextView.setText(title);
-            mHeaderTextView.setVisibility(View.VISIBLE);
-            mHeaderVisible = true;
-        } else {
-            if (mHeaderTextView != null) {
-                mHeaderTextView.setVisibility(View.GONE);
-            }
-            mHeaderVisible = false;
-        }
-    }
-
-    /**
-     * Returns the quick contact badge, creating it if necessary.
-     */
-    public QuickContactBadge getQuickContact() {
-        if (mQuickContact == null) {
-            mQuickContact = new QuickContactBadge(mContext, null, QUICK_CONTACT_BADGE_STYLE);
-            mQuickContact.setExcludeMimes(new String[] { Contacts.CONTENT_ITEM_TYPE });
-            addView(mQuickContact);
-        }
-        return mQuickContact;
-    }
-
-    /**
-     * Returns the photo view, creating it if necessary.
-     */
-    public ImageView getPhotoView() {
-        if (mPhotoView == null) {
-            mPhotoView = new ImageView(mContext, null, QUICK_CONTACT_BADGE_STYLE);
-            // Quick contact style used above will set a background - remove it
-            mPhotoView.setBackgroundDrawable(null);
-            addView(mPhotoView);
-        }
-        return mPhotoView;
-    }
-
-    /**
-     * Returns the text view for the contact name, creating it if necessary.
-     */
-    public TextView getNameTextView() {
-        if (mNameTextView == null) {
-            mNameTextView = new TextView(mContext);
-            mNameTextView.setSingleLine(true);
-            mNameTextView.setEllipsize(TruncateAt.MARQUEE);
-            mNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Large);
-            mNameTextView.setGravity(Gravity.CENTER_VERTICAL);
-            addView(mNameTextView);
-        }
-        return mNameTextView;
-    }
-
-    /**
-     * Adds a call button using the supplied arguments as an id and tag.
-     */
-    public void showCallButton(int id, int tag) {
-        if (mCallButton == null) {
-            mCallButton = new DontPressWithParentImageView(mContext, null);
-            mCallButton.setId(id);
-            mCallButton.setOnClickListener(mCallButtonClickListener);
-            mCallButton.setBackgroundResource(R.drawable.call_background);
-            mCallButton.setImageResource(android.R.drawable.sym_action_call);
-            mCallButton.setPadding(mCallButtonPadding, 0, mCallButtonPadding, 0);
-            mCallButton.setScaleType(ScaleType.CENTER);
-            addView(mCallButton);
-        }
-
-        mCallButton.setTag(tag);
-        mCallButton.setVisibility(View.VISIBLE);
-    }
-
-    public void hideCallButton() {
-        if (mCallButton != null) {
-            mCallButton.setVisibility(View.GONE);
-        }
-    }
-
-    /**
-     * Adds or updates a text view for the data label.
-     */
-    public void setLabel(CharSequence text) {
-        if (TextUtils.isEmpty(text)) {
-            if (mLabelView != null) {
-                mLabelView.setVisibility(View.GONE);
-            }
-        } else {
-            getLabelView();
-            mLabelView.setText(text);
-            mLabelView.setVisibility(VISIBLE);
-        }
-    }
-
-    /**
-     * Adds or updates a text view for the data label.
-     */
-    public void setLabel(char[] text, int size) {
-        if (text == null || size == 0) {
-            if (mLabelView != null) {
-                mLabelView.setVisibility(View.GONE);
-            }
-        } else {
-            getLabelView();
-            mLabelView.setText(text, 0, size);
-            mLabelView.setVisibility(VISIBLE);
-        }
-    }
-
-    /**
-     * Returns the text view for the data label, creating it if necessary.
-     */
-    public TextView getLabelView() {
-        if (mLabelView == null) {
-            mLabelView = new TextView(mContext);
-            mLabelView.setSingleLine(true);
-            mLabelView.setEllipsize(TruncateAt.MARQUEE);
-            mLabelView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
-            mLabelView.setTypeface(mLabelView.getTypeface(), Typeface.BOLD);
-            addView(mLabelView);
-        }
-        return mLabelView;
-    }
-
-    /**
-     * Adds or updates a text view for the data element.
-     */
-    public void setData(char[] text, int size) {
-        if (text == null || size == 0) {
-            if (mDataView != null) {
-                mDataView.setVisibility(View.GONE);
-            }
-            return;
-        } else {
-            getDataView();
-            mDataView.setText(text, 0, size);
-            mDataView.setVisibility(VISIBLE);
-        }
-    }
-
-    /**
-     * Returns the text view for the data text, creating it if necessary.
-     */
-    public TextView getDataView() {
-        if (mDataView == null) {
-            mDataView = new TextView(mContext);
-            mDataView.setSingleLine(true);
-            mDataView.setEllipsize(TruncateAt.MARQUEE);
-            mDataView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
-            addView(mDataView);
-        }
-        return mDataView;
-    }
-
-    /**
-     * Adds or updates a text view for the search snippet.
-     */
-    public void setSnippet(CharSequence text) {
-        if (TextUtils.isEmpty(text)) {
-            if (mSnippetView != null) {
-                mSnippetView.setVisibility(View.GONE);
-            }
-        } else {
-            getSnippetView();
-            mSnippetView.setText(text);
-            mSnippetView.setVisibility(VISIBLE);
-        }
-    }
-
-    /**
-     * Returns the text view for the search snippet, creating it if necessary.
-     */
-    public TextView getSnippetView() {
-        if (mSnippetView == null) {
-            mSnippetView = new TextView(mContext);
-            mSnippetView.setSingleLine(true);
-            mSnippetView.setEllipsize(TruncateAt.MARQUEE);
-            mSnippetView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
-            mSnippetView.setTypeface(mSnippetView.getTypeface(), Typeface.BOLD);
-            addView(mSnippetView);
-        }
-        return mSnippetView;
-    }
-
-    /**
-     * Adds or updates the presence icon view.
-     */
-    public void setPresence(Drawable icon) {
-        if (icon != null) {
-            if (mPresenceIcon == null) {
-                mPresenceIcon = new ImageView(mContext);
-                addView(mPresenceIcon);
-            }
-            mPresenceIcon.setImageDrawable(icon);
-            mPresenceIcon.setScaleType(ScaleType.CENTER);
-            mPresenceIcon.setVisibility(View.VISIBLE);
-        } else {
-            if (mPresenceIcon != null) {
-                mPresenceIcon.setVisibility(View.GONE);
-            }
-        }
-    }
-}
diff --git a/src/com/android/contacts/ContactPhotoLoader.java b/src/com/android/contacts/ContactPhotoLoader.java
deleted file mode 100644
index 96f55a6..0000000
--- a/src/com/android/contacts/ContactPhotoLoader.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.contacts;
-
-import com.google.android.collect.Lists;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.os.Message;
-import android.os.Handler.Callback;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.Contacts.Photo;
-import android.widget.ImageView;
-
-import java.lang.ref.SoftReference;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Asynchronously loads contact photos and maintains cache of photos.  The class is
- * mostly single-threaded.  The only two methods accessed by the loader thread are
- * {@link #cacheBitmap} and {@link #obtainPhotoIdsToLoad}. Those methods access concurrent
- * hash maps shared with the main thread.
- */
-public class ContactPhotoLoader implements Callback {
-
-    private static final String LOADER_THREAD_NAME = "ContactPhotoLoader";
-
-    /**
-     * Type of message sent by the UI thread to itself to indicate that some photos
-     * need to be loaded.
-     */
-    private static final int MESSAGE_REQUEST_LOADING = 1;
-
-    /**
-     * Type of message sent by the loader thread to indicate that some photos have
-     * been loaded.
-     */
-    private static final int MESSAGE_PHOTOS_LOADED = 2;
-
-    private static final String[] EMPTY_STRING_ARRAY = new String[0];
-
-    private final String[] COLUMNS = new String[] { Photo._ID, Photo.PHOTO };
-
-    /**
-     * The resource ID of the image to be used when the photo is unavailable or being
-     * loaded.
-     */
-    private final int mDefaultResourceId;
-
-    /**
-     * Maintains the state of a particular photo.
-     */
-    private static class BitmapHolder {
-        private static final int NEEDED = 0;
-        private static final int LOADING = 1;
-        private static final int LOADED = 2;
-
-        int state;
-        SoftReference<Bitmap> bitmapRef;
-    }
-
-    /**
-     * A soft cache for photos.
-     */
-    private final ConcurrentHashMap<Long, BitmapHolder> mBitmapCache =
-            new ConcurrentHashMap<Long, BitmapHolder>();
-
-    /**
-     * A map from ImageView to the corresponding photo ID. Please note that this
-     * photo ID may change before the photo loading request is started.
-     */
-    private final ConcurrentHashMap<ImageView, Long> mPendingRequests =
-            new ConcurrentHashMap<ImageView, Long>();
-
-    /**
-     * Handler for messages sent to the UI thread.
-     */
-    private final Handler mMainThreadHandler = new Handler(this);
-
-    /**
-     * Thread responsible for loading photos from the database. Created upon
-     * the first request.
-     */
-    private LoaderThread mLoaderThread;
-
-    /**
-     * A gate to make sure we only send one instance of MESSAGE_PHOTOS_NEEDED at a time.
-     */
-    private boolean mLoadingRequested;
-
-    /**
-     * Flag indicating if the image loading is paused.
-     */
-    private boolean mPaused;
-
-    private final Context mContext;
-
-    /**
-     * Constructor.
-     *
-     * @param context content context
-     * @param defaultResourceId the image resource ID to be used when there is
-     *            no photo for a contact
-     */
-    public ContactPhotoLoader(Context context, int defaultResourceId) {
-        mDefaultResourceId = defaultResourceId;
-        mContext = context;
-    }
-
-    /**
-     * Load photo into the supplied image view.  If the photo is already cached,
-     * it is displayed immediately.  Otherwise a request is sent to load the photo
-     * from the database.
-     */
-    public void loadPhoto(ImageView view, long photoId) {
-        if (photoId == 0) {
-            // No photo is needed
-            view.setImageResource(mDefaultResourceId);
-            mPendingRequests.remove(view);
-        } else {
-            boolean loaded = loadCachedPhoto(view, photoId);
-            if (loaded) {
-                mPendingRequests.remove(view);
-            } else {
-                mPendingRequests.put(view, photoId);
-                if (!mPaused) {
-                    // Send a request to start loading photos
-                    requestLoading();
-                }
-            }
-        }
-    }
-
-    /**
-     * Checks if the photo is present in cache.  If so, sets the photo on the view,
-     * otherwise sets the state of the photo to {@link BitmapHolder#NEEDED} and
-     * temporarily set the image to the default resource ID.
-     */
-    private boolean loadCachedPhoto(ImageView view, long photoId) {
-        BitmapHolder holder = mBitmapCache.get(photoId);
-        if (holder == null) {
-            holder = new BitmapHolder();
-            mBitmapCache.put(photoId, holder);
-        } else if (holder.state == BitmapHolder.LOADED) {
-            // Null bitmap reference means that database contains no bytes for the photo
-            if (holder.bitmapRef == null) {
-                view.setImageResource(mDefaultResourceId);
-                return true;
-            }
-
-            Bitmap bitmap = holder.bitmapRef.get();
-            if (bitmap != null) {
-                view.setImageBitmap(bitmap);
-                return true;
-            }
-
-            // Null bitmap means that the soft reference was released by the GC
-            // and we need to reload the photo.
-            holder.bitmapRef = null;
-        }
-
-        // The bitmap has not been loaded - should display the placeholder image.
-        view.setImageResource(mDefaultResourceId);
-        holder.state = BitmapHolder.NEEDED;
-        return false;
-    }
-
-    /**
-     * Stops loading images, kills the image loader thread and clears all caches.
-     */
-    public void stop() {
-        pause();
-
-        if (mLoaderThread != null) {
-            mLoaderThread.quit();
-            mLoaderThread = null;
-        }
-
-        mPendingRequests.clear();
-        mBitmapCache.clear();
-    }
-
-    public void clear() {
-        mPendingRequests.clear();
-        mBitmapCache.clear();
-    }
-
-    /**
-     * Temporarily stops loading photos from the database.
-     */
-    public void pause() {
-        mPaused = true;
-    }
-
-    /**
-     * Resumes loading photos from the database.
-     */
-    public void resume() {
-        mPaused = false;
-        if (!mPendingRequests.isEmpty()) {
-            requestLoading();
-        }
-    }
-
-    /**
-     * Sends a message to this thread itself to start loading images.  If the current
-     * view contains multiple image views, all of those image views will get a chance
-     * to request their respective photos before any of those requests are executed.
-     * This allows us to load images in bulk.
-     */
-    private void requestLoading() {
-        if (!mLoadingRequested) {
-            mLoadingRequested = true;
-            mMainThreadHandler.sendEmptyMessage(MESSAGE_REQUEST_LOADING);
-        }
-    }
-
-    /**
-     * Processes requests on the main thread.
-     */
-    public boolean handleMessage(Message msg) {
-        switch (msg.what) {
-            case MESSAGE_REQUEST_LOADING: {
-                mLoadingRequested = false;
-                if (!mPaused) {
-                    if (mLoaderThread == null) {
-                        mLoaderThread = new LoaderThread(mContext.getContentResolver());
-                        mLoaderThread.start();
-                    }
-
-                    mLoaderThread.requestLoading();
-                }
-                return true;
-            }
-
-            case MESSAGE_PHOTOS_LOADED: {
-                if (!mPaused) {
-                    processLoadedImages();
-                }
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Goes over pending loading requests and displays loaded photos.  If some of the
-     * photos still haven't been loaded, sends another request for image loading.
-     */
-    private void processLoadedImages() {
-        Iterator<ImageView> iterator = mPendingRequests.keySet().iterator();
-        while (iterator.hasNext()) {
-            ImageView view = iterator.next();
-            long photoId = mPendingRequests.get(view);
-            boolean loaded = loadCachedPhoto(view, photoId);
-            if (loaded) {
-                iterator.remove();
-            }
-        }
-
-        if (!mPendingRequests.isEmpty()) {
-            requestLoading();
-        }
-    }
-
-    /**
-     * Stores the supplied bitmap in cache.
-     */
-    private void cacheBitmap(long id, byte[] bytes) {
-        if (mPaused) {
-            return;
-        }
-
-        BitmapHolder holder = new BitmapHolder();
-        holder.state = BitmapHolder.LOADED;
-        if (bytes != null) {
-            try {
-                Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, null);
-                holder.bitmapRef = new SoftReference<Bitmap>(bitmap);
-            } catch (OutOfMemoryError e) {
-                // Do nothing - the photo will appear to be missing
-            }
-        }
-        mBitmapCache.put(id, holder);
-    }
-
-    /**
-     * Populates an array of photo IDs that need to be loaded.
-     */
-    private void obtainPhotoIdsToLoad(ArrayList<Long> photoIds,
-            ArrayList<String> photoIdsAsStrings) {
-        photoIds.clear();
-        photoIdsAsStrings.clear();
-
-        /*
-         * Since the call is made from the loader thread, the map could be
-         * changing during the iteration. That's not really a problem:
-         * ConcurrentHashMap will allow those changes to happen without throwing
-         * exceptions. Since we may miss some requests in the situation of
-         * concurrent change, we will need to check the map again once loading
-         * is complete.
-         */
-        Iterator<Long> iterator = mPendingRequests.values().iterator();
-        while (iterator.hasNext()) {
-            Long id = iterator.next();
-            BitmapHolder holder = mBitmapCache.get(id);
-            if (holder != null && holder.state == BitmapHolder.NEEDED) {
-                // Assuming atomic behavior
-                holder.state = BitmapHolder.LOADING;
-                photoIds.add(id);
-                photoIdsAsStrings.add(id.toString());
-            }
-        }
-    }
-
-    /**
-     * The thread that performs loading of photos from the database.
-     */
-    private class LoaderThread extends HandlerThread implements Callback {
-        private final ContentResolver mResolver;
-        private final StringBuilder mStringBuilder = new StringBuilder();
-        private final ArrayList<Long> mPhotoIds = Lists.newArrayList();
-        private final ArrayList<String> mPhotoIdsAsStrings = Lists.newArrayList();
-        private Handler mLoaderThreadHandler;
-
-        public LoaderThread(ContentResolver resolver) {
-            super(LOADER_THREAD_NAME);
-            mResolver = resolver;
-        }
-
-        /**
-         * Sends a message to this thread to load requested photos.
-         */
-        public void requestLoading() {
-            if (mLoaderThreadHandler == null) {
-                mLoaderThreadHandler = new Handler(getLooper(), this);
-            }
-            mLoaderThreadHandler.sendEmptyMessage(0);
-        }
-
-        /**
-         * Receives the above message, loads photos and then sends a message
-         * to the main thread to process them.
-         */
-        public boolean handleMessage(Message msg) {
-            loadPhotosFromDatabase();
-            mMainThreadHandler.sendEmptyMessage(MESSAGE_PHOTOS_LOADED);
-            return true;
-        }
-
-        private void loadPhotosFromDatabase() {
-            obtainPhotoIdsToLoad(mPhotoIds, mPhotoIdsAsStrings);
-
-            int count = mPhotoIds.size();
-            if (count == 0) {
-                return;
-            }
-
-            mStringBuilder.setLength(0);
-            mStringBuilder.append(Photo._ID + " IN(");
-            for (int i = 0; i < count; i++) {
-                if (i != 0) {
-                    mStringBuilder.append(',');
-                }
-                mStringBuilder.append('?');
-            }
-            mStringBuilder.append(')');
-
-            Cursor cursor = null;
-            try {
-                cursor = mResolver.query(Data.CONTENT_URI,
-                        COLUMNS,
-                        mStringBuilder.toString(),
-                        mPhotoIdsAsStrings.toArray(EMPTY_STRING_ARRAY),
-                        null);
-
-                if (cursor != null) {
-                    while (cursor.moveToNext()) {
-                        Long id = cursor.getLong(0);
-                        byte[] bytes = cursor.getBlob(1);
-                        cacheBitmap(id, bytes);
-                        mPhotoIds.remove(id);
-                    }
-                }
-            } finally {
-                if (cursor != null) {
-                    cursor.close();
-                }
-            }
-
-            // Remaining photos were not found in the database - mark the cache accordingly.
-            count = mPhotoIds.size();
-            for (int i = 0; i < count; i++) {
-                cacheBitmap(mPhotoIds.get(i), null);
-            }
-        }
-    }
-}
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
deleted file mode 100644
index ac6a3a8..0000000
--- a/src/com/android/contacts/ContactsListActivity.java
+++ /dev/null
@@ -1,3614 +0,0 @@
-/*
- * Copyright (C) 2007 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.contacts;
-
-import com.android.contacts.TextHighlightingAnimation.TextWithHighlighting;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Sources;
-import com.android.contacts.ui.ContactsPreferences;
-import com.android.contacts.ui.ContactsPreferencesActivity;
-import com.android.contacts.ui.ContactsPreferencesActivity.Prefs;
-import com.android.contacts.util.AccountSelectionUtil;
-import com.android.contacts.util.Constants;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ListActivity;
-import android.app.SearchManager;
-import android.content.AsyncQueryHandler;
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.IContentService;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.UriMatcher;
-import android.content.res.ColorStateList;
-import android.content.res.Resources;
-import android.database.CharArrayBuffer;
-import android.database.ContentObserver;
-import android.database.Cursor;
-import android.database.MatrixCursor;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.graphics.Typeface;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.net.Uri.Builder;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Parcelable;
-import android.os.RemoteException;
-import android.preference.PreferenceManager;
-import android.provider.ContactsContract;
-import android.provider.Settings;
-import android.provider.Contacts.ContactMethods;
-import android.provider.Contacts.People;
-import android.provider.Contacts.PeopleColumns;
-import android.provider.Contacts.Phones;
-import android.provider.ContactsContract.ContactCounts;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.Intents;
-import android.provider.ContactsContract.ProviderStatus;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.SearchSnippetColumns;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.Nickname;
-import android.provider.ContactsContract.CommonDataKinds.Organization;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.CommonDataKinds.Photo;
-import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
-import android.provider.ContactsContract.Contacts.AggregationSuggestions;
-import android.provider.ContactsContract.Intents.Insert;
-import android.provider.ContactsContract.Intents.UI;
-import android.telephony.TelephonyManager;
-import android.text.Editable;
-import android.text.Html;
-import android.text.TextUtils;
-import android.text.TextWatcher;
-import android.util.Log;
-import android.view.ContextMenu;
-import android.view.ContextThemeWrapper;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ContextMenu.ContextMenuInfo;
-import android.view.View.OnClickListener;
-import android.view.View.OnFocusChangeListener;
-import android.view.View.OnTouchListener;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.AbsListView;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.CursorAdapter;
-import android.widget.Filter;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.QuickContactBadge;
-import android.widget.SectionIndexer;
-import android.widget.TextView;
-import android.widget.Toast;
-import android.widget.AbsListView.OnScrollListener;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-/**
- * Displays a list of contacts. Usually is embedded into the ContactsActivity.
- */
-@SuppressWarnings("deprecation")
-public class ContactsListActivity extends ListActivity implements View.OnCreateContextMenuListener,
-        View.OnClickListener, View.OnKeyListener, TextWatcher, TextView.OnEditorActionListener,
-        OnFocusChangeListener, OnTouchListener {
-
-    public static class JoinContactActivity extends ContactsListActivity {
-
-    }
-
-    public static class ContactsSearchActivity extends ContactsListActivity {
-
-    }
-
-    private static final String TAG = "ContactsListActivity";
-
-    private static final boolean ENABLE_ACTION_ICON_OVERLAYS = true;
-
-    private static final String LIST_STATE_KEY = "liststate";
-    private static final String SHORTCUT_ACTION_KEY = "shortcutAction";
-
-    static final int MENU_ITEM_VIEW_CONTACT = 1;
-    static final int MENU_ITEM_CALL = 2;
-    static final int MENU_ITEM_EDIT_BEFORE_CALL = 3;
-    static final int MENU_ITEM_SEND_SMS = 4;
-    static final int MENU_ITEM_SEND_IM = 5;
-    static final int MENU_ITEM_EDIT = 6;
-    static final int MENU_ITEM_DELETE = 7;
-    static final int MENU_ITEM_TOGGLE_STAR = 8;
-
-    private static final int SUBACTIVITY_NEW_CONTACT = 1;
-    private static final int SUBACTIVITY_VIEW_CONTACT = 2;
-    private static final int SUBACTIVITY_DISPLAY_GROUP = 3;
-    private static final int SUBACTIVITY_SEARCH = 4;
-    private static final int SUBACTIVITY_FILTER = 5;
-
-    private static final int TEXT_HIGHLIGHTING_ANIMATION_DURATION = 350;
-
-    /**
-     * The action for the join contact activity.
-     * <p>
-     * Input: extra field {@link #EXTRA_AGGREGATE_ID} is the aggregate ID.
-     *
-     * TODO: move to {@link ContactsContract}.
-     */
-    public static final String JOIN_AGGREGATE =
-            "com.android.contacts.action.JOIN_AGGREGATE";
-
-    /**
-     * Used with {@link #JOIN_AGGREGATE} to give it the target for aggregation.
-     * <p>
-     * Type: LONG
-     */
-    public static final String EXTRA_AGGREGATE_ID =
-            "com.android.contacts.action.AGGREGATE_ID";
-
-    /**
-     * Used with {@link #JOIN_AGGREGATE} to give it the name of the aggregation target.
-     * <p>
-     * Type: STRING
-     */
-    @Deprecated
-    public static final String EXTRA_AGGREGATE_NAME =
-            "com.android.contacts.action.AGGREGATE_NAME";
-
-    public static final String AUTHORITIES_FILTER_KEY = "authorities";
-
-    private static final Uri CONTACTS_CONTENT_URI_WITH_LETTER_COUNTS =
-            buildSectionIndexerUri(Contacts.CONTENT_URI);
-
-    /** Mask for picker mode */
-    static final int MODE_MASK_PICKER = 0x80000000;
-    /** Mask for no presence mode */
-    static final int MODE_MASK_NO_PRESENCE = 0x40000000;
-    /** Mask for enabling list filtering */
-    static final int MODE_MASK_NO_FILTER = 0x20000000;
-    /** Mask for having a "create new contact" header in the list */
-    static final int MODE_MASK_CREATE_NEW = 0x10000000;
-    /** Mask for showing photos in the list */
-    static final int MODE_MASK_SHOW_PHOTOS = 0x08000000;
-    /** Mask for hiding additional information e.g. primary phone number in the list */
-    static final int MODE_MASK_NO_DATA = 0x04000000;
-    /** Mask for showing a call button in the list */
-    static final int MODE_MASK_SHOW_CALL_BUTTON = 0x02000000;
-    /** Mask to disable quickcontact (images will show as normal images) */
-    static final int MODE_MASK_DISABLE_QUIKCCONTACT = 0x01000000;
-    /** Mask to show the total number of contacts at the top */
-    static final int MODE_MASK_SHOW_NUMBER_OF_CONTACTS = 0x00800000;
-
-    /** Unknown mode */
-    static final int MODE_UNKNOWN = 0;
-    /** Default mode */
-    static final int MODE_DEFAULT = 4 | MODE_MASK_SHOW_PHOTOS | MODE_MASK_SHOW_NUMBER_OF_CONTACTS;
-    /** Custom mode */
-    static final int MODE_CUSTOM = 8;
-    /** Show all starred contacts */
-    static final int MODE_STARRED = 20 | MODE_MASK_SHOW_PHOTOS;
-    /** Show frequently contacted contacts */
-    static final int MODE_FREQUENT = 30 | MODE_MASK_SHOW_PHOTOS;
-    /** Show starred and the frequent */
-    static final int MODE_STREQUENT = 35 | MODE_MASK_SHOW_PHOTOS | MODE_MASK_SHOW_CALL_BUTTON;
-    /** Show all contacts and pick them when clicking */
-    static final int MODE_PICK_CONTACT = 40 | MODE_MASK_PICKER | MODE_MASK_SHOW_PHOTOS
-            | MODE_MASK_DISABLE_QUIKCCONTACT;
-    /** Show all contacts as well as the option to create a new one */
-    static final int MODE_PICK_OR_CREATE_CONTACT = 42 | MODE_MASK_PICKER | MODE_MASK_CREATE_NEW
-            | MODE_MASK_SHOW_PHOTOS | MODE_MASK_DISABLE_QUIKCCONTACT;
-    /** Show all people through the legacy provider and pick them when clicking */
-    static final int MODE_LEGACY_PICK_PERSON = 43 | MODE_MASK_PICKER
-            | MODE_MASK_DISABLE_QUIKCCONTACT;
-    /** Show all people through the legacy provider as well as the option to create a new one */
-    static final int MODE_LEGACY_PICK_OR_CREATE_PERSON = 44 | MODE_MASK_PICKER
-            | MODE_MASK_CREATE_NEW | MODE_MASK_DISABLE_QUIKCCONTACT;
-    /** Show all contacts and pick them when clicking, and allow creating a new contact */
-    static final int MODE_INSERT_OR_EDIT_CONTACT = 45 | MODE_MASK_PICKER | MODE_MASK_CREATE_NEW
-            | MODE_MASK_SHOW_PHOTOS | MODE_MASK_DISABLE_QUIKCCONTACT;
-    /** Show all phone numbers and pick them when clicking */
-    static final int MODE_PICK_PHONE = 50 | MODE_MASK_PICKER | MODE_MASK_NO_PRESENCE;
-    /** Show all phone numbers through the legacy provider and pick them when clicking */
-    static final int MODE_LEGACY_PICK_PHONE =
-            51 | MODE_MASK_PICKER | MODE_MASK_NO_PRESENCE | MODE_MASK_NO_FILTER;
-    /** Show all postal addresses and pick them when clicking */
-    static final int MODE_PICK_POSTAL =
-            55 | MODE_MASK_PICKER | MODE_MASK_NO_PRESENCE | MODE_MASK_NO_FILTER;
-    /** Show all postal addresses and pick them when clicking */
-    static final int MODE_LEGACY_PICK_POSTAL =
-            56 | MODE_MASK_PICKER | MODE_MASK_NO_PRESENCE | MODE_MASK_NO_FILTER;
-    static final int MODE_GROUP = 57 | MODE_MASK_SHOW_PHOTOS;
-    /** Run a search query */
-    static final int MODE_QUERY = 60 | MODE_MASK_SHOW_PHOTOS | MODE_MASK_NO_FILTER
-            | MODE_MASK_SHOW_NUMBER_OF_CONTACTS;
-    /** Run a search query in PICK mode, but that still launches to VIEW */
-    static final int MODE_QUERY_PICK_TO_VIEW = 65 | MODE_MASK_SHOW_PHOTOS | MODE_MASK_PICKER
-            | MODE_MASK_SHOW_NUMBER_OF_CONTACTS;
-
-    /** Show join suggestions followed by an A-Z list */
-    static final int MODE_JOIN_CONTACT = 70 | MODE_MASK_PICKER | MODE_MASK_NO_PRESENCE
-            | MODE_MASK_NO_DATA | MODE_MASK_SHOW_PHOTOS | MODE_MASK_DISABLE_QUIKCCONTACT;
-
-    /** Run a search query in a PICK mode */
-    static final int MODE_QUERY_PICK = 75 | MODE_MASK_SHOW_PHOTOS | MODE_MASK_NO_FILTER
-            | MODE_MASK_PICKER | MODE_MASK_DISABLE_QUIKCCONTACT | MODE_MASK_SHOW_NUMBER_OF_CONTACTS;
-
-    /** Run a search query in a PICK_PHONE mode */
-    static final int MODE_QUERY_PICK_PHONE = 80 | MODE_MASK_NO_FILTER | MODE_MASK_PICKER
-            | MODE_MASK_SHOW_NUMBER_OF_CONTACTS;
-
-    /** Run a search query in PICK mode, but that still launches to EDIT */
-    static final int MODE_QUERY_PICK_TO_EDIT = 85 | MODE_MASK_NO_FILTER | MODE_MASK_SHOW_PHOTOS
-            | MODE_MASK_PICKER | MODE_MASK_SHOW_NUMBER_OF_CONTACTS;
-
-    /**
-     * An action used to do perform search while in a contact picker.  It is initiated
-     * by the ContactListActivity itself.
-     */
-    private static final String ACTION_SEARCH_INTERNAL = "com.android.contacts.INTERNAL_SEARCH";
-
-    /** Maximum number of suggestions shown for joining aggregates */
-    static final int MAX_SUGGESTIONS = 4;
-
-    static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] {
-        Contacts._ID,                       // 0
-        Contacts.DISPLAY_NAME_PRIMARY,      // 1
-        Contacts.DISPLAY_NAME_ALTERNATIVE,  // 2
-        Contacts.SORT_KEY_PRIMARY,          // 3
-        Contacts.STARRED,                   // 4
-        Contacts.TIMES_CONTACTED,           // 5
-        Contacts.CONTACT_PRESENCE,          // 6
-        Contacts.PHOTO_ID,                  // 7
-        Contacts.LOOKUP_KEY,                // 8
-        Contacts.PHONETIC_NAME,             // 9
-        Contacts.HAS_PHONE_NUMBER,          // 10
-    };
-    static final String[] CONTACTS_SUMMARY_PROJECTION_FROM_EMAIL = new String[] {
-        Contacts._ID,                       // 0
-        Contacts.DISPLAY_NAME_PRIMARY,      // 1
-        Contacts.DISPLAY_NAME_ALTERNATIVE,  // 2
-        Contacts.SORT_KEY_PRIMARY,          // 3
-        Contacts.STARRED,                   // 4
-        Contacts.TIMES_CONTACTED,           // 5
-        Contacts.CONTACT_PRESENCE,          // 6
-        Contacts.PHOTO_ID,                  // 7
-        Contacts.LOOKUP_KEY,                // 8
-        Contacts.PHONETIC_NAME,             // 9
-        // email lookup doesn't included HAS_PHONE_NUMBER in projection
-    };
-
-    static final String[] CONTACTS_SUMMARY_FILTER_PROJECTION = new String[] {
-        Contacts._ID,                       // 0
-        Contacts.DISPLAY_NAME_PRIMARY,      // 1
-        Contacts.DISPLAY_NAME_ALTERNATIVE,  // 2
-        Contacts.SORT_KEY_PRIMARY,          // 3
-        Contacts.STARRED,                   // 4
-        Contacts.TIMES_CONTACTED,           // 5
-        Contacts.CONTACT_PRESENCE,          // 6
-        Contacts.PHOTO_ID,                  // 7
-        Contacts.LOOKUP_KEY,                // 8
-        Contacts.PHONETIC_NAME,             // 9
-        Contacts.HAS_PHONE_NUMBER,          // 10
-        SearchSnippetColumns.SNIPPET_MIMETYPE, // 11
-        SearchSnippetColumns.SNIPPET_DATA1,     // 12
-        SearchSnippetColumns.SNIPPET_DATA4,     // 13
-    };
-
-    static final String[] LEGACY_PEOPLE_PROJECTION = new String[] {
-        People._ID,                         // 0
-        People.DISPLAY_NAME,                // 1
-        People.DISPLAY_NAME,                // 2
-        People.DISPLAY_NAME,                // 3
-        People.STARRED,                     // 4
-        PeopleColumns.TIMES_CONTACTED,      // 5
-        People.PRESENCE_STATUS,             // 6
-    };
-    static final int SUMMARY_ID_COLUMN_INDEX = 0;
-    static final int SUMMARY_DISPLAY_NAME_PRIMARY_COLUMN_INDEX = 1;
-    static final int SUMMARY_DISPLAY_NAME_ALTERNATIVE_COLUMN_INDEX = 2;
-    static final int SUMMARY_SORT_KEY_PRIMARY_COLUMN_INDEX = 3;
-    static final int SUMMARY_STARRED_COLUMN_INDEX = 4;
-    static final int SUMMARY_TIMES_CONTACTED_COLUMN_INDEX = 5;
-    static final int SUMMARY_PRESENCE_STATUS_COLUMN_INDEX = 6;
-    static final int SUMMARY_PHOTO_ID_COLUMN_INDEX = 7;
-    static final int SUMMARY_LOOKUP_KEY_COLUMN_INDEX = 8;
-    static final int SUMMARY_PHONETIC_NAME_COLUMN_INDEX = 9;
-    static final int SUMMARY_HAS_PHONE_COLUMN_INDEX = 10;
-    static final int SUMMARY_SNIPPET_MIMETYPE_COLUMN_INDEX = 11;
-    static final int SUMMARY_SNIPPET_DATA1_COLUMN_INDEX = 12;
-    static final int SUMMARY_SNIPPET_DATA4_COLUMN_INDEX = 13;
-
-    static final String[] PHONES_PROJECTION = new String[] {
-        Phone._ID, //0
-        Phone.TYPE, //1
-        Phone.LABEL, //2
-        Phone.NUMBER, //3
-        Phone.DISPLAY_NAME, // 4
-        Phone.CONTACT_ID, // 5
-    };
-    static final String[] LEGACY_PHONES_PROJECTION = new String[] {
-        Phones._ID, //0
-        Phones.TYPE, //1
-        Phones.LABEL, //2
-        Phones.NUMBER, //3
-        People.DISPLAY_NAME, // 4
-    };
-    static final int PHONE_ID_COLUMN_INDEX = 0;
-    static final int PHONE_TYPE_COLUMN_INDEX = 1;
-    static final int PHONE_LABEL_COLUMN_INDEX = 2;
-    static final int PHONE_NUMBER_COLUMN_INDEX = 3;
-    static final int PHONE_DISPLAY_NAME_COLUMN_INDEX = 4;
-    static final int PHONE_CONTACT_ID_COLUMN_INDEX = 5;
-
-    static final String[] POSTALS_PROJECTION = new String[] {
-        StructuredPostal._ID, //0
-        StructuredPostal.TYPE, //1
-        StructuredPostal.LABEL, //2
-        StructuredPostal.DATA, //3
-        StructuredPostal.DISPLAY_NAME, // 4
-    };
-    static final String[] LEGACY_POSTALS_PROJECTION = new String[] {
-        ContactMethods._ID, //0
-        ContactMethods.TYPE, //1
-        ContactMethods.LABEL, //2
-        ContactMethods.DATA, //3
-        People.DISPLAY_NAME, // 4
-    };
-    static final String[] RAW_CONTACTS_PROJECTION = new String[] {
-        RawContacts._ID, //0
-        RawContacts.CONTACT_ID, //1
-        RawContacts.ACCOUNT_TYPE, //2
-    };
-
-    static final int POSTAL_ID_COLUMN_INDEX = 0;
-    static final int POSTAL_TYPE_COLUMN_INDEX = 1;
-    static final int POSTAL_LABEL_COLUMN_INDEX = 2;
-    static final int POSTAL_ADDRESS_COLUMN_INDEX = 3;
-    static final int POSTAL_DISPLAY_NAME_COLUMN_INDEX = 4;
-
-    private static final int QUERY_TOKEN = 42;
-
-    static final String KEY_PICKER_MODE = "picker_mode";
-
-    private ContactItemListAdapter mAdapter;
-
-    int mMode = MODE_DEFAULT;
-
-    private QueryHandler mQueryHandler;
-    private boolean mJustCreated;
-    private boolean mSyncEnabled;
-    Uri mSelectedContactUri;
-
-//    private boolean mDisplayAll;
-    private boolean mDisplayOnlyPhones;
-
-    private Uri mGroupUri;
-
-    private long mQueryAggregateId;
-
-    private ArrayList<Long> mWritableRawContactIds = new ArrayList<Long>();
-    private int  mWritableSourcesCnt;
-    private int  mReadOnlySourcesCnt;
-
-    /**
-     * Used to keep track of the scroll state of the list.
-     */
-    private Parcelable mListState = null;
-
-    private String mShortcutAction;
-
-    /**
-     * Internal query type when in mode {@link #MODE_QUERY_PICK_TO_VIEW}.
-     */
-    private int mQueryMode = QUERY_MODE_NONE;
-
-    private static final int QUERY_MODE_NONE = -1;
-    private static final int QUERY_MODE_MAILTO = 1;
-    private static final int QUERY_MODE_TEL = 2;
-
-    private int mProviderStatus = ProviderStatus.STATUS_NORMAL;
-
-    private boolean mSearchMode;
-    private boolean mSearchResultsMode;
-    private boolean mShowNumberOfContacts;
-
-    private boolean mShowSearchSnippets;
-    private boolean mSearchInitiated;
-
-    private String mInitialFilter;
-
-    private static final String CLAUSE_ONLY_VISIBLE = Contacts.IN_VISIBLE_GROUP + "=1";
-    private static final String CLAUSE_ONLY_PHONES = Contacts.HAS_PHONE_NUMBER + "=1";
-
-    /**
-     * In the {@link #MODE_JOIN_CONTACT} determines whether we display a list item with the label
-     * "Show all contacts" or actually show all contacts
-     */
-    private boolean mJoinModeShowAllContacts;
-
-    /**
-     * The ID of the special item described above.
-     */
-    private static final long JOIN_MODE_SHOW_ALL_CONTACTS_ID = -2;
-
-    // Uri matcher for contact id
-    private static final int CONTACTS_ID = 1001;
-    private static final UriMatcher sContactsIdMatcher;
-
-    private ContactPhotoLoader mPhotoLoader;
-
-    final String[] sLookupProjection = new String[] {
-            Contacts.LOOKUP_KEY
-    };
-
-    static {
-        sContactsIdMatcher = new UriMatcher(UriMatcher.NO_MATCH);
-        sContactsIdMatcher.addURI(ContactsContract.AUTHORITY, "contacts/#", CONTACTS_ID);
-    }
-
-    private class DeleteClickListener implements DialogInterface.OnClickListener {
-        public void onClick(DialogInterface dialog, int which) {
-            if (mSelectedContactUri != null) {
-                getContentResolver().delete(mSelectedContactUri, null, null);
-            }
-        }
-    }
-
-    /**
-     * A {@link TextHighlightingAnimation} that redraws just the contact display name in a
-     * list item.
-     */
-    private static class NameHighlightingAnimation extends TextHighlightingAnimation {
-        private final ListView mListView;
-
-        private NameHighlightingAnimation(ListView listView, int duration) {
-            super(duration);
-            this.mListView = listView;
-        }
-
-        /**
-         * Redraws all visible items of the list corresponding to contacts
-         */
-        @Override
-        protected void invalidate() {
-            int childCount = mListView.getChildCount();
-            for (int i = 0; i < childCount; i++) {
-                View itemView = mListView.getChildAt(i);
-                if (itemView instanceof ContactListItemView) {
-                    final ContactListItemView view = (ContactListItemView)itemView;
-                    view.getNameTextView().invalidate();
-                }
-            }
-        }
-
-        @Override
-        protected void onAnimationStarted() {
-            mListView.setScrollingCacheEnabled(false);
-        }
-
-        @Override
-        protected void onAnimationEnded() {
-            mListView.setScrollingCacheEnabled(true);
-        }
-    }
-
-    // The size of a home screen shortcut icon.
-    private int mIconSize;
-    private ContactsPreferences mContactsPrefs;
-    private int mDisplayOrder;
-    private int mSortOrder;
-    private boolean mHighlightWhenScrolling;
-    private TextHighlightingAnimation mHighlightingAnimation;
-    private SearchEditText mSearchEditText;
-
-    /**
-     * An approximation of the background color of the pinned header. This color
-     * is used when the pinned header is being pushed up.  At that point the header
-     * "fades away".  Rather than computing a faded bitmap based on the 9-patch
-     * normally used for the background, we will use a solid color, which will
-     * provide better performance and reduced complexity.
-     */
-    private int mPinnedHeaderBackgroundColor;
-
-    private ContentObserver mProviderStatusObserver = new ContentObserver(new Handler()) {
-
-        @Override
-        public void onChange(boolean selfChange) {
-            checkProviderState(true);
-        }
-    };
-
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        mIconSize = getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
-        mContactsPrefs = new ContactsPreferences(this);
-        mPhotoLoader = new ContactPhotoLoader(this, R.drawable.ic_contact_list_picture);
-
-        // Resolve the intent
-        final Intent intent = getIntent();
-
-        // Allow the title to be set to a custom String using an extra on the intent
-        String title = intent.getStringExtra(UI.TITLE_EXTRA_KEY);
-        if (title != null) {
-            setTitle(title);
-        }
-
-        String action = intent.getAction();
-        String component = intent.getComponent().getClassName();
-
-        // When we get a FILTER_CONTACTS_ACTION, it represents search in the context
-        // of some other action. Let's retrieve the original action to provide proper
-        // context for the search queries.
-        if (UI.FILTER_CONTACTS_ACTION.equals(action)) {
-            mSearchMode = true;
-            mShowSearchSnippets = true;
-            Bundle extras = intent.getExtras();
-            if (extras != null) {
-                mInitialFilter = extras.getString(UI.FILTER_TEXT_EXTRA_KEY);
-                String originalAction =
-                        extras.getString(ContactsSearchManager.ORIGINAL_ACTION_EXTRA_KEY);
-                if (originalAction != null) {
-                    action = originalAction;
-                }
-                String originalComponent =
-                        extras.getString(ContactsSearchManager.ORIGINAL_COMPONENT_EXTRA_KEY);
-                if (originalComponent != null) {
-                    component = originalComponent;
-                }
-            } else {
-                mInitialFilter = null;
-            }
-        }
-
-        Log.i(TAG, "Called with action: " + action);
-        mMode = MODE_UNKNOWN;
-        if (UI.LIST_DEFAULT.equals(action) || UI.FILTER_CONTACTS_ACTION.equals(action)) {
-            mMode = MODE_DEFAULT;
-            // When mDefaultMode is true the mode is set in onResume(), since the preferneces
-            // activity may change it whenever this activity isn't running
-        } else if (UI.LIST_GROUP_ACTION.equals(action)) {
-            mMode = MODE_GROUP;
-            String groupName = intent.getStringExtra(UI.GROUP_NAME_EXTRA_KEY);
-            if (TextUtils.isEmpty(groupName)) {
-                finish();
-                return;
-            }
-            buildUserGroupUri(groupName);
-        } else if (UI.LIST_ALL_CONTACTS_ACTION.equals(action)) {
-            mMode = MODE_CUSTOM;
-            mDisplayOnlyPhones = false;
-        } else if (UI.LIST_STARRED_ACTION.equals(action)) {
-            mMode = mSearchMode ? MODE_DEFAULT : MODE_STARRED;
-        } else if (UI.LIST_FREQUENT_ACTION.equals(action)) {
-            mMode = mSearchMode ? MODE_DEFAULT : MODE_FREQUENT;
-        } else if (UI.LIST_STREQUENT_ACTION.equals(action)) {
-            mMode = mSearchMode ? MODE_DEFAULT : MODE_STREQUENT;
-        } else if (UI.LIST_CONTACTS_WITH_PHONES_ACTION.equals(action)) {
-            mMode = MODE_CUSTOM;
-            mDisplayOnlyPhones = true;
-        } else if (Intent.ACTION_PICK.equals(action)) {
-            // XXX These should be showing the data from the URI given in
-            // the Intent.
-            final String type = intent.resolveType(this);
-            if (Contacts.CONTENT_TYPE.equals(type)) {
-                mMode = MODE_PICK_CONTACT;
-            } else if (People.CONTENT_TYPE.equals(type)) {
-                mMode = MODE_LEGACY_PICK_PERSON;
-            } else if (Phone.CONTENT_TYPE.equals(type)) {
-                mMode = MODE_PICK_PHONE;
-            } else if (Phones.CONTENT_TYPE.equals(type)) {
-                mMode = MODE_LEGACY_PICK_PHONE;
-            } else if (StructuredPostal.CONTENT_TYPE.equals(type)) {
-                mMode = MODE_PICK_POSTAL;
-            } else if (ContactMethods.CONTENT_POSTAL_TYPE.equals(type)) {
-                mMode = MODE_LEGACY_PICK_POSTAL;
-            }
-        } else if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) {
-            if (component.equals("alias.DialShortcut")) {
-                mMode = MODE_PICK_PHONE;
-                mShortcutAction = Intent.ACTION_CALL;
-                mShowSearchSnippets = false;
-                setTitle(R.string.callShortcutActivityTitle);
-            } else if (component.equals("alias.MessageShortcut")) {
-                mMode = MODE_PICK_PHONE;
-                mShortcutAction = Intent.ACTION_SENDTO;
-                mShowSearchSnippets = false;
-                setTitle(R.string.messageShortcutActivityTitle);
-            } else if (mSearchMode) {
-                mMode = MODE_PICK_CONTACT;
-                mShortcutAction = Intent.ACTION_VIEW;
-                setTitle(R.string.shortcutActivityTitle);
-            } else {
-                mMode = MODE_PICK_OR_CREATE_CONTACT;
-                mShortcutAction = Intent.ACTION_VIEW;
-                setTitle(R.string.shortcutActivityTitle);
-            }
-        } else if (Intent.ACTION_GET_CONTENT.equals(action)) {
-            final String type = intent.resolveType(this);
-            if (Contacts.CONTENT_ITEM_TYPE.equals(type)) {
-                if (mSearchMode) {
-                    mMode = MODE_PICK_CONTACT;
-                } else {
-                    mMode = MODE_PICK_OR_CREATE_CONTACT;
-                }
-            } else if (Phone.CONTENT_ITEM_TYPE.equals(type)) {
-                mMode = MODE_PICK_PHONE;
-            } else if (Phones.CONTENT_ITEM_TYPE.equals(type)) {
-                mMode = MODE_LEGACY_PICK_PHONE;
-            } else if (StructuredPostal.CONTENT_ITEM_TYPE.equals(type)) {
-                mMode = MODE_PICK_POSTAL;
-            } else if (ContactMethods.CONTENT_POSTAL_ITEM_TYPE.equals(type)) {
-                mMode = MODE_LEGACY_PICK_POSTAL;
-            }  else if (People.CONTENT_ITEM_TYPE.equals(type)) {
-                if (mSearchMode) {
-                    mMode = MODE_LEGACY_PICK_PERSON;
-                } else {
-                    mMode = MODE_LEGACY_PICK_OR_CREATE_PERSON;
-                }
-            }
-
-        } else if (Intent.ACTION_INSERT_OR_EDIT.equals(action)) {
-            mMode = MODE_INSERT_OR_EDIT_CONTACT;
-        } else if (Intent.ACTION_SEARCH.equals(action)) {
-            // See if the suggestion was clicked with a search action key (call button)
-            if ("call".equals(intent.getStringExtra(SearchManager.ACTION_MSG))) {
-                String query = intent.getStringExtra(SearchManager.QUERY);
-                if (!TextUtils.isEmpty(query)) {
-                    Intent newIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
-                            Uri.fromParts("tel", query, null));
-                    startActivity(newIntent);
-                }
-                finish();
-                return;
-            }
-
-            // See if search request has extras to specify query
-            if (intent.hasExtra(Insert.EMAIL)) {
-                mMode = MODE_QUERY_PICK_TO_VIEW;
-                mQueryMode = QUERY_MODE_MAILTO;
-                mInitialFilter = intent.getStringExtra(Insert.EMAIL);
-            } else if (intent.hasExtra(Insert.PHONE)) {
-                mMode = MODE_QUERY_PICK_TO_VIEW;
-                mQueryMode = QUERY_MODE_TEL;
-                mInitialFilter = intent.getStringExtra(Insert.PHONE);
-            } else {
-                // Otherwise handle the more normal search case
-                mMode = MODE_QUERY;
-                mShowSearchSnippets = true;
-                mInitialFilter = getIntent().getStringExtra(SearchManager.QUERY);
-            }
-            mSearchResultsMode = true;
-        } else if (ACTION_SEARCH_INTERNAL.equals(action)) {
-            String originalAction = null;
-            Bundle extras = intent.getExtras();
-            if (extras != null) {
-                originalAction = extras.getString(ContactsSearchManager.ORIGINAL_ACTION_EXTRA_KEY);
-            }
-            mShortcutAction = intent.getStringExtra(SHORTCUT_ACTION_KEY);
-
-            if (Intent.ACTION_INSERT_OR_EDIT.equals(originalAction)) {
-                mMode = MODE_QUERY_PICK_TO_EDIT;
-                mShowSearchSnippets = true;
-                mInitialFilter = getIntent().getStringExtra(SearchManager.QUERY);
-            } else if (mShortcutAction != null && intent.hasExtra(Insert.PHONE)) {
-                mMode = MODE_QUERY_PICK_PHONE;
-                mQueryMode = QUERY_MODE_TEL;
-                mInitialFilter = intent.getStringExtra(Insert.PHONE);
-            } else {
-                mMode = MODE_QUERY_PICK;
-                mQueryMode = QUERY_MODE_NONE;
-                mShowSearchSnippets = true;
-                mInitialFilter = getIntent().getStringExtra(SearchManager.QUERY);
-            }
-            mSearchResultsMode = true;
-        // Since this is the filter activity it receives all intents
-        // dispatched from the SearchManager for security reasons
-        // so we need to re-dispatch from here to the intended target.
-        } else if (Intents.SEARCH_SUGGESTION_CLICKED.equals(action)) {
-            Uri data = intent.getData();
-            Uri telUri = null;
-            if (sContactsIdMatcher.match(data) == CONTACTS_ID) {
-                long contactId = Long.valueOf(data.getLastPathSegment());
-                final Cursor cursor = queryPhoneNumbers(contactId);
-                if (cursor != null) {
-                    if (cursor.getCount() == 1 && cursor.moveToFirst()) {
-                        int phoneNumberIndex = cursor.getColumnIndex(Phone.NUMBER);
-                        String phoneNumber = cursor.getString(phoneNumberIndex);
-                        telUri = Uri.parse("tel:" + phoneNumber);
-                    }
-                    cursor.close();
-                }
-            }
-            // See if the suggestion was clicked with a search action key (call button)
-            Intent newIntent;
-            if ("call".equals(intent.getStringExtra(SearchManager.ACTION_MSG)) && telUri != null) {
-                newIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED, telUri);
-            } else {
-                newIntent = new Intent(Intent.ACTION_VIEW, data);
-            }
-            startActivity(newIntent);
-            finish();
-            return;
-        } else if (Intents.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED.equals(action)) {
-            Intent newIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED, intent.getData());
-            startActivity(newIntent);
-            finish();
-            return;
-        } else if (Intents.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED.equals(action)) {
-            // TODO actually support this in EditContactActivity.
-            String number = intent.getData().getSchemeSpecificPart();
-            Intent newIntent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
-            newIntent.putExtra(Intents.Insert.PHONE, number);
-            startActivity(newIntent);
-            finish();
-            return;
-        }
-
-        if (JOIN_AGGREGATE.equals(action)) {
-            if (mSearchMode) {
-                mMode = MODE_PICK_CONTACT;
-            } else {
-                mMode = MODE_JOIN_CONTACT;
-                mQueryAggregateId = intent.getLongExtra(EXTRA_AGGREGATE_ID, -1);
-                if (mQueryAggregateId == -1) {
-                    Log.e(TAG, "Intent " + action + " is missing required extra: "
-                            + EXTRA_AGGREGATE_ID);
-                    setResult(RESULT_CANCELED);
-                    finish();
-                }
-            }
-        }
-
-        if (mMode == MODE_UNKNOWN) {
-            mMode = MODE_DEFAULT;
-        }
-
-        if (((mMode & MODE_MASK_SHOW_NUMBER_OF_CONTACTS) != 0 || mSearchMode)
-                && !mSearchResultsMode) {
-            mShowNumberOfContacts = true;
-        }
-
-        if (mMode == MODE_JOIN_CONTACT) {
-            setContentView(R.layout.contacts_list_content_join);
-            TextView blurbView = (TextView)findViewById(R.id.join_contact_blurb);
-
-            String blurb = getString(R.string.blurbJoinContactDataWith,
-                    getContactDisplayName(mQueryAggregateId));
-            blurbView.setText(blurb);
-            mJoinModeShowAllContacts = true;
-        } else if (mSearchMode) {
-            setContentView(R.layout.contacts_search_content);
-        } else if (mSearchResultsMode) {
-            setContentView(R.layout.contacts_list_search_results);
-            TextView titleText = (TextView)findViewById(R.id.search_results_for);
-            titleText.setText(Html.fromHtml(getString(R.string.search_results_for,
-                    "<b>" + mInitialFilter + "</b>")));
-        } else {
-            setContentView(R.layout.contacts_list_content);
-        }
-
-        setupListView();
-        if (mSearchMode) {
-            setupSearchView();
-        }
-
-        mQueryHandler = new QueryHandler(this);
-        mJustCreated = true;
-
-        mSyncEnabled = true;
-    }
-
-    /**
-     * Register an observer for provider status changes - we will need to
-     * reflect them in the UI.
-     */
-    private void registerProviderStatusObserver() {
-        getContentResolver().registerContentObserver(ProviderStatus.CONTENT_URI,
-                false, mProviderStatusObserver);
-    }
-
-    /**
-     * Register an observer for provider status changes - we will need to
-     * reflect them in the UI.
-     */
-    private void unregisterProviderStatusObserver() {
-        getContentResolver().unregisterContentObserver(mProviderStatusObserver);
-    }
-
-    private void setupListView() {
-        final ListView list = getListView();
-        final LayoutInflater inflater = getLayoutInflater();
-
-        mHighlightingAnimation =
-                new NameHighlightingAnimation(list, TEXT_HIGHLIGHTING_ANIMATION_DURATION);
-
-        // Tell list view to not show dividers. We'll do it ourself so that we can *not* show
-        // them when an A-Z headers is visible.
-        list.setDividerHeight(0);
-        list.setOnCreateContextMenuListener(this);
-
-        mAdapter = new ContactItemListAdapter(this);
-        setListAdapter(mAdapter);
-
-        if (list instanceof PinnedHeaderListView && mAdapter.getDisplaySectionHeadersEnabled()) {
-            mPinnedHeaderBackgroundColor =
-                    getResources().getColor(R.color.pinned_header_background);
-            PinnedHeaderListView pinnedHeaderList = (PinnedHeaderListView)list;
-            View pinnedHeader = inflater.inflate(R.layout.list_section, list, false);
-            pinnedHeaderList.setPinnedHeaderView(pinnedHeader);
-        }
-
-        list.setOnScrollListener(mAdapter);
-        list.setOnKeyListener(this);
-        list.setOnFocusChangeListener(this);
-        list.setOnTouchListener(this);
-
-        // We manually save/restore the listview state
-        list.setSaveEnabled(false);
-    }
-
-    /**
-     * Configures search UI.
-     */
-    private void setupSearchView() {
-        mSearchEditText = (SearchEditText)findViewById(R.id.search_src_text);
-        mSearchEditText.addTextChangedListener(this);
-        mSearchEditText.setOnEditorActionListener(this);
-        mSearchEditText.setText(mInitialFilter);
-    }
-
-    private String getContactDisplayName(long contactId) {
-        String contactName = null;
-        Cursor c = getContentResolver().query(
-                ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId),
-                new String[] {Contacts.DISPLAY_NAME}, null, null, null);
-        try {
-            if (c != null && c.moveToFirst()) {
-                contactName = c.getString(0);
-            }
-        } finally {
-            if (c != null) {
-                c.close();
-            }
-        }
-
-        if (contactName == null) {
-            contactName = "";
-        }
-
-        return contactName;
-    }
-
-    private int getSummaryDisplayNameColumnIndex() {
-        if (mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY) {
-            return SUMMARY_DISPLAY_NAME_PRIMARY_COLUMN_INDEX;
-        } else {
-            return SUMMARY_DISPLAY_NAME_ALTERNATIVE_COLUMN_INDEX;
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void onClick(View v) {
-        int id = v.getId();
-        switch (id) {
-            // TODO a better way of identifying the button
-            case android.R.id.button1: {
-                final int position = (Integer)v.getTag();
-                Cursor c = mAdapter.getCursor();
-                if (c != null) {
-                    c.moveToPosition(position);
-                    callContact(c);
-                }
-                break;
-            }
-        }
-    }
-
-    private void setEmptyText() {
-        if (mMode == MODE_JOIN_CONTACT || mSearchMode) {
-            return;
-        }
-
-        TextView empty = (TextView) findViewById(R.id.emptyText);
-        if (mDisplayOnlyPhones) {
-            empty.setText(getText(R.string.noContactsWithPhoneNumbers));
-        } else if (mMode == MODE_STREQUENT || mMode == MODE_STARRED) {
-            empty.setText(getText(R.string.noFavoritesHelpText));
-        } else if (mMode == MODE_QUERY || mMode == MODE_QUERY_PICK
-                || mMode == MODE_QUERY_PICK_PHONE || mMode == MODE_QUERY_PICK_TO_VIEW
-                || mMode == MODE_QUERY_PICK_TO_EDIT) {
-            empty.setText(getText(R.string.noMatchingContacts));
-        } else {
-            boolean hasSim = ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE))
-                    .hasIccCard();
-            boolean createShortcut = Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction());
-            if (isSyncActive()) {
-                if (createShortcut) {
-                    // Help text is the same no matter whether there is SIM or not.
-                    empty.setText(getText(R.string.noContactsHelpTextWithSyncForCreateShortcut));
-                } else if (hasSim) {
-                    empty.setText(getText(R.string.noContactsHelpTextWithSync));
-                } else {
-                    empty.setText(getText(R.string.noContactsNoSimHelpTextWithSync));
-                }
-            } else {
-                if (createShortcut) {
-                    // Help text is the same no matter whether there is SIM or not.
-                    empty.setText(getText(R.string.noContactsHelpTextForCreateShortcut));
-                } else if (hasSim) {
-                    empty.setText(getText(R.string.noContactsHelpText));
-                } else {
-                    empty.setText(getText(R.string.noContactsNoSimHelpText));
-                }
-            }
-        }
-    }
-
-    private boolean isSyncActive() {
-        Account[] accounts = AccountManager.get(this).getAccounts();
-        if (accounts != null && accounts.length > 0) {
-            IContentService contentService = ContentResolver.getContentService();
-            for (Account account : accounts) {
-                try {
-                    if (contentService.isSyncActive(account, ContactsContract.AUTHORITY)) {
-                        return true;
-                    }
-                } catch (RemoteException e) {
-                    Log.e(TAG, "Could not get the sync status");
-                }
-            }
-        }
-        return false;
-    }
-
-    private void buildUserGroupUri(String group) {
-        mGroupUri = Uri.withAppendedPath(Contacts.CONTENT_GROUP_URI, group);
-    }
-
-    /**
-     * Sets the mode when the request is for "default"
-     */
-    private void setDefaultMode() {
-        // Load the preferences
-        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
-
-        mDisplayOnlyPhones = prefs.getBoolean(Prefs.DISPLAY_ONLY_PHONES,
-                Prefs.DISPLAY_ONLY_PHONES_DEFAULT);
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        mPhotoLoader.stop();
-    }
-
-    @Override
-    protected void onStart() {
-        super.onStart();
-
-        mContactsPrefs.registerChangeListener(mPreferencesChangeListener);
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        unregisterProviderStatusObserver();
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-
-        registerProviderStatusObserver();
-        mPhotoLoader.resume();
-
-        Activity parent = getParent();
-
-        // Do this before setting the filter. The filter thread relies
-        // on some state that is initialized in setDefaultMode
-        if (mMode == MODE_DEFAULT) {
-            // If we're in default mode we need to possibly reset the mode due to a change
-            // in the preferences activity while we weren't running
-            setDefaultMode();
-        }
-
-        // See if we were invoked with a filter
-        if (mSearchMode) {
-            mSearchEditText.requestFocus();
-        }
-
-        if (!mSearchMode && !checkProviderState(mJustCreated)) {
-            return;
-        }
-
-        if (mJustCreated) {
-            // We need to start a query here the first time the activity is launched, as long
-            // as we aren't doing a filter.
-            startQuery();
-        }
-        mJustCreated = false;
-        mSearchInitiated = false;
-    }
-
-    /**
-     * Obtains the contacts provider status and configures the UI accordingly.
-     *
-     * @param loadData true if the method needs to start a query when the
-     *            provider is in the normal state
-     * @return true if the provider status is normal
-     */
-    private boolean checkProviderState(boolean loadData) {
-        View importFailureView = findViewById(R.id.import_failure);
-        if (importFailureView == null) {
-            return true;
-        }
-
-        TextView messageView = (TextView) findViewById(R.id.emptyText);
-
-        // This query can be performed on the UI thread because
-        // the API explicitly allows such use.
-        Cursor cursor = getContentResolver().query(ProviderStatus.CONTENT_URI, new String[] {
-                ProviderStatus.STATUS, ProviderStatus.DATA1
-        }, null, null, null);
-        try {
-            if (cursor.moveToFirst()) {
-                int status = cursor.getInt(0);
-                if (status != mProviderStatus) {
-                    mProviderStatus = status;
-                    switch (status) {
-                        case ProviderStatus.STATUS_NORMAL:
-                            mAdapter.notifyDataSetInvalidated();
-                            if (loadData) {
-                                startQuery();
-                            }
-                            break;
-
-                        case ProviderStatus.STATUS_CHANGING_LOCALE:
-                            messageView.setText(R.string.locale_change_in_progress);
-                            mAdapter.changeCursor(null);
-                            mAdapter.notifyDataSetInvalidated();
-                            break;
-
-                        case ProviderStatus.STATUS_UPGRADING:
-                            messageView.setText(R.string.upgrade_in_progress);
-                            mAdapter.changeCursor(null);
-                            mAdapter.notifyDataSetInvalidated();
-                            break;
-
-                        case ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY:
-                            long size = cursor.getLong(1);
-                            String message = getResources().getString(
-                                    R.string.upgrade_out_of_memory, new Object[] {size});
-                            messageView.setText(message);
-                            configureImportFailureView(importFailureView);
-                            mAdapter.changeCursor(null);
-                            mAdapter.notifyDataSetInvalidated();
-                            break;
-                    }
-                }
-            }
-        } finally {
-            cursor.close();
-        }
-
-        importFailureView.setVisibility(
-                mProviderStatus == ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY
-                        ? View.VISIBLE
-                        : View.GONE);
-        return mProviderStatus == ProviderStatus.STATUS_NORMAL;
-    }
-
-    private void configureImportFailureView(View importFailureView) {
-
-        OnClickListener listener = new OnClickListener(){
-
-            public void onClick(View v) {
-                switch(v.getId()) {
-                    case R.id.import_failure_uninstall_apps: {
-                        startActivity(new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS));
-                        break;
-                    }
-                    case R.id.import_failure_retry_upgrade: {
-                        // Send a provider status update, which will trigger a retry
-                        ContentValues values = new ContentValues();
-                        values.put(ProviderStatus.STATUS, ProviderStatus.STATUS_UPGRADING);
-                        getContentResolver().update(ProviderStatus.CONTENT_URI, values, null, null);
-                        break;
-                    }
-                }
-            }};
-
-        Button uninstallApps = (Button) findViewById(R.id.import_failure_uninstall_apps);
-        uninstallApps.setOnClickListener(listener);
-
-        Button retryUpgrade = (Button) findViewById(R.id.import_failure_retry_upgrade);
-        retryUpgrade.setOnClickListener(listener);
-    }
-
-    private String getTextFilter() {
-        if (mSearchEditText != null) {
-            return mSearchEditText.getText().toString();
-        }
-        return null;
-    }
-
-    @Override
-    protected void onRestart() {
-        super.onRestart();
-
-        if (!checkProviderState(false)) {
-            return;
-        }
-
-        // The cursor was killed off in onStop(), so we need to get a new one here
-        // We do not perform the query if a filter is set on the list because the
-        // filter will cause the query to happen anyway
-        if (TextUtils.isEmpty(getTextFilter())) {
-            startQuery();
-        } else {
-            // Run the filtered query on the adapter
-            mAdapter.onContentChanged();
-        }
-    }
-
-    @Override
-    protected void onSaveInstanceState(Bundle icicle) {
-        super.onSaveInstanceState(icicle);
-        // Save list state in the bundle so we can restore it after the QueryHandler has run
-        if (mList != null) {
-            icicle.putParcelable(LIST_STATE_KEY, mList.onSaveInstanceState());
-        }
-    }
-
-    @Override
-    protected void onRestoreInstanceState(Bundle icicle) {
-        super.onRestoreInstanceState(icicle);
-        // Retrieve list state. This will be applied after the QueryHandler has run
-        mListState = icicle.getParcelable(LIST_STATE_KEY);
-    }
-
-    @Override
-    protected void onStop() {
-        super.onStop();
-
-        mContactsPrefs.unregisterChangeListener();
-        mAdapter.setSuggestionsCursor(null);
-        mAdapter.changeCursor(null);
-
-        if (mMode == MODE_QUERY) {
-            // Make sure the search box is closed
-            SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
-            searchManager.stopSearch();
-        }
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        super.onCreateOptionsMenu(menu);
-
-        // If Contacts was invoked by another Activity simply as a way of
-        // picking a contact, don't show the options menu
-        if ((mMode & MODE_MASK_PICKER) == MODE_MASK_PICKER) {
-            return false;
-        }
-
-        MenuInflater inflater = getMenuInflater();
-        inflater.inflate(R.menu.list, menu);
-        return true;
-    }
-
-    @Override
-    public boolean onPrepareOptionsMenu(Menu menu) {
-        final boolean defaultMode = (mMode == MODE_DEFAULT);
-        menu.findItem(R.id.menu_display_groups).setVisible(defaultMode);
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case R.id.menu_display_groups: {
-                final Intent intent = new Intent(this, ContactsPreferencesActivity.class);
-                startActivityForResult(intent, SUBACTIVITY_DISPLAY_GROUP);
-                return true;
-            }
-            case R.id.menu_search: {
-                onSearchRequested();
-                return true;
-            }
-            case R.id.menu_add: {
-                final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
-                startActivity(intent);
-                return true;
-            }
-            case R.id.menu_import_export: {
-                displayImportExportDialog();
-                return true;
-            }
-            case R.id.menu_accounts: {
-                final Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
-                intent.putExtra(AUTHORITIES_FILTER_KEY, new String[] {
-                    ContactsContract.AUTHORITY
-                });
-                startActivity(intent);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
-            boolean globalSearch) {
-        if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
-            return;
-        }
-
-        if (globalSearch) {
-            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
-        } else {
-            if (!mSearchMode && (mMode & MODE_MASK_NO_FILTER) == 0) {
-                if ((mMode & MODE_MASK_PICKER) != 0) {
-                    ContactsSearchManager.startSearchForResult(this, initialQuery,
-                            SUBACTIVITY_FILTER);
-                } else {
-                    ContactsSearchManager.startSearch(this, initialQuery);
-                }
-            }
-        }
-    }
-
-    /**
-     * Performs filtering of the list based on the search query entered in the
-     * search text edit.
-     */
-    protected void onSearchTextChanged() {
-        // Set the proper empty string
-        setEmptyText();
-
-        Filter filter = mAdapter.getFilter();
-        filter.filter(getTextFilter());
-    }
-
-    /**
-     * Starts a new activity that will run a search query and display search results.
-     */
-    private void doSearch() {
-        String query = getTextFilter();
-        if (TextUtils.isEmpty(query)) {
-            return;
-        }
-
-        Intent intent = new Intent(this, SearchResultsActivity.class);
-        Intent originalIntent = getIntent();
-        Bundle originalExtras = originalIntent.getExtras();
-        if (originalExtras != null) {
-            intent.putExtras(originalExtras);
-        }
-
-        intent.putExtra(SearchManager.QUERY, query);
-        if ((mMode & MODE_MASK_PICKER) != 0) {
-            intent.setAction(ACTION_SEARCH_INTERNAL);
-            intent.putExtra(SHORTCUT_ACTION_KEY, mShortcutAction);
-            if (mShortcutAction != null) {
-                if (Intent.ACTION_CALL.equals(mShortcutAction)
-                        || Intent.ACTION_SENDTO.equals(mShortcutAction)) {
-                    intent.putExtra(Insert.PHONE, query);
-                }
-            } else {
-                switch (mQueryMode) {
-                    case QUERY_MODE_MAILTO:
-                        intent.putExtra(Insert.EMAIL, query);
-                        break;
-                    case QUERY_MODE_TEL:
-                        intent.putExtra(Insert.PHONE, query);
-                        break;
-                }
-            }
-            startActivityForResult(intent, SUBACTIVITY_SEARCH);
-        } else {
-            intent.setAction(Intent.ACTION_SEARCH);
-            startActivity(intent);
-        }
-    }
-
-    @Override
-    protected Dialog onCreateDialog(int id, Bundle bundle) {
-        switch (id) {
-            case R.string.import_from_sim:
-            case R.string.import_from_sdcard: {
-                return AccountSelectionUtil.getSelectAccountDialog(this, id);
-            }
-            case R.id.dialog_sdcard_not_found: {
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.no_sdcard_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.no_sdcard_message)
-                        .setPositiveButton(android.R.string.ok, null).create();
-            }
-            case R.id.dialog_delete_contact_confirmation: {
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.deleteConfirmation)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .setPositiveButton(android.R.string.ok,
-                                new DeleteClickListener()).create();
-            }
-            case R.id.dialog_readonly_contact_hide_confirmation: {
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.readOnlyContactWarning)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .setPositiveButton(android.R.string.ok,
-                                new DeleteClickListener()).create();
-            }
-            case R.id.dialog_readonly_contact_delete_confirmation: {
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.readOnlyContactDeleteConfirmation)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .setPositiveButton(android.R.string.ok,
-                                new DeleteClickListener()).create();
-            }
-            case R.id.dialog_multiple_contact_delete_confirmation: {
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.multipleContactDeleteConfirmation)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .setPositiveButton(android.R.string.ok,
-                                new DeleteClickListener()).create();
-            }
-        }
-        return super.onCreateDialog(id, bundle);
-    }
-
-    /**
-     * Create a {@link Dialog} that allows the user to pick from a bulk import
-     * or bulk export task across all contacts.
-     */
-    private void displayImportExportDialog() {
-        // Wrap our context to inflate list items using correct theme
-        final Context dialogContext = new ContextThemeWrapper(this, android.R.style.Theme_Light);
-        final Resources res = dialogContext.getResources();
-        final LayoutInflater dialogInflater = (LayoutInflater)dialogContext
-                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
-        // Adapter that shows a list of string resources
-        final ArrayAdapter<Integer> adapter = new ArrayAdapter<Integer>(this,
-                android.R.layout.simple_list_item_1) {
-            @Override
-            public View getView(int position, View convertView, ViewGroup parent) {
-                if (convertView == null) {
-                    convertView = dialogInflater.inflate(android.R.layout.simple_list_item_1,
-                            parent, false);
-                }
-
-                final int resId = this.getItem(position);
-                ((TextView)convertView).setText(resId);
-                return convertView;
-            }
-        };
-
-        if (TelephonyManager.getDefault().hasIccCard()) {
-            adapter.add(R.string.import_from_sim);
-        }
-        if (res.getBoolean(R.bool.config_allow_import_from_sdcard)) {
-            adapter.add(R.string.import_from_sdcard);
-        }
-        if (res.getBoolean(R.bool.config_allow_export_to_sdcard)) {
-            adapter.add(R.string.export_to_sdcard);
-        }
-        if (res.getBoolean(R.bool.config_allow_share_visible_contacts)) {
-            adapter.add(R.string.share_visible_contacts);
-        }
-
-        final DialogInterface.OnClickListener clickListener =
-                new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                dialog.dismiss();
-
-                final int resId = adapter.getItem(which);
-                switch (resId) {
-                    case R.string.import_from_sim:
-                    case R.string.import_from_sdcard: {
-                        handleImportRequest(resId);
-                        break;
-                    }
-                    case R.string.export_to_sdcard: {
-                        Context context = ContactsListActivity.this;
-                        Intent exportIntent = new Intent(context, ExportVCardActivity.class);
-                        context.startActivity(exportIntent);
-                        break;
-                    }
-                    case R.string.share_visible_contacts: {
-                        doShareVisibleContacts();
-                        break;
-                    }
-                    default: {
-                        Log.e(TAG, "Unexpected resource: " +
-                                getResources().getResourceEntryName(resId));
-                    }
-                }
-            }
-        };
-
-        new AlertDialog.Builder(this)
-            .setTitle(R.string.dialog_import_export)
-            .setNegativeButton(android.R.string.cancel, null)
-            .setSingleChoiceItems(adapter, -1, clickListener)
-            .show();
-    }
-
-    private void doShareVisibleContacts() {
-        final Cursor cursor = getContentResolver().query(Contacts.CONTENT_URI,
-                sLookupProjection, getContactSelection(), null, null);
-        try {
-            if (!cursor.moveToFirst()) {
-                Toast.makeText(this, R.string.share_error, Toast.LENGTH_SHORT).show();
-                return;
-            }
-
-            StringBuilder uriListBuilder = new StringBuilder();
-            int index = 0;
-            for (;!cursor.isAfterLast(); cursor.moveToNext()) {
-                if (index != 0)
-                    uriListBuilder.append(':');
-                uriListBuilder.append(cursor.getString(0));
-                index++;
-            }
-            Uri uri = Uri.withAppendedPath(
-                    Contacts.CONTENT_MULTI_VCARD_URI,
-                    Uri.encode(uriListBuilder.toString()));
-
-            final Intent intent = new Intent(Intent.ACTION_SEND);
-            intent.setType(Contacts.CONTENT_VCARD_TYPE);
-            intent.putExtra(Intent.EXTRA_STREAM, uri);
-            startActivity(intent);
-        } finally {
-            cursor.close();
-        }
-    }
-
-    private void handleImportRequest(int resId) {
-        // There's three possibilities:
-        // - more than one accounts -> ask the user
-        // - just one account -> use the account without asking the user
-        // - no account -> use phone-local storage without asking the user
-        final Sources sources = Sources.getInstance(this);
-        final List<Account> accountList = sources.getAccounts(true);
-        final int size = accountList.size();
-        if (size > 1) {
-            showDialog(resId);
-            return;
-        }
-
-        AccountSelectionUtil.doImport(this, resId, (size == 1 ? accountList.get(0) : null));
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        switch (requestCode) {
-            case SUBACTIVITY_NEW_CONTACT:
-                if (resultCode == RESULT_OK) {
-                    returnPickerResult(null, data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME),
-                            data.getData(), (mMode & MODE_MASK_PICKER) != 0
-                            ? Intent.FLAG_GRANT_READ_URI_PERMISSION : 0);
-                }
-                break;
-
-            case SUBACTIVITY_VIEW_CONTACT:
-                if (resultCode == RESULT_OK) {
-                    mAdapter.notifyDataSetChanged();
-                }
-                break;
-
-            case SUBACTIVITY_DISPLAY_GROUP:
-                // Mark as just created so we re-run the view query
-                mJustCreated = true;
-                break;
-
-            case SUBACTIVITY_FILTER:
-            case SUBACTIVITY_SEARCH:
-                // Pass through results of filter or search UI
-                if (resultCode == RESULT_OK) {
-                    setResult(RESULT_OK, data);
-                    finish();
-                }
-                break;
-        }
-    }
-
-    @Override
-    public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
-        // If Contacts was invoked by another Activity simply as a way of
-        // picking a contact, don't show the context menu
-        if ((mMode & MODE_MASK_PICKER) == MODE_MASK_PICKER) {
-            return;
-        }
-
-        AdapterView.AdapterContextMenuInfo info;
-        try {
-             info = (AdapterView.AdapterContextMenuInfo) menuInfo;
-        } catch (ClassCastException e) {
-            Log.e(TAG, "bad menuInfo", e);
-            return;
-        }
-
-        Cursor cursor = (Cursor) getListAdapter().getItem(info.position);
-        if (cursor == null) {
-            // For some reason the requested item isn't available, do nothing
-            return;
-        }
-        long id = info.id;
-        Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, id);
-        long rawContactId = ContactsUtils.queryForRawContactId(getContentResolver(), id);
-        Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
-
-        // Setup the menu header
-        menu.setHeaderTitle(cursor.getString(getSummaryDisplayNameColumnIndex()));
-
-        // View contact details
-        final Intent viewContactIntent = new Intent(Intent.ACTION_VIEW, contactUri);
-        StickyTabs.setTab(viewContactIntent, getIntent());
-        menu.add(0, MENU_ITEM_VIEW_CONTACT, 0, R.string.menu_viewContact)
-                .setIntent(viewContactIntent);
-
-        if (cursor.getInt(SUMMARY_HAS_PHONE_COLUMN_INDEX) != 0) {
-            // Calling contact
-            menu.add(0, MENU_ITEM_CALL, 0, getString(R.string.menu_call));
-            // Send SMS item
-            menu.add(0, MENU_ITEM_SEND_SMS, 0, getString(R.string.menu_sendSMS));
-        }
-
-        // Star toggling
-        int starState = cursor.getInt(SUMMARY_STARRED_COLUMN_INDEX);
-        if (starState == 0) {
-            menu.add(0, MENU_ITEM_TOGGLE_STAR, 0, R.string.menu_addStar);
-        } else {
-            menu.add(0, MENU_ITEM_TOGGLE_STAR, 0, R.string.menu_removeStar);
-        }
-
-        // Contact editing
-        menu.add(0, MENU_ITEM_EDIT, 0, R.string.menu_editContact)
-                .setIntent(new Intent(Intent.ACTION_EDIT, rawContactUri));
-        menu.add(0, MENU_ITEM_DELETE, 0, R.string.menu_deleteContact);
-    }
-
-    @Override
-    public boolean onContextItemSelected(MenuItem item) {
-        AdapterView.AdapterContextMenuInfo info;
-        try {
-             info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
-        } catch (ClassCastException e) {
-            Log.e(TAG, "bad menuInfo", e);
-            return false;
-        }
-
-        Cursor cursor = (Cursor) getListAdapter().getItem(info.position);
-
-        switch (item.getItemId()) {
-            case MENU_ITEM_TOGGLE_STAR: {
-                // Toggle the star
-                ContentValues values = new ContentValues(1);
-                values.put(Contacts.STARRED, cursor.getInt(SUMMARY_STARRED_COLUMN_INDEX) == 0 ? 1 : 0);
-                final Uri selectedUri = this.getContactUri(info.position);
-                getContentResolver().update(selectedUri, values, null, null);
-                return true;
-            }
-
-            case MENU_ITEM_CALL: {
-                callContact(cursor);
-                return true;
-            }
-
-            case MENU_ITEM_SEND_SMS: {
-                smsContact(cursor);
-                return true;
-            }
-
-            case MENU_ITEM_DELETE: {
-                doContactDelete(getContactUri(info.position));
-                return true;
-            }
-        }
-
-        return super.onContextItemSelected(item);
-    }
-
-    /**
-     * Event handler for the use case where the user starts typing without
-     * bringing up the search UI first.
-     */
-    public boolean onKey(View v, int keyCode, KeyEvent event) {
-        if (!mSearchMode && (mMode & MODE_MASK_NO_FILTER) == 0 && !mSearchInitiated) {
-            int unicodeChar = event.getUnicodeChar();
-            if (unicodeChar != 0) {
-                mSearchInitiated = true;
-                startSearch(new String(new int[]{unicodeChar}, 0, 1), false, null, false);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Event handler for search UI.
-     */
-    public void afterTextChanged(Editable s) {
-        onSearchTextChanged();
-    }
-
-    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-    }
-
-    public void onTextChanged(CharSequence s, int start, int before, int count) {
-    }
-
-    /**
-     * Event handler for search UI.
-     */
-    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
-        if (actionId == EditorInfo.IME_ACTION_DONE) {
-            hideSoftKeyboard();
-            if (TextUtils.isEmpty(getTextFilter())) {
-                finish();
-            }
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        switch (keyCode) {
-            case KeyEvent.KEYCODE_CALL: {
-                if (callSelection()) {
-                    return true;
-                }
-                break;
-            }
-
-            case KeyEvent.KEYCODE_DEL: {
-                if (deleteSelection()) {
-                    return true;
-                }
-                break;
-            }
-        }
-
-        return super.onKeyDown(keyCode, event);
-    }
-
-    private boolean deleteSelection() {
-        if ((mMode & MODE_MASK_PICKER) != 0) {
-            return false;
-        }
-
-        final int position = getListView().getSelectedItemPosition();
-        if (position != ListView.INVALID_POSITION) {
-            Uri contactUri = getContactUri(position);
-            if (contactUri != null) {
-                doContactDelete(contactUri);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Prompt the user before deleting the given {@link Contacts} entry.
-     */
-    protected void doContactDelete(Uri contactUri) {
-        mReadOnlySourcesCnt = 0;
-        mWritableSourcesCnt = 0;
-        mWritableRawContactIds.clear();
-
-        Sources sources = Sources.getInstance(ContactsListActivity.this);
-        Cursor c = getContentResolver().query(RawContacts.CONTENT_URI, RAW_CONTACTS_PROJECTION,
-                RawContacts.CONTACT_ID + "=" + ContentUris.parseId(contactUri), null,
-                null);
-        if (c != null) {
-            try {
-                while (c.moveToNext()) {
-                    final String accountType = c.getString(2);
-                    final long rawContactId = c.getLong(0);
-                    ContactsSource contactsSource = sources.getInflatedSource(accountType,
-                            ContactsSource.LEVEL_SUMMARY);
-                    if (contactsSource != null && contactsSource.readOnly) {
-                        mReadOnlySourcesCnt += 1;
-                    } else {
-                        mWritableSourcesCnt += 1;
-                        mWritableRawContactIds.add(rawContactId);
-                    }
-                }
-            } finally {
-                c.close();
-            }
-        }
-
-        mSelectedContactUri = contactUri;
-        if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt > 0) {
-            showDialog(R.id.dialog_readonly_contact_delete_confirmation);
-        } else if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt == 0) {
-            showDialog(R.id.dialog_readonly_contact_hide_confirmation);
-        } else if (mReadOnlySourcesCnt == 0 && mWritableSourcesCnt > 1) {
-            showDialog(R.id.dialog_multiple_contact_delete_confirmation);
-        } else {
-            showDialog(R.id.dialog_delete_contact_confirmation);
-        }
-    }
-
-    /**
-     * Dismisses the soft keyboard when the list takes focus.
-     */
-    public void onFocusChange(View view, boolean hasFocus) {
-        if (view == getListView() && hasFocus) {
-            hideSoftKeyboard();
-        }
-    }
-
-    /**
-     * Dismisses the soft keyboard when the list takes focus.
-     */
-    public boolean onTouch(View view, MotionEvent event) {
-        if (view == getListView()) {
-            hideSoftKeyboard();
-        }
-        return false;
-    }
-
-    /**
-     * Dismisses the search UI along with the keyboard if the filter text is empty.
-     */
-    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
-        if (mSearchMode && keyCode == KeyEvent.KEYCODE_BACK && TextUtils.isEmpty(getTextFilter())) {
-            hideSoftKeyboard();
-            onBackPressed();
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    protected void onListItemClick(ListView l, View v, int position, long id) {
-        hideSoftKeyboard();
-
-        if (mSearchMode && mAdapter.isSearchAllContactsItemPosition(position)) {
-            doSearch();
-        } else if (mMode == MODE_INSERT_OR_EDIT_CONTACT || mMode == MODE_QUERY_PICK_TO_EDIT) {
-            Intent intent;
-            if (position == 0 && !mSearchMode && mMode != MODE_QUERY_PICK_TO_EDIT) {
-                intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
-            } else {
-                intent = new Intent(Intent.ACTION_EDIT, getSelectedUri(position));
-            }
-            intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
-            Bundle extras = getIntent().getExtras();
-            if (extras != null) {
-                intent.putExtras(extras);
-            }
-            intent.putExtra(KEY_PICKER_MODE, (mMode & MODE_MASK_PICKER) == MODE_MASK_PICKER);
-
-            startActivity(intent);
-            finish();
-        } else if ((mMode & MODE_MASK_CREATE_NEW) == MODE_MASK_CREATE_NEW
-                && position == 0) {
-            Intent newContact = new Intent(Intents.Insert.ACTION, Contacts.CONTENT_URI);
-            startActivityForResult(newContact, SUBACTIVITY_NEW_CONTACT);
-        } else if (mMode == MODE_JOIN_CONTACT && id == JOIN_MODE_SHOW_ALL_CONTACTS_ID) {
-            mJoinModeShowAllContacts = false;
-            startQuery();
-        } else if (id > 0) {
-            final Uri uri = getSelectedUri(position);
-            if ((mMode & MODE_MASK_PICKER) == 0) {
-                final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
-                StickyTabs.setTab(intent, getIntent());
-                startActivityForResult(intent, SUBACTIVITY_VIEW_CONTACT);
-            } else if (mMode == MODE_JOIN_CONTACT) {
-                returnPickerResult(null, null, uri, 0);
-            } else if (mMode == MODE_QUERY_PICK_TO_VIEW) {
-                // Started with query that should launch to view contact
-                final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
-                startActivity(intent);
-                finish();
-            } else if (mMode == MODE_PICK_PHONE || mMode == MODE_QUERY_PICK_PHONE) {
-                Cursor c = (Cursor) mAdapter.getItem(position);
-                returnPickerResult(c, c.getString(PHONE_DISPLAY_NAME_COLUMN_INDEX), uri,
-                        Intent.FLAG_GRANT_READ_URI_PERMISSION);
-            } else if ((mMode & MODE_MASK_PICKER) != 0) {
-                Cursor c = (Cursor) mAdapter.getItem(position);
-                returnPickerResult(c, c.getString(getSummaryDisplayNameColumnIndex()), uri,
-                        Intent.FLAG_GRANT_READ_URI_PERMISSION);
-            } else if (mMode == MODE_PICK_POSTAL
-                    || mMode == MODE_LEGACY_PICK_POSTAL
-                    || mMode == MODE_LEGACY_PICK_PHONE) {
-                returnPickerResult(null, null, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
-            }
-        } else {
-            signalError();
-        }
-    }
-
-    private void hideSoftKeyboard() {
-        // Hide soft keyboard, if visible
-        InputMethodManager inputMethodManager = (InputMethodManager)
-                getSystemService(Context.INPUT_METHOD_SERVICE);
-        inputMethodManager.hideSoftInputFromWindow(mList.getWindowToken(), 0);
-    }
-
-    /**
-     * @param selectedUri In most cases, this should be a lookup {@link Uri}, possibly
-     *            generated through {@link Contacts#getLookupUri(long, String)}.
-     */
-    private void returnPickerResult(Cursor c, String name, Uri selectedUri, int uriPerms) {
-        final Intent intent = new Intent();
-
-        if (mShortcutAction != null) {
-            Intent shortcutIntent;
-            if (Intent.ACTION_VIEW.equals(mShortcutAction)) {
-                // This is a simple shortcut to view a contact.
-                shortcutIntent = new Intent(ContactsContract.QuickContact.ACTION_QUICK_CONTACT);
-                shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
-                        Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
-
-                shortcutIntent.setData(selectedUri);
-                shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_MODE,
-                        ContactsContract.QuickContact.MODE_LARGE);
-                shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_EXCLUDE_MIMES,
-                        (String[]) null);
-
-                final Bitmap icon = framePhoto(loadContactPhoto(selectedUri, null));
-                if (icon != null) {
-                    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, scaleToAppIconSize(icon));
-                } else {
-                    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
-                            Intent.ShortcutIconResource.fromContext(this,
-                                    R.drawable.ic_launcher_shortcut_contact));
-                }
-            } else {
-                // This is a direct dial or sms shortcut.
-                String number = c.getString(PHONE_NUMBER_COLUMN_INDEX);
-                int type = c.getInt(PHONE_TYPE_COLUMN_INDEX);
-                String scheme;
-                int resid;
-                if (Intent.ACTION_CALL.equals(mShortcutAction)) {
-                    scheme = Constants.SCHEME_TEL;
-                    resid = R.drawable.badge_action_call;
-                } else {
-                    scheme = Constants.SCHEME_SMSTO;
-                    resid = R.drawable.badge_action_sms;
-                }
-
-                // Make the URI a direct tel: URI so that it will always continue to work
-                Uri phoneUri = Uri.fromParts(scheme, number, null);
-                shortcutIntent = new Intent(mShortcutAction, phoneUri);
-
-                intent.putExtra(Intent.EXTRA_SHORTCUT_ICON,
-                        generatePhoneNumberIcon(selectedUri, type, resid));
-            }
-            shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-            intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
-            intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
-            setResult(RESULT_OK, intent);
-        } else {
-            intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
-            intent.addFlags(uriPerms);
-            setResult(RESULT_OK, intent.setData(selectedUri));
-        }
-        finish();
-    }
-
-    private Bitmap framePhoto(Bitmap photo) {
-        final Resources r = getResources();
-        final Drawable frame = r.getDrawable(com.android.internal.R.drawable.quickcontact_badge);
-
-        final int width = r.getDimensionPixelSize(R.dimen.contact_shortcut_frame_width);
-        final int height = r.getDimensionPixelSize(R.dimen.contact_shortcut_frame_height);
-
-        frame.setBounds(0, 0, width, height);
-
-        final Rect padding = new Rect();
-        frame.getPadding(padding);
-
-        final Rect source = new Rect(0, 0, photo.getWidth(), photo.getHeight());
-        final Rect destination = new Rect(padding.left, padding.top,
-                width - padding.right, height - padding.bottom);
-
-        final int d = Math.max(width, height);
-        final Bitmap b = Bitmap.createBitmap(d, d, Bitmap.Config.ARGB_8888);
-        final Canvas c = new Canvas(b);
-
-        c.translate((d - width) / 2.0f, (d - height) / 2.0f);
-        frame.draw(c);
-        c.drawBitmap(photo, source, destination, new Paint(Paint.FILTER_BITMAP_FLAG));
-
-        return b;
-    }
-
-    /**
-     * Generates a phone number shortcut icon. Adds an overlay describing the type of the phone
-     * number, and if there is a photo also adds the call action icon.
-     *
-     * @param lookupUri The person the phone number belongs to
-     * @param type The type of the phone number
-     * @param actionResId The ID for the action resource
-     * @return The bitmap for the icon
-     */
-    private Bitmap generatePhoneNumberIcon(Uri lookupUri, int type, int actionResId) {
-        final Resources r = getResources();
-        boolean drawPhoneOverlay = true;
-        final float scaleDensity = getResources().getDisplayMetrics().scaledDensity;
-
-        Bitmap photo = loadContactPhoto(lookupUri, null);
-        if (photo == null) {
-            // If there isn't a photo use the generic phone action icon instead
-            Bitmap phoneIcon = getPhoneActionIcon(r, actionResId);
-            if (phoneIcon != null) {
-                photo = phoneIcon;
-                drawPhoneOverlay = false;
-            } else {
-                return null;
-            }
-        }
-
-        // Setup the drawing classes
-        Bitmap icon = createShortcutBitmap();
-        Canvas canvas = new Canvas(icon);
-
-        // Copy in the photo
-        Paint photoPaint = new Paint();
-        photoPaint.setDither(true);
-        photoPaint.setFilterBitmap(true);
-        Rect src = new Rect(0,0, photo.getWidth(),photo.getHeight());
-        Rect dst = new Rect(0,0, mIconSize, mIconSize);
-        canvas.drawBitmap(photo, src, dst, photoPaint);
-
-        // Create an overlay for the phone number type
-        String overlay = null;
-        switch (type) {
-            case Phone.TYPE_HOME:
-                overlay = getString(R.string.type_short_home);
-                break;
-
-            case Phone.TYPE_MOBILE:
-                overlay = getString(R.string.type_short_mobile);
-                break;
-
-            case Phone.TYPE_WORK:
-                overlay = getString(R.string.type_short_work);
-                break;
-
-            case Phone.TYPE_PAGER:
-                overlay = getString(R.string.type_short_pager);
-                break;
-
-            case Phone.TYPE_OTHER:
-                overlay = getString(R.string.type_short_other);
-                break;
-        }
-        if (overlay != null) {
-            Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);
-            textPaint.setTextSize(20.0f * scaleDensity);
-            textPaint.setTypeface(Typeface.DEFAULT_BOLD);
-            textPaint.setColor(r.getColor(R.color.textColorIconOverlay));
-            textPaint.setShadowLayer(3f, 1, 1, r.getColor(R.color.textColorIconOverlayShadow));
-            canvas.drawText(overlay, 2 * scaleDensity, 16 * scaleDensity, textPaint);
-        }
-
-        // Draw the phone action icon as an overlay
-        if (ENABLE_ACTION_ICON_OVERLAYS && drawPhoneOverlay) {
-            Bitmap phoneIcon = getPhoneActionIcon(r, actionResId);
-            if (phoneIcon != null) {
-                src.set(0, 0, phoneIcon.getWidth(), phoneIcon.getHeight());
-                int iconWidth = icon.getWidth();
-                dst.set(iconWidth - ((int) (20 * scaleDensity)), -1,
-                        iconWidth, ((int) (19 * scaleDensity)));
-                canvas.drawBitmap(phoneIcon, src, dst, photoPaint);
-            }
-        }
-
-        return icon;
-    }
-
-    private Bitmap scaleToAppIconSize(Bitmap photo) {
-        // Setup the drawing classes
-        Bitmap icon = createShortcutBitmap();
-        Canvas canvas = new Canvas(icon);
-
-        // Copy in the photo
-        Paint photoPaint = new Paint();
-        photoPaint.setDither(true);
-        photoPaint.setFilterBitmap(true);
-        Rect src = new Rect(0,0, photo.getWidth(),photo.getHeight());
-        Rect dst = new Rect(0,0, mIconSize, mIconSize);
-        canvas.drawBitmap(photo, src, dst, photoPaint);
-
-        return icon;
-    }
-
-    private Bitmap createShortcutBitmap() {
-        return Bitmap.createBitmap(mIconSize, mIconSize, Bitmap.Config.ARGB_8888);
-    }
-
-    /**
-     * Returns the icon for the phone call action.
-     *
-     * @param r The resources to load the icon from
-     * @param resId The resource ID to load
-     * @return the icon for the phone call action
-     */
-    private Bitmap getPhoneActionIcon(Resources r, int resId) {
-        Drawable phoneIcon = r.getDrawable(resId);
-        if (phoneIcon instanceof BitmapDrawable) {
-            BitmapDrawable bd = (BitmapDrawable) phoneIcon;
-            return bd.getBitmap();
-        } else {
-            return null;
-        }
-    }
-
-    private Uri getUriToQuery() {
-        switch(mMode) {
-            case MODE_JOIN_CONTACT:
-                return getJoinSuggestionsUri(null);
-            case MODE_FREQUENT:
-            case MODE_STARRED:
-                return Contacts.CONTENT_URI;
-
-            case MODE_DEFAULT:
-            case MODE_CUSTOM:
-            case MODE_INSERT_OR_EDIT_CONTACT:
-            case MODE_PICK_CONTACT:
-            case MODE_PICK_OR_CREATE_CONTACT:{
-                return CONTACTS_CONTENT_URI_WITH_LETTER_COUNTS;
-            }
-            case MODE_STREQUENT: {
-                return Contacts.CONTENT_STREQUENT_URI;
-            }
-            case MODE_LEGACY_PICK_PERSON:
-            case MODE_LEGACY_PICK_OR_CREATE_PERSON: {
-                return People.CONTENT_URI;
-            }
-            case MODE_PICK_PHONE: {
-                return buildSectionIndexerUri(Phone.CONTENT_URI);
-            }
-            case MODE_LEGACY_PICK_PHONE: {
-                return Phones.CONTENT_URI;
-            }
-            case MODE_PICK_POSTAL: {
-                return buildSectionIndexerUri(StructuredPostal.CONTENT_URI);
-            }
-            case MODE_LEGACY_PICK_POSTAL: {
-                return ContactMethods.CONTENT_URI;
-            }
-            case MODE_QUERY_PICK_TO_VIEW: {
-                if (mQueryMode == QUERY_MODE_MAILTO) {
-                    return Uri.withAppendedPath(Email.CONTENT_FILTER_URI,
-                            Uri.encode(mInitialFilter));
-                } else if (mQueryMode == QUERY_MODE_TEL) {
-                    return Uri.withAppendedPath(Phone.CONTENT_FILTER_URI,
-                            Uri.encode(mInitialFilter));
-                }
-                return CONTACTS_CONTENT_URI_WITH_LETTER_COUNTS;
-            }
-            case MODE_QUERY:
-            case MODE_QUERY_PICK:
-            case MODE_QUERY_PICK_TO_EDIT: {
-                return getContactFilterUri(mInitialFilter);
-            }
-            case MODE_QUERY_PICK_PHONE: {
-                return Uri.withAppendedPath(Phone.CONTENT_FILTER_URI,
-                        Uri.encode(mInitialFilter));
-            }
-            case MODE_GROUP: {
-                return mGroupUri;
-            }
-            default: {
-                throw new IllegalStateException("Can't generate URI: Unsupported Mode.");
-            }
-        }
-    }
-
-    /**
-     * Build the {@link Contacts#CONTENT_LOOKUP_URI} for the given
-     * {@link ListView} position, using {@link #mAdapter}.
-     */
-    private Uri getContactUri(int position) {
-        if (position == ListView.INVALID_POSITION) {
-            throw new IllegalArgumentException("Position not in list bounds");
-        }
-
-        final Cursor cursor = (Cursor)mAdapter.getItem(position);
-        if (cursor == null) {
-            return null;
-        }
-
-        switch(mMode) {
-            case MODE_LEGACY_PICK_PERSON:
-            case MODE_LEGACY_PICK_OR_CREATE_PERSON: {
-                final long personId = cursor.getLong(SUMMARY_ID_COLUMN_INDEX);
-                return ContentUris.withAppendedId(People.CONTENT_URI, personId);
-            }
-
-            default: {
-                // Build and return soft, lookup reference
-                final long contactId = cursor.getLong(SUMMARY_ID_COLUMN_INDEX);
-                final String lookupKey = cursor.getString(SUMMARY_LOOKUP_KEY_COLUMN_INDEX);
-                return Contacts.getLookupUri(contactId, lookupKey);
-            }
-        }
-    }
-
-    /**
-     * Build the {@link Uri} for the given {@link ListView} position, which can
-     * be used as result when in {@link #MODE_MASK_PICKER} mode.
-     */
-    private Uri getSelectedUri(int position) {
-        if (position == ListView.INVALID_POSITION) {
-            throw new IllegalArgumentException("Position not in list bounds");
-        }
-
-        final long id = mAdapter.getItemId(position);
-        switch(mMode) {
-            case MODE_LEGACY_PICK_PERSON:
-            case MODE_LEGACY_PICK_OR_CREATE_PERSON: {
-                return ContentUris.withAppendedId(People.CONTENT_URI, id);
-            }
-            case MODE_PICK_PHONE:
-            case MODE_QUERY_PICK_PHONE: {
-                return ContentUris.withAppendedId(Data.CONTENT_URI, id);
-            }
-            case MODE_LEGACY_PICK_PHONE: {
-                return ContentUris.withAppendedId(Phones.CONTENT_URI, id);
-            }
-            case MODE_PICK_POSTAL: {
-                return ContentUris.withAppendedId(Data.CONTENT_URI, id);
-            }
-            case MODE_LEGACY_PICK_POSTAL: {
-                return ContentUris.withAppendedId(ContactMethods.CONTENT_URI, id);
-            }
-            default: {
-                return getContactUri(position);
-            }
-        }
-    }
-
-    String[] getProjectionForQuery() {
-        switch(mMode) {
-            case MODE_JOIN_CONTACT:
-            case MODE_STREQUENT:
-            case MODE_FREQUENT:
-            case MODE_STARRED:
-            case MODE_DEFAULT:
-            case MODE_CUSTOM:
-            case MODE_INSERT_OR_EDIT_CONTACT:
-            case MODE_GROUP:
-            case MODE_PICK_CONTACT:
-            case MODE_PICK_OR_CREATE_CONTACT: {
-                return mSearchMode
-                        ? CONTACTS_SUMMARY_FILTER_PROJECTION
-                        : CONTACTS_SUMMARY_PROJECTION;
-            }
-            case MODE_QUERY:
-            case MODE_QUERY_PICK:
-            case MODE_QUERY_PICK_TO_EDIT: {
-                return CONTACTS_SUMMARY_FILTER_PROJECTION;
-            }
-            case MODE_LEGACY_PICK_PERSON:
-            case MODE_LEGACY_PICK_OR_CREATE_PERSON: {
-                return LEGACY_PEOPLE_PROJECTION ;
-            }
-            case MODE_QUERY_PICK_PHONE:
-            case MODE_PICK_PHONE: {
-                return PHONES_PROJECTION;
-            }
-            case MODE_LEGACY_PICK_PHONE: {
-                return LEGACY_PHONES_PROJECTION;
-            }
-            case MODE_PICK_POSTAL: {
-                return POSTALS_PROJECTION;
-            }
-            case MODE_LEGACY_PICK_POSTAL: {
-                return LEGACY_POSTALS_PROJECTION;
-            }
-            case MODE_QUERY_PICK_TO_VIEW: {
-                if (mQueryMode == QUERY_MODE_MAILTO) {
-                    return CONTACTS_SUMMARY_PROJECTION_FROM_EMAIL;
-                } else if (mQueryMode == QUERY_MODE_TEL) {
-                    return PHONES_PROJECTION;
-                }
-                break;
-            }
-        }
-
-        // Default to normal aggregate projection
-        return CONTACTS_SUMMARY_PROJECTION;
-    }
-
-    private Bitmap loadContactPhoto(Uri selectedUri, BitmapFactory.Options options) {
-        Uri contactUri = null;
-        if (Contacts.CONTENT_ITEM_TYPE.equals(getContentResolver().getType(selectedUri))) {
-            // TODO we should have a "photo" directory under the lookup URI itself
-            contactUri = Contacts.lookupContact(getContentResolver(), selectedUri);
-        } else {
-
-            Cursor cursor = getContentResolver().query(selectedUri,
-                    new String[] { Data.CONTACT_ID }, null, null, null);
-            try {
-                if (cursor != null && cursor.moveToFirst()) {
-                    final long contactId = cursor.getLong(0);
-                    contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
-                }
-            } finally {
-                if (cursor != null) cursor.close();
-            }
-        }
-
-        Cursor cursor = null;
-        Bitmap bm = null;
-
-        try {
-            Uri photoUri = Uri.withAppendedPath(contactUri, Contacts.Photo.CONTENT_DIRECTORY);
-            cursor = getContentResolver().query(photoUri, new String[] {Photo.PHOTO},
-                    null, null, null);
-            if (cursor != null && cursor.moveToFirst()) {
-                bm = ContactsUtils.loadContactPhoto(cursor, 0, options);
-            }
-        } finally {
-            if (cursor != null) {
-                cursor.close();
-            }
-        }
-
-        if (bm == null) {
-            final int[] fallbacks = {
-                R.drawable.ic_contact_picture,
-                R.drawable.ic_contact_picture_2,
-                R.drawable.ic_contact_picture_3
-            };
-            bm = BitmapFactory.decodeResource(getResources(),
-                    fallbacks[new Random().nextInt(fallbacks.length)]);
-        }
-
-        return bm;
-    }
-
-    /**
-     * Return the selection arguments for a default query based on the
-     * {@link #mDisplayOnlyPhones} flag.
-     */
-    private String getContactSelection() {
-        if (mDisplayOnlyPhones) {
-            return CLAUSE_ONLY_VISIBLE + " AND " + CLAUSE_ONLY_PHONES;
-        } else {
-            return CLAUSE_ONLY_VISIBLE;
-        }
-    }
-
-    private Uri getContactFilterUri(String filter) {
-        Uri baseUri;
-        if (!TextUtils.isEmpty(filter)) {
-            baseUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(filter));
-        } else {
-            baseUri = Contacts.CONTENT_URI;
-        }
-
-        if (mAdapter.getDisplaySectionHeadersEnabled()) {
-            return buildSectionIndexerUri(baseUri);
-        } else {
-            return baseUri;
-        }
-    }
-
-    private Uri getPeopleFilterUri(String filter) {
-        if (!TextUtils.isEmpty(filter)) {
-            return Uri.withAppendedPath(People.CONTENT_FILTER_URI, Uri.encode(filter));
-        } else {
-            return People.CONTENT_URI;
-        }
-    }
-
-    private static Uri buildSectionIndexerUri(Uri uri) {
-        return uri.buildUpon()
-                .appendQueryParameter(ContactCounts.ADDRESS_BOOK_INDEX_EXTRAS, "true").build();
-    }
-
-    private Uri getJoinSuggestionsUri(String filter) {
-        Builder builder = Contacts.CONTENT_URI.buildUpon();
-        builder.appendEncodedPath(String.valueOf(mQueryAggregateId));
-        builder.appendEncodedPath(AggregationSuggestions.CONTENT_DIRECTORY);
-        if (!TextUtils.isEmpty(filter)) {
-            builder.appendEncodedPath(Uri.encode(filter));
-        }
-        builder.appendQueryParameter("limit", String.valueOf(MAX_SUGGESTIONS));
-        return builder.build();
-    }
-
-    private String getSortOrder(String[] projectionType) {
-        if (mSortOrder == ContactsContract.Preferences.SORT_ORDER_PRIMARY) {
-            return Contacts.SORT_KEY_PRIMARY;
-        } else {
-            return Contacts.SORT_KEY_ALTERNATIVE;
-        }
-    }
-
-    void startQuery() {
-        // Set the proper empty string
-        setEmptyText();
-
-        if (mSearchResultsMode) {
-            TextView foundContactsText = (TextView)findViewById(R.id.search_results_found);
-            foundContactsText.setText(R.string.search_results_searching);
-        }
-
-        mAdapter.setLoading(true);
-
-        // Cancel any pending queries
-        mQueryHandler.cancelOperation(QUERY_TOKEN);
-        mQueryHandler.setLoadingJoinSuggestions(false);
-
-        mSortOrder = mContactsPrefs.getSortOrder();
-        mDisplayOrder = mContactsPrefs.getDisplayOrder();
-
-        // When sort order and display order contradict each other, we want to
-        // highlight the part of the name used for sorting.
-        mHighlightWhenScrolling = false;
-        if (mSortOrder == ContactsContract.Preferences.SORT_ORDER_PRIMARY &&
-                mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_ALTERNATIVE) {
-            mHighlightWhenScrolling = true;
-        } else if (mSortOrder == ContactsContract.Preferences.SORT_ORDER_ALTERNATIVE &&
-                mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY) {
-            mHighlightWhenScrolling = true;
-        }
-
-        String[] projection = getProjectionForQuery();
-        if (mSearchMode && TextUtils.isEmpty(getTextFilter())) {
-            mAdapter.changeCursor(new MatrixCursor(projection));
-            return;
-        }
-
-        String callingPackage = getCallingPackage();
-        Uri uri = getUriToQuery();
-        if (!TextUtils.isEmpty(callingPackage)) {
-            uri = uri.buildUpon()
-                    .appendQueryParameter(ContactsContract.REQUESTING_PACKAGE_PARAM_KEY,
-                            callingPackage)
-                    .build();
-        }
-
-        // Kick off the new query
-        switch (mMode) {
-            case MODE_GROUP:
-            case MODE_DEFAULT:
-            case MODE_CUSTOM:
-            case MODE_PICK_CONTACT:
-            case MODE_PICK_OR_CREATE_CONTACT:
-            case MODE_INSERT_OR_EDIT_CONTACT:
-                mQueryHandler.startQuery(QUERY_TOKEN, null, uri, projection, getContactSelection(),
-                        null, getSortOrder(projection));
-                break;
-
-            case MODE_LEGACY_PICK_PERSON:
-            case MODE_LEGACY_PICK_OR_CREATE_PERSON: {
-                mQueryHandler.startQuery(QUERY_TOKEN, null, uri, projection, null, null,
-                        People.DISPLAY_NAME);
-                break;
-            }
-            case MODE_PICK_POSTAL:
-            case MODE_QUERY:
-            case MODE_QUERY_PICK:
-            case MODE_QUERY_PICK_PHONE:
-            case MODE_QUERY_PICK_TO_VIEW:
-            case MODE_QUERY_PICK_TO_EDIT: {
-                mQueryHandler.startQuery(QUERY_TOKEN, null, uri, projection, null, null,
-                        getSortOrder(projection));
-                break;
-            }
-
-            case MODE_STARRED:
-                mQueryHandler.startQuery(QUERY_TOKEN, null, uri,
-                        projection, Contacts.STARRED + "=1", null,
-                        getSortOrder(projection));
-                break;
-
-            case MODE_FREQUENT:
-                mQueryHandler.startQuery(QUERY_TOKEN, null, uri,
-                        projection,
-                        Contacts.TIMES_CONTACTED + " > 0", null,
-                        Contacts.TIMES_CONTACTED + " DESC, "
-                        + getSortOrder(projection));
-                break;
-
-            case MODE_STREQUENT:
-                mQueryHandler.startQuery(QUERY_TOKEN, null, uri, projection, null, null, null);
-                break;
-
-            case MODE_PICK_PHONE:
-                mQueryHandler.startQuery(QUERY_TOKEN, null, uri,
-                        projection, CLAUSE_ONLY_VISIBLE, null, getSortOrder(projection));
-                break;
-
-            case MODE_LEGACY_PICK_PHONE:
-                mQueryHandler.startQuery(QUERY_TOKEN, null, uri,
-                        projection, null, null, Phones.DISPLAY_NAME);
-                break;
-
-            case MODE_LEGACY_PICK_POSTAL:
-                mQueryHandler.startQuery(QUERY_TOKEN, null, uri,
-                        projection,
-                        ContactMethods.KIND + "=" + android.provider.Contacts.KIND_POSTAL, null,
-                        ContactMethods.DISPLAY_NAME);
-                break;
-
-            case MODE_JOIN_CONTACT:
-                mQueryHandler.setLoadingJoinSuggestions(true);
-                mQueryHandler.startQuery(QUERY_TOKEN, null, uri, projection,
-                        null, null, null);
-                break;
-        }
-    }
-
-    /**
-     * Called from a background thread to do the filter and return the resulting cursor.
-     *
-     * @param filter the text that was entered to filter on
-     * @return a cursor with the results of the filter
-     */
-    Cursor doFilter(String filter) {
-        String[] projection = getProjectionForQuery();
-        if (mSearchMode && TextUtils.isEmpty(getTextFilter())) {
-            return new MatrixCursor(projection);
-        }
-
-        final ContentResolver resolver = getContentResolver();
-        switch (mMode) {
-            case MODE_DEFAULT:
-            case MODE_CUSTOM:
-            case MODE_PICK_CONTACT:
-            case MODE_PICK_OR_CREATE_CONTACT:
-            case MODE_INSERT_OR_EDIT_CONTACT: {
-                return resolver.query(getContactFilterUri(filter), projection,
-                        getContactSelection(), null, getSortOrder(projection));
-            }
-
-            case MODE_LEGACY_PICK_PERSON:
-            case MODE_LEGACY_PICK_OR_CREATE_PERSON: {
-                return resolver.query(getPeopleFilterUri(filter), projection, null, null,
-                        People.DISPLAY_NAME);
-            }
-
-            case MODE_STARRED: {
-                return resolver.query(getContactFilterUri(filter), projection,
-                        Contacts.STARRED + "=1", null,
-                        getSortOrder(projection));
-            }
-
-            case MODE_FREQUENT: {
-                return resolver.query(getContactFilterUri(filter), projection,
-                        Contacts.TIMES_CONTACTED + " > 0", null,
-                        Contacts.TIMES_CONTACTED + " DESC, "
-                        + getSortOrder(projection));
-            }
-
-            case MODE_STREQUENT: {
-                Uri uri;
-                if (!TextUtils.isEmpty(filter)) {
-                    uri = Uri.withAppendedPath(Contacts.CONTENT_STREQUENT_FILTER_URI,
-                            Uri.encode(filter));
-                } else {
-                    uri = Contacts.CONTENT_STREQUENT_URI;
-                }
-                return resolver.query(uri, projection, null, null, null);
-            }
-
-            case MODE_PICK_PHONE: {
-                Uri uri = getUriToQuery();
-                if (!TextUtils.isEmpty(filter)) {
-                    uri = Uri.withAppendedPath(Phone.CONTENT_FILTER_URI, Uri.encode(filter));
-                }
-                return resolver.query(uri, projection, CLAUSE_ONLY_VISIBLE, null,
-                        getSortOrder(projection));
-            }
-
-            case MODE_LEGACY_PICK_PHONE: {
-                //TODO: Support filtering here (bug 2092503)
-                break;
-            }
-
-            case MODE_JOIN_CONTACT: {
-
-                // We are on a background thread. Run queries one after the other synchronously
-                Cursor cursor = resolver.query(getJoinSuggestionsUri(filter), projection, null,
-                        null, null);
-                mAdapter.setSuggestionsCursor(cursor);
-                mJoinModeShowAllContacts = false;
-                return resolver.query(getContactFilterUri(filter), projection,
-                        Contacts._ID + " != " + mQueryAggregateId + " AND " + CLAUSE_ONLY_VISIBLE,
-                        null, getSortOrder(projection));
-            }
-        }
-        throw new UnsupportedOperationException("filtering not allowed in mode " + mMode);
-    }
-
-    private Cursor getShowAllContactsLabelCursor(String[] projection) {
-        MatrixCursor matrixCursor = new MatrixCursor(projection);
-        Object[] row = new Object[projection.length];
-        // The only columns we care about is the id
-        row[SUMMARY_ID_COLUMN_INDEX] = JOIN_MODE_SHOW_ALL_CONTACTS_ID;
-        matrixCursor.addRow(row);
-        return matrixCursor;
-    }
-
-    /**
-     * Calls the currently selected list item.
-     * @return true if the call was initiated, false otherwise
-     */
-    boolean callSelection() {
-        ListView list = getListView();
-        if (list.hasFocus()) {
-            Cursor cursor = (Cursor) list.getSelectedItem();
-            return callContact(cursor);
-        }
-        return false;
-    }
-
-    boolean callContact(Cursor cursor) {
-        return callOrSmsContact(cursor, false /*call*/);
-    }
-
-    boolean smsContact(Cursor cursor) {
-        return callOrSmsContact(cursor, true /*sms*/);
-    }
-
-    /**
-     * Calls the contact which the cursor is point to.
-     * @return true if the call was initiated, false otherwise
-     */
-    boolean callOrSmsContact(Cursor cursor, boolean sendSms) {
-        if (cursor == null) {
-            return false;
-        }
-
-        switch (mMode) {
-            case MODE_PICK_PHONE:
-            case MODE_LEGACY_PICK_PHONE:
-            case MODE_QUERY_PICK_PHONE: {
-                String phone = cursor.getString(PHONE_NUMBER_COLUMN_INDEX);
-                if (sendSms) {
-                    ContactsUtils.initiateSms(this, phone);
-                } else {
-                    ContactsUtils.initiateCall(this, phone);
-                }
-                return true;
-            }
-
-            case MODE_PICK_POSTAL:
-            case MODE_LEGACY_PICK_POSTAL: {
-                return false;
-            }
-
-            default: {
-
-                boolean hasPhone = cursor.getInt(SUMMARY_HAS_PHONE_COLUMN_INDEX) != 0;
-                if (!hasPhone) {
-                    // There is no phone number.
-                    signalError();
-                    return false;
-                }
-
-                String phone = null;
-                Cursor phonesCursor = null;
-                phonesCursor = queryPhoneNumbers(cursor.getLong(SUMMARY_ID_COLUMN_INDEX));
-                if (phonesCursor == null || phonesCursor.getCount() == 0) {
-                    // No valid number
-                    signalError();
-                    return false;
-                } else if (phonesCursor.getCount() == 1) {
-                    // only one number, call it.
-                    phone = phonesCursor.getString(phonesCursor.getColumnIndex(Phone.NUMBER));
-                } else {
-                    phonesCursor.moveToPosition(-1);
-                    while (phonesCursor.moveToNext()) {
-                        if (phonesCursor.getInt(phonesCursor.
-                                getColumnIndex(Phone.IS_SUPER_PRIMARY)) != 0) {
-                            // Found super primary, call it.
-                            phone = phonesCursor.
-                            getString(phonesCursor.getColumnIndex(Phone.NUMBER));
-                            break;
-                        }
-                    }
-                }
-
-                if (phone == null) {
-                    // Display dialog to choose a number to call.
-                    PhoneDisambigDialog phoneDialog = new PhoneDisambigDialog(
-                            this, phonesCursor, sendSms, StickyTabs.getTab(getIntent()));
-                    phoneDialog.show();
-                } else {
-                    if (sendSms) {
-                        ContactsUtils.initiateSms(this, phone);
-                    } else {
-                        StickyTabs.saveTab(this, getIntent());
-                        ContactsUtils.initiateCall(this, phone);
-                    }
-                }
-            }
-        }
-        return true;
-    }
-
-    private Cursor queryPhoneNumbers(long contactId) {
-        Uri baseUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
-        Uri dataUri = Uri.withAppendedPath(baseUri, Contacts.Data.CONTENT_DIRECTORY);
-
-        Cursor c = getContentResolver().query(dataUri,
-                new String[] {Phone._ID, Phone.NUMBER, Phone.IS_SUPER_PRIMARY,
-                        RawContacts.ACCOUNT_TYPE, Phone.TYPE, Phone.LABEL},
-                Data.MIMETYPE + "=?", new String[] {Phone.CONTENT_ITEM_TYPE}, null);
-        if (c != null) {
-            if (c.moveToFirst()) {
-                return c;
-            }
-            c.close();
-        }
-        return null;
-    }
-
-    // TODO: fix PluralRules to handle zero correctly and use Resources.getQuantityText directly
-    protected String getQuantityText(int count, int zeroResourceId, int pluralResourceId) {
-        if (count == 0) {
-            return getString(zeroResourceId);
-        } else {
-            String format = getResources().getQuantityText(pluralResourceId, count).toString();
-            return String.format(format, count);
-        }
-    }
-
-    /**
-     * Signal an error to the user.
-     */
-    void signalError() {
-        //TODO play an error beep or something...
-    }
-
-    Cursor getItemForView(View view) {
-        ListView listView = getListView();
-        int index = listView.getPositionForView(view);
-        if (index < 0) {
-            return null;
-        }
-        return (Cursor) listView.getAdapter().getItem(index);
-    }
-
-    private static class QueryHandler extends AsyncQueryHandler {
-        protected final WeakReference<ContactsListActivity> mActivity;
-        protected boolean mLoadingJoinSuggestions = false;
-
-        public QueryHandler(Context context) {
-            super(context.getContentResolver());
-            mActivity = new WeakReference<ContactsListActivity>((ContactsListActivity) context);
-        }
-
-        public void setLoadingJoinSuggestions(boolean flag) {
-            mLoadingJoinSuggestions = flag;
-        }
-
-        @Override
-        protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
-            final ContactsListActivity activity = mActivity.get();
-            if (activity != null && !activity.isFinishing()) {
-
-                // Whenever we get a suggestions cursor, we need to immediately kick off
-                // another query for the complete list of contacts
-                if (cursor != null && mLoadingJoinSuggestions) {
-                    mLoadingJoinSuggestions = false;
-                    if (cursor.getCount() > 0) {
-                        activity.mAdapter.setSuggestionsCursor(cursor);
-                    } else {
-                        cursor.close();
-                        activity.mAdapter.setSuggestionsCursor(null);
-                    }
-
-                    if (activity.mAdapter.mSuggestionsCursorCount == 0
-                            || !activity.mJoinModeShowAllContacts) {
-                        startQuery(QUERY_TOKEN, null, activity.getContactFilterUri(
-                                        activity.getTextFilter()),
-                                CONTACTS_SUMMARY_PROJECTION,
-                                Contacts._ID + " != " + activity.mQueryAggregateId
-                                        + " AND " + CLAUSE_ONLY_VISIBLE, null,
-                                activity.getSortOrder(CONTACTS_SUMMARY_PROJECTION));
-                        return;
-                    }
-
-                    cursor = activity.getShowAllContactsLabelCursor(CONTACTS_SUMMARY_PROJECTION);
-                }
-
-                activity.mAdapter.changeCursor(cursor);
-
-                // Now that the cursor is populated again, it's possible to restore the list state
-                if (activity.mListState != null) {
-                    activity.mList.onRestoreInstanceState(activity.mListState);
-                    activity.mListState = null;
-                }
-            } else {
-                if (cursor != null) {
-                    cursor.close();
-                }
-            }
-        }
-    }
-
-    final static class ContactListItemCache {
-        public CharArrayBuffer nameBuffer = new CharArrayBuffer(128);
-        public CharArrayBuffer dataBuffer = new CharArrayBuffer(128);
-        public CharArrayBuffer highlightedTextBuffer = new CharArrayBuffer(128);
-        public TextWithHighlighting textWithHighlighting;
-        public CharArrayBuffer phoneticNameBuffer = new CharArrayBuffer(128);
-    }
-
-    final static class PinnedHeaderCache {
-        public TextView titleView;
-        public ColorStateList textColor;
-        public Drawable background;
-    }
-
-    private final class ContactItemListAdapter extends CursorAdapter
-            implements SectionIndexer, OnScrollListener, PinnedHeaderListView.PinnedHeaderAdapter {
-        private SectionIndexer mIndexer;
-        private boolean mLoading = true;
-        private CharSequence mUnknownNameText;
-        private boolean mDisplayPhotos = false;
-        private boolean mDisplayCallButton = false;
-        private boolean mDisplayAdditionalData = true;
-        private int mFrequentSeparatorPos = ListView.INVALID_POSITION;
-        private boolean mDisplaySectionHeaders = true;
-        private Cursor mSuggestionsCursor;
-        private int mSuggestionsCursorCount;
-
-        public ContactItemListAdapter(Context context) {
-            super(context, null, false);
-
-            mUnknownNameText = context.getText(android.R.string.unknownName);
-            switch (mMode) {
-                case MODE_LEGACY_PICK_POSTAL:
-                case MODE_PICK_POSTAL:
-                case MODE_LEGACY_PICK_PHONE:
-                case MODE_PICK_PHONE:
-                case MODE_STREQUENT:
-                case MODE_FREQUENT:
-                    mDisplaySectionHeaders = false;
-                    break;
-            }
-
-            if (mSearchMode) {
-                mDisplaySectionHeaders = false;
-            }
-
-            // Do not display the second line of text if in a specific SEARCH query mode, usually for
-            // matching a specific E-mail or phone number. Any contact details
-            // shown would be identical, and columns might not even be present
-            // in the returned cursor.
-            if (mMode != MODE_QUERY_PICK_PHONE && mQueryMode != QUERY_MODE_NONE) {
-                mDisplayAdditionalData = false;
-            }
-
-            if ((mMode & MODE_MASK_NO_DATA) == MODE_MASK_NO_DATA) {
-                mDisplayAdditionalData = false;
-            }
-
-            if ((mMode & MODE_MASK_SHOW_CALL_BUTTON) == MODE_MASK_SHOW_CALL_BUTTON) {
-                mDisplayCallButton = true;
-            }
-
-            if ((mMode & MODE_MASK_SHOW_PHOTOS) == MODE_MASK_SHOW_PHOTOS) {
-                mDisplayPhotos = true;
-            }
-        }
-
-        public boolean getDisplaySectionHeadersEnabled() {
-            return mDisplaySectionHeaders;
-        }
-
-        public void setSuggestionsCursor(Cursor cursor) {
-            if (mSuggestionsCursor != null) {
-                mSuggestionsCursor.close();
-            }
-            mSuggestionsCursor = cursor;
-            mSuggestionsCursorCount = cursor == null ? 0 : cursor.getCount();
-        }
-
-        /**
-         * Callback on the UI thread when the content observer on the backing cursor fires.
-         * Instead of calling requery we need to do an async query so that the requery doesn't
-         * block the UI thread for a long time.
-         */
-        @Override
-        protected void onContentChanged() {
-            CharSequence constraint = getTextFilter();
-            if (!TextUtils.isEmpty(constraint)) {
-                // Reset the filter state then start an async filter operation
-                Filter filter = getFilter();
-                filter.filter(constraint);
-            } else {
-                // Start an async query
-                startQuery();
-            }
-        }
-
-        public void setLoading(boolean loading) {
-            mLoading = loading;
-        }
-
-        @Override
-        public boolean isEmpty() {
-            if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
-                return true;
-            }
-
-            if (mSearchMode) {
-                return TextUtils.isEmpty(getTextFilter());
-            } else if ((mMode & MODE_MASK_CREATE_NEW) == MODE_MASK_CREATE_NEW) {
-                // This mode mask adds a header and we always want it to show up, even
-                // if the list is empty, so always claim the list is not empty.
-                return false;
-            } else {
-                if (mCursor == null || mLoading) {
-                    // We don't want the empty state to show when loading.
-                    return false;
-                } else {
-                    return super.isEmpty();
-                }
-            }
-        }
-
-        @Override
-        public int getItemViewType(int position) {
-            if (position == 0 && (mShowNumberOfContacts || (mMode & MODE_MASK_CREATE_NEW) != 0)) {
-                return IGNORE_ITEM_VIEW_TYPE;
-            }
-
-            if (isShowAllContactsItemPosition(position)) {
-                return IGNORE_ITEM_VIEW_TYPE;
-            }
-
-            if (isSearchAllContactsItemPosition(position)) {
-                return IGNORE_ITEM_VIEW_TYPE;
-            }
-
-            if (getSeparatorId(position) != 0) {
-                // We don't want the separator view to be recycled.
-                return IGNORE_ITEM_VIEW_TYPE;
-            }
-
-            return super.getItemViewType(position);
-        }
-
-        @Override
-        public View getView(int position, View convertView, ViewGroup parent) {
-            if (!mDataValid) {
-                throw new IllegalStateException(
-                        "this should only be called when the cursor is valid");
-            }
-
-            // handle the total contacts item
-            if (position == 0 && mShowNumberOfContacts) {
-                return getTotalContactCountView(parent);
-            }
-
-            if (position == 0 && (mMode & MODE_MASK_CREATE_NEW) != 0) {
-                // Add the header for creating a new contact
-                return getLayoutInflater().inflate(R.layout.create_new_contact, parent, false);
-            }
-
-            if (isShowAllContactsItemPosition(position)) {
-                return getLayoutInflater().
-                        inflate(R.layout.contacts_list_show_all_item, parent, false);
-            }
-
-            if (isSearchAllContactsItemPosition(position)) {
-                return getLayoutInflater().
-                        inflate(R.layout.contacts_list_search_all_item, parent, false);
-            }
-
-            // Handle the separator specially
-            int separatorId = getSeparatorId(position);
-            if (separatorId != 0) {
-                TextView view = (TextView) getLayoutInflater().
-                        inflate(R.layout.list_separator, parent, false);
-                view.setText(separatorId);
-                return view;
-            }
-
-            boolean showingSuggestion;
-            Cursor cursor;
-            if (mSuggestionsCursorCount != 0 && position < mSuggestionsCursorCount + 2) {
-                showingSuggestion = true;
-                cursor = mSuggestionsCursor;
-            } else {
-                showingSuggestion = false;
-                cursor = mCursor;
-            }
-
-            int realPosition = getRealPosition(position);
-            if (!cursor.moveToPosition(realPosition)) {
-                throw new IllegalStateException("couldn't move cursor to position " + position);
-            }
-
-            boolean newView;
-            View v;
-            if (convertView == null || convertView.getTag() == null) {
-                newView = true;
-                v = newView(mContext, cursor, parent);
-            } else {
-                newView = false;
-                v = convertView;
-            }
-            bindView(v, mContext, cursor);
-            bindSectionHeader(v, realPosition, mDisplaySectionHeaders && !showingSuggestion);
-            return v;
-        }
-
-        private View getTotalContactCountView(ViewGroup parent) {
-            final LayoutInflater inflater = getLayoutInflater();
-            View view = inflater.inflate(R.layout.total_contacts, parent, false);
-
-            TextView totalContacts = (TextView) view.findViewById(R.id.totalContactsText);
-
-            String text;
-            int count = getRealCount();
-
-            if (mSearchMode && !TextUtils.isEmpty(getTextFilter())) {
-                text = getQuantityText(count, R.string.listFoundAllContactsZero,
-                        R.plurals.searchFoundContacts);
-            } else {
-                if (mDisplayOnlyPhones) {
-                    text = getQuantityText(count, R.string.listTotalPhoneContactsZero,
-                            R.plurals.listTotalPhoneContacts);
-                } else {
-                    text = getQuantityText(count, R.string.listTotalAllContactsZero,
-                            R.plurals.listTotalAllContacts);
-                }
-            }
-            totalContacts.setText(text);
-            return view;
-        }
-
-        private boolean isShowAllContactsItemPosition(int position) {
-            return mMode == MODE_JOIN_CONTACT && mJoinModeShowAllContacts
-                    && mSuggestionsCursorCount != 0 && position == mSuggestionsCursorCount + 2;
-        }
-
-        private boolean isSearchAllContactsItemPosition(int position) {
-            return mSearchMode && position == getCount() - 1;
-        }
-
-        private int getSeparatorId(int position) {
-            int separatorId = 0;
-            if (position == mFrequentSeparatorPos) {
-                separatorId = R.string.favoritesFrquentSeparator;
-            }
-            if (mSuggestionsCursorCount != 0) {
-                if (position == 0) {
-                    separatorId = R.string.separatorJoinAggregateSuggestions;
-                } else if (position == mSuggestionsCursorCount + 1) {
-                    separatorId = R.string.separatorJoinAggregateAll;
-                }
-            }
-            return separatorId;
-        }
-
-        @Override
-        public View newView(Context context, Cursor cursor, ViewGroup parent) {
-            final ContactListItemView view = new ContactListItemView(context, null);
-            view.setOnCallButtonClickListener(ContactsListActivity.this);
-            view.setTag(new ContactListItemCache());
-            return view;
-        }
-
-        @Override
-        public void bindView(View itemView, Context context, Cursor cursor) {
-            final ContactListItemView view = (ContactListItemView)itemView;
-            final ContactListItemCache cache = (ContactListItemCache) view.getTag();
-
-            int typeColumnIndex;
-            int dataColumnIndex;
-            int labelColumnIndex;
-            int defaultType;
-            int nameColumnIndex;
-            int phoneticNameColumnIndex;
-            boolean displayAdditionalData = mDisplayAdditionalData;
-            boolean highlightingEnabled = false;
-            switch(mMode) {
-                case MODE_PICK_PHONE:
-                case MODE_LEGACY_PICK_PHONE:
-                case MODE_QUERY_PICK_PHONE: {
-                    nameColumnIndex = PHONE_DISPLAY_NAME_COLUMN_INDEX;
-                    phoneticNameColumnIndex = -1;
-                    dataColumnIndex = PHONE_NUMBER_COLUMN_INDEX;
-                    typeColumnIndex = PHONE_TYPE_COLUMN_INDEX;
-                    labelColumnIndex = PHONE_LABEL_COLUMN_INDEX;
-                    defaultType = Phone.TYPE_HOME;
-                    break;
-                }
-                case MODE_PICK_POSTAL:
-                case MODE_LEGACY_PICK_POSTAL: {
-                    nameColumnIndex = POSTAL_DISPLAY_NAME_COLUMN_INDEX;
-                    phoneticNameColumnIndex = -1;
-                    dataColumnIndex = POSTAL_ADDRESS_COLUMN_INDEX;
-                    typeColumnIndex = POSTAL_TYPE_COLUMN_INDEX;
-                    labelColumnIndex = POSTAL_LABEL_COLUMN_INDEX;
-                    defaultType = StructuredPostal.TYPE_HOME;
-                    break;
-                }
-                default: {
-                    nameColumnIndex = getSummaryDisplayNameColumnIndex();
-                    if (mMode == MODE_LEGACY_PICK_PERSON
-                            || mMode == MODE_LEGACY_PICK_OR_CREATE_PERSON) {
-                        phoneticNameColumnIndex = -1;
-                    } else {
-                        phoneticNameColumnIndex = SUMMARY_PHONETIC_NAME_COLUMN_INDEX;
-                    }
-                    dataColumnIndex = -1;
-                    typeColumnIndex = -1;
-                    labelColumnIndex = -1;
-                    defaultType = Phone.TYPE_HOME;
-                    displayAdditionalData = false;
-                    highlightingEnabled = mHighlightWhenScrolling && mMode != MODE_STREQUENT;
-                }
-            }
-
-            // Set the name
-            cursor.copyStringToBuffer(nameColumnIndex, cache.nameBuffer);
-            TextView nameView = view.getNameTextView();
-            int size = cache.nameBuffer.sizeCopied;
-            if (size != 0) {
-                if (highlightingEnabled) {
-                    if (cache.textWithHighlighting == null) {
-                        cache.textWithHighlighting =
-                                mHighlightingAnimation.createTextWithHighlighting();
-                    }
-                    buildDisplayNameWithHighlighting(nameView, cursor, cache.nameBuffer,
-                            cache.highlightedTextBuffer, cache.textWithHighlighting);
-                } else {
-                    nameView.setText(cache.nameBuffer.data, 0, size);
-                }
-            } else {
-                nameView.setText(mUnknownNameText);
-            }
-
-            boolean hasPhone = cursor.getColumnCount() >= SUMMARY_HAS_PHONE_COLUMN_INDEX
-                    && cursor.getInt(SUMMARY_HAS_PHONE_COLUMN_INDEX) != 0;
-
-            // Make the call button visible if requested.
-            if (mDisplayCallButton && hasPhone) {
-                int pos = cursor.getPosition();
-                view.showCallButton(android.R.id.button1, pos);
-            } else {
-                view.hideCallButton();
-            }
-
-            // Set the photo, if requested
-            if (mDisplayPhotos) {
-                boolean useQuickContact = (mMode & MODE_MASK_DISABLE_QUIKCCONTACT) == 0;
-
-                long photoId = 0;
-                if (!cursor.isNull(SUMMARY_PHOTO_ID_COLUMN_INDEX)) {
-                    photoId = cursor.getLong(SUMMARY_PHOTO_ID_COLUMN_INDEX);
-                }
-
-                ImageView viewToUse;
-                if (useQuickContact) {
-                    // Build soft lookup reference
-                    final long contactId = cursor.getLong(SUMMARY_ID_COLUMN_INDEX);
-                    final String lookupKey = cursor.getString(SUMMARY_LOOKUP_KEY_COLUMN_INDEX);
-                    QuickContactBadge quickContact = view.getQuickContact();
-                    quickContact.assignContactUri(Contacts.getLookupUri(contactId, lookupKey));
-                    quickContact.setSelectedContactsAppTabIndex(StickyTabs.getTab(getIntent()));
-                    viewToUse = quickContact;
-                } else {
-                    viewToUse = view.getPhotoView();
-                }
-
-                final int position = cursor.getPosition();
-                mPhotoLoader.loadPhoto(viewToUse, photoId);
-            }
-
-            if ((mMode & MODE_MASK_NO_PRESENCE) == 0) {
-                // Set the proper icon (star or presence or nothing)
-                int serverStatus;
-                if (!cursor.isNull(SUMMARY_PRESENCE_STATUS_COLUMN_INDEX)) {
-                    serverStatus = cursor.getInt(SUMMARY_PRESENCE_STATUS_COLUMN_INDEX);
-                    Drawable icon = ContactPresenceIconUtil.getPresenceIcon(mContext, serverStatus);
-                    if (icon != null) {
-                        view.setPresence(icon);
-                    } else {
-                        view.setPresence(null);
-                    }
-                } else {
-                    view.setPresence(null);
-                }
-            } else {
-                view.setPresence(null);
-            }
-
-            if (mShowSearchSnippets) {
-                boolean showSnippet = false;
-                String snippetMimeType = cursor.getString(SUMMARY_SNIPPET_MIMETYPE_COLUMN_INDEX);
-                if (Email.CONTENT_ITEM_TYPE.equals(snippetMimeType)) {
-                    String email = cursor.getString(SUMMARY_SNIPPET_DATA1_COLUMN_INDEX);
-                    if (!TextUtils.isEmpty(email)) {
-                        view.setSnippet(email);
-                        showSnippet = true;
-                    }
-                } else if (Organization.CONTENT_ITEM_TYPE.equals(snippetMimeType)) {
-                    String company = cursor.getString(SUMMARY_SNIPPET_DATA1_COLUMN_INDEX);
-                    String title = cursor.getString(SUMMARY_SNIPPET_DATA4_COLUMN_INDEX);
-                    if (!TextUtils.isEmpty(company)) {
-                        if (!TextUtils.isEmpty(title)) {
-                            view.setSnippet(company + " / " + title);
-                        } else {
-                            view.setSnippet(company);
-                        }
-                        showSnippet = true;
-                    } else if (!TextUtils.isEmpty(title)) {
-                        view.setSnippet(title);
-                        showSnippet = true;
-                    }
-                } else if (Nickname.CONTENT_ITEM_TYPE.equals(snippetMimeType)) {
-                    String nickname = cursor.getString(SUMMARY_SNIPPET_DATA1_COLUMN_INDEX);
-                    if (!TextUtils.isEmpty(nickname)) {
-                        view.setSnippet(nickname);
-                        showSnippet = true;
-                    }
-                }
-
-                if (!showSnippet) {
-                    view.setSnippet(null);
-                }
-            }
-
-            if (!displayAdditionalData) {
-                if (phoneticNameColumnIndex != -1) {
-
-                    // Set the name
-                    cursor.copyStringToBuffer(phoneticNameColumnIndex, cache.phoneticNameBuffer);
-                    int phoneticNameSize = cache.phoneticNameBuffer.sizeCopied;
-                    if (phoneticNameSize != 0) {
-                        view.setLabel(cache.phoneticNameBuffer.data, phoneticNameSize);
-                    } else {
-                        view.setLabel(null);
-                    }
-                } else {
-                    view.setLabel(null);
-                }
-                return;
-            }
-
-            // Set the data.
-            cursor.copyStringToBuffer(dataColumnIndex, cache.dataBuffer);
-
-            size = cache.dataBuffer.sizeCopied;
-            view.setData(cache.dataBuffer.data, size);
-
-            // Set the label.
-            if (!cursor.isNull(typeColumnIndex)) {
-                final int type = cursor.getInt(typeColumnIndex);
-                final String label = cursor.getString(labelColumnIndex);
-
-                if (mMode == MODE_LEGACY_PICK_POSTAL || mMode == MODE_PICK_POSTAL) {
-                    // TODO cache
-                    view.setLabel(StructuredPostal.getTypeLabel(context.getResources(), type,
-                            label));
-                } else {
-                    // TODO cache
-                    view.setLabel(Phone.getTypeLabel(context.getResources(), type, label));
-                }
-            } else {
-                view.setLabel(null);
-            }
-        }
-
-        /**
-         * Computes the span of the display name that has highlighted parts and configures
-         * the display name text view accordingly.
-         */
-        private void buildDisplayNameWithHighlighting(TextView textView, Cursor cursor,
-                CharArrayBuffer buffer1, CharArrayBuffer buffer2,
-                TextWithHighlighting textWithHighlighting) {
-            int oppositeDisplayOrderColumnIndex;
-            if (mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY) {
-                oppositeDisplayOrderColumnIndex = SUMMARY_DISPLAY_NAME_ALTERNATIVE_COLUMN_INDEX;
-            } else {
-                oppositeDisplayOrderColumnIndex = SUMMARY_DISPLAY_NAME_PRIMARY_COLUMN_INDEX;
-            }
-            cursor.copyStringToBuffer(oppositeDisplayOrderColumnIndex, buffer2);
-
-            textWithHighlighting.setText(buffer1, buffer2);
-            textView.setText(textWithHighlighting);
-        }
-
-        private void bindSectionHeader(View itemView, int position, boolean displaySectionHeaders) {
-            final ContactListItemView view = (ContactListItemView)itemView;
-            final ContactListItemCache cache = (ContactListItemCache) view.getTag();
-            if (!displaySectionHeaders) {
-                view.setSectionHeader(null);
-                view.setDividerVisible(true);
-            } else {
-                final int section = getSectionForPosition(position);
-                if (getPositionForSection(section) == position) {
-                    String title = (String)mIndexer.getSections()[section];
-                    view.setSectionHeader(title);
-                } else {
-                    view.setDividerVisible(false);
-                    view.setSectionHeader(null);
-                }
-
-                // move the divider for the last item in a section
-                if (getPositionForSection(section + 1) - 1 == position) {
-                    view.setDividerVisible(false);
-                } else {
-                    view.setDividerVisible(true);
-                }
-            }
-        }
-
-        @Override
-        public void changeCursor(Cursor cursor) {
-            if (cursor != null) {
-                setLoading(false);
-            }
-
-            // Get the split between starred and frequent items, if the mode is strequent
-            mFrequentSeparatorPos = ListView.INVALID_POSITION;
-            int cursorCount = 0;
-            if (cursor != null && (cursorCount = cursor.getCount()) > 0
-                    && mMode == MODE_STREQUENT) {
-                cursor.move(-1);
-                for (int i = 0; cursor.moveToNext(); i++) {
-                    int starred = cursor.getInt(SUMMARY_STARRED_COLUMN_INDEX);
-                    if (starred == 0) {
-                        if (i > 0) {
-                            // Only add the separator when there are starred items present
-                            mFrequentSeparatorPos = i;
-                        }
-                        break;
-                    }
-                }
-            }
-
-            if (cursor != null && mSearchResultsMode) {
-                TextView foundContactsText = (TextView)findViewById(R.id.search_results_found);
-                String text = getQuantityText(cursor.getCount(), R.string.listFoundAllContactsZero,
-                        R.plurals.listFoundAllContacts);
-                foundContactsText.setText(text);
-            }
-
-            super.changeCursor(cursor);
-            // Update the indexer for the fast scroll widget
-            updateIndexer(cursor);
-        }
-
-        private void updateIndexer(Cursor cursor) {
-            if (cursor == null) {
-                mIndexer = null;
-                return;
-            }
-
-            Bundle bundle = cursor.getExtras();
-            if (bundle.containsKey(ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_TITLES)) {
-                String sections[] =
-                    bundle.getStringArray(ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_TITLES);
-                int counts[] = bundle.getIntArray(ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS);
-                mIndexer = new ContactsSectionIndexer(sections, counts);
-            } else {
-                mIndexer = null;
-            }
-        }
-
-        /**
-         * Run the query on a helper thread. Beware that this code does not run
-         * on the main UI thread!
-         */
-        @Override
-        public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
-            return doFilter(constraint.toString());
-        }
-
-        public Object [] getSections() {
-            if (mIndexer == null) {
-                return new String[] { " " };
-            } else {
-                return mIndexer.getSections();
-            }
-        }
-
-        public int getPositionForSection(int sectionIndex) {
-            if (mIndexer == null) {
-                return -1;
-            }
-
-            return mIndexer.getPositionForSection(sectionIndex);
-        }
-
-        public int getSectionForPosition(int position) {
-            if (mIndexer == null) {
-                return -1;
-            }
-
-            return mIndexer.getSectionForPosition(position);
-        }
-
-        @Override
-        public boolean areAllItemsEnabled() {
-            return mMode != MODE_STARRED
-                && !mShowNumberOfContacts
-                && mSuggestionsCursorCount == 0;
-        }
-
-        @Override
-        public boolean isEnabled(int position) {
-            if (mShowNumberOfContacts) {
-                if (position == 0) {
-                    return false;
-                }
-                position--;
-            }
-
-            if (mSuggestionsCursorCount > 0) {
-                return position != 0 && position != mSuggestionsCursorCount + 1;
-            }
-            return position != mFrequentSeparatorPos;
-        }
-
-        @Override
-        public int getCount() {
-            if (!mDataValid) {
-                return 0;
-            }
-            int superCount = super.getCount();
-
-            if (mShowNumberOfContacts && (mSearchMode || superCount > 0)) {
-                // We don't want to count this header if it's the only thing visible, so that
-                // the empty text will display.
-                superCount++;
-            }
-
-            if (mSearchMode) {
-                // Last element in the list is the "Find
-                superCount++;
-            }
-
-            // We do not show the "Create New" button in Search mode
-            if ((mMode & MODE_MASK_CREATE_NEW) != 0 && !mSearchMode) {
-                // Count the "Create new contact" line
-                superCount++;
-            }
-
-            if (mSuggestionsCursorCount != 0) {
-                // When showing suggestions, we have 2 additional list items: the "Suggestions"
-                // and "All contacts" headers.
-                return mSuggestionsCursorCount + superCount + 2;
-            }
-            else if (mFrequentSeparatorPos != ListView.INVALID_POSITION) {
-                // When showing strequent list, we have an additional list item - the separator.
-                return superCount + 1;
-            } else {
-                return superCount;
-            }
-        }
-
-        /**
-         * Gets the actual count of contacts and excludes all the headers.
-         */
-        public int getRealCount() {
-            return super.getCount();
-        }
-
-        private int getRealPosition(int pos) {
-            if (mShowNumberOfContacts) {
-                pos--;
-            }
-
-            if ((mMode & MODE_MASK_CREATE_NEW) != 0 && !mSearchMode) {
-                return pos - 1;
-            } else if (mSuggestionsCursorCount != 0) {
-                // When showing suggestions, we have 2 additional list items: the "Suggestions"
-                // and "All contacts" separators.
-                if (pos < mSuggestionsCursorCount + 2) {
-                    // We are in the upper partition (Suggestions). Adjusting for the "Suggestions"
-                    // separator.
-                    return pos - 1;
-                } else {
-                    // We are in the lower partition (All contacts). Adjusting for the size
-                    // of the upper partition plus the two separators.
-                    return pos - mSuggestionsCursorCount - 2;
-                }
-            } else if (mFrequentSeparatorPos == ListView.INVALID_POSITION) {
-                // No separator, identity map
-                return pos;
-            } else if (pos <= mFrequentSeparatorPos) {
-                // Before or at the separator, identity map
-                return pos;
-            } else {
-                // After the separator, remove 1 from the pos to get the real underlying pos
-                return pos - 1;
-            }
-        }
-
-        @Override
-        public Object getItem(int pos) {
-            if (mSuggestionsCursorCount != 0 && pos <= mSuggestionsCursorCount) {
-                mSuggestionsCursor.moveToPosition(getRealPosition(pos));
-                return mSuggestionsCursor;
-            } else if (isSearchAllContactsItemPosition(pos)){
-                return null;
-            } else {
-                int realPosition = getRealPosition(pos);
-                if (realPosition < 0) {
-                    return null;
-                }
-                return super.getItem(realPosition);
-            }
-        }
-
-        @Override
-        public long getItemId(int pos) {
-            if (mSuggestionsCursorCount != 0 && pos < mSuggestionsCursorCount + 2) {
-                if (mSuggestionsCursor.moveToPosition(pos - 1)) {
-                    return mSuggestionsCursor.getLong(mRowIDColumn);
-                } else {
-                    return 0;
-                }
-            } else if (isSearchAllContactsItemPosition(pos)) {
-                return 0;
-            }
-            int realPosition = getRealPosition(pos);
-            if (realPosition < 0) {
-                return 0;
-            }
-            return super.getItemId(realPosition);
-        }
-
-        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
-                int totalItemCount) {
-            if (view instanceof PinnedHeaderListView) {
-                ((PinnedHeaderListView)view).configureHeaderView(firstVisibleItem);
-            }
-        }
-
-        public void onScrollStateChanged(AbsListView view, int scrollState) {
-            if (mHighlightWhenScrolling) {
-                if (scrollState != OnScrollListener.SCROLL_STATE_IDLE) {
-                    mHighlightingAnimation.startHighlighting();
-                } else {
-                    mHighlightingAnimation.stopHighlighting();
-                }
-            }
-
-            if (scrollState == OnScrollListener.SCROLL_STATE_FLING) {
-                mPhotoLoader.pause();
-            } else if (mDisplayPhotos) {
-                mPhotoLoader.resume();
-            }
-        }
-
-        /**
-         * Computes the state of the pinned header.  It can be invisible, fully
-         * visible or partially pushed up out of the view.
-         */
-        public int getPinnedHeaderState(int position) {
-            if (mIndexer == null || mCursor == null || mCursor.getCount() == 0) {
-                return PINNED_HEADER_GONE;
-            }
-
-            int realPosition = getRealPosition(position);
-            if (realPosition < 0) {
-                return PINNED_HEADER_GONE;
-            }
-
-            // The header should get pushed up if the top item shown
-            // is the last item in a section for a particular letter.
-            int section = getSectionForPosition(realPosition);
-            int nextSectionPosition = getPositionForSection(section + 1);
-            if (nextSectionPosition != -1 && realPosition == nextSectionPosition - 1) {
-                return PINNED_HEADER_PUSHED_UP;
-            }
-
-            return PINNED_HEADER_VISIBLE;
-        }
-
-        /**
-         * Configures the pinned header by setting the appropriate text label
-         * and also adjusting color if necessary.  The color needs to be
-         * adjusted when the pinned header is being pushed up from the view.
-         */
-        public void configurePinnedHeader(View header, int position, int alpha) {
-            PinnedHeaderCache cache = (PinnedHeaderCache)header.getTag();
-            if (cache == null) {
-                cache = new PinnedHeaderCache();
-                cache.titleView = (TextView)header.findViewById(R.id.header_text);
-                cache.textColor = cache.titleView.getTextColors();
-                cache.background = header.getBackground();
-                header.setTag(cache);
-            }
-
-            int realPosition = getRealPosition(position);
-            int section = getSectionForPosition(realPosition);
-
-            String title = (String)mIndexer.getSections()[section];
-            cache.titleView.setText(title);
-
-            if (alpha == 255) {
-                // Opaque: use the default background, and the original text color
-                header.setBackgroundDrawable(cache.background);
-                cache.titleView.setTextColor(cache.textColor);
-            } else {
-                // Faded: use a solid color approximation of the background, and
-                // a translucent text color
-                header.setBackgroundColor(Color.rgb(
-                        Color.red(mPinnedHeaderBackgroundColor) * alpha / 255,
-                        Color.green(mPinnedHeaderBackgroundColor) * alpha / 255,
-                        Color.blue(mPinnedHeaderBackgroundColor) * alpha / 255));
-
-                int textColor = cache.textColor.getDefaultColor();
-                cache.titleView.setTextColor(Color.argb(alpha,
-                        Color.red(textColor), Color.green(textColor), Color.blue(textColor)));
-            }
-        }
-    }
-
-    private ContactsPreferences.ChangeListener mPreferencesChangeListener =
-            new ContactsPreferences.ChangeListener() {
-        @Override
-        public void onChange() {
-            // When returning from DisplayOptions, onActivityResult ensures that we reload the list,
-            // so we do not have to do anything here. However, ContactsPreferences requires a change
-            // listener, otherwise it would not reload its settings.
-        }
-    };
-}
diff --git a/src/com/android/contacts/ContactsSearchManager.java b/src/com/android/contacts/ContactsSearchManager.java
index d65e079..edb2016 100644
--- a/src/com/android/contacts/ContactsSearchManager.java
+++ b/src/com/android/contacts/ContactsSearchManager.java
@@ -16,6 +16,8 @@
 
 package com.android.contacts;
 
+import com.android.contacts.list.ContactsRequest;
+
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
@@ -31,27 +33,28 @@
      * An extra that provides context for search UI and defines the scope for
      * the search queries.
      */
-    public static final String ORIGINAL_ACTION_EXTRA_KEY = "originalAction";
-
-    /**
-     * An extra that provides context for search UI and defines the scope for
-     * the search queries.
-     */
-    public static final String ORIGINAL_COMPONENT_EXTRA_KEY = "originalComponent";
+    public static final String ORIGINAL_REQUEST_KEY = "originalRequest";
 
     /**
      * Starts the contact list activity in the search mode.
      */
     public static void startSearch(Activity context, String initialQuery) {
-        context.startActivity(buildIntent(context, initialQuery));
+        context.startActivity(buildIntent(context, initialQuery, null));
     }
 
     public static void startSearchForResult(Activity context, String initialQuery,
-            int requestCode) {
-        context.startActivityForResult(buildIntent(context, initialQuery), requestCode);
+            int requestCode, ContactsRequest originalRequest) {
+        context.startActivityForResult(
+                buildIntent(context, initialQuery, originalRequest), requestCode);
     }
 
-    private static Intent buildIntent(Activity context, String initialQuery) {
+    public static void startSearch(Activity context, String initialQuery,
+            ContactsRequest originalRequest) {
+        context.startActivity(buildIntent(context, initialQuery, originalRequest));
+    }
+
+    private static Intent buildIntent(
+            Activity context, String initialQuery, ContactsRequest originalRequest) {
         Intent intent = new Intent();
         intent.setData(ContactsContract.Contacts.CONTENT_URI);
         intent.setAction(UI.FILTER_CONTACTS_ACTION);
@@ -62,8 +65,9 @@
             intent.putExtras(originalExtras);
         }
         intent.putExtra(UI.FILTER_TEXT_EXTRA_KEY, initialQuery);
-        intent.putExtra(ORIGINAL_ACTION_EXTRA_KEY, originalIntent.getAction());
-        intent.putExtra(ORIGINAL_COMPONENT_EXTRA_KEY, originalIntent.getComponent().getClassName());
+        if (originalRequest != null) {
+            intent.putExtra(ORIGINAL_REQUEST_KEY, originalRequest);
+        }
         return intent;
     }
 }
diff --git a/src/com/android/contacts/ContactsSectionIndexer.java b/src/com/android/contacts/ContactsSectionIndexer.java
deleted file mode 100644
index 01d461f..0000000
--- a/src/com/android/contacts/ContactsSectionIndexer.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.contacts;
-
-import android.widget.SectionIndexer;
-
-import java.util.Arrays;
-
-/**
- * A section indexer that is configured with precomputed section titles and
- * their respective counts.
- */
-public class ContactsSectionIndexer implements SectionIndexer {
-
-    private final String[] mSections;
-    private final int[] mPositions;
-    private final int mCount;
-
-    /**
-     * Constructor.
-     *
-     * @param sections a non-null array
-     * @param counts a non-null array of the same size as <code>sections</code>
-     */
-    public ContactsSectionIndexer(String[] sections, int[] counts) {
-        if (sections == null || counts == null) {
-            throw new NullPointerException();
-        }
-
-        if (sections.length != counts.length) {
-            throw new IllegalArgumentException(
-                    "The sections and counts arrays must have the same length");
-        }
-
-        // TODO process sections/counts based on current locale and/or specific section titles
-
-        this.mSections = sections;
-        mPositions = new int[counts.length];
-        int position = 0;
-        for (int i = 0; i < counts.length; i++) {
-            if (mSections[i] == null) {
-                mSections[i] = " ";
-            } else {
-                mSections[i] = mSections[i].trim();
-            }
-
-            mPositions[i] = position;
-            position += counts[i];
-        }
-        mCount = position;
-    }
-
-    public Object[] getSections() {
-        return mSections;
-    }
-
-    public int getPositionForSection(int section) {
-        if (section < 0 || section >= mSections.length) {
-            return -1;
-        }
-
-        return mPositions[section];
-    }
-
-    public int getSectionForPosition(int position) {
-        if (position < 0 || position >= mCount) {
-            return -1;
-        }
-
-        int index = Arrays.binarySearch(mPositions, position);
-
-        /*
-         * Consider this example: section positions are 0, 3, 5; the supplied
-         * position is 4. The section corresponding to position 4 starts at
-         * position 3, so the expected return value is 1. Binary search will not
-         * find 4 in the array and thus will return -insertPosition-1, i.e. -3.
-         * To get from that number to the expected value of 1 we need to negate
-         * and subtract 2.
-         */
-        return index >= 0 ? index : -index - 2;
-    }
-}
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index 94dabba..fd9eb58 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -16,8 +16,7 @@
 
 package com.android.contacts;
 
-
-import com.android.contacts.model.ContactsSource;
+import com.android.contacts.model.BaseAccountType;
 import com.android.contacts.util.Constants;
 
 import android.content.ContentResolver;
@@ -29,6 +28,7 @@
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.drawable.Drawable;
+import android.location.CountryDetector;
 import android.net.Uri;
 import android.provider.ContactsContract.Contacts;
 import android.provider.ContactsContract.Data;
@@ -236,33 +236,104 @@
         return null;
     }
 
+    public static final class ImActions {
+        private final Intent mPrimaryIntent;
+        private final Intent mSecondaryIntent;
+        private final int mPrimaryActionIcon;
+        private final int mSecondaryActionIcon;
+
+        private ImActions(Intent primaryIntent, Intent secondaryIntent, int primaryActionIcon,
+                int secondaryActionIcon) {
+            mPrimaryIntent = primaryIntent;
+            mSecondaryIntent = secondaryIntent;
+            mPrimaryActionIcon = primaryActionIcon;
+            mSecondaryActionIcon = secondaryActionIcon;
+        }
+
+        public Intent getPrimaryIntent() {
+            return mPrimaryIntent;
+        }
+
+        public Intent getSecondaryIntent() {
+            return mSecondaryIntent;
+        }
+
+        public int getPrimaryActionIcon() {
+            return mPrimaryActionIcon;
+        }
+
+        public int getSecondaryActionIcon() {
+            return mSecondaryActionIcon;
+        }
+    }
+
     /**
      * Build {@link Intent} to launch an action for the given {@link Im} or
-     * {@link Email} row. Returns null when missing protocol or data.
+     * {@link Email} row. If the result is non-null, it either contains one or two Intents
+     * (e.g. [Text, Videochat] or just [Text])
+     * Returns null when missing protocol or data.
      */
-    public static Intent buildImIntent(ContentValues values) {
+    public static ImActions buildImActions(ContentValues values) {
         final boolean isEmail = Email.CONTENT_ITEM_TYPE.equals(values.getAsString(Data.MIMETYPE));
 
         if (!isEmail && !isProtocolValid(values)) {
             return null;
         }
 
+        final String data = values.getAsString(isEmail ? Email.DATA : Im.DATA);
+        if (TextUtils.isEmpty(data)) return null;
+
         final int protocol = isEmail ? Im.PROTOCOL_GOOGLE_TALK : values.getAsInteger(Im.PROTOCOL);
 
-        String host = values.getAsString(Im.CUSTOM_PROTOCOL);
-        String data = values.getAsString(isEmail ? Email.DATA : Im.DATA);
-        if (protocol != Im.PROTOCOL_CUSTOM) {
-            // Try bringing in a well-known host for specific protocols
-            host = ContactsUtils.lookupProviderNameFromId(protocol);
-        }
-
-        if (!TextUtils.isEmpty(host) && !TextUtils.isEmpty(data)) {
-            final String authority = host.toLowerCase();
-            final Uri imUri = new Uri.Builder().scheme(Constants.SCHEME_IMTO).authority(
-                    authority).appendPath(data).build();
-            return new Intent(Intent.ACTION_SENDTO, imUri);
+        if (protocol == Im.PROTOCOL_GOOGLE_TALK) {
+            final Integer chatCapabilityObj = values.getAsInteger(Im.CHAT_CAPABILITY);
+            final int chatCapability = chatCapabilityObj == null ? 0 : chatCapabilityObj;
+            if ((chatCapability & Im.CAPABILITY_HAS_CAMERA) != 0) {
+                // Allow Video chat and Texting
+                return new ImActions(
+                        new Intent(Intent.ACTION_SENDTO, Uri.parse("xmpp:" + data + "?message")),
+                        new Intent(Intent.ACTION_SENDTO, Uri.parse("xmpp:" + data + "?call")),
+                        android.R.drawable.sym_action_chat,
+                        R.drawable.sym_action_videochat
+                        );
+            } else if ((chatCapability & Im.CAPABILITY_HAS_VOICE) != 0) {
+                // Allow Talking and Texting
+                return new ImActions(
+                        new Intent(Intent.ACTION_SENDTO, Uri.parse("xmpp:" + data + "?message")),
+                        new Intent(Intent.ACTION_SENDTO, Uri.parse("xmpp:" + data + "?call")),
+                        android.R.drawable.sym_action_chat,
+                        R.drawable.sym_action_audiochat
+                        );
+            } else {
+                return new ImActions(
+                        new Intent(Intent.ACTION_SENDTO, Uri.parse("xmpp:" + data + "?message")),
+                        null,
+                        android.R.drawable.sym_action_chat,
+                        -1
+                        );
+            }
         } else {
-            return null;
+            // Build an IM Intent
+            String host = values.getAsString(Im.CUSTOM_PROTOCOL);
+
+            if (protocol != Im.PROTOCOL_CUSTOM) {
+                // Try bringing in a well-known host for specific protocols
+                host = ContactsUtils.lookupProviderNameFromId(protocol);
+            }
+
+            if (!TextUtils.isEmpty(host)) {
+                final String authority = host.toLowerCase();
+                final Uri imUri = new Uri.Builder().scheme(Constants.SCHEME_IMTO).authority(
+                        authority).appendPath(data).build();
+                return new ImActions(
+                        new Intent(Intent.ACTION_SENDTO, imUri),
+                        null,
+                        android.R.drawable.sym_action_chat,
+                        -1
+                        );
+            } else {
+                return null;
+            }
         }
     }
 
@@ -388,10 +459,10 @@
      * Utility for creating a standard tab indicator view.
      *
      * @param parent The parent ViewGroup to attach the new view to.
-     * @param source The {@link ContactsSource} to build the tab view from.
+     * @param source The {@link BaseAccountType} to build the tab view from.
      * @return The tab indicator View.
      */
-    public static View createTabIndicatorView(ViewGroup parent, ContactsSource source) {
+    public static View createTabIndicatorView(ViewGroup parent, BaseAccountType source) {
         Drawable icon = null;
         if (source != null) {
             icon = source.getDisplayIcon(parent.getContext());
@@ -490,4 +561,14 @@
         }
         return TextUtils.equals(a.getAction(), b.getAction());
     }
+
+    /**
+     * @return The ISO 3166-1 two letters country code of the country the user
+     *         is in.
+     */
+    public static final String getCurrentCountryIso(Context context) {
+        CountryDetector detector =
+                (CountryDetector) context.getSystemService(Context.COUNTRY_DETECTOR);
+        return detector.detectCountry().getCountryIso();
+    }
 }
diff --git a/src/com/android/contacts/DialtactsActivity.java b/src/com/android/contacts/DialtactsActivity.java
index ef183c5..ce8d3f4 100644
--- a/src/com/android/contacts/DialtactsActivity.java
+++ b/src/com/android/contacts/DialtactsActivity.java
@@ -16,6 +16,8 @@
 
 package com.android.contacts;
 
+import com.android.contacts.activities.ContactsFrontDoor;
+import com.android.contacts.activities.ContactBrowserActivity;
 import com.android.internal.telephony.ITelephony;
 
 import android.app.Activity;
@@ -44,6 +46,10 @@
     private static final String FAVORITES_ENTRY_COMPONENT =
             "com.android.contacts.DialtactsFavoritesEntryActivity";
 
+    /** Opens the Contacts app in the state the user has last set it to */
+    private static final String CONTACTS_LAUNCH_ACTIVITY =
+            "com.android.contacts.ContactsLaunchActivity";
+
     private static final int TAB_INDEX_DIALER = 0;
     private static final int TAB_INDEX_CALL_LOG = 1;
     private static final int TAB_INDEX_CONTACTS = 2;
@@ -51,19 +57,32 @@
 
     static final String EXTRA_IGNORE_STATE = "ignore-state";
 
+    /** Name of the dialtacts shared preferences */
+    static final String PREFS_DIALTACTS = "dialtacts";
     /** If true, when handling the contacts intent the favorites tab will be shown instead */
-    private static final String PREF_FAVORITES_AS_CONTACTS = "favorites_as_contacts";
-    private static final boolean PREF_FAVORITES_AS_CONTACTS_DEFAULT = false;
+    static final String PREF_FAVORITES_AS_CONTACTS = "favorites_as_contacts";
+    static final boolean PREF_FAVORITES_AS_CONTACTS_DEFAULT = false;
+
+    /** Last manually selected tab index */
+    private static final String PREF_LAST_MANUALLY_SELECTED_TAB = "last_manually_selected_tab";
+    private static final int PREF_LAST_MANUALLY_SELECTED_TAB_DEFAULT = TAB_INDEX_DIALER;
 
     private TabHost mTabHost;
     private String mFilterText;
     private Uri mDialUri;
 
+    /**
+     * The index of the tab that has last been manually selected (the user clicked on a tab).
+     * This value does not keep track of programmatically set Tabs (e.g. Call Log after a Call)
+     */
+    private int mLastManuallySelectedTab;
+
     @Override
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
 
         final Intent intent = getIntent();
+        fixIntent(intent);
 
         requestWindowFeature(Window.FEATURE_NO_TITLE);
         setContentView(R.layout.dialer_activity);
@@ -77,9 +96,14 @@
         setupContactsTab();
         setupFavoritesTab();
 
+        // Load the last manually loaded tab
+        final SharedPreferences prefs = getSharedPreferences(PREFS_DIALTACTS, MODE_PRIVATE);
+        mLastManuallySelectedTab = prefs.getInt(PREF_LAST_MANUALLY_SELECTED_TAB,
+                PREF_LAST_MANUALLY_SELECTED_TAB_DEFAULT);
+
         setCurrentTab(intent);
 
-        if (intent.getAction().equals(UI.FILTER_CONTACTS_ACTION)
+        if (UI.FILTER_CONTACTS_ACTION.equals(intent.getAction())
                 && icicle == null) {
             setupFilterText(intent);
         }
@@ -91,19 +115,30 @@
 
         final int currentTabIndex = mTabHost.getCurrentTab();
         final SharedPreferences.Editor editor =
-                getSharedPreferences(StickyTabs.PREFERENCES_NAME, MODE_PRIVATE).edit();
+                getSharedPreferences(PREFS_DIALTACTS, MODE_PRIVATE).edit();
         if (currentTabIndex == TAB_INDEX_CONTACTS || currentTabIndex == TAB_INDEX_FAVORITES) {
             editor.putBoolean(PREF_FAVORITES_AS_CONTACTS, currentTabIndex == TAB_INDEX_FAVORITES);
         }
+        editor.putInt(PREF_LAST_MANUALLY_SELECTED_TAB, mLastManuallySelectedTab);
 
         editor.apply();
     }
 
+    private void fixIntent(Intent intent) {
+        // This should be cleaned up: the call key used to send an Intent
+        // that just said to go to the recent calls list.  It now sends this
+        // abstract action, but this class hasn't been rewritten to deal with it.
+        if (Intent.ACTION_CALL_BUTTON.equals(intent.getAction())) {
+            intent.setDataAndType(Calls.CONTENT_URI, Calls.CONTENT_TYPE);
+            intent.putExtra("call_key", true);
+            setIntent(intent);
+        }
+    }
+
     private void setupCallLogTab() {
         // Force the class since overriding tab entries doesn't work
         Intent intent = new Intent("com.android.phone.action.RECENT_CALLS");
         intent.setClass(this, RecentCallsListActivity.class);
-        StickyTabs.setTab(intent, TAB_INDEX_CALL_LOG);
 
         mTabHost.addTab(mTabHost.newTabSpec("call_log")
                 .setIndicator(getString(R.string.recentCallsIconLabel),
@@ -114,7 +149,6 @@
     private void setupDialerTab() {
         Intent intent = new Intent("com.android.phone.action.TOUCH_DIALER");
         intent.setClass(this, TwelveKeyDialer.class);
-        StickyTabs.setTab(intent, TAB_INDEX_DIALER);
 
         mTabHost.addTab(mTabHost.newTabSpec("dialer")
                 .setIndicator(getString(R.string.dialerIconLabel),
@@ -124,8 +158,7 @@
 
     private void setupContactsTab() {
         Intent intent = new Intent(UI.LIST_DEFAULT);
-        intent.setClass(this, ContactsListActivity.class);
-        StickyTabs.setTab(intent, TAB_INDEX_CONTACTS);
+        intent.setClass(this, ContactBrowserActivity.class);
 
         mTabHost.addTab(mTabHost.newTabSpec("contacts")
                 .setIndicator(getText(R.string.contactsIconLabel),
@@ -135,8 +168,7 @@
 
     private void setupFavoritesTab() {
         Intent intent = new Intent(UI.LIST_STREQUENT_ACTION);
-        intent.setClass(this, ContactsListActivity.class);
-        StickyTabs.setTab(intent, TAB_INDEX_FAVORITES);
+        intent.setClass(this, ContactBrowserActivity.class);
 
         mTabHost.addTab(mTabHost.newTabSpec("favorites")
                 .setIndicator(getString(R.string.contactsFavoritesLabel),
@@ -145,11 +177,43 @@
     }
 
     /**
+     * Returns true if the intent is due to hitting the green send key while in a call.
+     *
+     * @param intent the intent that launched this activity
+     * @param recentCallsRequest true if the intent is requesting to view recent calls
+     * @return true if the intent is due to hitting the green send key while in a call
+     */
+    private boolean isSendKeyWhileInCall(final Intent intent, final boolean recentCallsRequest) {
+        // If there is a call in progress go to the call screen
+        if (recentCallsRequest) {
+            final boolean callKey = intent.getBooleanExtra("call_key", false);
+
+            try {
+                ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
+                if (callKey && phone != null && phone.showCallScreen()) {
+                    return true;
+                }
+            } catch (RemoteException e) {
+                Log.e(TAG, "Failed to handle send while in call", e);
+            }
+        }
+
+        return false;
+    }
+
+    /**
      * Sets the current tab based on the intent's request type
      *
      * @param intent Intent that contains information about which tab should be selected
      */
     private void setCurrentTab(Intent intent) {
+        // If we got here by hitting send and we're in call forward along to the in-call activity
+        final boolean recentCallsRequest = Calls.CONTENT_TYPE.equals(intent.getType());
+        if (isSendKeyWhileInCall(intent, recentCallsRequest)) {
+            finish();
+            return;
+        }
+
         // Dismiss menu provided by any children activities
         Activity activity = getLocalActivityManager().
                 getActivity(mTabHost.getCurrentTabTag());
@@ -161,52 +225,58 @@
         // state and instead reload their state from the parent's intent
         intent.putExtra(EXTRA_IGNORE_STATE, true);
 
+        // Remember the old manually selected tab index so that it can be restored if it is
+        // overwritten by one of the programmatic tab selections
+        final int savedTabIndex = mLastManuallySelectedTab;
+
         // Choose the tab based on the inbound intent
-        String componentName = intent.getComponent().getClassName();
-        if (getClass().getName().equals(componentName)) {
-            if (phoneIsInUse()) {
-                // We are in a call, show the dialer tab (which allows going back to the call)
-                mTabHost.setCurrentTab(TAB_INDEX_DIALER);
-            } else if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
-                // launched from history (long-press home) --> nothing to change
-            } else if (isDialIntent(intent)) {
-                // The dialer was explicitly requested
-                mTabHost.setCurrentTab(TAB_INDEX_DIALER);
-            } else if (Calls.CONTENT_TYPE.equals(intent.getType())) {
-                // After a call, show the call log
-                mTabHost.setCurrentTab(TAB_INDEX_CALL_LOG);
-            } else {
-                // Load the last tab used to make a phone call. default to the dialer in
-                // first launch
-                mTabHost.setCurrentTab(StickyTabs.loadTab(this, TAB_INDEX_DIALER));
-            }
-        } else if (FAVORITES_ENTRY_COMPONENT.equals(componentName)) {
-            mTabHost.setCurrentTab(TAB_INDEX_FAVORITES);
+        if (intent.getBooleanExtra(ContactsFrontDoor.EXTRA_FRONT_DOOR, false)) {
+            // Launched through the contacts front door, set the proper contacts tab
+            setContactsTab();
         } else {
-            // Launched as "Contacts" --> Go either to favorites or contacts, whichever is more
-            // recent
-            final SharedPreferences prefs = getSharedPreferences(StickyTabs.PREFERENCES_NAME,
-                    MODE_PRIVATE);
-            final boolean favoritesAsContacts = prefs.getBoolean(PREF_FAVORITES_AS_CONTACTS,
-                    PREF_FAVORITES_AS_CONTACTS_DEFAULT);
-            if (favoritesAsContacts) {
+            // Not launched through the front door, look at the component to determine the tab
+            String componentName = intent.getComponent().getClassName();
+            if (getClass().getName().equals(componentName)) {
+                if (recentCallsRequest) {
+                    mTabHost.setCurrentTab(TAB_INDEX_CALL_LOG);
+                } else {
+                    mTabHost.setCurrentTab(TAB_INDEX_DIALER);
+                }
+            } else if (FAVORITES_ENTRY_COMPONENT.equals(componentName)) {
                 mTabHost.setCurrentTab(TAB_INDEX_FAVORITES);
+            } else if (CONTACTS_LAUNCH_ACTIVITY.equals(componentName)) {
+                mTabHost.setCurrentTab(mLastManuallySelectedTab);
             } else {
-                mTabHost.setCurrentTab(TAB_INDEX_CONTACTS);
+                setContactsTab();
             }
         }
 
+        // Restore to the previous manual selection
+        mLastManuallySelectedTab = savedTabIndex;
+
         // Tell the children activities that they should honor their saved states
         // instead of the state from the parent's intent
         intent.putExtra(EXTRA_IGNORE_STATE, false);
     }
 
+    private void setContactsTab() {
+        SharedPreferences prefs = getSharedPreferences(PREFS_DIALTACTS, MODE_PRIVATE);
+        boolean favoritesAsContacts = prefs.getBoolean(PREF_FAVORITES_AS_CONTACTS,
+                PREF_FAVORITES_AS_CONTACTS_DEFAULT);
+        if (favoritesAsContacts) {
+            mTabHost.setCurrentTab(TAB_INDEX_FAVORITES);
+        } else {
+            mTabHost.setCurrentTab(TAB_INDEX_CONTACTS);
+        }
+    }
+
     @Override
     public void onNewIntent(Intent newIntent) {
         setIntent(newIntent);
+        fixIntent(newIntent);
         setCurrentTab(newIntent);
         final String action = newIntent.getAction();
-        if (action.equals(UI.FILTER_CONTACTS_ACTION)) {
+        if (UI.FILTER_CONTACTS_ACTION.equals(action)) {
             setupFilterText(newIntent);
         } else if (isDialIntent(newIntent)) {
             setupDialUri(newIntent);
@@ -300,7 +370,6 @@
     }
 
     /** {@inheritDoc} */
-    @Override
     public void onTabChanged(String tabId) {
         // Because we're using Activities as our tab children, we trigger
         // onWindowFocusChanged() to let them know when they're active.  This may
@@ -310,20 +379,9 @@
         if (activity != null) {
             activity.onWindowFocusChanged(true);
         }
-    }
 
-    /**
-     * @return true if the phone is "in use", meaning that at least one line
-     *              is active (ie. off hook or ringing or dialing).
-     */
-    private boolean phoneIsInUse() {
-        boolean phoneInUse = false;
-        try {
-            ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
-            if (phone != null) phoneInUse = !phone.isIdle();
-        } catch (RemoteException e) {
-            Log.w(TAG, "phone.isIdle() failed", e);
-        }
-        return phoneInUse;
+        // Remember this tab index. This function is also called, if the tab is set automatically
+        // in which case the setter (setCurrentTab) has to set this to its old value afterwards
+        mLastManuallySelectedTab = mTabHost.getCurrentTab();
     }
 }
diff --git a/src/com/android/contacts/ExportVCardActivity.java b/src/com/android/contacts/ExportVCardActivity.java
deleted file mode 100644
index ceeecfc..0000000
--- a/src/com/android/contacts/ExportVCardActivity.java
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.res.Resources;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.PowerManager;
-import android.pim.vcard.VCardComposer;
-import android.pim.vcard.VCardConfig;
-import android.text.TextUtils;
-import android.util.Log;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Class for exporting vCard.
- *
- * Note that this Activity assumes that the instance is a "one-shot Activity", which will be
- * finished (with the method {@link Activity#finish()}) after the export and never reuse
- * any Dialog in the instance. So this code is careless about the management around managed
- * dialogs stuffs (like how onCreateDialog() is used).
- */
-public class ExportVCardActivity extends Activity {
-    private static final String LOG_TAG = "ExportVCardActivity";
-
-    // If true, VCardExporter is able to emits files longer than 8.3 format.
-    private static final boolean ALLOW_LONG_FILE_NAME = false;
-    private String mTargetDirectory;
-    private String mFileNamePrefix;
-    private String mFileNameSuffix;
-    private int mFileIndexMinimum;
-    private int mFileIndexMaximum;
-    private String mFileNameExtension;
-    private String mVCardTypeStr;
-    private Set<String> mExtensionsToConsider;
-
-    private ProgressDialog mProgressDialog;
-    private String mExportingFileName;
-
-    private Handler mHandler = new Handler();
-
-    // Used temporaly when asking users to confirm the file name
-    private String mTargetFileName;
-
-    // String for storing error reason temporaly.
-    private String mErrorReason;
-
-    private ActualExportThread mActualExportThread;
-
-    private class CancelListener
-            implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener {
-        public void onClick(DialogInterface dialog, int which) {
-            finish();
-        }
-        public void onCancel(DialogInterface dialog) {
-            finish();
-        }
-    }
-
-    private CancelListener mCancelListener = new CancelListener();
-
-    private class ErrorReasonDisplayer implements Runnable {
-        private final int mResId;
-        public ErrorReasonDisplayer(int resId) {
-            mResId = resId;
-        }
-        public ErrorReasonDisplayer(String errorReason) {
-            mResId = R.id.dialog_fail_to_export_with_reason;
-            mErrorReason = errorReason;
-        }
-        public void run() {
-            // Show the Dialog only when the parent Activity is still alive.
-            if (!ExportVCardActivity.this.isFinishing()) {
-                showDialog(mResId);
-            }
-        }
-    }
-
-    private class ExportConfirmationListener implements DialogInterface.OnClickListener {
-        private final String mFileName;
-
-        public ExportConfirmationListener(String fileName) {
-            mFileName = fileName;
-        }
-
-        public void onClick(DialogInterface dialog, int which) {
-            if (which == DialogInterface.BUTTON_POSITIVE) {
-                mActualExportThread = new ActualExportThread(mFileName);
-                showDialog(R.id.dialog_exporting_vcard);
-            }
-        }
-    }
-
-    private class ActualExportThread extends Thread
-            implements DialogInterface.OnCancelListener {
-        private PowerManager.WakeLock mWakeLock;
-        private boolean mCanceled = false;
-
-        public ActualExportThread(String fileName) {
-            mExportingFileName = fileName;
-            PowerManager powerManager = (PowerManager)getSystemService(Context.POWER_SERVICE);
-            mWakeLock = powerManager.newWakeLock(
-                    PowerManager.SCREEN_DIM_WAKE_LOCK |
-                    PowerManager.ON_AFTER_RELEASE, LOG_TAG);
-        }
-
-        @Override
-        public void run() {
-            boolean shouldCallFinish = true;
-            mWakeLock.acquire();
-            VCardComposer composer = null;
-            try {
-                OutputStream outputStream = null;
-                try {
-                    outputStream = new FileOutputStream(mExportingFileName);
-                } catch (FileNotFoundException e) {
-                    final String errorReason =
-                        getString(R.string.fail_reason_could_not_open_file,
-                                mExportingFileName, e.getMessage());
-                    shouldCallFinish = false;
-                    mHandler.post(new ErrorReasonDisplayer(errorReason));
-                    return;
-                }
-
-                // composer = new VCardComposer(ExportVCardActivity.this, mVCardTypeStr, true);
-                int vcardType = VCardConfig.VCARD_TYPE_V30_GENERIC;
-                composer = new VCardComposer(ExportVCardActivity.this, vcardType, true);
-
-                composer.addHandler(composer.new HandlerForOutputStream(outputStream));
-
-                if (!composer.init()) {
-                    final String errorReason = composer.getErrorReason();
-                    Log.e(LOG_TAG, "initialization of vCard composer failed: " + errorReason);
-                    final String translatedErrorReason =
-                            translateComposerError(errorReason);
-                    mHandler.post(new ErrorReasonDisplayer(
-                            getString(R.string.fail_reason_could_not_initialize_exporter,
-                                    translatedErrorReason)));
-                    shouldCallFinish = false;
-                    return;
-                }
-
-                int size = composer.getCount();
-
-                if (size == 0) {
-                    mHandler.post(new ErrorReasonDisplayer(
-                            getString(R.string.fail_reason_no_exportable_contact)));
-                    shouldCallFinish = false;
-                    return;
-                }
-
-                mProgressDialog.setProgressNumberFormat(
-                        getString(R.string.exporting_contact_list_progress));
-                mProgressDialog.setMax(size);
-                mProgressDialog.setProgress(0);
-
-                while (!composer.isAfterLast()) {
-                    if (mCanceled) {
-                        return;
-                    }
-                    if (!composer.createOneEntry()) {
-                        final String errorReason = composer.getErrorReason();
-                        Log.e(LOG_TAG, "Failed to read a contact: " + errorReason);
-                        final String translatedErrorReason =
-                            translateComposerError(errorReason);
-                        mHandler.post(new ErrorReasonDisplayer(
-                                getString(R.string.fail_reason_error_occurred_during_export,
-                                        translatedErrorReason)));
-                        shouldCallFinish = false;
-                        return;
-                    }
-                    mProgressDialog.incrementProgressBy(1);
-                }
-            } finally {
-                if (composer != null) {
-                    composer.terminate();
-                }
-                mWakeLock.release();
-                mProgressDialog.dismiss();
-                if (shouldCallFinish && !isFinishing()) {
-                    finish();
-                }
-            }
-        }
-
-        @Override
-        public void finalize() {
-            if (mWakeLock != null && mWakeLock.isHeld()) {
-                mWakeLock.release();
-            }
-        }
-
-        public void cancel() {
-            mCanceled = true;
-        }
-
-        public void onCancel(DialogInterface dialog) {
-            cancel();
-        }
-    }
-
-    private String translateComposerError(String errorMessage) {
-        Resources resources = getResources();
-        if (VCardComposer.FAILURE_REASON_FAILED_TO_GET_DATABASE_INFO.equals(errorMessage)) {
-            return resources.getString(R.string.composer_failed_to_get_database_infomation);
-        } else if (VCardComposer.FAILURE_REASON_NO_ENTRY.equals(errorMessage)) {
-            return resources.getString(R.string.composer_has_no_exportable_contact);
-        } else if (VCardComposer.FAILURE_REASON_NOT_INITIALIZED.equals(errorMessage)) {
-            return resources.getString(R.string.composer_not_initialized);
-        } else {
-            return errorMessage;
-        }
-    }
-
-    @Override
-    protected void onCreate(Bundle bundle) {
-        super.onCreate(bundle);
-
-        mTargetDirectory = getString(R.string.config_export_dir);
-        mFileNamePrefix = getString(R.string.config_export_file_prefix);
-        mFileNameSuffix = getString(R.string.config_export_file_suffix);
-        mFileNameExtension = getString(R.string.config_export_file_extension);
-        mVCardTypeStr = getString(R.string.config_export_vcard_type);
-
-        mExtensionsToConsider = new HashSet<String>();
-        mExtensionsToConsider.add(mFileNameExtension);
-
-        final String additionalExtensions =
-            getString(R.string.config_export_extensions_to_consider);
-        if (!TextUtils.isEmpty(additionalExtensions)) {
-            for (String extension : additionalExtensions.split(",")) {
-                String trimed = extension.trim();
-                if (trimed.length() > 0) {
-                    mExtensionsToConsider.add(trimed);
-                }
-            }
-        }
-
-        final Resources resources = getResources();
-        mFileIndexMinimum = resources.getInteger(R.integer.config_export_file_min_index);
-        mFileIndexMaximum = resources.getInteger(R.integer.config_export_file_max_index);
-
-        startExportVCardToSdCard();
-    }
-
-    @Override
-    protected Dialog onCreateDialog(int id) {
-        switch (id) {
-            case R.id.dialog_export_confirmation: {
-                return getExportConfirmationDialog();
-            }
-            case R.string.fail_reason_too_many_vcard: {
-                return new AlertDialog.Builder(this)
-                    .setTitle(R.string.exporting_contact_failed_title)
-                    .setMessage(getString(R.string.exporting_contact_failed_message,
-                                getString(R.string.fail_reason_too_many_vcard)))
-                                .setPositiveButton(android.R.string.ok, mCancelListener)
-                                .create();
-            }
-            case R.id.dialog_fail_to_export_with_reason: {
-                return getErrorDialogWithReason();
-            }
-            case R.id.dialog_sdcard_not_found: {
-                AlertDialog.Builder builder = new AlertDialog.Builder(this)
-                .setTitle(R.string.no_sdcard_title)
-                .setIcon(android.R.drawable.ic_dialog_alert)
-                .setMessage(R.string.no_sdcard_message)
-                .setPositiveButton(android.R.string.ok, mCancelListener);
-                return builder.create();
-            }
-            case R.id.dialog_exporting_vcard: {
-                if (mProgressDialog == null) {
-                    String title = getString(R.string.exporting_contact_list_title);
-                    String message = getString(R.string.exporting_contact_list_message,
-                            mExportingFileName);
-                    mProgressDialog = new ProgressDialog(ExportVCardActivity.this);
-                    mProgressDialog.setTitle(title);
-                    mProgressDialog.setMessage(message);
-                    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
-                    mProgressDialog.setOnCancelListener(mActualExportThread);
-                    mActualExportThread.start();
-                }
-                return mProgressDialog;
-            }
-        }
-        return super.onCreateDialog(id);
-    }
-
-    @Override
-    protected void onPrepareDialog(int id, Dialog dialog) {
-        if (id == R.id.dialog_fail_to_export_with_reason) {
-            ((AlertDialog)dialog).setMessage(getErrorReason());
-        } else if (id == R.id.dialog_export_confirmation) {
-            ((AlertDialog)dialog).setMessage(
-                    getString(R.string.confirm_export_message, mTargetFileName));
-        } else {
-            super.onPrepareDialog(id, dialog);
-        }
-    }
-
-    @Override
-    protected void onStop() {
-        super.onStop();
-        if (mActualExportThread != null) {
-            // The Activity is no longer visible. Stop the thread.
-            mActualExportThread.cancel();
-            mActualExportThread = null;
-        }
-
-        if (!isFinishing()) {
-            finish();
-        }
-    }
-
-    /**
-     * Tries to start exporting VCard. If there's no SDCard available,
-     * an error dialog is shown.
-     */
-    public void startExportVCardToSdCard() {
-        File targetDirectory = new File(mTargetDirectory);
-
-        if (!(targetDirectory.exists() &&
-                targetDirectory.isDirectory() &&
-                targetDirectory.canRead()) &&
-                !targetDirectory.mkdirs()) {
-            showDialog(R.id.dialog_sdcard_not_found);
-        } else {
-            mTargetFileName = getAppropriateFileName(mTargetDirectory);
-            if (TextUtils.isEmpty(mTargetFileName)) {
-                mTargetFileName = null;
-                // finish() is called via the error dialog. Do not call the method here.
-                return;
-            }
-
-            showDialog(R.id.dialog_export_confirmation);
-        }
-    }
-
-    /**
-     * Tries to get an appropriate filename. Returns null if it fails.
-     */
-    private String getAppropriateFileName(final String destDirectory) {
-        int fileNumberStringLength = 0;
-        {
-            // Calling Math.Log10() is costly.
-            int tmp;
-            for (fileNumberStringLength = 0, tmp = mFileIndexMaximum; tmp > 0;
-                fileNumberStringLength++, tmp /= 10) {
-            }
-        }
-        String bodyFormat = "%s%0" + fileNumberStringLength + "d%s";
-
-        if (!ALLOW_LONG_FILE_NAME) {
-            String possibleBody = String.format(bodyFormat,mFileNamePrefix, 1, mFileNameSuffix);
-            if (possibleBody.length() > 8 || mFileNameExtension.length() > 3) {
-                Log.e(LOG_TAG, "This code does not allow any long file name.");
-                mErrorReason = getString(R.string.fail_reason_too_long_filename,
-                        String.format("%s.%s", possibleBody, mFileNameExtension));
-                showDialog(R.id.dialog_fail_to_export_with_reason);
-                // finish() is called via the error dialog. Do not call the method here.
-                return null;
-            }
-        }
-
-        // Note that this logic assumes that the target directory is case insensitive.
-        // As of 2009-07-16, it is true since the external storage is only sdcard, and
-        // it is formated as FAT/VFAT.
-        // TODO: fix this.
-        for (int i = mFileIndexMinimum; i <= mFileIndexMaximum; i++) {
-            boolean numberIsAvailable = true;
-            // SD Association's specification seems to require this feature, though we cannot
-            // have the specification since it is proprietary...
-            String body = null;
-            for (String possibleExtension : mExtensionsToConsider) {
-                body = String.format(bodyFormat, mFileNamePrefix, i, mFileNameSuffix);
-                File file = new File(String.format("%s/%s.%s",
-                        destDirectory, body, possibleExtension));
-                if (file.exists()) {
-                    numberIsAvailable = false;
-                    break;
-                }
-            }
-            if (numberIsAvailable) {
-                return String.format("%s/%s.%s", destDirectory, body, mFileNameExtension);
-            }
-        }
-        showDialog(R.string.fail_reason_too_many_vcard);
-        return null;
-    }
-
-    public Dialog getExportConfirmationDialog() {
-        if (TextUtils.isEmpty(mTargetFileName)) {
-            Log.e(LOG_TAG, "Target file name is empty, which must not be!");
-            // This situation is not acceptable (probably a bug!), but we don't have no reason to
-            // show...
-            mErrorReason = null;
-            return getErrorDialogWithReason();
-        }
-
-        return new AlertDialog.Builder(this)
-            .setTitle(R.string.confirm_export_title)
-            .setMessage(getString(R.string.confirm_export_message, mTargetFileName))
-            .setPositiveButton(android.R.string.ok,
-                    new ExportConfirmationListener(mTargetFileName))
-            .setNegativeButton(android.R.string.cancel, mCancelListener)
-            .setOnCancelListener(mCancelListener)
-            .create();
-    }
-
-    public Dialog getErrorDialogWithReason() {
-        if (mErrorReason == null) {
-            Log.e(LOG_TAG, "Error reason must have been set.");
-            mErrorReason = getString(R.string.fail_reason_unknown);
-        }
-        return new AlertDialog.Builder(this)
-            .setTitle(R.string.exporting_contact_failed_title)
-                .setMessage(getString(R.string.exporting_contact_failed_message, mErrorReason))
-            .setPositiveButton(android.R.string.ok, mCancelListener)
-            .setOnCancelListener(mCancelListener)
-            .create();
-    }
-
-    public void cancelExport() {
-        if (mActualExportThread != null) {
-            mActualExportThread.cancel();
-            mActualExportThread = null;
-        }
-    }
-
-    public String getErrorReason() {
-        return mErrorReason;
-    }
-}
\ No newline at end of file
diff --git a/src/com/android/contacts/GroupingListAdapter.java b/src/com/android/contacts/GroupingListAdapter.java
deleted file mode 100644
index 5937a6d..0000000
--- a/src/com/android/contacts/GroupingListAdapter.java
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.contacts;
-
-import com.android.internal.util.ArrayUtils;
-
-import android.content.Context;
-import android.database.ContentObserver;
-import android.database.Cursor;
-import android.database.DataSetObserver;
-import android.os.Handler;
-import android.util.SparseIntArray;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-
-/**
- * Maintains a list that groups adjacent items sharing the same value of
- * a "group-by" field.  The list has three types of elements: stand-alone, group header and group
- * child. Groups are collapsible and collapsed by default.
- */
-public abstract class GroupingListAdapter extends BaseAdapter {
-
-    private static final int GROUP_METADATA_ARRAY_INITIAL_SIZE = 16;
-    private static final int GROUP_METADATA_ARRAY_INCREMENT = 128;
-    private static final long GROUP_OFFSET_MASK    = 0x00000000FFFFFFFFL;
-    private static final long GROUP_SIZE_MASK     = 0x7FFFFFFF00000000L;
-    private static final long EXPANDED_GROUP_MASK = 0x8000000000000000L;
-
-    public static final int ITEM_TYPE_STANDALONE = 0;
-    public static final int ITEM_TYPE_GROUP_HEADER = 1;
-    public static final int ITEM_TYPE_IN_GROUP = 2;
-
-    /**
-     * Information about a specific list item: is it a group, if so is it expanded.
-     * Otherwise, is it a stand-alone item or a group member.
-     */
-    protected static class PositionMetadata {
-        int itemType;
-        boolean isExpanded;
-        int cursorPosition;
-        int childCount;
-        private int groupPosition;
-        private int listPosition = -1;
-    }
-
-    private Context mContext;
-    private Cursor mCursor;
-
-    /**
-     * Count of list items.
-     */
-    private int mCount;
-
-    private int mRowIdColumnIndex;
-
-    /**
-     * Count of groups in the list.
-     */
-    private int mGroupCount;
-
-    /**
-     * Information about where these groups are located in the list, how large they are
-     * and whether they are expanded.
-     */
-    private long[] mGroupMetadata;
-
-    private SparseIntArray mPositionCache = new SparseIntArray();
-    private int mLastCachedListPosition;
-    private int mLastCachedCursorPosition;
-    private int mLastCachedGroup;
-
-    /**
-     * A reusable temporary instance of PositionMetadata
-     */
-    private PositionMetadata mPositionMetadata = new PositionMetadata();
-
-    protected ContentObserver mChangeObserver = new ContentObserver(new Handler()) {
-
-        @Override
-        public boolean deliverSelfNotifications() {
-            return true;
-        }
-
-        @Override
-        public void onChange(boolean selfChange) {
-            onContentChanged();
-        }
-    };
-
-    protected DataSetObserver mDataSetObserver = new DataSetObserver() {
-
-        @Override
-        public void onChanged() {
-            notifyDataSetChanged();
-        }
-
-        @Override
-        public void onInvalidated() {
-            notifyDataSetInvalidated();
-        }
-    };
-
-    public GroupingListAdapter(Context context) {
-        mContext = context;
-        resetCache();
-    }
-
-    /**
-     * Finds all groups of adjacent items in the cursor and calls {@link #addGroup} for
-     * each of them.
-     */
-    protected abstract void addGroups(Cursor cursor);
-
-    protected abstract View newStandAloneView(Context context, ViewGroup parent);
-    protected abstract void bindStandAloneView(View view, Context context, Cursor cursor);
-
-    protected abstract View newGroupView(Context context, ViewGroup parent);
-    protected abstract void bindGroupView(View view, Context context, Cursor cursor, int groupSize,
-            boolean expanded);
-
-    protected abstract View newChildView(Context context, ViewGroup parent);
-    protected abstract void bindChildView(View view, Context context, Cursor cursor);
-
-    /**
-     * Cache should be reset whenever the cursor changes or groups are expanded or collapsed.
-     */
-    private void resetCache() {
-        mCount = -1;
-        mLastCachedListPosition = -1;
-        mLastCachedCursorPosition = -1;
-        mLastCachedGroup = -1;
-        mPositionMetadata.listPosition = -1;
-        mPositionCache.clear();
-    }
-
-    protected void onContentChanged() {
-    }
-
-    public void changeCursor(Cursor cursor) {
-        if (cursor == mCursor) {
-            return;
-        }
-
-        if (mCursor != null) {
-            mCursor.unregisterContentObserver(mChangeObserver);
-            mCursor.unregisterDataSetObserver(mDataSetObserver);
-            mCursor.close();
-        }
-        mCursor = cursor;
-        resetCache();
-        findGroups();
-
-        if (cursor != null) {
-            cursor.registerContentObserver(mChangeObserver);
-            cursor.registerDataSetObserver(mDataSetObserver);
-            mRowIdColumnIndex = cursor.getColumnIndexOrThrow("_id");
-            notifyDataSetChanged();
-        } else {
-            // notify the observers about the lack of a data set
-            notifyDataSetInvalidated();
-        }
-
-    }
-
-    public Cursor getCursor() {
-        return mCursor;
-    }
-
-    /**
-     * Scans over the entire cursor looking for duplicate phone numbers that need
-     * to be collapsed.
-     */
-    private void findGroups() {
-        mGroupCount = 0;
-        mGroupMetadata = new long[GROUP_METADATA_ARRAY_INITIAL_SIZE];
-
-        if (mCursor == null) {
-            return;
-        }
-
-        addGroups(mCursor);
-    }
-
-    /**
-     * Records information about grouping in the list.  Should be called by the overridden
-     * {@link #addGroups} method.
-     */
-    protected void addGroup(int cursorPosition, int size, boolean expanded) {
-        if (mGroupCount >= mGroupMetadata.length) {
-            int newSize = ArrayUtils.idealLongArraySize(
-                    mGroupMetadata.length + GROUP_METADATA_ARRAY_INCREMENT);
-            long[] array = new long[newSize];
-            System.arraycopy(mGroupMetadata, 0, array, 0, mGroupCount);
-            mGroupMetadata = array;
-        }
-
-        long metadata = ((long)size << 32) | cursorPosition;
-        if (expanded) {
-            metadata |= EXPANDED_GROUP_MASK;
-        }
-        mGroupMetadata[mGroupCount++] = metadata;
-    }
-
-    public int getCount() {
-        if (mCursor == null) {
-            return 0;
-        }
-
-        if (mCount != -1) {
-            return mCount;
-        }
-
-        int cursorPosition = 0;
-        int count = 0;
-        for (int i = 0; i < mGroupCount; i++) {
-            long metadata = mGroupMetadata[i];
-            int offset = (int)(metadata & GROUP_OFFSET_MASK);
-            boolean expanded = (metadata & EXPANDED_GROUP_MASK) != 0;
-            int size = (int)((metadata & GROUP_SIZE_MASK) >> 32);
-
-            count += (offset - cursorPosition);
-
-            if (expanded) {
-                count += size + 1;
-            } else {
-                count++;
-            }
-
-            cursorPosition = offset + size;
-        }
-
-        mCount = count + mCursor.getCount() - cursorPosition;
-        return mCount;
-    }
-
-    /**
-     * Figures out whether the item at the specified position represents a
-     * stand-alone element, a group or a group child. Also computes the
-     * corresponding cursor position.
-     */
-    public void obtainPositionMetadata(PositionMetadata metadata, int position) {
-
-        // If the description object already contains requested information, just return
-        if (metadata.listPosition == position) {
-            return;
-        }
-
-        int listPosition = 0;
-        int cursorPosition = 0;
-        int firstGroupToCheck = 0;
-
-        // Check cache for the supplied position.  What we are looking for is
-        // the group descriptor immediately preceding the supplied position.
-        // Once we have that, we will be able to tell whether the position
-        // is the header of the group, a member of the group or a standalone item.
-        if (mLastCachedListPosition != -1) {
-            if (position <= mLastCachedListPosition) {
-
-                // Have SparceIntArray do a binary search for us.
-                int index = mPositionCache.indexOfKey(position);
-
-                // If we get back a positive number, the position corresponds to
-                // a group header.
-                if (index < 0) {
-
-                    // We had a cache miss, but we did obtain valuable information anyway.
-                    // The negative number will allow us to compute the location of
-                    // the group header immediately preceding the supplied position.
-                    index = ~index - 1;
-
-                    if (index >= mPositionCache.size()) {
-                        index--;
-                    }
-                }
-
-                // A non-negative index gives us the position of the group header
-                // corresponding or preceding the position, so we can
-                // search for the group information at the supplied position
-                // starting with the cached group we just found
-                if (index >= 0) {
-                    listPosition = mPositionCache.keyAt(index);
-                    firstGroupToCheck = mPositionCache.valueAt(index);
-                    long descriptor = mGroupMetadata[firstGroupToCheck];
-                    cursorPosition = (int)(descriptor & GROUP_OFFSET_MASK);
-                }
-            } else {
-
-                // If we haven't examined groups beyond the supplied position,
-                // we will start where we left off previously
-                firstGroupToCheck = mLastCachedGroup;
-                listPosition = mLastCachedListPosition;
-                cursorPosition = mLastCachedCursorPosition;
-            }
-        }
-
-        for (int i = firstGroupToCheck; i < mGroupCount; i++) {
-            long group = mGroupMetadata[i];
-            int offset = (int)(group & GROUP_OFFSET_MASK);
-
-            // Move pointers to the beginning of the group
-            listPosition += (offset - cursorPosition);
-            cursorPosition = offset;
-
-            if (i > mLastCachedGroup) {
-                mPositionCache.append(listPosition, i);
-                mLastCachedListPosition = listPosition;
-                mLastCachedCursorPosition = cursorPosition;
-                mLastCachedGroup = i;
-            }
-
-            // Now we have several possibilities:
-            // A) The requested position precedes the group
-            if (position < listPosition) {
-                metadata.itemType = ITEM_TYPE_STANDALONE;
-                metadata.cursorPosition = cursorPosition - (listPosition - position);
-                return;
-            }
-
-            boolean expanded = (group & EXPANDED_GROUP_MASK) != 0;
-            int size = (int) ((group & GROUP_SIZE_MASK) >> 32);
-
-            // B) The requested position is a group header
-            if (position == listPosition) {
-                metadata.itemType = ITEM_TYPE_GROUP_HEADER;
-                metadata.groupPosition = i;
-                metadata.isExpanded = expanded;
-                metadata.childCount = size;
-                metadata.cursorPosition = offset;
-                return;
-            }
-
-            if (expanded) {
-                // C) The requested position is an element in the expanded group
-                if (position < listPosition + size + 1) {
-                    metadata.itemType = ITEM_TYPE_IN_GROUP;
-                    metadata.cursorPosition = cursorPosition + (position - listPosition) - 1;
-                    return;
-                }
-
-                // D) The element is past the expanded group
-                listPosition += size + 1;
-            } else {
-
-                // E) The element is past the collapsed group
-                listPosition++;
-            }
-
-            // Move cursor past the group
-            cursorPosition += size;
-        }
-
-        // The required item is past the last group
-        metadata.itemType = ITEM_TYPE_STANDALONE;
-        metadata.cursorPosition = cursorPosition + (position - listPosition);
-    }
-
-    /**
-     * Returns true if the specified position in the list corresponds to a
-     * group header.
-     */
-    public boolean isGroupHeader(int position) {
-        obtainPositionMetadata(mPositionMetadata, position);
-        return mPositionMetadata.itemType == ITEM_TYPE_GROUP_HEADER;
-    }
-
-    /**
-     * Given a position of a groups header in the list, returns the size of
-     * the corresponding group.
-     */
-    public int getGroupSize(int position) {
-        obtainPositionMetadata(mPositionMetadata, position);
-        return mPositionMetadata.childCount;
-    }
-
-    /**
-     * Mark group as expanded if it is collapsed and vice versa.
-     */
-    public void toggleGroup(int position) {
-        obtainPositionMetadata(mPositionMetadata, position);
-        if (mPositionMetadata.itemType != ITEM_TYPE_GROUP_HEADER) {
-            throw new IllegalArgumentException("Not a group at position " + position);
-        }
-
-
-        if (mPositionMetadata.isExpanded) {
-            mGroupMetadata[mPositionMetadata.groupPosition] &= ~EXPANDED_GROUP_MASK;
-        } else {
-            mGroupMetadata[mPositionMetadata.groupPosition] |= EXPANDED_GROUP_MASK;
-        }
-        resetCache();
-        notifyDataSetChanged();
-    }
-
-    @Override
-    public int getViewTypeCount() {
-        return 3;
-    }
-
-    @Override
-    public int getItemViewType(int position) {
-        obtainPositionMetadata(mPositionMetadata, position);
-        return mPositionMetadata.itemType;
-    }
-
-    public Object getItem(int position) {
-        if (mCursor == null) {
-            return null;
-        }
-
-        obtainPositionMetadata(mPositionMetadata, position);
-        if (mCursor.moveToPosition(mPositionMetadata.cursorPosition)) {
-            return mCursor;
-        } else {
-            return null;
-        }
-    }
-
-    public long getItemId(int position) {
-        Object item = getItem(position);
-        if (item != null) {
-            return mCursor.getLong(mRowIdColumnIndex);
-        } else {
-            return -1;
-        }
-    }
-
-    public View getView(int position, View convertView, ViewGroup parent) {
-        obtainPositionMetadata(mPositionMetadata, position);
-        View view = convertView;
-        if (view == null) {
-            switch (mPositionMetadata.itemType) {
-                case ITEM_TYPE_STANDALONE:
-                    view = newStandAloneView(mContext, parent);
-                    break;
-                case ITEM_TYPE_GROUP_HEADER:
-                    view = newGroupView(mContext, parent);
-                    break;
-                case ITEM_TYPE_IN_GROUP:
-                    view = newChildView(mContext, parent);
-                    break;
-            }
-        }
-
-        mCursor.moveToPosition(mPositionMetadata.cursorPosition);
-        switch (mPositionMetadata.itemType) {
-            case ITEM_TYPE_STANDALONE:
-                bindStandAloneView(view, mContext, mCursor);
-                break;
-            case ITEM_TYPE_GROUP_HEADER:
-                bindGroupView(view, mContext, mCursor, mPositionMetadata.childCount,
-                        mPositionMetadata.isExpanded);
-                break;
-            case ITEM_TYPE_IN_GROUP:
-                bindChildView(view, mContext, mCursor);
-                break;
-
-        }
-        return view;
-    }
-}
diff --git a/src/com/android/contacts/ImportVCardActivity.java b/src/com/android/contacts/ImportVCardActivity.java
deleted file mode 100644
index 46cdf32..0000000
--- a/src/com/android/contacts/ImportVCardActivity.java
+++ /dev/null
@@ -1,1002 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts;
-
-import com.android.contacts.model.Sources;
-import com.android.contacts.util.AccountSelectionUtil;
-
-import android.accounts.Account;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ProgressDialog;
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnCancelListener;
-import android.content.DialogInterface.OnClickListener;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.Handler;
-import android.os.PowerManager;
-import android.pim.vcard.VCardConfig;
-import android.pim.vcard.VCardEntryCommitter;
-import android.pim.vcard.VCardEntryConstructor;
-import android.pim.vcard.VCardEntryCounter;
-import android.pim.vcard.VCardInterpreter;
-import android.pim.vcard.VCardInterpreterCollection;
-import android.pim.vcard.VCardParser;
-import android.pim.vcard.VCardParser_V21;
-import android.pim.vcard.VCardParser_V30;
-import android.pim.vcard.VCardSourceDetector;
-import android.pim.vcard.exception.VCardException;
-import android.pim.vcard.exception.VCardNestedException;
-import android.pim.vcard.exception.VCardNotSupportedException;
-import android.pim.vcard.exception.VCardVersionException;
-import android.provider.ContactsContract.RawContacts;
-import android.text.SpannableStringBuilder;
-import android.text.Spanned;
-import android.text.TextUtils;
-import android.text.style.RelativeSizeSpan;
-import android.util.Log;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-import java.util.Vector;
-
-class VCardFile {
-    private String mName;
-    private String mCanonicalPath;
-    private long mLastModified;
-
-    public VCardFile(String name, String canonicalPath, long lastModified) {
-        mName = name;
-        mCanonicalPath = canonicalPath;
-        mLastModified = lastModified;
-    }
-
-    public String getName() {
-        return mName;
-    }
-
-    public String getCanonicalPath() {
-        return mCanonicalPath;
-    }
-
-    public long getLastModified() {
-        return mLastModified;
-    }
-}
-
-/**
- * Class for importing vCard. Several user interaction will be required while reading
- * (selecting a file, waiting a moment, etc.)
- *
- * Note that this Activity assumes that the instance is a "one-shot Activity", which will be
- * finished (with the method {@link Activity#finish()}) after the import and never reuse
- * any Dialog in the instance. So this code is careless about the management around managed
- * dialogs stuffs (like how onCreateDialog() is used).
- */
-public class ImportVCardActivity extends Activity {
-    private static final String LOG_TAG = "ImportVCardActivity";
-    private static final boolean DO_PERFORMANCE_PROFILE = false;
-
-    private final static int VCARD_VERSION_V21 = 1;
-    private final static int VCARD_VERSION_V30 = 2;
-    private final static int VCARD_VERSION_V40 = 3;
-
-    // Run on the UI thread. Must not be null except after onDestroy().
-    private Handler mHandler = new Handler();
-
-    private AccountSelectionUtil.AccountSelectedListener mAccountSelectionListener;
-    private Account mAccount;
-
-    private ProgressDialog mProgressDialogForScanVCard;
-
-    private List<VCardFile> mAllVCardFileList;
-    private VCardScanThread mVCardScanThread;
-    private VCardReadThread mVCardReadThread;
-    private ProgressDialog mProgressDialogForReadVCard;
-
-    private String mErrorMessage;
-
-    private boolean mNeedReview = false;
-
-    // Runs on the UI thread.
-    private class DialogDisplayer implements Runnable {
-        private final int mResId;
-        public DialogDisplayer(int resId) {
-            mResId = resId;
-        }
-        public DialogDisplayer(String errorMessage) {
-            mResId = R.id.dialog_error_with_message;
-            mErrorMessage = errorMessage;
-        }
-        public void run() {
-            showDialog(mResId);
-        }
-    }
-
-    private class CancelListener
-        implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener {
-        public void onClick(DialogInterface dialog, int which) {
-            finish();
-        }
-
-        public void onCancel(DialogInterface dialog) {
-            finish();
-        }
-    }
-
-    private CancelListener mCancelListener = new CancelListener();
-
-    private class VCardReadThread extends Thread
-            implements DialogInterface.OnCancelListener {
-        private ContentResolver mResolver;
-        private VCardParser mVCardParser;
-        private boolean mCanceled;
-        private PowerManager.WakeLock mWakeLock;
-        private Uri mUri;
-        private File mTempFile;
-
-        private List<VCardFile> mSelectedVCardFileList;
-        private List<String> mErrorFileNameList;
-
-        public VCardReadThread(Uri uri) {
-            mUri = uri;
-            init();
-        }
-
-        public VCardReadThread(final List<VCardFile> selectedVCardFileList) {
-            mSelectedVCardFileList = selectedVCardFileList;
-            mErrorFileNameList = new ArrayList<String>();
-            init();
-        }
-
-        private void init() {
-            Context context = ImportVCardActivity.this;
-            mResolver = context.getContentResolver();
-            PowerManager powerManager = (PowerManager)context.getSystemService(
-                    Context.POWER_SERVICE);
-            mWakeLock = powerManager.newWakeLock(
-                    PowerManager.SCREEN_DIM_WAKE_LOCK |
-                    PowerManager.ON_AFTER_RELEASE, LOG_TAG);
-        }
-
-        @Override
-        public void finalize() {
-            if (mWakeLock != null && mWakeLock.isHeld()) {
-                mWakeLock.release();
-            }
-        }
-
-        @Override
-        public void run() {
-            boolean shouldCallFinish = true;
-            mWakeLock.acquire();
-            Uri createdUri = null;
-            mTempFile = null;
-            // Some malicious vCard data may make this thread broken
-            // (e.g. OutOfMemoryError).
-            // Even in such cases, some should be done.
-            try {
-                if (mUri != null) {  // Read one vCard expressed by mUri
-                    final Uri targetUri = mUri;
-                    mProgressDialogForReadVCard.setProgressNumberFormat("");
-                    mProgressDialogForReadVCard.setProgress(0);
-
-                    // Count the number of VCard entries
-                    mProgressDialogForReadVCard.setIndeterminate(true);
-                    long start;
-                    if (DO_PERFORMANCE_PROFILE) {
-                        start = System.currentTimeMillis();
-                    }
-                    final VCardEntryCounter counter = new VCardEntryCounter();
-                    final VCardSourceDetector detector = new VCardSourceDetector();
-                    final VCardInterpreterCollection builderCollection =
-                            new VCardInterpreterCollection(Arrays.asList(counter, detector));
-                    boolean result;
-                    try {
-                        // We don't know which type should be useld to parse the Uri.
-                        // It is possble to misinterpret the vCard, but we expect the parser
-                        // lets VCardSourceDetector detect the type before the misinterpretation.
-                        result = readOneVCardFile(targetUri, VCardConfig.VCARD_TYPE_UNKNOWN,
-                                builderCollection, true, null);
-                    } catch (VCardNestedException e) {
-                        try {
-                            final int estimatedVCardType = detector.getEstimatedType();
-                            final String estimatedCharset = detector.getEstimatedCharset();
-                            // Assume that VCardSourceDetector was able to detect the source.
-                            // Try again with the detector.
-                            result = readOneVCardFile(targetUri, estimatedVCardType,
-                                    counter, false, null);
-                        } catch (VCardNestedException e2) {
-                            result = false;
-                            Log.e(LOG_TAG, "Must not reach here. " + e2);
-                        }
-                    }
-                    if (DO_PERFORMANCE_PROFILE) {
-                        long time = System.currentTimeMillis() - start;
-                        Log.d(LOG_TAG, "time for counting the number of vCard entries: " +
-                                time + " ms");
-                    }
-                    if (!result) {
-                        shouldCallFinish = false;
-                        return;
-                    }
-
-                    mProgressDialogForReadVCard.setProgressNumberFormat(
-                            getString(R.string.reading_vcard_contacts));
-                    mProgressDialogForReadVCard.setIndeterminate(false);
-                    mProgressDialogForReadVCard.setMax(counter.getCount());
-                    String charset = detector.getEstimatedCharset();
-                    createdUri = doActuallyReadOneVCard(targetUri, mAccount, true, detector,
-                            mErrorFileNameList);
-                } else {  // Read multiple files.
-                    mProgressDialogForReadVCard.setProgressNumberFormat(
-                            getString(R.string.reading_vcard_files));
-                    mProgressDialogForReadVCard.setMax(mSelectedVCardFileList.size());
-                    mProgressDialogForReadVCard.setProgress(0);
-
-                    for (VCardFile vcardFile : mSelectedVCardFileList) {
-                        if (mCanceled) {
-                            return;
-                        }
-                        // TODO: detect scheme!
-                        final Uri targetUri = Uri.parse("file://" + vcardFile.getCanonicalPath());
-                        VCardSourceDetector detector = new VCardSourceDetector();
-                        try {
-                            if (!readOneVCardFile(targetUri, VCardConfig.VCARD_TYPE_UNKNOWN,
-                                    detector, true, mErrorFileNameList)) {
-                                continue;
-                            }
-                        } catch (VCardNestedException e) {
-                            // Assume that VCardSourceDetector was able to detect the source.
-                        }
-                        String charset = detector.getEstimatedCharset();
-                        doActuallyReadOneVCard(targetUri, mAccount,
-                                false, detector, mErrorFileNameList);
-                        mProgressDialogForReadVCard.incrementProgressBy(1);
-                    }
-                }
-            } finally {
-                mWakeLock.release();
-                mProgressDialogForReadVCard.dismiss();
-                if (mTempFile != null) {
-                    if (!mTempFile.delete()) {
-                        Log.w(LOG_TAG, "Failed to delete a cache file.");
-                    }
-                    mTempFile = null;
-                }
-                // finish() is called via mCancelListener, which is used in DialogDisplayer.
-                if (shouldCallFinish && !isFinishing()) {
-                    if (mErrorFileNameList == null || mErrorFileNameList.isEmpty()) {
-                        finish();
-                        if (mNeedReview) {
-                            mNeedReview = false;
-                            Log.v("importVCardActivity", "Prepare to review the imported contact");
-
-                            if (createdUri != null) {
-                                // get contact_id of this raw_contact
-                                final long rawContactId = ContentUris.parseId(createdUri);
-                                Uri contactUri = RawContacts.getContactLookupUri(
-                                        getContentResolver(), ContentUris.withAppendedId(
-                                                RawContacts.CONTENT_URI, rawContactId));
-
-                                Intent viewIntent = new Intent(Intent.ACTION_VIEW, contactUri);
-                                startActivity(viewIntent);
-                            }
-                        }
-                    } else {
-                        StringBuilder builder = new StringBuilder();
-                        boolean first = true;
-                        for (String fileName : mErrorFileNameList) {
-                            if (first) {
-                                first = false;
-                            } else {
-                                builder.append(", ");
-                            }
-                            builder.append(fileName);
-                        }
-
-                        runOnUIThread(new DialogDisplayer(
-                                getString(R.string.fail_reason_failed_to_read_files,
-                                        builder.toString())));
-                    }
-                }
-            }
-        }
-
-        private Uri doActuallyReadOneVCard(Uri uri, Account account,
-                boolean showEntryParseProgress,
-                VCardSourceDetector detector, List<String> errorFileNameList) {
-            final Context context = ImportVCardActivity.this;
-            int vcardType = detector.getEstimatedType();
-            if (vcardType == VCardConfig.VCARD_TYPE_UNKNOWN) {
-                vcardType = VCardConfig.getVCardTypeFromString(
-                        context.getString(R.string.config_import_vcard_type));
-            }
-            final String estimatedCharset = detector.getEstimatedCharset();
-            final String currentLanguage = Locale.getDefault().getLanguage();
-            VCardEntryConstructor builder;
-            builder = new VCardEntryConstructor(vcardType, mAccount, estimatedCharset);
-            final VCardEntryCommitter committer = new VCardEntryCommitter(mResolver);
-            builder.addEntryHandler(committer);
-            if (showEntryParseProgress) {
-                builder.addEntryHandler(new ProgressShower(mProgressDialogForReadVCard,
-                        context.getString(R.string.reading_vcard_message),
-                        ImportVCardActivity.this,
-                        mHandler));
-            }
-
-            try {
-                if (!readOneVCardFile(uri, vcardType, builder, false, null)) {
-                    return null;
-                }
-            } catch (VCardNestedException e) {
-                Log.e(LOG_TAG, "Never reach here.");
-            }
-            final ArrayList<Uri> createdUris = committer.getCreatedUris();
-            return (createdUris == null || createdUris.size() != 1) ? null : createdUris.get(0);
-        }
-
-        /**
-         * Charset should be handled by {@link VCardEntryConstructor}. 
-         */
-        private boolean readOneVCardFile(Uri uri, int vcardType,
-                VCardInterpreter interpreter,
-                boolean throwNestedException, List<String> errorFileNameList)
-                throws VCardNestedException {
-            InputStream is;
-            try {
-                is = mResolver.openInputStream(uri);
-                mVCardParser = new VCardParser_V21(vcardType);
-
-                try {
-                    mVCardParser.parse(is, interpreter);
-                } catch (VCardVersionException e1) {
-                    try {
-                        is.close();
-                    } catch (IOException e) {
-                    }
-                    if (interpreter instanceof VCardEntryConstructor) {
-                        // Let the object clean up internal temporal objects,
-                        ((VCardEntryConstructor)interpreter).clear();
-                    } else if (interpreter instanceof VCardInterpreterCollection) {
-                        for (VCardInterpreter elem :
-                            ((VCardInterpreterCollection) interpreter).getCollection()) {
-                            if (elem instanceof VCardEntryConstructor) {
-                                ((VCardEntryConstructor)elem).clear();
-                            }
-                        }
-                    }
-
-                    is = mResolver.openInputStream(uri);
-
-                    try {
-                        mVCardParser = new VCardParser_V30(vcardType);
-                        mVCardParser.parse(is, interpreter);
-                    } catch (VCardVersionException e2) {
-                        throw new VCardException("vCard with unspported version.");
-                    }
-                } finally {
-                    if (is != null) {
-                        try {
-                            is.close();
-                        } catch (IOException e) {
-                        }
-                    }
-                }
-            } catch (IOException e) {
-                Log.e(LOG_TAG, "IOException was emitted: " + e.getMessage());
-
-                mProgressDialogForReadVCard.dismiss();
-
-                if (errorFileNameList != null) {
-                    errorFileNameList.add(uri.toString());
-                } else {
-                    runOnUIThread(new DialogDisplayer(
-                            getString(R.string.fail_reason_io_error) +
-                                    ": " + e.getLocalizedMessage()));
-                }
-                return false;
-            } catch (VCardNotSupportedException e) {
-                if ((e instanceof VCardNestedException) && throwNestedException) {
-                    throw (VCardNestedException)e;
-                }
-                if (errorFileNameList != null) {
-                    errorFileNameList.add(uri.toString());
-                } else {
-                    runOnUIThread(new DialogDisplayer(
-                            getString(R.string.fail_reason_vcard_not_supported_error) +
-                            " (" + e.getMessage() + ")"));
-                }
-                return false;
-            } catch (VCardException e) {
-                if (errorFileNameList != null) {
-                    errorFileNameList.add(uri.toString());
-                } else {
-                    runOnUIThread(new DialogDisplayer(
-                            getString(R.string.fail_reason_vcard_parse_error) +
-                            " (" + e.getMessage() + ")"));
-                }
-                return false;
-            }
-            return true;
-        }
-
-        public void cancel() {
-            mCanceled = true;
-            if (mVCardParser != null) {
-                mVCardParser.cancel();
-            }
-        }
-
-        public void onCancel(DialogInterface dialog) {
-            cancel();
-        }
-    }
-
-    private class ImportTypeSelectedListener implements
-            DialogInterface.OnClickListener {
-        public static final int IMPORT_ONE = 0;
-        public static final int IMPORT_MULTIPLE = 1;
-        public static final int IMPORT_ALL = 2;
-        public static final int IMPORT_TYPE_SIZE = 3;
-
-        private int mCurrentIndex;
-
-        public void onClick(DialogInterface dialog, int which) {
-            if (which == DialogInterface.BUTTON_POSITIVE) {
-                switch (mCurrentIndex) {
-                case IMPORT_ALL:
-                    importMultipleVCardFromSDCard(mAllVCardFileList);
-                    break;
-                case IMPORT_MULTIPLE:
-                    showDialog(R.id.dialog_select_multiple_vcard);
-                    break;
-                default:
-                    showDialog(R.id.dialog_select_one_vcard);
-                    break;
-                }
-            } else if (which == DialogInterface.BUTTON_NEGATIVE) {
-                finish();
-            } else {
-                mCurrentIndex = which;
-            }
-        }
-    }
-
-    private class VCardSelectedListener implements
-            DialogInterface.OnClickListener, DialogInterface.OnMultiChoiceClickListener {
-        private int mCurrentIndex;
-        private Set<Integer> mSelectedIndexSet;
-
-        public VCardSelectedListener(boolean multipleSelect) {
-            mCurrentIndex = 0;
-            if (multipleSelect) {
-                mSelectedIndexSet = new HashSet<Integer>();
-            }
-        }
-
-        public void onClick(DialogInterface dialog, int which) {
-            if (which == DialogInterface.BUTTON_POSITIVE) {
-                if (mSelectedIndexSet != null) {
-                    List<VCardFile> selectedVCardFileList = new ArrayList<VCardFile>();
-                    int size = mAllVCardFileList.size();
-                    // We'd like to sort the files by its index, so we do not use Set iterator.
-                    for (int i = 0; i < size; i++) {
-                        if (mSelectedIndexSet.contains(i)) {
-                            selectedVCardFileList.add(mAllVCardFileList.get(i));
-                        }
-                    }
-                    importMultipleVCardFromSDCard(selectedVCardFileList);
-                } else {
-                    String canonicalPath = mAllVCardFileList.get(mCurrentIndex).getCanonicalPath();
-                    final Uri uri = Uri.parse("file://" + canonicalPath);
-                    importOneVCardFromSDCard(uri);
-                }
-            } else if (which == DialogInterface.BUTTON_NEGATIVE) {
-                finish();
-            } else {
-                // Some file is selected.
-                mCurrentIndex = which;
-                if (mSelectedIndexSet != null) {
-                    if (mSelectedIndexSet.contains(which)) {
-                        mSelectedIndexSet.remove(which);
-                    } else {
-                        mSelectedIndexSet.add(which);
-                    }
-                }
-            }
-        }
-
-        public void onClick(DialogInterface dialog, int which, boolean isChecked) {
-            if (mSelectedIndexSet == null || (mSelectedIndexSet.contains(which) == isChecked)) {
-                Log.e(LOG_TAG, String.format("Inconsist state in index %d (%s)", which,
-                        mAllVCardFileList.get(which).getCanonicalPath()));
-            } else {
-                onClick(dialog, which);
-            }
-        }
-    }
-
-    /**
-     * Thread scanning VCard from SDCard. After scanning, the dialog which lets a user select
-     * a vCard file is shown. After the choice, VCardReadThread starts running.
-     */
-    private class VCardScanThread extends Thread implements OnCancelListener, OnClickListener {
-        private boolean mCanceled;
-        private boolean mGotIOException;
-        private File mRootDirectory;
-
-        // To avoid recursive link.
-        private Set<String> mCheckedPaths;
-        private PowerManager.WakeLock mWakeLock;
-
-        private class CanceledException extends Exception {
-        }
-
-        public VCardScanThread(File sdcardDirectory) {
-            mCanceled = false;
-            mGotIOException = false;
-            mRootDirectory = sdcardDirectory;
-            mCheckedPaths = new HashSet<String>();
-            PowerManager powerManager = (PowerManager)ImportVCardActivity.this.getSystemService(
-                    Context.POWER_SERVICE);
-            mWakeLock = powerManager.newWakeLock(
-                    PowerManager.SCREEN_DIM_WAKE_LOCK |
-                    PowerManager.ON_AFTER_RELEASE, LOG_TAG);
-        }
-
-        @Override
-        public void run() {
-            mAllVCardFileList = new Vector<VCardFile>();
-            try {
-                mWakeLock.acquire();
-                getVCardFileRecursively(mRootDirectory);
-            } catch (CanceledException e) {
-                mCanceled = true;
-            } catch (IOException e) {
-                mGotIOException = true;
-            } finally {
-                mWakeLock.release();
-            }
-
-            if (mCanceled) {
-                mAllVCardFileList = null;
-            }
-
-            mProgressDialogForScanVCard.dismiss();
-            mProgressDialogForScanVCard = null;
-
-            if (mGotIOException) {
-                runOnUIThread(new DialogDisplayer(R.id.dialog_io_exception));
-            } else if (mCanceled) {
-                finish();
-            } else {
-                int size = mAllVCardFileList.size();
-                final Context context = ImportVCardActivity.this;
-                if (size == 0) {
-                    runOnUIThread(new DialogDisplayer(R.id.dialog_vcard_not_found));
-                } else {
-                    startVCardSelectAndImport();
-                }
-            }
-        }
-
-        private void getVCardFileRecursively(File directory)
-                throws CanceledException, IOException {
-            if (mCanceled) {
-                throw new CanceledException();
-            }
-
-            // e.g. secured directory may return null toward listFiles().
-            final File[] files = directory.listFiles();
-            if (files == null) {
-                Log.w(LOG_TAG, "listFiles() returned null (directory: " + directory + ")");
-                return;
-            }
-            for (File file : directory.listFiles()) {
-                if (mCanceled) {
-                    throw new CanceledException();
-                }
-                String canonicalPath = file.getCanonicalPath();
-                if (mCheckedPaths.contains(canonicalPath)) {
-                    continue;
-                }
-
-                mCheckedPaths.add(canonicalPath);
-
-                if (file.isDirectory()) {
-                    getVCardFileRecursively(file);
-                } else if (canonicalPath.toLowerCase().endsWith(".vcf") &&
-                        file.canRead()){
-                    String fileName = file.getName();
-                    VCardFile vcardFile = new VCardFile(
-                            fileName, canonicalPath, file.lastModified());
-                    mAllVCardFileList.add(vcardFile);
-                }
-            }
-        }
-
-        public void onCancel(DialogInterface dialog) {
-            mCanceled = true;
-        }
-
-        public void onClick(DialogInterface dialog, int which) {
-            if (which == DialogInterface.BUTTON_NEGATIVE) {
-                mCanceled = true;
-            }
-        }
-    }
-
-    private void startVCardSelectAndImport() {
-        int size = mAllVCardFileList.size();
-        if (getResources().getBoolean(R.bool.config_import_all_vcard_from_sdcard_automatically)) {
-            importMultipleVCardFromSDCard(mAllVCardFileList);
-        } else if (size == 1) {
-            String canonicalPath = mAllVCardFileList.get(0).getCanonicalPath();
-            Uri uri = Uri.parse("file://" + canonicalPath);
-            importOneVCardFromSDCard(uri);
-        } else if (getResources().getBoolean(R.bool.config_allow_users_select_all_vcard_import)) {
-            runOnUIThread(new DialogDisplayer(R.id.dialog_select_import_type));
-        } else {
-            runOnUIThread(new DialogDisplayer(R.id.dialog_select_one_vcard));
-        }
-    }
-
-    private void importMultipleVCardFromSDCard(final List<VCardFile> selectedVCardFileList) {
-        runOnUIThread(new Runnable() {
-            public void run() {
-                mVCardReadThread = new VCardReadThread(selectedVCardFileList);
-                showDialog(R.id.dialog_reading_vcard);
-            }
-        });
-    }
-
-    private void importOneVCardFromSDCard(final Uri uri) {
-        runOnUIThread(new Runnable() {
-            public void run() {
-                mVCardReadThread = new VCardReadThread(uri);
-                showDialog(R.id.dialog_reading_vcard);
-            }
-        });
-    }
-
-    private Dialog getSelectImportTypeDialog() {
-        DialogInterface.OnClickListener listener =
-            new ImportTypeSelectedListener();
-        AlertDialog.Builder builder = new AlertDialog.Builder(this)
-            .setTitle(R.string.select_vcard_title)
-            .setPositiveButton(android.R.string.ok, listener)
-            .setOnCancelListener(mCancelListener)
-            .setNegativeButton(android.R.string.cancel, mCancelListener);
-
-        String[] items = new String[ImportTypeSelectedListener.IMPORT_TYPE_SIZE];
-        items[ImportTypeSelectedListener.IMPORT_ONE] =
-            getString(R.string.import_one_vcard_string);
-        items[ImportTypeSelectedListener.IMPORT_MULTIPLE] =
-            getString(R.string.import_multiple_vcard_string);
-        items[ImportTypeSelectedListener.IMPORT_ALL] =
-            getString(R.string.import_all_vcard_string);
-        builder.setSingleChoiceItems(items, ImportTypeSelectedListener.IMPORT_ONE, listener);
-        return builder.create();
-    }
-
-    private Dialog getVCardFileSelectDialog(boolean multipleSelect) {
-        int size = mAllVCardFileList.size();
-        VCardSelectedListener listener = new VCardSelectedListener(multipleSelect);
-        AlertDialog.Builder builder =
-            new AlertDialog.Builder(this)
-                .setTitle(R.string.select_vcard_title)
-                .setPositiveButton(android.R.string.ok, listener)
-                .setOnCancelListener(mCancelListener)
-                .setNegativeButton(android.R.string.cancel, mCancelListener);
-
-        CharSequence[] items = new CharSequence[size];
-        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        for (int i = 0; i < size; i++) {
-            VCardFile vcardFile = mAllVCardFileList.get(i);
-            SpannableStringBuilder stringBuilder = new SpannableStringBuilder();
-            stringBuilder.append(vcardFile.getName());
-            stringBuilder.append('\n');
-            int indexToBeSpanned = stringBuilder.length();
-            // Smaller date text looks better, since each file name becomes easier to read.
-            // The value set to RelativeSizeSpan is arbitrary. You can change it to any other
-            // value (but the value bigger than 1.0f would not make nice appearance :)
-            stringBuilder.append(
-                        "(" + dateFormat.format(new Date(vcardFile.getLastModified())) + ")");
-            stringBuilder.setSpan(
-                    new RelativeSizeSpan(0.7f), indexToBeSpanned, stringBuilder.length(),
-                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
-            items[i] = stringBuilder;
-        }
-        if (multipleSelect) {
-            builder.setMultiChoiceItems(items, (boolean[])null, listener);
-        } else {
-            builder.setSingleChoiceItems(items, 0, listener);
-        }
-        return builder.create();
-    }
-
-    @Override
-    protected void onCreate(Bundle bundle) {
-        super.onCreate(bundle);
-
-        final Intent intent = getIntent();
-        if (intent != null) {
-            final String accountName = intent.getStringExtra("account_name");
-            final String accountType = intent.getStringExtra("account_type");
-            if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(accountType)) {
-                mAccount = new Account(accountName, accountType);
-            }
-        } else {
-            Log.e(LOG_TAG, "intent does not exist");
-        }
-
-        // The caller often does not know account information at all, so we show the UI instead.
-        if (mAccount == null) {
-            // There's three possibilities:
-            // - more than one accounts -> ask the user
-            // - just one account -> use the account without asking the user
-            // - no account -> use phone-local storage without asking the user
-            final Sources sources = Sources.getInstance(this);
-            final List<Account> accountList = sources.getAccounts(true);
-            final int size = accountList.size();
-            if (size > 1) {
-                final int resId = R.string.import_from_sdcard;
-                mAccountSelectionListener =
-                    new AccountSelectionUtil.AccountSelectedListener(
-                            this, accountList, resId) {
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-                        dialog.dismiss();
-                        mAccount = mAccountList.get(which);
-                        // Instead of using Intent mechanism, call the relevant private method,
-                        // to avoid throwing an Intent to itself again.
-                        startImport();
-                    }
-                };
-                showDialog(resId);
-                return;
-            } else {
-                mAccount = size > 0 ? accountList.get(0) : null;
-            }
-        }
-
-        startImport();
-    }
-
-    private void startImport() {
-        Intent intent = getIntent();
-        final String action = intent.getAction();
-        final Uri uri = intent.getData();
-        Log.v(LOG_TAG, "action = " + action + " ; path = " + uri);
-        if (Intent.ACTION_VIEW.equals(action)) {
-            // Import the file directly and then go to EDIT screen
-            mNeedReview = true;
-        }
-
-        if (uri != null) {
-            importOneVCardFromSDCard(uri);
-        } else {
-            doScanExternalStorageAndImportVCard();
-        }
-    }
-
-    @Override
-    protected Dialog onCreateDialog(int resId) {
-        switch (resId) {
-            case R.string.import_from_sdcard: {
-                if (mAccountSelectionListener == null) {
-                    throw new NullPointerException(
-                            "mAccountSelectionListener must not be null.");
-                }
-                return AccountSelectionUtil.getSelectAccountDialog(this, resId,
-                        mAccountSelectionListener,
-                        new CancelListener());
-            }
-            case R.id.dialog_searching_vcard: {
-                if (mProgressDialogForScanVCard == null) {
-                    String title = getString(R.string.searching_vcard_title);
-                    String message = getString(R.string.searching_vcard_message);
-                    mProgressDialogForScanVCard =
-                        ProgressDialog.show(this, title, message, true, false);
-                    mProgressDialogForScanVCard.setOnCancelListener(mVCardScanThread);
-                    mVCardScanThread.start();
-                }
-                return mProgressDialogForScanVCard;
-            }
-            case R.id.dialog_sdcard_not_found: {
-                AlertDialog.Builder builder = new AlertDialog.Builder(this)
-                    .setTitle(R.string.no_sdcard_title)
-                    .setIcon(android.R.drawable.ic_dialog_alert)
-                    .setMessage(R.string.no_sdcard_message)
-                    .setOnCancelListener(mCancelListener)
-                    .setPositiveButton(android.R.string.ok, mCancelListener);
-                return builder.create();
-            }
-            case R.id.dialog_vcard_not_found: {
-                String message = (getString(R.string.scanning_sdcard_failed_message,
-                        getString(R.string.fail_reason_no_vcard_file)));
-                AlertDialog.Builder builder = new AlertDialog.Builder(this)
-                    .setTitle(R.string.scanning_sdcard_failed_title)
-                    .setMessage(message)
-                    .setOnCancelListener(mCancelListener)
-                    .setPositiveButton(android.R.string.ok, mCancelListener);
-                return builder.create();
-            }
-            case R.id.dialog_select_import_type: {
-                return getSelectImportTypeDialog();
-            }
-            case R.id.dialog_select_multiple_vcard: {
-                return getVCardFileSelectDialog(true);
-            }
-            case R.id.dialog_select_one_vcard: {
-                return getVCardFileSelectDialog(false);
-            }
-            case R.id.dialog_reading_vcard: {
-                if (mProgressDialogForReadVCard == null) {
-                    String title = getString(R.string.reading_vcard_title);
-                    String message = getString(R.string.reading_vcard_message);
-                    mProgressDialogForReadVCard = new ProgressDialog(this);
-                    mProgressDialogForReadVCard.setTitle(title);
-                    mProgressDialogForReadVCard.setMessage(message);
-                    mProgressDialogForReadVCard.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
-                    mProgressDialogForReadVCard.setOnCancelListener(mVCardReadThread);
-                    mVCardReadThread.start();
-                }
-                return mProgressDialogForReadVCard;
-            }
-            case R.id.dialog_io_exception: {
-                String message = (getString(R.string.scanning_sdcard_failed_message,
-                        getString(R.string.fail_reason_io_error)));
-                AlertDialog.Builder builder = new AlertDialog.Builder(this)
-                    .setTitle(R.string.scanning_sdcard_failed_title)
-                    .setIcon(android.R.drawable.ic_dialog_alert)
-                    .setMessage(message)
-                    .setOnCancelListener(mCancelListener)
-                    .setPositiveButton(android.R.string.ok, mCancelListener);
-                return builder.create();
-            }
-            case R.id.dialog_error_with_message: {
-                String message = mErrorMessage;
-                if (TextUtils.isEmpty(message)) {
-                    Log.e(LOG_TAG, "Error message is null while it must not.");
-                    message = getString(R.string.fail_reason_unknown);
-                }
-                AlertDialog.Builder builder = new AlertDialog.Builder(this)
-                    .setTitle(getString(R.string.reading_vcard_failed_title))
-                    .setIcon(android.R.drawable.ic_dialog_alert)
-                    .setMessage(message)
-                    .setOnCancelListener(mCancelListener)
-                    .setPositiveButton(android.R.string.ok, mCancelListener);
-                return builder.create();
-            }
-        }
-
-        return super.onCreateDialog(resId);
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        if (mVCardReadThread != null) {
-            // The Activity is no longer visible. Stop the thread.
-            mVCardReadThread.cancel();
-            mVCardReadThread = null;
-        }
-
-        // ImportVCardActivity should not be persistent. In other words, if there's some
-        // event calling onPause(), this Activity should finish its work and give the main
-        // screen back to the caller Activity.
-        if (!isFinishing()) {
-            finish();
-        }
-    }
-
-    @Override
-    protected void onDestroy() {
-        // The code assumes the handler runs on the UI thread. If not,
-        // clearing the message queue is not enough, one would have to
-        // make sure that the handler does not run any callback when
-        // this activity isFinishing().
-
-        // Need to make sure any worker thread is done before we flush and
-        // nullify the message handler.
-        if (mVCardReadThread != null) {
-            Log.w(LOG_TAG, "VCardReadThread exists while this Activity is now being killed!");
-            mVCardReadThread.cancel();
-            int attempts = 0;
-            while (mVCardReadThread.isAlive() && attempts < 10) {
-                try {
-                    Thread.currentThread().sleep(20);
-                } catch (InterruptedException ie) {
-                    // Keep on going until max attempts is reached.
-                }
-                attempts++;
-            }
-            if (mVCardReadThread.isAlive()) {
-                // Find out why the thread did not exit in a timely
-                // fashion. Last resort: increase the sleep duration
-                // and/or the number of attempts.
-                Log.e(LOG_TAG, "VCardReadThread is still alive after max attempts.");
-            }
-            mVCardReadThread = null;
-        }
-
-        // Callbacks messages have what == 0.
-        if (mHandler.hasMessages(0)) {
-            mHandler.removeMessages(0);
-        }
-
-        mHandler = null;  // Prevents memory leaks by breaking any circular dependency.
-        super.onDestroy();
-    }
-
-    /**
-     * Tries to run a given Runnable object when the UI thread can. Ignore it otherwise
-     */
-    private void runOnUIThread(Runnable runnable) {
-        if (mHandler == null) {
-            Log.w(LOG_TAG, "Handler object is null. No dialog is shown.");
-        } else {
-            mHandler.post(runnable);
-        }
-    }
-
-    @Override
-    public void finalize() {
-        // TODO: This should not be needed. Throw exception instead.
-        if (mVCardReadThread != null) {
-            // Not sure this procedure is really needed, but just in case...
-            Log.e(LOG_TAG, "VCardReadThread exists while this Activity is now being killed!");
-            mVCardReadThread.cancel();
-            mVCardReadThread = null;
-        }
-    }
-
-    /**
-     * Scans vCard in external storage (typically SDCard) and tries to import it.
-     * - When there's no SDCard available, an error dialog is shown.
-     * - When multiple vCard files are available, asks a user to select one.
-     */
-    private void doScanExternalStorageAndImportVCard() {
-        // TODO: should use getExternalStorageState().
-        final File file = Environment.getExternalStorageDirectory();
-        if (!file.exists() || !file.isDirectory() || !file.canRead()) {
-            showDialog(R.id.dialog_sdcard_not_found);
-        } else {
-            mVCardScanThread = new VCardScanThread(file);
-            showDialog(R.id.dialog_searching_vcard);
-        }
-    }
-}
diff --git a/src/com/android/contacts/JoinContactActivity.java b/src/com/android/contacts/JoinContactActivity.java
new file mode 100644
index 0000000..ea48763
--- /dev/null
+++ b/src/com/android/contacts/JoinContactActivity.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2009 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.contacts;
+
+
+import com.android.contacts.list.ContactEntryListFragment;
+import com.android.contacts.list.JoinContactListFragment;
+import com.android.contacts.list.OnContactPickerActionListener;
+
+import android.app.Activity;
+import android.app.FragmentTransaction;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+
+/**
+ * An activity that shows a list of contacts that can be joined with the target contact.
+ */
+public class JoinContactActivity extends Activity {
+
+    private static final String TAG = "JoinContactActivity";
+
+    /**
+     * The action for the join contact activity.
+     * <p>
+     * Input: extra field {@link #EXTRA_TARGET_CONTACT_ID} is the aggregate ID.
+     * TODO: move to {@link ContactsContract}.
+     */
+    public static final String JOIN_CONTACT = "com.android.contacts.action.JOIN_CONTACT";
+
+    /**
+     * Used with {@link #JOIN_CONTACT} to give it the target for aggregation.
+     * <p>
+     * Type: LONG
+     */
+    public static final String EXTRA_TARGET_CONTACT_ID = "com.android.contacts.action.CONTACT_ID";
+
+    private long mTargetContactId;
+
+    private JoinContactListFragment mListFragment;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        Intent intent = getIntent();
+        mTargetContactId = intent.getLongExtra(EXTRA_TARGET_CONTACT_ID, -1);
+        if (mTargetContactId == -1) {
+            Log.e(TAG, "Intent " + intent.getAction() + " is missing required extra: "
+                    + EXTRA_TARGET_CONTACT_ID);
+            setResult(RESULT_CANCELED);
+            finish();
+            return;
+        }
+
+        mListFragment = new JoinContactListFragment();
+        mListFragment.setTargetContactId(mTargetContactId);
+        mListFragment.setOnContactPickerActionListener(new OnContactPickerActionListener() {
+            public void onPickContactAction(Uri contactUri) {
+                Intent intent = new Intent(null, contactUri);
+                setResult(RESULT_OK, intent);
+                finish();
+            }
+
+            public void onSearchAllContactsAction(String string) {
+            }
+
+            public void onShortcutIntentCreated(Intent intent) {
+            }
+
+            public void onCreateNewContactAction() {
+            }
+        });
+
+        FragmentTransaction transaction = getFragmentManager().openTransaction();
+        transaction.add(android.R.id.content, mListFragment);
+        transaction.commit();
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        MenuInflater inflater = getMenuInflater();
+        inflater.inflate(R.menu.search, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.menu_search: {
+                onSearchRequested();
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
+            boolean globalSearch) {
+        if (globalSearch) {
+            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+        } else {
+            mListFragment.startSearch(initialQuery);
+        }
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == ContactEntryListFragment.ACTIVITY_REQUEST_CODE_PICKER
+                && resultCode == RESULT_OK) {
+            mListFragment.onPickerResult(data);
+        }
+    }
+}
diff --git a/src/com/android/contacts/MultiplePhonePickerActivity.java b/src/com/android/contacts/MultiplePhonePickerActivity.java
new file mode 100644
index 0000000..572b4de
--- /dev/null
+++ b/src/com/android/contacts/MultiplePhonePickerActivity.java
@@ -0,0 +1,226 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts;
+
+import com.android.contacts.list.MultiplePhonePickerFragment;
+import com.android.contacts.list.OnMultiplePhoneNumberPickerActionListener;
+
+import android.app.Activity;
+import android.app.FragmentTransaction;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.provider.ContactsContract.Intents;
+import android.view.Menu;
+import android.view.MenuInflater;
+
+/**
+ * Displays of phone numbers and allows selection of multiple numbers.
+ */
+public class MultiplePhonePickerActivity extends Activity {
+
+    /**
+     * Display only selected recipients or not in MODE_PICK_MULTIPLE_PHONES mode
+     */
+    private boolean mShowSelectedOnly = false;
+
+    private MultiplePhonePickerFragment mListFragment;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        mListFragment = new MultiplePhonePickerFragment();
+        mListFragment.setOnMultiplePhoneNumberPickerActionListener(
+                new OnMultiplePhoneNumberPickerActionListener() {
+
+            public void onPhoneNumbersSelectedAction(Uri[] dataUris) {
+                returnActivityResult(dataUris);
+            }
+
+            public void onFinishAction() {
+                finish();
+            }
+        });
+
+        Parcelable[] extras = getIntent().getParcelableArrayExtra(Intents.EXTRA_PHONE_URIS);
+        mListFragment.setSelectedUris(extras);
+        FragmentTransaction transaction = getFragmentManager().openTransaction();
+        transaction.add(android.R.id.content, mListFragment);
+        transaction.commit();
+    }
+
+    @Override
+    public void onBackPressed() {
+        returnActivityResult(mListFragment.getSelectedUris());
+        super.onBackPressed();
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle icicle) {
+        super.onSaveInstanceState(icicle);
+        mListFragment.onSaveInstanceState(icicle);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+
+        final MenuInflater inflater = getMenuInflater();
+        inflater.inflate(R.menu.pick, menu);
+        return true;
+    }
+
+    /*
+    @Override
+    public boolean onPrepareOptionsMenu(Menu menu) {
+        if (mShowSelectedOnly) {
+            menu.findItem(R.id.menu_display_selected).setVisible(false);
+            menu.findItem(R.id.menu_display_all).setVisible(true);
+            menu.findItem(R.id.menu_select_all).setVisible(false);
+            menu.findItem(R.id.menu_select_none).setVisible(false);
+            return true;
+        }
+        menu.findItem(R.id.menu_display_all).setVisible(false);
+        menu.findItem(R.id.menu_display_selected).setVisible(true);
+        if (mUserSelection.isAllSelected()) {
+            menu.findItem(R.id.menu_select_all).setVisible(false);
+            menu.findItem(R.id.menu_select_none).setVisible(true);
+        } else {
+            menu.findItem(R.id.menu_select_all).setVisible(true);
+            menu.findItem(R.id.menu_select_none).setVisible(false);
+        }
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.menu_select_all: {
+                mUserSelection.setAllPhonesSelected(true);
+                checkAll(true);
+                updateWidgets(true);
+                return true;
+            }
+            case R.id.menu_select_none: {
+                mUserSelection.setAllPhonesSelected(false);
+                checkAll(false);
+                updateWidgets(true);
+                return true;
+            }
+            case R.id.menu_display_selected: {
+                mShowSelectedOnly = true;
+                startQuery();
+                return true;
+            }
+            case R.id.menu_display_all: {
+                mShowSelectedOnly = false;
+                startQuery();
+                return true;
+            }
+        }
+        return super.onOptionsItemSelected(item);
+    }
+*/
+    @Override
+    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
+            boolean globalSearch) {
+        // TODO
+//        if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
+//            return;
+//        }
+//
+//        if (globalSearch) {
+//            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+//        } else {
+//            if (!mSearchMode && (mMode & MODE_MASK_NO_FILTER) == 0) {
+//                if ((mMode & MODE_MASK_PICKER) != 0) {
+//                    Bundle extras = getIntent().getExtras();
+//                    if (extras == null) {
+//                        extras = new Bundle();
+//                    }
+//                    mUserSelection.fillSelectionForSearchMode(extras);
+//                    ContactsSearchManager.startSearchForResult(this, initialQuery,
+//                            SUBACTIVITY_FILTER, extras);
+//                } else {
+//                    ContactsSearchManager.startSearch(this, initialQuery);
+//                }
+//            }
+//        }
+    }
+
+//    @Override
+//    protected void startQuery(Uri uri, String[] projection) {
+//        // Filter unknown phone numbers first.
+//        mPhoneNumberAdapter.doFilter(null, mShowSelectedOnly);
+//        if (mShowSelectedOnly) {
+//            StringBuilder idSetBuilder = new StringBuilder();
+//            Iterator<Long> itr = mUserSelection.getSelectedPhonIds();
+//            if (itr.hasNext()) {
+//                idSetBuilder.append(Long.toString(itr.next()));
+//            }
+//            while (itr.hasNext()) {
+//                idSetBuilder.append(',');
+//                idSetBuilder.append(Long.toString(itr.next()));
+//            }
+//            String whereClause = Phone._ID + " IN (" + idSetBuilder.toString() + ")";
+//            mQueryHandler.startQuery(QUERY_TOKEN, null, uri, projection, whereClause, null,
+//                    getSortOrder(projection));
+//        } else {
+//            mQueryHandler.startQuery(QUERY_TOKEN, null, uri,
+//                    projection, CLAUSE_ONLY_VISIBLE, null, getSortOrder(projection));
+//        }
+//    }
+
+//    @Override
+//    public Cursor doFilter(String filter) {
+//        String[] projection = getProjectionForQuery();
+//        if (mSearchMode && TextUtils.isEmpty(mListFragment.getQueryString())) {
+//            return new MatrixCursor(projection);
+//        }
+//
+//        final ContentResolver resolver = getContentResolver();
+//        // Filter phone numbers as well.
+//        mPhoneNumberAdapter.doFilter(filter, mShowSelectedOnly);
+//
+//        Uri uri = getUriToQuery();
+//        if (!TextUtils.isEmpty(filter)) {
+//            uri = Uri.withAppendedPath(Phone.CONTENT_FILTER_URI, Uri.encode(filter));
+//        }
+//        return resolver.query(uri, projection, CLAUSE_ONLY_VISIBLE, null, getSortOrder(projection));
+//    }
+
+    public void returnActivityResult(Uri[] dataUris) {
+        Intent intent = new Intent();
+        intent.putExtra(Intents.EXTRA_PHONE_URIS, dataUris);
+        setResult(RESULT_OK, intent);
+        finish();
+    }
+
+    private void checkAll(boolean checked) {
+        // TODO fix this. It should iterate over the cursor rather than the views in the list.
+        /*
+        final ListView listView = getListView();
+        int childCount = listView.getChildCount();
+        for (int i = 0; i < childCount; i++) {
+            final ContactListItemView child = (ContactListItemView)listView.getChildAt(i);
+            child.getCheckBoxView().setChecked(checked);
+        }
+        */
+    }
+}
diff --git a/src/com/android/contacts/PhoneDisambigDialog.java b/src/com/android/contacts/PhoneDisambigDialog.java
deleted file mode 100644
index 3e3d534..0000000
--- a/src/com/android/contacts/PhoneDisambigDialog.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts;
-
-import com.android.contacts.Collapser.Collapsible;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Sources;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.StringInflater;
-
-import android.app.AlertDialog;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.database.Cursor;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.telephony.PhoneNumberUtils;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
-import android.widget.ListAdapter;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Class used for displaying a dialog with a list of phone numbers of which
- * one will be chosen to make a call or initiate an sms message.
- */
-public class PhoneDisambigDialog implements DialogInterface.OnClickListener,
-        DialogInterface.OnDismissListener, CompoundButton.OnCheckedChangeListener{
-
-    private boolean mMakePrimary = false;
-    private Context mContext;
-    private AlertDialog mDialog;
-    private boolean mSendSms;
-    private int mStickyTab;
-    private Cursor mPhonesCursor;
-    private ListAdapter mPhonesAdapter;
-    private ArrayList<PhoneItem> mPhoneItemList;
-
-    public PhoneDisambigDialog(Context context, Cursor phonesCursor, boolean sendSms,
-            int stickyTab) {
-        mContext = context;
-        mSendSms = sendSms;
-        mPhonesCursor = phonesCursor;
-        mStickyTab = stickyTab;
-
-        mPhoneItemList = makePhoneItemsList(phonesCursor);
-        Collapser.collapseList(mPhoneItemList);
-
-        mPhonesAdapter = new PhonesAdapter(mContext, mPhoneItemList, mSendSms);
-
-        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
-                Context.LAYOUT_INFLATER_SERVICE);
-        View setPrimaryView = inflater.
-                inflate(R.layout.set_primary_checkbox, null);
-        ((CheckBox) setPrimaryView.findViewById(R.id.setPrimary)).
-                setOnCheckedChangeListener(this);
-
-        // Need to show disambig dialogue.
-        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(mContext).
-                setAdapter(mPhonesAdapter, this).
-                        setTitle(sendSms ?
-                                R.string.sms_disambig_title : R.string.call_disambig_title).
-                        setView(setPrimaryView);
-
-        mDialog = dialogBuilder.create();
-    }
-
-    /**
-     * Show the dialog.
-     */
-    public void show() {
-        if (mPhoneItemList.size() == 1) {
-            // If there is only one after collapse, just select it, and close;
-            onClick(mDialog, 0);
-            return;
-        }
-        mDialog.show();
-    }
-
-    public void onClick(DialogInterface dialog, int which) {
-        if (mPhoneItemList.size() > which && which >= 0) {
-            PhoneItem phoneItem = mPhoneItemList.get(which);
-            long id = phoneItem.id;
-            String phone = phoneItem.phoneNumber;
-
-            if (mMakePrimary) {
-                ContentValues values = new ContentValues(1);
-                values.put(Data.IS_SUPER_PRIMARY, 1);
-                mContext.getContentResolver().update(ContentUris.
-                        withAppendedId(Data.CONTENT_URI, id), values, null, null);
-            }
-
-            if (mSendSms) {
-                ContactsUtils.initiateSms(mContext, phone);
-            } else {
-                StickyTabs.saveTab(mContext, mStickyTab);
-                ContactsUtils.initiateCall(mContext, phone);
-            }
-        } else {
-            dialog.dismiss();
-        }
-    }
-
-    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-        mMakePrimary = isChecked;
-    }
-
-    public void onDismiss(DialogInterface dialog) {
-        mPhonesCursor.close();
-    }
-
-    private static class PhonesAdapter extends ArrayAdapter<PhoneItem> {
-        private final boolean sendSms;
-        private final Sources mSources;
-
-        public PhonesAdapter(Context context, List<PhoneItem> objects, boolean sendSms) {
-            super(context, R.layout.phone_disambig_item,
-                    android.R.id.text2, objects);
-            this.sendSms = sendSms;
-            mSources = Sources.getInstance(context);
-        }
-
-        @Override
-        public View getView(int position, View convertView, ViewGroup parent) {
-            View view = super.getView(position, convertView, parent);
-
-            PhoneItem item = getItem(position);
-            ContactsSource source = mSources.getInflatedSource(item.accountType,
-                    ContactsSource.LEVEL_SUMMARY);
-
-            // Obtain a string representation of the phone type specific to the
-            // ContactSource associated with that phone number
-            TextView typeView = (TextView)view.findViewById(android.R.id.text1);
-            DataKind kind = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
-            if (kind != null) {
-                ContentValues values = new ContentValues();
-                values.put(Phone.TYPE, item.type);
-                values.put(Phone.LABEL, item.label);
-                StringInflater header = sendSms ? kind.actionAltHeader : kind.actionHeader;
-                typeView.setText(header.inflateUsing(getContext(), values));
-            } else {
-                typeView.setText(R.string.call_other);
-            }
-            return view;
-        }
-    }
-
-    private class PhoneItem implements Collapsible<PhoneItem> {
-
-        final long id;
-        final String phoneNumber;
-        final String accountType;
-        final long type;
-        final String label;
-
-        public PhoneItem(long id, String phoneNumber, String accountType, int type, String label) {
-            this.id = id;
-            this.phoneNumber = (phoneNumber != null ? phoneNumber : "");
-            this.accountType = accountType;
-            this.type = type;
-            this.label = label;
-        }
-
-        public boolean collapseWith(PhoneItem phoneItem) {
-            if (!shouldCollapseWith(phoneItem)) {
-                return false;
-            }
-            // Just keep the number and id we already have.
-            return true;
-        }
-
-        public boolean shouldCollapseWith(PhoneItem phoneItem) {
-            if (PhoneNumberUtils.compare(PhoneDisambigDialog.this.mContext,
-                    phoneNumber, phoneItem.phoneNumber)) {
-                return true;
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            return phoneNumber;
-        }
-    }
-
-    private ArrayList<PhoneItem> makePhoneItemsList(Cursor phonesCursor) {
-        ArrayList<PhoneItem> phoneList = new ArrayList<PhoneItem>();
-
-        phonesCursor.moveToPosition(-1);
-        while (phonesCursor.moveToNext()) {
-            long id = phonesCursor.getLong(phonesCursor.getColumnIndex(Data._ID));
-            String phone = phonesCursor.getString(phonesCursor.getColumnIndex(Phone.NUMBER));
-            String accountType =
-                    phonesCursor.getString(phonesCursor.getColumnIndex(RawContacts.ACCOUNT_TYPE));
-            int type = phonesCursor.getInt(phonesCursor.getColumnIndex(Phone.TYPE));
-            String label = phonesCursor.getString(phonesCursor.getColumnIndex(Phone.LABEL));
-
-            phoneList.add(new PhoneItem(id, phone, accountType, type, label));
-        }
-
-        return phoneList;
-    }
-}
diff --git a/src/com/android/contacts/PinnedHeaderListView.java b/src/com/android/contacts/PinnedHeaderListView.java
deleted file mode 100644
index 9d1391b..0000000
--- a/src/com/android/contacts/PinnedHeaderListView.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.contacts;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.ListAdapter;
-import android.widget.ListView;
-
-/**
- * A ListView that maintains a header pinned at the top of the list. The
- * pinned header can be pushed up and dissolved as needed.
- */
-public class PinnedHeaderListView extends ListView {
-
-    /**
-     * Adapter interface.  The list adapter must implement this interface.
-     */
-    public interface PinnedHeaderAdapter {
-
-        /**
-         * Pinned header state: don't show the header.
-         */
-        public static final int PINNED_HEADER_GONE = 0;
-
-        /**
-         * Pinned header state: show the header at the top of the list.
-         */
-        public static final int PINNED_HEADER_VISIBLE = 1;
-
-        /**
-         * Pinned header state: show the header. If the header extends beyond
-         * the bottom of the first shown element, push it up and clip.
-         */
-        public static final int PINNED_HEADER_PUSHED_UP = 2;
-
-        /**
-         * Computes the desired state of the pinned header for the given
-         * position of the first visible list item. Allowed return values are
-         * {@link #PINNED_HEADER_GONE}, {@link #PINNED_HEADER_VISIBLE} or
-         * {@link #PINNED_HEADER_PUSHED_UP}.
-         */
-        int getPinnedHeaderState(int position);
-
-        /**
-         * Configures the pinned header view to match the first visible list item.
-         *
-         * @param header pinned header view.
-         * @param position position of the first visible list item.
-         * @param alpha fading of the header view, between 0 and 255.
-         */
-        void configurePinnedHeader(View header, int position, int alpha);
-    }
-
-    private static final int MAX_ALPHA = 255;
-
-    private PinnedHeaderAdapter mAdapter;
-    private View mHeaderView;
-    private boolean mHeaderViewVisible;
-
-    private int mHeaderViewWidth;
-
-    private int mHeaderViewHeight;
-
-    public PinnedHeaderListView(Context context) {
-        super(context);
-    }
-
-    public PinnedHeaderListView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public PinnedHeaderListView(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-    }
-
-    public void setPinnedHeaderView(View view) {
-        mHeaderView = view;
-
-        // Disable vertical fading when the pinned header is present
-        // TODO change ListView to allow separate measures for top and bottom fading edge;
-        // in this particular case we would like to disable the top, but not the bottom edge.
-        if (mHeaderView != null) {
-            setFadingEdgeLength(0);
-        }
-        requestLayout();
-    }
-
-    @Override
-    public void setAdapter(ListAdapter adapter) {
-        super.setAdapter(adapter);
-        mAdapter = (PinnedHeaderAdapter)adapter;
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-        if (mHeaderView != null) {
-            measureChild(mHeaderView, widthMeasureSpec, heightMeasureSpec);
-            mHeaderViewWidth = mHeaderView.getMeasuredWidth();
-            mHeaderViewHeight = mHeaderView.getMeasuredHeight();
-        }
-    }
-
-    @Override
-    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
-        super.onLayout(changed, left, top, right, bottom);
-        if (mHeaderView != null) {
-            mHeaderView.layout(0, 0, mHeaderViewWidth, mHeaderViewHeight);
-            configureHeaderView(getFirstVisiblePosition());
-        }
-    }
-
-    public void configureHeaderView(int position) {
-        if (mHeaderView == null) {
-            return;
-        }
-
-        int state = mAdapter.getPinnedHeaderState(position);
-        switch (state) {
-            case PinnedHeaderAdapter.PINNED_HEADER_GONE: {
-                mHeaderViewVisible = false;
-                break;
-            }
-
-            case PinnedHeaderAdapter.PINNED_HEADER_VISIBLE: {
-                mAdapter.configurePinnedHeader(mHeaderView, position, MAX_ALPHA);
-                if (mHeaderView.getTop() != 0) {
-                    mHeaderView.layout(0, 0, mHeaderViewWidth, mHeaderViewHeight);
-                }
-                mHeaderViewVisible = true;
-                break;
-            }
-
-            case PinnedHeaderAdapter.PINNED_HEADER_PUSHED_UP: {
-                View firstView = getChildAt(0);
-                int bottom = firstView.getBottom();
-                int itemHeight = firstView.getHeight();
-                int headerHeight = mHeaderView.getHeight();
-                int y;
-                int alpha;
-                if (bottom < headerHeight) {
-                    y = (bottom - headerHeight);
-                    alpha = MAX_ALPHA * (headerHeight + y) / headerHeight;
-                } else {
-                    y = 0;
-                    alpha = MAX_ALPHA;
-                }
-                mAdapter.configurePinnedHeader(mHeaderView, position, alpha);
-                if (mHeaderView.getTop() != y) {
-                    mHeaderView.layout(0, y, mHeaderViewWidth, mHeaderViewHeight + y);
-                }
-                mHeaderViewVisible = true;
-                break;
-            }
-        }
-    }
-
-    @Override
-    protected void dispatchDraw(Canvas canvas) {
-        super.dispatchDraw(canvas);
-        if (mHeaderViewVisible) {
-            drawChild(canvas, mHeaderView, getDrawingTime());
-        }
-    }
-}
diff --git a/src/com/android/contacts/ProgressShower.java b/src/com/android/contacts/ProgressShower.java
deleted file mode 100644
index a5ad2a2..0000000
--- a/src/com/android/contacts/ProgressShower.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts;
-
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.os.Handler;
-import android.pim.vcard.VCardEntry;
-import android.pim.vcard.VCardEntryHandler;
-import android.pim.vcard.VCardConfig;
-import android.util.Log;
-
-public class ProgressShower implements VCardEntryHandler {
-    public static final String LOG_TAG = "vcard.ProgressShower"; 
-
-    private final Context mContext;
-    private final Handler mHandler;
-    private final ProgressDialog mProgressDialog;
-    private final String mProgressMessage;
-
-    private long mTime;
-    
-    private class ShowProgressRunnable implements Runnable {
-        private VCardEntry mContact;
-        
-        public ShowProgressRunnable(VCardEntry contact) {
-            mContact = contact;
-        }
-        
-        public void run() {
-            mProgressDialog.setMessage( mProgressMessage + "\n" + 
-                    mContact.getDisplayName());
-            mProgressDialog.incrementProgressBy(1);
-        }
-    }
-    
-    public ProgressShower(ProgressDialog progressDialog,
-            String progressMessage,
-            Context context,
-            Handler handler) {
-        mContext = context;
-        mHandler = handler;
-        mProgressDialog = progressDialog;
-        mProgressMessage = progressMessage;
-    }
-
-    public void onStart() {
-    }
-
-    public void onEntryCreated(VCardEntry contactStruct) {
-        long start = System.currentTimeMillis();
-        
-        if (!contactStruct.isIgnorable()) {
-            if (mProgressDialog != null && mProgressMessage != null) {
-                if (mHandler != null) {
-                    mHandler.post(new ShowProgressRunnable(contactStruct));
-                } else {
-                    mProgressDialog.setMessage(mContext.getString(R.string.progress_shower_message,
-                            mProgressMessage, 
-                            contactStruct.getDisplayName()));
-                }
-            }
-        }
-        
-        mTime += System.currentTimeMillis() - start;
-    }
-
-    public void onEnd() {
-        if (VCardConfig.showPerformanceLog()) {
-            Log.d(LOG_TAG,
-                    String.format("Time to progress a dialog: %d ms", mTime));
-        }
-    }
-}
diff --git a/src/com/android/contacts/RecentCallsListActivity.java b/src/com/android/contacts/RecentCallsListActivity.java
index abda325..c004ccf 100644
--- a/src/com/android/contacts/RecentCallsListActivity.java
+++ b/src/com/android/contacts/RecentCallsListActivity.java
@@ -16,6 +16,7 @@
 
 package com.android.contacts;
 
+import com.android.common.widget.GroupingListAdapter;
 import com.android.internal.telephony.CallerInfo;
 import com.android.internal.telephony.ITelephony;
 
@@ -55,7 +56,6 @@
 import android.provider.ContactsContract.PhoneLookup;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.TelephonyManager;
-import android.text.SpannableStringBuilder;
 import android.text.TextUtils;
 import android.text.format.DateUtils;
 import android.util.Log;
@@ -77,7 +77,6 @@
 import java.lang.ref.WeakReference;
 import java.util.HashMap;
 import java.util.LinkedList;
-import java.util.Locale;
 
 /**
  * Displays a list of call log entries.
@@ -95,8 +94,8 @@
             Calls.TYPE,
             Calls.CACHED_NAME,
             Calls.CACHED_NUMBER_TYPE,
-            Calls.CACHED_NUMBER_LABEL
-    };
+            Calls.CACHED_NUMBER_LABEL,
+            Calls.COUNTRY_ISO};
 
     static final int ID_COLUMN_INDEX = 0;
     static final int NUMBER_COLUMN_INDEX = 1;
@@ -106,6 +105,7 @@
     static final int CALLER_NAME_COLUMN_INDEX = 5;
     static final int CALLER_NUMBERTYPE_COLUMN_INDEX = 6;
     static final int CALLER_NUMBERLABEL_COLUMN_INDEX = 7;
+    static final int COUNTRY_ISO_COLUMN_INDEX = 8;
 
     /** The projection to use when querying the phones table */
     static final String[] PHONES_PROJECTION = new String[] {
@@ -113,18 +113,19 @@
             PhoneLookup.DISPLAY_NAME,
             PhoneLookup.TYPE,
             PhoneLookup.LABEL,
-            PhoneLookup.NUMBER
-    };
+            PhoneLookup.NUMBER,
+            PhoneLookup.NORMALIZED_NUMBER};
 
     static final int PERSON_ID_COLUMN_INDEX = 0;
     static final int NAME_COLUMN_INDEX = 1;
     static final int PHONE_TYPE_COLUMN_INDEX = 2;
     static final int LABEL_COLUMN_INDEX = 3;
     static final int MATCHED_NUMBER_COLUMN_INDEX = 4;
+    static final int NORMALIZED_NUMBER_COLUMN_INDEX = 5;
 
-    private static final int MENU_ITEM_DELETE_ALL = 1;
-    private static final int CONTEXT_MENU_ITEM_DELETE = 1;
-    private static final int CONTEXT_MENU_CALL_CONTACT = 2;
+    private static final int MENU_ITEM_DELETE = 1;
+    private static final int MENU_ITEM_DELETE_ALL = 2;
+    private static final int MENU_ITEM_VIEW_CONTACTS = 3;
 
     private static final int QUERY_TOKEN = 53;
     private static final int UPDATE_TOKEN = 54;
@@ -134,6 +135,7 @@
     RecentCallsAdapter mAdapter;
     private QueryHandler mQueryHandler;
     String mVoiceMailNumber;
+    private String mCurrentCountryIso;
 
     private boolean mScrollToTop;
 
@@ -144,6 +146,7 @@
         public String label;
         public String number;
         public String formattedNumber;
+        public String normalizedNumber;
 
         public static ContactInfo EMPTY = new ContactInfo();
     }
@@ -167,23 +170,6 @@
         String numberLabel;
     }
 
-    /**
-     * Shared builder used by {@link #formatPhoneNumber(String)} to minimize
-     * allocations when formatting phone numbers.
-     */
-    private static final SpannableStringBuilder sEditable = new SpannableStringBuilder();
-
-    /**
-     * Invalid formatting type constant for {@link #sFormattingType}.
-     */
-    private static final int FORMATTING_TYPE_INVALID = -1;
-
-    /**
-     * Cached formatting type for current {@link Locale}, as provided by
-     * {@link PhoneNumberUtils#getFormatTypeForLocale(Locale)}.
-     */
-    private static int sFormattingType = FORMATTING_TYPE_INVALID;
-
     /** Adapter class to fill in data for the Call Log */
     final class RecentCallsAdapter extends GroupingListAdapter
             implements Runnable, ViewTreeObserver.OnPreDrawListener, View.OnClickListener {
@@ -221,7 +207,6 @@
                 } else {
                     callUri = Uri.fromParts("tel", number, null);
                 }
-                StickyTabs.saveTab(RecentCallsListActivity.this, getIntent());
                 startActivity(new Intent(Intent.ACTION_CALL_PRIVILEGED, callUri));
             }
         }
@@ -415,6 +400,7 @@
                             // Note Data.DATA1 and SipAddress.SIP_ADDRESS are equivalent.
                             info.number = dataTableCursor.getString(
                                     dataTableCursor.getColumnIndex(Data.DATA1));
+                            info.normalizedNumber = null;  // meaningless for SIP addresses
 
                             infoUpdated = true;
                         }
@@ -426,7 +412,7 @@
                     Cursor phonesCursor =
                             RecentCallsListActivity.this.getContentResolver().query(
                                 Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,
-                                                     Uri.encode(ciq.number)),
+                                        Uri.encode(ciq.number)),
                                 PHONES_PROJECTION, null, null, null);
                     if (phonesCursor != null) {
                         if (phonesCursor.moveToFirst()) {
@@ -436,6 +422,8 @@
                             info.type = phonesCursor.getInt(PHONE_TYPE_COLUMN_INDEX);
                             info.label = phonesCursor.getString(LABEL_COLUMN_INDEX);
                             info.number = phonesCursor.getString(MATCHED_NUMBER_COLUMN_INDEX);
+                            info.normalizedNumber =
+                                    phonesCursor.getString(NORMALIZED_NUMBER_COLUMN_INDEX);
 
                             infoUpdated = true;
                         }
@@ -623,7 +611,7 @@
             String callerName = c.getString(CALLER_NAME_COLUMN_INDEX);
             int callerNumberType = c.getInt(CALLER_NUMBERTYPE_COLUMN_INDEX);
             String callerNumberLabel = c.getString(CALLER_NUMBERLABEL_COLUMN_INDEX);
-
+            String countryIso = c.getString(COUNTRY_ISO_COLUMN_INDEX);
             // Store away the number so we can call it directly if you click on the call icon
             views.callView.setTag(number);
 
@@ -650,7 +638,8 @@
 
                 // Format and cache phone number for found contact
                 if (info.formattedNumber == null) {
-                    info.formattedNumber = formatPhoneNumber(info.number);
+                    info.formattedNumber =
+                            formatPhoneNumber(info.number, info.normalizedNumber, countryIso);
                 }
                 formattedNumber = info.formattedNumber;
             }
@@ -667,7 +656,7 @@
                 label = callerNumberLabel;
 
                 // Format the cached call_log phone number
-                formattedNumber = formatPhoneNumber(number);
+                formattedNumber = formatPhoneNumber(number, null, countryIso);
             }
             // Set the text lines and call icon.
             // Assumes the call back feature is on most of the
@@ -731,7 +720,7 @@
                     number = getString(R.string.voicemail);
                 } else {
                     // Just a raw number, and no cache, so format it nicely
-                    number = formatPhoneNumber(number);
+                    number = formatPhoneNumber(number, null, countryIso);
                 }
 
                 views.line1View.setText(number);
@@ -850,8 +839,7 @@
                 .getVoiceMailNumber();
         mQueryHandler = new QueryHandler(this);
 
-        // Reset locale-based formatting cache
-        sFormattingType = FORMATTING_TYPE_INVALID;
+        mCurrentCountryIso = ContactsUtils.getCurrentCountryIso(this);
     }
 
     @Override
@@ -914,36 +902,28 @@
     }
 
     /**
-     * Format the given phone number using
-     * {@link PhoneNumberUtils#formatNumber(android.text.Editable, int)}. This
-     * helper method uses {@link #sEditable} and {@link #sFormattingType} to
-     * prevent allocations between multiple calls.
-     * <p>
-     * Because of the shared {@link #sEditable} builder, <b>this method is not
-     * thread safe</b>, and should only be called from the GUI thread.
-     * <p>
-     * If the given String object is null or empty, return an empty String.
+     * Format the given phone number
+     *
+     * @param number the number to be formatted.
+     * @param normalizedNumber the normalized number of the given number.
+     * @param countryIso the ISO 3166-1 two letters country code, the country's
+     *        convention will be used to format the number if the normalized
+     *        phone is null.
+     *
+     * @return the formatted number, or the given number if it was formatted.
      */
-    private String formatPhoneNumber(String number) {
+    private String formatPhoneNumber(String number, String normalizedNumber, String countryIso) {
         if (TextUtils.isEmpty(number)) {
             return "";
         }
-
         // If "number" is really a SIP address, don't try to do any formatting at all.
         if (PhoneNumberUtils.isUriNumber(number)) {
             return number;
         }
-
-        // Cache formatting type if not already present
-        if (sFormattingType == FORMATTING_TYPE_INVALID) {
-            sFormattingType = PhoneNumberUtils.getFormatTypeForLocale(Locale.getDefault());
+        if (TextUtils.isEmpty(countryIso)) {
+            countryIso = mCurrentCountryIso;
         }
-
-        sEditable.clear();
-        sEditable.append(number);
-
-        PhoneNumberUtils.formatNumber(sEditable, sFormattingType);
-        return sEditable.toString();
+        return PhoneNumberUtils.formatNumber(number, normalizedNumber, countryIso);
     }
 
     private void resetNewCallsFlag() {
@@ -1017,16 +997,14 @@
 
         if (numberUri != null) {
             Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED, numberUri);
-            menu.add(0, CONTEXT_MENU_CALL_CONTACT, 0,
-                    getResources().getString(R.string.recentCalls_callNumber, number))
+            menu.add(0, 0, 0, getResources().getString(R.string.recentCalls_callNumber, number))
                     .setIntent(intent);
         }
 
         if (contactInfoPresent) {
-            Intent intent = new Intent(Intent.ACTION_VIEW,
-                    ContentUris.withAppendedId(Contacts.CONTENT_URI, info.personId));
-            StickyTabs.setTab(intent, getIntent());
-            menu.add(0, 0, 0, R.string.menu_viewContact).setIntent(intent);
+            menu.add(0, 0, 0, R.string.menu_viewContact)
+                    .setIntent(new Intent(Intent.ACTION_VIEW,
+                            ContentUris.withAppendedId(Contacts.CONTENT_URI, info.personId)));
         }
 
         if (numberUri != null && !isVoicemail && !isSipNumber) {
@@ -1055,7 +1033,7 @@
             menu.add(0, 0, 0, R.string.recentCalls_addToContact)
                     .setIntent(intent);
         }
-        menu.add(0, CONTEXT_MENU_ITEM_DELETE, 0, R.string.recentCalls_removeFromRecentList);
+        menu.add(0, MENU_ITEM_DELETE, 0, R.string.recentCalls_removeFromRecentList);
     }
 
     @Override
@@ -1089,23 +1067,30 @@
                 showDialog(DIALOG_CONFIRM_DELETE_ALL);
                 return true;
             }
+
+            case MENU_ITEM_VIEW_CONTACTS: {
+                Intent intent = new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI);
+                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                startActivity(intent);
+                return true;
+            }
         }
         return super.onOptionsItemSelected(item);
     }
 
     @Override
     public boolean onContextItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case CONTEXT_MENU_ITEM_DELETE: {
-                // Convert the menu info to the proper type
-                AdapterView.AdapterContextMenuInfo menuInfo;
-                try {
-                     menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
-                } catch (ClassCastException e) {
-                    Log.e(TAG, "bad menuInfoIn", e);
-                    return false;
-                }
+        // Convert the menu info to the proper type
+        AdapterView.AdapterContextMenuInfo menuInfo;
+        try {
+             menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
+        } catch (ClassCastException e) {
+            Log.e(TAG, "bad menuInfoIn", e);
+            return false;
+        }
 
+        switch (item.getItemId()) {
+            case MENU_ITEM_DELETE: {
                 Cursor cursor = (Cursor)mAdapter.getItem(menuInfo.position);
                 int groupSize = 1;
                 if (mAdapter.isGroupHeader(menuInfo.position)) {
@@ -1124,17 +1109,9 @@
 
                 getContentResolver().delete(Calls.CONTENT_URI, Calls._ID + " IN (" + sb + ")",
                         null);
-                return true;
-            }
-            case CONTEXT_MENU_CALL_CONTACT: {
-                StickyTabs.saveTab(this, getIntent());
-                startActivity(item.getIntent());
-                return true;
-            }
-            default: {
-                return super.onContextItemSelected(item);
             }
         }
+        return super.onContextItemSelected(item);
     }
 
     @Override
@@ -1253,7 +1230,6 @@
                 intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
                                     Uri.fromParts("tel", number, null));
             }
-            StickyTabs.saveTab(this, getIntent());
             intent.setFlags(
                     Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
             startActivity(intent);
@@ -1267,7 +1243,6 @@
         } else {
             Intent intent = new Intent(this, CallDetailActivity.class);
             intent.setData(ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI, id));
-            StickyTabs.setTab(intent, getIntent());
             startActivity(intent);
         }
     }
diff --git a/src/com/android/contacts/ScrollingTabWidget.java b/src/com/android/contacts/ScrollingTabWidget.java
deleted file mode 100644
index b45abe4..0000000
--- a/src/com/android/contacts/ScrollingTabWidget.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
-import android.view.View.OnClickListener;
-import android.view.View.OnFocusChangeListener;
-import android.widget.HorizontalScrollView;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-
-/*
- * Tab widget that can contain more tabs than can fit on screen at once and scroll over them.
- */
-public class ScrollingTabWidget extends RelativeLayout
-        implements OnClickListener, ViewTreeObserver.OnGlobalFocusChangeListener,
-        OnFocusChangeListener {
-
-    private static final String TAG = "ScrollingTabWidget";
-
-    private OnTabSelectionChangedListener mSelectionChangedListener;
-    private int mSelectedTab = 0;
-    private ImageView mLeftArrowView;
-    private ImageView mRightArrowView;
-    private HorizontalScrollView mTabsScrollWrapper;
-    private TabStripView mTabsView;
-    private LayoutInflater mInflater;
-
-    // Keeps track of the left most visible tab.
-    private int mLeftMostVisibleTabIndex = 0;
-
-    public ScrollingTabWidget(Context context) {
-        this(context, null);
-    }
-
-    public ScrollingTabWidget(Context context, AttributeSet attrs) {
-        this(context, attrs, 0);
-    }
-
-    public ScrollingTabWidget(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs);
-
-        mInflater = (LayoutInflater) mContext.getSystemService(
-                Context.LAYOUT_INFLATER_SERVICE);
-
-        setFocusable(true);
-        setOnFocusChangeListener(this);
-        if (!hasFocus()) {
-            setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS);
-        }
-
-        mLeftArrowView = (ImageView) mInflater.inflate(R.layout.tab_left_arrow, this, false);
-        mLeftArrowView.setOnClickListener(this);
-        mRightArrowView = (ImageView) mInflater.inflate(R.layout.tab_right_arrow, this, false);
-        mRightArrowView.setOnClickListener(this);
-        mTabsScrollWrapper = (HorizontalScrollView) mInflater.inflate(
-                R.layout.tab_layout, this, false);
-        mTabsView = (TabStripView) mTabsScrollWrapper.findViewById(android.R.id.tabs);
-        View accountNameView = mInflater.inflate(R.layout.tab_account_name, this, false);
-
-        mLeftArrowView.setVisibility(View.INVISIBLE);
-        mRightArrowView.setVisibility(View.INVISIBLE);
-
-        addView(mTabsScrollWrapper);
-        addView(mLeftArrowView);
-        addView(mRightArrowView);
-        addView(accountNameView);
-    }
-
-    @Override
-    protected void onAttachedToWindow() {
-        super.onAttachedToWindow();
-        final ViewTreeObserver treeObserver = getViewTreeObserver();
-        if (treeObserver != null) {
-            treeObserver.addOnGlobalFocusChangeListener(this);
-        }
-    }
-
-    @Override
-    protected void onDetachedFromWindow() {
-        super.onDetachedFromWindow();
-        final ViewTreeObserver treeObserver = getViewTreeObserver();
-        if (treeObserver != null) {
-            treeObserver.removeOnGlobalFocusChangeListener(this);
-        }
-    }
-
-    protected void updateArrowVisibility() {
-        int scrollViewLeftEdge = mTabsScrollWrapper.getScrollX();
-        int tabsViewLeftEdge = mTabsView.getLeft();
-        int scrollViewRightEdge = scrollViewLeftEdge + mTabsScrollWrapper.getWidth();
-        int tabsViewRightEdge = mTabsView.getRight();
-
-        int rightArrowCurrentVisibility = mRightArrowView.getVisibility();
-        if (scrollViewRightEdge == tabsViewRightEdge
-                && rightArrowCurrentVisibility == View.VISIBLE) {
-            mRightArrowView.setVisibility(View.INVISIBLE);
-        } else if (scrollViewRightEdge < tabsViewRightEdge
-                && rightArrowCurrentVisibility != View.VISIBLE) {
-            mRightArrowView.setVisibility(View.VISIBLE);
-        }
-
-        int leftArrowCurrentVisibility = mLeftArrowView.getVisibility();
-        if (scrollViewLeftEdge == tabsViewLeftEdge
-                && leftArrowCurrentVisibility == View.VISIBLE) {
-            mLeftArrowView.setVisibility(View.INVISIBLE);
-        } else if (scrollViewLeftEdge > tabsViewLeftEdge
-                && leftArrowCurrentVisibility != View.VISIBLE) {
-            mLeftArrowView.setVisibility(View.VISIBLE);
-        }
-    }
-
-    /**
-     * Returns the tab indicator view at the given index.
-     *
-     * @param index the zero-based index of the tab indicator view to return
-     * @return the tab indicator view at the given index
-     */
-    public View getChildTabViewAt(int index) {
-        return mTabsView.getChildAt(index);
-    }
-
-    /**
-     * Returns the number of tab indicator views.
-     *
-     * @return the number of tab indicator views.
-     */
-    public int getTabCount() {
-        return mTabsView.getChildCount();
-    }
-
-    /**
-     * Returns the {@link ViewGroup} that actually contains the tabs. This is where the tab
-     * views should be attached to when being inflated.
-     */
-    public ViewGroup getTabParent() {
-        return mTabsView;
-    }
-
-    public void removeAllTabs() {
-        mTabsView.removeAllViews();
-    }
-
-    @Override
-    public void dispatchDraw(Canvas canvas) {
-        updateArrowVisibility();
-        super.dispatchDraw(canvas);
-    }
-
-    /**
-     * Sets the current tab.
-     * This method is used to bring a tab to the front of the Widget,
-     * and is used to post to the rest of the UI that a different tab
-     * has been brought to the foreground.
-     *
-     * Note, this is separate from the traditional "focus" that is
-     * employed from the view logic.
-     *
-     * For instance, if we have a list in a tabbed view, a user may be
-     * navigating up and down the list, moving the UI focus (orange
-     * highlighting) through the list items.  The cursor movement does
-     * not effect the "selected" tab though, because what is being
-     * scrolled through is all on the same tab.  The selected tab only
-     * changes when we navigate between tabs (moving from the list view
-     * to the next tabbed view, in this example).
-     *
-     * To move both the focus AND the selected tab at once, please use
-     * {@link #focusCurrentTab}. Normally, the view logic takes care of
-     * adjusting the focus, so unless you're circumventing the UI,
-     * you'll probably just focus your interest here.
-     *
-     *  @param index The tab that you want to indicate as the selected
-     *  tab (tab brought to the front of the widget)
-     *
-     *  @see #focusCurrentTab
-     */
-    public void setCurrentTab(int index) {
-        if (index < 0 || index >= getTabCount()) {
-            return;
-        }
-
-        if (mSelectedTab < getTabCount()) {
-            mTabsView.setSelected(mSelectedTab, false);
-        }
-        mSelectedTab = index;
-        mTabsView.setSelected(mSelectedTab, true);
-    }
-
-    /**
-     * Return index of the currently selected tab.
-     */
-    public int getCurrentTab() {
-        return mSelectedTab;
-    }
-
-    /**
-     * Sets the current tab and focuses the UI on it.
-     * This method makes sure that the focused tab matches the selected
-     * tab, normally at {@link #setCurrentTab}.  Normally this would not
-     * be an issue if we go through the UI, since the UI is responsible
-     * for calling TabWidget.onFocusChanged(), but in the case where we
-     * are selecting the tab programmatically, we'll need to make sure
-     * focus keeps up.
-     *
-     *  @param index The tab that you want focused (highlighted in orange)
-     *  and selected (tab brought to the front of the widget)
-     *
-     *  @see #setCurrentTab
-     */
-    public void focusCurrentTab(int index) {
-        if (index < 0 || index >= getTabCount()) {
-            return;
-        }
-
-        setCurrentTab(index);
-        getChildTabViewAt(index).requestFocus();
-
-    }
-
-    /**
-     * Adds a tab to the list of tabs. The tab's indicator view is specified
-     * by a layout id. InflateException will be thrown if there is a problem
-     * inflating.
-     *
-     * @param layoutResId The layout id to be inflated to make the tab indicator.
-     */
-    public void addTab(int layoutResId) {
-        addTab(mInflater.inflate(layoutResId, mTabsView, false));
-    }
-
-    /**
-     * Adds a tab to the list of tabs. The tab's indicator view must be provided.
-     *
-     * @param child
-     */
-    public void addTab(View child) {
-        if (child == null) {
-            return;
-        }
-
-        if (child.getLayoutParams() == null) {
-            final LayoutParams lp = new LayoutParams(
-                    ViewGroup.LayoutParams.WRAP_CONTENT,
-                    ViewGroup.LayoutParams.WRAP_CONTENT);
-            lp.setMargins(0, 0, 0, 0);
-            child.setLayoutParams(lp);
-        }
-
-        // Ensure you can navigate to the tab with the keyboard, and you can touch it
-        child.setFocusable(true);
-        child.setClickable(true);
-        child.setOnClickListener(new TabClickListener());
-        child.setOnFocusChangeListener(this);
-
-        mTabsView.addView(child);
-    }
-
-    /**
-     * Provides a way for ViewContactActivity and EditContactActivity to be notified that the
-     * user clicked on a tab indicator.
-     */
-    public void setTabSelectionListener(OnTabSelectionChangedListener listener) {
-        mSelectionChangedListener = listener;
-    }
-
-    public void onGlobalFocusChanged(View oldFocus, View newFocus) {
-        if (isTab(oldFocus) && !isTab(newFocus)) {
-            onLoseFocus();
-        }
-    }
-
-    public void onFocusChange(View v, boolean hasFocus) {
-        if (v == this && hasFocus) {
-            onObtainFocus();
-            return;
-        }
-
-        if (hasFocus) {
-            for (int i = 0; i < getTabCount(); i++) {
-                if (getChildTabViewAt(i) == v) {
-                    setCurrentTab(i);
-                    mSelectionChangedListener.onTabSelectionChanged(i, false);
-                    break;
-                }
-            }
-        }
-    }
-
-    /**
-     * Called when the {@link ScrollingTabWidget} gets focus. Here the
-     * widget decides which of it's tabs should have focus.
-     */
-    protected void onObtainFocus() {
-        // Setting this flag, allows the children of this View to obtain focus.
-        setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
-        // Assign focus to the last selected tab.
-        focusCurrentTab(mSelectedTab);
-        mSelectionChangedListener.onTabSelectionChanged(mSelectedTab, false);
-    }
-
-    /**
-     * Called when the focus has left the {@link ScrollingTabWidget} or its
-     * descendants. At this time we want the children of this view to be marked
-     * as un-focusable, so that next time focus is moved to the widget, the widget
-     * gets control, and can assign focus where it wants.
-     */
-    protected void onLoseFocus() {
-        // Setting this flag will effectively make the tabs unfocusable. This will
-        // be toggled when the widget obtains focus again.
-        setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS);
-    }
-
-    public boolean isTab(View v) {
-        for (int i = 0; i < getTabCount(); i++) {
-            if (getChildTabViewAt(i) == v) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private class TabClickListener implements OnClickListener {
-        public void onClick(View v) {
-            for (int i = 0; i < getTabCount(); i++) {
-                if (getChildTabViewAt(i) == v) {
-                    setCurrentTab(i);
-                    mSelectionChangedListener.onTabSelectionChanged(i, true);
-                    break;
-                }
-            }
-        }
-    }
-
-    public interface OnTabSelectionChangedListener {
-        /**
-         * Informs the tab widget host which tab was selected. It also indicates
-         * if the tab was clicked/pressed or just focused into.
-         *
-         * @param tabIndex index of the tab that was selected
-         * @param clicked whether the selection changed due to a touch/click
-         * or due to focus entering the tab through navigation. Pass true
-         * if it was due to a press/click and false otherwise.
-         */
-        void onTabSelectionChanged(int tabIndex, boolean clicked);
-    }
-
-    public void onClick(View v) {
-        updateLeftMostVisible();
-        if (v == mRightArrowView && (mLeftMostVisibleTabIndex + 1 < getTabCount())) {
-            tabScroll(true /* right */);
-        } else if (v == mLeftArrowView && mLeftMostVisibleTabIndex > 0) {
-            tabScroll(false /* left */);
-        }
-    }
-
-    /*
-     * Updates our record of the left most visible tab. We keep track of this explicitly
-     * on arrow clicks, but need to re-calibrate after focus navigation.
-     */
-    protected void updateLeftMostVisible() {
-        int viewableLeftEdge = mTabsScrollWrapper.getScrollX();
-
-        if (mLeftArrowView.getVisibility() == View.VISIBLE) {
-            viewableLeftEdge += mLeftArrowView.getWidth();
-        }
-
-        for (int i = 0; i < getTabCount(); i++) {
-            View tab = getChildTabViewAt(i);
-            int tabLeftEdge = tab.getLeft();
-            if (tabLeftEdge >= viewableLeftEdge) {
-                mLeftMostVisibleTabIndex = i;
-                break;
-            }
-        }
-    }
-
-    /**
-     * Scrolls the tabs by exactly one tab width.
-     *
-     * @param directionRight if true, scroll to the right, if false, scroll to the left.
-     */
-    protected void tabScroll(boolean directionRight) {
-        int scrollWidth = 0;
-        View newLeftMostVisibleTab = null;
-        if (directionRight) {
-            newLeftMostVisibleTab = getChildTabViewAt(++mLeftMostVisibleTabIndex);
-        } else {
-            newLeftMostVisibleTab = getChildTabViewAt(--mLeftMostVisibleTabIndex);
-        }
-
-        scrollWidth = newLeftMostVisibleTab.getLeft() - mTabsScrollWrapper.getScrollX();
-        if (mLeftMostVisibleTabIndex > 0) {
-            scrollWidth -= mLeftArrowView.getWidth();
-        }
-        mTabsScrollWrapper.smoothScrollBy(scrollWidth, 0);
-    }
-
-}
diff --git a/src/com/android/contacts/SearchEditText.java b/src/com/android/contacts/SearchEditText.java
deleted file mode 100644
index 7683f23..0000000
--- a/src/com/android/contacts/SearchEditText.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.contacts;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.view.KeyEvent;
-import android.widget.EditText;
-
-/**
- * A custom text editor that helps automatically dismiss the activity along with the soft
- * keyboard.
- */
-public class SearchEditText extends EditText {
-
-    private boolean mMagnifyingGlassShown = true;
-    private Drawable mMagnifyingGlass;
-
-    public SearchEditText(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        mMagnifyingGlass = getCompoundDrawables()[2];
-    }
-
-    /**
-     * Conditionally shows a magnifying glass icon on the right side of the text field
-     * when the text it empty.
-     */
-    @Override
-    public boolean onPreDraw() {
-        boolean emptyText = TextUtils.isEmpty(getText());
-        if (mMagnifyingGlassShown != emptyText) {
-            mMagnifyingGlassShown = emptyText;
-            if (mMagnifyingGlassShown) {
-                setCompoundDrawables(null, null, mMagnifyingGlass, null);
-            } else {
-                setCompoundDrawables(null, null, null, null);
-            }
-            return false;
-        }
-        return super.onPreDraw();
-    }
-
-    /**
-     * Forwards the onKeyPreIme call to the view's activity.
-     */
-    @Override
-    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
-        if (((ContactsListActivity)getContext()).onKeyPreIme(keyCode, event)) {
-            return true;
-        }
-        return super.onKeyPreIme(keyCode, event);
-    }
-}
diff --git a/src/com/android/contacts/SearchResultsActivity.java b/src/com/android/contacts/SearchResultsActivity.java
deleted file mode 100644
index 09f0014..0000000
--- a/src/com/android/contacts/SearchResultsActivity.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2007 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.contacts;
-
-/**
- * The activity that displays the list of contact search results.  We need a separate
- * class because it uses a different theme from {@link ContactsListActivity}.
- */
-public class SearchResultsActivity extends ContactsListActivity {
-}
diff --git a/src/com/android/contacts/SplitAggregateView.java b/src/com/android/contacts/SplitAggregateView.java
index b85a4ab..a7a56b2 100644
--- a/src/com/android/contacts/SplitAggregateView.java
+++ b/src/com/android/contacts/SplitAggregateView.java
@@ -16,8 +16,8 @@
 
 package com.android.contacts;
 
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountTypes;
 
 import android.content.Context;
 import android.content.pm.PackageManager;
@@ -73,7 +73,7 @@
 
     private final Uri mAggregateUri;
     private OnContactSelectedListener mListener;
-    private Sources mSources;
+    private AccountTypes mSources;
 
     /**
      * Listener interface that gets the contact ID of the user-selected contact.
@@ -90,7 +90,7 @@
 
         mAggregateUri = aggregateUri;
 
-        mSources = Sources.getInstance(context);
+        mSources = AccountTypes.getInstance(context);
 
         final List<RawContactInfo> list = loadData();
 
@@ -247,8 +247,8 @@
             cache.additionalData.setText(info.getAdditionalData());
 
             Drawable icon = null;
-            ContactsSource source = mSources.getInflatedSource(info.accountType,
-                    ContactsSource.LEVEL_SUMMARY);
+            BaseAccountType source = mSources.getInflatedSource(info.accountType,
+                    BaseAccountType.LEVEL_SUMMARY);
             if (source != null) {
                 icon = source.getDisplayIcon(getContext());
             }
diff --git a/src/com/android/contacts/StickyTabs.java b/src/com/android/contacts/StickyTabs.java
deleted file mode 100644
index 4ecc970..0000000
--- a/src/com/android/contacts/StickyTabs.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.contacts;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.provider.ContactsContract.QuickContact;
-import android.util.Log;
-
-/**
- * Utility class to annotate Intents with extra data required for the Sticky-Tab behavior, which
- * allows storing the app to go to the last tab that was used to make a call. Also handles saving
- * and restoring the tab index
- */
-public final class StickyTabs {
-    private static final String TAG = "StickyTabs";
-    private static final boolean LOGV = false;
-
-    private static final String EXTRA_TAB_INDEX =
-            QuickContact.EXTRA_SELECTED_CONTACTS_APP_TAB_INDEX;
-
-    /**
-     * Name of the shared setting. We are using the same name as in FroYo to prevent
-     * having an orphan here
-     */
-    public static final String PREFERENCES_NAME = "dialtacts";
-
-    /**
-     * Name of the shared setting. We are using the same name as in FroYo to prevent
-     * having an orphan there
-     */
-    private static final String PREF_LAST_PHONECALL_TAB = "last_manually_selected_tab";
-
-    /**
-     * Writes the selected tab to the passed intent
-     * @param intent The intent to modify.
-     * @param tabIndex The tab index to write to the intent
-     * @return Returns the modified intent. Notice that this is not a new instance (the passed-in
-     * intent is modified)
-     */
-    public static Intent setTab(Intent intent, int tabIndex) {
-        if (LOGV) Log.v(TAG, "*********** Setting tab index of intent to " + tabIndex);
-
-        if (tabIndex == -1) {
-            intent.removeExtra(EXTRA_TAB_INDEX);
-        } else {
-            intent.putExtra(EXTRA_TAB_INDEX, tabIndex);
-        }
-        return intent;
-    }
-
-    /**
-     * Writes the selected tab to the passed intent by retrieving it from the originalIntent that
-     * was passed in
-     * @param intent The intent to modify.
-     * @param originalIntent The intent where the tab index should be read from
-     * @return Returns the modified intent. Notice that this is not a new instance (the passed-in
-     * intent is modified)
-     */
-    public static Intent setTab(Intent intent, Intent originalIntent) {
-        return setTab(intent, getTab(originalIntent));
-    }
-
-    /**
-     * Returns the selected tab or -1 if no tab is stored
-     */
-    public static int getTab(Intent intent) {
-        if (intent.getExtras() == null) return -1;
-        return intent.getExtras().getInt(EXTRA_TAB_INDEX, -1);
-    }
-
-    /**
-     * Persists the given tabIndex. If the value is -1, the previously persisted value is not
-     * overriden
-     */
-    public static void saveTab(Context context, int tabIndex) {
-        if (LOGV) Log.v(TAG, "*********** Persisting tab index " + tabIndex);
-        if (tabIndex == -1) return;
-
-        final SharedPreferences.Editor editor =
-            context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE).edit();
-        editor.putInt(PREF_LAST_PHONECALL_TAB, tabIndex);
-        editor.apply();
-    }
-
-    /**
-     * Persists the tab as it is stored in the Intent. If the intent does not have a tab index,
-     * the persisted value is not overriden
-     */
-    public static void saveTab(Context context, Intent intent) {
-        saveTab(context, getTab(intent));
-    }
-
-    /**
-     * Returns the previously persisted tab or defaultValue if nothing is saved
-     */
-    public static int loadTab(Context context, int defaultValue) {
-        final SharedPreferences prefs = context.getSharedPreferences(PREFERENCES_NAME,
-                Context.MODE_PRIVATE);
-        final int result = prefs.getInt(PREF_LAST_PHONECALL_TAB, defaultValue);
-        if (LOGV) Log.v(TAG, "*********** Loaded tab index: " + result);
-        return result;
-    }
-}
diff --git a/src/com/android/contacts/TextHighlightingAnimation.java b/src/com/android/contacts/TextHighlightingAnimation.java
deleted file mode 100644
index e35ae1e..0000000
--- a/src/com/android/contacts/TextHighlightingAnimation.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * 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.
- */
-package com.android.contacts;
-
-import com.android.internal.R;
-
-import android.database.CharArrayBuffer;
-import android.graphics.Color;
-import android.os.Handler;
-import android.text.Spanned;
-import android.text.TextPaint;
-import android.text.style.CharacterStyle;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.DecelerateInterpolator;
-
-/**
- * An animation that alternately dims and brightens the non-highlighted portion of text.
- */
-public abstract class TextHighlightingAnimation implements Runnable {
-
-    private static final int MAX_ALPHA = 255;
-    private static final int MIN_ALPHA = 50;
-
-    private AccelerateInterpolator ACCELERATE_INTERPOLATOR = new AccelerateInterpolator();
-    private DecelerateInterpolator DECELERATE_INTERPOLATOR = new DecelerateInterpolator();
-
-    private final static DimmingSpan[] sEmptySpans = new DimmingSpan[0];
-
-    /**
-     * Frame rate expressed a number of millis between frames.
-     */
-    private static final long FRAME_RATE = 50;
-
-    private DimmingSpan mDimmingSpan;
-    private Handler mHandler;
-    private boolean mAnimating;
-    private boolean mDimming;
-    private long mTargetTime;
-    private final int mDuration;
-
-    /**
-     * A Spanned that highlights a part of text by dimming another part of that text.
-     */
-    public class TextWithHighlighting implements Spanned {
-
-        private final DimmingSpan[] mSpans;
-        private boolean mDimmingEnabled;
-        private CharArrayBuffer mText;
-        private int mDimmingSpanStart;
-        private int mDimmingSpanEnd;
-        private String mString;
-
-        public TextWithHighlighting() {
-            mSpans = new DimmingSpan[] { mDimmingSpan };
-        }
-
-        public void setText(CharArrayBuffer baseText, CharArrayBuffer highlightedText) {
-            mText = baseText;
-
-            // TODO figure out a way to avoid string allocation
-            mString = new String(mText.data, 0, mText.sizeCopied);
-
-            int index = indexOf(baseText, highlightedText);
-
-            if (index == 0 || index == -1) {
-                mDimmingEnabled = false;
-            } else {
-                mDimmingEnabled = true;
-                mDimmingSpanStart = 0;
-                mDimmingSpanEnd = index;
-            }
-        }
-
-        /**
-         * An implementation of indexOf on CharArrayBuffers that finds the first match of
-         * the start of buffer2 in buffer1.  For example, indexOf("abcd", "cdef") == 2
-         */
-        private int indexOf(CharArrayBuffer buffer1, CharArrayBuffer buffer2) {
-            char[] string1 = buffer1.data;
-            char[] string2 = buffer2.data;
-            int count1 = buffer1.sizeCopied;
-            int count2 = buffer2.sizeCopied;
-
-            // Ignore matching tails of the two buffers
-            while (count1 > 0 && count2 > 0 && string1[count1 - 1] == string2[count2 - 1]) {
-                count1--;
-                count2--;
-            }
-
-            int size = count2;
-            for (int i = 0; i < count1; i++) {
-                if (i + size > count1) {
-                    size = count1 - i;
-                }
-                int j;
-                for (j = 0; j < size; j++) {
-                    if (string1[i+j] != string2[j]) {
-                        break;
-                    }
-                }
-                if (j == size) {
-                    return i;
-                }
-            }
-
-            return -1;
-        }
-
-
-        @SuppressWarnings("unchecked")
-        public <T> T[] getSpans(int start, int end, Class<T> type) {
-            if (mDimmingEnabled) {
-                return (T[])mSpans;
-            } else {
-                return (T[])sEmptySpans;
-            }
-        }
-
-        public int getSpanStart(Object tag) {
-            // We only have one span - no need to check the tag parameter
-            return mDimmingSpanStart;
-        }
-
-        public int getSpanEnd(Object tag) {
-            // We only have one span - no need to check the tag parameter
-            return mDimmingSpanEnd;
-        }
-
-        public int getSpanFlags(Object tag) {
-            // String is immutable - flags not needed
-            return 0;
-        }
-
-        public int nextSpanTransition(int start, int limit, Class type) {
-            // Never called since we only have one span
-            return 0;
-        }
-
-        public char charAt(int index) {
-            return mText.data[index];
-        }
-
-        public int length() {
-            return mText.sizeCopied;
-        }
-
-        public CharSequence subSequence(int start, int end) {
-            // Never called - implementing for completeness
-            return new String(mText.data, start, end);
-        }
-
-        @Override
-        public String toString() {
-            return mString;
-        }
-    }
-
-    /**
-     * A Span that modifies alpha of the default foreground color.
-     */
-    private static class DimmingSpan extends CharacterStyle {
-        private int mAlpha;
-
-        public void setAlpha(int alpha) {
-            mAlpha = alpha;
-        }
-
-        @Override
-        public void updateDrawState(TextPaint ds) {
-
-            // Only dim the text in the basic state; not selected, focused or pressed
-            int[] states = ds.drawableState;
-            if (states != null) {
-                int count = states.length;
-                for (int i = 0; i < count; i++) {
-                    switch (states[i]) {
-                        case R.attr.state_pressed:
-                        case R.attr.state_selected:
-                        case R.attr.state_focused:
-                            // We can simply return, because the supplied text
-                            // paint is already configured with defaults.
-                            return;
-                    }
-                }
-            }
-
-            int color = ds.getColor();
-            color = Color.argb(mAlpha, Color.red(color), Color.green(color), Color.blue(color));
-            ds.setColor(color);
-        }
-    }
-
-    /**
-     * Constructor.
-     */
-    public TextHighlightingAnimation(int duration) {
-        mDuration = duration;
-        mHandler = new Handler();
-        mDimmingSpan = new DimmingSpan();
-        mDimmingSpan.setAlpha(MAX_ALPHA);
-    }
-
-    /**
-     * Returns a Spanned that can be used by a text view to show text with highlighting.
-     */
-    public TextWithHighlighting createTextWithHighlighting() {
-        return new TextWithHighlighting();
-    }
-
-    /**
-     * Override and invalidate (redraw) TextViews showing {@link TextWithHighlighting}.
-     */
-    protected abstract void invalidate();
-
-    /**
-     * Starts the highlighting animation, which will dim portions of text.
-     */
-    public void startHighlighting() {
-        startAnimation(true);
-    }
-
-    /**
-     * Starts un-highlighting animation, which will brighten the dimmed portions of text
-     * to the brightness level of the rest of text.
-     */
-    public void stopHighlighting() {
-        startAnimation(false);
-    }
-
-    /**
-     * Called when the animation starts.
-     */
-    protected void onAnimationStarted() {
-    }
-
-    /**
-     * Called when the animation has stopped.
-     */
-    protected void onAnimationEnded() {
-    }
-
-    private void startAnimation(boolean dim) {
-        if (mDimming != dim) {
-            mDimming = dim;
-            long now = System.currentTimeMillis();
-            if (!mAnimating) {
-                mAnimating = true;
-                mTargetTime = now + mDuration;
-                onAnimationStarted();
-                mHandler.post(this);
-            } else  {
-
-                // If we have started dimming, reverse the direction and adjust the target
-                // time accordingly.
-                mTargetTime = (now + mDuration) - (mTargetTime - now);
-            }
-        }
-    }
-
-    /**
-     * Animation step.
-     */
-    public void run() {
-        long now = System.currentTimeMillis();
-        long timeLeft = mTargetTime - now;
-        if (timeLeft < 0) {
-            mDimmingSpan.setAlpha(mDimming ? MIN_ALPHA : MAX_ALPHA);
-            mAnimating = false;
-            onAnimationEnded();
-            return;
-        }
-
-        // Start=1, end=0
-        float virtualTime = (float)timeLeft / mDuration;
-        if (mDimming) {
-            float interpolatedTime = DECELERATE_INTERPOLATOR.getInterpolation(virtualTime);
-            mDimmingSpan.setAlpha((int)(MIN_ALPHA + (MAX_ALPHA-MIN_ALPHA) * interpolatedTime));
-        } else {
-            float interpolatedTime = ACCELERATE_INTERPOLATOR.getInterpolation(virtualTime);
-            mDimmingSpan.setAlpha((int)(MIN_ALPHA + (MAX_ALPHA-MIN_ALPHA) * (1-interpolatedTime)));
-        }
-
-        invalidate();
-
-        // Repeat
-        mHandler.postDelayed(this, FRAME_RATE);
-    }
-}
diff --git a/src/com/android/contacts/TwelveKeyDialer.java b/src/com/android/contacts/TwelveKeyDialer.java
index 5219d99..b93375c 100644
--- a/src/com/android/contacts/TwelveKeyDialer.java
+++ b/src/com/android/contacts/TwelveKeyDialer.java
@@ -137,6 +137,8 @@
     /** Indicates if we are opening this dialer to add a call from the InCallScreen. */
     private boolean mIsAddCallMode;
 
+    private String mCurrentCountryIso;
+
     PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
             /**
              * Listen for phone state changes so that we can take down the
@@ -190,6 +192,7 @@
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
 
+        mCurrentCountryIso = ContactsUtils.getCurrentCountryIso(this);
         Resources r = getResources();
         // Do not show title in the case the device is in carmode.
         if ((r.getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) ==
@@ -268,7 +271,7 @@
     }
 
     protected void maybeAddNumberFormatting() {
-        mDigits.addTextChangedListener(new PhoneNumberFormattingTextWatcher());
+        mDigits.addTextChangedListener(new PhoneNumberFormattingTextWatcher(mCurrentCountryIso));
     }
 
     /**
@@ -308,18 +311,19 @@
                 if ("tel".equals(uri.getScheme())) {
                     // Put the requested number into the input area
                     String data = uri.getSchemeSpecificPart();
-                    setFormattedDigits(data);
+                    setFormattedDigits(data, null);
                 } else {
                     String type = intent.getType();
                     if (People.CONTENT_ITEM_TYPE.equals(type)
                             || Phones.CONTENT_ITEM_TYPE.equals(type)) {
                         // Query the phone number
                         Cursor c = getContentResolver().query(intent.getData(),
-                                new String[] {PhonesColumns.NUMBER}, null, null, null);
+                                new String[] {PhonesColumns.NUMBER, PhonesColumns.NUMBER_KEY},
+                                null, null, null);
                         if (c != null) {
                             if (c.moveToFirst()) {
                                 // Put the number into the input area
-                                setFormattedDigits(c.getString(0));
+                                setFormattedDigits(c.getString(0), c.getString(1));
                             }
                             c.close();
                         }
@@ -359,10 +363,11 @@
         return ignoreState;
     }
 
-    protected void setFormattedDigits(String data) {
+    protected void setFormattedDigits(String data, String normalizedNumber) {
         // strip the non-dialable numbers out of the data string.
         String dialString = PhoneNumberUtils.extractNetworkPortion(data);
-        dialString = PhoneNumberUtils.formatNumber(dialString);
+        dialString =
+                PhoneNumberUtils.formatNumber(dialString, normalizedNumber, mCurrentCountryIso);
         if (!TextUtils.isEmpty(dialString)) {
             Editable digits = mDigits.getText();
             digits.replace(0, digits.length(), dialString);
@@ -617,25 +622,6 @@
     public boolean onKeyUp(int keyCode, KeyEvent event) {
         switch (keyCode) {
             case KeyEvent.KEYCODE_CALL: {
-                // TODO: In dialButtonPressed we do some of these
-                // tests again. We should try to consolidate them in
-                // one place.
-                if (!phoneIsCdma() && mIsAddCallMode && isDigitsEmpty()) {
-                    // For CDMA phones, we always call
-                    // dialButtonPressed() because we may need to send
-                    // an empty flash command to the network.
-                    // Otherwise, if we are adding a call from the
-                    // InCallScreen and the phone number entered is
-                    // empty, we just close the dialer to expose the
-                    // InCallScreen under it.
-                    finish();
-                }
-
-                // If we're CDMA, regardless of where we are adding a call from (either
-                // InCallScreen or Dialtacts), the user may need to send an empty
-                // flash command to the network. So let's call dialButtonPressed() regardless
-                // and dialButtonPressed will handle this functionality for us.
-                // otherwise, we place the call.
                 dialButtonPressed();
                 return true;
             }
@@ -774,54 +760,55 @@
     }
 
     void callVoicemail() {
-        StickyTabs.saveTab(this, getIntent());
-        Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
-                Uri.fromParts("voicemail", EMPTY_NUMBER, null));
-        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        startActivity(intent);
-        mDigits.getText().clear();
+        startActivity(newVoicemailIntent());
+        mDigits.getText().clear(); // TODO: Fix bug 1745781
         finish();
     }
 
+    /**
+     * In most cases, when the dial button is pressed, there is a
+     * number in digits area. Pack it in the intent, start the
+     * outgoing call broadcast as a separate task and finish this
+     * activity.
+     *
+     * When there is no digit and the phone is CDMA and off hook,
+     * we're sending a blank flash for CDMA. CDMA networks use Flash
+     * messages when special processing needs to be done, mainly for
+     * 3-way or call waiting scenarios. Presumably, here we're in a
+     * special 3-way scenario where the network needs a blank flash
+     * before being able to add the new participant.  (This is not the
+     * case with all 3-way calls, just certain CDMA infrastructures.)
+     *
+     * Otherwise, there is no digit, display the last dialed
+     * number. Don't finish since the user may want to edit it. The
+     * user needs to press the dial button again, to dial it (general
+     * case described above).
+     */
     void dialButtonPressed() {
-        final String number = mDigits.getText().toString();
-        boolean sendEmptyFlash = false;
-        Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED);
-
-        if (isDigitsEmpty()) { // There is no number entered.
+        if (isDigitsEmpty()) { // No number entered.
             if (phoneIsCdma() && phoneIsOffhook()) {
-                // On CDMA phones, if we're already on a call, pressing
-                // the Dial button without entering any digits means "send
-                // an empty flash."
-                intent.setData(Uri.fromParts("tel", EMPTY_NUMBER, null));
-                intent.putExtra(EXTRA_SEND_EMPTY_FLASH, true);
-                sendEmptyFlash = true;
-            } else if (!TextUtils.isEmpty(mLastNumberDialed)) {
-                // Otherwise, pressing the Dial button without entering
-                // any digits means "recall the last number dialed".
-                mDigits.setText(mLastNumberDialed);
-                return;
+                // This is really CDMA specific. On GSM is it possible
+                // to be off hook and wanted to add a 3rd party using
+                // the redial feature.
+                startActivity(newFlashIntent());
             } else {
-                // Rare case: there's no "last number dialed".  There's
-                // nothing useful for the Dial button to do in this case.
-                playTone(ToneGenerator.TONE_PROP_NACK);
-                return;
+                if (!TextUtils.isEmpty(mLastNumberDialed)) {
+                    mDigits.setText(mLastNumberDialed);
+                } else {
+                    // There's no "last number dialed" or the
+                    // background query is still running. There's
+                    // nothing useful for the Dial button to do in
+                    // this case.  Note: with a soft dial button, this
+                    // can never happens since the dial button is
+                    // disabled under these conditons.
+                    playTone(ToneGenerator.TONE_PROP_NACK);
+                }
             }
-        } else {  // There is a number.
-            intent.setData(Uri.fromParts("tel", number, null));
-        }
+        } else {
+            final String number = mDigits.getText().toString();
 
-        StickyTabs.saveTab(this, getIntent());
-        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        startActivity(intent);
-        mDigits.getText().clear();
-
-        // Don't finish TwelveKeyDialer yet if we're sending a blank flash for CDMA. CDMA
-        // networks use Flash messages when special processing needs to be done, mainly for
-        // 3-way or call waiting scenarios. Presumably, here we're in a special 3-way scenario
-        // where the network needs a blank flash before being able to add the new participant.
-        // (This is not the case with all 3-way calls, just certain CDMA infrastructures.)
-        if (!sendEmptyFlash) {
+            startActivity(newDialNumberIntent(number));
+            mDigits.getText().clear();  // TODO: Fix bug 1745781
             finish();
         }
     }
@@ -1269,4 +1256,25 @@
             ContactsSearchManager.startSearch(this, initialQuery);
         }
     }
+
+    // Helpers for the call intents.
+    private Intent newVoicemailIntent() {
+        final Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
+                                         Uri.fromParts("voicemail", EMPTY_NUMBER, null));
+        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        return intent;
+    }
+
+    private Intent newFlashIntent() {
+        final Intent intent = newDialNumberIntent(EMPTY_NUMBER);
+        intent.putExtra(EXTRA_SEND_EMPTY_FLASH, true);
+        return intent;
+    }
+
+    private Intent newDialNumberIntent(String number) {
+        final Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
+                                         Uri.fromParts("tel", number, null));
+        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        return intent;
+    }
 }
diff --git a/src/com/android/contacts/ViewContactActivity.java b/src/com/android/contacts/ViewContactActivity.java
deleted file mode 100644
index eeb0a0d..0000000
--- a/src/com/android/contacts/ViewContactActivity.java
+++ /dev/null
@@ -1,1388 +0,0 @@
-/*
- * Copyright (C) 2007 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.contacts;
-import com.android.contacts.Collapser.Collapsible;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Sources;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.ui.EditContactActivity;
-import com.android.contacts.util.Constants;
-import com.android.contacts.util.DataStatus;
-import com.android.contacts.util.NotifyingAsyncQueryHandler;
-import com.android.internal.telephony.ITelephony;
-import com.android.internal.widget.ContactHeaderWidget;
-import com.google.android.collect.Lists;
-import com.google.android.collect.Maps;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.ActivityNotFoundException;
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Entity;
-import android.content.EntityIterator;
-import android.content.Intent;
-import android.content.Entity.NamedContentValues;
-import android.content.res.Resources;
-import android.database.ContentObserver;
-import android.database.Cursor;
-import android.graphics.drawable.Drawable;
-import android.net.ParseException;
-import android.net.Uri;
-import android.net.WebAddress;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.provider.ContactsContract;
-import android.provider.ContactsContract.AggregationExceptions;
-import android.provider.ContactsContract.CommonDataKinds;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.DisplayNameSources;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.RawContactsEntity;
-import android.provider.ContactsContract.StatusUpdates;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.Im;
-import android.provider.ContactsContract.CommonDataKinds.Nickname;
-import android.provider.ContactsContract.CommonDataKinds.Note;
-import android.provider.ContactsContract.CommonDataKinds.Organization;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.CommonDataKinds.SipAddress;
-import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
-import android.provider.ContactsContract.CommonDataKinds.Website;
-import android.telephony.PhoneNumberUtils;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.ContextMenu;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.view.ContextMenu.ContextMenuInfo;
-import android.widget.AdapterView;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * Displays the details of a specific contact.
- */
-public class ViewContactActivity extends Activity
-        implements View.OnCreateContextMenuListener, DialogInterface.OnClickListener,
-        AdapterView.OnItemClickListener, NotifyingAsyncQueryHandler.AsyncQueryListener {
-    private static final String TAG = "ViewContact";
-
-    private static final boolean SHOW_SEPARATORS = false;
-
-    private static final int DIALOG_CONFIRM_DELETE = 1;
-    private static final int DIALOG_CONFIRM_READONLY_DELETE = 2;
-    private static final int DIALOG_CONFIRM_MULTIPLE_DELETE = 3;
-    private static final int DIALOG_CONFIRM_READONLY_HIDE = 4;
-
-    private static final int REQUEST_JOIN_CONTACT = 1;
-    private static final int REQUEST_EDIT_CONTACT = 2;
-
-    public static final int MENU_ITEM_MAKE_DEFAULT = 3;
-    public static final int MENU_ITEM_CALL = 4;
-
-    protected Uri mLookupUri;
-    private ContentResolver mResolver;
-    private ViewAdapter mAdapter;
-    private int mNumPhoneNumbers = 0;
-
-    /**
-     * A list of distinct contact IDs included in the current contact.
-     */
-    private ArrayList<Long> mRawContactIds = new ArrayList<Long>();
-
-    /* package */ ArrayList<ViewEntry> mPhoneEntries = new ArrayList<ViewEntry>();
-    /* package */ ArrayList<ViewEntry> mSmsEntries = new ArrayList<ViewEntry>();
-    /* package */ ArrayList<ViewEntry> mEmailEntries = new ArrayList<ViewEntry>();
-    /* package */ ArrayList<ViewEntry> mPostalEntries = new ArrayList<ViewEntry>();
-    /* package */ ArrayList<ViewEntry> mImEntries = new ArrayList<ViewEntry>();
-    /* package */ ArrayList<ViewEntry> mNicknameEntries = new ArrayList<ViewEntry>();
-    /* package */ ArrayList<ViewEntry> mOrganizationEntries = new ArrayList<ViewEntry>();
-    /* package */ ArrayList<ViewEntry> mGroupEntries = new ArrayList<ViewEntry>();
-    /* package */ ArrayList<ViewEntry> mOtherEntries = new ArrayList<ViewEntry>();
-    /* package */ ArrayList<ArrayList<ViewEntry>> mSections = new ArrayList<ArrayList<ViewEntry>>();
-
-    private Cursor mCursor;
-
-    protected ContactHeaderWidget mContactHeaderWidget;
-    private NotifyingAsyncQueryHandler mHandler;
-
-    protected LayoutInflater mInflater;
-
-    protected int mReadOnlySourcesCnt;
-    protected int mWritableSourcesCnt;
-    protected boolean mAllRestricted;
-
-    protected Uri mPrimaryPhoneUri = null;
-
-    protected ArrayList<Long> mWritableRawContactIds = new ArrayList<Long>();
-
-    private static final int TOKEN_ENTITIES = 0;
-    private static final int TOKEN_STATUSES = 1;
-
-    private boolean mHasEntities = false;
-    private boolean mHasStatuses = false;
-
-    private long mNameRawContactId = -1;
-    private int mDisplayNameSource = DisplayNameSources.UNDEFINED;
-
-    private ArrayList<Entity> mEntities = Lists.newArrayList();
-    private HashMap<Long, DataStatus> mStatuses = Maps.newHashMap();
-
-    /**
-     * The view shown if the detail list is empty.
-     * We set this to the list view when first bind the adapter, so that it won't be shown while
-     * we're loading data.
-     */
-    private View mEmptyView;
-
-    private ContentObserver mObserver = new ContentObserver(new Handler()) {
-        @Override
-        public boolean deliverSelfNotifications() {
-            return true;
-        }
-
-        @Override
-        public void onChange(boolean selfChange) {
-            if (mCursor != null && !mCursor.isClosed()) {
-                startEntityQuery();
-            }
-        }
-    };
-
-    public void onClick(DialogInterface dialog, int which) {
-        closeCursor();
-        getContentResolver().delete(mLookupUri, null, null);
-        finish();
-    }
-
-    private ListView mListView;
-    private boolean mShowSmsLinksForAllPhones;
-
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        final Intent intent = getIntent();
-        Uri data = intent.getData();
-        String authority = data.getAuthority();
-        if (ContactsContract.AUTHORITY.equals(authority)) {
-            mLookupUri = data;
-        } else if (android.provider.Contacts.AUTHORITY.equals(authority)) {
-            final long rawContactId = ContentUris.parseId(data);
-            mLookupUri = RawContacts.getContactLookupUri(getContentResolver(),
-                    ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId));
-
-        }
-        mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
-        requestWindowFeature(Window.FEATURE_NO_TITLE);
-        setContentView(R.layout.contact_card_layout);
-
-        mContactHeaderWidget = (ContactHeaderWidget) findViewById(R.id.contact_header_widget);
-        mContactHeaderWidget.showStar(true);
-        mContactHeaderWidget.setExcludeMimes(new String[] {
-            Contacts.CONTENT_ITEM_TYPE
-        });
-        mContactHeaderWidget.setSelectedContactsAppTabIndex(StickyTabs.getTab(getIntent()));
-
-        mHandler = new NotifyingAsyncQueryHandler(this, this);
-
-        mListView = (ListView) findViewById(R.id.contact_data);
-        mListView.setOnCreateContextMenuListener(this);
-        mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
-        mListView.setOnItemClickListener(this);
-        // Don't set it to mListView yet.  We do so later when we bind the adapter.
-        mEmptyView = findViewById(android.R.id.empty);
-
-        mResolver = getContentResolver();
-
-        // Build the list of sections. The order they're added to mSections dictates the
-        // order they are displayed in the list.
-        mSections.add(mPhoneEntries);
-        mSections.add(mSmsEntries);
-        mSections.add(mEmailEntries);
-        mSections.add(mImEntries);
-        mSections.add(mPostalEntries);
-        mSections.add(mNicknameEntries);
-        mSections.add(mOrganizationEntries);
-        mSections.add(mGroupEntries);
-        mSections.add(mOtherEntries);
-
-        //TODO Read this value from a preference
-        mShowSmsLinksForAllPhones = true;
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        startEntityQuery();
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        closeCursor();
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        closeCursor();
-    }
-
-    @Override
-    protected Dialog onCreateDialog(int id) {
-        switch (id) {
-            case DIALOG_CONFIRM_DELETE:
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.deleteConfirmation)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .setPositiveButton(android.R.string.ok, this)
-                        .setCancelable(false)
-                        .create();
-            case DIALOG_CONFIRM_READONLY_DELETE:
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.readOnlyContactDeleteConfirmation)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .setPositiveButton(android.R.string.ok, this)
-                        .setCancelable(false)
-                        .create();
-            case DIALOG_CONFIRM_MULTIPLE_DELETE:
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.multipleContactDeleteConfirmation)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .setPositiveButton(android.R.string.ok, this)
-                        .setCancelable(false)
-                        .create();
-            case DIALOG_CONFIRM_READONLY_HIDE: {
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.readOnlyContactWarning)
-                        .setPositiveButton(android.R.string.ok, this)
-                        .create();
-            }
-
-        }
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    public void onQueryComplete(int token, Object cookie, final Cursor cursor) {
-        if (token == TOKEN_STATUSES) {
-            try {
-                // Read available social rows and consider binding
-                readStatuses(cursor);
-            } finally {
-                if (cursor != null) {
-                    cursor.close();
-                }
-            }
-            considerBindData();
-            return;
-        }
-
-        // One would think we could just iterate over the Cursor
-        // directly here, as the result set should be small, and we've
-        // already run the query in an AsyncTask, but a lot of ANRs
-        // were being reported in this code nonetheless.  See bug
-        // 2539603 for details.  The real bug which makes this result
-        // set huge and CPU-heavy may be elsewhere.
-        // TODO: if we keep this async, perhaps the entity iteration
-        // should also be original AsyncTask, rather than ping-ponging
-        // between threads like this.
-        final ArrayList<Entity> oldEntities = mEntities;
-        (new AsyncTask<Void, Void, ArrayList<Entity>>() {
-            @Override
-            protected ArrayList<Entity> doInBackground(Void... params) {
-                ArrayList<Entity> newEntities = new ArrayList<Entity>(cursor.getCount());
-                EntityIterator iterator = RawContacts.newEntityIterator(cursor);
-                try {
-                    while (iterator.hasNext()) {
-                        Entity entity = iterator.next();
-                        newEntities.add(entity);
-                    }
-                } finally {
-                    iterator.close();
-                }
-                return newEntities;
-            }
-
-            @Override
-            protected void onPostExecute(ArrayList<Entity> newEntities) {
-                if (newEntities == null) {
-                    // There was an error loading.
-                    return;
-                }
-                synchronized (ViewContactActivity.this) {
-                    if (mEntities != oldEntities) {
-                        // Multiple async tasks were in flight and we
-                        // lost the race.
-                        return;
-                    }
-                    mEntities = newEntities;
-                    mHasEntities = true;
-                }
-                considerBindData();
-            }
-        }).execute();
-    }
-
-    private long getRefreshedContactId() {
-        Uri freshContactUri = Contacts.lookupContact(getContentResolver(), mLookupUri);
-        if (freshContactUri != null) {
-            return ContentUris.parseId(freshContactUri);
-        }
-        return -1;
-    }
-
-    /**
-     * Read from the given {@link Cursor} and build a set of {@link DataStatus}
-     * objects to match any valid statuses found.
-     */
-    private synchronized void readStatuses(Cursor cursor) {
-        mStatuses.clear();
-
-        // Walk found statuses, creating internal row for each
-        while (cursor.moveToNext()) {
-            final DataStatus status = new DataStatus(cursor);
-            final long dataId = cursor.getLong(StatusQuery._ID);
-            mStatuses.put(dataId, status);
-        }
-
-        mHasStatuses = true;
-    }
-
-    private static Cursor setupContactCursor(ContentResolver resolver, Uri lookupUri) {
-        if (lookupUri == null) {
-            return null;
-        }
-        final List<String> segments = lookupUri.getPathSegments();
-        if (segments.size() != 4) {
-            return null;
-        }
-
-        // Contains an Id.
-        final long uriContactId = Long.parseLong(segments.get(3));
-        final String uriLookupKey = Uri.encode(segments.get(2));
-        final Uri dataUri = Uri.withAppendedPath(
-                ContentUris.withAppendedId(Contacts.CONTENT_URI, uriContactId),
-                Contacts.Data.CONTENT_DIRECTORY);
-
-        // This cursor has several purposes:
-        // - Fetch NAME_RAW_CONTACT_ID and DISPLAY_NAME_SOURCE
-        // - Fetch the lookup-key to ensure we are looking at the right record
-        // - Watcher for change events
-        Cursor cursor = resolver.query(dataUri,
-                new String[] {
-                    Contacts.NAME_RAW_CONTACT_ID,
-                    Contacts.DISPLAY_NAME_SOURCE,
-                    Contacts.LOOKUP_KEY
-                }, null, null, null);
-
-        if (cursor.moveToFirst()) {
-            String lookupKey =
-                    cursor.getString(cursor.getColumnIndex(Contacts.LOOKUP_KEY));
-            if (!lookupKey.equals(uriLookupKey)) {
-                // ID and lookup key do not match
-                cursor.close();
-                return null;
-            }
-            return cursor;
-        } else {
-            cursor.close();
-            return null;
-        }
-    }
-
-    private synchronized void startEntityQuery() {
-        closeCursor();
-
-        // Interprete mLookupUri
-        mCursor = setupContactCursor(mResolver, mLookupUri);
-
-        // If mCursor is null now we did not succeed in using the Uri's Id (or it didn't contain
-        // a Uri). Instead we now have to use the lookup key to find the record
-        if (mCursor == null) {
-            mLookupUri = Contacts.getLookupUri(getContentResolver(), mLookupUri);
-            mCursor = setupContactCursor(mResolver, mLookupUri);
-        }
-
-        // If mCursor is still null, we were unsuccessful in finding the record
-        if (mCursor == null) {
-            mNameRawContactId = -1;
-            mDisplayNameSource = DisplayNameSources.UNDEFINED;
-            // TODO either figure out a way to prevent a flash of black background or
-            // use some other UI than a toast
-            Toast.makeText(this, R.string.invalidContactMessage, Toast.LENGTH_SHORT).show();
-            Log.e(TAG, "invalid contact uri: " + mLookupUri);
-            finish();
-            return;
-        }
-
-        final long contactId = ContentUris.parseId(mLookupUri);
-
-        mNameRawContactId =
-                mCursor.getLong(mCursor.getColumnIndex(Contacts.NAME_RAW_CONTACT_ID));
-        mDisplayNameSource =
-                mCursor.getInt(mCursor.getColumnIndex(Contacts.DISPLAY_NAME_SOURCE));
-
-        mCursor.registerContentObserver(mObserver);
-
-        // Clear flags and start queries to data and status
-        mHasEntities = false;
-        mHasStatuses = false;
-
-        mHandler.startQuery(TOKEN_ENTITIES, null, RawContactsEntity.CONTENT_URI, null,
-                RawContacts.CONTACT_ID + "=?", new String[] {
-                    String.valueOf(contactId)
-                }, null);
-        final Uri dataUri = Uri.withAppendedPath(
-                ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId),
-                Contacts.Data.CONTENT_DIRECTORY);
-        mHandler.startQuery(TOKEN_STATUSES, null, dataUri, StatusQuery.PROJECTION,
-                        StatusUpdates.PRESENCE + " IS NOT NULL OR " + StatusUpdates.STATUS
-                                + " IS NOT NULL", null, null);
-
-        mContactHeaderWidget.bindFromContactLookupUri(mLookupUri);
-    }
-
-    private void closeCursor() {
-        if (mCursor != null) {
-            mCursor.unregisterContentObserver(mObserver);
-            mCursor.close();
-            mCursor = null;
-        }
-    }
-
-    /**
-     * Consider binding views after any of several background queries has
-     * completed. We check internal flags and only bind when all data has
-     * arrived.
-     */
-    private void considerBindData() {
-        if (mHasEntities && mHasStatuses) {
-            bindData();
-        }
-    }
-
-    private void bindData() {
-
-        // Build up the contact entries
-        buildEntries();
-
-        // Collapse similar data items in select sections.
-        Collapser.collapseList(mPhoneEntries);
-        Collapser.collapseList(mSmsEntries);
-        Collapser.collapseList(mEmailEntries);
-        Collapser.collapseList(mPostalEntries);
-        Collapser.collapseList(mImEntries);
-
-        if (mAdapter == null) {
-            mAdapter = new ViewAdapter(this, mSections);
-            mListView.setAdapter(mAdapter);
-        } else {
-            mAdapter.setSections(mSections, SHOW_SEPARATORS);
-        }
-        mListView.setEmptyView(mEmptyView);
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        super.onCreateOptionsMenu(menu);
-
-        final MenuInflater inflater = getMenuInflater();
-        inflater.inflate(R.menu.view, menu);
-        return true;
-    }
-
-    @Override
-    public boolean onPrepareOptionsMenu(Menu menu) {
-        super.onPrepareOptionsMenu(menu);
-
-        // Only allow edit when we have at least one raw_contact id
-        final boolean hasRawContact = (mRawContactIds.size() > 0);
-        menu.findItem(R.id.menu_edit).setEnabled(hasRawContact);
-
-        // Only allow share when unrestricted contacts available
-        menu.findItem(R.id.menu_share).setEnabled(!mAllRestricted);
-
-        return true;
-    }
-
-    @Override
-    public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
-        AdapterView.AdapterContextMenuInfo info;
-        try {
-             info = (AdapterView.AdapterContextMenuInfo) menuInfo;
-        } catch (ClassCastException e) {
-            Log.e(TAG, "bad menuInfo", e);
-            return;
-        }
-
-        // This can be null sometimes, don't crash...
-        if (info == null) {
-            Log.e(TAG, "bad menuInfo");
-            return;
-        }
-
-        ViewEntry entry = ContactEntryAdapter.getEntry(mSections, info.position, SHOW_SEPARATORS);
-        menu.setHeaderTitle(R.string.contactOptionsTitle);
-        if (entry.mimetype.equals(CommonDataKinds.Phone.CONTENT_ITEM_TYPE)) {
-            menu.add(0, MENU_ITEM_CALL, 0, R.string.menu_call).setIntent(entry.intent);
-            menu.add(0, 0, 0, R.string.menu_sendSMS).setIntent(entry.secondaryIntent);
-            if (!entry.isPrimary) {
-                menu.add(0, MENU_ITEM_MAKE_DEFAULT, 0, R.string.menu_makeDefaultNumber);
-            }
-        } else if (entry.mimetype.equals(CommonDataKinds.Email.CONTENT_ITEM_TYPE)) {
-            menu.add(0, 0, 0, R.string.menu_sendEmail).setIntent(entry.intent);
-            if (!entry.isPrimary) {
-                menu.add(0, MENU_ITEM_MAKE_DEFAULT, 0, R.string.menu_makeDefaultEmail);
-            }
-        } else if (entry.mimetype.equals(CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE)) {
-            menu.add(0, 0, 0, R.string.menu_viewAddress).setIntent(entry.intent);
-        }
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case R.id.menu_edit: {
-                Long rawContactIdToEdit = null;
-                if (mRawContactIds.size() > 0) {
-                    rawContactIdToEdit = mRawContactIds.get(0);
-                } else {
-                    // There is no rawContact to edit.
-                    break;
-                }
-                Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI,
-                        rawContactIdToEdit);
-                startActivityForResult(new Intent(Intent.ACTION_EDIT, rawContactUri),
-                        REQUEST_EDIT_CONTACT);
-                break;
-            }
-            case R.id.menu_delete: {
-                // Get confirmation
-                if (mReadOnlySourcesCnt > 0 & mWritableSourcesCnt > 0) {
-                    showDialog(DIALOG_CONFIRM_READONLY_DELETE);
-                } else if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt == 0) {
-                    showDialog(DIALOG_CONFIRM_READONLY_HIDE);
-                } else if (mReadOnlySourcesCnt == 0 && mWritableSourcesCnt > 1) {
-                    showDialog(DIALOG_CONFIRM_MULTIPLE_DELETE);
-                } else {
-                    showDialog(DIALOG_CONFIRM_DELETE);
-                }
-                return true;
-            }
-            case R.id.menu_join: {
-                showJoinAggregateActivity();
-                return true;
-            }
-            case R.id.menu_options: {
-                showOptionsActivity();
-                return true;
-            }
-            case R.id.menu_share: {
-                if (mAllRestricted) return false;
-
-                // TODO: Keep around actual LOOKUP_KEY, or formalize method of extracting
-                final String lookupKey = Uri.encode(mLookupUri.getPathSegments().get(2));
-                final Uri shareUri = Uri.withAppendedPath(Contacts.CONTENT_VCARD_URI, lookupKey);
-
-                final Intent intent = new Intent(Intent.ACTION_SEND);
-                intent.setType(Contacts.CONTENT_VCARD_TYPE);
-                intent.putExtra(Intent.EXTRA_STREAM, shareUri);
-
-                // Launch chooser to share contact via
-                final CharSequence chooseTitle = getText(R.string.share_via);
-                final Intent chooseIntent = Intent.createChooser(intent, chooseTitle);
-
-                try {
-                    startActivity(chooseIntent);
-                } catch (ActivityNotFoundException ex) {
-                    Toast.makeText(this, R.string.share_error, Toast.LENGTH_SHORT).show();
-                }
-                return true;
-            }
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    @Override
-    public boolean onContextItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case MENU_ITEM_MAKE_DEFAULT: {
-                makeItemDefault(item);
-                return true;
-            }
-            case MENU_ITEM_CALL: {
-                StickyTabs.saveTab(this, getIntent());
-                startActivity(item.getIntent());
-                return true;
-            }
-            default: {
-                return super.onContextItemSelected(item);
-            }
-        }
-    }
-
-    private boolean makeItemDefault(MenuItem item) {
-        ViewEntry entry = getViewEntryForMenuItem(item);
-        if (entry == null) {
-            return false;
-        }
-
-        // Update the primary values in the data record.
-        ContentValues values = new ContentValues(1);
-        values.put(Data.IS_SUPER_PRIMARY, 1);
-        getContentResolver().update(ContentUris.withAppendedId(Data.CONTENT_URI, entry.id),
-                values, null, null);
-        startEntityQuery();
-        return true;
-    }
-
-    /**
-     * Shows a list of aggregates that can be joined into the currently viewed aggregate.
-     */
-    public void showJoinAggregateActivity() {
-        long freshId = getRefreshedContactId();
-        if (freshId > 0) {
-            String displayName = null;
-            if (mCursor.moveToFirst()) {
-                displayName = mCursor.getString(0);
-            }
-            Intent intent = new Intent(ContactsListActivity.JOIN_AGGREGATE);
-            intent.putExtra(ContactsListActivity.EXTRA_AGGREGATE_ID, freshId);
-            if (displayName != null) {
-                intent.putExtra(ContactsListActivity.EXTRA_AGGREGATE_NAME, displayName);
-            }
-            startActivityForResult(intent, REQUEST_JOIN_CONTACT);
-        }
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
-        if (requestCode == REQUEST_JOIN_CONTACT) {
-            if (resultCode == RESULT_OK && intent != null) {
-                final long contactId = ContentUris.parseId(intent.getData());
-                joinAggregate(contactId);
-            }
-        } else if (requestCode == REQUEST_EDIT_CONTACT) {
-            if (resultCode == EditContactActivity.RESULT_CLOSE_VIEW_ACTIVITY) {
-                finish();
-            } else if (resultCode == Activity.RESULT_OK) {
-                mLookupUri = intent.getData();
-                if (mLookupUri == null) {
-                    finish();
-                }
-            }
-        }
-    }
-
-    private void joinAggregate(final long contactId) {
-        Cursor c = mResolver.query(RawContacts.CONTENT_URI, new String[] {RawContacts._ID},
-                RawContacts.CONTACT_ID + "=" + contactId, null, null);
-
-        try {
-            while(c.moveToNext()) {
-                long rawContactId = c.getLong(0);
-                setAggregationException(rawContactId, AggregationExceptions.TYPE_KEEP_TOGETHER);
-            }
-        } finally {
-            c.close();
-        }
-
-        Toast.makeText(this, R.string.contactsJoinedMessage, Toast.LENGTH_LONG).show();
-        startEntityQuery();
-    }
-
-    /**
-     * Given a contact ID sets an aggregation exception to either join the contact with the
-     * current aggregate or split off.
-     */
-    protected void setAggregationException(long rawContactId, int exceptionType) {
-        ContentValues values = new ContentValues(3);
-        for (long aRawContactId : mRawContactIds) {
-            if (aRawContactId != rawContactId) {
-                values.put(AggregationExceptions.RAW_CONTACT_ID1, aRawContactId);
-                values.put(AggregationExceptions.RAW_CONTACT_ID2, rawContactId);
-                values.put(AggregationExceptions.TYPE, exceptionType);
-                mResolver.update(AggregationExceptions.CONTENT_URI, values, null, null);
-            }
-        }
-    }
-
-    private void showOptionsActivity() {
-        final Intent intent = new Intent(this, ContactOptionsActivity.class);
-        intent.setData(mLookupUri);
-        startActivity(intent);
-    }
-
-    private ViewEntry getViewEntryForMenuItem(MenuItem item) {
-        AdapterView.AdapterContextMenuInfo info;
-        try {
-             info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
-        } catch (ClassCastException e) {
-            Log.e(TAG, "bad menuInfo", e);
-            return null;
-        }
-
-        return ContactEntryAdapter.getEntry(mSections, info.position, SHOW_SEPARATORS);
-    }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        switch (keyCode) {
-            case KeyEvent.KEYCODE_CALL: {
-                try {
-                    ITelephony phone = ITelephony.Stub.asInterface(
-                            ServiceManager.checkService("phone"));
-                    if (phone != null && !phone.isIdle()) {
-                        // Skip out and let the key be handled at a higher level
-                        break;
-                    }
-                } catch (RemoteException re) {
-                    // Fall through and try to call the contact
-                }
-
-                int index = mListView.getSelectedItemPosition();
-                if (index != -1) {
-                    ViewEntry entry = ViewAdapter.getEntry(mSections, index, SHOW_SEPARATORS);
-                    if (entry != null && entry.intent != null &&
-                            entry.intent.getAction() == Intent.ACTION_CALL_PRIVILEGED) {
-                        startActivity(entry.intent);
-                        StickyTabs.saveTab(this, getIntent());
-                        return true;
-                    }
-                } else if (mPrimaryPhoneUri != null) {
-                    // There isn't anything selected, call the default number
-                    final Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
-                            mPrimaryPhoneUri);
-                    startActivity(intent);
-                    StickyTabs.saveTab(this, getIntent());
-                    return true;
-                }
-                return false;
-            }
-
-            case KeyEvent.KEYCODE_DEL: {
-                if (mReadOnlySourcesCnt > 0 & mWritableSourcesCnt > 0) {
-                    showDialog(DIALOG_CONFIRM_READONLY_DELETE);
-                } else if (mReadOnlySourcesCnt > 0 && mWritableSourcesCnt == 0) {
-                    showDialog(DIALOG_CONFIRM_READONLY_HIDE);
-                } else if (mReadOnlySourcesCnt == 0 && mWritableSourcesCnt > 1) {
-                    showDialog(DIALOG_CONFIRM_MULTIPLE_DELETE);
-                } else {
-                    showDialog(DIALOG_CONFIRM_DELETE);
-                }
-                return true;
-            }
-        }
-
-        return super.onKeyDown(keyCode, event);
-    }
-
-    public void onItemClick(AdapterView parent, View v, int position, long id) {
-        ViewEntry entry = ViewAdapter.getEntry(mSections, position, SHOW_SEPARATORS);
-        if (entry != null) {
-            Intent intent = entry.intent;
-            if (intent != null) {
-                if (Intent.ACTION_CALL_PRIVILEGED.equals(intent.getAction())) {
-                    StickyTabs.saveTab(this, getIntent());
-                }
-                try {
-                    startActivity(intent);
-                } catch (ActivityNotFoundException e) {
-                    Log.e(TAG, "No activity found for intent: " + intent);
-                    signalError();
-                }
-            } else {
-                signalError();
-            }
-        } else {
-            signalError();
-        }
-    }
-
-    /**
-     * Signal an error to the user via a beep, or some other method.
-     */
-    private void signalError() {
-        //TODO: implement this when we have the sonification APIs
-    }
-
-    /**
-     * Build up the entries to display on the screen.
-     *
-     * @param personCursor the URI for the contact being displayed
-     */
-    private final void buildEntries() {
-        // Clear out the old entries
-        final int numSections = mSections.size();
-        for (int i = 0; i < numSections; i++) {
-            mSections.get(i).clear();
-        }
-
-        mRawContactIds.clear();
-
-        mReadOnlySourcesCnt = 0;
-        mWritableSourcesCnt = 0;
-        mAllRestricted = true;
-        mPrimaryPhoneUri = null;
-
-        mWritableRawContactIds.clear();
-
-        final Context context = this;
-        final Sources sources = Sources.getInstance(context);
-
-        // Build up method entries
-        if (mLookupUri != null) {
-            for (Entity entity: mEntities) {
-                final ContentValues entValues = entity.getEntityValues();
-                final String accountType = entValues.getAsString(RawContacts.ACCOUNT_TYPE);
-                final long rawContactId = entValues.getAsLong(RawContacts._ID);
-
-                // Mark when this contact has any unrestricted components
-                final boolean isRestricted = entValues.getAsInteger(RawContacts.IS_RESTRICTED) != 0;
-                if (!isRestricted) mAllRestricted = false;
-
-                if (!mRawContactIds.contains(rawContactId)) {
-                    mRawContactIds.add(rawContactId);
-                }
-                ContactsSource contactsSource = sources.getInflatedSource(accountType,
-                        ContactsSource.LEVEL_SUMMARY);
-                if (contactsSource != null && contactsSource.readOnly) {
-                    mReadOnlySourcesCnt += 1;
-                } else {
-                    mWritableSourcesCnt += 1;
-                    mWritableRawContactIds.add(rawContactId);
-                }
-
-
-                for (NamedContentValues subValue : entity.getSubValues()) {
-                    final ContentValues entryValues = subValue.values;
-                    entryValues.put(Data.RAW_CONTACT_ID, rawContactId);
-
-                    final long dataId = entryValues.getAsLong(Data._ID);
-                    final String mimeType = entryValues.getAsString(Data.MIMETYPE);
-                    if (mimeType == null) continue;
-
-                    final DataKind kind = sources.getKindOrFallback(accountType, mimeType, this,
-                            ContactsSource.LEVEL_MIMETYPES);
-                    if (kind == null) continue;
-
-                    final ViewEntry entry = ViewEntry.fromValues(context, mimeType, kind,
-                            rawContactId, dataId, entryValues);
-
-                    final boolean hasData = !TextUtils.isEmpty(entry.data);
-                    final boolean isSuperPrimary = entryValues.getAsInteger(
-                            Data.IS_SUPER_PRIMARY) != 0;
-
-                    if (Phone.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
-                        // Build phone entries
-                        mNumPhoneNumbers++;
-
-                        entry.intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
-                                Uri.fromParts(Constants.SCHEME_TEL, entry.data, null));
-                        entry.secondaryIntent = new Intent(Intent.ACTION_SENDTO,
-                                Uri.fromParts(Constants.SCHEME_SMSTO, entry.data, null));
-
-                        // Remember super-primary phone
-                        if (isSuperPrimary) mPrimaryPhoneUri = entry.uri;
-
-                        entry.isPrimary = isSuperPrimary;
-                        mPhoneEntries.add(entry);
-
-                        if (entry.type == CommonDataKinds.Phone.TYPE_MOBILE
-                                || mShowSmsLinksForAllPhones) {
-                            // Add an SMS entry
-                            if (kind.iconAltRes > 0) {
-                                entry.secondaryActionIcon = kind.iconAltRes;
-                            }
-                        }
-                    } else if (Email.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
-                        // Build email entries
-                        entry.intent = new Intent(Intent.ACTION_SENDTO,
-                                Uri.fromParts(Constants.SCHEME_MAILTO, entry.data, null));
-                        entry.isPrimary = isSuperPrimary;
-                        mEmailEntries.add(entry);
-
-                        // When Email rows have status, create additional Im row
-                        final DataStatus status = mStatuses.get(entry.id);
-                        if (status != null) {
-                            final String imMime = Im.CONTENT_ITEM_TYPE;
-                            final DataKind imKind = sources.getKindOrFallback(accountType,
-                                    imMime, this, ContactsSource.LEVEL_MIMETYPES);
-                            final ViewEntry imEntry = ViewEntry.fromValues(context,
-                                    imMime, imKind, rawContactId, dataId, entryValues);
-                            imEntry.intent = ContactsUtils.buildImIntent(entryValues);
-                            imEntry.applyStatus(status, false);
-                            mImEntries.add(imEntry);
-                        }
-                    } else if (StructuredPostal.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
-                        // Build postal entries
-                        entry.maxLines = 4;
-                        entry.intent = new Intent(Intent.ACTION_VIEW, entry.uri);
-                        mPostalEntries.add(entry);
-                    } else if (Im.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
-                        // Build IM entries
-                        entry.intent = ContactsUtils.buildImIntent(entryValues);
-                        if (TextUtils.isEmpty(entry.label)) {
-                            entry.label = getString(R.string.chat).toLowerCase();
-                        }
-
-                        // Apply presence and status details when available
-                        final DataStatus status = mStatuses.get(entry.id);
-                        if (status != null) {
-                            entry.applyStatus(status, false);
-                        }
-                        mImEntries.add(entry);
-                    } else if (Organization.CONTENT_ITEM_TYPE.equals(mimeType) &&
-                            (hasData || !TextUtils.isEmpty(entry.label))) {
-                        // Build organization entries
-                        final boolean isNameRawContact = (mNameRawContactId == rawContactId);
-
-                        final boolean duplicatesTitle =
-                            isNameRawContact
-                            && mDisplayNameSource == DisplayNameSources.ORGANIZATION
-                            && (!hasData || TextUtils.isEmpty(entry.label));
-
-                        if (!duplicatesTitle) {
-                            entry.uri = null;
-
-                            if (TextUtils.isEmpty(entry.label)) {
-                                entry.label = entry.data;
-                                entry.data = "";
-                            }
-
-                            mOrganizationEntries.add(entry);
-                        }
-                    } else if (Nickname.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
-                        // Build nickname entries
-                        final boolean isNameRawContact = (mNameRawContactId == rawContactId);
-
-                        final boolean duplicatesTitle =
-                            isNameRawContact
-                            && mDisplayNameSource == DisplayNameSources.NICKNAME;
-
-                        if (!duplicatesTitle) {
-                            entry.uri = null;
-                            mNicknameEntries.add(entry);
-                        }
-                    } else if (Note.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
-                        // Build note entries
-                        entry.uri = null;
-                        entry.maxLines = 100;
-                        mOtherEntries.add(entry);
-                    } else if (Website.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
-                        // Build Website entries
-                        entry.uri = null;
-                        entry.maxLines = 10;
-                        try {
-                            WebAddress webAddress = new WebAddress(entry.data);
-                            entry.intent = new Intent(Intent.ACTION_VIEW,
-                                    Uri.parse(webAddress.toString()));
-                        } catch (ParseException e) {
-                            Log.e(TAG, "Couldn't parse website: " + entry.data);
-                        }
-                        mOtherEntries.add(entry);
-                    } else if (SipAddress.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
-                        // Build SipAddress entries
-                        entry.uri = null;
-                        entry.maxLines = 1;
-                        entry.intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
-                                Uri.fromParts(Constants.SCHEME_SIP, entry.data, null));
-                        mOtherEntries.add(entry);
-                        // TODO: Consider moving the SipAddress into its own
-                        // section (rather than lumping it in with mOtherEntries)
-                        // so that we can reposition it right under the phone number.
-                        // (Then, we'd also update FallbackSource.java to set
-                        // secondary=false for this field, and tweak the weight
-                        // of its DataKind.)
-                    } else {
-                        // Handle showing custom rows
-                        entry.intent = new Intent(Intent.ACTION_VIEW, entry.uri);
-
-                        // Use social summary when requested by external source
-                        final DataStatus status = mStatuses.get(entry.id);
-                        final boolean hasSocial = kind.actionBodySocial && status != null;
-                        if (hasSocial) {
-                            entry.applyStatus(status, true);
-                        }
-
-                        if (hasSocial || hasData) {
-                            mOtherEntries.add(entry);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    static String buildActionString(DataKind kind, ContentValues values, boolean lowerCase,
-            Context context) {
-        if (kind.actionHeader == null) {
-            return null;
-        }
-        CharSequence actionHeader = kind.actionHeader.inflateUsing(context, values);
-        if (actionHeader == null) {
-            return null;
-        }
-        return lowerCase ? actionHeader.toString().toLowerCase() : actionHeader.toString();
-    }
-
-    static String buildDataString(DataKind kind, ContentValues values, Context context) {
-        if (kind.actionBody == null) {
-            return null;
-        }
-        CharSequence actionBody = kind.actionBody.inflateUsing(context, values);
-        return actionBody == null ? null : actionBody.toString();
-    }
-
-    /**
-     * A basic structure with the data for a contact entry in the list.
-     */
-    static class ViewEntry extends ContactEntryAdapter.Entry implements Collapsible<ViewEntry> {
-        public Context context = null;
-        public String resPackageName = null;
-        public int actionIcon = -1;
-        public boolean isPrimary = false;
-        public int secondaryActionIcon = -1;
-        public Intent intent;
-        public Intent secondaryIntent = null;
-        public int maxLabelLines = 1;
-        public ArrayList<Long> ids = new ArrayList<Long>();
-        public int collapseCount = 0;
-
-        public int presence = -1;
-
-        public CharSequence footerLine = null;
-
-        private ViewEntry() {
-        }
-
-        /**
-         * Build new {@link ViewEntry} and populate from the given values.
-         */
-        public static ViewEntry fromValues(Context context, String mimeType, DataKind kind,
-                long rawContactId, long dataId, ContentValues values) {
-            final ViewEntry entry = new ViewEntry();
-            entry.context = context;
-            entry.contactId = rawContactId;
-            entry.id = dataId;
-            entry.uri = ContentUris.withAppendedId(Data.CONTENT_URI, entry.id);
-            entry.mimetype = mimeType;
-            entry.label = buildActionString(kind, values, false, context);
-            entry.data = buildDataString(kind, values, context);
-
-            if (kind.typeColumn != null && values.containsKey(kind.typeColumn)) {
-                entry.type = values.getAsInteger(kind.typeColumn);
-            }
-            if (kind.iconRes > 0) {
-                entry.resPackageName = kind.resPackageName;
-                entry.actionIcon = kind.iconRes;
-            }
-
-            return entry;
-        }
-
-        /**
-         * Apply given {@link DataStatus} values over this {@link ViewEntry}
-         *
-         * @param fillData When true, the given status replaces {@link #data}
-         *            and {@link #footerLine}. Otherwise only {@link #presence}
-         *            is updated.
-         */
-        public ViewEntry applyStatus(DataStatus status, boolean fillData) {
-            presence = status.getPresence();
-            if (fillData && status.isValid()) {
-                this.data = status.getStatus().toString();
-                this.footerLine = status.getTimestampLabel(context);
-            }
-
-            return this;
-        }
-
-        public boolean collapseWith(ViewEntry entry) {
-            // assert equal collapse keys
-            if (!shouldCollapseWith(entry)) {
-                return false;
-            }
-
-            // Choose the label associated with the highest type precedence.
-            if (TypePrecedence.getTypePrecedence(mimetype, type)
-                    > TypePrecedence.getTypePrecedence(entry.mimetype, entry.type)) {
-                type = entry.type;
-                label = entry.label;
-            }
-
-            // Choose the max of the maxLines and maxLabelLines values.
-            maxLines = Math.max(maxLines, entry.maxLines);
-            maxLabelLines = Math.max(maxLabelLines, entry.maxLabelLines);
-
-            // Choose the presence with the highest precedence.
-            if (StatusUpdates.getPresencePrecedence(presence)
-                    < StatusUpdates.getPresencePrecedence(entry.presence)) {
-                presence = entry.presence;
-            }
-
-            // If any of the collapsed entries are primary make the whole thing primary.
-            isPrimary = entry.isPrimary ? true : isPrimary;
-
-            // uri, and contactdId, shouldn't make a difference. Just keep the original.
-
-            // Keep track of all the ids that have been collapsed with this one.
-            ids.add(entry.id);
-            collapseCount++;
-            return true;
-        }
-
-        public boolean shouldCollapseWith(ViewEntry entry) {
-            if (entry == null) {
-                return false;
-            }
-
-            if (!ContactsUtils.shouldCollapse(context, mimetype, data, entry.mimetype,
-                    entry.data)) {
-                return false;
-            }
-
-            if (!TextUtils.equals(mimetype, entry.mimetype)
-                    || !ContactsUtils.areIntentActionEqual(intent, entry.intent)
-                    || !ContactsUtils.areIntentActionEqual(secondaryIntent, entry.secondaryIntent)
-                    || actionIcon != entry.actionIcon) {
-                return false;
-            }
-
-            return true;
-        }
-    }
-
-    /** Cache of the children views of a row */
-    static class ViewCache {
-        public TextView label;
-        public TextView data;
-        public TextView footer;
-        public ImageView actionIcon;
-        public ImageView presenceIcon;
-        public ImageView primaryIcon;
-        public ImageView secondaryActionButton;
-        public View secondaryActionDivider;
-
-        // Need to keep track of this too
-        ViewEntry entry;
-    }
-
-    private final class ViewAdapter extends ContactEntryAdapter<ViewEntry>
-            implements View.OnClickListener {
-
-
-        ViewAdapter(Context context, ArrayList<ArrayList<ViewEntry>> sections) {
-            super(context, sections, SHOW_SEPARATORS);
-        }
-
-        public void onClick(View v) {
-            Intent intent = (Intent) v.getTag();
-            startActivity(intent);
-        }
-
-        @Override
-        public View getView(int position, View convertView, ViewGroup parent) {
-            ViewEntry entry = getEntry(mSections, position, false);
-            View v;
-
-            ViewCache views;
-
-            // Check to see if we can reuse convertView
-            if (convertView != null) {
-                v = convertView;
-                views = (ViewCache) v.getTag();
-            } else {
-                // Create a new view if needed
-                v = mInflater.inflate(R.layout.list_item_text_icons, parent, false);
-
-                // Cache the children
-                views = new ViewCache();
-                views.label = (TextView) v.findViewById(android.R.id.text1);
-                views.data = (TextView) v.findViewById(android.R.id.text2);
-                views.footer = (TextView) v.findViewById(R.id.footer);
-                views.actionIcon = (ImageView) v.findViewById(R.id.action_icon);
-                views.primaryIcon = (ImageView) v.findViewById(R.id.primary_icon);
-                views.presenceIcon = (ImageView) v.findViewById(R.id.presence_icon);
-                views.secondaryActionButton = (ImageView) v.findViewById(
-                        R.id.secondary_action_button);
-                views.secondaryActionButton.setOnClickListener(this);
-                views.secondaryActionDivider = v.findViewById(R.id.divider);
-                v.setTag(views);
-            }
-
-            // Update the entry in the view cache
-            views.entry = entry;
-
-            // Bind the data to the view
-            bindView(v, entry);
-            return v;
-        }
-
-        @Override
-        protected View newView(int position, ViewGroup parent) {
-            // getView() handles this
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        protected void bindView(View view, ViewEntry entry) {
-            final Resources resources = mContext.getResources();
-            ViewCache views = (ViewCache) view.getTag();
-
-            // Set the label
-            TextView label = views.label;
-            setMaxLines(label, entry.maxLabelLines);
-            label.setText(entry.label);
-
-            // Set the data
-            TextView data = views.data;
-            if (data != null) {
-                if (entry.mimetype.equals(Phone.CONTENT_ITEM_TYPE)
-                        || entry.mimetype.equals(Constants.MIME_SMS_ADDRESS)) {
-                    data.setText(PhoneNumberUtils.formatNumber(entry.data));
-                } else {
-                    data.setText(entry.data);
-                }
-                setMaxLines(data, entry.maxLines);
-            }
-
-            // Set the footer
-            if (!TextUtils.isEmpty(entry.footerLine)) {
-                views.footer.setText(entry.footerLine);
-                views.footer.setVisibility(View.VISIBLE);
-            } else {
-                views.footer.setVisibility(View.GONE);
-            }
-
-            // Set the primary icon
-            views.primaryIcon.setVisibility(entry.isPrimary ? View.VISIBLE : View.GONE);
-
-            // Set the action icon
-            ImageView action = views.actionIcon;
-            if (entry.actionIcon != -1) {
-                Drawable actionIcon;
-                if (entry.resPackageName != null) {
-                    // Load external resources through PackageManager
-                    actionIcon = mContext.getPackageManager().getDrawable(entry.resPackageName,
-                            entry.actionIcon, null);
-                } else {
-                    actionIcon = resources.getDrawable(entry.actionIcon);
-                }
-                action.setImageDrawable(actionIcon);
-                action.setVisibility(View.VISIBLE);
-            } else {
-                // Things should still line up as if there was an icon, so make it invisible
-                action.setVisibility(View.INVISIBLE);
-            }
-
-            // Set the presence icon
-            Drawable presenceIcon = ContactPresenceIconUtil.getPresenceIcon(
-                    mContext, entry.presence);
-            ImageView presenceIconView = views.presenceIcon;
-            if (presenceIcon != null) {
-                presenceIconView.setImageDrawable(presenceIcon);
-                presenceIconView.setVisibility(View.VISIBLE);
-            } else {
-                presenceIconView.setVisibility(View.GONE);
-            }
-
-            // Set the secondary action button
-            ImageView secondaryActionView = views.secondaryActionButton;
-            Drawable secondaryActionIcon = null;
-            if (entry.secondaryActionIcon != -1) {
-                secondaryActionIcon = resources.getDrawable(entry.secondaryActionIcon);
-            }
-            if (entry.secondaryIntent != null && secondaryActionIcon != null) {
-                secondaryActionView.setImageDrawable(secondaryActionIcon);
-                secondaryActionView.setTag(entry.secondaryIntent);
-                secondaryActionView.setVisibility(View.VISIBLE);
-                views.secondaryActionDivider.setVisibility(View.VISIBLE);
-            } else {
-                secondaryActionView.setVisibility(View.GONE);
-                views.secondaryActionDivider.setVisibility(View.GONE);
-            }
-        }
-
-        private void setMaxLines(TextView textView, int maxLines) {
-            if (maxLines == 1) {
-                textView.setSingleLine(true);
-                textView.setEllipsize(TextUtils.TruncateAt.END);
-            } else {
-                textView.setSingleLine(false);
-                textView.setMaxLines(maxLines);
-                textView.setEllipsize(null);
-            }
-        }
-    }
-
-    private interface StatusQuery {
-        final String[] PROJECTION = new String[] {
-                Data._ID,
-                Data.STATUS,
-                Data.STATUS_RES_PACKAGE,
-                Data.STATUS_ICON,
-                Data.STATUS_LABEL,
-                Data.STATUS_TIMESTAMP,
-                Data.PRESENCE,
-        };
-
-        final int _ID = 0;
-    }
-
-    @Override
-    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
-            boolean globalSearch) {
-        if (globalSearch) {
-            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
-        } else {
-            ContactsSearchManager.startSearch(this, initialQuery);
-        }
-    }
-}
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
new file mode 100644
index 0000000..78c968a
--- /dev/null
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -0,0 +1,220 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.activities;
+
+import com.android.contacts.R;
+import com.android.contacts.list.ContactListFilterController;
+import com.android.contacts.list.ContactListFilterController.ContactListFilterListener;
+import com.android.contacts.list.ContactListFilterView;
+import com.android.contacts.list.ContactsRequest;
+
+import android.app.ActionBar;
+import android.content.Context;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.SearchView;
+import android.widget.SearchView.OnCloseListener;
+import android.widget.SearchView.OnQueryChangeListener;
+import android.widget.TextView;
+
+/**
+ * Adapter for the action bar at the top of the Contacts activity.
+ */
+public class ActionBarAdapter
+        implements OnQueryChangeListener, OnCloseListener, ContactListFilterListener {
+
+    public interface Listener {
+        void onAction();
+    }
+
+    private static final String EXTRA_KEY_SEARCH_MODE = "navBar.searchMode";
+    private static final String EXTRA_KEY_QUERY = "navBar.query";
+
+    private static final String KEY_MODE_DEFAULT = "mode_default";
+    private static final String KEY_MODE_SEARCH = "mode_search";
+
+    private boolean mSearchMode;
+    private String mQueryString;
+    private Bundle mSavedStateForSearchMode;
+    private Bundle mSavedStateForDefaultMode;
+
+    private View mNavigationBar;
+    private TextView mSearchLabel;
+    private SearchView mSearchView;
+
+    private final Context mContext;
+
+    private Listener mListener;
+    private ContactListFilterView mFilterView;
+    private View mFilterIndicator;
+    private ContactListFilterController mFilterController;
+    private View mFilterContainer;
+
+    public ActionBarAdapter(Context context) {
+        mContext = context;
+    }
+
+    public void onCreate(Bundle savedState, ContactsRequest request, ActionBar actionBar) {
+        mQueryString = null;
+        if (savedState != null) {
+            mSearchMode = savedState.getBoolean(EXTRA_KEY_SEARCH_MODE);
+            mQueryString = savedState.getString(EXTRA_KEY_QUERY);
+            mSavedStateForDefaultMode = savedState.getParcelable(KEY_MODE_DEFAULT);
+            mSavedStateForSearchMode = savedState.getParcelable(KEY_MODE_SEARCH);
+        } else {
+            mSearchMode = request.isSearchMode();
+            mQueryString = request.getQueryString();
+        }
+
+        mNavigationBar = LayoutInflater.from(mContext).inflate(R.layout.navigation_bar, null);
+        actionBar.setCustomNavigationMode(mNavigationBar);
+
+        mFilterContainer = mNavigationBar.findViewById(R.id.filter_container);
+        mFilterView = (ContactListFilterView) mNavigationBar.findViewById(R.id.filter_view);
+        mSearchLabel = (TextView) mNavigationBar.findViewById(R.id.search_label);
+        mFilterIndicator = mNavigationBar.findViewById(R.id.filter_indicator);
+        mSearchView = (SearchView) mNavigationBar.findViewById(R.id.search_view);
+
+        mSearchView.setIconifiedByDefault(false);
+        mSearchView.setOnQueryChangeListener(this);
+        mSearchView.setOnCloseListener(this);
+        mSearchView.setQuery(mQueryString, false);
+
+        update();
+    }
+
+    public void setListener(Listener listener) {
+        mListener = listener;
+    }
+
+    public void setContactListFilterController(ContactListFilterController controller) {
+        mFilterController = controller;
+        mFilterController.setAnchor(mFilterContainer);
+        mFilterController.addListener(this);
+    }
+
+    public boolean isSearchMode() {
+        return mSearchMode;
+    }
+
+    public void setSearchMode(boolean flag) {
+        if (mSearchMode != flag) {
+            mSearchMode = flag;
+            update();
+            if (mSearchMode) {
+                mSearchView.requestFocus();
+            }
+            if (mListener != null) {
+                mListener.onAction();
+            }
+        }
+    }
+
+    public String getQueryString() {
+        return mQueryString;
+    }
+
+    public void setQueryString(String query) {
+        mQueryString = query;
+        mSearchView.setQuery(query, false);
+    }
+
+    public void update() {
+        if (mSearchMode) {
+            mSearchLabel.setVisibility(View.VISIBLE);
+            mFilterView.setVisibility(View.GONE);
+            mFilterIndicator.setVisibility(View.INVISIBLE);
+            if (mFilterController != null) {
+                mFilterController.setEnabled(false);
+            }
+        } else {
+            mSearchLabel.setVisibility(View.GONE);
+            mFilterView.setVisibility(View.VISIBLE);
+            boolean showIndicator = false;
+            if (mFilterController != null){
+                mFilterController.setEnabled(true);
+                if (mFilterController.isLoaded()) {
+                    mFilterView.setContactListFilter(mFilterController.getFilter());
+                    mFilterView.bindView(false);
+                    showIndicator = mFilterController.getFilterList().size() > 1;
+                }
+            }
+            mFilterIndicator.setVisibility(showIndicator ? View.VISIBLE : View.INVISIBLE);
+        }
+    }
+
+    @Override
+    public boolean onQueryTextChanged(String queryString) {
+        mQueryString = queryString;
+        setSearchMode(!TextUtils.isEmpty(queryString));
+        return true;
+    }
+
+    @Override
+    public boolean onSubmitQuery(String query) {
+        return true;
+    }
+
+    @Override
+    public boolean onClose() {
+        setSearchMode(false);
+        return false;
+    }
+
+    public Bundle getSavedStateForSearchMode() {
+        return mSavedStateForSearchMode;
+    }
+
+    public void setSavedStateForSearchMode(Bundle state) {
+        mSavedStateForSearchMode = state;
+    }
+
+    public Bundle getSavedStateForDefaultMode() {
+        return mSavedStateForDefaultMode;
+    }
+
+    public void setSavedStateForDefaultMode(Bundle state) {
+        mSavedStateForDefaultMode = state;
+    }
+
+    public void onSaveInstanceState(Bundle outState) {
+        outState.putBoolean(EXTRA_KEY_SEARCH_MODE, mSearchMode);
+        outState.putString(EXTRA_KEY_QUERY, mQueryString);
+        if (mSavedStateForDefaultMode != null) {
+            outState.putParcelable(KEY_MODE_DEFAULT, mSavedStateForDefaultMode);
+        }
+        if (mSavedStateForSearchMode != null) {
+            outState.putParcelable(KEY_MODE_SEARCH, mSavedStateForSearchMode);
+        }
+    }
+
+    @Override
+    public void onContactListFiltersLoaded() {
+        update();
+    }
+
+    @Override
+    public void onContactListFilterChanged() {
+        update();
+    }
+
+    @Override
+    public void onContactListFilterCustomizationRequest() {
+    }
+}
diff --git a/src/com/android/contacts/activities/ContactBrowserActivity.java b/src/com/android/contacts/activities/ContactBrowserActivity.java
new file mode 100644
index 0000000..ace768f
--- /dev/null
+++ b/src/com/android/contacts/activities/ContactBrowserActivity.java
@@ -0,0 +1,896 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.activities;
+
+import com.android.contacts.R;
+import com.android.contacts.interactions.ContactDeletionInteraction;
+import com.android.contacts.interactions.ImportExportInteraction;
+import com.android.contacts.interactions.PhoneNumberInteraction;
+import com.android.contacts.list.ContactBrowseListContextMenuAdapter;
+import com.android.contacts.list.ContactBrowseListFragment;
+import com.android.contacts.list.ContactEntryListFragment;
+import com.android.contacts.list.ContactListFilter;
+import com.android.contacts.list.ContactListFilterController;
+import com.android.contacts.list.ContactsIntentResolver;
+import com.android.contacts.list.ContactsRequest;
+import com.android.contacts.list.DefaultContactBrowseListFragment;
+import com.android.contacts.list.OnContactBrowserActionListener;
+import com.android.contacts.list.StrequentContactListFragment;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.preference.ContactsPreferenceActivity;
+import com.android.contacts.util.AccountsListAdapter;
+import com.android.contacts.util.DialogManager;
+import com.android.contacts.views.ContactSaveService;
+import com.android.contacts.views.detail.ContactDetailFragment;
+import com.android.contacts.views.detail.ContactNoneFragment;
+import com.android.contacts.widget.ContextMenuAdapter;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.Dialog;
+import android.app.Fragment;
+import android.content.ActivityNotFoundException;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Intents;
+import android.provider.Settings;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.Window;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ImageView;
+import android.widget.ListPopupWindow;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+
+/**
+ * Displays a list to browse contacts. For xlarge screens, this also displays a detail-pane on
+ * the right
+ */
+public class ContactBrowserActivity extends Activity
+        implements View.OnCreateContextMenuListener, ActionBarAdapter.Listener,
+        DialogManager.DialogShowingViewActivity {
+
+    private static final String TAG = "ContactBrowserActivity";
+
+    private static final int SUBACTIVITY_NEW_CONTACT = 2;
+    private static final int SUBACTIVITY_SETTINGS = 3;
+    private static final int SUBACTIVITY_EDIT_CONTACT = 4;
+
+    private static final String KEY_DEFAULT_CONTACT_URI = "defaultSelectedContactUri";
+
+    private static final int DEFAULT_DIRECTORY_RESULT_LIMIT = 20;
+
+    private static final String KEY_SEARCH_MODE = "searchMode";
+
+    private DialogManager mDialogManager = new DialogManager(this);
+
+    private ContactsIntentResolver mIntentResolver;
+    private ContactsRequest mRequest;
+
+    private SharedPreferences mPrefs;
+
+    private boolean mHasActionBar;
+    private ActionBarAdapter mActionBarAdapter;
+
+    private boolean mSearchMode;
+
+    private ContactBrowseListFragment mListFragment;
+    private ContactNoneFragment mEmptyFragment;
+
+    private boolean mContactContentDisplayed;
+    private ContactDetailFragment mDetailFragment;
+    private DetailFragmentListener mDetailFragmentListener = new DetailFragmentListener();
+
+    private PhoneNumberInteraction mPhoneNumberCallInteraction;
+    private PhoneNumberInteraction mSendTextMessageInteraction;
+    private ContactDeletionInteraction mContactDeletionInteraction;
+    private ImportExportInteraction mImportExportInteraction;
+
+    private boolean mSearchInitiated;
+
+    private ContactListFilterController mContactListFilterController;
+
+    private ImageView mAddContactImageView;
+
+    public ContactBrowserActivity() {
+        mIntentResolver = new ContactsIntentResolver(this);
+        mContactListFilterController = new ContactListFilterController(this);
+    }
+
+    @Override
+    public void onAttachFragment(Fragment fragment) {
+        if (fragment instanceof ContactBrowseListFragment) {
+            mListFragment = (ContactBrowseListFragment)fragment;
+            mListFragment.setOnContactListActionListener(new ContactBrowserActionListener());
+            if (mListFragment instanceof DefaultContactBrowseListFragment) {
+                ((DefaultContactBrowseListFragment) mListFragment).setContactListFilterController(
+                        mContactListFilterController);
+            }
+        } else if (fragment instanceof ContactNoneFragment) {
+            mEmptyFragment = (ContactNoneFragment)fragment;
+        } else if (fragment instanceof ContactDetailFragment) {
+            mDetailFragment = (ContactDetailFragment)fragment;
+            mDetailFragment.setListener(mDetailFragmentListener);
+        }
+    }
+
+    @Override
+    protected void onCreate(Bundle savedState) {
+        super.onCreate(savedState);
+
+        if (savedState != null) {
+            mSearchMode = savedState.getBoolean(KEY_SEARCH_MODE);
+        }
+
+        // Extract relevant information from the intent
+        mRequest = mIntentResolver.resolveIntent(getIntent());
+        if (!mRequest.isValid()) {
+            setResult(RESULT_CANCELED);
+            finish();
+            return;
+        }
+
+        Intent redirect = mRequest.getRedirectIntent();
+        if (redirect != null) {
+            // Need to start a different activity
+            startActivity(redirect);
+            finish();
+            return;
+        }
+
+        mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
+
+        setTitle(mRequest.getActivityTitle());
+        setContentView(R.layout.contact_browser);
+
+        mHasActionBar = getWindow().hasFeature(Window.FEATURE_ACTION_BAR);
+        mContactContentDisplayed = findViewById(R.id.detail_container) != null;
+
+        if (mRequest.getActionCode() == ContactsRequest.ACTION_VIEW_CONTACT) {
+            if (!mContactContentDisplayed) {
+                startActivity(new Intent(Intent.ACTION_VIEW, mRequest.getContactUri()));
+                finish();
+                return;
+            }
+        }
+
+        if (mHasActionBar) {
+            mActionBarAdapter = new ActionBarAdapter(this);
+            mActionBarAdapter.onCreate(savedState, mRequest, getActionBar());
+            mActionBarAdapter.setListener(this);
+            mActionBarAdapter.setContactListFilterController(mContactListFilterController);
+            // TODO: request may ask for FREQUENT - set the filter accordingly
+            mAddContactImageView = new ImageView(this);
+            mAddContactImageView.setImageResource(R.drawable.ic_menu_add_contact);
+            mAddContactImageView.setContentDescription(getString(R.string.menu_newContact));
+            mAddContactImageView.setOnClickListener(new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    createNewContact();
+                }
+            });
+        }
+
+        configureListFragment(true /* from request */);
+
+        if (mContactContentDisplayed) {
+            setupContactDetailFragment(mListFragment.getSelectedContactUri());
+        }
+    }
+
+    @Override
+    protected void onNewIntent(Intent intent) {
+        super.onNewIntent(intent);
+        if (Intent.ACTION_VIEW.equals(intent.getAction())) {
+            Uri uri = intent.getData();
+            if (uri == null) {
+                return;
+            }
+
+            if (mHasActionBar) {
+                if (mActionBarAdapter.isSearchMode()) {
+                    mActionBarAdapter.setSavedStateForSearchMode(null);
+                    mActionBarAdapter.setSearchMode(false);
+                }
+            }
+            setSelectedContactUri(uri);
+            setupContactDetailFragment(uri);
+            mListFragment.requestSelectionOnScreen(true);
+        }
+    }
+
+    public void setSelectedContactUri(Uri contactLookupUri) {
+        mListFragment.setSelectedContactUri(contactLookupUri);
+
+        Editor editor = mPrefs.edit();
+        if (contactLookupUri == null) {
+            editor.remove(KEY_DEFAULT_CONTACT_URI);
+        } else {
+            editor.putString(KEY_DEFAULT_CONTACT_URI, contactLookupUri.toString());
+        }
+        editor.apply();
+    }
+
+    public Uri getDefaultSelectedContactUri() {
+        String uriString = mPrefs.getString(KEY_DEFAULT_CONTACT_URI, null);
+        return TextUtils.isEmpty(uriString) ? null : Uri.parse(uriString);
+    }
+
+    private void configureListFragment(boolean fromRequest) {
+        boolean searchMode = mSearchMode;
+        if (fromRequest) {
+            ContactListFilter filter = null;
+            int actionCode = mRequest.getActionCode();
+            switch (actionCode) {
+                case ContactsRequest.ACTION_ALL_CONTACTS:
+                    filter = new ContactListFilter(ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS);
+                    break;
+                case ContactsRequest.ACTION_CONTACTS_WITH_PHONES:
+                    filter = new ContactListFilter(
+                            ContactListFilter.FILTER_TYPE_WITH_PHONE_NUMBERS_ONLY);
+                    break;
+
+                // TODO: handle FREQUENT and STREQUENT according to the spec
+                case ContactsRequest.ACTION_FREQUENT:
+                case ContactsRequest.ACTION_STREQUENT:
+                    // For now they are treated the same as STARRED
+                case ContactsRequest.ACTION_STARRED:
+                    filter = new ContactListFilter(ContactListFilter.FILTER_TYPE_STARRED);
+                    break;
+            }
+
+            if (filter != null) {
+                mContactListFilterController.setContactListFilter(filter, false);
+                searchMode = false;
+            } else if (mRequest.getActionCode() == ContactsRequest.ACTION_ALL_CONTACTS) {
+                mContactListFilterController.setContactListFilter(new ContactListFilter(
+                        ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS), false);
+            }
+        } else {
+            if (mHasActionBar) {
+                searchMode = mActionBarAdapter.isSearchMode();
+            }
+        }
+
+        boolean replaceList = mListFragment == null || (mSearchMode != searchMode);
+        if (replaceList) {
+            closeListFragment();
+            mSearchMode = searchMode;
+            if (mSearchMode) {
+                mListFragment = createContactSearchFragment();
+            } else {
+                mListFragment = createListFragment(ContactsRequest.ACTION_DEFAULT);
+            }
+        }
+
+        if (mHasActionBar) {
+            if (mSearchMode) {
+                Bundle savedState = mActionBarAdapter.getSavedStateForSearchMode();
+                if (savedState != null) {
+                    mListFragment.restoreSavedState(savedState);
+                    mActionBarAdapter.setSavedStateForSearchMode(null);
+                }
+
+                mListFragment.setQueryString(mActionBarAdapter.getQueryString());
+            } else {
+                Bundle savedState = mActionBarAdapter.getSavedStateForDefaultMode();
+                if (savedState != null) {
+                    mListFragment.restoreSavedState(savedState);
+                    mActionBarAdapter.setSavedStateForDefaultMode(null);
+                }
+            }
+        }
+
+        Uri selectUri = null;
+        if (fromRequest) {
+            selectUri = mRequest.getContactUri();
+            if (selectUri != null) {
+                setSelectedContactUri(selectUri);
+            }
+        }
+
+        if (selectUri == null && mListFragment.getSelectedContactUri() == null) {
+            selectUri = getDefaultSelectedContactUri();
+        }
+
+        if (selectUri != null) {
+            mListFragment.setSelectedContactUri(selectUri);
+            mListFragment.requestSelectionOnScreen(false);
+        }
+
+        if (replaceList) {
+            getFragmentManager().openTransaction()
+                    .replace(R.id.list_container, mListFragment)
+                    .commit();
+        }
+    }
+
+    private void closeListFragment() {
+        if (mListFragment != null) {
+            mListFragment.setOnContactListActionListener(null);
+
+            if (mHasActionBar) {
+                Bundle state = new Bundle();
+                mListFragment.onSaveInstanceState(state);
+                if (mSearchMode) {
+                    mActionBarAdapter.setSavedStateForSearchMode(state);
+                } else {
+                    mActionBarAdapter.setSavedStateForDefaultMode(state);
+                }
+            }
+
+            mListFragment = null;
+        }
+    }
+
+    private void setupContactDetailFragment(Uri contactLookupUri) {
+        if (mDetailFragment != null && contactLookupUri != null
+                && contactLookupUri.equals(mDetailFragment.getUri())) {
+            return;
+        }
+
+        if (contactLookupUri != null) {
+            // Already showing? Nothing to do
+            if (mDetailFragment != null) {
+                mDetailFragment.loadUri(contactLookupUri);
+                return;
+            }
+
+            closeEmptyFragment();
+
+            mDetailFragment = new ContactDetailFragment();
+            mDetailFragment.loadUri(contactLookupUri);
+
+            // Nothing showing yet? Create (this happens during Activity-Startup)
+            getFragmentManager().openTransaction()
+                    .replace(R.id.detail_container, mDetailFragment)
+                    .commit();
+        } else {
+            closeDetailFragment();
+
+            mEmptyFragment = new ContactNoneFragment();
+            getFragmentManager().openTransaction()
+                    .replace(R.id.detail_container, mEmptyFragment)
+                    .commit();
+        }
+    }
+
+    private void closeDetailFragment() {
+        if (mDetailFragment != null) {
+            mDetailFragment.setListener(null);
+            mDetailFragment = null;
+        }
+    }
+
+    private void closeEmptyFragment() {
+        mEmptyFragment = null;
+    }
+
+    /**
+     * Handler for action bar actions.
+     */
+    @Override
+    public void onAction() {
+        configureListFragment(false /* from request */);
+        setupContactDetailFragment(mListFragment.getSelectedContactUri());
+    }
+
+    /**
+     * Creates the list fragment for the specified mode.
+     */
+    private ContactBrowseListFragment createListFragment(int actionCode) {
+        switch (actionCode) {
+            case ContactsRequest.ACTION_DEFAULT: {
+                DefaultContactBrowseListFragment fragment = new DefaultContactBrowseListFragment();
+                fragment.setContactsRequest(mRequest);
+                fragment.setOnContactListActionListener(new ContactBrowserActionListener());
+                if (!mHasActionBar) {
+                    fragment.setContextMenuAdapter(
+                            new ContactBrowseListContextMenuAdapter(fragment));
+                }
+                fragment.setSearchMode(mRequest.isSearchMode());
+                fragment.setQueryString(mRequest.getQueryString());
+                fragment.setDirectorySearchEnabled(
+                        mRequest.isSearchMode() && mRequest.isDirectorySearchEnabled());
+                fragment.setAizyEnabled(!mRequest.isSearchMode());
+                fragment.setSelectionVisible(mContactContentDisplayed);
+                fragment.setQuickContactEnabled(!mContactContentDisplayed);
+                fragment.setFilterEnabled(!mRequest.isSearchMode());
+                return fragment;
+            }
+
+            case ContactsRequest.ACTION_GROUP: {
+                throw new UnsupportedOperationException("Not yet implemented");
+            }
+
+            case ContactsRequest.ACTION_STARRED: {
+                StrequentContactListFragment fragment = new StrequentContactListFragment();
+                fragment.setOnContactListActionListener(new ContactBrowserActionListener());
+                fragment.setFrequentlyContactedContactsIncluded(false);
+                fragment.setStarredContactsIncluded(true);
+                fragment.setSelectionVisible(mContactContentDisplayed);
+                fragment.setQuickContactEnabled(!mContactContentDisplayed);
+                return fragment;
+            }
+
+            case ContactsRequest.ACTION_FREQUENT: {
+                StrequentContactListFragment fragment = new StrequentContactListFragment();
+                fragment.setOnContactListActionListener(new ContactBrowserActionListener());
+                fragment.setFrequentlyContactedContactsIncluded(true);
+                fragment.setStarredContactsIncluded(false);
+                fragment.setSelectionVisible(mContactContentDisplayed);
+                fragment.setQuickContactEnabled(!mContactContentDisplayed);
+                return fragment;
+            }
+
+            case ContactsRequest.ACTION_STREQUENT: {
+                StrequentContactListFragment fragment = new StrequentContactListFragment();
+                fragment.setOnContactListActionListener(new ContactBrowserActionListener());
+                fragment.setFrequentlyContactedContactsIncluded(true);
+                fragment.setStarredContactsIncluded(true);
+                fragment.setSelectionVisible(mContactContentDisplayed);
+                fragment.setQuickContactEnabled(!mContactContentDisplayed);
+                return fragment;
+            }
+
+            default:
+                throw new IllegalStateException("Invalid action code: " + actionCode);
+        }
+    }
+
+    private ContactBrowseListFragment createContactSearchFragment() {
+        DefaultContactBrowseListFragment fragment = new DefaultContactBrowseListFragment();
+        fragment.setOnContactListActionListener(new ContactBrowserActionListener());
+        if (!mHasActionBar) {
+            fragment.setContextMenuAdapter(new ContactBrowseListContextMenuAdapter(fragment));
+        }
+        fragment.setSearchMode(true);
+        fragment.setDirectorySearchEnabled(true);
+        fragment.setDirectoryResultLimit(DEFAULT_DIRECTORY_RESULT_LIMIT);
+        fragment.setAizyEnabled(false);
+        fragment.setSelectionVisible(true);
+        fragment.setQuickContactEnabled(!mContactContentDisplayed);
+        return fragment;
+    }
+
+    private final class ContactBrowserActionListener implements OnContactBrowserActionListener {
+        @Override
+        public void onViewContactAction(Uri contactLookupUri) {
+            if (mContactContentDisplayed) {
+                setSelectedContactUri(contactLookupUri);
+                setupContactDetailFragment(contactLookupUri);
+            } else {
+                startActivity(new Intent(Intent.ACTION_VIEW, contactLookupUri));
+            }
+        }
+
+        @Override
+        public void onCreateNewContactAction() {
+            Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+            Bundle extras = getIntent().getExtras();
+            if (extras != null) {
+                intent.putExtras(extras);
+            }
+            startActivity(intent);
+        }
+
+        @Override
+        public void onEditContactAction(Uri contactLookupUri) {
+            Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
+            Bundle extras = getIntent().getExtras();
+            if (extras != null) {
+                intent.putExtras(extras);
+            }
+            startActivityForResult(intent, SUBACTIVITY_EDIT_CONTACT);
+        }
+
+        @Override
+        public void onAddToFavoritesAction(Uri contactUri) {
+            ContentValues values = new ContentValues(1);
+            values.put(Contacts.STARRED, 1);
+            getContentResolver().update(contactUri, values, null, null);
+        }
+
+        @Override
+        public void onRemoveFromFavoritesAction(Uri contactUri) {
+            ContentValues values = new ContentValues(1);
+            values.put(Contacts.STARRED, 0);
+            getContentResolver().update(contactUri, values, null, null);
+        }
+
+        @Override
+        public void onCallContactAction(Uri contactUri) {
+            getPhoneNumberCallInteraction().startInteraction(contactUri);
+        }
+
+        @Override
+        public void onSmsContactAction(Uri contactUri) {
+            getSendTextMessageInteraction().startInteraction(contactUri);
+        }
+
+        @Override
+        public void onDeleteContactAction(Uri contactUri) {
+            getContactDeletionInteraction().deleteContact(contactUri);
+        }
+
+        @Override
+        public void onFinishAction() {
+            onBackPressed();
+        }
+    }
+
+    private class DetailFragmentListener implements ContactDetailFragment.Listener {
+        @Override
+        public void onContactNotFound() {
+            setupContactDetailFragment(null);
+        }
+
+        @Override
+        public void onEditRequested(Uri contactLookupUri) {
+            startActivityForResult(
+                    new Intent(Intent.ACTION_EDIT, contactLookupUri), SUBACTIVITY_EDIT_CONTACT);
+        }
+
+        @Override
+        public void onItemClicked(Intent intent) {
+            try {
+                startActivity(intent);
+            } catch (ActivityNotFoundException e) {
+                Log.e(TAG, "No activity found for intent: " + intent);
+            }
+        }
+
+        @Override
+        public void onDeleteRequested(Uri contactLookupUri) {
+            getContactDeletionInteraction().deleteContact(contactLookupUri);
+        }
+
+        @Override
+        public void onCreateRawContactRequested(ArrayList<ContentValues> values, Account account) {
+            Toast.makeText(ContactBrowserActivity.this, R.string.toast_making_personal_copy,
+                    Toast.LENGTH_LONG).show();
+            Intent serviceIntent = ContactSaveService.createNewRawContactIntent(
+                    ContactBrowserActivity.this, values, account);
+            startService(serviceIntent);
+        }
+    }
+
+    public void startActivityAndForwardResult(final Intent intent) {
+        intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+
+        // Forward extras to the new activity
+        Bundle extras = getIntent().getExtras();
+        if (extras != null) {
+            intent.putExtras(extras);
+        }
+        startActivity(intent);
+        finish();
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+
+        MenuInflater inflater = getMenuInflater();
+        if (mHasActionBar) {
+            inflater.inflate(R.menu.actions, menu);
+
+            // Change add contact button to button with a custom view
+            final MenuItem addContact = menu.findItem(R.id.menu_add);
+            addContact.setActionView(mAddContactImageView);
+            return true;
+        } else if (mRequest.getActionCode() == ContactsRequest.ACTION_DEFAULT ||
+                mRequest.getActionCode() == ContactsRequest.ACTION_STREQUENT) {
+            inflater.inflate(R.menu.list, menu);
+            return true;
+        } else if (!mListFragment.isSearchMode()) {
+            inflater.inflate(R.menu.search, menu);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public boolean onPrepareOptionsMenu(Menu menu) {
+        MenuItem displayGroups = menu.findItem(R.id.menu_display_groups);
+        if (displayGroups != null) {
+            displayGroups.setVisible(
+                    mRequest.getActionCode() == ContactsRequest.ACTION_DEFAULT);
+        }
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.menu_settings: {
+                final Intent intent = new Intent(this, ContactsPreferenceActivity.class);
+                startActivityForResult(intent, SUBACTIVITY_SETTINGS);
+                return true;
+            }
+            case R.id.menu_search: {
+                onSearchRequested();
+                return true;
+            }
+            case R.id.menu_add: {
+                final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+                startActivityForResult(intent, SUBACTIVITY_NEW_CONTACT);
+                return true;
+            }
+            case R.id.menu_import_export: {
+                getImportExportInteraction().startInteraction();
+                return true;
+            }
+            case R.id.menu_accounts: {
+                final Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
+                intent.putExtra(Settings.EXTRA_AUTHORITIES, new String[] {
+                    ContactsContract.AUTHORITY
+                });
+                startActivity(intent);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private void createNewContact() {
+        final ArrayList<Account> accounts =
+                AccountTypes.getInstance(this).getAccounts(true);
+        if (accounts.size() <= 1 || mAddContactImageView == null) {
+            // No account to choose or no control to anchor the popup-menu to
+            // ==> just go straight to the editor which will disambig if necessary
+            final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+            startActivityForResult(intent, SUBACTIVITY_NEW_CONTACT);
+            return;
+        }
+
+        final ListPopupWindow popup = new ListPopupWindow(this, null);
+        popup.setWidth(getResources().getDimensionPixelSize(R.dimen.account_selector_popup_width));
+        popup.setAnchorView(mAddContactImageView);
+        final AccountsListAdapter adapter = new AccountsListAdapter(this, true);
+        popup.setAdapter(adapter);
+        popup.setOnItemClickListener(new OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                popup.dismiss();
+                final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+                intent.putExtra(Intents.Insert.ACCOUNT, adapter.getItem(position));
+                startActivityForResult(intent, SUBACTIVITY_NEW_CONTACT);
+            }
+        });
+        popup.setModal(true);
+        popup.show();
+    }
+
+    @Override
+    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
+            boolean globalSearch) {
+// TODO
+//        if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
+//            return;
+//        }
+
+        if (globalSearch) {
+            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+        } else {
+            mListFragment.startSearch(initialQuery);
+        }
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int id, Bundle bundle) {
+        if (DialogManager.isManagedId(id)) return mDialogManager.onCreateDialog(id, bundle);
+
+        Dialog dialog = getContactDeletionInteraction().onCreateDialog(id, bundle);
+        if (dialog != null) return dialog;
+
+        dialog = getPhoneNumberCallInteraction().onCreateDialog(id, bundle);
+        if (dialog != null) return dialog;
+
+        dialog = getSendTextMessageInteraction().onCreateDialog(id, bundle);
+        if (dialog != null) return dialog;
+
+        dialog = getImportExportInteraction().onCreateDialog(id, bundle);
+        if (dialog != null) return dialog;
+
+        return super.onCreateDialog(id, bundle);
+    }
+
+    @Override
+    protected void onPrepareDialog(int id, Dialog dialog, Bundle bundle) {
+        if (getContactDeletionInteraction().onPrepareDialog(id, dialog, bundle)) {
+            return;
+        }
+
+        if (getPhoneNumberCallInteraction().onPrepareDialog(id, dialog, bundle)) {
+            return;
+        }
+
+        if (getSendTextMessageInteraction().onPrepareDialog(id, dialog, bundle)) {
+            return;
+        }
+
+        super.onPrepareDialog(id, dialog, bundle);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        switch (requestCode) {
+            case SUBACTIVITY_EDIT_CONTACT: {
+                mListFragment.requestSelectionOnScreen(true);
+                break;
+            }
+
+            case SUBACTIVITY_NEW_CONTACT: {
+                if (resultCode == RESULT_OK && mContactContentDisplayed) {
+                    final Uri newContactUri = data.getData();
+                    setSelectedContactUri(newContactUri);
+                    setupContactDetailFragment(newContactUri);
+                }
+                break;
+            }
+
+            case SUBACTIVITY_SETTINGS:
+                // TODO: Force the ListFragment to reload its setting and update (don't lookup
+                // directories here)
+                break;
+
+            // TODO: Using the new startActivityWithResultFromFragment API this should not be needed
+            // anymore
+            case ContactEntryListFragment.ACTIVITY_REQUEST_CODE_PICKER:
+                if (resultCode == RESULT_OK) {
+                    mListFragment.onPickerResult(data);
+                }
+
+// TODO fix or remove multipicker code
+//                else if (resultCode == RESULT_CANCELED && mMode == MODE_PICK_MULTIPLE_PHONES) {
+//                    // Finish the activity if the sub activity was canceled as back key is used
+//                    // to confirm user selection in MODE_PICK_MULTIPLE_PHONES.
+//                    finish();
+//                }
+//                break;
+        }
+    }
+
+    @Override
+    public boolean onContextItemSelected(MenuItem item) {
+        ContextMenuAdapter menuAdapter = mListFragment.getContextMenuAdapter();
+        if (menuAdapter != null) {
+            return menuAdapter.onContextItemSelected(item);
+        }
+
+        return super.onContextItemSelected(item);
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        // TODO move to the fragment
+        switch (keyCode) {
+//            case KeyEvent.KEYCODE_CALL: {
+//                if (callSelection()) {
+//                    return true;
+//                }
+//                break;
+//            }
+
+            case KeyEvent.KEYCODE_DEL: {
+                if (deleteSelection()) {
+                    return true;
+                }
+                break;
+            }
+            default: {
+                // Bring up the search UI if the user starts typing
+                final int unicodeChar = event.getUnicodeChar();
+
+                if (unicodeChar != 0) {
+                    String query = new String(new int[]{ unicodeChar }, 0, 1);
+                    if (mHasActionBar) {
+                        if (!mActionBarAdapter.isSearchMode()) {
+                            mActionBarAdapter.setQueryString(query);
+                            mActionBarAdapter.setSearchMode(true);
+                            return true;
+                        }
+                    } else if (!mRequest.isSearchMode()) {
+                        if (!mSearchInitiated) {
+                            mSearchInitiated = true;
+                            startSearch(query, false, null, false);
+                            return true;
+                        }
+                    }
+                }
+            }
+        }
+
+        return super.onKeyDown(keyCode, event);
+    }
+
+    private boolean deleteSelection() {
+        // TODO move to the fragment
+//        if (mActionCode == ContactsRequest.ACTION_DEFAULT) {
+//            final int position = mListView.getSelectedItemPosition();
+//            if (position != ListView.INVALID_POSITION) {
+//                Uri contactUri = getContactUri(position);
+//                if (contactUri != null) {
+//                    doContactDelete(contactUri);
+//                    return true;
+//                }
+//            }
+//        }
+        return false;
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        outState.putBoolean(KEY_SEARCH_MODE, mSearchMode);
+        if (mActionBarAdapter != null) {
+            mActionBarAdapter.onSaveInstanceState(outState);
+        }
+    }
+
+    private PhoneNumberInteraction getPhoneNumberCallInteraction() {
+        if (mPhoneNumberCallInteraction == null) {
+            mPhoneNumberCallInteraction = new PhoneNumberInteraction(this, false, null);
+        }
+        return mPhoneNumberCallInteraction;
+    }
+
+    private PhoneNumberInteraction getSendTextMessageInteraction() {
+        if (mSendTextMessageInteraction == null) {
+            mSendTextMessageInteraction = new PhoneNumberInteraction(this, true, null);
+        }
+        return mSendTextMessageInteraction;
+    }
+
+    private ContactDeletionInteraction getContactDeletionInteraction() {
+        if (mContactDeletionInteraction == null) {
+            mContactDeletionInteraction = new ContactDeletionInteraction();
+            mContactDeletionInteraction.attachToActivity(this);
+        }
+        return mContactDeletionInteraction;
+    }
+
+    private ImportExportInteraction getImportExportInteraction() {
+        if (mImportExportInteraction == null) {
+            mImportExportInteraction = new ImportExportInteraction(this);
+        }
+        return mImportExportInteraction;
+    }
+
+    @Override
+    public DialogManager getDialogManager() {
+        return mDialogManager;
+    }
+}
diff --git a/src/com/android/contacts/activities/ContactDetailActivity.java b/src/com/android/contacts/activities/ContactDetailActivity.java
new file mode 100644
index 0000000..f593a0d
--- /dev/null
+++ b/src/com/android/contacts/activities/ContactDetailActivity.java
@@ -0,0 +1,138 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.activities;
+
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.R;
+import com.android.contacts.interactions.ContactDeletionInteraction;
+import com.android.contacts.views.ContactSaveService;
+import com.android.contacts.views.detail.ContactDetailFragment;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.ActivityNotFoundException;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+
+public class ContactDetailActivity extends Activity {
+    private static final String TAG = "ContactDetailActivity";
+
+    private ContactDetailFragment mFragment;
+    private ContactDeletionInteraction mContactDeletionInteraction;
+
+    @Override
+    public void onCreate(Bundle savedState) {
+        super.onCreate(savedState);
+
+        setContentView(R.layout.contact_detail_activity);
+
+        mFragment = (ContactDetailFragment) getFragmentManager().findFragmentById(
+                R.id.contact_detail_fragment);
+        mFragment.setListener(mFragmentListener);
+        mFragment.loadUri(getIntent().getData());
+
+        Log.i(TAG, getIntent().getData().toString());
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int id, Bundle args) {
+        final Dialog deletionDialog = getContactDeletionInteraction().onCreateDialog(id, args);
+        if (deletionDialog != null) return deletionDialog;
+
+        // Nobody knows about the Dialog
+        Log.w(TAG, "Unknown dialog requested, id: " + id + ", args: " + args);
+        return null;
+    }
+
+    @Override
+    protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
+        if (getContactDeletionInteraction().onPrepareDialog(id, dialog, args)) {
+            return;
+        }
+    }
+
+    @Override
+    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
+            boolean globalSearch) {
+        if (globalSearch) {
+            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+        } else {
+            ContactsSearchManager.startSearch(this, initialQuery);
+        }
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        if (mFragment.handleKeyDown(keyCode)) return true;
+
+        return super.onKeyDown(keyCode, event);
+    }
+
+    private ContactDeletionInteraction getContactDeletionInteraction() {
+        if (mContactDeletionInteraction == null) {
+            mContactDeletionInteraction = new ContactDeletionInteraction();
+            mContactDeletionInteraction.attachToActivity(this);
+        }
+        return mContactDeletionInteraction;
+    }
+
+    private final ContactDetailFragment.Listener mFragmentListener =
+            new ContactDetailFragment.Listener() {
+        @Override
+        public void onContactNotFound() {
+            finish();
+        }
+
+        @Override
+        public void onEditRequested(Uri contactLookupUri) {
+            startActivity(new Intent(Intent.ACTION_EDIT, contactLookupUri));
+        }
+
+        @Override
+        public void onItemClicked(Intent intent) {
+            try {
+                startActivity(intent);
+            } catch (ActivityNotFoundException e) {
+                Log.e(TAG, "No activity found for intent: " + intent);
+            }
+        }
+
+        @Override
+        public void onDeleteRequested(Uri lookupUri) {
+            getContactDeletionInteraction().deleteContact(lookupUri);
+        }
+
+        @Override
+        public void onCreateRawContactRequested(
+                ArrayList<ContentValues> values, Account account) {
+            Toast.makeText(ContactDetailActivity.this, R.string.toast_making_personal_copy,
+                    Toast.LENGTH_LONG).show();
+            Intent serviceIntent = ContactSaveService.createNewRawContactIntent(
+                    ContactDetailActivity.this, values, account);
+            startService(serviceIntent);
+
+        }
+    };
+}
diff --git a/src/com/android/contacts/activities/ContactEditorActivity.java b/src/com/android/contacts/activities/ContactEditorActivity.java
new file mode 100644
index 0000000..8ac23a4
--- /dev/null
+++ b/src/com/android/contacts/activities/ContactEditorActivity.java
@@ -0,0 +1,173 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.activities;
+
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.R;
+import com.android.contacts.interactions.ContactDeletionInteraction;
+import com.android.contacts.util.DialogManager;
+import com.android.contacts.views.editor.ContactEditorFragment;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract.Intents.Insert;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+import java.util.ArrayList;
+
+public class ContactEditorActivity extends Activity implements
+        DialogManager.DialogShowingViewActivity {
+    private static final String TAG = "ContactEditorActivity";
+
+    private ContactEditorFragment mFragment;
+    private ContactDeletionInteraction mContactDeletionInteraction;
+    private Button mDoneButton;
+    private Button mRevertButton;
+
+    private DialogManager mDialogManager = new DialogManager(this);
+
+    @Override
+    public void onCreate(Bundle savedState) {
+        super.onCreate(savedState);
+
+        setContentView(R.layout.contact_editor_activity);
+
+        mFragment = (ContactEditorFragment) getFragmentManager().findFragmentById(
+                R.id.contact_editor_fragment);
+        mFragment.setListener(mFragmentListener);
+        mFragment.load(getIntent().getAction(), getIntent().getData(),
+                getIntent().resolveType(getContentResolver()), getIntent().getExtras());
+
+        // Depending on the use-case, this activity has Done and Revert buttons or not.
+        mDoneButton = (Button) findViewById(R.id.done);
+        mRevertButton = (Button) findViewById(R.id.revert);
+        if (mDoneButton != null) mDoneButton.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                mFragment.save(true);
+            }
+        });
+        if (mRevertButton != null) mRevertButton.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+
+        Log.i(TAG, getIntent().getData().toString());
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int id, Bundle args) {
+        if (DialogManager.isManagedId(id)) return mDialogManager.onCreateDialog(id, args);
+
+        // Nobody knows about the Dialog
+        Log.w(TAG, "Unknown dialog requested, id: " + id + ", args: " + args);
+        return null;
+    }
+
+    @Override
+    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
+            boolean globalSearch) {
+        if (globalSearch) {
+            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+        } else {
+            ContactsSearchManager.startSearch(this, initialQuery);
+        }
+    }
+
+    @Override
+    public void onBackPressed() {
+        mFragment.save(true);
+    }
+
+    private ContactDeletionInteraction getContactDeletionInteraction() {
+        if (mContactDeletionInteraction == null) {
+            mContactDeletionInteraction = new ContactDeletionInteraction();
+            mContactDeletionInteraction.attachToActivity(this);
+        }
+        return mContactDeletionInteraction;
+    }
+
+    private final ContactEditorFragment.Listener mFragmentListener =
+            new ContactEditorFragment.Listener() {
+        @Override
+        public void onReverted() {
+            finish();
+        }
+
+        @Override
+        public void onSaveFinished(int resultCode, Intent resultIntent) {
+            setResult(resultCode, resultIntent);
+            finish();
+        }
+
+        @Override
+        public void onContactSplit(Uri newLookupUri) {
+            finish();
+        }
+
+        @Override
+        public void onAccountSelectorAborted() {
+            finish();
+        }
+
+        @Override
+        public void onContactNotFound() {
+            setResult(Activity.RESULT_CANCELED, null);
+            finish();
+        }
+
+        @Override
+        public void setTitleTo(int resourceId) {
+            setTitle(resourceId);
+        }
+
+        @Override
+        public void onDeleteRequested(Uri lookupUri) {
+            getContactDeletionInteraction().deleteContact(lookupUri);
+        }
+
+        @Override
+        public void onEditOtherContactRequested(
+                Uri contactLookupUri, ArrayList<ContentValues> values) {
+            Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
+            intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
+                    | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+
+            // Pass on all the data that has been entered so far
+            if (values != null && values.size() != 0) {
+                intent.putParcelableArrayListExtra(Insert.DATA, values);
+            }
+
+            startActivity(intent);
+            finish();
+        }
+    };
+
+    @Override
+    public DialogManager getDialogManager() {
+        return mDialogManager;
+    }
+}
diff --git a/src/com/android/contacts/activities/ContactSearchActivity.java b/src/com/android/contacts/activities/ContactSearchActivity.java
new file mode 100644
index 0000000..5b52d9a
--- /dev/null
+++ b/src/com/android/contacts/activities/ContactSearchActivity.java
@@ -0,0 +1,186 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.activities;
+
+import com.android.contacts.R;
+import com.android.contacts.interactions.ContactDeletionInteraction;
+import com.android.contacts.interactions.PhoneNumberInteraction;
+import com.android.contacts.list.ContactBrowseListContextMenuAdapter;
+import com.android.contacts.list.ContactBrowseListFragment;
+import com.android.contacts.list.ContactsIntentResolver;
+import com.android.contacts.list.ContactsRequest;
+import com.android.contacts.list.DefaultContactBrowseListFragment;
+import com.android.contacts.list.OnContactBrowserActionListener;
+import com.android.contacts.widget.SearchEditText;
+import com.android.contacts.widget.SearchEditText.OnFilterTextListener;
+
+import android.app.Activity;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract.Contacts;
+
+public class ContactSearchActivity extends Activity {
+
+    private ContactsIntentResolver mIntentResolver;
+    private ContactsRequest mRequest;
+    private ContactBrowseListFragment mListFragment;
+    private PhoneNumberInteraction mPhoneNumberCallInteraction;
+    private PhoneNumberInteraction mSendTextMessageInteraction;
+    private ContactDeletionInteraction mContactDeletionInteraction;
+    private SearchEditText mSearchEditText;
+
+    public ContactSearchActivity() {
+        mIntentResolver = new ContactsIntentResolver(this);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedState) {
+        super.onCreate(savedState);
+
+        // Extract relevant information from the intent
+        mRequest = mIntentResolver.resolveIntent(getIntent());
+        if (!mRequest.isValid()) {
+            setResult(RESULT_CANCELED);
+            finish();
+            return;
+        }
+
+        setTitle(mRequest.getActivityTitle());
+
+        setContentView(R.layout.contacts_search_content);
+
+        if (mListFragment == null) {
+            mListFragment = createContactSearchFragment();
+            getFragmentManager().openTransaction()
+                    .replace(R.id.list_container, mListFragment)
+                    .commit();
+        }
+
+        mSearchEditText = (SearchEditText)findViewById(R.id.search_src_text);
+        mSearchEditText.setText(mRequest.getQueryString());
+        mSearchEditText.setOnFilterTextListener(new OnFilterTextListener() {
+            @Override
+            public void onFilterChange(String queryString) {
+                mListFragment.setQueryString(queryString);
+            }
+
+            @Override
+            public void onCancelSearch() {
+                finish();
+            }
+        });
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        mSearchEditText.requestFocus();
+    }
+
+
+    private ContactBrowseListFragment createContactSearchFragment() {
+        DefaultContactBrowseListFragment fragment = new DefaultContactBrowseListFragment();
+        fragment.setOnContactListActionListener(new ContactBrowserActionListener());
+        fragment.setContextMenuAdapter(new ContactBrowseListContextMenuAdapter(fragment));
+        fragment.setSearchMode(true);
+        fragment.setDirectorySearchEnabled(true);
+        fragment.setAizyEnabled(false);
+        fragment.setSelectionVisible(true);
+        fragment.setEditMode(mRequest.getActionCode() ==
+                ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT);
+        return fragment;
+    }
+
+    private final class ContactBrowserActionListener implements OnContactBrowserActionListener {
+        @Override
+        public void onViewContactAction(Uri contactLookupUri) {
+            startActivity(new Intent(Intent.ACTION_VIEW, contactLookupUri));
+        }
+
+        @Override
+        public void onCreateNewContactAction() {
+        }
+
+        @Override
+        public void onEditContactAction(Uri contactLookupUri) {
+            Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
+            Bundle extras = getIntent().getExtras();
+            if (extras != null) {
+                intent.putExtras(extras);
+            }
+            startActivity(intent);
+        }
+
+        @Override
+        public void onAddToFavoritesAction(Uri contactUri) {
+            ContentValues values = new ContentValues(1);
+            values.put(Contacts.STARRED, 1);
+            getContentResolver().update(contactUri, values, null, null);
+        }
+
+        @Override
+        public void onRemoveFromFavoritesAction(Uri contactUri) {
+            ContentValues values = new ContentValues(1);
+            values.put(Contacts.STARRED, 0);
+            getContentResolver().update(contactUri, values, null, null);
+        }
+
+        @Override
+        public void onCallContactAction(Uri contactUri) {
+            getPhoneNumberCallInteraction().startInteraction(contactUri);
+        }
+
+        @Override
+        public void onSmsContactAction(Uri contactUri) {
+            getSendTextMessageInteraction().startInteraction(contactUri);
+        }
+
+        @Override
+        public void onDeleteContactAction(Uri contactUri) {
+            getContactDeletionInteraction().deleteContact(contactUri);
+        }
+
+        @Override
+        public void onFinishAction() {
+            onBackPressed();
+        }
+    }
+
+    private PhoneNumberInteraction getPhoneNumberCallInteraction() {
+        if (mPhoneNumberCallInteraction == null) {
+            mPhoneNumberCallInteraction = new PhoneNumberInteraction(this, false, null);
+        }
+        return mPhoneNumberCallInteraction;
+    }
+
+    private PhoneNumberInteraction getSendTextMessageInteraction() {
+        if (mSendTextMessageInteraction == null) {
+            mSendTextMessageInteraction = new PhoneNumberInteraction(this, true, null);
+        }
+        return mSendTextMessageInteraction;
+    }
+
+    private ContactDeletionInteraction getContactDeletionInteraction() {
+        if (mContactDeletionInteraction == null) {
+            mContactDeletionInteraction = new ContactDeletionInteraction();
+            mContactDeletionInteraction.attachToActivity(this);
+        }
+        return mContactDeletionInteraction;
+    }
+}
diff --git a/src/com/android/contacts/activities/ContactSelectionActivity.java b/src/com/android/contacts/activities/ContactSelectionActivity.java
new file mode 100644
index 0000000..06e5bf3
--- /dev/null
+++ b/src/com/android/contacts/activities/ContactSelectionActivity.java
@@ -0,0 +1,552 @@
+/*
+ * Copyright (C) 2007 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.contacts.activities;
+
+import com.android.contacts.R;
+import com.android.contacts.list.ContactEntryListFragment;
+import com.android.contacts.list.ContactPickerFragment;
+import com.android.contacts.list.ContactsIntentResolver;
+import com.android.contacts.list.ContactsRequest;
+import com.android.contacts.list.DefaultContactBrowseListFragment;
+import com.android.contacts.list.OnContactBrowserActionListener;
+import com.android.contacts.list.OnContactPickerActionListener;
+import com.android.contacts.list.OnPhoneNumberPickerActionListener;
+import com.android.contacts.list.OnPostalAddressPickerActionListener;
+import com.android.contacts.list.PhoneNumberPickerFragment;
+import com.android.contacts.list.PostalAddressPickerFragment;
+import com.android.contacts.widget.ContextMenuAdapter;
+import com.android.contacts.widget.SearchEditText;
+import com.android.contacts.widget.SearchEditText.OnFilterTextListener;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract.Contacts;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+
+/**
+ * Displays a list of contacts (or phone numbers or postal addresses) for the
+ * purposes of selecting one.
+ */
+public class ContactSelectionActivity extends Activity implements View.OnCreateContextMenuListener {
+    private static final String TAG = "ContactSelectionActivity";
+
+    private static final String KEY_ACTION_CODE = "actionCode";
+
+    private ContactsIntentResolver mIntentResolver;
+    protected ContactEntryListFragment<?> mListFragment;
+
+    private int mActionCode = -1;
+
+    private boolean mSearchInitiated;
+
+    private ContactsRequest mRequest;
+    private SearchEditText mSearchEditText;
+
+    public ContactSelectionActivity() {
+        mIntentResolver = new ContactsIntentResolver(this);
+    }
+
+    @Override
+    public void onAttachFragment(Fragment fragment) {
+        if (fragment instanceof ContactEntryListFragment<?>) {
+            mListFragment = (ContactEntryListFragment<?>) fragment;
+            setupActionListener();
+        }
+    }
+
+    @Override
+    protected void onCreate(Bundle savedState) {
+        super.onCreate(savedState);
+
+        if (savedState != null) {
+            mActionCode = savedState.getInt(KEY_ACTION_CODE);
+        }
+
+        // Extract relevant information from the intent
+        mRequest = mIntentResolver.resolveIntent(getIntent());
+        if (!mRequest.isValid()) {
+            setResult(RESULT_CANCELED);
+            finish();
+            return;
+        }
+
+        Intent redirect = mRequest.getRedirectIntent();
+        if (redirect != null) {
+            // Need to start a different activity
+            startActivity(redirect);
+            finish();
+            return;
+        }
+
+        configureActivityTitle();
+        if (mRequest.isSearchMode()) {
+            setContentView(R.layout.contacts_search_content);
+            setupSearchUI();
+        } else {
+            setContentView(R.layout.contact_picker);
+        }
+        configureListFragment();
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        outState.putInt(KEY_ACTION_CODE, mActionCode);
+    }
+
+    private void setupSearchUI() {
+        mSearchEditText = (SearchEditText)findViewById(R.id.search_src_text);
+        mSearchEditText.setText(mRequest.getQueryString());
+        mSearchEditText.setOnFilterTextListener(new OnFilterTextListener() {
+            @Override
+            public void onFilterChange(String queryString) {
+                mListFragment.setQueryString(queryString);
+            }
+
+            @Override
+            public void onCancelSearch() {
+                finish();
+            }
+        });
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (mRequest.isSearchMode()) {
+            mSearchEditText.requestFocus();
+        }
+    }
+
+    private void configureActivityTitle() {
+        if (mRequest.getActivityTitle() != null) {
+            setTitle(mRequest.getActivityTitle());
+            return;
+        }
+
+        int actionCode = mRequest.getActionCode();
+        switch (actionCode) {
+            case ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT: {
+                setTitle(R.string.contactPickerActivityTitle);
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_CONTACT: {
+                setTitle(R.string.contactPickerActivityTitle);
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT: {
+                setTitle(R.string.contactPickerActivityTitle);
+                break;
+            }
+
+            case ContactsRequest.ACTION_CREATE_SHORTCUT_CONTACT: {
+                setTitle(R.string.shortcutActivityTitle);
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_PHONE: {
+                setTitle(R.string.contactPickerActivityTitle);
+                break;
+            }
+
+            case ContactsRequest.ACTION_CREATE_SHORTCUT_CALL: {
+                setTitle(R.string.callShortcutActivityTitle);
+                break;
+            }
+
+            case ContactsRequest.ACTION_CREATE_SHORTCUT_SMS: {
+                setTitle(R.string.messageShortcutActivityTitle);
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_POSTAL: {
+                setTitle(R.string.contactPickerActivityTitle);
+                break;
+            }
+        }
+    }
+
+    /**
+     * Creates the fragment based on the current request.
+     */
+    public void configureListFragment() {
+        if (mActionCode == mRequest.getActionCode()) {
+            return;
+        }
+
+        mActionCode = mRequest.getActionCode();
+        switch (mActionCode) {
+            case ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT: {
+                DefaultContactBrowseListFragment fragment = new DefaultContactBrowseListFragment();
+                fragment.setEditMode(true);
+                fragment.setCreateContactEnabled(true);
+                fragment.setSearchMode(mRequest.isSearchMode());
+                fragment.setQueryString(mRequest.getQueryString());
+                fragment.setDirectorySearchEnabled(false);
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_CONTACT: {
+                ContactPickerFragment fragment = new ContactPickerFragment();
+                fragment.setSearchMode(mRequest.isSearchMode());
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT: {
+                ContactPickerFragment fragment = new ContactPickerFragment();
+                fragment.setCreateContactEnabled(!mRequest.isSearchMode());
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_CREATE_SHORTCUT_CONTACT: {
+                ContactPickerFragment fragment = new ContactPickerFragment();
+                fragment.setCreateContactEnabled(!mRequest.isSearchMode());
+                fragment.setSearchMode(mRequest.isSearchMode());
+                fragment.setQueryString(mRequest.getQueryString());
+                fragment.setDirectorySearchEnabled(mRequest.isDirectorySearchEnabled());
+                fragment.setShortcutRequested(true);
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_PHONE: {
+                PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_CREATE_SHORTCUT_CALL: {
+                PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
+                fragment.setShortcutAction(Intent.ACTION_CALL);
+                fragment.setSearchMode(mRequest.isSearchMode());
+
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_CREATE_SHORTCUT_SMS: {
+                PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
+                fragment.setShortcutAction(Intent.ACTION_SENDTO);
+                fragment.setSearchMode(mRequest.isSearchMode());
+
+                mListFragment = fragment;
+                break;
+            }
+
+            case ContactsRequest.ACTION_PICK_POSTAL: {
+                PostalAddressPickerFragment fragment = new PostalAddressPickerFragment();
+                mListFragment = fragment;
+                break;
+            }
+
+            default:
+                throw new IllegalStateException("Invalid action code: " + mActionCode);
+        }
+
+        mListFragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
+        mListFragment.setContactsRequest(mRequest);
+        getFragmentManager().openTransaction()
+                .replace(R.id.list_container, mListFragment)
+                .commit();
+    }
+
+    public void setupActionListener() {
+        if (mListFragment instanceof DefaultContactBrowseListFragment) {
+            ((DefaultContactBrowseListFragment) mListFragment).setOnContactListActionListener(
+                    new ContactBrowserActionListener());
+        } else if (mListFragment instanceof ContactPickerFragment) {
+            ((ContactPickerFragment) mListFragment).setOnContactPickerActionListener(
+                    new ContactPickerActionListener());
+        } else if (mListFragment instanceof PhoneNumberPickerFragment) {
+            ((PhoneNumberPickerFragment) mListFragment).setOnPhoneNumberPickerActionListener(
+                    new PhoneNumberPickerActionListener());
+        } else if (mListFragment instanceof PostalAddressPickerFragment) {
+            ((PostalAddressPickerFragment) mListFragment).setOnPostalAddressPickerActionListener(
+                    new PostalAddressPickerActionListener());
+        } else {
+            throw new IllegalStateException("Unsupported list fragment type: " + mListFragment);
+        }
+    }
+
+    private final class ContactBrowserActionListener implements OnContactBrowserActionListener {
+        @Override
+        public void onViewContactAction(Uri contactLookupUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void onCreateNewContactAction() {
+            Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+            Bundle extras = getIntent().getExtras();
+            if (extras != null) {
+                intent.putExtras(extras);
+            }
+            startActivity(intent);
+        }
+
+        @Override
+        public void onEditContactAction(Uri contactLookupUri) {
+            Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
+            Bundle extras = getIntent().getExtras();
+            if (extras != null) {
+                intent.putExtras(extras);
+            }
+            startActivity(intent);
+        }
+
+        @Override
+        public void onAddToFavoritesAction(Uri contactUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void onRemoveFromFavoritesAction(Uri contactUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void onCallContactAction(Uri contactUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void onSmsContactAction(Uri contactUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void onDeleteContactAction(Uri contactUri) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void onFinishAction() {
+            onBackPressed();
+        }
+    }
+
+    private final class ContactPickerActionListener implements OnContactPickerActionListener {
+        @Override
+        public void onCreateNewContactAction() {
+            Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+            startActivityAndForwardResult(intent);
+        }
+
+        @Override
+        public void onPickContactAction(Uri contactUri) {
+            Intent intent = new Intent();
+            setResult(RESULT_OK, intent.setData(contactUri));
+            finish();
+        }
+
+        @Override
+        public void onShortcutIntentCreated(Intent intent) {
+            setResult(RESULT_OK, intent);
+            finish();
+        }
+    }
+
+    private final class PhoneNumberPickerActionListener implements
+            OnPhoneNumberPickerActionListener {
+        @Override
+        public void onPickPhoneNumberAction(Uri dataUri) {
+            Intent intent = new Intent();
+            setResult(RESULT_OK, intent.setData(dataUri));
+            finish();
+        }
+
+        @Override
+        public void onShortcutIntentCreated(Intent intent) {
+            setResult(RESULT_OK, intent);
+            finish();
+        }
+    }
+
+    private final class PostalAddressPickerActionListener implements
+            OnPostalAddressPickerActionListener {
+        @Override
+        public void onPickPostalAddressAction(Uri dataUri) {
+            Intent intent = new Intent();
+            setResult(RESULT_OK, intent.setData(dataUri));
+            finish();
+        }
+    }
+
+    public void startActivityAndForwardResult(final Intent intent) {
+        intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+
+        // Forward extras to the new activity
+        Bundle extras = getIntent().getExtras();
+        if (extras != null) {
+            intent.putExtras(extras);
+        }
+        startActivity(intent);
+        finish();
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+
+        MenuInflater inflater = getMenuInflater();
+        if (!mListFragment.isSearchMode()) {
+            inflater.inflate(R.menu.search, menu);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.menu_search: {
+                onSearchRequested();
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
+            boolean globalSearch) {
+// TODO
+//        if (mProviderStatus != ProviderStatus.STATUS_NORMAL) {
+//            return;
+//        }
+
+        if (globalSearch) {
+            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+        } else {
+            mListFragment.startSearch(initialQuery);
+        }
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        switch (requestCode) {
+//            case SUBACTIVITY_NEW_CONTACT:
+//                if (resultCode == RESULT_OK) {
+//                    returnPickerResult(null, data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME),
+//                            data.getData());
+//                    setRe
+//                }
+//                break;
+
+//            case SUBACTIVITY_VIEW_CONTACT:
+//                if (resultCode == RESULT_OK) {
+//                    mAdapter.notifyDataSetChanged();
+//                }
+//                break;
+//
+//            case SUBACTIVITY_DISPLAY_GROUP:
+//                // Mark as just created so we re-run the view query
+////                mJustCreated = true;
+//                break;
+//
+            case ContactEntryListFragment.ACTIVITY_REQUEST_CODE_PICKER:
+                if (resultCode == RESULT_OK) {
+                    mListFragment.onPickerResult(data);
+                }
+
+// TODO fix or remove multipicker code
+//                else if (resultCode == RESULT_CANCELED && mMode == MODE_PICK_MULTIPLE_PHONES) {
+//                    // Finish the activity if the sub activity was canceled as back key is used
+//                    // to confirm user selection in MODE_PICK_MULTIPLE_PHONES.
+//                    finish();
+//                }
+//                break;
+        }
+    }
+
+    @Override
+    public boolean onContextItemSelected(MenuItem item) {
+        ContextMenuAdapter menuAdapter = mListFragment.getContextMenuAdapter();
+        if (menuAdapter != null) {
+            return menuAdapter.onContextItemSelected(item);
+        }
+
+        return super.onContextItemSelected(item);
+    }
+
+    /**
+     * Event handler for the use case where the user starts typing without
+     * bringing up the search UI first.
+     */
+    @Override
+    public boolean dispatchKeyEvent(KeyEvent event) {
+        if (!mSearchInitiated && !mRequest.isSearchMode()) {
+            int unicodeChar = event.getUnicodeChar();
+            if (unicodeChar != 0) {
+                mSearchInitiated = true;
+                startSearch(new String(new int[]{unicodeChar}, 0, 1), false, null, false);
+                return true;
+            }
+        }
+        return super.dispatchKeyEvent(event);
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        // TODO move to the fragment
+        switch (keyCode) {
+//            case KeyEvent.KEYCODE_CALL: {
+//                if (callSelection()) {
+//                    return true;
+//                }
+//                break;
+//            }
+
+            case KeyEvent.KEYCODE_DEL: {
+                if (deleteSelection()) {
+                    return true;
+                }
+                break;
+            }
+        }
+
+        return super.onKeyDown(keyCode, event);
+    }
+
+    private boolean deleteSelection() {
+        // TODO move to the fragment
+//        if (mActionCode == ContactsRequest.ACTION_DEFAULT) {
+//            final int position = mListView.getSelectedItemPosition();
+//            if (position != ListView.INVALID_POSITION) {
+//                Uri contactUri = getContactUri(position);
+//                if (contactUri != null) {
+//                    doContactDelete(contactUri);
+//                    return true;
+//                }
+//            }
+//        }
+        return false;
+    }
+}
diff --git a/src/com/android/contacts/activities/ContactsFrontDoor.java b/src/com/android/contacts/activities/ContactsFrontDoor.java
new file mode 100644
index 0000000..d8ffd7a
--- /dev/null
+++ b/src/com/android/contacts/activities/ContactsFrontDoor.java
@@ -0,0 +1,52 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.activities;
+
+import com.android.contacts.DialtactsActivity;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Bundle;
+
+public class ContactsFrontDoor extends Activity {
+    public static final String EXTRA_FRONT_DOOR = "front_door";
+
+    @Override
+    public void onCreate(Bundle savedState) {
+        super.onCreate(savedState);
+
+        Intent intent = new Intent();
+        intent.setFlags(
+                Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+        intent.putExtra(EXTRA_FRONT_DOOR, true);
+
+        // The user launched the config based front door, pick the right activity to go to
+        Configuration config = getResources().getConfiguration();
+        int screenLayoutSize = config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
+        if (screenLayoutSize == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
+            // XL screen, use two pane UI
+            intent.setClass(this, ContactBrowserActivity.class);
+        } else {
+            // Default to the normal dialtacts layout
+            intent.setClass(this, DialtactsActivity.class);
+        }
+
+        startActivity(intent);
+        finish();
+    }
+}
diff --git a/src/com/android/contacts/activities/ShowOrCreateActivity.java b/src/com/android/contacts/activities/ShowOrCreateActivity.java
new file mode 100755
index 0000000..5eb7106
--- /dev/null
+++ b/src/com/android/contacts/activities/ShowOrCreateActivity.java
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2009 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.contacts.activities;
+
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.R;
+import com.android.contacts.util.Constants;
+import com.android.contacts.util.NotifyingAsyncQueryHandler;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.ComponentName;
+import android.content.ContentUris;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Intents;
+import android.provider.ContactsContract.PhoneLookup;
+import android.provider.ContactsContract.RawContacts;
+import android.util.Log;
+
+/**
+ * Handle several edge cases around showing or possibly creating contacts in
+ * connected with a specific E-mail address or phone number. Will search based
+ * on incoming {@link Intent#getData()} as described by
+ * {@link Intents#SHOW_OR_CREATE_CONTACT}.
+ * <ul>
+ * <li>If no matching contacts found, will prompt user with dialog to add to a
+ * contact, then will use {@link Intent#ACTION_INSERT_OR_EDIT} to let create new
+ * contact or edit new data into an existing one.
+ * <li>If one matching contact found, directly show {@link Intent#ACTION_VIEW}
+ * that specific contact.
+ * <li>If more than one matching found, show list of matching contacts using
+ * {@link Intent#ACTION_SEARCH}.
+ * </ul>
+ */
+public final class ShowOrCreateActivity extends Activity implements
+        NotifyingAsyncQueryHandler.AsyncQueryListener {
+    static final String TAG = "ShowOrCreateActivity";
+    static final boolean LOGD = false;
+
+    static final String[] PHONES_PROJECTION = new String[] {
+        PhoneLookup._ID,
+    };
+
+    static final String[] CONTACTS_PROJECTION = new String[] {
+        RawContacts.CONTACT_ID,
+    };
+
+    static final int CONTACT_ID_INDEX = 0;
+
+    static final int CREATE_CONTACT_DIALOG = 1;
+
+    static final int QUERY_TOKEN = 42;
+
+    private NotifyingAsyncQueryHandler mQueryHandler;
+
+    private Bundle mCreateExtras;
+    private String mCreateDescrip;
+    private boolean mCreateForce;
+
+    @Override
+    protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+
+        // Create handler if doesn't exist, otherwise cancel any running
+        if (mQueryHandler == null) {
+            mQueryHandler = new NotifyingAsyncQueryHandler(this, this);
+        } else {
+            mQueryHandler.cancelOperation(QUERY_TOKEN);
+        }
+
+        final Intent intent = getIntent();
+        final Uri data = intent.getData();
+
+        // Unpack scheme and target data from intent
+        String scheme = null;
+        String ssp = null;
+        if (data != null) {
+            scheme = data.getScheme();
+            ssp = data.getSchemeSpecificPart();
+        }
+
+        // Build set of extras for possible use when creating contact
+        mCreateExtras = new Bundle();
+        Bundle originalExtras = intent.getExtras();
+        if (originalExtras != null) {
+            mCreateExtras.putAll(originalExtras);
+        }
+
+        // Read possible extra with specific title
+        mCreateDescrip = intent.getStringExtra(Intents.EXTRA_CREATE_DESCRIPTION);
+        if (mCreateDescrip == null) {
+            mCreateDescrip = ssp;
+        }
+
+        // Allow caller to bypass dialog prompt
+        mCreateForce = intent.getBooleanExtra(Intents.EXTRA_FORCE_CREATE, false);
+
+        // Handle specific query request
+        if (Constants.SCHEME_MAILTO.equals(scheme)) {
+            mCreateExtras.putString(Intents.Insert.EMAIL, ssp);
+
+            Uri uri = Uri.withAppendedPath(Email.CONTENT_FILTER_URI, Uri.encode(ssp));
+            mQueryHandler.startQuery(QUERY_TOKEN, null, uri, CONTACTS_PROJECTION, null, null, null);
+
+        } else if (Constants.SCHEME_TEL.equals(scheme)) {
+            mCreateExtras.putString(Intents.Insert.PHONE, ssp);
+
+            Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, ssp);
+            mQueryHandler.startQuery(QUERY_TOKEN, null, uri, PHONES_PROJECTION, null, null, null);
+
+        } else {
+            Log.w(TAG, "Invalid intent:" + getIntent());
+            finish();
+        }
+    }
+
+    @Override
+    protected void onStop() {
+        super.onStop();
+        if (mQueryHandler != null) {
+            mQueryHandler.cancelOperation(QUERY_TOKEN);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void onQueryComplete(int token, Object cookie, Cursor cursor) {
+        if (cursor == null) {
+            // Bail when problem running query in background
+            finish();
+            return;
+        }
+
+        // Count contacts found by query
+        int count = 0;
+        long contactId = -1;
+        try {
+            count = cursor.getCount();
+            if (count == 1 && cursor.moveToFirst()) {
+                // Try reading ID if only one contact returned
+                contactId = cursor.getLong(CONTACT_ID_INDEX);
+            }
+        } finally {
+            cursor.close();
+        }
+
+        if (count == 1 && contactId != -1) {
+            // If we only found one item, jump right to viewing it
+            final Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+            final Intent viewIntent = new Intent(Intent.ACTION_VIEW, contactUri);
+            startActivity(viewIntent);
+            finish();
+
+        } else if (count > 1) {
+            // If more than one, show pick list
+            Intent listIntent = new Intent(Intent.ACTION_SEARCH);
+            listIntent.setComponent(new ComponentName(this, ContactBrowserActivity.class));
+            listIntent.putExtras(mCreateExtras);
+            startActivity(listIntent);
+            finish();
+
+        } else {
+            // No matching contacts found
+            if (mCreateForce) {
+                // Forced to create new contact
+                Intent createIntent = new Intent(Intent.ACTION_INSERT, RawContacts.CONTENT_URI);
+                createIntent.putExtras(mCreateExtras);
+                createIntent.setType(RawContacts.CONTENT_TYPE);
+
+                startActivity(createIntent);
+                finish();
+
+            } else {
+	        showDialog(CREATE_CONTACT_DIALOG);
+           }
+        }
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int id) {
+        switch(id) {
+	    case CREATE_CONTACT_DIALOG:
+                // Prompt user to insert or edit contact
+                final Intent createIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
+                createIntent.putExtras(mCreateExtras);
+                createIntent.setType(RawContacts.CONTENT_ITEM_TYPE);
+
+                final CharSequence message = getResources().getString(
+                        R.string.add_contact_dlg_message_fmt, mCreateDescrip);
+
+                return new AlertDialog.Builder(this)
+                        .setTitle(R.string.add_contact_dlg_title)
+                        .setMessage(message)
+                        .setPositiveButton(android.R.string.ok,
+                                new IntentClickListener(this, createIntent))
+                        .setNegativeButton(android.R.string.cancel,
+                                new IntentClickListener(this, null))
+                        .create();
+        }
+	return super.onCreateDialog(id);
+    }
+
+    /**
+     * Listener for {@link DialogInterface} that launches a given {@link Intent}
+     * when clicked. When clicked, this also closes the parent using
+     * {@link Activity#finish()}.
+     */
+    private static class IntentClickListener implements DialogInterface.OnClickListener {
+        private Activity mParent;
+        private Intent mIntent;
+
+        /**
+         * @param parent {@link Activity} to use for launching target.
+         * @param intent Target {@link Intent} to launch when clicked.
+         */
+        public IntentClickListener(Activity parent, Intent intent) {
+            mParent = parent;
+            mIntent = intent;
+        }
+
+        public void onClick(DialogInterface dialog, int which) {
+            if (mIntent != null) {
+                mParent.startActivity(mIntent);
+            }
+            mParent.finish();
+        }
+    }
+
+    @Override
+    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
+            boolean globalSearch) {
+        if (globalSearch) {
+            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+        } else {
+            ContactsSearchManager.startSearch(this, initialQuery);
+        }
+    }
+}
diff --git a/src/com/android/contacts/interactions/ContactDeletionInteraction.java b/src/com/android/contacts/interactions/ContactDeletionInteraction.java
new file mode 100644
index 0000000..76ca76e
--- /dev/null
+++ b/src/com/android/contacts/interactions/ContactDeletionInteraction.java
@@ -0,0 +1,201 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.interactions;
+
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountTypes;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.content.DialogInterface;
+import android.content.Loader;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract.RawContacts;
+import android.util.Log;
+
+// TODO: This should respect the lookup element. The Id might by now refer to a different contact
+/**
+ * An interaction invoked to delete a contact.
+ */
+public class ContactDeletionInteraction {
+
+    private static final String TAG = "ContactDeletionInteraction";
+
+    public static final String EXTRA_KEY_CONTACT_URI = "contactUri";
+    public static final String EXTRA_KEY_MESSAGE_ID = "messageId";
+
+    private static final String[] RAW_CONTACTS_PROJECTION = new String[] {
+        RawContacts._ID, //0
+        RawContacts.ACCOUNT_TYPE, //1
+    };
+
+    private final class RawContactLoader extends CursorLoader {
+        private final Uri mContactUri;
+
+        private RawContactLoader(Context context, Uri contactUri) {
+            super(context,
+                    RawContacts.CONTENT_URI,
+                    RAW_CONTACTS_PROJECTION,
+                    RawContacts.CONTACT_ID + "=?",
+                    new String[] { String.valueOf(ContentUris.parseId(contactUri)) },
+                    null);
+            this.mContactUri = contactUri;
+        }
+
+        @Override
+        public void deliverResult(Cursor data) {
+            if (data == null || data.getCount() == 0) {
+                Log.e(TAG, "No such contact: " + mContactUri);
+                return;
+            }
+
+            showConfirmationDialog(data, mContactUri);
+        }
+    }
+
+    private final class ConfirmationDialogClickListener implements DialogInterface.OnClickListener {
+        private final Uri mContactUri;
+
+        public ConfirmationDialogClickListener(Uri contactUri) {
+            this.mContactUri = contactUri;
+        }
+
+        public void onClick(DialogInterface dialog, int which) {
+            doDeleteContact(mContactUri);
+        }
+    }
+
+    private Context mContext;
+    private CursorLoader mLoader;
+
+    public void attachToActivity(Activity activity) {
+        setContext(activity);
+    }
+
+    /* Visible for testing */
+    void setContext(Context context) {
+        mContext = context;
+    }
+
+    public void deleteContact(Uri contactUri) {
+        if (mLoader != null) {
+            mLoader.destroy();
+        }
+        mLoader = new RawContactLoader(mContext, contactUri);
+        startLoading(mLoader);
+    }
+
+    protected void showConfirmationDialog(Cursor cursor, Uri contactUri) {
+        int  writableSourcesCnt = 0;
+        int  readOnlySourcesCnt = 0;
+
+        AccountTypes sources = getSources();
+        try {
+            while (cursor.moveToNext()) {
+                final long rawContactId = cursor.getLong(0);
+                final String accountType = cursor.getString(1);
+                BaseAccountType contactsSource = sources.getInflatedSource(accountType,
+                        BaseAccountType.LEVEL_SUMMARY);
+                boolean readonly = contactsSource != null && contactsSource.readOnly;
+                if (readonly) {
+                    readOnlySourcesCnt ++;
+                } else {
+                    writableSourcesCnt ++;
+                }
+            }
+        } finally {
+            cursor.close();
+        }
+
+        int messageId;
+        if (readOnlySourcesCnt > 0 && writableSourcesCnt > 0) {
+            messageId = R.string.readOnlyContactDeleteConfirmation;
+        } else if (readOnlySourcesCnt > 0 && writableSourcesCnt == 0) {
+            messageId = R.string.readOnlyContactWarning;
+        } else if (readOnlySourcesCnt == 0 && writableSourcesCnt > 1) {
+            messageId = R.string.multipleContactDeleteConfirmation;
+        } else {
+            messageId = R.string.deleteConfirmation;
+        }
+
+        Bundle bundle = new Bundle();
+        bundle.putParcelable(EXTRA_KEY_CONTACT_URI, contactUri);
+        bundle.putInt(EXTRA_KEY_MESSAGE_ID, messageId);
+
+        showDialog(bundle);
+    }
+
+    /**
+     * Creates a delete confirmation dialog and returns it.  Returns null if the
+     * id is not for a deletion confirmation.
+     */
+    public Dialog onCreateDialog(int id, Bundle bundle) {
+        if (id != R.id.dialog_delete_contact_confirmation) {
+            return null;
+        }
+
+        return new AlertDialog.Builder(mContext)
+                .setTitle(R.string.deleteConfirmation_title)
+                .setIcon(android.R.drawable.ic_dialog_alert)
+                .setMessage(R.string.deleteConfirmation)
+                .setNegativeButton(android.R.string.cancel, null)
+                .setPositiveButton(android.R.string.ok, null)
+                .create();
+    }
+
+    public boolean onPrepareDialog(int id, Dialog dialog, Bundle bundle) {
+        if (id != R.id.dialog_delete_contact_confirmation) {
+            return false;
+        }
+
+        Uri contactUri = bundle.getParcelable(EXTRA_KEY_CONTACT_URI);
+        int messageId = bundle.getInt(EXTRA_KEY_MESSAGE_ID, R.string.deleteConfirmation);
+
+        ((AlertDialog)dialog).setMessage(mContext.getText(messageId));
+        ((AlertDialog)dialog).setButton(DialogInterface.BUTTON_POSITIVE,
+                mContext.getText(android.R.string.ok),
+                new ConfirmationDialogClickListener(contactUri));
+
+        return true;
+    }
+
+    protected void doDeleteContact(Uri contactUri) {
+        mContext.getContentResolver().delete(contactUri, null, null);
+    }
+
+    /* Visible for testing */
+    void startLoading(Loader<Cursor> loader) {
+        loader.startLoading();
+    }
+
+    /* Visible for testing */
+    AccountTypes getSources() {
+        return AccountTypes.getInstance(mContext);
+    }
+
+    /* Visible for testing */
+    void showDialog(Bundle bundle) {
+        ((Activity)mContext).showDialog(R.id.dialog_delete_contact_confirmation, bundle);
+    }
+}
diff --git a/src/com/android/contacts/interactions/ImportExportInteraction.java b/src/com/android/contacts/interactions/ImportExportInteraction.java
new file mode 100644
index 0000000..1055672
--- /dev/null
+++ b/src/com/android/contacts/interactions/ImportExportInteraction.java
@@ -0,0 +1,217 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.interactions;
+
+import com.android.contacts.R;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.util.AccountSelectionUtil;
+import com.android.contacts.vcard.ExportVCardActivity;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract.Contacts;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+import android.view.ContextThemeWrapper;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.util.List;
+
+/**
+ * An interaction invoked to import/export contacts.
+ */
+public class ImportExportInteraction {
+
+    private static final String TAG = "ImportExportInteraction";
+
+    private final String[] LOOKUP_PROJECTION = new String[] {
+            Contacts.LOOKUP_KEY
+    };
+
+    private final Context mContext;
+
+    public ImportExportInteraction(Context context) {
+        this.mContext = context;
+    }
+
+    /**
+     * Creates a {@link Dialog} that allows the user to choose between a bulk import
+     * and bulk export task across all contacts.
+     */
+    public void startInteraction() {
+        showDialog(R.id.dialog_import_export_options, null);
+    }
+
+    public Dialog onCreateDialog(int id, Bundle bundle) {
+        switch (id) {
+            case R.id.dialog_import_export_options: {
+                return createOptionsDialog();
+            }
+            case R.string.import_from_sim:
+            case R.string.import_from_sdcard: {
+                return AccountSelectionUtil.getSelectAccountDialog(mContext, id);
+            }
+            case R.id.dialog_sdcard_not_found: {
+                return new AlertDialog.Builder(mContext)
+                        .setTitle(R.string.no_sdcard_title)
+                        .setIcon(android.R.drawable.ic_dialog_alert)
+                        .setMessage(R.string.no_sdcard_message)
+                        .setPositiveButton(android.R.string.ok, null).create();
+            }
+        }
+
+        return null;
+    }
+
+    private Dialog createOptionsDialog() {
+        // Wrap our context to inflate list items using the correct theme
+        final Resources res = mContext.getResources();
+        final LayoutInflater dialogInflater = (LayoutInflater)mContext
+                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+        // Adapter that shows a list of string resources
+        final ArrayAdapter<Integer> adapter = new ArrayAdapter<Integer>(mContext,
+                android.R.layout.select_dialog_item) {
+            @Override
+            public View getView(int position, View convertView, ViewGroup parent) {
+                if (convertView == null) {
+                    convertView = dialogInflater.inflate(android.R.layout.select_dialog_item,
+                            parent, false);
+                }
+
+                final int resId = this.getItem(position);
+                ((TextView)convertView).setText(resId);
+                return convertView;
+            }
+        };
+
+        if (TelephonyManager.getDefault().hasIccCard()) {
+            adapter.add(R.string.import_from_sim);
+        }
+        if (res.getBoolean(R.bool.config_allow_import_from_sdcard)) {
+            adapter.add(R.string.import_from_sdcard);
+        }
+        if (res.getBoolean(R.bool.config_allow_export_to_sdcard)) {
+            adapter.add(R.string.export_to_sdcard);
+        }
+        if (res.getBoolean(R.bool.config_allow_share_visible_contacts)) {
+            adapter.add(R.string.share_visible_contacts);
+        }
+
+        final DialogInterface.OnClickListener clickListener =
+                new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialog, int which) {
+                dialog.dismiss();
+
+                final int resId = adapter.getItem(which);
+                switch (resId) {
+                    case R.string.import_from_sim:
+                    case R.string.import_from_sdcard: {
+                        handleImportRequest(resId);
+                        break;
+                    }
+                    case R.string.export_to_sdcard: {
+                        Intent exportIntent = new Intent(mContext, ExportVCardActivity.class);
+                        mContext.startActivity(exportIntent);
+                        break;
+                    }
+                    case R.string.share_visible_contacts: {
+                        doShareVisibleContacts();
+                        break;
+                    }
+                    default: {
+                        Log.e(TAG, "Unexpected resource: " +
+                                mContext.getResources().getResourceEntryName(resId));
+                    }
+                }
+            }
+        };
+
+        return new AlertDialog.Builder(mContext)
+                .setTitle(R.string.dialog_import_export)
+                .setNegativeButton(android.R.string.cancel, null)
+                .setSingleChoiceItems(adapter, -1, clickListener)
+                .create();
+    }
+
+    private void doShareVisibleContacts() {
+
+        // TODO move the query into a loader
+        final Cursor cursor = mContext.getContentResolver().query(Contacts.CONTENT_URI,
+                LOOKUP_PROJECTION, Contacts.IN_VISIBLE_GROUP + "!=0", null, null);
+        try {
+            if (!cursor.moveToFirst()) {
+                Toast.makeText(mContext, R.string.share_error, Toast.LENGTH_SHORT).show();
+                return;
+            }
+
+            StringBuilder uriListBuilder = new StringBuilder();
+            int index = 0;
+            while (cursor.moveToNext()) {
+                if (index != 0)
+                    uriListBuilder.append(':');
+                uriListBuilder.append(cursor.getString(0));
+                index++;
+            }
+            Uri uri = Uri.withAppendedPath(
+                    Contacts.CONTENT_MULTI_VCARD_URI,
+                    Uri.encode(uriListBuilder.toString()));
+
+            final Intent intent = new Intent(Intent.ACTION_SEND);
+            intent.setType(Contacts.CONTENT_VCARD_TYPE);
+            intent.putExtra(Intent.EXTRA_STREAM, uri);
+            mContext.startActivity(intent);
+        } finally {
+            cursor.close();
+        }
+    }
+
+    private void handleImportRequest(int resId) {
+        // There are three possibilities:
+        // - more than one accounts -> ask the user
+        // - just one account -> use the account without asking the user
+        // - no account -> use phone-local storage without asking the user
+        final AccountTypes sources = AccountTypes.getInstance(mContext);
+        final List<Account> accountList = sources.getAccounts(true);
+        final int size = accountList.size();
+        if (size > 1) {
+            showDialog(resId, null);
+            return;
+        }
+
+        AccountSelectionUtil.doImport(mContext, resId, (size == 1 ? accountList.get(0) : null));
+    }
+
+    /* Visible for testing */
+    void showDialog(int dialogId, Bundle bundle) {
+        ((Activity)mContext).showDialog(dialogId, bundle);
+    }
+}
diff --git a/src/com/android/contacts/interactions/PhoneNumberInteraction.java b/src/com/android/contacts/interactions/PhoneNumberInteraction.java
new file mode 100644
index 0000000..ac3c3c8
--- /dev/null
+++ b/src/com/android/contacts/interactions/PhoneNumberInteraction.java
@@ -0,0 +1,365 @@
+/*
+ * 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.
+ */
+package com.android.contacts.interactions;
+
+
+import com.android.contacts.Collapser;
+import com.android.contacts.Collapser.Collapsible;
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.StringInflater;
+import com.android.contacts.model.AccountTypes;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
+import android.content.DialogInterface.OnDismissListener;
+import android.content.Intent;
+import android.content.Loader;
+import android.content.Loader.OnLoadCompleteListener;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.RawContacts;
+import android.telephony.PhoneNumberUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.CheckBox;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+
+/**
+ * Initiates phone calls or a text message.
+ */
+public class PhoneNumberInteraction
+        implements OnLoadCompleteListener<Cursor>, OnClickListener {
+
+    public static final String EXTRA_KEY_ITEMS = "items";
+
+    /**
+     * A model object for capturing a phone number for a given contact.
+     */
+    static class PhoneItem implements Parcelable, Collapsible<PhoneItem> {
+        long id;
+        String phoneNumber;
+        String accountType;
+        long type;
+        String label;
+
+        public static Parcelable.Creator<PhoneItem> CREATOR = new Creator<PhoneItem>() {
+
+            public PhoneItem[] newArray(int size) {
+                return new PhoneItem[size];
+            }
+
+            public PhoneItem createFromParcel(Parcel source) {
+                PhoneItem item = new PhoneItem();
+                item.id = source.readLong();
+                item.phoneNumber = source.readString();
+                item.accountType = source.readString();
+                item.type = source.readLong();
+                item.label = source.readString();
+                return item;
+            }
+        };
+
+        public void writeToParcel(Parcel dest, int flags) {
+            dest.writeLong(id);
+            dest.writeString(phoneNumber);
+            dest.writeString(accountType);
+            dest.writeLong(type);
+            dest.writeString(label);
+        }
+
+        public int describeContents() {
+            return 0;
+        }
+
+        public boolean collapseWith(PhoneItem phoneItem) {
+            if (!shouldCollapseWith(phoneItem)) {
+                return false;
+            }
+            // Just keep the number and id we already have.
+            return true;
+        }
+
+        public boolean shouldCollapseWith(PhoneItem phoneItem) {
+            if (PhoneNumberUtils.compareStrictly(phoneNumber, phoneItem.phoneNumber)) {
+                return true;
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return phoneNumber;
+        }
+    }
+
+    /**
+     * A list adapter that populates the list of contact's phone numbers.
+     */
+    private class PhoneItemAdapter extends ArrayAdapter<PhoneItem> {
+        private final AccountTypes mSources;
+
+        public PhoneItemAdapter(Context context) {
+            super(context, R.layout.phone_disambig_item, android.R.id.text2);
+            mSources = AccountTypes.getInstance(context);
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            View view = super.getView(position, convertView, parent);
+
+            PhoneItem item = getItem(position);
+            BaseAccountType source = mSources.getInflatedSource(item.accountType,
+                    BaseAccountType.LEVEL_SUMMARY);
+
+            // Obtain a string representation of the phone type specific to the
+            // ContactSource associated with that phone number
+            TextView typeView = (TextView)view.findViewById(android.R.id.text1);
+            DataKind kind = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
+            if (kind != null) {
+                ContentValues values = new ContentValues();
+                values.put(Phone.TYPE, item.type);
+                values.put(Phone.LABEL, item.label);
+                StringInflater header = mSendTextMessage ? kind.actionAltHeader : kind.actionHeader;
+                typeView.setText(header.inflateUsing(getContext(), values));
+            } else {
+                typeView.setText(R.string.call_other);
+            }
+            return view;
+        }
+    }
+
+    private static final String[] PHONE_NUMBER_PROJECTION = new String[] {
+            Phone._ID,
+            Phone.NUMBER,
+            Phone.IS_SUPER_PRIMARY,
+            RawContacts.ACCOUNT_TYPE,
+            Phone.TYPE,
+            Phone.LABEL
+    };
+
+    private static final String PHONE_NUMBER_SELECTION = Data.MIMETYPE + "='"
+            + Phone.CONTENT_ITEM_TYPE + "' AND " + Phone.NUMBER + " NOT NULL";
+
+    private final Context mContext;
+    private final OnDismissListener mDismissListener;
+    private final boolean mSendTextMessage;
+
+    private CursorLoader mLoader;
+
+    public PhoneNumberInteraction(Context context, boolean sendTextMessage,
+            DialogInterface.OnDismissListener dismissListener) {
+        mContext = context;
+        mSendTextMessage = sendTextMessage;
+        mDismissListener = dismissListener;
+    }
+
+    private void performAction(String phoneNumber) {
+        Intent intent;
+        if (mSendTextMessage) {
+            intent = new Intent(
+                    Intent.ACTION_SENDTO, Uri.fromParts("sms", phoneNumber, null));
+        } else {
+            intent = new Intent(
+                    Intent.ACTION_CALL_PRIVILEGED, Uri.fromParts("tel", phoneNumber, null));
+
+        }
+        startActivity(intent);
+    }
+
+    /**
+     * Initiates the interaction. This may result in a phone call or sms message started
+     * or a disambiguation dialog to determine which phone number should be used.
+     */
+    public void startInteraction(Uri contactUri) {
+        if (mLoader != null) {
+            mLoader.destroy();
+        }
+
+        mLoader = new CursorLoader(mContext,
+                Uri.withAppendedPath(contactUri, Contacts.Data.CONTENT_DIRECTORY),
+                PHONE_NUMBER_PROJECTION,
+                PHONE_NUMBER_SELECTION,
+                null,
+                null);
+        mLoader.registerListener(0, this);
+        startLoading(mLoader);
+    }
+
+    @Override
+    public void onLoadComplete(Loader<Cursor> loader, Cursor cursor) {
+        if (cursor == null) {
+            onDismiss();
+            return;
+        }
+
+        ArrayList<PhoneItem> phoneList = new ArrayList<PhoneItem>();
+        String primaryPhone = null;
+        try {
+            while (cursor.moveToNext()) {
+                if (cursor.getInt(cursor.getColumnIndex(Phone.IS_SUPER_PRIMARY)) != 0) {
+                    // Found super primary, call it.
+                    primaryPhone = cursor.getString(cursor.getColumnIndex(Phone.NUMBER));
+                    break;
+                }
+
+                PhoneItem item = new PhoneItem();
+                item.id = cursor.getLong(cursor.getColumnIndex(Data._ID));
+                item.phoneNumber = cursor.getString(cursor.getColumnIndex(Phone.NUMBER));
+                item.accountType =
+                        cursor.getString(cursor.getColumnIndex(RawContacts.ACCOUNT_TYPE));
+                item.type = cursor.getInt(cursor.getColumnIndex(Phone.TYPE));
+                item.label = cursor.getString(cursor.getColumnIndex(Phone.LABEL));
+
+                phoneList.add(item);
+            }
+        } finally {
+            cursor.close();
+        }
+
+        if (primaryPhone != null) {
+            performAction(primaryPhone);
+            onDismiss();
+            return;
+        }
+
+        Collapser.collapseList(phoneList);
+
+        if (phoneList.size() == 0) {
+            onDismiss();
+        } else if (phoneList.size() == 1) {
+            onDismiss();
+            performAction(phoneList.get(0).phoneNumber);
+        } else {
+            Bundle bundle = new Bundle();
+            bundle.putParcelableArrayList(EXTRA_KEY_ITEMS, phoneList);
+            showDialog(getDialogId(), bundle);
+        }
+    }
+
+    private void onDismiss() {
+        if (mDismissListener != null) {
+            mDismissListener.onDismiss(null);
+        }
+    }
+
+    private int getDialogId() {
+        return mSendTextMessage
+                ? R.id.dialog_phone_number_message_disambiguation
+                : R.id.dialog_phone_number_call_disambiguation;
+    }
+
+    public Dialog onCreateDialog(int id, Bundle bundle) {
+        if (id != getDialogId()) {
+            return null;
+        }
+
+        LayoutInflater inflater = LayoutInflater.from(mContext);
+        View setPrimaryView = inflater.inflate(R.layout.set_primary_checkbox, null);
+        AlertDialog dialog = new AlertDialog.Builder(mContext)
+                .setAdapter(new PhoneItemAdapter(mContext), this)
+                .setView(setPrimaryView)
+                .setTitle(mSendTextMessage
+                        ? R.string.sms_disambig_title
+                        : R.string.call_disambig_title)
+                .create();
+        dialog.setOnDismissListener(mDismissListener);
+        return dialog;
+    }
+
+    public boolean onPrepareDialog(int id, Dialog dialog, Bundle bundle) {
+        if (id != getDialogId()) {
+            return false;
+        }
+
+        ArrayList<PhoneItem> phoneList = bundle.getParcelableArrayList(EXTRA_KEY_ITEMS);
+
+        AlertDialog alertDialog = (AlertDialog)dialog;
+        PhoneItemAdapter adapter = (PhoneItemAdapter)alertDialog.getListView().getAdapter();
+        adapter.clear();
+        adapter.addAll(phoneList);
+
+        return true;
+    }
+
+    /**
+     * Handles the user selection in the disambiguation dialog.
+     */
+    @Override
+    public void onClick(DialogInterface dialog, int which) {
+        AlertDialog alertDialog = (AlertDialog)dialog;
+        PhoneItemAdapter adapter = (PhoneItemAdapter)alertDialog.getListView().getAdapter();
+        PhoneItem phoneItem = adapter.getItem(which);
+        if (phoneItem != null) {
+            long id = phoneItem.id;
+            String phone = phoneItem.phoneNumber;
+
+            CheckBox checkBox = (CheckBox)alertDialog.findViewById(R.id.setPrimary);
+            if (checkBox.isChecked()) {
+                makePrimary(id);
+            }
+
+            performAction(phone);
+        }
+    }
+
+    /**
+     * Makes the selected phone number primary.
+     */
+    void makePrimary(long id) {
+        // TODO use a Saver
+        ContentValues values = new ContentValues(1);
+        values.put(Data.IS_SUPER_PRIMARY, 1);
+        Uri uri = ContentUris.withAppendedId(Data.CONTENT_URI, id);
+        mContext.getContentResolver().update(uri, values, null, null);
+    }
+
+    /* Visible for testing */
+    void showDialog(int dialogId, Bundle bundle) {
+        Activity activity = (Activity)mContext;
+        if (!activity.isFinishing()) {
+            activity.showDialog(dialogId, bundle);
+        }
+    }
+
+    /* Visible for testing */
+    void startActivity(Intent intent) {
+        mContext.startActivity(intent);
+    }
+
+    /* Visible for testing */
+    void startLoading(Loader<Cursor> loader) {
+        loader.startLoading();
+    }
+}
diff --git a/src/com/android/contacts/list/ContactBrowseListContextMenuAdapter.java b/src/com/android/contacts/list/ContactBrowseListContextMenuAdapter.java
new file mode 100644
index 0000000..f2a53ca
--- /dev/null
+++ b/src/com/android/contacts/list/ContactBrowseListContextMenuAdapter.java
@@ -0,0 +1,146 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+import com.android.contacts.util.PhoneCapabilityTester;
+import com.android.contacts.widget.ContextMenuAdapter;
+
+import android.content.Context;
+import android.net.Uri;
+import android.util.Log;
+import android.view.ContextMenu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ContextMenu.ContextMenuInfo;
+import android.widget.AdapterView;
+
+/**
+ * A contextual menu adapter for the basic contact list.
+ */
+public class ContactBrowseListContextMenuAdapter implements ContextMenuAdapter {
+
+    private static final int MENU_ITEM_VIEW_CONTACT = 1;
+    private static final int MENU_ITEM_CALL = 2;
+    private static final int MENU_ITEM_SEND_SMS = 3;
+    private static final int MENU_ITEM_EDIT = 4;
+    private static final int MENU_ITEM_DELETE = 5;
+    private static final int MENU_ITEM_TOGGLE_STAR = 6;
+
+    private static final String TAG = "LightContactBrowserContextMenuAdapter";
+
+    private final ContactBrowseListFragment mContactListFragment;
+
+    public ContactBrowseListContextMenuAdapter(ContactBrowseListFragment fragment) {
+        this.mContactListFragment = fragment;
+    }
+
+    @Override
+    public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
+        AdapterView.AdapterContextMenuInfo info;
+        try {
+             info = (AdapterView.AdapterContextMenuInfo) menuInfo;
+        } catch (ClassCastException e) {
+            Log.wtf(TAG, "Bad menuInfo", e);
+            return;
+        }
+
+        ContactListAdapter adapter = mContactListFragment.getAdapter();
+        int headerViewsCount = mContactListFragment.getListView().getHeaderViewsCount();
+        int position = info.position - headerViewsCount;
+
+        // Setup the menu header
+        menu.setHeaderTitle(adapter.getContactDisplayName(position));
+
+        // View contact details
+        menu.add(0, MENU_ITEM_VIEW_CONTACT, 0, R.string.menu_viewContact);
+
+        if (adapter.getHasPhoneNumber(position)) {
+            final Context context = mContactListFragment.getContext();
+            boolean hasPhoneApp = PhoneCapabilityTester.isPhone(context);
+            boolean hasSmsApp = PhoneCapabilityTester.isSmsIntentRegistered(context);
+            // Calling contact
+            if (hasPhoneApp) menu.add(0, MENU_ITEM_CALL, 0, R.string.menu_call);
+            // Send SMS item
+            if (hasSmsApp) menu.add(0, MENU_ITEM_SEND_SMS, 0, R.string.menu_sendSMS);
+        }
+
+        // Star toggling
+        if (!adapter.isContactStarred(position)) {
+            menu.add(0, MENU_ITEM_TOGGLE_STAR, 0, R.string.menu_addStar);
+        } else {
+            menu.add(0, MENU_ITEM_TOGGLE_STAR, 0, R.string.menu_removeStar);
+        }
+
+        // Contact editing
+        menu.add(0, MENU_ITEM_EDIT, 0, R.string.menu_editContact);
+        menu.add(0, MENU_ITEM_DELETE, 0, R.string.menu_deleteContact);
+    }
+
+    @Override
+    public boolean onContextItemSelected(MenuItem item) {
+        AdapterView.AdapterContextMenuInfo info;
+        try {
+             info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
+        } catch (ClassCastException e) {
+            Log.wtf(TAG, "Bad menuInfo", e);
+            return false;
+        }
+
+        ContactListAdapter adapter = mContactListFragment.getAdapter();
+        int headerViewsCount = mContactListFragment.getListView().getHeaderViewsCount();
+        int position = info.position - headerViewsCount;
+
+        final Uri contactUri = adapter.getContactUri(position);
+        switch (item.getItemId()) {
+            case MENU_ITEM_VIEW_CONTACT: {
+                mContactListFragment.viewContact(contactUri);
+                return true;
+            }
+
+            case MENU_ITEM_TOGGLE_STAR: {
+                if (adapter.isContactStarred(position)) {
+                    mContactListFragment.removeFromFavorites(contactUri);
+                } else {
+                    mContactListFragment.addToFavorites(contactUri);
+                }
+                return true;
+            }
+
+            case MENU_ITEM_CALL: {
+                mContactListFragment.callContact(contactUri);
+                return true;
+            }
+
+            case MENU_ITEM_SEND_SMS: {
+                mContactListFragment.smsContact(contactUri);
+                return true;
+            }
+
+            case MENU_ITEM_EDIT: {
+                mContactListFragment.editContact(contactUri);
+                return true;
+            }
+
+            case MENU_ITEM_DELETE: {
+                mContactListFragment.deleteContact(contactUri);
+                return true;
+            }
+        }
+
+        return false;
+    }
+}
diff --git a/src/com/android/contacts/list/ContactBrowseListFragment.java b/src/com/android/contacts/list/ContactBrowseListFragment.java
new file mode 100644
index 0000000..f99134b
--- /dev/null
+++ b/src/com/android/contacts/list/ContactBrowseListFragment.java
@@ -0,0 +1,272 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+import com.android.contacts.widget.ListViewUtils;
+
+import android.app.LoaderManager.LoaderCallbacks;
+import android.content.CursorLoader;
+import android.content.Loader;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Directory;
+import android.text.TextUtils;
+import android.widget.ListView;
+
+/**
+ * Fragment containing a contact list used for browsing (as compared to
+ * picking a contact with one of the PICK intents).
+ */
+public abstract class ContactBrowseListFragment extends
+        ContactEntryListFragment<ContactListAdapter> {
+
+    private static final String KEY_SELECTED_URI = "selectedUri";
+
+    private static final int SELECTED_ID_LOADER = -3;
+
+    private static final int SELECTION_VISIBILITY_REQUEST_NONE = 0;
+    private static final int SELECTION_VISIBILITY_REQUEST_SMOOTH = 1;
+    private static final int SELECTION_VISIBILITY_REQUEST_INSTANT = 2;
+
+    private Uri mSelectedContactUri;
+    private long mSelectedContactDirectoryId;
+    private String mSelectedContactLookupKey;
+    private int mSelectionVisibilityRequest;
+
+    private OnContactBrowserActionListener mListener;
+
+    private LoaderCallbacks<Cursor> mIdLoaderCallbacks = new LoaderCallbacks<Cursor>() {
+
+        @Override
+        public Loader<Cursor> onCreateLoader(int id, Bundle args) {
+            return new CursorLoader(getContext(),
+                    mSelectedContactUri,
+                    new String[] { Contacts.LOOKUP_KEY },
+                    null,
+                    null,
+                    null);
+        }
+
+        @Override
+        public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+            String lookupKey = null;
+            if (data != null) {
+                if (data.moveToFirst()) {
+                    lookupKey = data.getString(0);
+                }
+            }
+            if (!TextUtils.equals(mSelectedContactLookupKey, lookupKey)) {
+                mSelectedContactLookupKey = lookupKey;
+                configureContactSelection();
+            }
+            return;
+        }
+    };
+
+    @Override
+    public void restoreSavedState(Bundle savedState) {
+        super.restoreSavedState(savedState);
+
+        if (savedState == null) {
+            return;
+        }
+
+        mSelectedContactUri = savedState.getParcelable(KEY_SELECTED_URI);
+        parseSelectedContactUri();
+    }
+
+    @Override
+    public void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        outState.putParcelable(KEY_SELECTED_URI, mSelectedContactUri);
+    }
+
+    @Override
+    public void onStart() {
+        // Refresh the currently selected lookup in case it changed while we were sleeping
+        startLoadingContactLookupKey();
+        super.onStart();
+   }
+
+    protected void startLoadingContactLookupKey() {
+        if (isSelectionVisible() && mSelectedContactUri != null &&
+                (mSelectedContactDirectoryId == Directory.DEFAULT ||
+                        mSelectedContactDirectoryId == Directory.LOCAL_INVISIBLE)) {
+            getLoaderManager().restartLoader(SELECTED_ID_LOADER, null, mIdLoaderCallbacks);
+        } else {
+            getLoaderManager().stopLoader(SELECTED_ID_LOADER);
+        }
+    }
+
+    @Override
+    protected void prepareEmptyView() {
+        if (isSearchMode()) {
+            return;
+        } else if (isSyncActive()) {
+            if (hasIccCard()) {
+                setEmptyText(R.string.noContactsHelpTextWithSync);
+            } else {
+                setEmptyText(R.string.noContactsNoSimHelpTextWithSync);
+            }
+        } else {
+            if (hasIccCard()) {
+                setEmptyText(R.string.noContactsHelpText);
+            } else {
+                setEmptyText(R.string.noContactsNoSimHelpText);
+            }
+        }
+    }
+
+    public Uri getSelectedContactUri() {
+        return mSelectedContactUri;
+    }
+
+    public void setSelectedContactUri(Uri uri) {
+        if (mSelectedContactUri == null
+                || (mSelectedContactUri != null && !mSelectedContactUri.equals(uri))) {
+            mSelectedContactUri = uri;
+
+            parseSelectedContactUri();
+
+            if (isAdded()) {
+                // Configure the adapter to show the selection based on the lookup key extracted
+                // from the URI
+                configureAdapter();
+
+                // Also, launch a loader to pick up a new lookup key in case it has changed
+                startLoadingContactLookupKey();
+            }
+        }
+    }
+
+    private void parseSelectedContactUri() {
+        if (mSelectedContactUri != null) {
+            if (!mSelectedContactUri.toString()
+                    .startsWith(Contacts.CONTENT_LOOKUP_URI.toString())) {
+                throw new IllegalStateException(
+                        "Contact list contains a non-lookup URI: " + mSelectedContactUri);
+            }
+
+            String directoryParam =
+                mSelectedContactUri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY);
+            mSelectedContactDirectoryId = TextUtils.isEmpty(directoryParam)
+                    ? Directory.DEFAULT
+                    : Long.parseLong(directoryParam);
+            mSelectedContactLookupKey =
+                    Uri.encode(mSelectedContactUri.getPathSegments().get(2));
+        } else {
+            mSelectedContactDirectoryId = Directory.DEFAULT;
+            mSelectedContactLookupKey = null;
+        }
+    }
+
+    @Override
+    protected void configureAdapter() {
+        super.configureAdapter();
+        configureContactSelection();
+    }
+
+    /**
+     * Configures the adapter with the identity of the currently selected contact.
+     */
+    private void configureContactSelection() {
+        ContactListAdapter adapter = getAdapter();
+        if (adapter == null) {
+            return;
+        }
+
+        adapter.setSelectedContact(mSelectedContactDirectoryId, mSelectedContactLookupKey);
+    }
+
+    public void setOnContactListActionListener(OnContactBrowserActionListener listener) {
+        mListener = listener;
+    }
+
+    public void createNewContact() {
+        mListener.onCreateNewContactAction();
+    }
+
+    public void viewContact(Uri contactUri) {
+        mListener.onViewContactAction(contactUri);
+    }
+
+    public void editContact(Uri contactUri) {
+        mListener.onEditContactAction(contactUri);
+    }
+
+    public void deleteContact(Uri contactUri) {
+        mListener.onDeleteContactAction(contactUri);
+    }
+
+    public void addToFavorites(Uri contactUri) {
+        mListener.onAddToFavoritesAction(contactUri);
+    }
+
+    public void removeFromFavorites(Uri contactUri) {
+        mListener.onRemoveFromFavoritesAction(contactUri);
+    }
+
+    public void callContact(Uri contactUri) {
+        mListener.onCallContactAction(contactUri);
+    }
+
+    public void smsContact(Uri contactUri) {
+        mListener.onSmsContactAction(contactUri);
+    }
+
+    @Override
+    protected void finish() {
+        super.finish();
+        mListener.onFinishAction();
+    }
+
+    public void requestSelectionOnScreen(boolean smooth) {
+        mSelectionVisibilityRequest = smooth
+                ? SELECTION_VISIBILITY_REQUEST_SMOOTH
+                : SELECTION_VISIBILITY_REQUEST_INSTANT;
+        requestSelectionOnScreenIfNeeded();
+    }
+
+    @Override
+    protected void completeRestoreInstanceState() {
+        super.completeRestoreInstanceState();
+        requestSelectionOnScreenIfNeeded();
+    }
+
+    private void requestSelectionOnScreenIfNeeded() {
+        if (mSelectionVisibilityRequest == SELECTION_VISIBILITY_REQUEST_NONE) {
+            return;
+        }
+
+        ContactListAdapter adapter = getAdapter();
+        if (adapter == null) {
+            return;
+        }
+
+        int position = adapter.getSelectedContactPosition();
+        if (position != -1) {
+            boolean smooth = mSelectionVisibilityRequest == SELECTION_VISIBILITY_REQUEST_SMOOTH;
+            mSelectionVisibilityRequest = SELECTION_VISIBILITY_REQUEST_NONE;
+            ListView listView = getListView();
+            ListViewUtils.requestPositionToScreen(
+                    listView, position + listView.getHeaderViewsCount(), smooth);
+        }
+    }
+}
diff --git a/src/com/android/contacts/list/ContactEntryListAdapter.java b/src/com/android/contacts/list/ContactEntryListAdapter.java
new file mode 100644
index 0000000..f66003d
--- /dev/null
+++ b/src/com/android/contacts/list/ContactEntryListAdapter.java
@@ -0,0 +1,492 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+import com.android.contacts.widget.IndexerListAdapter;
+import com.android.contacts.widget.TextWithHighlightingFactory;
+
+import android.content.Context;
+import android.content.CursorLoader;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.provider.ContactsContract.ContactCounts;
+import android.provider.ContactsContract.Directory;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import java.util.HashSet;
+
+/**
+ * Common base class for various contact-related lists, e.g. contact list, phone number list
+ * etc.
+ */
+public abstract class ContactEntryListAdapter extends IndexerListAdapter {
+
+    private static final String TAG = "ContactEntryListAdapter";
+
+    /**
+     * Indicates whether the {@link Directory#LOCAL_INVISIBLE} directory should
+     * be included in the search.
+     */
+    private static final boolean LOCAL_INVISIBLE_DIRECTORY_ENABLED = false;
+
+    /**
+     * The animation is used here to allocate animated name text views.
+     */
+    private TextWithHighlightingFactory mTextWithHighlightingFactory;
+    private int mDisplayOrder;
+    private int mSortOrder;
+    private boolean mNameHighlightingEnabled;
+
+    private boolean mDisplayPhotos;
+    private boolean mQuickContactEnabled;
+    private ContactPhotoLoader mPhotoLoader;
+
+    private String mQueryString;
+    private char[] mUpperCaseQueryString;
+    private boolean mSearchMode;
+    private boolean mDirectorySearchEnabled;
+    private int mDirectoryResultLimit = Integer.MAX_VALUE;
+
+    private boolean mLoading = true;
+    private boolean mEmptyListEnabled = true;
+
+    private boolean mSelectionVisible;
+
+    public ContactEntryListAdapter(Context context) {
+        super(context, R.layout.list_section, R.id.header_text);
+        addPartitions();
+    }
+
+    protected void addPartitions() {
+        addPartition(createDefaultDirectoryPartition());
+    }
+
+    protected DirectoryPartition createDefaultDirectoryPartition() {
+        DirectoryPartition partition = new DirectoryPartition(true, true);
+        partition.setDirectoryId(Directory.DEFAULT);
+        partition.setDirectoryType(getContext().getString(R.string.contactsList));
+        partition.setPriorityDirectory(true);
+        partition.setPhotoSupported(true);
+        return partition;
+    }
+
+    private int getPartitionByDirectoryId(long id) {
+        int count = getPartitionCount();
+        for (int i = 0; i < count; i++) {
+            Partition partition = getPartition(i);
+            if (partition instanceof DirectoryPartition) {
+                if (((DirectoryPartition)partition).getDirectoryId() == id) {
+                    return i;
+                }
+            }
+        }
+        return -1;
+    }
+
+    public abstract String getContactDisplayName(int position);
+    public abstract void configureLoader(CursorLoader loader, long directoryId);
+
+    /**
+     * Marks all partitions as "loading"
+     */
+    public void onDataReload() {
+        boolean notify = false;
+        int count = getPartitionCount();
+        for (int i = 0; i < count; i++) {
+            Partition partition = getPartition(i);
+            if (partition instanceof DirectoryPartition) {
+                DirectoryPartition directoryPartition = (DirectoryPartition)partition;
+                if (!directoryPartition.isLoading()) {
+                    notify = true;
+                }
+                directoryPartition.setStatus(DirectoryPartition.STATUS_NOT_LOADED);
+            }
+        }
+        if (notify) {
+            notifyDataSetChanged();
+        }
+    }
+
+    public boolean isSearchMode() {
+        return mSearchMode;
+    }
+
+    public void setSearchMode(boolean flag) {
+        mSearchMode = flag;
+    }
+
+    public String getQueryString() {
+        return mQueryString;
+    }
+
+    public void setQueryString(String queryString) {
+        mQueryString = queryString;
+        if (TextUtils.isEmpty(queryString)) {
+            mUpperCaseQueryString = null;
+        } else {
+            mUpperCaseQueryString = queryString.toUpperCase().toCharArray();
+        }
+    }
+
+    public char[] getUpperCaseQueryString() {
+        return mUpperCaseQueryString;
+    }
+
+    public boolean isDirectorySearchEnabled() {
+        return mDirectorySearchEnabled;
+    }
+
+    public void setDirectorySearchEnabled(boolean flag) {
+        mDirectorySearchEnabled = flag;
+    }
+
+    public int getDirectoryResultLimit() {
+        return mDirectoryResultLimit;
+    }
+
+    public void setDirectoryResultLimit(int limit) {
+        this.mDirectoryResultLimit = limit;
+    }
+
+    public int getContactNameDisplayOrder() {
+        return mDisplayOrder;
+    }
+
+    public void setContactNameDisplayOrder(int displayOrder) {
+        mDisplayOrder = displayOrder;
+    }
+
+    public int getSortOrder() {
+        return mSortOrder;
+    }
+
+    public void setSortOrder(int sortOrder) {
+        mSortOrder = sortOrder;
+    }
+
+    public void setNameHighlightingEnabled(boolean flag) {
+        mNameHighlightingEnabled = flag;
+    }
+
+    public boolean isNameHighlightingEnabled() {
+        return mNameHighlightingEnabled;
+    }
+
+    public void setTextWithHighlightingFactory(TextWithHighlightingFactory factory) {
+        mTextWithHighlightingFactory = factory;
+    }
+
+    protected TextWithHighlightingFactory getTextWithHighlightingFactory() {
+        return mTextWithHighlightingFactory;
+    }
+
+    public void setPhotoLoader(ContactPhotoLoader photoLoader) {
+        mPhotoLoader = photoLoader;
+    }
+
+    protected ContactPhotoLoader getPhotoLoader() {
+        return mPhotoLoader;
+    }
+
+    public boolean getDisplayPhotos() {
+        return mDisplayPhotos;
+    }
+
+    public void setDisplayPhotos(boolean displayPhotos) {
+        mDisplayPhotos = displayPhotos;
+    }
+
+    public boolean isEmptyListEnabled() {
+        return mEmptyListEnabled;
+    }
+
+    public void setEmptyListEnabled(boolean flag) {
+        mEmptyListEnabled = flag;
+    }
+
+    public boolean isSelectionVisible() {
+        return mSelectionVisible;
+    }
+
+    public void setSelectionVisible(boolean flag) {
+        this.mSelectionVisible = flag;
+    }
+
+    public boolean isQuickContactEnabled() {
+        return mQuickContactEnabled;
+    }
+
+    public void setQuickContactEnabled(boolean quickContactEnabled) {
+        mQuickContactEnabled = quickContactEnabled;
+    }
+
+    public void configureDirectoryLoader(DirectoryListLoader loader) {
+        loader.setDirectorySearchEnabled(mDirectorySearchEnabled);
+        loader.setLocalInvisibleDirectoryEnabled(LOCAL_INVISIBLE_DIRECTORY_ENABLED);
+    }
+
+    /**
+     * Updates partitions according to the directory meta-data contained in the supplied
+     * cursor.  Takes ownership of the cursor and will close it.
+     */
+    public void changeDirectories(Cursor cursor) {
+        HashSet<Long> directoryIds = new HashSet<Long>();
+
+        int idColumnIndex = cursor.getColumnIndex(Directory._ID);
+        int directoryTypeColumnIndex = cursor.getColumnIndex(DirectoryListLoader.DIRECTORY_TYPE);
+        int displayNameColumnIndex = cursor.getColumnIndex(Directory.DISPLAY_NAME);
+        int photoSupportColumnIndex = cursor.getColumnIndex(Directory.PHOTO_SUPPORT);
+
+        // TODO preserve the order of partition to match those of the cursor
+        // Phase I: add new directories
+        cursor.moveToPosition(-1);
+        while (cursor.moveToNext()) {
+            long id = cursor.getLong(idColumnIndex);
+            directoryIds.add(id);
+            if (getPartitionByDirectoryId(id) == -1) {
+                DirectoryPartition partition = new DirectoryPartition(false, true);
+                partition.setDirectoryId(id);
+                partition.setDirectoryType(cursor.getString(directoryTypeColumnIndex));
+                partition.setDisplayName(cursor.getString(displayNameColumnIndex));
+                int photoSupport = cursor.getInt(photoSupportColumnIndex);
+                partition.setPhotoSupported(photoSupport == Directory.PHOTO_SUPPORT_THUMBNAIL_ONLY
+                        || photoSupport == Directory.PHOTO_SUPPORT_FULL);
+                addPartition(partition);
+            }
+        }
+
+        // Phase II: remove deleted directories
+        int count = getPartitionCount();
+        for (int i = count; --i >= 0; ) {
+            Partition partition = getPartition(i);
+            if (partition instanceof DirectoryPartition) {
+                long id = ((DirectoryPartition)partition).getDirectoryId();
+                if (!directoryIds.contains(id)) {
+                    removePartition(i);
+                }
+            }
+        }
+
+        invalidate();
+        notifyDataSetChanged();
+    }
+
+    @Override
+    public void changeCursor(int partitionIndex, Cursor cursor) {
+        if (partitionIndex >= getPartitionCount()) {
+            // There is no partition for this data
+            return;
+        }
+
+        Partition partition = getPartition(partitionIndex);
+        if (partition instanceof DirectoryPartition) {
+            ((DirectoryPartition)partition).setStatus(DirectoryPartition.STATUS_LOADED);
+        }
+
+        super.changeCursor(partitionIndex, cursor);
+
+        if (isSectionHeaderDisplayEnabled() && partitionIndex == getIndexedPartition()) {
+            updateIndexer(cursor);
+        }
+    }
+
+    public void changeCursor(Cursor cursor) {
+        changeCursor(0, cursor);
+    }
+
+    /**
+     * Updates the indexer, which is used to produce section headers.
+     */
+    private void updateIndexer(Cursor cursor) {
+        if (cursor == null) {
+            setIndexer(null);
+            return;
+        }
+
+        Bundle bundle = cursor.getExtras();
+        if (bundle.containsKey(ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_TITLES)) {
+            String sections[] =
+                    bundle.getStringArray(ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_TITLES);
+            int counts[] = bundle.getIntArray(ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS);
+            setIndexer(new ContactsSectionIndexer(sections, counts));
+        } else {
+            setIndexer(null);
+        }
+    }
+
+    @Override
+    public int getViewTypeCount() {
+        // We need a separate view type for each item type, plus another one for
+        // each type with header, plus one for "other".
+        return getItemViewTypeCount() * 2 + 1;
+    }
+
+    @Override
+    public int getItemViewType(int partitionIndex, int position) {
+        int type = super.getItemViewType(partitionIndex, position);
+        if (isSectionHeaderDisplayEnabled() && partitionIndex == getIndexedPartition()) {
+            Placement placement = getItemPlacementInSection(position);
+            return placement.firstInSection ? type : getItemViewTypeCount() + type;
+        } else {
+            return type;
+        }
+    }
+
+    @Override
+    public boolean isEmpty() {
+        // TODO
+//        if (contactsListActivity.mProviderStatus != ProviderStatus.STATUS_NORMAL) {
+//            return true;
+//        }
+
+        if (!mEmptyListEnabled) {
+            return false;
+        } else if (isSearchMode()) {
+            return TextUtils.isEmpty(getQueryString());
+        } else if (mLoading) {
+            // We don't want the empty state to show when loading.
+            return false;
+        } else {
+            return super.isEmpty();
+        }
+    }
+
+    public boolean isLoading() {
+        int count = getPartitionCount();
+        for (int i = 0; i < count; i++) {
+            Partition partition = getPartition(i);
+            if (partition instanceof DirectoryPartition
+                    && ((DirectoryPartition) partition).isLoading()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean areAllPartitionsEmpty() {
+        int count = getPartitionCount();
+        for (int i = 0; i < count; i++) {
+            if (!isPartitionEmpty(i)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Changes visibility parameters for the default directory partition.
+     */
+    public void configureDefaultPartition(boolean showIfEmpty, boolean hasHeader) {
+        int defaultPartitionIndex = -1;
+        int count = getPartitionCount();
+        for (int i = 0; i < count; i++) {
+            Partition partition = getPartition(i);
+            if (partition instanceof DirectoryPartition &&
+                    ((DirectoryPartition)partition).getDirectoryId() == Directory.DEFAULT) {
+                defaultPartitionIndex = i;
+                break;
+            }
+        }
+        if (defaultPartitionIndex != -1) {
+            setShowIfEmpty(defaultPartitionIndex, showIfEmpty);
+            setHasHeader(defaultPartitionIndex, hasHeader);
+        }
+    }
+
+    @Override
+    protected View newHeaderView(Context context, int partition, Cursor cursor,
+            ViewGroup parent) {
+        LayoutInflater inflater = LayoutInflater.from(context);
+        return inflater.inflate(R.layout.directory_header, parent, false);
+    }
+
+    @Override
+    protected void bindHeaderView(View view, int partitionIndex, Cursor cursor) {
+        Partition partition = getPartition(partitionIndex);
+        if (!(partition instanceof DirectoryPartition)) {
+            return;
+        }
+
+        DirectoryPartition directoryPartition = (DirectoryPartition)partition;
+        long directoryId = directoryPartition.getDirectoryId();
+        TextView labelTextView = (TextView)view.findViewById(R.id.label);
+        TextView displayNameTextView = (TextView)view.findViewById(R.id.display_name);
+        if (directoryId == Directory.DEFAULT || directoryId == Directory.LOCAL_INVISIBLE) {
+            labelTextView.setText(R.string.local_search_label);
+            displayNameTextView.setText(null);
+        } else {
+            labelTextView.setText(R.string.directory_search_label);
+            displayNameTextView.setText(buildDirectoryName(directoryPartition.getDirectoryType(),
+                    directoryPartition.getDisplayName()));
+        }
+
+        TextView countText = (TextView)view.findViewById(R.id.count);
+        if (directoryPartition.isLoading()) {
+            countText.setText(R.string.search_results_searching);
+        } else {
+            int count = cursor == null ? 0 : cursor.getCount();
+            if (directoryId != Directory.DEFAULT && directoryId != Directory.LOCAL_INVISIBLE
+                    && count >= getDirectoryResultLimit()) {
+                countText.setText(mContext.getString(
+                        R.string.foundTooManyContacts, getDirectoryResultLimit()));
+            } else {
+                countText.setText(getQuantityText(
+                        count, R.string.listFoundAllContactsZero, R.plurals.searchFoundContacts));
+            }
+        }
+    }
+
+    private CharSequence buildDirectoryName(String directoryType, String directoryName) {
+        String title;
+        if (!TextUtils.isEmpty(directoryName)) {
+            title = directoryName;
+            // TODO: STOPSHIP - remove this once this is done by both directory providers
+            int atIndex = title.indexOf('@');
+            if (atIndex != -1 && atIndex < title.length() - 2) {
+                final char firstLetter = Character.toUpperCase(title.charAt(atIndex + 1));
+                title = firstLetter + title.substring(atIndex + 2);
+            }
+        } else {
+            title = directoryType;
+        }
+
+        return title;
+    }
+
+    // TODO: fix PluralRules to handle zero correctly and use Resources.getQuantityText directly
+    public String getQuantityText(int count, int zeroResourceId, int pluralResourceId) {
+        if (count == 0) {
+            return getContext().getString(zeroResourceId);
+        } else {
+            String format = getContext().getResources()
+                    .getQuantityText(pluralResourceId, count).toString();
+            return String.format(format, count);
+        }
+    }
+
+    public boolean isPhotoSupported(int partitionIndex) {
+        Partition partition = getPartition(partitionIndex);
+        if (partition instanceof DirectoryPartition) {
+            return ((DirectoryPartition) partition).isPhotoSupported();
+        }
+        return true;
+    }
+}
diff --git a/src/com/android/contacts/list/ContactEntryListFragment.java b/src/com/android/contacts/list/ContactEntryListFragment.java
new file mode 100644
index 0000000..548b984
--- /dev/null
+++ b/src/com/android/contacts/list/ContactEntryListFragment.java
@@ -0,0 +1,1031 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import com.android.common.widget.CompositeCursorAdapter.Partition;
+import com.android.contacts.ContactListEmptyView;
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.R;
+import com.android.contacts.preference.ContactsPreferences;
+import com.android.contacts.widget.ContextMenuAdapter;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.LoaderManager;
+import android.app.LoaderManager.LoaderCallbacks;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.content.IContentService;
+import android.content.Intent;
+import android.content.Loader;
+import android.database.ContentObserver;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Parcelable;
+import android.os.RemoteException;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Directory;
+import android.provider.ContactsContract.ProviderStatus;
+import android.provider.Settings;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnFocusChangeListener;
+import android.view.View.OnTouchListener;
+import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.AbsListView;
+import android.widget.AbsListView.OnScrollListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.TextView;
+
+/**
+ * Common base class for various contact-related list fragments.
+ */
+public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter>
+        extends Fragment
+        implements OnItemClickListener, OnScrollListener, OnFocusChangeListener, OnTouchListener,
+                LoaderCallbacks<Cursor> {
+
+    // TODO: Make this protected. This should not be used from the ContactBrowserActivity but
+    // instead use the new startActivityWithResultFromFragment API
+    public static final int ACTIVITY_REQUEST_CODE_PICKER = 1;
+
+    private static final String TAG = "ContactEntryListFragment";
+
+    private static final String KEY_LIST_STATE = "liststate";
+    private static final String KEY_SECTION_HEADER_DISPLAY_ENABLED = "sectionHeaderDisplayEnabled";
+    private static final String KEY_PHOTO_LOADER_ENABLED = "photoLoaderEnabled";
+    private static final String KEY_QUICK_CONTACT_ENABLED = "quickContactEnabled";
+    private static final String KEY_SEARCH_MODE = "searchMode";
+    private static final String KEY_AIZY_ENABLED = "aizyEnabled";
+    private static final String KEY_QUERY_STRING = "queryString";
+    private static final String KEY_DIRECTORY_SEARCH_ENABLED = "directorySearchEnabled";
+    private static final String KEY_SELECTION_VISIBLE = "selectionVisible";
+    private static final String KEY_REQUEST = "request";
+    private static final String KEY_LEGACY_COMPATIBILITY = "legacyCompatibility";
+    private static final String KEY_DIRECTORY_RESULT_LIMIT = "directoryResultLimit";
+
+    private static final String DIRECTORY_ID_ARG_KEY = "directoryId";
+
+    private static final int DIRECTORY_LOADER_ID = -1;
+
+    private static final int DIRECTORY_SEARCH_DELAY_MILLIS = 300;
+    private static final int DIRECTORY_SEARCH_MESSAGE = 1;
+
+    private boolean mSectionHeaderDisplayEnabled;
+    private boolean mPhotoLoaderEnabled;
+    private boolean mQuickContactEnabled = true;
+    private boolean mSearchMode;
+    private boolean mAizyEnabled;
+    private String mQueryString;
+    private boolean mDirectorySearchEnabled;
+    private boolean mSelectionVisible;
+    private ContactsRequest mRequest;
+    private boolean mLegacyCompatibility;
+
+    private T mAdapter;
+    private View mView;
+    private ListView mListView;
+    private ContactListAizyView mAizy;
+
+    /**
+     * Used for keeping track of the scroll state of the list.
+     */
+    private Parcelable mListState;
+
+    private int mDisplayOrder;
+    private int mSortOrder;
+    private int mDirectoryResultLimit;
+
+    private ContextMenuAdapter mContextMenuAdapter;
+    private ContactPhotoLoader mPhotoLoader;
+    private ContactListEmptyView mEmptyView;
+    private ProviderStatusLoader mProviderStatusLoader;
+    private ContactsPreferences mContactsPrefs;
+
+    private int mProviderStatus = ProviderStatus.STATUS_NORMAL;
+
+    private boolean mForceLoad;
+    private boolean mLoadDirectoryList;
+
+    /**
+     * Indicates whether we are doing the initial complete load of data (false) or
+     * a refresh caused by a change notification (true)
+     */
+    private boolean mLoadPriorityDirectoriesOnly;
+
+    private Context mContext;
+
+    private LoaderManager mLoaderManager;
+
+    private Handler mDelayedDirectorySearchHandler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            if (msg.what == DIRECTORY_SEARCH_MESSAGE) {
+                loadDirectoryPartition(msg.arg1, (DirectoryPartition) msg.obj);
+            }
+        }
+    };
+
+    protected abstract View inflateView(LayoutInflater inflater, ViewGroup container);
+    protected abstract T createListAdapter();
+
+    /**
+     * @param position Please note that the position is already adjusted for
+     *            header views, so "0" means the first list item below header
+     *            views.
+     */
+    protected abstract void onItemClick(int position, long id);
+
+    @Override
+    public void onAttach(Activity activity) {
+        super.onAttach(activity);
+        setContext(activity);
+        setLoaderManager(super.getLoaderManager());
+    }
+
+    /**
+     * Sets a context for the fragment in the unit test environment.
+     */
+    public void setContext(Context context) {
+        mContext = context;
+        configurePhotoLoader();
+    }
+
+    public Context getContext() {
+        return mContext;
+    }
+
+    /**
+     * Overrides a loader manager for use in unit tests.
+     */
+    public void setLoaderManager(LoaderManager loaderManager) {
+        mLoaderManager = loaderManager;
+    }
+
+    @Override
+    public LoaderManager getLoaderManager() {
+        return mLoaderManager;
+    }
+
+    public T getAdapter() {
+        return mAdapter;
+    }
+
+    @Override
+    public View getView() {
+        return mView;
+    }
+
+    public ListView getListView() {
+        return mListView;
+    }
+
+    public ContactListEmptyView getEmptyView() {
+        return mEmptyView;
+    }
+
+    @Override
+    public void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        outState.putBoolean(KEY_SECTION_HEADER_DISPLAY_ENABLED, mSectionHeaderDisplayEnabled);
+        outState.putBoolean(KEY_PHOTO_LOADER_ENABLED, mPhotoLoaderEnabled);
+        outState.putBoolean(KEY_QUICK_CONTACT_ENABLED, mQuickContactEnabled);
+        outState.putBoolean(KEY_SEARCH_MODE, mSearchMode);
+        outState.putBoolean(KEY_AIZY_ENABLED, mAizyEnabled);
+        outState.putBoolean(KEY_DIRECTORY_SEARCH_ENABLED, mDirectorySearchEnabled);
+        outState.putBoolean(KEY_SELECTION_VISIBLE, mSelectionVisible);
+        outState.putBoolean(KEY_LEGACY_COMPATIBILITY, mLegacyCompatibility);
+        outState.putString(KEY_QUERY_STRING, mQueryString);
+        outState.putInt(KEY_DIRECTORY_RESULT_LIMIT, mDirectoryResultLimit);
+        outState.putParcelable(KEY_REQUEST, mRequest);
+
+        if (mListView != null) {
+            mListState = mListView.onSaveInstanceState();
+            outState.putParcelable(KEY_LIST_STATE, mListState);
+        }
+    }
+
+    @Override
+    public void onCreate(Bundle savedState) {
+        super.onCreate(savedState);
+        mContactsPrefs = new ContactsPreferences(mContext);
+        restoreSavedState(savedState);
+    }
+
+    public void restoreSavedState(Bundle savedState) {
+        if (savedState == null) {
+            return;
+        }
+
+        mSectionHeaderDisplayEnabled = savedState.getBoolean(KEY_SECTION_HEADER_DISPLAY_ENABLED);
+        mPhotoLoaderEnabled = savedState.getBoolean(KEY_PHOTO_LOADER_ENABLED);
+        mQuickContactEnabled = savedState.getBoolean(KEY_QUICK_CONTACT_ENABLED);
+        mSearchMode = savedState.getBoolean(KEY_SEARCH_MODE);
+        mAizyEnabled = savedState.getBoolean(KEY_AIZY_ENABLED);
+        mDirectorySearchEnabled = savedState.getBoolean(KEY_DIRECTORY_SEARCH_ENABLED);
+        mSelectionVisible = savedState.getBoolean(KEY_SELECTION_VISIBLE);
+        mLegacyCompatibility = savedState.getBoolean(KEY_LEGACY_COMPATIBILITY);
+        mQueryString = savedState.getString(KEY_QUERY_STRING);
+        mDirectoryResultLimit = savedState.getInt(KEY_DIRECTORY_RESULT_LIMIT);
+        mRequest = savedState.getParcelable(KEY_REQUEST);
+
+        // Retrieve list state. This will be applied in onLoadFinished
+        mListState = savedState.getParcelable(KEY_LIST_STATE);
+    }
+
+    /**
+     * Returns the parsed intent that started the activity hosting this fragment.
+     */
+    public ContactsRequest getContactsRequest() {
+        return mRequest;
+    }
+
+    /**
+     * Sets a parsed intent that started the activity hosting this fragment.
+     */
+    public void setContactsRequest(ContactsRequest request) {
+        mRequest = request;
+    }
+
+    @Override
+    public void onStart() {
+        mContactsPrefs.registerChangeListener(mPreferencesChangeListener);
+
+        if (mProviderStatusLoader == null) {
+            mProviderStatusLoader = new ProviderStatusLoader(mContext);
+        }
+
+        loadPreferences();
+
+        if (mListView instanceof ContactEntryListView) {
+            ContactEntryListView listView = (ContactEntryListView)mListView;
+            listView.setSelectionVisible(isSelectionVisible());
+        }
+
+        mForceLoad = false;
+        mLoadDirectoryList = true;
+        mLoadPriorityDirectoriesOnly = true;
+
+        startLoading();
+        super.onStart();
+    }
+
+    protected void startLoading() {
+        configureAdapter();
+        int partitionCount = mAdapter.getPartitionCount();
+        for (int i = 0; i < partitionCount; i++) {
+            Partition partition = mAdapter.getPartition(i);
+            if (partition instanceof DirectoryPartition) {
+                DirectoryPartition directoryPartition = (DirectoryPartition)partition;
+                if (directoryPartition.getStatus() == DirectoryPartition.STATUS_NOT_LOADED) {
+                    if (directoryPartition.isPriorityDirectory() || !mLoadPriorityDirectoriesOnly) {
+                        startLoadingDirectoryPartition(i);
+                    }
+                }
+            } else {
+                getLoaderManager().initLoader(i, null, this);
+            }
+        }
+
+        // Next time this method is called, we should start loading non-priority directories
+        mLoadPriorityDirectoriesOnly = false;
+    }
+
+    @Override
+    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
+        if (id == DIRECTORY_LOADER_ID) {
+            DirectoryListLoader loader = new DirectoryListLoader(mContext);
+            mAdapter.configureDirectoryLoader(loader);
+            return loader;
+        } else {
+            CursorLoader loader = new CursorLoader(mContext, null, null, null, null, null);
+            long directoryId = args != null && args.containsKey(DIRECTORY_ID_ARG_KEY)
+                    ? args.getLong(DIRECTORY_ID_ARG_KEY)
+                    : Directory.DEFAULT;
+            mAdapter.configureLoader(loader, directoryId);
+            return loader;
+        }
+    }
+
+    private void startLoadingDirectoryPartition(int partitionIndex) {
+        DirectoryPartition partition = (DirectoryPartition)mAdapter.getPartition(partitionIndex);
+        partition.setStatus(DirectoryPartition.STATUS_LOADING);
+        long directoryId = partition.getDirectoryId();
+        if (mForceLoad) {
+            if (directoryId == Directory.DEFAULT) {
+                loadDirectoryPartition(partitionIndex, partition);
+            } else {
+                loadDirectoryPartitionDelayed(partitionIndex, partition);
+            }
+        } else {
+            Bundle args = new Bundle();
+            args.putLong(DIRECTORY_ID_ARG_KEY, directoryId);
+            getLoaderManager().initLoader(partitionIndex, args, this);
+        }
+    }
+
+    /**
+     * Queues up a delayed request to search the specified directory. Since
+     * directory search will likely introduce a lot of network traffic, we want
+     * to wait for a pause in the user's typing before sending a directory request.
+     */
+    private void loadDirectoryPartitionDelayed(int partitionIndex, DirectoryPartition partition) {
+        mDelayedDirectorySearchHandler.removeMessages(DIRECTORY_SEARCH_MESSAGE, partition);
+        Message msg = mDelayedDirectorySearchHandler.obtainMessage(
+                DIRECTORY_SEARCH_MESSAGE, partitionIndex, 0, partition);
+        mDelayedDirectorySearchHandler.sendMessageDelayed(msg, DIRECTORY_SEARCH_DELAY_MILLIS);
+    }
+
+    /**
+     * Loads the directory partition.
+     */
+    protected void loadDirectoryPartition(int partitionIndex, DirectoryPartition partition) {
+        Bundle args = new Bundle();
+        args.putLong(DIRECTORY_ID_ARG_KEY, partition.getDirectoryId());
+        getLoaderManager().restartLoader(partitionIndex, args, this);
+    }
+
+    /**
+     * Cancels all queued directory loading requests.
+     */
+    private void removePendingDirectorySearchRequests() {
+        mDelayedDirectorySearchHandler.removeMessages(DIRECTORY_SEARCH_MESSAGE);
+    }
+
+    @Override
+    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+        if (!checkProviderStatus(false)) {
+            if (data != null) {
+                data.close();
+            }
+            return;
+        }
+
+        int loaderId = loader.getId();
+        if (loaderId == DIRECTORY_LOADER_ID) {
+            mAdapter.changeDirectories(data);
+            startLoading();
+        } else {
+            onPartitionLoaded(loaderId, data);
+            if (isDirectorySearchEnabled()) {
+                if (mLoadDirectoryList) {
+                    mLoadDirectoryList = false;
+                    getLoaderManager().initLoader(DIRECTORY_LOADER_ID, null, this);
+                } else {
+                    startLoading();
+                }
+            }
+
+        }
+
+// TODO fix the empty view
+//            if (mEmptyView != null && (data == null || data.getCount() == 0)) {
+//                prepareEmptyView();
+//            }
+    }
+
+    protected void onPartitionLoaded(int partitionIndex, Cursor data) {
+        mAdapter.changeCursor(partitionIndex, data);
+        showCount(partitionIndex, data);
+        if (partitionIndex == mAdapter.getIndexedPartition()) {
+            mAizy.setIndexer(mAdapter.getIndexer(), data.getCount());
+        }
+
+        // TODO should probably only restore instance state after all directories are loaded
+        completeRestoreInstanceState();
+    }
+
+    @Override
+    public void onStop() {
+        super.onStop();
+        mContactsPrefs.unregisterChangeListener();
+        mAdapter.clearPartitions();
+    }
+
+    protected void reloadData() {
+        removePendingDirectorySearchRequests();
+        mAdapter.onDataReload();
+        mLoadPriorityDirectoriesOnly = true;
+        mForceLoad = true;
+        startLoading();
+    }
+
+    /**
+     * Configures the empty view. It is called when we are about to populate
+     * the list with an empty cursor.
+     */
+    protected void prepareEmptyView() {
+    }
+
+    /**
+     * Shows the count of entries included in the list. The default
+     * implementation does nothing.
+     */
+    protected void showCount(int partitionIndex, Cursor data) {
+    }
+
+    /**
+     * Provides logic that dismisses this fragment. The default implementation
+     * does nothing.
+     */
+    protected void finish() {
+    }
+
+    public void setSectionHeaderDisplayEnabled(boolean flag) {
+        mSectionHeaderDisplayEnabled = flag;
+        if (mAdapter != null) {
+            mAdapter.setSectionHeaderDisplayEnabled(flag);
+        }
+        configureAizy();
+    }
+
+    public boolean isSectionHeaderDisplayEnabled() {
+        return mSectionHeaderDisplayEnabled;
+    }
+
+    public void setAizyEnabled(boolean flag) {
+        mAizyEnabled = flag;
+        configureAizy();
+    }
+
+    public boolean isAizyEnabled() {
+        return mAizyEnabled;
+    }
+
+    private void configureAizy() {
+        boolean hasAisy = isAizyEnabled() && isSectionHeaderDisplayEnabled();
+
+        if (mListView != null) {
+            mListView.setFastScrollEnabled(!hasAisy);
+            mListView.setVerticalScrollBarEnabled(!hasAisy);
+        }
+        if (mAizy != null) {
+            if (hasAisy) {
+                mAizy.setVisibility(View.VISIBLE);
+            } else if (isAizyEnabled()) {
+                mAizy.setVisibility(View.INVISIBLE);
+            } else {
+                mAizy.setVisibility(View.GONE);
+            }
+        }
+    }
+
+    public void setPhotoLoaderEnabled(boolean flag) {
+        mPhotoLoaderEnabled = flag;
+        configurePhotoLoader();
+    }
+
+    public boolean isPhotoLoaderEnabled() {
+        return mPhotoLoaderEnabled;
+    }
+
+    /**
+     * Returns true if the list is supposed to visually highlight the selected item.
+     */
+    public boolean isSelectionVisible() {
+        return mSelectionVisible;
+    }
+
+    public void setSelectionVisible(boolean flag) {
+        this.mSelectionVisible = flag;
+    }
+
+    public void setQuickContactEnabled(boolean flag) {
+        this.mQuickContactEnabled = flag;
+    }
+
+    public void setSearchMode(boolean flag) {
+        if (mSearchMode != flag) {
+            mSearchMode = flag;
+            setSectionHeaderDisplayEnabled(!mSearchMode);
+
+            if (mAdapter != null) {
+                mAdapter.clearPartitions();
+                mAdapter.setSearchMode(flag);
+                mAdapter.setPinnedPartitionHeadersEnabled(flag);
+                mAdapter.configureDefaultPartition(false, flag);
+                reloadData();
+            }
+
+            if (mListView != null) {
+                mListView.setFastScrollEnabled(!flag);
+            }
+        }
+    }
+
+    public boolean isSearchMode() {
+        return mSearchMode;
+    }
+
+    public String getQueryString() {
+        return mQueryString;
+    }
+
+    public void setQueryString(String queryString) {
+        if (!TextUtils.equals(mQueryString, queryString)) {
+            mQueryString = queryString;
+            if (mAdapter != null) {
+                mAdapter.setQueryString(queryString);
+                reloadData();
+            }
+        }
+    }
+
+    public boolean isDirectorySearchEnabled() {
+        return mDirectorySearchEnabled;
+    }
+
+    public void setDirectorySearchEnabled(boolean flag) {
+        mDirectorySearchEnabled = flag;
+    }
+
+    public boolean isLegacyCompatibilityMode() {
+        return mLegacyCompatibility;
+    }
+
+    public void setLegacyCompatibilityMode(boolean flag) {
+        mLegacyCompatibility = flag;
+    }
+
+    protected int getContactNameDisplayOrder() {
+        return mDisplayOrder;
+    }
+
+    protected void setContactNameDisplayOrder(int displayOrder) {
+        mDisplayOrder = displayOrder;
+        if (mAdapter != null) {
+            mAdapter.setContactNameDisplayOrder(displayOrder);
+        }
+    }
+
+    public int getSortOrder() {
+        return mSortOrder;
+    }
+
+    public void setSortOrder(int sortOrder) {
+        mSortOrder = sortOrder;
+        if (mAdapter != null) {
+            mAdapter.setSortOrder(sortOrder);
+        }
+    }
+
+    public void setDirectoryResultLimit(int limit) {
+        mDirectoryResultLimit = limit;
+    }
+
+    public void setContextMenuAdapter(ContextMenuAdapter adapter) {
+        mContextMenuAdapter = adapter;
+        if (mListView != null) {
+            mListView.setOnCreateContextMenuListener(adapter);
+        }
+    }
+
+    public ContextMenuAdapter getContextMenuAdapter() {
+        return mContextMenuAdapter;
+    }
+
+    protected void loadPreferences() {
+        setContactNameDisplayOrder(mContactsPrefs.getDisplayOrder());
+        setSortOrder(mContactsPrefs.getSortOrder());
+        if (mListView instanceof ContactEntryListView) {
+            ContactEntryListView listView = (ContactEntryListView)mListView;
+            listView.setHighlightNamesWhenScrolling(isNameHighlighingEnabled());
+        }
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        onCreateView(inflater, container);
+
+        mAdapter = createListAdapter();
+
+        boolean searchMode = isSearchMode();
+        mAdapter.setSearchMode(searchMode);
+        mAdapter.configureDefaultPartition(false, searchMode);
+        mAdapter.setPhotoLoader(mPhotoLoader);
+        mListView.setAdapter(mAdapter);
+
+        if (!isSearchMode()) {
+            mListView.setFocusableInTouchMode(true);
+            mListView.requestFocus();
+        }
+
+        return mView;
+    }
+
+    protected void onCreateView(LayoutInflater inflater, ViewGroup container) {
+        mView = inflateView(inflater, container);
+
+        mListView = (ListView)mView.findViewById(android.R.id.list);
+        if (mListView == null) {
+            throw new RuntimeException(
+                    "Your content must have a ListView whose id attribute is " +
+                    "'android.R.id.list'");
+        }
+
+        View emptyView = mView.findViewById(com.android.internal.R.id.empty);
+        if (emptyView != null) {
+            mListView.setEmptyView(emptyView);
+            if (emptyView instanceof ContactListEmptyView) {
+                mEmptyView = (ContactListEmptyView)emptyView;
+            }
+        }
+
+        mListView.setOnItemClickListener(this);
+        mListView.setOnFocusChangeListener(this);
+        mListView.setOnTouchListener(this);
+        mListView.setFastScrollEnabled(!isSearchMode());
+
+        // Tell list view to not show dividers. We'll do it ourself so that we can *not* show
+        // them when an A-Z headers is visible.
+        mListView.setDividerHeight(0);
+
+        // We manually save/restore the listview state
+        mListView.setSaveEnabled(false);
+
+        if (mContextMenuAdapter != null) {
+            mListView.setOnCreateContextMenuListener(mContextMenuAdapter);
+        }
+
+        mAizy = (ContactListAizyView) mView.findViewById(R.id.contacts_list_aizy);
+        mAizy.setListener(new ContactListAizyView.Listener() {
+            @Override
+            public void onScroll(int position) {
+                mListView.smoothScrollToPositionFromTop(position + mListView.getHeaderViewsCount(),
+                        0);
+            }
+        });
+
+        configureAizy();
+        configurePhotoLoader();
+    }
+
+    protected void configurePhotoLoader() {
+        if (isPhotoLoaderEnabled() && mContext != null) {
+            if (mPhotoLoader == null) {
+                mPhotoLoader = new ContactPhotoLoader(mContext, R.drawable.ic_contact_list_picture);
+            }
+            if (mListView != null) {
+                mListView.setOnScrollListener(this);
+            }
+            if (mAdapter != null) {
+                mAdapter.setPhotoLoader(mPhotoLoader);
+            }
+        }
+    }
+
+    protected void configureAdapter() {
+        if (mAdapter == null) {
+            return;
+        }
+
+        mAdapter.setQuickContactEnabled(mQuickContactEnabled);
+        mAdapter.setQueryString(mQueryString);
+        mAdapter.setDirectorySearchEnabled(mDirectorySearchEnabled);
+        mAdapter.setPinnedPartitionHeadersEnabled(mSearchMode);
+        mAdapter.setContactNameDisplayOrder(mDisplayOrder);
+        mAdapter.setSortOrder(mSortOrder);
+        mAdapter.setNameHighlightingEnabled(isNameHighlighingEnabled());
+        mAdapter.setSectionHeaderDisplayEnabled(mSectionHeaderDisplayEnabled);
+        mAdapter.setSelectionVisible(mSelectionVisible);
+        mAdapter.setDirectoryResultLimit(mDirectoryResultLimit);
+    }
+
+    protected boolean isNameHighlighingEnabled() {
+        // When sort order and display order contradict each other, we want to
+        // highlight the part of the name used for sorting.
+        if (mSortOrder == ContactsContract.Preferences.SORT_ORDER_PRIMARY &&
+                mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_ALTERNATIVE) {
+            return true;
+        } else if (mSortOrder == ContactsContract.Preferences.SORT_ORDER_ALTERNATIVE &&
+                mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
+            int totalItemCount) {
+        if (isAizyEnabled()) {
+            mAizy.listOnScroll(firstVisibleItem);
+        }
+    }
+
+    public void onScrollStateChanged(AbsListView view, int scrollState) {
+        if (scrollState == OnScrollListener.SCROLL_STATE_FLING) {
+            mPhotoLoader.pause();
+        } else if (isPhotoLoaderEnabled()) {
+            mPhotoLoader.resume();
+        }
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+
+        registerProviderStatusObserver();
+
+        if (isPhotoLoaderEnabled()) {
+            mPhotoLoader.resume();
+        }
+    }
+
+    @Override
+    public void onDestroy() {
+        if (isPhotoLoaderEnabled()) {
+            mPhotoLoader.stop();
+        }
+        super.onDestroy();
+    }
+
+    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+        hideSoftKeyboard();
+
+        int adjPosition = position - mListView.getHeaderViewsCount();
+        if (adjPosition >= 0) {
+            onItemClick(adjPosition, id);
+        }
+    }
+
+    private void hideSoftKeyboard() {
+        // Hide soft keyboard, if visible
+        InputMethodManager inputMethodManager = (InputMethodManager)
+                mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
+        inputMethodManager.hideSoftInputFromWindow(mListView.getWindowToken(), 0);
+    }
+
+    /**
+     * Dismisses the soft keyboard when the list takes focus.
+     */
+    public void onFocusChange(View view, boolean hasFocus) {
+        if (view == mListView && hasFocus) {
+            hideSoftKeyboard();
+        }
+    }
+
+    /**
+     * Dismisses the soft keyboard when the list is touched.
+     */
+    public boolean onTouch(View view, MotionEvent event) {
+        if (view == mListView) {
+            hideSoftKeyboard();
+        }
+        return false;
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        removePendingDirectorySearchRequests();
+        unregisterProviderStatusObserver();
+    }
+
+    /**
+     * Dismisses the search UI along with the keyboard if the filter text is empty.
+     */
+    public void onClose() {
+        hideSoftKeyboard();
+        finish();
+    }
+
+    /**
+     * Restore the list state after the adapter is populated.
+     */
+    protected void completeRestoreInstanceState() {
+        if (mListState != null) {
+            mListView.onRestoreInstanceState(mListState);
+            mListState = null;
+        }
+    }
+
+    private ContentObserver mProviderStatusObserver = new ContentObserver(new Handler()) {
+        @Override
+        public void onChange(boolean selfChange) {
+            checkProviderStatus(true);
+        }
+    };
+
+    /**
+     * Register an observer for provider status changes - we will need to
+     * reflect them in the UI.
+     */
+    private void registerProviderStatusObserver() {
+        mContext.getContentResolver().registerContentObserver(ProviderStatus.CONTENT_URI,
+                false, mProviderStatusObserver);
+    }
+
+    /**
+     * Register an observer for provider status changes - we will need to
+     * reflect them in the UI.
+     */
+    private void unregisterProviderStatusObserver() {
+        mContext.getContentResolver().unregisterContentObserver(mProviderStatusObserver);
+    }
+
+    /**
+     * Obtains the contacts provider status and configures the UI accordingly.
+     *
+     * @param loadData true if the method needs to start a query when the
+     *            provider is in the normal state
+     * @return true if the provider status is normal
+     */
+    private boolean checkProviderStatus(boolean loadData) {
+        View importFailureView = findViewById(R.id.import_failure);
+        if (importFailureView == null) {
+            return true;
+        }
+
+        // This query can be performed on the UI thread because
+        // the API explicitly allows such use.
+        Cursor cursor = mContext.getContentResolver().query(ProviderStatus.CONTENT_URI,
+                new String[] { ProviderStatus.STATUS, ProviderStatus.DATA1 }, null, null, null);
+        if (cursor != null) {
+            try {
+                if (cursor.moveToFirst()) {
+                    int status = cursor.getInt(0);
+                    if (status != mProviderStatus) {
+                        mProviderStatus = status;
+                        switch (status) {
+                            case ProviderStatus.STATUS_NORMAL:
+                                mAdapter.notifyDataSetInvalidated();
+                                if (loadData) {
+                                    reloadData();
+                                }
+                                break;
+
+                            case ProviderStatus.STATUS_CHANGING_LOCALE:
+                                setEmptyText(R.string.locale_change_in_progress);
+                                mAdapter.changeCursor(null);
+                                mAdapter.notifyDataSetInvalidated();
+                                break;
+
+                            case ProviderStatus.STATUS_UPGRADING:
+                                setEmptyText(R.string.upgrade_in_progress);
+                                mAdapter.changeCursor(null);
+                                mAdapter.notifyDataSetInvalidated();
+                                break;
+
+                            case ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY:
+                                long size = cursor.getLong(1);
+                                String message = mContext.getResources().getString(
+                                        R.string.upgrade_out_of_memory, new Object[] {size});
+                                TextView messageView = (TextView) findViewById(R.id.emptyText);
+                                messageView.setText(message);
+                                messageView.setVisibility(View.VISIBLE);
+                                configureImportFailureView(importFailureView);
+                                mAdapter.changeCursor(null);
+                                mAdapter.notifyDataSetInvalidated();
+                                break;
+                        }
+                    }
+                }
+            } finally {
+                cursor.close();
+            }
+        }
+
+        importFailureView.setVisibility(
+                mProviderStatus == ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY
+                        ? View.VISIBLE
+                        : View.GONE);
+        return mProviderStatus == ProviderStatus.STATUS_NORMAL;
+    }
+
+    private void configureImportFailureView(View importFailureView) {
+
+        OnClickListener listener = new OnClickListener(){
+
+            public void onClick(View v) {
+                switch(v.getId()) {
+                    case R.id.import_failure_uninstall_apps: {
+                        // TODO break into a separate method
+                        startActivity(new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS));
+                        break;
+                    }
+                    case R.id.import_failure_retry_upgrade: {
+                        // Send a provider status update, which will trigger a retry
+                        ContentValues values = new ContentValues();
+                        values.put(ProviderStatus.STATUS, ProviderStatus.STATUS_UPGRADING);
+                        mContext.getContentResolver().update(ProviderStatus.CONTENT_URI,
+                                values, null, null);
+                        break;
+                    }
+                }
+            }};
+
+        Button uninstallApps = (Button) findViewById(R.id.import_failure_uninstall_apps);
+        uninstallApps.setOnClickListener(listener);
+
+        Button retryUpgrade = (Button) findViewById(R.id.import_failure_retry_upgrade);
+        retryUpgrade.setOnClickListener(listener);
+    }
+
+    private View findViewById(int id) {
+        return mView.findViewById(id);
+    }
+
+    // TODO: fix PluralRules to handle zero correctly and use Resources.getQuantityText directly
+    public String getQuantityText(int count, int zeroResourceId, int pluralResourceId) {
+        if (count == 0) {
+            return mContext.getString(zeroResourceId);
+        } else {
+            String format = mContext.getResources()
+                    .getQuantityText(pluralResourceId, count).toString();
+            return String.format(format, count);
+        }
+    }
+
+    protected void setEmptyText(int resourceId) {
+        TextView empty = (TextView) getEmptyView().findViewById(R.id.emptyText);
+        empty.setText(mContext.getText(resourceId));
+        empty.setVisibility(View.VISIBLE);
+    }
+
+    // TODO redesign into an async task or loader
+    protected boolean isSyncActive() {
+        Account[] accounts = AccountManager.get(mContext).getAccounts();
+        if (accounts != null && accounts.length > 0) {
+            IContentService contentService = ContentResolver.getContentService();
+            for (Account account : accounts) {
+                try {
+                    if (contentService.isSyncActive(account, ContactsContract.AUTHORITY)) {
+                        return true;
+                    }
+                } catch (RemoteException e) {
+                    Log.e(TAG, "Could not get the sync status");
+                }
+            }
+        }
+        return false;
+    }
+
+    protected boolean hasIccCard() {
+        TelephonyManager telephonyManager =
+                (TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE);
+        return telephonyManager.hasIccCard();
+    }
+
+    /**
+     * Processes a user request to start search. This may be triggered by the
+     * search key, a menu item or some other user action.
+     */
+    public void startSearch(String initialQuery) {
+        ContactsSearchManager.startSearch(getActivity(), initialQuery, mRequest);
+    }
+
+    /**
+     * Processes a result returned by the contact picker.
+     */
+    public void onPickerResult(Intent data) {
+        throw new UnsupportedOperationException("Picker result handler is not implemented.");
+    }
+
+    // TODO integrate into picker fragments
+//    protected Uri buildCallingPackageUri(Uri uri) {
+//        String callingPackage = getContext().getCallingPackage();
+//        if (!TextUtils.isEmpty(callingPackage)) {
+//            uri = uri.buildUpon().appendQueryParameter(
+//                    ContactsContract.REQUESTING_PACKAGE_PARAM_KEY, callingPackage).build();
+//        }
+//    }
+    private ContactsPreferences.ChangeListener mPreferencesChangeListener =
+            new ContactsPreferences.ChangeListener() {
+        @Override
+        public void onChange() {
+            loadPreferences();
+            reloadData();
+        }
+    };
+}
diff --git a/src/com/android/contacts/list/ContactEntryListView.java b/src/com/android/contacts/list/ContactEntryListView.java
new file mode 100644
index 0000000..7ef7732
--- /dev/null
+++ b/src/com/android/contacts/list/ContactEntryListView.java
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import com.android.contacts.widget.PinnedHeaderListView;
+import com.android.contacts.widget.TextHighlightingAnimation;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.ColorFilter;
+import android.graphics.PixelFormat;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.widget.AbsListView;
+import android.widget.ListAdapter;
+
+/**
+ * A custom list view for a list of contacts or contact-related entries.  It handles
+ * animation of names on scroll.
+ */
+public class ContactEntryListView extends PinnedHeaderListView {
+
+    private static final int TEXT_HIGHLIGHTING_ANIMATION_DURATION = 350;
+
+    private final TextHighlightingAnimation mHighlightingAnimation =
+            new ContactNameHighlightingAnimation(this, TEXT_HIGHLIGHTING_ANIMATION_DURATION);
+
+    private boolean mHighlightNamesWhenScrolling;
+    private Drawable mDefaultSelector;
+    private boolean mSelectionVisible;
+
+    public ContactEntryListView(Context context) {
+        this(context, null);
+    }
+
+    public ContactEntryListView(Context context, AttributeSet attrs) {
+        this(context, attrs, com.android.internal.R.attr.listViewStyle);
+    }
+
+    public ContactEntryListView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+        mDefaultSelector = getSelector();
+    }
+
+    public TextHighlightingAnimation getTextHighlightingAnimation() {
+        return mHighlightingAnimation;
+    }
+
+    public boolean getHighlightNamesWhenScrolling() {
+        return mHighlightNamesWhenScrolling;
+    }
+
+    public void setHighlightNamesWhenScrolling(boolean flag) {
+        mHighlightNamesWhenScrolling = flag;
+    }
+
+    public void setSelectionVisible(boolean selectionVisible) {
+        if (selectionVisible != mSelectionVisible) {
+            mSelectionVisible = selectionVisible;
+            if (selectionVisible) {
+                // When a persistent selection is handled by the adapter,
+                // we want to disable the standard selection drawing.
+                setSelector(new EmptyDrawable());
+            } else {
+                setSelector(mDefaultSelector);
+            }
+        }
+    }
+
+    @Override
+    public void setAdapter(ListAdapter adapter) {
+        super.setAdapter(adapter);
+        if (adapter instanceof ContactEntryListAdapter) {
+            ((ContactEntryListAdapter)adapter)
+                    .setTextWithHighlightingFactory(mHighlightingAnimation);
+        }
+    }
+
+    @Override
+    public void onScrollStateChanged(AbsListView view, int scrollState) {
+        super.onScrollStateChanged(view, scrollState);
+        if (mHighlightNamesWhenScrolling) {
+            if (scrollState != OnScrollListener.SCROLL_STATE_IDLE) {
+                mHighlightingAnimation.startHighlighting();
+            } else {
+                mHighlightingAnimation.stopHighlighting();
+            }
+        }
+    }
+
+    /**
+     * A drawable that is ignored.  We have to use an empty drawable instead
+     * of null, because ListView does not allow selection to be null.
+     */
+    private class EmptyDrawable extends Drawable {
+
+        @Override
+        public void draw(Canvas canvas) {
+        }
+
+        @Override
+        public int getOpacity() {
+            return PixelFormat.OPAQUE;
+        }
+
+        @Override
+        public void setAlpha(int alpha) {
+        }
+
+        @Override
+        public void setColorFilter(ColorFilter cf) {
+        }
+    }
+}
diff --git a/src/com/android/contacts/list/ContactListAdapter.java b/src/com/android/contacts/list/ContactListAdapter.java
new file mode 100644
index 0000000..7e2c4c2
--- /dev/null
+++ b/src/com/android/contacts/list/ContactListAdapter.java
@@ -0,0 +1,329 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.ContactCounts;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.Directory;
+import android.provider.ContactsContract.SearchSnippetColumns;
+import android.text.TextUtils;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ListView;
+import android.widget.QuickContactBadge;
+
+import java.util.List;
+
+/**
+ * A cursor adapter for the {@link ContactsContract.Contacts#CONTENT_TYPE} content type.
+ */
+public abstract class ContactListAdapter extends ContactEntryListAdapter {
+
+    protected static final String[] PROJECTION_CONTACT = new String[] {
+        Contacts._ID,                           // 0
+        Contacts.DISPLAY_NAME_PRIMARY,          // 1
+        Contacts.DISPLAY_NAME_ALTERNATIVE,      // 2
+        Contacts.SORT_KEY_PRIMARY,              // 3
+        Contacts.STARRED,                       // 4
+        Contacts.CONTACT_PRESENCE,              // 5
+        Contacts.PHOTO_ID,                      // 6
+        Contacts.PHOTO_THUMBNAIL_URI,           // 7
+        Contacts.LOOKUP_KEY,                    // 8
+        Contacts.PHONETIC_NAME,                 // 9
+        Contacts.HAS_PHONE_NUMBER,              // 10
+    };
+
+    protected static final String[] PROJECTION_DATA = new String[] {
+        Data.CONTACT_ID,                        // 0
+        Data.DISPLAY_NAME_PRIMARY,              // 1
+        Data.DISPLAY_NAME_ALTERNATIVE,          // 2
+        Data.SORT_KEY_PRIMARY,                  // 3
+        Data.STARRED,                           // 4
+        Data.CONTACT_PRESENCE,                  // 5
+        Data.PHOTO_ID,                          // 6
+        Data.PHOTO_THUMBNAIL_URI,               // 7
+        Data.LOOKUP_KEY,                        // 8
+        Data.PHONETIC_NAME,                     // 9
+        Data.HAS_PHONE_NUMBER,                  // 10
+    };
+
+    protected static final String[] FILTER_PROJECTION = new String[] {
+        Contacts._ID,                           // 0
+        Contacts.DISPLAY_NAME_PRIMARY,          // 1
+        Contacts.DISPLAY_NAME_ALTERNATIVE,      // 2
+        Contacts.SORT_KEY_PRIMARY,              // 3
+        Contacts.STARRED,                       // 4
+        Contacts.CONTACT_PRESENCE,              // 5
+        Contacts.PHOTO_ID,                      // 6
+        Contacts.PHOTO_THUMBNAIL_URI,           // 7
+        Contacts.LOOKUP_KEY,                    // 8
+        Contacts.PHONETIC_NAME,                 // 9
+        Contacts.HAS_PHONE_NUMBER,              // 10
+        SearchSnippetColumns.SNIPPET_MIMETYPE,  // 11
+        SearchSnippetColumns.SNIPPET_DATA1,     // 12
+        SearchSnippetColumns.SNIPPET_DATA4,     // 13
+    };
+
+    protected static final int CONTACT_ID_COLUMN_INDEX = 0;
+    protected static final int CONTACT_DISPLAY_NAME_PRIMARY_COLUMN_INDEX = 1;
+    protected static final int CONTACT_DISPLAY_NAME_ALTERNATIVE_COLUMN_INDEX = 2;
+    protected static final int CONTACT_SORT_KEY_PRIMARY_COLUMN_INDEX = 3;
+    protected static final int CONTACT_STARRED_COLUMN_INDEX = 4;
+    protected static final int CONTACT_PRESENCE_STATUS_COLUMN_INDEX = 5;
+    protected static final int CONTACT_PHOTO_ID_COLUMN_INDEX = 6;
+    protected static final int CONTACT_PHOTO_URI_COLUMN_INDEX = 7;
+    protected static final int CONTACT_LOOKUP_KEY_COLUMN_INDEX = 8;
+    protected static final int CONTACT_PHONETIC_NAME_COLUMN_INDEX = 9;
+    protected static final int CONTACT_HAS_PHONE_COLUMN_INDEX = 10;
+    protected static final int CONTACT_SNIPPET_MIMETYPE_COLUMN_INDEX = 11;
+    protected static final int CONTACT_SNIPPET_DATA1_COLUMN_INDEX = 12;
+    protected static final int CONTACT_SNIPPET_DATA4_COLUMN_INDEX = 13;
+
+    private CharSequence mUnknownNameText;
+    private int mDisplayNameColumnIndex;
+    private int mAlternativeDisplayNameColumnIndex;
+
+    private long mSelectedContactDirectoryId;
+    private String mSelectedContactLookupKey;
+
+    private ContactListFilter mFilter;
+    private List<ContactListFilter> mAllFilters;
+
+    public ContactListAdapter(Context context) {
+        super(context);
+
+        mUnknownNameText = context.getText(android.R.string.unknownName);
+    }
+
+    public CharSequence getUnknownNameText() {
+        return mUnknownNameText;
+    }
+
+    /**
+     * Returns a full set of all available list filters.
+     */
+    public List<ContactListFilter> getAllFilters() {
+        return mAllFilters;
+    }
+
+    /**
+     * Returns the currently selected filter.
+     */
+    public ContactListFilter getFilter() {
+        return mFilter;
+    }
+
+    public void setFilter(ContactListFilter filter, List<ContactListFilter> allFilters) {
+        mFilter = filter;
+        mAllFilters = allFilters;
+    }
+
+    public long getSelectedContactDirectoryId() {
+        return mSelectedContactDirectoryId;
+    }
+
+    public String getSelectedContactLookupKey() {
+        return mSelectedContactLookupKey;
+    }
+
+    public void setSelectedContact(long selectedDirectoryId, String lookupKey) {
+        if (mSelectedContactDirectoryId != selectedDirectoryId ||
+                !TextUtils.equals(mSelectedContactLookupKey, lookupKey)) {
+            this.mSelectedContactDirectoryId = selectedDirectoryId;
+            this.mSelectedContactLookupKey = lookupKey;
+            notifyDataSetChanged();
+        }
+    }
+
+    protected static Uri buildSectionIndexerUri(Uri uri) {
+        return uri.buildUpon()
+                .appendQueryParameter(ContactCounts.ADDRESS_BOOK_INDEX_EXTRAS, "true").build();
+    }
+
+    public boolean getHasPhoneNumber(int position) {
+        return ((Cursor)getItem(position)).getInt(CONTACT_HAS_PHONE_COLUMN_INDEX) != 0;
+    }
+
+    public boolean isContactStarred(int position) {
+        return ((Cursor)getItem(position)).getInt(CONTACT_STARRED_COLUMN_INDEX) != 0;
+    }
+
+    @Override
+    public String getContactDisplayName(int position) {
+        return ((Cursor)getItem(position)).getString(mDisplayNameColumnIndex);
+    }
+
+    @Override
+    public void setContactNameDisplayOrder(int displayOrder) {
+        super.setContactNameDisplayOrder(displayOrder);
+        if (getContactNameDisplayOrder() == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY) {
+            mDisplayNameColumnIndex = CONTACT_DISPLAY_NAME_PRIMARY_COLUMN_INDEX;
+            mAlternativeDisplayNameColumnIndex = CONTACT_DISPLAY_NAME_ALTERNATIVE_COLUMN_INDEX;
+        } else {
+            mDisplayNameColumnIndex = CONTACT_DISPLAY_NAME_ALTERNATIVE_COLUMN_INDEX;
+            mAlternativeDisplayNameColumnIndex = CONTACT_DISPLAY_NAME_PRIMARY_COLUMN_INDEX;
+        }
+    }
+
+    /**
+     * Builds the {@link Contacts#CONTENT_LOOKUP_URI} for the given
+     * {@link ListView} position.
+     */
+    public Uri getContactUri(int position) {
+        int partitionIndex = getPartitionForPosition(position);
+        Cursor item = (Cursor)getItem(position);
+        return item != null ? getContactUri(partitionIndex, item) : null;
+    }
+
+    public Uri getContactUri(int partitionIndex, Cursor cursor) {
+        long contactId = cursor.getLong(CONTACT_ID_COLUMN_INDEX);
+        String lookupKey = cursor.getString(CONTACT_LOOKUP_KEY_COLUMN_INDEX);
+        Uri uri = Contacts.getLookupUri(contactId, lookupKey);
+        long directoryId = ((DirectoryPartition)getPartition(partitionIndex)).getDirectoryId();
+        if (directoryId != Directory.DEFAULT) {
+            uri = uri.buildUpon().appendQueryParameter(
+                    ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(directoryId)).build();
+        }
+        return uri;
+    }
+
+    /**
+     * Returns true if the specified contact is selected in the list. For a
+     * contact to be shown as selected, we need both the directory and and the
+     * lookup key to be the same. We are paying no attention to the contactId,
+     * because it is volatile, especially in the case of directories.
+     */
+    public boolean isSelectedContact(int partitionIndex, Cursor cursor) {
+        long directoryId = ((DirectoryPartition)getPartition(partitionIndex)).getDirectoryId();
+        return getSelectedContactDirectoryId() == directoryId
+                && TextUtils.equals(getSelectedContactLookupKey(),
+                        cursor.getString(CONTACT_LOOKUP_KEY_COLUMN_INDEX));
+    }
+
+    @Override
+    protected View newView(Context context, int partition, Cursor cursor, int position,
+            ViewGroup parent) {
+        final ContactListItemView view = new ContactListItemView(context, null);
+        view.setUnknownNameText(mUnknownNameText);
+        view.setTextWithHighlightingFactory(getTextWithHighlightingFactory());
+        view.setQuickContactEnabled(isQuickContactEnabled());
+        view.setActivatedStateSupported(isSelectionVisible());
+        return view;
+    }
+
+    protected void bindSectionHeaderAndDivider(ContactListItemView view, int position) {
+        Placement placement = getItemPlacementInSection(position);
+        view.setSectionHeader(placement.firstInSection ? placement.sectionHeader : null);
+        view.setDividerVisible(!placement.lastInSection);
+    }
+
+    protected void bindPhoto(final ContactListItemView view, int partitionIndex, Cursor cursor) {
+        if (!isPhotoSupported(partitionIndex)) {
+            view.removePhotoView();
+            return;
+        }
+
+        // Set the photo, if available
+        long photoId = 0;
+        if (!cursor.isNull(CONTACT_PHOTO_ID_COLUMN_INDEX)) {
+            photoId = cursor.getLong(CONTACT_PHOTO_ID_COLUMN_INDEX);
+        }
+
+        if (photoId != 0) {
+            getPhotoLoader().loadPhoto(view.getPhotoView(), photoId);
+        } else {
+            final String photoUriString = cursor.getString(CONTACT_PHOTO_URI_COLUMN_INDEX);
+            final Uri photoUri = photoUriString == null ? null : Uri.parse(photoUriString);
+            getPhotoLoader().loadPhoto(view.getPhotoView(), photoUri);
+        }
+    }
+
+    protected void bindQuickContact(
+            final ContactListItemView view, int partitionIndex, Cursor cursor) {
+        long photoId = 0;
+        if (!cursor.isNull(CONTACT_PHOTO_ID_COLUMN_INDEX)) {
+            photoId = cursor.getLong(CONTACT_PHOTO_ID_COLUMN_INDEX);
+        }
+
+        QuickContactBadge quickContact = view.getQuickContact();
+        quickContact.assignContactUri(getContactUri(partitionIndex, cursor));
+        getPhotoLoader().loadPhoto(quickContact, photoId);
+    }
+
+    protected void bindName(final ContactListItemView view, Cursor cursor) {
+        view.showDisplayName(cursor, mDisplayNameColumnIndex, isNameHighlightingEnabled(),
+                mAlternativeDisplayNameColumnIndex);
+        view.showPhoneticName(cursor, CONTACT_PHONETIC_NAME_COLUMN_INDEX);
+    }
+
+    protected void bindPresence(final ContactListItemView view, Cursor cursor) {
+        view.showPresence(cursor, CONTACT_PRESENCE_STATUS_COLUMN_INDEX);
+    }
+
+    protected void bindSearchSnippet(final ContactListItemView view, Cursor cursor) {
+        view.showSnippet(cursor, CONTACT_SNIPPET_MIMETYPE_COLUMN_INDEX,
+                CONTACT_SNIPPET_DATA1_COLUMN_INDEX, CONTACT_SNIPPET_DATA4_COLUMN_INDEX);
+    }
+
+    public int getSelectedContactPosition() {
+        if (mSelectedContactLookupKey == null) {
+            return -1;
+        }
+
+        Cursor cursor = null;
+        int partitionIndex = -1;
+        int partitionCount = getPartitionCount();
+        for (int i = 0; i < partitionCount; i++) {
+            DirectoryPartition partition = (DirectoryPartition) getPartition(i);
+            if (partition.getDirectoryId() == mSelectedContactDirectoryId) {
+                partitionIndex = i;
+                break;
+            }
+        }
+        if (partitionIndex == -1) {
+            return -1;
+        }
+
+        cursor = getCursor(partitionIndex);
+        if (cursor == null) {
+            return -1;
+        }
+
+        cursor.moveToPosition(-1);      // Reset cursor
+        int offset = -1;
+        while (cursor.moveToNext()) {
+            String lookupKey = cursor.getString(CONTACT_LOOKUP_KEY_COLUMN_INDEX);
+            if (mSelectedContactLookupKey.equals(lookupKey)) {
+                offset = cursor.getPosition();
+                break;
+            }
+        }
+        if (offset == -1) {
+            return -1;
+        }
+
+        int position = getPositionForPartition(partitionIndex) + offset;
+        if (hasHeader(partitionIndex)) {
+            position++;
+        }
+        return position;
+    }
+}
diff --git a/src/com/android/contacts/list/ContactListAizyView.java b/src/com/android/contacts/list/ContactListAizyView.java
new file mode 100644
index 0000000..e22e1c7
--- /dev/null
+++ b/src/com/android/contacts/list/ContactListAizyView.java
@@ -0,0 +1,244 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.PopupWindow;
+import android.widget.SectionIndexer;
+import android.widget.TextView;
+
+/**
+ * A View that displays the sections given by an Indexer and their relative sizes. For
+ * English and similar languages, this is an A to Z list (where only the used letters are
+ * displayed). As the sections are shown in their relative sizes, this View can be used as a
+ * scrollbar.
+ */
+public class ContactListAizyView extends View {
+    private static final String TAG = "ContactListAizyView";
+
+    private SectionIndexer mIndexer;
+    private int mItemCount;
+    private int[] mSectionPositions;
+
+    private Listener mListener;
+    private float mPosition;
+
+    private int mPreviewPosition;
+    private PopupWindow mPreviewPopupWindow;
+    private TextView mPreviewPopupTextView;
+    private boolean mPreviewPopupVisible;
+    private final int[] mWindowOffset = new int[2];
+
+    private ResourceValues mResourceValues;
+
+    public ContactListAizyView(Context context) {
+        super(context);
+    }
+
+    public ContactListAizyView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    public ContactListAizyView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    @Override
+    protected void onAttachedToWindow() {
+        super.onAttachedToWindow();
+
+        mResourceValues = new ResourceValues(getContext().getResources());
+
+        final LayoutInflater inflater =
+                (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        mPreviewPopupWindow = new PopupWindow(
+                inflater.inflate(R.layout.aizy_popup_window, null, false),
+                mResourceValues.getPreviewWidth(), mResourceValues.getPreviewHeight());
+        mPreviewPopupWindow.setAnimationStyle(R.style.AizyPreviewPopupAnimation);
+        mPreviewPopupTextView =
+                (TextView) mPreviewPopupWindow.getContentView().findViewById(R.id.caption);
+    }
+
+    public void setIndexer(SectionIndexer indexer, int itemCount) {
+        mIndexer = indexer;
+        mItemCount = itemCount;
+        if (mIndexer == null) {
+            mSectionPositions = null;
+            return;
+        }
+
+        // Read the section positions
+        final Object[] sections = mIndexer.getSections();
+        final int sectionCount = sections.length;
+        if (mSectionPositions == null || mSectionPositions.length != sectionCount) {
+            mSectionPositions = new int[sectionCount];
+        }
+        for (int i = 0; i < sectionCount; i++) {
+            mSectionPositions[i] = mIndexer.getPositionForSection(i);
+        }
+
+    }
+
+    public void setListener(Listener listener) {
+        mListener = listener;
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        setMeasuredDimension(resolveSize(0, widthMeasureSpec), resolveSize(0, heightMeasureSpec));
+    }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        if (mIndexer == null) return;
+
+        drawLineAndText(canvas);
+    }
+
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        getLocationInWindow(mWindowOffset);
+
+        final int previewX = mWindowOffset[0] + getWidth();
+        final int previewY = (int) event.getY() + mWindowOffset[1]
+                - mPreviewPopupWindow.getHeight() / 2;
+        final boolean previewPopupVisible =
+            event.getActionMasked() == MotionEvent.ACTION_MOVE ||
+            event.getActionMasked() == MotionEvent.ACTION_DOWN;
+        if (previewPopupVisible != mPreviewPopupVisible) {
+            if (previewPopupVisible) {
+                mPreviewPopupWindow.showAtLocation(this, Gravity.LEFT | Gravity.TOP,
+                        previewX, previewY);
+            } else {
+                mPreviewPopupWindow.dismiss();
+            }
+            mPreviewPopupVisible = previewPopupVisible;
+        } else {
+            mPreviewPopupWindow.update(previewX, previewY, -1, -1);
+        }
+        final float yFactor = (float) getHeight() / mItemCount;
+        final int position = Math.max(0, (int) (event.getY() / yFactor));
+        if (mIndexer != null) {
+            final int index = mIndexer.getSectionForPosition(position);
+            final Object[] sections = mIndexer.getSections();
+            final String caption =
+                    (index != -1 && index < sections.length) ? sections[index].toString() : "";
+            mPreviewPopupTextView.setText(caption);
+        }
+
+        if (mListener != null) mListener.onScroll(position);
+        mPreviewPosition = position;
+
+        super.onTouchEvent(event);
+        return true;
+    }
+
+    private void drawLineAndText(Canvas canvas) {
+        final float yFactor = (float) getHeight() / mItemCount;
+
+        final Paint paint = new Paint();
+
+        paint.setColor(mResourceValues.getLineColor());
+        paint.setAntiAlias(true);
+
+        // TODO: Decide whether to use this feature and remove this flag
+        final boolean useSections = false;
+
+        // Draw sections
+        final float centerX = getWidth() * 0.5f;
+        if (useSections) {
+            for (int i = 1; i < mSectionPositions.length; i++) {
+                final float y1 = mSectionPositions[i - 1] * yFactor;
+                final float y2 = mSectionPositions[i] * yFactor;
+                canvas.drawLine(
+                        centerX, y1 + 1.0f,
+                        centerX, y2 - 1.0f,
+                        paint);
+            }
+        } else {
+            canvas.drawLine(
+                    centerX, 0.0f,
+                    centerX, getHeight(),
+                    paint);
+        }
+
+        // Draw knob
+        final Drawable knob = mResourceValues.getKnobDrawable();
+        final int w = knob.getIntrinsicWidth();
+        final int h = knob.getIntrinsicWidth();
+        final float y;
+//        if (mPreviewPopupWindow.) {
+//            y = mPreviewPosition * yFactor;
+//        } else {
+            y = mPosition * yFactor;
+//        }
+        knob.setBounds(
+                (int) (centerX - w / 2.0f), (int) (y - h / 2.0f),
+                (int) (centerX + w / 2.0f), (int) (y + h / 2.0f));
+        knob.draw(canvas);
+    }
+
+    public void listOnScroll(int firstVisibleItem) {
+        mPosition = firstVisibleItem;
+        invalidate();
+    }
+
+    private static class ResourceValues {
+        private int mLineColor;
+        private Drawable mKnobDrawable;
+        private int mPreviewWidth;
+        private int mPreviewHeight;
+
+        public int getLineColor() {
+            return mLineColor;
+        }
+
+        public Drawable getKnobDrawable() {
+            return mKnobDrawable;
+        }
+
+        public int getPreviewWidth() {
+            return mPreviewWidth;
+        }
+
+        public int getPreviewHeight() {
+            return mPreviewHeight;
+        }
+
+        public ResourceValues(Resources resources) {
+            mLineColor = resources.getColor(R.color.aizy_line_color);
+            mKnobDrawable = resources.getDrawable(R.drawable.aizy_knob);
+            mPreviewWidth = resources.getDimensionPixelSize(R.dimen.aizy_preview_width);
+            mPreviewHeight = resources.getDimensionPixelSize(R.dimen.aizy_preview_height);
+        }
+    }
+
+    public interface Listener {
+        void onScroll(int position);
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/contacts/list/ContactListFilter.java b/src/com/android/contacts/list/ContactListFilter.java
new file mode 100644
index 0000000..0189bbb
--- /dev/null
+++ b/src/com/android/contacts/list/ContactListFilter.java
@@ -0,0 +1,162 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import android.content.SharedPreferences;
+import android.graphics.drawable.Drawable;
+import android.text.TextUtils;
+
+/**
+ * Contact list filter parameters.
+ */
+public final class ContactListFilter implements Comparable<ContactListFilter> {
+
+    public static final int FILTER_TYPE_DEFAULT = -1;
+    public static final int FILTER_TYPE_ALL_ACCOUNTS = -2;
+    public static final int FILTER_TYPE_CUSTOM = -3;
+    public static final int FILTER_TYPE_STARRED = -4;
+    public static final int FILTER_TYPE_WITH_PHONE_NUMBERS_ONLY = -5;
+
+    public static final int FILTER_TYPE_ACCOUNT = 0;
+    public static final int FILTER_TYPE_GROUP = 1;
+
+    private static final String KEY_FILTER_TYPE = "filter.type";
+    private static final String KEY_ACCOUNT_NAME = "filter.accountName";
+    private static final String KEY_ACCOUNT_TYPE = "filter.accountType";
+    private static final String KEY_GROUP_ID = "filter.groupId";
+
+    public int filterType;
+    public String accountType;
+    public String accountName;
+    public Drawable icon;
+    public long groupId;
+    public String title;
+
+    public ContactListFilter(int filterType) {
+        this.filterType = filterType;
+    }
+
+    public ContactListFilter(
+            String accountType, String accountName, Drawable icon, String title) {
+        this.filterType = ContactListFilter.FILTER_TYPE_ACCOUNT;
+        this.accountType = accountType;
+        this.accountName = accountName;
+        this.icon = icon;
+        this.title = title;
+    }
+
+    public ContactListFilter(
+            String accountType, String accountName, long groupId, String title) {
+        this.filterType = ContactListFilter.FILTER_TYPE_GROUP;
+        this.accountType = accountType;
+        this.accountName = accountName;
+        this.groupId = groupId;
+        this.title = title;
+    }
+
+    /**
+     * Returns true if this filter is based on data and may become invalid over time.
+     */
+    public boolean isValidationRequired() {
+        return filterType == FILTER_TYPE_ACCOUNT || filterType == FILTER_TYPE_GROUP;
+    }
+
+    @Override
+    public String toString() {
+        switch (filterType) {
+            case ContactListFilter.FILTER_TYPE_ACCOUNT:
+                return "account: " + accountType + " " + accountName;
+            case ContactListFilter.FILTER_TYPE_GROUP:
+                return "group: " + accountType + " " + accountName + " " + title + "(" + groupId
+                        + ")";
+        }
+        return super.toString();
+    }
+
+    @Override
+    public int compareTo(ContactListFilter another) {
+        int res = accountType.compareTo(another.accountType);
+        if (res != 0) {
+            return res;
+        }
+
+        res = accountName.compareTo(another.accountName);
+        if (res != 0) {
+            return res;
+        }
+
+        if (filterType != another.filterType) {
+            return filterType - another.filterType;
+        }
+
+        String title1 = title != null ? title : "";
+        String title2 = another.title != null ? another.title : "";
+        return title1.compareTo(title2);
+    }
+
+    @Override
+    public int hashCode() {
+        int code = filterType;
+        if (accountType != null) {
+            code = code * 31 + accountType.hashCode();
+            code = code * 31 + accountName.hashCode();
+        }
+        if (groupId != 0) {
+            code = code * 31 + (int) groupId;
+        }
+        return code;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+
+        if (!(other instanceof ContactListFilter)) {
+            return false;
+        }
+
+        ContactListFilter otherFilter = (ContactListFilter) other;
+        return filterType == otherFilter.filterType
+                && TextUtils.equals(accountName, otherFilter.accountName)
+                && TextUtils.equals(accountType, otherFilter.accountType)
+                && groupId == otherFilter.groupId;
+    }
+
+    public static void storeToPreferences(SharedPreferences prefs, ContactListFilter filter) {
+        prefs.edit()
+            .putInt(KEY_FILTER_TYPE, filter == null ? FILTER_TYPE_DEFAULT : filter.filterType)
+            .putString(KEY_ACCOUNT_NAME, filter == null ? null : filter.accountName)
+            .putString(KEY_ACCOUNT_TYPE, filter == null ? null : filter.accountType)
+            .putLong(KEY_GROUP_ID, filter == null ? -1 : filter.groupId)
+            .apply();
+    }
+
+    public static ContactListFilter restoreFromPreferences(SharedPreferences prefs) {
+        int filterType = prefs.getInt(KEY_FILTER_TYPE, FILTER_TYPE_DEFAULT);
+        if (filterType == FILTER_TYPE_DEFAULT) {
+            return null;
+        }
+
+        ContactListFilter filter = new ContactListFilter(filterType);
+        filter.accountName = prefs.getString(KEY_ACCOUNT_NAME, null);
+        filter.accountType = prefs.getString(KEY_ACCOUNT_TYPE, null);
+        filter.groupId = prefs.getLong(KEY_GROUP_ID, -1);
+        return filter;
+    }
+}
diff --git a/src/com/android/contacts/list/ContactListFilterController.java b/src/com/android/contacts/list/ContactListFilterController.java
new file mode 100644
index 0000000..c342d75
--- /dev/null
+++ b/src/com/android/contacts/list/ContactListFilterController.java
@@ -0,0 +1,358 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+
+import android.app.Activity;
+import android.app.LoaderManager;
+import android.app.LoaderManager.LoaderCallbacks;
+import android.content.Context;
+import android.content.Loader;
+import android.content.SharedPreferences;
+import android.content.res.TypedArray;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.preference.PreferenceManager;
+import android.util.SparseArray;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.BaseAdapter;
+import android.widget.ListPopupWindow;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Controls a list of {@link ContactListFilter}'s.
+ */
+public class ContactListFilterController
+        implements LoaderCallbacks<List<ContactListFilter>>, OnClickListener, OnItemClickListener {
+
+    public interface ContactListFilterListener {
+        void onContactListFiltersLoaded();
+        void onContactListFilterChanged();
+        void onContactListFilterCustomizationRequest();
+    }
+
+    private static final int MESSAGE_REFRESH_FILTERS = 0;
+
+    /**
+     * The delay before the contact filter list is refreshed. This is needed because
+     * during contact sync we will get lots of notifications in rapid succession. This
+     * delay will prevent the slowly changing list of filters from reloading too often.
+     */
+    private static final int FILTER_SPINNER_REFRESH_DELAY_MILLIS = 5000;
+
+    private Context mContext;
+    private LoaderManager mLoaderManager;
+    private boolean mEnabled = true;
+    private List<ContactListFilterListener> mListeners = new ArrayList<ContactListFilterListener>();
+    private ListPopupWindow mPopup;
+    private int mPopupWidth = -1;
+    private SparseArray<ContactListFilter> mFilters;
+    private ArrayList<ContactListFilter> mFilterList;
+    private int mNextFilterId = 1;
+    private View mAnchor;
+    private FilterListAdapter mFilterListAdapter;
+    private ContactListFilter mFilter;
+    private boolean mFiltersLoaded;
+    private final Handler mHandler = new Handler() {
+
+        @Override
+        public void handleMessage(Message msg) {
+            if (msg.what == MESSAGE_REFRESH_FILTERS) {
+                loadFilters();
+            }
+        }
+    };
+
+    private int mAccountCount;
+
+    public ContactListFilterController(Activity activity) {
+        mContext = activity;
+        mLoaderManager = activity.getLoaderManager();
+    }
+
+    public void setEnabled(boolean flag) {
+        mEnabled = flag;
+    }
+
+    public void addListener(ContactListFilterListener listener) {
+        mListeners.add(listener);
+    }
+
+    public void removeListener(ContactListFilterListener listener) {
+        mListeners.remove(listener);
+    }
+
+    public void setAnchor(View anchor) {
+        mAnchor = anchor;
+        mAnchor.setOnClickListener(this);
+    }
+
+    public ContactListFilter getFilter() {
+        return mFilter;
+    }
+
+    public List<ContactListFilter> getFilterList() {
+        return mFilterList;
+    }
+
+    public boolean isLoaded() {
+        return mFiltersLoaded;
+    }
+
+    public void startLoading() {
+        // Set the "ready" flag right away - we only want to start the loader once
+        mFiltersLoaded = false;
+        mFilter = ContactListFilter.restoreFromPreferences(getSharedPreferences());
+        loadFilters();
+    }
+
+    private SharedPreferences getSharedPreferences() {
+        return PreferenceManager.getDefaultSharedPreferences(mContext);
+    }
+
+    private void loadFilters() {
+        mLoaderManager.restartLoader(R.id.contact_list_filter_loader, null, this);
+    }
+
+    @Override
+    public ContactListFilterLoader onCreateLoader(int id, Bundle args) {
+        return new ContactListFilterLoader(mContext);
+    }
+
+    @Override
+    public void onLoadFinished(
+            Loader<List<ContactListFilter>> loader, List<ContactListFilter> filters) {
+        if (mFilters == null) {
+            mFilters = new SparseArray<ContactListFilter>(filters.size());
+            mFilterList = new ArrayList<ContactListFilter>();
+        } else {
+            mFilters.clear();
+            mFilterList.clear();
+        }
+
+        boolean filterValid = mFilter != null && !mFilter.isValidationRequired();
+
+        mAccountCount = 0;
+        int count = filters.size();
+        for (int index = 0; index < count; index++) {
+            if (filters.get(index).filterType == ContactListFilter.FILTER_TYPE_ACCOUNT) {
+                mAccountCount++;
+            }
+        }
+
+        if (mAccountCount > 1) {
+            mFilters.append(mNextFilterId++,
+                    new ContactListFilter(ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS));
+            mFilters.append(mNextFilterId++,
+                    new ContactListFilter(ContactListFilter.FILTER_TYPE_STARRED));
+        }
+
+        for (int index = 0; index < count; index++) {
+            ContactListFilter filter = filters.get(index);
+
+            boolean firstAndOnly = mAccountCount == 1
+                    && filter.filterType == ContactListFilter.FILTER_TYPE_ACCOUNT;
+
+            // If we only have one account, don't show it as "account", instead show it as "all"
+            if (firstAndOnly) {
+                filter = new ContactListFilter(ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS);
+            }
+
+            mFilters.append(mNextFilterId++, filter);
+            mFilterList.add(filter);
+
+            if (filter.equals(mFilter)) {
+                // Refresh the filter in case the title got changed
+                mFilter = filter;
+                filterValid = true;
+            }
+
+            if (firstAndOnly) {
+                mFilters.append(mNextFilterId++,
+                        new ContactListFilter(ContactListFilter.FILTER_TYPE_STARRED));
+            }
+        }
+
+        if (mAccountCount > 0) {
+            mFilters.append(
+                    mNextFilterId++, new ContactListFilter(ContactListFilter.FILTER_TYPE_CUSTOM));
+        }
+
+        boolean filterChanged = false;
+        if (mFilter == null  || !filterValid) {
+            filterChanged = mFilter != null;
+            mFilter = getDefaultFilter();
+        }
+
+        if (mFilterListAdapter == null) {
+            mFilterListAdapter = new FilterListAdapter();
+        } else {
+            mFilterListAdapter.notifyDataSetChanged();
+        }
+
+        if (filterChanged) {
+            mFiltersLoaded = true;
+            notifyContactListFilterChanged();
+        } else if (!mFiltersLoaded) {
+            mFiltersLoaded = true;
+            notifyContacListFiltersLoaded();
+        }
+    }
+
+    public void postDelayedRefresh() {
+        if (!mHandler.hasMessages(MESSAGE_REFRESH_FILTERS)) {
+            mHandler.sendEmptyMessageDelayed(
+                    MESSAGE_REFRESH_FILTERS, FILTER_SPINNER_REFRESH_DELAY_MILLIS);
+        }
+    }
+
+    private void setContactListFilter(int filterId) {
+        ContactListFilter filter;
+        if (filterId == ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS) {
+            filter = new ContactListFilter(ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS);
+        } else if (filterId == ContactListFilter.FILTER_TYPE_CUSTOM) {
+            filter = new ContactListFilter(ContactListFilter.FILTER_TYPE_CUSTOM);
+        } else if (filterId == ContactListFilter.FILTER_TYPE_STARRED) {
+            filter = new ContactListFilter(ContactListFilter.FILTER_TYPE_STARRED);
+        } else {
+            filter = mFilters.get(filterId);
+            if (filter == null) {
+                filter = getDefaultFilter();
+            }
+        }
+
+        setContactListFilter(filter, true);
+    }
+
+    public void setContactListFilter(ContactListFilter filter, boolean persistent) {
+        if (!filter.equals(mFilter)) {
+            mFilter = filter;
+            ContactListFilter.storeToPreferences(getSharedPreferences(), mFilter);
+            if (mListeners != null) {
+               notifyContactListFilterChanged();
+            }
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        if (!mFiltersLoaded || !mEnabled) {
+            return;
+        }
+
+        if (mPopupWidth == -1) {
+            TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.ContactBrowser);
+            mPopupWidth = a.getDimensionPixelSize(
+                    R.styleable.ContactBrowser_contact_filter_popup_width, -1);
+            a.recycle();
+
+            if (mPopupWidth == -1) {
+                mPopupWidth = mAnchor.getWidth();
+            }
+        }
+
+        mPopup = new ListPopupWindow(mContext, null);
+        mPopup.setWidth(mPopupWidth);
+        mPopup.setAdapter(mFilterListAdapter);
+        mPopup.setAnchorView(mAnchor);
+        mPopup.setOnItemClickListener(this);
+        mPopup.setModal(true);
+        mPopup.show();
+    }
+
+    @Override
+    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+        mPopup.dismiss();
+        if (mFilters.get((int) id).filterType == ContactListFilter.FILTER_TYPE_CUSTOM) {
+            notifyContactListFilterCustomizationRequest();
+        } else {
+            setContactListFilter((int) id);
+        }
+    }
+
+    public void selectCustomFilter() {
+        mFilter = new ContactListFilter(ContactListFilter.FILTER_TYPE_CUSTOM);
+        notifyContactListFilterChanged();
+    }
+
+    private ContactListFilter getDefaultFilter() {
+        return mFilters.size() > 0 ? mFilters.valueAt(0) : null;
+    }
+
+    private void notifyContacListFiltersLoaded() {
+        for (ContactListFilterListener listener : mListeners) {
+            listener.onContactListFiltersLoaded();
+        }
+    }
+
+    private void notifyContactListFilterChanged() {
+        for (ContactListFilterListener listener : mListeners) {
+            listener.onContactListFilterChanged();
+        }
+    }
+
+    private void notifyContactListFilterCustomizationRequest() {
+        for (ContactListFilterListener listener : mListeners) {
+            listener.onContactListFilterCustomizationRequest();
+        }
+    }
+
+    private class FilterListAdapter extends BaseAdapter {
+        private LayoutInflater mLayoutInflater;
+
+        public FilterListAdapter() {
+            mLayoutInflater = LayoutInflater.from(mContext);
+        }
+
+        @Override
+        public int getCount() {
+            return mFilters.size();
+        }
+
+        @Override
+        public long getItemId(int position) {
+            return mFilters.keyAt(position);
+        }
+
+        @Override
+        public Object getItem(int position) {
+            return mFilters.valueAt(position);
+        }
+
+        public View getView(int position, View convertView, ViewGroup parent) {
+            ContactListFilterView view;
+            if (convertView != null) {
+                view = (ContactListFilterView) convertView;
+            } else {
+                view = (ContactListFilterView) mLayoutInflater.inflate(
+                        R.layout.filter_spinner_item, parent, false);
+            }
+            view.setMultipleAccounts(mAccountCount > 1);
+            view.setContactListFilter(mFilters.valueAt(position));
+            view.bindView(true);
+            return view;
+        }
+    }
+}
diff --git a/src/com/android/contacts/list/ContactListFilterLoader.java b/src/com/android/contacts/list/ContactListFilterLoader.java
new file mode 100644
index 0000000..ae791ab
--- /dev/null
+++ b/src/com/android/contacts/list/ContactListFilterLoader.java
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountTypes;
+
+import android.accounts.Account;
+import android.content.AsyncTaskLoader;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.database.Cursor;
+import android.graphics.drawable.Drawable;
+import android.provider.ContactsContract.Groups;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ * A loader for the data needed for the group selector.
+ */
+public class ContactListFilterLoader extends AsyncTaskLoader<List<ContactListFilter>> {
+
+    private static final class GroupQuery {
+        public static final String[] COLUMNS = {
+            Groups._ID,
+            Groups.ACCOUNT_TYPE,
+            Groups.ACCOUNT_NAME,
+            Groups.TITLE,
+            Groups.AUTO_ADD,
+        };
+
+        public static final int ID = 0;
+        public static final int ACCOUNT_TYPE = 1;
+        public static final int ACCOUNT_NAME = 2;
+        public static final int TITLE = 3;
+        public static final int IS_DEFAULT_GROUP = 4;       // Using the AUTO_ADD group as default
+
+        private static final String SELECTION =
+                Groups.DELETED + "=0 AND " + Groups.FAVORITES + "=0";
+    }
+
+    public ContactListFilterLoader(Context context) {
+        super(context);
+    }
+
+    @Override
+    public List<ContactListFilter> loadInBackground() {
+
+        ArrayList<ContactListFilter> results = new ArrayList<ContactListFilter>();
+        Context context = getContext();
+        final AccountTypes sources = AccountTypes.getInstance(context);
+        ArrayList<Account> accounts = sources.getAccounts(false);
+        for (Account account : accounts) {
+            BaseAccountType source = sources.getInflatedSource(
+                    account.type, BaseAccountType.LEVEL_SUMMARY);
+            Drawable icon = source != null ? source.getDisplayIcon(getContext()) : null;
+            results.add(new ContactListFilter(account.type, account.name, icon, account.name));
+        }
+
+        HashSet<Account> accountsWithGroups = new HashSet<Account>();
+        ContentResolver resolver = context.getContentResolver();
+
+        Cursor cursor = resolver.query(
+                Groups.CONTENT_URI, GroupQuery.COLUMNS, GroupQuery.SELECTION, null, null);
+        try {
+            while (cursor.moveToNext()) {
+                long groupId = cursor.getLong(GroupQuery.ID);
+                String accountType = cursor.getString(GroupQuery.ACCOUNT_TYPE);
+                String accountName = cursor.getString(GroupQuery.ACCOUNT_NAME);
+                boolean defaultGroup = false;
+                if (!cursor.isNull(GroupQuery.IS_DEFAULT_GROUP)) {
+                    defaultGroup = cursor.getInt(GroupQuery.IS_DEFAULT_GROUP) != 0;
+                }
+                if (defaultGroup) {
+                    // Find the filter for this account and set the default group ID
+                    for (ContactListFilter filter : results) {
+                        if (filter.accountName.equals(accountName)
+                                && filter.accountType.equals(accountType)) {
+                            filter.groupId = groupId;
+                            break;
+                        }
+                    }
+                } else {
+                    String title = cursor.getString(GroupQuery.TITLE);
+                    results.add(new ContactListFilter(accountType, accountName, groupId, title));
+                }
+            }
+        } finally {
+            cursor.close();
+        }
+
+        Collections.sort(results);
+
+        return results;
+    }
+
+    @Override
+    public void destroy() {
+        stopLoading();
+    }
+
+    @Override
+    public void startLoading() {
+        cancelLoad();
+        forceLoad();
+    }
+
+    @Override
+    public void stopLoading() {
+        cancelLoad();
+    }
+}
diff --git a/src/com/android/contacts/list/ContactListFilterView.java b/src/com/android/contacts/list/ContactListFilterView.java
new file mode 100644
index 0000000..e065e91
--- /dev/null
+++ b/src/com/android/contacts/list/ContactListFilterView.java
@@ -0,0 +1,168 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+/**
+ * Contact list filter parameters.
+ */
+public class ContactListFilterView extends LinearLayout {
+
+    private ImageView mIcon;
+    private TextView mLabel;
+    private TextView mIndentedLabel;
+    private View mGroupView;
+    private ContactListFilter mFilter;
+    private boolean mMultipleAccounts;
+    private TextView mGroupLabel;
+    private TextView mAccountLabel;
+
+    public ContactListFilterView(Context context) {
+        super(context);
+    }
+
+    public ContactListFilterView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public void setContactListFilter(ContactListFilter filter) {
+        mFilter = filter;
+    }
+
+    public ContactListFilter getContactListFilter() {
+        return mFilter;
+    }
+
+    public void setMultipleAccounts(boolean flag) {
+        this.mMultipleAccounts = flag;
+    }
+
+    public void bindView(boolean dropdown) {
+        if (mLabel == null) {
+            mIcon = (ImageView) findViewById(R.id.icon);
+            mLabel = (TextView) findViewById(R.id.label);
+            mIndentedLabel = (TextView) findViewById(R.id.indented_label);
+            mGroupView = findViewById(R.id.group);
+            mGroupLabel = (TextView) findViewById(R.id.group_label);
+            mAccountLabel = (TextView) findViewById(R.id.account_label);
+        }
+
+        if (mFilter == null) {
+            mLabel.setText(R.string.contactsList);
+            mLabel.setVisibility(View.VISIBLE);
+            return;
+        }
+
+        if (!dropdown) {
+            if (mFilter.filterType == ContactListFilter.FILTER_TYPE_GROUP && mMultipleAccounts) {
+                mLabel.setVisibility(View.GONE);
+                mGroupView.setVisibility(View.VISIBLE);
+            } else {
+                mLabel.setVisibility(View.VISIBLE);
+                mGroupView.setVisibility(View.GONE);
+            }
+        }
+
+        switch (mFilter.filterType) {
+            case ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS: {
+                bindView(R.drawable.ic_contact_list_filter_all,
+                        R.string.list_filter_all_accounts);
+                break;
+            }
+            case ContactListFilter.FILTER_TYPE_STARRED: {
+                bindView(R.drawable.ic_contact_list_filter_starred,
+                        R.string.list_filter_all_starred);
+                break;
+            }
+            case ContactListFilter.FILTER_TYPE_CUSTOM: {
+                bindView(R.drawable.ic_contact_list_filter_custom,
+                        dropdown ? R.string.list_filter_customize : R.string.list_filter_custom);
+                break;
+            }
+            case ContactListFilter.FILTER_TYPE_WITH_PHONE_NUMBERS_ONLY: {
+                bindView(0, R.string.list_filter_phones);
+                break;
+            }
+            case ContactListFilter.FILTER_TYPE_ACCOUNT: {
+                if (mIcon != null) {
+                    mIcon.setVisibility(View.VISIBLE);
+                    if (mFilter.icon != null) {
+                        mIcon.setImageDrawable(mFilter.icon);
+                    } else {
+                        mIcon.setImageResource(R.drawable.unknown_source);
+                    }
+                }
+                mLabel.setText(mFilter.accountName);
+                mLabel.setVisibility(View.VISIBLE);
+                if (dropdown) {
+                    mIndentedLabel.setVisibility(View.GONE);
+                }
+                break;
+            }
+            case ContactListFilter.FILTER_TYPE_GROUP: {
+                if (mIcon != null) {
+                    mIcon.setVisibility(View.INVISIBLE);
+                }
+                if (dropdown) {
+                    if (mMultipleAccounts) {
+                        mLabel.setVisibility(View.GONE);
+                        mIndentedLabel.setText(mFilter.title);
+                        mIndentedLabel.setVisibility(View.VISIBLE);
+                    } else {
+                        mLabel.setText(mFilter.title);
+                        mLabel.setVisibility(View.VISIBLE);
+                        mIndentedLabel.setVisibility(View.GONE);
+                    }
+                } else {
+                    if (mMultipleAccounts) {
+                        mGroupLabel.setText(mFilter.title);
+                        mAccountLabel.setText(mFilter.accountName);
+                    } else {
+                        mLabel.setText(mFilter.title);
+                    }
+                }
+                break;
+            }
+        }
+    }
+
+    private void bindView(int iconResource, int textResource) {
+        if (mIcon != null) {
+            if (iconResource != 0) {
+                mIcon.setVisibility(View.VISIBLE);
+                mIcon.setImageResource(iconResource);
+            } else {
+                mIcon.setVisibility(View.INVISIBLE);
+            }
+        }
+
+        mLabel.setText(textResource);
+        mLabel.setVisibility(View.VISIBLE);
+
+        if (mIndentedLabel != null) {
+            mIndentedLabel.setVisibility(View.GONE);
+        }
+    }
+}
diff --git a/src/com/android/contacts/list/ContactListItemView.java b/src/com/android/contacts/list/ContactListItemView.java
new file mode 100644
index 0000000..68560e4
--- /dev/null
+++ b/src/com/android/contacts/list/ContactListItemView.java
@@ -0,0 +1,975 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import com.android.contacts.ContactPresenceIconUtil;
+import com.android.contacts.R;
+import com.android.contacts.widget.TextWithHighlighting;
+import com.android.contacts.widget.TextWithHighlightingFactory;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.database.CharArrayBuffer;
+import android.database.Cursor;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Nickname;
+import android.provider.ContactsContract.CommonDataKinds.Organization;
+import android.provider.ContactsContract.Contacts;
+import android.text.SpannableString;
+import android.text.TextUtils;
+import android.text.TextUtils.TruncateAt;
+import android.text.style.ForegroundColorSpan;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.ImageView.ScaleType;
+import android.widget.QuickContactBadge;
+import android.widget.TextView;
+
+/**
+ * A custom view for an item in the contact list.
+ */
+public class ContactListItemView extends ViewGroup {
+
+    private static final int QUICK_CONTACT_BADGE_STYLE =
+            com.android.internal.R.attr.quickContactBadgeStyleWindowMedium;
+
+    protected final Context mContext;
+
+    private final int mPreferredHeight;
+    private final int mVerticalDividerMargin;
+    private final int mPaddingTop;
+    private final int mPaddingRight;
+    private final int mPaddingBottom;
+    private final int mPaddingLeft;
+    private final int mGapBetweenImageAndText;
+    private final int mGapBetweenLabelAndData;
+    private final int mCallButtonPadding;
+    private final int mPresenceIconMargin;
+    private final int mHeaderTextWidth;
+    private final int mPrefixHightlightColor;
+
+    private Drawable mPressedBackgroundDrawable;
+    private Drawable mActivatedBackgroundDrawable;
+
+    private boolean mHorizontalDividerVisible = true;
+    private Drawable mHorizontalDividerDrawable;
+    private int mHorizontalDividerHeight;
+
+    private boolean mVerticalDividerVisible;
+    private Drawable mVerticalDividerDrawable;
+    private int mVerticalDividerWidth;
+
+    private boolean mHeaderVisible;
+    private Drawable mHeaderBackgroundDrawable;
+    private int mHeaderBackgroundHeight;
+    private TextView mHeaderTextView;
+
+    private boolean mQuickContactEnabled = true;
+    private QuickContactBadge mQuickContact;
+    private ImageView mPhotoView;
+    private TextView mNameTextView;
+    private TextView mPhoneticNameTextView;
+    private DontPressWithParentImageView mCallButton;
+    private TextView mLabelView;
+    private TextView mDataView;
+    private TextView mSnippetView;
+    private ImageView mPresenceIcon;
+
+    private char[] mHighlightedPrefix;
+
+    private int mDefaultPhotoViewSize;
+    private int mPhotoViewWidth;
+    private int mPhotoViewHeight;
+    private int mLine1Height;
+    private int mLine2Height;
+    private int mLine3Height;
+    private int mLine4Height;
+
+    private OnClickListener mCallButtonClickListener;
+    private TextWithHighlightingFactory mTextWithHighlightingFactory;
+    private CharArrayBuffer mNameBuffer = new CharArrayBuffer(128);
+    private CharArrayBuffer mDataBuffer = new CharArrayBuffer(128);
+    private CharArrayBuffer mHighlightedTextBuffer = new CharArrayBuffer(128);
+    private TextWithHighlighting mTextWithHighlighting;
+    private CharArrayBuffer mPhoneticNameBuffer = new CharArrayBuffer(128);
+
+    private CharSequence mUnknownNameText;
+
+    private boolean mActivatedStateSupported;
+
+    private ForegroundColorSpan mPrefixColorSpan;
+
+    /**
+     * Special class to allow the parent to be pressed without being pressed itself.
+     * This way the line of a tab can be pressed, but the image itself is not.
+     */
+    // TODO: understand this
+    private static class DontPressWithParentImageView extends ImageView {
+
+        public DontPressWithParentImageView(Context context, AttributeSet attrs) {
+            super(context, attrs);
+        }
+
+        @Override
+        public void setPressed(boolean pressed) {
+            // If the parent is pressed, do not set to pressed.
+            if (pressed && ((View) getParent()).isPressed()) {
+                return;
+            }
+            super.setPressed(pressed);
+        }
+    }
+
+    public ContactListItemView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        mContext = context;
+
+        // Obtain preferred item height from the current theme
+        TypedArray a = context.obtainStyledAttributes(null, com.android.internal.R.styleable.Theme);
+        mPreferredHeight =
+                a.getDimensionPixelSize(android.R.styleable.Theme_listPreferredItemHeight, 0);
+        a.recycle();
+
+        a = getContext().obtainStyledAttributes(attrs,R.styleable.ContactListItemView);
+        mPressedBackgroundDrawable = a.getDrawable(
+                R.styleable.ContactListItemView_pressedBackground);
+        mHeaderBackgroundDrawable = a.getDrawable(
+                R.styleable.ContactListItemView_section_header_background);
+        mHorizontalDividerDrawable = a.getDrawable(
+                R.styleable.ContactListItemView_list_item_divider);
+        mVerticalDividerMargin = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_vertical_divider_margin, 0);
+        mPaddingTop = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_padding_top, 0);
+        mPaddingBottom = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_padding_bottom, 0);
+        mPaddingLeft = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_padding_left, 0);
+        mPaddingRight = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_padding_right, 0);
+        mGapBetweenImageAndText = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_gap_between_image_and_text, 0);
+        mGapBetweenLabelAndData = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_gap_between_label_and_data, 0);
+        mCallButtonPadding = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_call_button_padding, 0);
+        mPresenceIconMargin = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_presence_icon_margin, 0);
+        mHeaderTextWidth = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_header_text_width, 0);
+        mDefaultPhotoViewSize = a.getDimensionPixelOffset(
+                R.styleable.ContactListItemView_list_item_photo_size, 0);
+        mPrefixHightlightColor = a.getColor(
+                R.styleable.ContactListItemView_list_item_prefix_highlight_color, Color.GREEN);
+
+        a.recycle();
+
+        mHeaderBackgroundHeight = mHeaderBackgroundDrawable.getIntrinsicHeight();
+        mHorizontalDividerHeight = mHorizontalDividerDrawable.getIntrinsicHeight();
+    }
+
+    /**
+     * Installs a call button listener.
+     */
+    public void setOnCallButtonClickListener(OnClickListener callButtonClickListener) {
+        mCallButtonClickListener = callButtonClickListener;
+    }
+
+    public void setTextWithHighlightingFactory(TextWithHighlightingFactory factory) {
+        mTextWithHighlightingFactory = factory;
+    }
+
+    public void setUnknownNameText(CharSequence unknownNameText) {
+        mUnknownNameText = unknownNameText;
+    }
+
+    public void setQuickContactEnabled(boolean flag) {
+        mQuickContactEnabled = flag;
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        // We will match parent's width and wrap content vertically, but make sure
+        // height is no less than listPreferredItemHeight.
+        int width = resolveSize(0, widthMeasureSpec);
+        int height = 0;
+
+        mLine1Height = 0;
+        mLine2Height = 0;
+        mLine3Height = 0;
+        mLine4Height = 0;
+
+        // Obtain the natural dimensions of the name text (we only care about height)
+        if (isVisible(mNameTextView)) {
+            mNameTextView.measure(0, 0);
+            mLine1Height = mNameTextView.getMeasuredHeight();
+        }
+
+        if (isVisible(mPhoneticNameTextView)) {
+            mPhoneticNameTextView.measure(0, 0);
+            mLine2Height = mPhoneticNameTextView.getMeasuredHeight();
+        }
+
+        if (isVisible(mLabelView)) {
+            mLabelView.measure(0, 0);
+            mLine3Height = mLabelView.getMeasuredHeight();
+        }
+
+        if (isVisible(mDataView)) {
+            mDataView.measure(0, 0);
+            mLine3Height = Math.max(mLine3Height, mDataView.getMeasuredHeight());
+        }
+
+        if (isVisible(mSnippetView)) {
+            mSnippetView.measure(0, 0);
+            mLine4Height = mSnippetView.getMeasuredHeight();
+        }
+
+        height += mLine1Height + mLine2Height + mLine3Height + mLine4Height
+                + mPaddingTop + mPaddingBottom;
+
+        if (isVisible(mCallButton)) {
+            mCallButton.measure(0, 0);
+        }
+        if (isVisible(mPresenceIcon)) {
+            mPresenceIcon.measure(0, 0);
+        }
+
+        ensurePhotoViewSize();
+
+        height = Math.max(height, mPhotoViewHeight + mPaddingBottom + mPaddingTop);
+
+        if (mHorizontalDividerVisible) {
+            height += mHorizontalDividerHeight;
+        }
+
+        height = Math.max(height, mPreferredHeight);
+
+        if (mHeaderVisible) {
+            mHeaderTextView.measure(
+                    MeasureSpec.makeMeasureSpec(mHeaderTextWidth, MeasureSpec.EXACTLY),
+                    MeasureSpec.makeMeasureSpec(mHeaderBackgroundHeight, MeasureSpec.EXACTLY));
+            height += mHeaderBackgroundHeight;
+        }
+
+        setMeasuredDimension(width, height);
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+        int height = bottom - top;
+        int width = right - left;
+
+        // Determine the vertical bounds by laying out the header first.
+        int topBound = 0;
+        int bottomBound = height;
+
+        if (mHeaderVisible) {
+            mHeaderBackgroundDrawable.setBounds(
+                    0,
+                    0,
+                    width,
+                    mHeaderBackgroundHeight);
+            mHeaderTextView.layout(0, 0, width, mHeaderBackgroundHeight);
+            topBound += mHeaderBackgroundHeight;
+        }
+
+        if (mHorizontalDividerVisible) {
+            mHorizontalDividerDrawable.setBounds(
+                    0,
+                    height - mHorizontalDividerHeight,
+                    width,
+                    height);
+            bottomBound -= mHorizontalDividerHeight;
+        }
+
+        if (isActivated()) {
+            ensureActivatedBackgroundDrawable();
+            mActivatedBackgroundDrawable.setBounds(0, topBound, width, bottomBound);
+        }
+
+        if (mPressedBackgroundDrawable != null) {
+            mPressedBackgroundDrawable.setBounds(0, topBound, width, bottomBound);
+        }
+
+        topBound += mPaddingTop;
+        bottomBound -= mPaddingBottom;
+
+        // Positions of views on the left are fixed and so are those on the right side.
+        // The stretchable part of the layout is in the middle.  So, we will start off
+        // by laying out the left and right sides. Then we will allocate the remainder
+        // to the text fields in the middle.
+
+        int leftBound = layoutLeftSide(height, topBound, bottomBound, mPaddingLeft);
+        int rightBound = layoutRightSide(height, topBound, right);
+
+        // Text lines, centered vertically
+        rightBound -= mPaddingRight;
+
+        // Center text vertically
+        int totalTextHeight = mLine1Height + mLine2Height + mLine3Height + mLine4Height;
+        int textTopBound = (bottomBound + topBound - totalTextHeight) / 2;
+
+        if (isVisible(mNameTextView)) {
+            mNameTextView.layout(leftBound,
+                    textTopBound,
+                    rightBound,
+                    textTopBound + mLine1Height);
+        }
+
+        int dataLeftBound = leftBound;
+        if (isVisible(mPhoneticNameTextView)) {
+            mPhoneticNameTextView.layout(leftBound,
+                    textTopBound + mLine1Height,
+                    rightBound,
+                    textTopBound + mLine1Height + mLine2Height);
+        }
+
+        if (isVisible(mLabelView)) {
+            dataLeftBound = leftBound + mLabelView.getMeasuredWidth();
+            mLabelView.layout(leftBound,
+                    textTopBound + mLine1Height + mLine2Height,
+                    dataLeftBound,
+                    textTopBound + mLine1Height + mLine2Height + mLine3Height);
+            dataLeftBound += mGapBetweenLabelAndData;
+        }
+
+        if (isVisible(mDataView)) {
+            mDataView.layout(dataLeftBound,
+                    textTopBound + mLine1Height + mLine2Height,
+                    rightBound,
+                    textTopBound + mLine1Height + mLine2Height + mLine3Height);
+        }
+
+        if (isVisible(mSnippetView)) {
+            mSnippetView.layout(leftBound,
+                    textTopBound + mLine1Height + mLine2Height + mLine3Height,
+                    rightBound,
+                    textTopBound + mLine1Height + mLine2Height + mLine3Height + mLine4Height);
+        }
+    }
+
+    /**
+     * Performs layout of the left side of the view
+     *
+     * @return new left boundary
+     */
+    protected int layoutLeftSide(int height, int topBound, int bottomBound, int leftBound) {
+        View photoView = mQuickContact != null ? mQuickContact : mPhotoView;
+        if (photoView != null) {
+            // Center the photo vertically
+            int photoTop = topBound + (bottomBound - topBound - mPhotoViewHeight) / 2;
+            photoView.layout(
+                    leftBound,
+                    photoTop,
+                    leftBound + mPhotoViewWidth,
+                    photoTop + mPhotoViewHeight);
+            leftBound += mPhotoViewWidth + mGapBetweenImageAndText;
+        }
+        return leftBound;
+    }
+
+    /**
+     * Performs layout of the right side of the view
+     *
+     * @return new right boundary
+     */
+    protected int layoutRightSide(int height, int topBound, int rightBound) {
+        if (isVisible(mCallButton)) {
+            int buttonWidth = mCallButton.getMeasuredWidth();
+            rightBound -= buttonWidth;
+            mCallButton.layout(
+                    rightBound,
+                    topBound,
+                    rightBound + buttonWidth,
+                    height - mHorizontalDividerHeight);
+            mVerticalDividerVisible = true;
+            ensureVerticalDivider();
+            rightBound -= mVerticalDividerWidth;
+            mVerticalDividerDrawable.setBounds(
+                    rightBound,
+                    topBound + mVerticalDividerMargin,
+                    rightBound + mVerticalDividerWidth,
+                    height - mVerticalDividerMargin);
+        } else {
+            mVerticalDividerVisible = false;
+        }
+
+        if (isVisible(mPresenceIcon)) {
+            int iconWidth = mPresenceIcon.getMeasuredWidth();
+            rightBound -= mPresenceIconMargin + iconWidth;
+            mPresenceIcon.layout(
+                    rightBound,
+                    topBound,
+                    rightBound + iconWidth,
+                    height);
+        }
+        return rightBound;
+    }
+
+    protected boolean isVisible(View view) {
+        return view != null && view.getVisibility() == View.VISIBLE;
+    }
+
+    /**
+     * Loads the drawable for the item background used when the item is checked.
+     */
+    private void ensureActivatedBackgroundDrawable() {
+        if (mActivatedBackgroundDrawable == null) {
+            mActivatedBackgroundDrawable = mContext.getResources().getDrawable(
+                    R.drawable.list_item_activated_bg);
+            mActivatedBackgroundDrawable.setBounds(0, 0, getWidth(), getHeight());
+        }
+    }
+
+    /**
+     * Loads the drawable for the vertical divider if it has not yet been loaded.
+     */
+    private void ensureVerticalDivider() {
+        if (mVerticalDividerDrawable == null) {
+            mVerticalDividerDrawable = mContext.getResources().getDrawable(
+                    R.drawable.divider_vertical_dark);
+            mVerticalDividerWidth = mVerticalDividerDrawable.getIntrinsicWidth();
+        }
+    }
+
+    /**
+     * Extracts width and height from the style
+     */
+    private void ensurePhotoViewSize() {
+        if (mPhotoViewWidth == 0 && mPhotoViewHeight == 0) {
+            if (mQuickContactEnabled) {
+                TypedArray a = mContext.obtainStyledAttributes(null,
+                        com.android.internal.R.styleable.ViewGroup_Layout,
+                        QUICK_CONTACT_BADGE_STYLE, 0);
+                mPhotoViewWidth = a.getLayoutDimension(
+                        android.R.styleable.ViewGroup_Layout_layout_width,
+                        ViewGroup.LayoutParams.WRAP_CONTENT);
+                mPhotoViewHeight = a.getLayoutDimension(
+                        android.R.styleable.ViewGroup_Layout_layout_height,
+                        ViewGroup.LayoutParams.WRAP_CONTENT);
+                a.recycle();
+            } else {
+                mPhotoViewWidth = mPhotoViewHeight = mDefaultPhotoViewSize;
+            }
+        }
+    }
+
+    @Override
+    protected void drawableStateChanged() {
+        super.drawableStateChanged();
+        if (mPressedBackgroundDrawable != null) {
+            mPressedBackgroundDrawable.setState(getDrawableState());
+            invalidate();
+        }
+    }
+
+    @Override
+    public void dispatchDraw(Canvas canvas) {
+        if (isPressed() && mPressedBackgroundDrawable != null) {
+            mPressedBackgroundDrawable.draw(canvas);
+        } else if (isActivated()) {
+            mActivatedBackgroundDrawable.draw(canvas);
+        }
+        if (mHeaderVisible) {
+            mHeaderBackgroundDrawable.draw(canvas);
+        }
+        if (mHorizontalDividerVisible) {
+            mHorizontalDividerDrawable.draw(canvas);
+        }
+        if (mVerticalDividerVisible) {
+            mVerticalDividerDrawable.draw(canvas);
+        }
+        super.dispatchDraw(canvas);
+    }
+
+    /**
+     * Sets the flag that determines whether a divider should drawn at the bottom
+     * of the view.
+     */
+    public void setDividerVisible(boolean visible) {
+        mHorizontalDividerVisible = visible;
+    }
+
+    /**
+     * Sets section header or makes it invisible if the title is null.
+     */
+    public void setSectionHeader(String title) {
+        if (!TextUtils.isEmpty(title)) {
+            if (mHeaderTextView == null) {
+                mHeaderTextView = new TextView(mContext);
+                mHeaderTextView.setTypeface(mHeaderTextView.getTypeface(), Typeface.BOLD);
+                mHeaderTextView.setTextColor(mContext.getResources()
+                        .getColor(R.color.section_header_text_color));
+                mHeaderTextView.setTextSize(14);
+                mHeaderTextView.setGravity(Gravity.CENTER);
+                addView(mHeaderTextView);
+            }
+            mHeaderTextView.setText(title);
+            mHeaderTextView.setVisibility(View.VISIBLE);
+            mHeaderVisible = true;
+        } else {
+            if (mHeaderTextView != null) {
+                mHeaderTextView.setVisibility(View.GONE);
+            }
+            mHeaderVisible = false;
+        }
+    }
+
+    /**
+     * Returns the quick contact badge, creating it if necessary.
+     */
+    public QuickContactBadge getQuickContact() {
+        if (!mQuickContactEnabled) {
+            throw new IllegalStateException("QuickContact is disabled for this view");
+        }
+        if (mQuickContact == null) {
+            mQuickContact = new QuickContactBadge(mContext, null, QUICK_CONTACT_BADGE_STYLE);
+            mQuickContact.setExcludeMimes(new String[] { Contacts.CONTENT_ITEM_TYPE });
+            addView(mQuickContact);
+        }
+        return mQuickContact;
+    }
+
+    /**
+     * Returns the photo view, creating it if necessary.
+     */
+    public ImageView getPhotoView() {
+        if (mPhotoView == null) {
+            if (mQuickContactEnabled) {
+                mPhotoView = new ImageView(mContext, null, QUICK_CONTACT_BADGE_STYLE);
+            } else {
+                mPhotoView = new ImageView(mContext);
+            }
+            // Quick contact style used above will set a background - remove it
+            mPhotoView.setBackgroundDrawable(null);
+            addView(mPhotoView);
+        }
+        return mPhotoView;
+    }
+
+    /**
+     * Removes the photo view.  Should not be needed once we start handling different
+     * types of views as different types of views from the List's perspective.
+     */
+    public void removePhotoView() {
+        if (mPhotoView != null) {
+            removeView(mPhotoView);
+            mPhotoView = null;
+        }
+        if (mQuickContact != null) {
+            removeView(mQuickContact);
+            mQuickContact = null;
+        }
+    }
+
+    /**
+     * Sets a word prefix that will be highlighted if encountered in fields like
+     * name and search snippet.
+     * <p>
+     * NOTE: must be all upper-case
+     */
+    public void setHighlightedPrefix(char[] upperCasePrefix) {
+        mHighlightedPrefix = upperCasePrefix;
+    }
+
+    /**
+     * Returns the text view for the contact name, creating it if necessary.
+     */
+    public TextView getNameTextView() {
+        if (mNameTextView == null) {
+            mNameTextView = new TextView(mContext);
+            mNameTextView.setSingleLine(true);
+            mNameTextView.setEllipsize(getTextEllipsis());
+            mNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Large);
+            mNameTextView.setGravity(Gravity.CENTER_VERTICAL);
+            addView(mNameTextView);
+        }
+        return mNameTextView;
+    }
+
+    /**
+     * Adds a call button using the supplied arguments as an id and tag.
+     */
+    public void showCallButton(int id, int tag) {
+        if (mCallButton == null) {
+            mCallButton = new DontPressWithParentImageView(mContext, null);
+            mCallButton.setId(id);
+            mCallButton.setOnClickListener(mCallButtonClickListener);
+            mCallButton.setBackgroundResource(R.drawable.call_background);
+            mCallButton.setImageResource(android.R.drawable.sym_action_call);
+            mCallButton.setPadding(mCallButtonPadding, 0, mCallButtonPadding, 0);
+            mCallButton.setScaleType(ScaleType.CENTER);
+            addView(mCallButton);
+        }
+
+        mCallButton.setTag(tag);
+        mCallButton.setVisibility(View.VISIBLE);
+    }
+
+    public void hideCallButton() {
+        if (mCallButton != null) {
+            mCallButton.setVisibility(View.GONE);
+        }
+    }
+
+    /**
+     * Adds or updates a text view for the phonetic name.
+     */
+    public void setPhoneticName(char[] text, int size) {
+        if (text == null || size == 0) {
+            if (mPhoneticNameTextView != null) {
+                mPhoneticNameTextView.setVisibility(View.GONE);
+            }
+        } else {
+            getPhoneticNameTextView();
+            mPhoneticNameTextView.setText(text, 0, size);
+            mPhoneticNameTextView.setVisibility(VISIBLE);
+        }
+    }
+
+    /**
+     * Returns the text view for the phonetic name, creating it if necessary.
+     */
+    public TextView getPhoneticNameTextView() {
+        if (mPhoneticNameTextView == null) {
+            mPhoneticNameTextView = new TextView(mContext);
+            mPhoneticNameTextView.setSingleLine(true);
+            mPhoneticNameTextView.setEllipsize(getTextEllipsis());
+            mPhoneticNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
+            mPhoneticNameTextView.setTypeface(mPhoneticNameTextView.getTypeface(), Typeface.BOLD);
+            addView(mPhoneticNameTextView);
+        }
+        return mPhoneticNameTextView;
+    }
+
+    /**
+     * Adds or updates a text view for the data label.
+     */
+    public void setLabel(CharSequence text) {
+        if (TextUtils.isEmpty(text)) {
+            if (mLabelView != null) {
+                mLabelView.setVisibility(View.GONE);
+            }
+        } else {
+            getLabelView();
+            mLabelView.setText(text);
+            mLabelView.setVisibility(VISIBLE);
+        }
+    }
+
+    /**
+     * Adds or updates a text view for the data label.
+     */
+    public void setLabel(char[] text, int size) {
+        if (text == null || size == 0) {
+            if (mLabelView != null) {
+                mLabelView.setVisibility(View.GONE);
+            }
+        } else {
+            getLabelView();
+            mLabelView.setText(text, 0, size);
+            mLabelView.setVisibility(VISIBLE);
+        }
+    }
+
+    /**
+     * Returns the text view for the data label, creating it if necessary.
+     */
+    public TextView getLabelView() {
+        if (mLabelView == null) {
+            mLabelView = new TextView(mContext);
+            mLabelView.setSingleLine(true);
+            mLabelView.setEllipsize(getTextEllipsis());
+            mLabelView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
+            mLabelView.setTypeface(mLabelView.getTypeface(), Typeface.BOLD);
+            addView(mLabelView);
+        }
+        return mLabelView;
+    }
+
+    /**
+     * Adds or updates a text view for the data element.
+     */
+    public void setData(char[] text, int size) {
+        if (text == null || size == 0) {
+            if (mDataView != null) {
+                mDataView.setVisibility(View.GONE);
+            }
+            return;
+        } else {
+            getDataView();
+            mDataView.setText(text, 0, size);
+            mDataView.setVisibility(VISIBLE);
+        }
+    }
+
+    /**
+     * Returns the text view for the data text, creating it if necessary.
+     */
+    public TextView getDataView() {
+        if (mDataView == null) {
+            mDataView = new TextView(mContext);
+            mDataView.setSingleLine(true);
+            mDataView.setEllipsize(getTextEllipsis());
+            mDataView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
+            addView(mDataView);
+        }
+        return mDataView;
+    }
+
+    /**
+     * Adds or updates a text view for the search snippet.
+     */
+    public void setSnippet(String text) {
+        if (TextUtils.isEmpty(text)) {
+            if (mSnippetView != null) {
+                mSnippetView.setVisibility(View.GONE);
+            }
+        } else {
+            getSnippetView();
+            setTextWithPrefixHighlighting(mSnippetView, text);
+            mSnippetView.setVisibility(VISIBLE);
+        }
+    }
+
+    /**
+     * Returns the text view for the search snippet, creating it if necessary.
+     */
+    public TextView getSnippetView() {
+        if (mSnippetView == null) {
+            mSnippetView = new TextView(mContext);
+            mSnippetView.setSingleLine(true);
+            mSnippetView.setEllipsize(getTextEllipsis());
+            mSnippetView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
+            mSnippetView.setTypeface(mSnippetView.getTypeface(), Typeface.BOLD);
+            addView(mSnippetView);
+        }
+        return mSnippetView;
+    }
+
+    /**
+     * Adds or updates the presence icon view.
+     */
+    public void setPresence(Drawable icon) {
+        if (icon != null) {
+            if (mPresenceIcon == null) {
+                mPresenceIcon = new ImageView(mContext);
+                addView(mPresenceIcon);
+            }
+            mPresenceIcon.setImageDrawable(icon);
+            mPresenceIcon.setScaleType(ScaleType.CENTER);
+            mPresenceIcon.setVisibility(View.VISIBLE);
+        } else {
+            if (mPresenceIcon != null) {
+                mPresenceIcon.setVisibility(View.GONE);
+            }
+        }
+    }
+
+    private TruncateAt getTextEllipsis() {
+        return mActivatedStateSupported ? TruncateAt.START : TruncateAt.MARQUEE;
+    }
+
+    public void showDisplayName(Cursor cursor, int nameColumnIndex, boolean highlightingEnabled,
+            int alternativeNameColumnIndex) {
+        cursor.copyStringToBuffer(nameColumnIndex, mNameBuffer);
+        TextView nameView = getNameTextView();
+        int size = mNameBuffer.sizeCopied;
+        if (size != 0) {
+            if (mHighlightedPrefix != null) {
+                setTextWithPrefixHighlighting(nameView, mNameBuffer);
+            } else if (highlightingEnabled) {
+                if (mTextWithHighlighting == null) {
+                    mTextWithHighlighting =
+                            mTextWithHighlightingFactory.createTextWithHighlighting();
+                }
+                cursor.copyStringToBuffer(alternativeNameColumnIndex, mHighlightedTextBuffer);
+                mTextWithHighlighting.setText(mNameBuffer, mHighlightedTextBuffer);
+                nameView.setText(mTextWithHighlighting);
+            } else {
+                nameView.setText(mNameBuffer.data, 0, size);
+            }
+        } else {
+            nameView.setText(mUnknownNameText);
+        }
+    }
+
+    public void showPhoneticName(Cursor cursor, int phoneticNameColumnIndex) {
+        cursor.copyStringToBuffer(phoneticNameColumnIndex, mPhoneticNameBuffer);
+        int phoneticNameSize = mPhoneticNameBuffer.sizeCopied;
+        if (phoneticNameSize != 0) {
+            setPhoneticName(mPhoneticNameBuffer.data, phoneticNameSize);
+        } else {
+            setPhoneticName(null, 0);
+        }
+    }
+
+    /**
+     * Sets the proper icon (star or presence or nothing)
+     */
+    public void showPresence(Cursor cursor, int presenceColumnIndex) {
+        int serverStatus;
+        if (!cursor.isNull(presenceColumnIndex)) {
+            serverStatus = cursor.getInt(presenceColumnIndex);
+
+            // TODO consider caching these drawables
+            Drawable icon = ContactPresenceIconUtil.getPresenceIcon(getContext(), serverStatus);
+            if (icon != null) {
+                setPresence(icon);
+            } else {
+                setPresence(null);
+            }
+        } else {
+            setPresence(null);
+        }
+    }
+
+    /**
+     * Shows search snippet.
+     */
+    public void showSnippet(Cursor cursor, int summarySnippetMimetypeColumnIndex,
+            int summarySnippetData1ColumnIndex, int summarySnippetData4ColumnIndex) {
+        String snippet = null;
+        String snippetMimeType = cursor.getString(summarySnippetMimetypeColumnIndex);
+        if (Email.CONTENT_ITEM_TYPE.equals(snippetMimeType)) {
+            String email = cursor.getString(summarySnippetData1ColumnIndex);
+            if (!TextUtils.isEmpty(email)) {
+                snippet = email;
+            }
+        } else if (Organization.CONTENT_ITEM_TYPE.equals(snippetMimeType)) {
+            String company = cursor.getString(summarySnippetData1ColumnIndex);
+            String title = cursor.getString(summarySnippetData4ColumnIndex);
+            if (!TextUtils.isEmpty(company)) {
+                if (!TextUtils.isEmpty(title)) {
+                    snippet = company + " / " + title;
+                } else {
+                    snippet = company;
+                }
+            } else if (!TextUtils.isEmpty(title)) {
+                snippet = title;
+            }
+        } else if (Nickname.CONTENT_ITEM_TYPE.equals(snippetMimeType)) {
+            String nickname = cursor.getString(summarySnippetData1ColumnIndex);
+            if (!TextUtils.isEmpty(nickname)) {
+                snippet = nickname;
+            }
+        }
+
+        setSnippet(snippet);
+    }
+
+    /**
+     * Shows data element (e.g. phone number).
+     */
+    public void showData(Cursor cursor, int dataColumnIndex) {
+        cursor.copyStringToBuffer(dataColumnIndex, mDataBuffer);
+        setData(mDataBuffer.data, mDataBuffer.sizeCopied);
+    }
+
+    public void setActivatedStateSupported(boolean flag) {
+        this.mActivatedStateSupported = flag;
+    }
+
+    /**
+     * Sets text on the given text view, highlighting the word that matches
+     * the given prefix (see {@link #setHighlightedPrefix}).
+     */
+    private void setTextWithPrefixHighlighting(TextView textView, String text) {
+        mHighlightedTextBuffer.sizeCopied =
+                Math.min(text.length(), mHighlightedTextBuffer.data.length);
+        text.getChars(0, mHighlightedTextBuffer.sizeCopied, mHighlightedTextBuffer.data, 0);
+        setTextWithPrefixHighlighting(textView, mHighlightedTextBuffer);
+    }
+
+    /**
+     * Sets text on the given text view, highlighting the word that matches
+     * the given prefix (see {@link #setHighlightedPrefix}).
+     */
+    private void setTextWithPrefixHighlighting(TextView textView, CharArrayBuffer text) {
+        int index = indexOfWordPrefix(text, mHighlightedPrefix);
+        if (index != -1) {
+            if (mPrefixColorSpan == null) {
+                mPrefixColorSpan = new ForegroundColorSpan(mPrefixHightlightColor);
+            }
+
+            String string = new String(text.data, 0, text.sizeCopied);
+            SpannableString name = new SpannableString(string);
+            name.setSpan(mPrefixColorSpan, index, index + mHighlightedPrefix.length, 0 /* flags */);
+            textView.setText(name);
+        } else {
+            textView.setText(text.data, 0, text.sizeCopied);
+        }
+    }
+
+    /**
+     * Finds the index of the word that starts with the given prefix.  If not found,
+     * returns -1.
+     */
+    private int indexOfWordPrefix(CharArrayBuffer buffer, char[] prefix) {
+        char[] string1 = buffer.data;
+        int count1 = buffer.sizeCopied;
+        int count2 = prefix.length;
+
+        int size = count2;
+        int i = 0;
+        while (i < count1) {
+
+            // Skip non-word characters
+            while (i < count1 && !Character.isLetterOrDigit(string1[i])) {
+                i++;
+            }
+
+            if (i + size > count1) {
+                return -1;
+            }
+
+            // Compare the prefixes
+            int j;
+            for (j = 0; j < size; j++) {
+                if (Character.toUpperCase(string1[i+j]) != prefix[j]) {
+                    break;
+                }
+            }
+            if (j == size) {
+                return i;
+            }
+
+            // Skip this word
+            while (i < count1 && Character.isLetterOrDigit(string1[i])) {
+                i++;
+            }
+        }
+
+        return -1;
+    }
+
+    @Override
+    public void requestLayout() {
+        // We will assume that once measured this will not need to resize
+        // itself, so there is no need to pass the layout request to the parent
+        // view (ListView).
+        forceLayout();
+    }
+}
diff --git a/src/com/android/contacts/list/ContactNameHighlightingAnimation.java b/src/com/android/contacts/list/ContactNameHighlightingAnimation.java
new file mode 100644
index 0000000..05881ce
--- /dev/null
+++ b/src/com/android/contacts/list/ContactNameHighlightingAnimation.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2007 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.contacts.list;
+
+import com.android.contacts.widget.TextHighlightingAnimation;
+
+import android.view.View;
+import android.widget.ListView;
+
+/**
+ * A {@link TextHighlightingAnimation} that redraws just the contact display name in a
+ * list item.
+ */
+public class ContactNameHighlightingAnimation extends TextHighlightingAnimation {
+    private final ListView mListView;
+    private boolean mSavedScrollingCacheEnabledFlag;
+
+    public ContactNameHighlightingAnimation(ListView listView, int duration) {
+        super(duration);
+        this.mListView = listView;
+    }
+
+    /**
+     * Redraws all visible items of the list corresponding to contacts
+     */
+    @Override
+    protected void invalidate() {
+        int childCount = mListView.getChildCount();
+        for (int i = 0; i < childCount; i++) {
+            View itemView = mListView.getChildAt(i);
+            if (itemView instanceof ContactListItemView) {
+                final ContactListItemView view = (ContactListItemView)itemView;
+                view.getNameTextView().invalidate();
+            }
+        }
+    }
+
+    @Override
+    protected void onAnimationStarted() {
+        mSavedScrollingCacheEnabledFlag = mListView.isScrollingCacheEnabled();
+        mListView.setScrollingCacheEnabled(false);
+    }
+
+    @Override
+    protected void onAnimationEnded() {
+        mListView.setScrollingCacheEnabled(mSavedScrollingCacheEnabledFlag);
+    }
+}
diff --git a/src/com/android/contacts/list/ContactPhotoLoader.java b/src/com/android/contacts/list/ContactPhotoLoader.java
new file mode 100644
index 0000000..83e9131
--- /dev/null
+++ b/src/com/android/contacts/list/ContactPhotoLoader.java
@@ -0,0 +1,479 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import com.google.android.collect.Lists;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.Handler.Callback;
+import android.os.HandlerThread;
+import android.os.Message;
+import android.provider.ContactsContract.Contacts.Photo;
+import android.provider.ContactsContract.Data;
+import android.util.Log;
+import android.widget.ImageView;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Asynchronously loads contact photos and maintains cache of photos.  The class is
+ * mostly single-threaded.  The only two methods accessed by the loader thread are
+ * {@link #cacheBitmap} and {@link #obtainPhotoIdsAndUrisToLoad}. Those methods access concurrent
+ * hash maps shared with the main thread.
+ */
+public class ContactPhotoLoader implements Callback {
+    private static final String TAG = "ContactPhotoLoader";
+    private static final String LOADER_THREAD_NAME = "ContactPhotoLoader";
+
+    /**
+     * Type of message sent by the UI thread to itself to indicate that some photos
+     * need to be loaded.
+     */
+    private static final int MESSAGE_REQUEST_LOADING = 1;
+
+    /**
+     * Type of message sent by the loader thread to indicate that some photos have
+     * been loaded.
+     */
+    private static final int MESSAGE_PHOTOS_LOADED = 2;
+
+    private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+    private final String[] COLUMNS = new String[] { Photo._ID, Photo.PHOTO };
+
+    /**
+     * The resource ID of the image to be used when the photo is unavailable or being
+     * loaded.
+     */
+    private final int mDefaultResourceId;
+
+    /**
+     * Maintains the state of a particular photo.
+     */
+    private static class BitmapHolder {
+        private static final int NEEDED = 0;
+        private static final int LOADING = 1;
+        private static final int LOADED = 2;
+
+        int state;
+        SoftReference<Bitmap> bitmapRef;
+    }
+
+    /**
+     * A soft cache for photos.
+     */
+    private final ConcurrentHashMap<Object, BitmapHolder> mBitmapCache =
+            new ConcurrentHashMap<Object, BitmapHolder>();
+
+    /**
+     * A map from ImageView to the corresponding photo ID. Please note that this
+     * photo ID may change before the photo loading request is started.
+     */
+    private final ConcurrentHashMap<ImageView, Object> mPendingRequests =
+            new ConcurrentHashMap<ImageView, Object>();
+
+    /**
+     * Handler for messages sent to the UI thread.
+     */
+    private final Handler mMainThreadHandler = new Handler(this);
+
+    /**
+     * Thread responsible for loading photos from the database. Created upon
+     * the first request.
+     */
+    private LoaderThread mLoaderThread;
+
+    /**
+     * A gate to make sure we only send one instance of MESSAGE_PHOTOS_NEEDED at a time.
+     */
+    private boolean mLoadingRequested;
+
+    /**
+     * Flag indicating if the image loading is paused.
+     */
+    private boolean mPaused;
+
+    private final Context mContext;
+
+    /**
+     * Constructor.
+     *
+     * @param context content context
+     * @param defaultResourceId the image resource ID to be used when there is
+     *            no photo for a contact
+     */
+    public ContactPhotoLoader(Context context, int defaultResourceId) {
+        mDefaultResourceId = defaultResourceId;
+        mContext = context;
+    }
+
+    /**
+     * Load photo into the supplied image view.  If the photo is already cached,
+     * it is displayed immediately.  Otherwise a request is sent to load the photo
+     * from the database.
+     */
+    public void loadPhoto(ImageView view, long photoId) {
+        if (photoId == 0) {
+            // No photo is needed
+            view.setImageResource(mDefaultResourceId);
+            mPendingRequests.remove(view);
+        } else {
+            loadPhotoByIdOrUri(view, photoId);
+        }
+    }
+
+    /**
+     * Load photo into the supplied image view.  If the photo is already cached,
+     * it is displayed immediately.  Otherwise a request is sent to load the photo
+     * from the location specified by the URI.
+     */
+    public void loadPhoto(ImageView view, Uri photoUri) {
+        if (photoUri == null) {
+            // No photo is needed
+            view.setImageResource(mDefaultResourceId);
+            mPendingRequests.remove(view);
+        } else {
+            loadPhotoByIdOrUri(view, photoUri);
+        }
+    }
+
+    private void loadPhotoByIdOrUri(ImageView view, Object key) {
+        boolean loaded = loadCachedPhoto(view, key);
+        if (loaded) {
+            mPendingRequests.remove(view);
+        } else {
+            mPendingRequests.put(view, key);
+            if (!mPaused) {
+                // Send a request to start loading photos
+                requestLoading();
+            }
+        }
+    }
+
+    /**
+     * Checks if the photo is present in cache.  If so, sets the photo on the view,
+     * otherwise sets the state of the photo to {@link BitmapHolder#NEEDED} and
+     * temporarily set the image to the default resource ID.
+     */
+    private boolean loadCachedPhoto(ImageView view, Object key) {
+        BitmapHolder holder = mBitmapCache.get(key);
+        if (holder == null) {
+            holder = new BitmapHolder();
+            mBitmapCache.put(key, holder);
+        } else if (holder.state == BitmapHolder.LOADED) {
+            // Null bitmap reference means that database contains no bytes for the photo
+            if (holder.bitmapRef == null) {
+                view.setImageResource(mDefaultResourceId);
+                return true;
+            }
+
+            Bitmap bitmap = holder.bitmapRef.get();
+            if (bitmap != null) {
+                view.setImageBitmap(bitmap);
+                return true;
+            }
+
+            // Null bitmap means that the soft reference was released by the GC
+            // and we need to reload the photo.
+            holder.bitmapRef = null;
+        }
+
+        // The bitmap has not been loaded - should display the placeholder image.
+        view.setImageResource(mDefaultResourceId);
+        holder.state = BitmapHolder.NEEDED;
+        return false;
+    }
+
+    /**
+     * Stops loading images, kills the image loader thread and clears all caches.
+     */
+    public void stop() {
+        pause();
+
+        if (mLoaderThread != null) {
+            mLoaderThread.quit();
+            mLoaderThread = null;
+        }
+
+        mPendingRequests.clear();
+        mBitmapCache.clear();
+    }
+
+    public void clear() {
+        mPendingRequests.clear();
+        mBitmapCache.clear();
+    }
+
+    /**
+     * Temporarily stops loading photos from the database.
+     */
+    public void pause() {
+        mPaused = true;
+    }
+
+    /**
+     * Resumes loading photos from the database.
+     */
+    public void resume() {
+        mPaused = false;
+        if (!mPendingRequests.isEmpty()) {
+            requestLoading();
+        }
+    }
+
+    /**
+     * Sends a message to this thread itself to start loading images.  If the current
+     * view contains multiple image views, all of those image views will get a chance
+     * to request their respective photos before any of those requests are executed.
+     * This allows us to load images in bulk.
+     */
+    private void requestLoading() {
+        if (!mLoadingRequested) {
+            mLoadingRequested = true;
+            mMainThreadHandler.sendEmptyMessage(MESSAGE_REQUEST_LOADING);
+        }
+    }
+
+    /**
+     * Processes requests on the main thread.
+     */
+    public boolean handleMessage(Message msg) {
+        switch (msg.what) {
+            case MESSAGE_REQUEST_LOADING: {
+                mLoadingRequested = false;
+                if (!mPaused) {
+                    if (mLoaderThread == null) {
+                        mLoaderThread = new LoaderThread(mContext.getContentResolver());
+                        mLoaderThread.start();
+                    }
+
+                    mLoaderThread.requestLoading();
+                }
+                return true;
+            }
+
+            case MESSAGE_PHOTOS_LOADED: {
+                if (!mPaused) {
+                    processLoadedImages();
+                }
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Goes over pending loading requests and displays loaded photos.  If some of the
+     * photos still haven't been loaded, sends another request for image loading.
+     */
+    private void processLoadedImages() {
+        Iterator<ImageView> iterator = mPendingRequests.keySet().iterator();
+        while (iterator.hasNext()) {
+            ImageView view = iterator.next();
+            Object key = mPendingRequests.get(view);
+            boolean loaded = loadCachedPhoto(view, key);
+            if (loaded) {
+                iterator.remove();
+            }
+        }
+
+        if (!mPendingRequests.isEmpty()) {
+            requestLoading();
+        }
+    }
+
+    /**
+     * Stores the supplied bitmap in cache.
+     */
+    private void cacheBitmap(Object key, byte[] bytes) {
+        if (mPaused) {
+            return;
+        }
+
+        BitmapHolder holder = new BitmapHolder();
+        holder.state = BitmapHolder.LOADED;
+        if (bytes != null) {
+            try {
+                Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, null);
+                holder.bitmapRef = new SoftReference<Bitmap>(bitmap);
+            } catch (OutOfMemoryError e) {
+                // Do nothing - the photo will appear to be missing
+            }
+        }
+        mBitmapCache.put(key, holder);
+    }
+
+    /**
+     * Populates an array of photo IDs that need to be loaded.
+     */
+    private void obtainPhotoIdsAndUrisToLoad(ArrayList<Long> photoIds,
+            ArrayList<String> photoIdsAsStrings, ArrayList<Uri> uris) {
+        photoIds.clear();
+        photoIdsAsStrings.clear();
+        uris.clear();
+
+        /*
+         * Since the call is made from the loader thread, the map could be
+         * changing during the iteration. That's not really a problem:
+         * ConcurrentHashMap will allow those changes to happen without throwing
+         * exceptions. Since we may miss some requests in the situation of
+         * concurrent change, we will need to check the map again once loading
+         * is complete.
+         */
+        Iterator<Object> iterator = mPendingRequests.values().iterator();
+        while (iterator.hasNext()) {
+            Object key = iterator.next();
+            BitmapHolder holder = mBitmapCache.get(key);
+            if (holder != null && holder.state == BitmapHolder.NEEDED) {
+                // Assuming atomic behavior
+                holder.state = BitmapHolder.LOADING;
+                if (key instanceof Long) {
+                    photoIds.add((Long)key);
+                    photoIdsAsStrings.add(key.toString());
+                } else {
+                    uris.add((Uri)key);
+                }
+            }
+        }
+    }
+
+    /**
+     * The thread that performs loading of photos from the database.
+     */
+    private class LoaderThread extends HandlerThread implements Callback {
+        private static final int BUFFER_SIZE = 1024*16;
+
+        private final ContentResolver mResolver;
+        private final StringBuilder mStringBuilder = new StringBuilder();
+        private final ArrayList<Long> mPhotoIds = Lists.newArrayList();
+        private final ArrayList<String> mPhotoIdsAsStrings = Lists.newArrayList();
+        private final ArrayList<Uri> mPhotoUris = Lists.newArrayList();
+        private Handler mLoaderThreadHandler;
+        private byte mBuffer[];
+
+        public LoaderThread(ContentResolver resolver) {
+            super(LOADER_THREAD_NAME);
+            mResolver = resolver;
+        }
+
+        /**
+         * Sends a message to this thread to load requested photos.
+         */
+        public void requestLoading() {
+            if (mLoaderThreadHandler == null) {
+                mLoaderThreadHandler = new Handler(getLooper(), this);
+            }
+            mLoaderThreadHandler.sendEmptyMessage(0);
+        }
+
+        /**
+         * Receives the above message, loads photos and then sends a message
+         * to the main thread to process them.
+         */
+        public boolean handleMessage(Message msg) {
+            loadPhotosFromDatabase();
+            return true;
+        }
+
+        private void loadPhotosFromDatabase() {
+            obtainPhotoIdsAndUrisToLoad(mPhotoIds, mPhotoIdsAsStrings, mPhotoUris);
+
+            int count = mPhotoIds.size();
+            if (count != 0) {
+                mStringBuilder.setLength(0);
+                mStringBuilder.append(Photo._ID + " IN(");
+                for (int i = 0; i < count; i++) {
+                    if (i != 0) {
+                        mStringBuilder.append(',');
+                    }
+                    mStringBuilder.append('?');
+                }
+                mStringBuilder.append(')');
+
+                Cursor cursor = null;
+                try {
+                    cursor = mResolver.query(Data.CONTENT_URI,
+                            COLUMNS,
+                            mStringBuilder.toString(),
+                            mPhotoIdsAsStrings.toArray(EMPTY_STRING_ARRAY),
+                            null);
+
+                    if (cursor != null) {
+                        while (cursor.moveToNext()) {
+                            Long id = cursor.getLong(0);
+                            byte[] bytes = cursor.getBlob(1);
+                            cacheBitmap(id, bytes);
+                            mPhotoIds.remove(id);
+                        }
+                    }
+                } finally {
+                    if (cursor != null) {
+                        cursor.close();
+                    }
+                }
+
+                // Remaining photos were not found in the database - mark the cache accordingly.
+                count = mPhotoIds.size();
+                for (int i = 0; i < count; i++) {
+                    cacheBitmap(mPhotoIds.get(i), null);
+                }
+                mMainThreadHandler.sendEmptyMessage(MESSAGE_PHOTOS_LOADED);
+            }
+
+            count = mPhotoUris.size();
+            for (int i = 0; i < count; i++) {
+                Uri uri = mPhotoUris.get(i);
+                if (mBuffer == null) {
+                    mBuffer = new byte[BUFFER_SIZE];
+                }
+                try {
+                    InputStream is = mResolver.openInputStream(uri);
+                    if (is != null) {
+                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                        try {
+                            int size;
+                            while ((size = is.read(mBuffer)) != -1) {
+                                baos.write(mBuffer, 0, size);
+                            }
+                        } finally {
+                            is.close();
+                        }
+                        cacheBitmap(uri, baos.toByteArray());
+                        mMainThreadHandler.sendEmptyMessage(MESSAGE_PHOTOS_LOADED);
+                    } else {
+                        Log.v(TAG, "Cannot load photo " + uri);
+                        cacheBitmap(uri, null);
+                    }
+                } catch (Exception ex) {
+                    Log.v(TAG, "Cannot load photo " + uri, ex);
+                    cacheBitmap(uri, null);
+                }
+            }
+        }
+    }
+}
diff --git a/src/com/android/contacts/list/ContactPickerFragment.java b/src/com/android/contacts/list/ContactPickerFragment.java
new file mode 100644
index 0000000..2fa70af
--- /dev/null
+++ b/src/com/android/contacts/list/ContactPickerFragment.java
@@ -0,0 +1,172 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.R;
+import com.android.contacts.list.ShortcutIntentBuilder.OnShortcutIntentCreatedListener;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+
+/**
+ * Fragment for the contact list used for browsing contacts (as compared to
+ * picking a contact with one of the PICK or SHORTCUT intents).
+ */
+public class ContactPickerFragment extends ContactEntryListFragment<ContactEntryListAdapter>
+        implements OnShortcutIntentCreatedListener {
+
+    private OnContactPickerActionListener mListener;
+    private boolean mCreateContactEnabled;
+    private boolean mShortcutRequested;
+
+    public ContactPickerFragment() {
+        setPhotoLoaderEnabled(true);
+        setSectionHeaderDisplayEnabled(true);
+        setAizyEnabled(true);
+        setQuickContactEnabled(false);
+    }
+
+    public void setOnContactPickerActionListener(OnContactPickerActionListener listener) {
+        mListener = listener;
+    }
+
+    public boolean isCreateContactEnabled() {
+        return mCreateContactEnabled;
+    }
+
+    public void setCreateContactEnabled(boolean flag) {
+        this.mCreateContactEnabled = flag;
+    }
+
+    public boolean isShortcutRequested() {
+        return mShortcutRequested;
+    }
+
+    public void setShortcutRequested(boolean flag) {
+        mShortcutRequested = flag;
+    }
+
+    @Override
+    protected void onCreateView(LayoutInflater inflater, ViewGroup container) {
+        super.onCreateView(inflater, container);
+        if (mCreateContactEnabled) {
+            getListView().addHeaderView(inflater.inflate(R.layout.create_new_contact, null, false));
+        }
+    }
+
+    @Override
+    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+        if (position == 0 && !isSearchMode() && mCreateContactEnabled) {
+            mListener.onCreateNewContactAction();
+        } else {
+            super.onItemClick(parent, view, position, id);
+        }
+    }
+
+    @Override
+    protected void onItemClick(int position, long id) {
+        Uri uri;
+        if (isLegacyCompatibilityMode()) {
+            uri = ((LegacyContactListAdapter)getAdapter()).getPersonUri(position);
+        } else {
+            uri = ((ContactListAdapter)getAdapter()).getContactUri(position);
+        }
+        if (mShortcutRequested) {
+            ShortcutIntentBuilder builder = new ShortcutIntentBuilder(getActivity(), this);
+            builder.createContactShortcutIntent(uri);
+        } else {
+            mListener.onPickContactAction(uri);
+        }
+    }
+
+    @Override
+    protected ContactEntryListAdapter createListAdapter() {
+        if (!isLegacyCompatibilityMode()) {
+            DefaultContactListAdapter adapter = new DefaultContactListAdapter(getActivity());
+            adapter.setFilter(
+                    new ContactListFilter(ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS), null);
+            adapter.setSectionHeaderDisplayEnabled(true);
+            adapter.setDisplayPhotos(true);
+            adapter.setQuickContactEnabled(false);
+            return adapter;
+        } else {
+            LegacyContactListAdapter adapter = new LegacyContactListAdapter(getActivity());
+            adapter.setSectionHeaderDisplayEnabled(false);
+            adapter.setDisplayPhotos(false);
+            return adapter;
+        }
+    }
+
+    @Override
+    protected void configureAdapter() {
+        super.configureAdapter();
+
+        ContactEntryListAdapter adapter = getAdapter();
+
+        // If "Create new contact" is shown, don't display the empty list UI
+        adapter.setEmptyListEnabled(!isCreateContactEnabled());
+    }
+
+    @Override
+    protected View inflateView(LayoutInflater inflater, ViewGroup container) {
+        return inflater.inflate(R.layout.contact_picker_content, null);
+    }
+
+    @Override
+    protected void prepareEmptyView() {
+        if (isSearchMode()) {
+            return;
+        } else if (isSyncActive()) {
+            if (mShortcutRequested) {
+                // Help text is the same no matter whether there is SIM or not.
+                setEmptyText(R.string.noContactsHelpTextWithSyncForCreateShortcut);
+            } else if (hasIccCard()) {
+                setEmptyText(R.string.noContactsHelpTextWithSync);
+            } else {
+                setEmptyText(R.string.noContactsNoSimHelpTextWithSync);
+            }
+        } else {
+            if (mShortcutRequested) {
+                // Help text is the same no matter whether there is SIM or not.
+                setEmptyText(R.string.noContactsHelpTextWithSyncForCreateShortcut);
+            } else if (hasIccCard()) {
+                setEmptyText(R.string.noContactsHelpText);
+            } else {
+                setEmptyText(R.string.noContactsNoSimHelpText);
+            }
+        }
+    }
+
+    public void onShortcutIntentCreated(Uri uri, Intent shortcutIntent) {
+        mListener.onShortcutIntentCreated(shortcutIntent);
+    }
+
+    @Override
+    public void startSearch(String initialQuery) {
+        ContactsSearchManager.startSearchForResult(getActivity(), initialQuery,
+                ACTIVITY_REQUEST_CODE_PICKER, getContactsRequest());
+    }
+
+    @Override
+    public void onPickerResult(Intent data) {
+        mListener.onPickContactAction(data.getData());
+    }
+}
diff --git a/src/com/android/contacts/list/ContactsIntentResolver.java b/src/com/android/contacts/list/ContactsIntentResolver.java
new file mode 100644
index 0000000..c0917dd
--- /dev/null
+++ b/src/com/android/contacts/list/ContactsIntentResolver.java
@@ -0,0 +1,196 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import com.android.contacts.CallContactActivity;
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.R;
+
+import android.app.Activity;
+import android.app.SearchManager;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.Contacts.ContactMethods;
+import android.provider.Contacts.People;
+import android.provider.Contacts.Phones;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Intents;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.provider.ContactsContract.Intents.UI;
+import android.text.TextUtils;
+import android.util.Log;
+
+/**
+ * Parses a Contacts intent, extracting all relevant parts and packaging them
+ * as a {@link ContactsRequest} object.
+ */
+@SuppressWarnings("deprecation")
+public class ContactsIntentResolver {
+
+    private static final String TAG = "ContactsIntentResolver";
+
+    private final Activity mContext;
+
+    public ContactsIntentResolver(Activity context) {
+        this.mContext = context;
+    }
+
+    public ContactsRequest resolveIntent(Intent intent) {
+        ContactsRequest request = new ContactsRequest();
+
+        String action = intent.getAction();
+
+        Log.i(TAG, "Called with action: " + action);
+
+        if (UI.LIST_DEFAULT.equals(action) ) {
+            request.setActionCode(ContactsRequest.ACTION_DEFAULT);
+        } else if (UI.LIST_ALL_CONTACTS_ACTION.equals(action)) {
+            request.setActionCode(ContactsRequest.ACTION_ALL_CONTACTS);
+        } else if (UI.LIST_CONTACTS_WITH_PHONES_ACTION.equals(action)) {
+            request.setActionCode(ContactsRequest.ACTION_CONTACTS_WITH_PHONES);
+        } else if (UI.LIST_STARRED_ACTION.equals(action)) {
+            request.setActionCode(ContactsRequest.ACTION_STARRED);
+        } else if (UI.LIST_FREQUENT_ACTION.equals(action)) {
+            request.setActionCode(ContactsRequest.ACTION_FREQUENT);
+        } else if (UI.LIST_STREQUENT_ACTION.equals(action)) {
+            request.setActionCode(ContactsRequest.ACTION_STREQUENT);
+        } else if (UI.LIST_GROUP_ACTION.equals(action)) {
+            request.setActionCode(ContactsRequest.ACTION_GROUP);
+            String groupName = intent.getStringExtra(UI.GROUP_NAME_EXTRA_KEY);
+            if (!TextUtils.isEmpty(groupName)) {
+                request.setGroupName(groupName);
+            } else {
+                Log.e(TAG, "Intent missing a required extra: " + UI.GROUP_NAME_EXTRA_KEY);
+                request.setValid(false);
+            }
+        } else if (Intent.ACTION_PICK.equals(action)) {
+            final String resolvedType = intent.resolveType(mContext);
+            if (Contacts.CONTENT_TYPE.equals(resolvedType)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_CONTACT);
+            } else if (People.CONTENT_TYPE.equals(resolvedType)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_CONTACT);
+                request.setLegacyCompatibilityMode(true);
+            } else if (Phone.CONTENT_TYPE.equals(resolvedType)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_PHONE);
+            } else if (Phones.CONTENT_TYPE.equals(resolvedType)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_PHONE);
+                request.setLegacyCompatibilityMode(true);
+            } else if (StructuredPostal.CONTENT_TYPE.equals(resolvedType)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_POSTAL);
+            } else if (ContactMethods.CONTENT_POSTAL_TYPE.equals(resolvedType)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_POSTAL);
+                request.setLegacyCompatibilityMode(true);
+            }
+        } else if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) {
+            String component = intent.getComponent().getClassName();
+            if (component.equals("alias.DialShortcut")) {
+                request.setActionCode(ContactsRequest.ACTION_CREATE_SHORTCUT_CALL);
+            } else if (component.equals("alias.MessageShortcut")) {
+                request.setActionCode(ContactsRequest.ACTION_CREATE_SHORTCUT_SMS);
+            } else {
+                request.setActionCode(ContactsRequest.ACTION_CREATE_SHORTCUT_CONTACT);
+            }
+        } else if (Intent.ACTION_GET_CONTENT.equals(action)) {
+            String type = intent.getType();
+            if (Contacts.CONTENT_ITEM_TYPE.equals(type)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT);
+            } else if (Phone.CONTENT_ITEM_TYPE.equals(type)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_PHONE);
+            } else if (Phones.CONTENT_ITEM_TYPE.equals(type)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_PHONE);
+                request.setLegacyCompatibilityMode(true);
+            } else if (StructuredPostal.CONTENT_ITEM_TYPE.equals(type)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_POSTAL);
+            } else if (ContactMethods.CONTENT_POSTAL_ITEM_TYPE.equals(type)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_POSTAL);
+                request.setLegacyCompatibilityMode(true);
+            }  else if (People.CONTENT_ITEM_TYPE.equals(type)) {
+                request.setActionCode(ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT);
+                request.setLegacyCompatibilityMode(true);
+            }
+        } else if (Intent.ACTION_INSERT_OR_EDIT.equals(action)) {
+            request.setActionCode(ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT);
+        } else if (Intent.ACTION_SEARCH.equals(action)) {
+            // See if the suggestion was clicked with a search action key (call button)
+            if ("call".equals(intent.getStringExtra(SearchManager.ACTION_MSG))) {
+                String query = intent.getStringExtra(SearchManager.QUERY);
+                if (!TextUtils.isEmpty(query)) {
+                    Intent newIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
+                            Uri.fromParts("tel", query, null));
+                    request.setRedirectIntent(newIntent);
+                }
+            } else {
+                request.setQueryString(intent.getStringExtra(SearchManager.QUERY));
+                request.setSearchMode(true);
+            }
+        } else if (UI.FILTER_CONTACTS_ACTION.equals(action)) {
+            // When we get a FILTER_CONTACTS_ACTION, it represents search in the context
+            // of some other action. Let's retrieve the original action to provide proper
+            // context for the search queries.
+            request.setActionCode(ContactsRequest.ACTION_DEFAULT);
+            Bundle extras = intent.getExtras();
+            if (extras != null) {
+                request.setQueryString(extras.getString(UI.FILTER_TEXT_EXTRA_KEY));
+
+                ContactsRequest originalRequest =
+                        (ContactsRequest)extras.get(ContactsSearchManager.ORIGINAL_REQUEST_KEY);
+                if (originalRequest != null) {
+                    request.copyFrom(originalRequest);
+                }
+            }
+
+            if (request == null) {
+                request = new ContactsRequest();
+            }
+
+            request.setSearchMode(true);
+
+        // Since this is the filter activity it receives all intents
+        // dispatched from the SearchManager for security reasons
+        // so we need to re-dispatch from here to the intended target.
+        } else if (Intents.SEARCH_SUGGESTION_CLICKED.equals(action)) {
+            Uri data = intent.getData();
+            // See if the suggestion was clicked with a search action key (call button)
+            if ("call".equals(intent.getStringExtra(SearchManager.ACTION_MSG))) {
+                Intent newIntent = new Intent(mContext, CallContactActivity.class);
+                newIntent.setData(data);
+                request.setRedirectIntent(newIntent);
+            } else {
+                request.setActionCode(ContactsRequest.ACTION_VIEW_CONTACT);
+                request.setContactUri(data);
+            }
+        } else if (Intents.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED.equals(action)) {
+            request.setRedirectIntent(new Intent(Intent.ACTION_CALL_PRIVILEGED, intent.getData()));
+        } else if (Intents.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED.equals(action)) {
+            // TODO actually support this in EditContactActivity.
+            String number = intent.getData().getSchemeSpecificPart();
+            Intent newIntent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+            newIntent.putExtra(Intents.Insert.PHONE, number);
+            request.setRedirectIntent(newIntent);
+
+        }
+        // Allow the title to be set to a custom String using an extra on the intent
+        String title = intent.getStringExtra(UI.TITLE_EXTRA_KEY);
+        if (title != null) {
+            request.setActivityTitle(title);
+        }
+
+        return request;
+    }
+}
diff --git a/src/com/android/contacts/list/ContactsRequest.java b/src/com/android/contacts/list/ContactsRequest.java
new file mode 100644
index 0000000..aefa451
--- /dev/null
+++ b/src/com/android/contacts/list/ContactsRequest.java
@@ -0,0 +1,227 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Parsed form of the intent sent to the Contacts application.
+ */
+public class ContactsRequest implements Parcelable {
+
+    /** Default mode: browse contacts */
+    public static final int ACTION_DEFAULT = 10;
+
+    /** Show all contacts */
+    public static final int ACTION_ALL_CONTACTS = 15;
+
+    /** Show all contacts with phone numbers */
+    public static final int ACTION_CONTACTS_WITH_PHONES = 17;
+
+    /** Show contents of a specific group */
+    public static final int ACTION_GROUP = 20;
+
+    /** Show all starred contacts */
+    public static final int ACTION_STARRED = 30;
+
+    /** Show frequently contacted contacts */
+    public static final int ACTION_FREQUENT = 40;
+
+    /** Show starred and the frequent */
+    public static final int ACTION_STREQUENT = 50;
+
+    /** Show all contacts and pick them when clicking */
+    public static final int ACTION_PICK_CONTACT = 60;
+
+    /** Show all contacts as well as the option to create a new one */
+    public static final int ACTION_PICK_OR_CREATE_CONTACT = 70;
+
+    /** Show all contacts and pick them for edit when clicking, and allow creating a new contact */
+    public static final int ACTION_INSERT_OR_EDIT_CONTACT = 80;
+
+    /** Show all phone numbers and pick them when clicking */
+    public static final int ACTION_PICK_PHONE = 90;
+
+    /** Show all postal addresses and pick them when clicking */
+    public static final int ACTION_PICK_POSTAL = 100;
+
+    /** Show all contacts and create a shortcut for the picked contact */
+    public static final int ACTION_CREATE_SHORTCUT_CONTACT = 110;
+
+    /** Show all phone numbers and create a call shortcut for the picked number */
+    public static final int ACTION_CREATE_SHORTCUT_CALL = 120;
+
+    /** Show all phone numbers and create an SMS shortcut for the picked number */
+    public static final int ACTION_CREATE_SHORTCUT_SMS = 130;
+
+    /** Show all contacts and activate the specified one */
+    public static final int ACTION_VIEW_CONTACT = 140;
+
+    private boolean mValid = true;
+    private int mActionCode = ACTION_DEFAULT;
+    private Intent mRedirectIntent;
+    private CharSequence mTitle;
+    private boolean mSearchMode;
+    private String mQueryString;
+    private String mGroupName;
+    private boolean mLegacyCompatibilityMode;
+    private boolean mDirectorySearchEnabled = true;
+    private Uri mContactUri;
+
+    /**
+     * Copies all fields.
+     */
+    public void copyFrom(ContactsRequest request) {
+        mValid = request.mValid;
+        mActionCode = request.mActionCode;
+        mRedirectIntent = request.mRedirectIntent;
+        mTitle = request.mTitle;
+        mSearchMode = request.mSearchMode;
+        mQueryString = request.mQueryString;
+        mGroupName = request.mGroupName;
+        mLegacyCompatibilityMode = request.mLegacyCompatibilityMode;
+        mDirectorySearchEnabled = request.mDirectorySearchEnabled;
+        mContactUri = request.mContactUri;
+    }
+
+    public static Parcelable.Creator<ContactsRequest> CREATOR = new Creator<ContactsRequest>() {
+
+        public ContactsRequest[] newArray(int size) {
+            return new ContactsRequest[size];
+        }
+
+        public ContactsRequest createFromParcel(Parcel source) {
+            ClassLoader classLoader = this.getClass().getClassLoader();
+            ContactsRequest request = new ContactsRequest();
+            request.mValid = source.readInt() != 0;
+            request.mActionCode = source.readInt();
+            request.mRedirectIntent = source.readParcelable(classLoader);
+            request.mTitle = source.readCharSequence();
+            request.mSearchMode = source.readInt() != 0;
+            request.mQueryString = source.readString();
+            request.mGroupName = source.readString();
+            request.mLegacyCompatibilityMode  = source.readInt() != 0;
+            request.mDirectorySearchEnabled = source.readInt() != 0;
+            request.mContactUri = source.readParcelable(classLoader);
+            return request;
+        }
+    };
+
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeInt(mValid ? 1 : 0);
+        dest.writeInt(mActionCode);
+        dest.writeParcelable(mRedirectIntent, 0);
+        dest.writeCharSequence(mTitle);
+        dest.writeInt(mSearchMode ? 1 : 0);
+        dest.writeString(mQueryString);
+        dest.writeString(mGroupName);
+        dest.writeInt(mLegacyCompatibilityMode ? 1 : 0);
+        dest.writeInt(mDirectorySearchEnabled ? 1 : 0);
+        dest.writeParcelable(mContactUri, 0);
+    }
+
+    public int describeContents() {
+        return 0;
+    }
+
+    public boolean isValid() {
+        return mValid;
+    }
+
+    public void setValid(boolean flag) {
+        mValid = flag;
+    }
+
+    public Intent getRedirectIntent() {
+        return mRedirectIntent;
+    }
+
+    public void setRedirectIntent(Intent intent) {
+        mRedirectIntent = intent;
+    }
+
+    public void setActivityTitle(CharSequence title) {
+        mTitle = title;
+    }
+
+    public CharSequence getActivityTitle() {
+        return mTitle;
+    }
+
+    public int getActionCode() {
+        return mActionCode;
+    }
+
+    public void setActionCode(int actionCode) {
+        mActionCode = actionCode;
+    }
+
+    public boolean isSearchMode() {
+        return mSearchMode;
+    }
+
+    public void setSearchMode(boolean flag) {
+        mSearchMode = flag;
+    }
+
+    public String getQueryString() {
+        return mQueryString;
+    }
+
+    public void setQueryString(String string) {
+        mQueryString = string;
+    }
+
+    public String getGroupName() {
+        return mGroupName;
+    }
+
+    public void setGroupName(String groupName) {
+        mGroupName = groupName;
+    }
+
+    public boolean isLegacyCompatibilityMode() {
+        return mLegacyCompatibilityMode;
+    }
+
+    public void setLegacyCompatibilityMode(boolean flag) {
+        mLegacyCompatibilityMode = flag;
+    }
+
+    /**
+     * Determines whether this search request should include directories or
+     * is limited to local contacts only.
+     */
+    public boolean isDirectorySearchEnabled() {
+        return mDirectorySearchEnabled;
+    }
+
+    public void setDirectorySearchEnabled(boolean flag) {
+        mDirectorySearchEnabled = flag;
+    }
+
+    public Uri getContactUri() {
+        return mContactUri;
+    }
+
+    public void setContactUri(Uri contactUri) {
+        this.mContactUri = contactUri;
+    }
+}
diff --git a/src/com/android/contacts/list/ContactsSectionIndexer.java b/src/com/android/contacts/list/ContactsSectionIndexer.java
new file mode 100644
index 0000000..a80d1de
--- /dev/null
+++ b/src/com/android/contacts/list/ContactsSectionIndexer.java
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import android.widget.SectionIndexer;
+
+import java.util.Arrays;
+
+/**
+ * A section indexer that is configured with precomputed section titles and
+ * their respective counts.
+ */
+public class ContactsSectionIndexer implements SectionIndexer {
+
+    private final String[] mSections;
+    private final int[] mPositions;
+    private final int mCount;
+
+    /**
+     * Constructor.
+     *
+     * @param sections a non-null array
+     * @param counts a non-null array of the same size as <code>sections</code>
+     */
+    public ContactsSectionIndexer(String[] sections, int[] counts) {
+        if (sections == null || counts == null) {
+            throw new NullPointerException();
+        }
+
+        if (sections.length != counts.length) {
+            throw new IllegalArgumentException(
+                    "The sections and counts arrays must have the same length");
+        }
+
+        // TODO process sections/counts based on current locale and/or specific section titles
+
+        this.mSections = sections;
+        mPositions = new int[counts.length];
+        int position = 0;
+        for (int i = 0; i < counts.length; i++) {
+            if (mSections[i] == null) {
+                mSections[i] = " ";
+            } else {
+                mSections[i] = mSections[i].trim();
+            }
+
+            mPositions[i] = position;
+            position += counts[i];
+        }
+        mCount = position;
+    }
+
+    public Object[] getSections() {
+        return mSections;
+    }
+
+    public int getPositionForSection(int section) {
+        if (section < 0 || section >= mSections.length) {
+            return -1;
+        }
+
+        return mPositions[section];
+    }
+
+    public int getSectionForPosition(int position) {
+        if (position < 0 || position >= mCount) {
+            return -1;
+        }
+
+        int index = Arrays.binarySearch(mPositions, position);
+
+        /*
+         * Consider this example: section positions are 0, 3, 5; the supplied
+         * position is 4. The section corresponding to position 4 starts at
+         * position 3, so the expected return value is 1. Binary search will not
+         * find 4 in the array and thus will return -insertPosition-1, i.e. -3.
+         * To get from that number to the expected value of 1 we need to negate
+         * and subtract 2.
+         */
+        return index >= 0 ? index : -index - 2;
+    }
+}
diff --git a/src/com/android/contacts/list/CustomContactListFilterActivity.java b/src/com/android/contacts/list/CustomContactListFilterActivity.java
new file mode 100644
index 0000000..6221d08
--- /dev/null
+++ b/src/com/android/contacts/list/CustomContactListFilterActivity.java
@@ -0,0 +1,910 @@
+/*
+ * Copyright (C) 2009 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.contacts.list;
+
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.android.contacts.model.GoogleAccountType;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.preference.ContactsPreferences;
+import com.android.contacts.util.EmptyService;
+import com.android.contacts.util.LocalizedNameResolver;
+import com.android.contacts.util.WeakAsyncTask;
+import com.google.android.collect.Lists;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.ExpandableListActivity;
+import android.app.ProgressDialog;
+import android.content.ContentProviderOperation;
+import android.content.ContentProviderOperation.Builder;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.EntityIterator;
+import android.content.Intent;
+import android.content.OperationApplicationException;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.preference.PreferenceManager;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Groups;
+import android.provider.ContactsContract.Settings;
+import android.util.Log;
+import android.view.ContextMenu;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.MenuItem.OnMenuItemClickListener;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseExpandableListAdapter;
+import android.widget.CheckBox;
+import android.widget.ExpandableListAdapter;
+import android.widget.ExpandableListView;
+import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
+import android.widget.TextView;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+
+/**
+ * Shows a list of all available {@link Groups} available, letting the user
+ * select which ones they want to be visible.
+ */
+public final class CustomContactListFilterActivity extends ExpandableListActivity implements
+        AdapterView.OnItemClickListener, View.OnClickListener {
+
+    private static final String TAG = "CustomContactListFilterActivity";
+
+    private ExpandableListView mList;
+    private DisplayAdapter mAdapter;
+
+    private SharedPreferences mPrefs;
+
+    private CheckBox mDisplayPhones;
+
+    private View mHeaderPhones;
+    private View mHeaderSeparator;
+
+    @Override
+    protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        setContentView(R.layout.contact_list_filter_custom);
+
+        mList = getExpandableListView();
+        mList.setHeaderDividersEnabled(true);
+        mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
+        mAdapter = new DisplayAdapter(this);
+
+        final LayoutInflater inflater = getLayoutInflater();
+
+        createWithPhonesOnlyPreferenceView(inflater);
+        createDisplayGroupHeader(inflater);
+
+        findViewById(R.id.btn_done).setOnClickListener(this);
+        findViewById(R.id.btn_discard).setOnClickListener(this);
+
+        // Catch clicks on the header views
+        mList.setOnItemClickListener(this);
+        mList.setOnCreateContextMenuListener(this);
+    }
+
+    private void createWithPhonesOnlyPreferenceView(LayoutInflater inflater) {
+        // Add the "Only contacts with phones" header modifier.
+        mHeaderPhones = inflater.inflate(R.layout.contact_list_filter_phones_only, mList, false);
+        mHeaderPhones.setId(R.id.header_phones);
+        mDisplayPhones = (CheckBox) mHeaderPhones.findViewById(android.R.id.checkbox);
+        mDisplayPhones.setChecked(mPrefs.getBoolean(ContactsPreferences.PREF_DISPLAY_ONLY_PHONES,
+                ContactsPreferences.PREF_DISPLAY_ONLY_PHONES_DEFAULT));
+        final TextView text1 = (TextView) mHeaderPhones.findViewById(android.R.id.text1);
+        text1.setText(R.string.showFilterPhones);
+        final TextView text2 = (TextView) mHeaderPhones.findViewById(android.R.id.text2);
+        text2.setText(R.string.showFilterPhonesDescrip);
+    }
+
+    private void createDisplayGroupHeader(LayoutInflater inflater) {
+        // Add the separator before showing the detailed group list.
+        mHeaderSeparator = inflater.inflate(R.layout.list_separator, mList, false);
+        final TextView text1 = (TextView) mHeaderSeparator;
+        text1.setText(R.string.headerContactGroups);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        mList.removeHeaderView(mHeaderPhones);
+        mList.removeHeaderView(mHeaderSeparator);
+
+        // List adapter needs to be reset, because header views cannot be added
+        // to a list with an existing adapter.
+        setListAdapter(null);
+
+        mList.addHeaderView(mHeaderPhones, null, true);
+        mList.addHeaderView(mHeaderSeparator, null, false);
+
+        setListAdapter(mAdapter);
+
+        // Start background query to find account details
+        new QueryGroupsTask(this).execute();
+    }
+
+    /**
+     * Background operation to build set of {@link AccountDisplay} for each
+     * {@link AccountTypes#getAccounts(boolean)} that provides groups.
+     */
+    private static class QueryGroupsTask extends
+            WeakAsyncTask<Void, Void, AccountSet, CustomContactListFilterActivity> {
+        public QueryGroupsTask(CustomContactListFilterActivity target) {
+            super(target);
+        }
+
+        @Override
+        protected AccountSet doInBackground(CustomContactListFilterActivity target,
+                Void... params) {
+            final Context context = target;
+            final AccountTypes sources = AccountTypes.getInstance(context);
+            final ContentResolver resolver = context.getContentResolver();
+
+            // Inflate groups entry for each account
+            final AccountSet accounts = new AccountSet();
+            for (Account account : sources.getAccounts(false)) {
+                accounts.add(new AccountDisplay(resolver, account.name, account.type));
+            }
+
+            return accounts;
+        }
+
+        @Override
+        protected void onPostExecute(CustomContactListFilterActivity target, AccountSet result) {
+            target.mAdapter.setAccounts(result);
+        }
+    }
+
+    private static final int DEFAULT_SHOULD_SYNC = 1;
+    private static final int DEFAULT_VISIBLE = 0;
+
+    /**
+     * Entry holding any changes to {@link Groups} or {@link Settings} rows,
+     * such as {@link Groups#SHOULD_SYNC} or {@link Groups#GROUP_VISIBLE}.
+     */
+    protected static class GroupDelta extends ValuesDelta {
+        private boolean mUngrouped = false;
+        private boolean mAccountHasGroups;
+
+        private GroupDelta() {
+            super();
+        }
+
+        /**
+         * Build {@link GroupDelta} from the {@link Settings} row for the given
+         * {@link Settings#ACCOUNT_NAME} and {@link Settings#ACCOUNT_TYPE}.
+         */
+        public static GroupDelta fromSettings(ContentResolver resolver, String accountName,
+                String accountType, boolean accountHasGroups) {
+            final Uri settingsUri = Settings.CONTENT_URI.buildUpon()
+                    .appendQueryParameter(Settings.ACCOUNT_NAME, accountName)
+                    .appendQueryParameter(Settings.ACCOUNT_TYPE, accountType).build();
+            final Cursor cursor = resolver.query(settingsUri, new String[] {
+                    Settings.SHOULD_SYNC, Settings.UNGROUPED_VISIBLE
+            }, null, null, null);
+
+            try {
+                final ContentValues values = new ContentValues();
+                values.put(Settings.ACCOUNT_NAME, accountName);
+                values.put(Settings.ACCOUNT_TYPE, accountType);
+
+                if (cursor != null && cursor.moveToFirst()) {
+                    // Read existing values when present
+                    values.put(Settings.SHOULD_SYNC, cursor.getInt(0));
+                    values.put(Settings.UNGROUPED_VISIBLE, cursor.getInt(1));
+                    return fromBefore(values).setUngrouped(accountHasGroups);
+                } else {
+                    // Nothing found, so treat as create
+                    values.put(Settings.SHOULD_SYNC, DEFAULT_SHOULD_SYNC);
+                    values.put(Settings.UNGROUPED_VISIBLE, DEFAULT_VISIBLE);
+                    return fromAfter(values).setUngrouped(accountHasGroups);
+                }
+            } finally {
+                if (cursor != null) cursor.close();
+            }
+        }
+
+        public static GroupDelta fromBefore(ContentValues before) {
+            final GroupDelta entry = new GroupDelta();
+            entry.mBefore = before;
+            entry.mAfter = new ContentValues();
+            return entry;
+        }
+
+        public static GroupDelta fromAfter(ContentValues after) {
+            final GroupDelta entry = new GroupDelta();
+            entry.mBefore = null;
+            entry.mAfter = after;
+            return entry;
+        }
+
+        protected GroupDelta setUngrouped(boolean accountHasGroups) {
+            mUngrouped = true;
+            mAccountHasGroups = accountHasGroups;
+            return this;
+        }
+
+        @Override
+        public boolean beforeExists() {
+            return mBefore != null;
+        }
+
+        public boolean getShouldSync() {
+            return getAsInteger(mUngrouped ? Settings.SHOULD_SYNC : Groups.SHOULD_SYNC,
+                    DEFAULT_SHOULD_SYNC) != 0;
+        }
+
+        public boolean getVisible() {
+            return getAsInteger(mUngrouped ? Settings.UNGROUPED_VISIBLE : Groups.GROUP_VISIBLE,
+                    DEFAULT_VISIBLE) != 0;
+        }
+
+        public void putShouldSync(boolean shouldSync) {
+            put(mUngrouped ? Settings.SHOULD_SYNC : Groups.SHOULD_SYNC, shouldSync ? 1 : 0);
+        }
+
+        public void putVisible(boolean visible) {
+            put(mUngrouped ? Settings.UNGROUPED_VISIBLE : Groups.GROUP_VISIBLE, visible ? 1 : 0);
+        }
+
+        private String getAccountType() {
+            return (mBefore == null ? mAfter : mBefore).getAsString(Settings.ACCOUNT_TYPE);
+        }
+
+        public CharSequence getTitle(Context context) {
+            if (mUngrouped) {
+                final String customAllContactsName =
+                        LocalizedNameResolver.getAllContactsName(context, getAccountType());
+                if (customAllContactsName != null) {
+                    return customAllContactsName;
+                }
+                if (mAccountHasGroups) {
+                    return context.getText(R.string.display_ungrouped);
+                } else {
+                    return context.getText(R.string.display_all_contacts);
+                }
+            } else {
+                final Integer titleRes = getAsInteger(Groups.TITLE_RES);
+                if (titleRes != null) {
+                    final String packageName = getAsString(Groups.RES_PACKAGE);
+                    return context.getPackageManager().getText(packageName, titleRes, null);
+                } else {
+                    return getAsString(Groups.TITLE);
+                }
+            }
+        }
+
+        /**
+         * Build a possible {@link ContentProviderOperation} to persist any
+         * changes to the {@link Groups} or {@link Settings} row described by
+         * this {@link GroupDelta}.
+         */
+        public ContentProviderOperation buildDiff() {
+            if (isNoop()) {
+                return null;
+            } else if (isUpdate()) {
+                // When has changes and "before" exists, then "update"
+                final Builder builder = ContentProviderOperation.newUpdate(
+                        mUngrouped
+                                ? Settings.CONTENT_URI
+                                : addCallerIsSyncAdapterParameter(Groups.CONTENT_URI));
+                if (mUngrouped) {
+                    builder.withSelection(Settings.ACCOUNT_NAME + "=? AND " + Settings.ACCOUNT_TYPE
+                            + "=?", new String[] {
+                            this.getAsString(Settings.ACCOUNT_NAME),
+                            this.getAsString(Settings.ACCOUNT_TYPE)
+                    });
+                } else {
+                    builder.withSelection(Groups._ID + "=" + this.getId(), null);
+                }
+                builder.withValues(mAfter);
+                return builder.build();
+            } else if (isInsert() && mUngrouped) {
+                // Only allow inserts for Settings
+                mAfter.remove(mIdColumn);
+                final Builder builder = ContentProviderOperation.newInsert(Settings.CONTENT_URI);
+                builder.withValues(mAfter);
+                return builder.build();
+            } else {
+                throw new IllegalStateException("Unexpected delete or insert");
+            }
+        }
+    }
+
+    private static Uri addCallerIsSyncAdapterParameter(Uri uri) {
+        return uri.buildUpon()
+            .appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
+            .build();
+    }
+
+    /**
+     * {@link Comparator} to sort by {@link Groups#_ID}.
+     */
+    private static Comparator<GroupDelta> sIdComparator = new Comparator<GroupDelta>() {
+        public int compare(GroupDelta object1, GroupDelta object2) {
+            final Long id1 = object1.getId();
+            final Long id2 = object2.getId();
+            if (id1 == null && id2 == null) {
+                return 0;
+            } else if (id1 == null) {
+                return -1;
+            } else if (id2 == null) {
+                return 1;
+            } else if (id1 < id2) {
+                return -1;
+            } else if (id1 > id2) {
+                return 1;
+            } else {
+                return 0;
+            }
+        }
+    };
+
+    /**
+     * Set of all {@link AccountDisplay} entries, one for each source.
+     */
+    protected static class AccountSet extends ArrayList<AccountDisplay> {
+        public ArrayList<ContentProviderOperation> buildDiff() {
+            final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
+            for (AccountDisplay account : this) {
+                account.buildDiff(diff);
+            }
+            return diff;
+        }
+    }
+
+    /**
+     * {@link GroupDelta} details for a single {@link Account}, usually shown as
+     * children under a single expandable group.
+     */
+    protected static class AccountDisplay {
+        public String mName;
+        public String mType;
+
+        public GroupDelta mUngrouped;
+        public ArrayList<GroupDelta> mSyncedGroups = Lists.newArrayList();
+        public ArrayList<GroupDelta> mUnsyncedGroups = Lists.newArrayList();
+
+        /**
+         * Build an {@link AccountDisplay} covering all {@link Groups} under the
+         * given {@link Account}.
+         */
+        public AccountDisplay(ContentResolver resolver, String accountName, String accountType) {
+            mName = accountName;
+            mType = accountType;
+
+            final Uri groupsUri = Groups.CONTENT_URI.buildUpon()
+                    .appendQueryParameter(Groups.ACCOUNT_NAME, accountName)
+                    .appendQueryParameter(Groups.ACCOUNT_TYPE, accountType).build();
+            EntityIterator iterator = ContactsContract.Groups.newEntityIterator(resolver.query(
+                    groupsUri, null, null, null, null));
+            try {
+                boolean hasGroups = false;
+
+                // Create entries for each known group
+                while (iterator.hasNext()) {
+                    final ContentValues values = iterator.next().getEntityValues();
+                    final GroupDelta group = GroupDelta.fromBefore(values);
+                    addGroup(group);
+                    hasGroups = true;
+                }
+                // Create single entry handling ungrouped status
+                mUngrouped = GroupDelta.fromSettings(resolver, accountName, accountType, hasGroups);
+                addGroup(mUngrouped);
+            } finally {
+                iterator.close();
+            }
+        }
+
+        /**
+         * Add the given {@link GroupDelta} internally, filing based on its
+         * {@link GroupDelta#getShouldSync()} status.
+         */
+        private void addGroup(GroupDelta group) {
+            if (group.getShouldSync()) {
+                mSyncedGroups.add(group);
+            } else {
+                mUnsyncedGroups.add(group);
+            }
+        }
+
+        /**
+         * Set the {@link GroupDelta#putShouldSync(boolean)} value for all
+         * children {@link GroupDelta} rows.
+         */
+        public void setShouldSync(boolean shouldSync) {
+            final Iterator<GroupDelta> oppositeChildren = shouldSync ?
+                    mUnsyncedGroups.iterator() : mSyncedGroups.iterator();
+            while (oppositeChildren.hasNext()) {
+                final GroupDelta child = oppositeChildren.next();
+                setShouldSync(child, shouldSync, false);
+                oppositeChildren.remove();
+            }
+        }
+
+        public void setShouldSync(GroupDelta child, boolean shouldSync) {
+            setShouldSync(child, shouldSync, true);
+        }
+
+        /**
+         * Set {@link GroupDelta#putShouldSync(boolean)}, and file internally
+         * based on updated state.
+         */
+        public void setShouldSync(GroupDelta child, boolean shouldSync, boolean attemptRemove) {
+            child.putShouldSync(shouldSync);
+            if (shouldSync) {
+                if (attemptRemove) {
+                    mUnsyncedGroups.remove(child);
+                }
+                mSyncedGroups.add(child);
+                Collections.sort(mSyncedGroups, sIdComparator);
+            } else {
+                if (attemptRemove) {
+                    mSyncedGroups.remove(child);
+                }
+                mUnsyncedGroups.add(child);
+            }
+        }
+
+        /**
+         * Build set of {@link ContentProviderOperation} to persist any user
+         * changes to {@link GroupDelta} rows under this {@link Account}.
+         */
+        public void buildDiff(ArrayList<ContentProviderOperation> diff) {
+            for (GroupDelta group : mSyncedGroups) {
+                final ContentProviderOperation oper = group.buildDiff();
+                if (oper != null) diff.add(oper);
+            }
+            for (GroupDelta group : mUnsyncedGroups) {
+                final ContentProviderOperation oper = group.buildDiff();
+                if (oper != null) diff.add(oper);
+            }
+        }
+    }
+
+    /**
+     * {@link ExpandableListAdapter} that shows {@link GroupDelta} settings,
+     * grouped by {@link Account} source. Shows footer row when any groups are
+     * unsynced, as determined through {@link AccountDisplay#mUnsyncedGroups}.
+     */
+    protected static class DisplayAdapter extends BaseExpandableListAdapter {
+        private Context mContext;
+        private LayoutInflater mInflater;
+        private AccountTypes mSources;
+        private AccountSet mAccounts;
+
+        private boolean mChildWithPhones = false;
+
+        public DisplayAdapter(Context context) {
+            mContext = context;
+            mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            mSources = AccountTypes.getInstance(context);
+        }
+
+        public void setAccounts(AccountSet accounts) {
+            mAccounts = accounts;
+            notifyDataSetChanged();
+        }
+
+        /**
+         * In group descriptions, show the number of contacts with phone
+         * numbers, in addition to the total contacts.
+         */
+        public void setChildDescripWithPhones(boolean withPhones) {
+            mChildWithPhones = withPhones;
+        }
+
+        /** {@inheritDoc} */
+        public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
+                View convertView, ViewGroup parent) {
+            if (convertView == null) {
+                convertView = mInflater.inflate(R.layout.display_child, parent, false);
+            }
+
+            final TextView text1 = (TextView)convertView.findViewById(android.R.id.text1);
+            final TextView text2 = (TextView)convertView.findViewById(android.R.id.text2);
+            final CheckBox checkbox = (CheckBox)convertView.findViewById(android.R.id.checkbox);
+
+            final AccountDisplay account = mAccounts.get(groupPosition);
+            final GroupDelta child = (GroupDelta)this.getChild(groupPosition, childPosition);
+            if (child != null) {
+                // Handle normal group, with title and checkbox
+                final boolean groupVisible = child.getVisible();
+                checkbox.setVisibility(View.VISIBLE);
+                checkbox.setChecked(groupVisible);
+
+                final CharSequence groupTitle = child.getTitle(mContext);
+                text1.setText(groupTitle);
+                text2.setVisibility(View.GONE);
+            } else {
+                // When unknown child, this is "more" footer view
+                checkbox.setVisibility(View.GONE);
+                text1.setText(R.string.display_more_groups);
+                text2.setVisibility(View.GONE);
+            }
+
+            return convertView;
+        }
+
+        /** {@inheritDoc} */
+        public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
+                ViewGroup parent) {
+            if (convertView == null) {
+                convertView = mInflater.inflate(R.layout.display_group, parent, false);
+            }
+
+            final TextView text1 = (TextView)convertView.findViewById(android.R.id.text1);
+            final TextView text2 = (TextView)convertView.findViewById(android.R.id.text2);
+
+            final AccountDisplay account = (AccountDisplay)this.getGroup(groupPosition);
+
+            final BaseAccountType source = mSources.getInflatedSource(account.mType,
+                    BaseAccountType.LEVEL_SUMMARY);
+
+            text1.setText(account.mName);
+            text2.setText(source.getDisplayLabel(mContext));
+            text2.setVisibility(account.mName == null ? View.GONE : View.VISIBLE);
+
+            return convertView;
+        }
+
+        /** {@inheritDoc} */
+        public Object getChild(int groupPosition, int childPosition) {
+            final AccountDisplay account = mAccounts.get(groupPosition);
+            final boolean validChild = childPosition >= 0
+                    && childPosition < account.mSyncedGroups.size();
+            if (validChild) {
+                return account.mSyncedGroups.get(childPosition);
+            } else {
+                return null;
+            }
+        }
+
+        /** {@inheritDoc} */
+        public long getChildId(int groupPosition, int childPosition) {
+            final GroupDelta child = (GroupDelta)getChild(groupPosition, childPosition);
+            if (child != null) {
+                final Long childId = child.getId();
+                return childId != null ? childId : Long.MIN_VALUE;
+            } else {
+                return Long.MIN_VALUE;
+            }
+        }
+
+        /** {@inheritDoc} */
+        public int getChildrenCount(int groupPosition) {
+            // Count is any synced groups, plus possible footer
+            final AccountDisplay account = mAccounts.get(groupPosition);
+            final boolean anyHidden = account.mUnsyncedGroups.size() > 0;
+            return account.mSyncedGroups.size() + (anyHidden ? 1 : 0);
+        }
+
+        /** {@inheritDoc} */
+        public Object getGroup(int groupPosition) {
+            return mAccounts.get(groupPosition);
+        }
+
+        /** {@inheritDoc} */
+        public int getGroupCount() {
+            if (mAccounts == null) {
+                return 0;
+            }
+            return mAccounts.size();
+        }
+
+        /** {@inheritDoc} */
+        public long getGroupId(int groupPosition) {
+            return groupPosition;
+        }
+
+        /** {@inheritDoc} */
+        public boolean hasStableIds() {
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        public boolean isChildSelectable(int groupPosition, int childPosition) {
+            return true;
+        }
+    }
+
+    /**
+     * Handle any clicks on header views added to our {@link #mAdapter}, which
+     * are usually the global modifier checkboxes.
+     */
+    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+        Log.d(TAG, "OnItemClick, position=" + position + ", id=" + id);
+        if (view == mHeaderPhones) {
+            mDisplayPhones.toggle();
+            return;
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void onClick(View view) {
+        switch (view.getId()) {
+            case R.id.btn_done: {
+                this.doSaveAction();
+                break;
+            }
+            case R.id.btn_discard: {
+                this.finish();
+                break;
+            }
+        }
+    }
+
+    /**
+     * Assign a specific value to {@link ContactsPreferences#PREF_DISPLAY_ONLY_PHONES}, refreshing
+     * the visible list as needed.
+     */
+    protected void setDisplayOnlyPhones(boolean displayOnlyPhones) {
+        mDisplayPhones.setChecked(displayOnlyPhones);
+
+        Editor editor = mPrefs.edit();
+        editor.putBoolean(ContactsPreferences.PREF_DISPLAY_ONLY_PHONES, displayOnlyPhones);
+        editor.apply();
+
+        mAdapter.setChildDescripWithPhones(displayOnlyPhones);
+        mAdapter.notifyDataSetChanged();
+    }
+
+    /**
+     * Handle any clicks on {@link ExpandableListAdapter} children, which
+     * usually mean toggling its visible state.
+     */
+    @Override
+    public boolean onChildClick(ExpandableListView parent, View view, int groupPosition,
+            int childPosition, long id) {
+        final CheckBox checkbox = (CheckBox)view.findViewById(android.R.id.checkbox);
+
+        final AccountDisplay account = (AccountDisplay)mAdapter.getGroup(groupPosition);
+        final GroupDelta child = (GroupDelta)mAdapter.getChild(groupPosition, childPosition);
+        if (child != null) {
+            checkbox.toggle();
+            child.putVisible(checkbox.isChecked());
+        } else {
+            // Open context menu for bringing back unsynced
+            this.openContextMenu(view);
+        }
+        return true;
+    }
+
+    // TODO: move these definitions to framework constants when we begin
+    // defining this mode through <sync-adapter> tags
+    private static final int SYNC_MODE_UNSUPPORTED = 0;
+    private static final int SYNC_MODE_UNGROUPED = 1;
+    private static final int SYNC_MODE_EVERYTHING = 2;
+
+    protected int getSyncMode(AccountDisplay account) {
+        // TODO: read sync mode through <sync-adapter> definition
+        if (GoogleAccountType.ACCOUNT_TYPE.equals(account.mType)) {
+            return SYNC_MODE_EVERYTHING;
+        } else {
+            return SYNC_MODE_UNSUPPORTED;
+        }
+    }
+
+    @Override
+    public void onCreateContextMenu(ContextMenu menu, View view,
+            ContextMenu.ContextMenuInfo menuInfo) {
+        super.onCreateContextMenu(menu, view, menuInfo);
+
+        // Bail if not working with expandable long-press, or if not child
+        if (!(menuInfo instanceof ExpandableListContextMenuInfo)) return;
+
+        final ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
+        final int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);
+        final int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition);
+
+        // Skip long-press on expandable parents
+        if (childPosition == -1) return;
+
+        final AccountDisplay account = (AccountDisplay)mAdapter.getGroup(groupPosition);
+        final GroupDelta child = (GroupDelta)mAdapter.getChild(groupPosition, childPosition);
+
+        // Ignore when selective syncing unsupported
+        final int syncMode = getSyncMode(account);
+        if (syncMode == SYNC_MODE_UNSUPPORTED) return;
+
+        if (child != null) {
+            showRemoveSync(menu, account, child, syncMode);
+        } else {
+            showAddSync(menu, account, syncMode);
+        }
+    }
+
+    protected void showRemoveSync(ContextMenu menu, final AccountDisplay account,
+            final GroupDelta child, final int syncMode) {
+        final CharSequence title = child.getTitle(this);
+
+        menu.setHeaderTitle(title);
+        menu.add(R.string.menu_sync_remove).setOnMenuItemClickListener(
+                new OnMenuItemClickListener() {
+                    public boolean onMenuItemClick(MenuItem item) {
+                        handleRemoveSync(account, child, syncMode, title);
+                        return true;
+                    }
+                });
+    }
+
+    protected void handleRemoveSync(final AccountDisplay account, final GroupDelta child,
+            final int syncMode, CharSequence title) {
+        final boolean shouldSyncUngrouped = account.mUngrouped.getShouldSync();
+        if (syncMode == SYNC_MODE_EVERYTHING && shouldSyncUngrouped
+                && !child.equals(account.mUngrouped)) {
+            // Warn before removing this group when it would cause ungrouped to stop syncing
+            final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+            final CharSequence removeMessage = this.getString(
+                    R.string.display_warn_remove_ungrouped, title);
+            builder.setTitle(R.string.menu_sync_remove);
+            builder.setMessage(removeMessage);
+            builder.setNegativeButton(android.R.string.cancel, null);
+            builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int which) {
+                    // Mark both this group and ungrouped to stop syncing
+                    account.setShouldSync(account.mUngrouped, false);
+                    account.setShouldSync(child, false);
+                    mAdapter.notifyDataSetChanged();
+                }
+            });
+            builder.show();
+        } else {
+            // Mark this group to not sync
+            account.setShouldSync(child, false);
+            mAdapter.notifyDataSetChanged();
+        }
+    }
+
+    protected void showAddSync(ContextMenu menu, final AccountDisplay account, final int syncMode) {
+        menu.setHeaderTitle(R.string.dialog_sync_add);
+
+        // Create item for each available, unsynced group
+        for (final GroupDelta child : account.mUnsyncedGroups) {
+            if (!child.getShouldSync()) {
+                final CharSequence title = child.getTitle(this);
+                menu.add(title).setOnMenuItemClickListener(new OnMenuItemClickListener() {
+                    public boolean onMenuItemClick(MenuItem item) {
+                        // Adding specific group for syncing
+                        if (child.mUngrouped && syncMode == SYNC_MODE_EVERYTHING) {
+                            account.setShouldSync(true);
+                        } else {
+                            account.setShouldSync(child, true);
+                        }
+                        mAdapter.notifyDataSetChanged();
+                        return true;
+                    }
+                });
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void onBackPressed() {
+        doSaveAction();
+    }
+
+    @SuppressWarnings("unchecked")
+    private void doSaveAction() {
+        if (mAdapter == null || mAdapter.mAccounts == null) {
+            finish();
+            return;
+        }
+
+        setDisplayOnlyPhones(mDisplayPhones.isChecked());
+        setResult(RESULT_OK);
+
+        final ArrayList<ContentProviderOperation> diff = mAdapter.mAccounts.buildDiff();
+        if (diff.isEmpty()) {
+            finish();
+            return;
+        }
+
+        new UpdateTask(this).execute(diff);
+    }
+
+    /**
+     * Background task that persists changes to {@link Groups#GROUP_VISIBLE},
+     * showing spinner dialog to user while updating.
+     */
+    public static class UpdateTask extends
+            WeakAsyncTask<ArrayList<ContentProviderOperation>, Void, Void, Activity> {
+        private ProgressDialog mProgress;
+
+        public UpdateTask(Activity target) {
+            super(target);
+        }
+
+        /** {@inheritDoc} */
+        @Override
+        protected void onPreExecute(Activity target) {
+            final Context context = target;
+
+            mProgress = ProgressDialog.show(
+                    context, null, context.getText(R.string.savingDisplayGroups));
+
+            // Before starting this task, start an empty service to protect our
+            // process from being reclaimed by the system.
+            context.startService(new Intent(context, EmptyService.class));
+        }
+
+        /** {@inheritDoc} */
+        @Override
+        protected Void doInBackground(
+                Activity target, ArrayList<ContentProviderOperation>... params) {
+            final Context context = target;
+            final ContentValues values = new ContentValues();
+            final ContentResolver resolver = context.getContentResolver();
+
+            try {
+                final ArrayList<ContentProviderOperation> diff = params[0];
+                resolver.applyBatch(ContactsContract.AUTHORITY, diff);
+            } catch (RemoteException e) {
+                Log.e(TAG, "Problem saving display groups", e);
+            } catch (OperationApplicationException e) {
+                Log.e(TAG, "Problem saving display groups", e);
+            }
+
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override
+        protected void onPostExecute(Activity target, Void result) {
+            final Context context = target;
+
+            try {
+                mProgress.dismiss();
+            } catch (Exception e) {
+                Log.e(TAG, "Error dismissing progress dialog", e);
+            }
+
+            target.finish();
+
+            // Stop the service that was protecting us
+            context.stopService(new Intent(context, EmptyService.class));
+        }
+    }
+
+    @Override
+    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
+            boolean globalSearch) {
+        if (globalSearch) {
+            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+        } else {
+            ContactsSearchManager.startSearch(this, initialQuery);
+        }
+    }
+}
diff --git a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
new file mode 100644
index 0000000..bd43afc
--- /dev/null
+++ b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
@@ -0,0 +1,268 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+
+/**
+ * Fragment containing a contact list used for browsing (as compared to
+ * picking a contact with one of the PICK intents).
+ */
+public class DefaultContactBrowseListFragment extends ContactBrowseListFragment
+        implements ContactListFilterController.ContactListFilterListener {
+
+    private static final String KEY_EDIT_MODE = "editMode";
+    private static final String KEY_CREATE_CONTACT_ENABLED = "createContactEnabled";
+    private static final String KEY_FILTER_ENABLED = "filterEnabled";
+
+    private static final int REQUEST_CODE_CUSTOMIZE_FILTER = 3;
+
+    private boolean mEditMode;
+    private boolean mCreateContactEnabled;
+    private View mCounterHeaderView;
+    private View mSearchHeaderView;
+
+    private boolean mFilterEnabled;
+    private ContactListFilterController mFilterController;
+
+    public DefaultContactBrowseListFragment() {
+        setPhotoLoaderEnabled(true);
+        setSectionHeaderDisplayEnabled(true);
+        setAizyEnabled(true);
+    }
+
+    public void setContactListFilterController(ContactListFilterController filterController) {
+        mFilterController = filterController;
+        mFilterController.addListener(this);
+    }
+
+    @Override
+    public void onDetach() {
+        if (mFilterController != null) {
+            mFilterController.removeListener(this);
+        }
+        super.onDetach();
+    }
+
+    @Override
+    public void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        outState.putBoolean(KEY_EDIT_MODE, mEditMode);
+        outState.putBoolean(KEY_CREATE_CONTACT_ENABLED, mCreateContactEnabled);
+        outState.putBoolean(KEY_FILTER_ENABLED, mFilterEnabled);
+    }
+
+    @Override
+    public void restoreSavedState(Bundle savedState) {
+        super.restoreSavedState(savedState);
+
+        if (savedState == null) {
+            return;
+        }
+
+        mEditMode = savedState.getBoolean(KEY_EDIT_MODE);
+        mCreateContactEnabled = savedState.getBoolean(KEY_CREATE_CONTACT_ENABLED);
+        setFilterEnabled(savedState.getBoolean(KEY_FILTER_ENABLED));
+    }
+
+    @Override
+    protected void onItemClick(int position, long id) {
+        ContactListAdapter adapter = getAdapter();
+        if (isEditMode()) {
+            if (position == 0 && !isSearchMode() && isCreateContactEnabled()) {
+                createNewContact();
+            } else {
+                editContact(adapter.getContactUri(position));
+            }
+        } else {
+            viewContact(adapter.getContactUri(position));
+        }
+    }
+
+    @Override
+    protected ContactListAdapter createListAdapter() {
+        DefaultContactListAdapter adapter = new DefaultContactListAdapter(getContext());
+        adapter.setSectionHeaderDisplayEnabled(isSectionHeaderDisplayEnabled());
+        adapter.setDisplayPhotos(true);
+        return adapter;
+    }
+
+    @Override
+    protected void configureAdapter() {
+        super.configureAdapter();
+
+        DefaultContactListAdapter adapter = (DefaultContactListAdapter)getAdapter();
+        if (adapter != null && mFilterEnabled && mFilterController != null) {
+            adapter.setFilter(mFilterController.getFilter(), mFilterController.getFilterList());
+        }
+    }
+
+    @Override
+    protected View inflateView(LayoutInflater inflater, ViewGroup container) {
+        return inflater.inflate(R.layout.contacts_list_content, null);
+    }
+
+    @Override
+    protected void onCreateView(LayoutInflater inflater, ViewGroup container) {
+        super.onCreateView(inflater, container);
+
+        // Putting the header view inside a container will allow us to make
+        // it invisible later. See checkHeaderViewVisibility()
+        FrameLayout headerContainer = new FrameLayout(inflater.getContext());
+        mCounterHeaderView = inflater.inflate(R.layout.total_contacts, null, false);
+        headerContainer.addView(mCounterHeaderView);
+        mSearchHeaderView = inflater.inflate(R.layout.search_header, null, false);
+        headerContainer.addView(mSearchHeaderView);
+        getListView().addHeaderView(headerContainer);
+        checkHeaderViewVisibility();
+    }
+
+    @Override
+    public void setSearchMode(boolean flag) {
+        super.setSearchMode(flag);
+        checkHeaderViewVisibility();
+    }
+
+    private void checkHeaderViewVisibility() {
+        if (mCounterHeaderView != null) {
+            mCounterHeaderView.setVisibility(isSearchMode() ? View.GONE : View.VISIBLE);
+        }
+
+        // Hide the search header by default. See showCount().
+        if (mSearchHeaderView != null) {
+            mSearchHeaderView.setVisibility(View.GONE);
+        }
+    }
+
+    @Override
+    protected void showCount(int partitionIndex, Cursor data) {
+        if (!isSearchMode() && data != null) {
+            int count = data.getCount();
+            // TODO
+            // if (contactsListActivity.mDisplayOnlyPhones) {
+            // text = contactsListActivity.getQuantityText(count,
+            // R.string.listTotalPhoneContactsZero,
+            // R.plurals.listTotalPhoneContacts);
+            TextView textView = (TextView)mCounterHeaderView.findViewById(R.id.totalContactsText);
+            String text = getQuantityText(count, R.string.listTotalAllContactsZero,
+                    R.plurals.listTotalAllContacts);
+            textView.setText(text);
+        } else {
+            ContactListAdapter adapter = getAdapter();
+            if (adapter == null) {
+                return;
+            }
+
+            // In search mode we only display the header if there is nothing found
+            if (!adapter.areAllPartitionsEmpty()) {
+                mSearchHeaderView.setVisibility(View.GONE);
+            } else {
+                TextView textView = (TextView) mSearchHeaderView.findViewById(
+                        R.id.totalContactsText);
+                ProgressBar progress = (ProgressBar) mSearchHeaderView.findViewById(
+                        R.id.progress);
+                if (adapter.isLoading()) {
+                    textView.setText(R.string.search_results_searching);
+                    progress.setVisibility(View.VISIBLE);
+                } else {
+                    textView.setText(R.string.listFoundAllContactsZero);
+                    progress.setVisibility(View.GONE);
+                }
+                mSearchHeaderView.setVisibility(View.VISIBLE);
+            }
+        }
+    }
+
+    public boolean isEditMode() {
+        return mEditMode;
+    }
+
+    public void setEditMode(boolean flag) {
+        mEditMode = flag;
+    }
+
+    public boolean isFilterEnabled() {
+        return mFilterEnabled;
+    }
+
+    public void setFilterEnabled(boolean flag) {
+        this.mFilterEnabled = flag;
+    }
+
+    public boolean isCreateContactEnabled() {
+        return mCreateContactEnabled;
+    }
+
+    public void setCreateContactEnabled(boolean flag) {
+        this.mCreateContactEnabled = flag;
+    }
+
+    @Override
+    protected void startLoading() {
+        if (mFilterController != null && !mFilterController.isLoaded()) {
+            mFilterController.startLoading();
+        }
+
+        if (!mFilterEnabled || mFilterController == null || mFilterController.isLoaded()) {
+            super.startLoading();
+        }
+    }
+
+    @Override
+    protected void onPartitionLoaded(int partitionIndex, Cursor data) {
+        super.onPartitionLoaded(partitionIndex, data);
+        if (mFilterController != null) {
+            mFilterController.postDelayedRefresh();
+        }
+    }
+
+    @Override
+    public void onContactListFiltersLoaded() {
+        if (mFilterEnabled) {
+            // Filters have been loaded - now we can start loading the list itself
+            startLoading();
+        }
+    }
+
+    @Override
+    public void onContactListFilterChanged() {
+        reloadData();
+    }
+
+    @Override
+    public void onContactListFilterCustomizationRequest() {
+        startActivityForResult(new Intent(getContext(), CustomContactListFilterActivity.class),
+                REQUEST_CODE_CUSTOMIZE_FILTER);
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == REQUEST_CODE_CUSTOMIZE_FILTER && resultCode == Activity.RESULT_OK) {
+            mFilterController.selectCustomFilter();
+        }
+    }
+}
diff --git a/src/com/android/contacts/list/DefaultContactListAdapter.java b/src/com/android/contacts/list/DefaultContactListAdapter.java
new file mode 100644
index 0000000..ede3597
--- /dev/null
+++ b/src/com/android/contacts/list/DefaultContactListAdapter.java
@@ -0,0 +1,205 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.preference.ContactsPreferences;
+
+import android.content.Context;
+import android.content.CursorLoader;
+import android.content.SharedPreferences;
+import android.database.Cursor;
+import android.net.Uri;
+import android.net.Uri.Builder;
+import android.preference.PreferenceManager;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.Directory;
+import android.provider.ContactsContract.RawContacts;
+import android.text.TextUtils;
+import android.view.View;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A cursor adapter for the {@link ContactsContract.Contacts#CONTENT_TYPE} content type.
+ */
+public class DefaultContactListAdapter extends ContactListAdapter {
+
+    public DefaultContactListAdapter(Context context) {
+        super(context);
+    }
+
+    @Override
+    public void configureLoader(CursorLoader loader, long directoryId) {
+
+        ContactListFilter filter = getFilter();
+        if (isSearchMode()) {
+            String query = getQueryString();
+            Builder builder = Contacts.CONTENT_FILTER_URI.buildUpon();
+            if (TextUtils.isEmpty(query)) {
+                builder.appendPath("");
+            } else {
+                builder.appendPath(query);      // Builder will encode the query
+            }
+            builder.appendQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY,
+                    String.valueOf(directoryId));
+            if (directoryId != Directory.DEFAULT && directoryId != Directory.LOCAL_INVISIBLE) {
+                builder.appendQueryParameter(ContactsContract.LIMIT_PARAM_KEY,
+                        String.valueOf(getDirectoryResultLimit()));
+            }
+            loader.setUri(builder.build());
+            loader.setProjection(FILTER_PROJECTION);
+        } else {
+            configureUri(loader, directoryId, filter);
+            configureProjection(loader, directoryId, filter);
+            configureSelection(loader, directoryId, filter);
+        }
+
+        String sortOrder;
+        if (getSortOrder() == ContactsContract.Preferences.SORT_ORDER_PRIMARY) {
+            sortOrder = Contacts.SORT_KEY_PRIMARY;
+        } else {
+            sortOrder = Contacts.SORT_KEY_ALTERNATIVE;
+        }
+
+        loader.setSortOrder(sortOrder);
+    }
+
+    protected void configureUri(CursorLoader loader, long directoryId, ContactListFilter filter) {
+        Uri uri;
+        if (filter != null && filter.groupId != 0) {
+            uri = Data.CONTENT_URI;
+        } else {
+            uri = Contacts.CONTENT_URI;
+        }
+
+        if (directoryId == Directory.DEFAULT && isSectionHeaderDisplayEnabled()) {
+            uri = buildSectionIndexerUri(uri);
+        }
+
+        // The "All accounts" filter is the same as the entire contents of Directory.DEFAULT
+        if (filter != null && filter.filterType != ContactListFilter.FILTER_TYPE_CUSTOM) {
+            uri = uri.buildUpon().appendQueryParameter(
+                    ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(Directory.DEFAULT))
+                    .build();
+        }
+        loader.setUri(uri);
+    }
+
+    protected void configureProjection(
+            CursorLoader loader, long directoryId, ContactListFilter filter) {
+        if (filter != null && filter.groupId != 0) {
+            loader.setProjection(PROJECTION_DATA);
+        } else {
+            loader.setProjection(PROJECTION_CONTACT);
+        }
+    }
+
+    private void configureSelection(
+            CursorLoader loader, long directoryId, ContactListFilter filter) {
+        if (filter == null) {
+            return;
+        }
+
+        if (directoryId != Directory.DEFAULT) {
+            return;
+        }
+
+        StringBuilder selection = new StringBuilder();
+        List<String> selectionArgs = new ArrayList<String>();
+
+        switch (filter.filterType) {
+            case ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS: {
+                // We have already added directory=0 to the URI, which takes care of this
+                // filter
+                break;
+            }
+            case ContactListFilter.FILTER_TYPE_STARRED: {
+                selection.append(Contacts.STARRED + "!=0");
+                break;
+            }
+            case ContactListFilter.FILTER_TYPE_WITH_PHONE_NUMBERS_ONLY: {
+                selection.append(Contacts.HAS_PHONE_NUMBER + "=1");
+                break;
+            }
+            case ContactListFilter.FILTER_TYPE_CUSTOM: {
+                selection.append(Contacts.IN_VISIBLE_GROUP + "=1");
+                if (isCustomFilterForPhoneNumbersOnly()) {
+                    selection.append(" AND " + Contacts.HAS_PHONE_NUMBER + "=1");
+                }
+                break;
+            }
+            case ContactListFilter.FILTER_TYPE_ACCOUNT:
+            case ContactListFilter.FILTER_TYPE_GROUP: {
+                if (filter.groupId != 0) {
+                    selection.append(Data.MIMETYPE + "=?"
+                            + " AND " + GroupMembership.GROUP_ROW_ID + "=?");
+                    selectionArgs.add(GroupMembership.CONTENT_ITEM_TYPE);
+                    selectionArgs.add(String.valueOf(filter.groupId));
+                } else {
+                    // TODO: avoid the use of private API
+                    selection.append(
+                            Contacts._ID + " IN ("
+                                    + "SELECT " + RawContacts.CONTACT_ID
+                                    + " FROM raw_contacts"
+                                    + " WHERE " + RawContacts.ACCOUNT_TYPE + "=?"
+                                    + "   AND " + RawContacts.ACCOUNT_NAME + "=?)");
+                    selectionArgs.add(filter.accountType);
+                    selectionArgs.add(filter.accountName);
+                }
+                break;
+            }
+        }
+        loader.setSelection(selection.toString());
+        loader.setSelectionArgs(selectionArgs.toArray(new String[0]));
+    }
+
+    @Override
+    protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        final ContactListItemView view = (ContactListItemView)itemView;
+
+        view.setHighlightedPrefix(getUpperCaseQueryString());
+
+        if (isSelectionVisible()) {
+            view.setActivated(isSelectedContact(partition, cursor));
+        }
+
+        bindSectionHeaderAndDivider(view, position);
+
+        if (isQuickContactEnabled()) {
+            bindQuickContact(view, partition, cursor);
+        } else {
+            bindPhoto(view, partition, cursor);
+        }
+
+        bindName(view, cursor);
+        bindPresence(view, cursor);
+
+        if (isSearchMode()) {
+            bindSearchSnippet(view, cursor);
+        }
+    }
+
+    private boolean isCustomFilterForPhoneNumbersOnly() {
+        // TODO: this flag should not be stored in shared prefs.  It needs to be in the db.
+        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
+        return prefs.getBoolean(ContactsPreferences.PREF_DISPLAY_ONLY_PHONES,
+                ContactsPreferences.PREF_DISPLAY_ONLY_PHONES_DEFAULT);
+    }
+}
diff --git a/src/com/android/contacts/list/DirectoryListLoader.java b/src/com/android/contacts/list/DirectoryListLoader.java
new file mode 100644
index 0000000..c2505e1
--- /dev/null
+++ b/src/com/android/contacts/list/DirectoryListLoader.java
@@ -0,0 +1,172 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+
+import android.content.AsyncTaskLoader;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.database.ContentObserver;
+import android.database.Cursor;
+import android.database.MatrixCursor;
+import android.net.Uri;
+import android.os.Handler;
+import android.provider.ContactsContract.Directory;
+import android.text.TextUtils;
+import android.util.Log;
+
+/**
+ * A specialized loader for the list of directories, see {@link Directory}.
+ */
+public class DirectoryListLoader extends AsyncTaskLoader<Cursor> {
+
+    private static final String TAG = "ContactEntryListAdapter";
+
+    private static final class DirectoryQuery {
+        public static final Uri URI = Directory.CONTENT_URI;
+        public static final String ORDER_BY = Directory._ID;
+
+        public static final String[] PROJECTION = {
+            Directory._ID,
+            Directory.PACKAGE_NAME,
+            Directory.TYPE_RESOURCE_ID,
+            Directory.DISPLAY_NAME,
+            Directory.PHOTO_SUPPORT,
+        };
+
+        public static final int ID = 0;
+        public static final int PACKAGE_NAME = 1;
+        public static final int TYPE_RESOURCE_ID = 2;
+        public static final int DISPLAY_NAME = 3;
+        public static final int PHOTO_SUPPORT = 4;
+    }
+
+    public static final String DIRECTORY_TYPE = "directoryType";
+
+    private static final String[] RESULT_PROJECTION = {
+        Directory._ID,
+        DIRECTORY_TYPE,
+        Directory.DISPLAY_NAME,
+        Directory.PHOTO_SUPPORT,
+    };
+
+    private final ContentObserver mObserver = new ContentObserver(new Handler()) {
+        @Override
+        public void onChange(boolean selfChange) {
+            forceLoad();
+        }
+    };
+
+    private boolean mDirectorySearchEnabled;
+    private boolean mLocalInvisibleDirectoryEnabled;
+
+    private MatrixCursor mDefaultDirectoryList;
+
+    public DirectoryListLoader(Context context) {
+        super(context);
+    }
+
+    public void setDirectorySearchEnabled(boolean flag) {
+        mDirectorySearchEnabled = flag;
+    }
+
+    /**
+     * A flag that indicates whether the {@link Directory#LOCAL_INVISIBLE} directory should
+     * be included in the results.
+     */
+    public void setLocalInvisibleDirectoryEnabled(boolean flag) {
+        this.mLocalInvisibleDirectoryEnabled = flag;
+    }
+
+    @Override
+    public void startLoading() {
+        getContext().getContentResolver().
+                registerContentObserver(Directory.CONTENT_URI, false, mObserver);
+        forceLoad();
+    }
+
+    @Override
+    public void stopLoading() {
+        getContext().getContentResolver().unregisterContentObserver(mObserver);
+    }
+
+    @Override
+    public Cursor loadInBackground() {
+        if (mDirectorySearchEnabled) {
+            return loadDirectories();
+        } else {
+            return getDefaultDirectories();
+        }
+    }
+
+    private Cursor loadDirectories() {
+        MatrixCursor result = new MatrixCursor(RESULT_PROJECTION);
+        Context context = getContext();
+        PackageManager pm = context.getPackageManager();
+        String selection = mLocalInvisibleDirectoryEnabled
+                ? null
+                : Directory._ID + "!=" + Directory.LOCAL_INVISIBLE;
+        Cursor cursor = context.getContentResolver().query(DirectoryQuery.URI,
+                DirectoryQuery.PROJECTION, selection, null, DirectoryQuery.ORDER_BY);
+        try {
+            while(cursor.moveToNext()) {
+                Object[] row = new Object[RESULT_PROJECTION.length];
+                long directoryId = cursor.getLong(DirectoryQuery.ID);
+                String directoryType = null;
+
+                String packageName = cursor.getString(DirectoryQuery.PACKAGE_NAME);
+                int typeResourceId = cursor.getInt(DirectoryQuery.TYPE_RESOURCE_ID);
+                if (!TextUtils.isEmpty(packageName) && typeResourceId != 0) {
+                    try {
+                        directoryType = pm.getResourcesForApplication(packageName)
+                                .getString(typeResourceId);
+                    } catch (Exception e) {
+                        Log.e(TAG, "Cannot obtain directory type from package: " + packageName);
+                    }
+                }
+                String displayName = cursor.getString(DirectoryQuery.DISPLAY_NAME);
+                int photoSupport = cursor.getInt(DirectoryQuery.PHOTO_SUPPORT);
+                result.addRow(new Object[]{directoryId, directoryType, displayName, photoSupport});
+            }
+        } finally {
+            cursor.close();
+        }
+        return result;
+    }
+
+    private Cursor getDefaultDirectories() {
+        if (mDefaultDirectoryList == null) {
+            mDefaultDirectoryList = new MatrixCursor(RESULT_PROJECTION);
+            mDefaultDirectoryList.addRow(new Object[] {
+                    Directory.DEFAULT,
+                    getContext().getString(R.string.contactsList),
+                    null
+            });
+            mDefaultDirectoryList.addRow(new Object[] {
+                    Directory.LOCAL_INVISIBLE,
+                    getContext().getString(R.string.local_invisible_directory),
+                    null
+            });
+        }
+        return mDefaultDirectoryList;
+    }
+
+    @Override
+    public void destroy() {
+        stopLoading();
+    }
+}
diff --git a/src/com/android/contacts/list/DirectoryPartition.java b/src/com/android/contacts/list/DirectoryPartition.java
new file mode 100644
index 0000000..47a1037
--- /dev/null
+++ b/src/com/android/contacts/list/DirectoryPartition.java
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.common.widget.CompositeCursorAdapter;
+
+import android.provider.ContactsContract.Directory;
+
+/**
+ * Model object for a {@link Directory} row.
+ */
+public final class DirectoryPartition extends CompositeCursorAdapter.Partition {
+
+    public static final int STATUS_NOT_LOADED = 0;
+    public static final int STATUS_LOADING = 1;
+    public static final int STATUS_LOADED = 2;
+
+    private long mDirectoryId;
+    private String mDirectoryType;
+    private String mDisplayName;
+    private int mStatus;
+    private boolean mPriorityDirectory;
+    private boolean mPhotoSupported;
+
+    public DirectoryPartition(boolean showIfEmpty, boolean hasHeader) {
+        super(showIfEmpty, hasHeader);
+    }
+
+    /**
+     * Directory ID, see {@link Directory}.
+     */
+    public long getDirectoryId() {
+        return mDirectoryId;
+    }
+
+    public void setDirectoryId(long directoryId) {
+        this.mDirectoryId = directoryId;
+    }
+
+    /**
+     * Directory type resolved from {@link Directory#PACKAGE_NAME} and
+     * {@link Directory#TYPE_RESOURCE_ID};
+     */
+    public String getDirectoryType() {
+        return mDirectoryType;
+    }
+
+    public void setDirectoryType(String directoryType) {
+        this.mDirectoryType = directoryType;
+    }
+
+    /**
+     * See {@link Directory#DISPLAY_NAME}.
+     */
+    public String getDisplayName() {
+        return mDisplayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.mDisplayName = displayName;
+    }
+
+    public int getStatus() {
+        return mStatus;
+    }
+
+    public void setStatus(int status) {
+        mStatus = status;
+    }
+
+    public boolean isLoading() {
+        return mStatus == STATUS_NOT_LOADED || mStatus == STATUS_LOADING;
+    }
+
+    /**
+     * Returns true if this directory should be loaded before non-priority directories.
+     */
+    public boolean isPriorityDirectory() {
+        return mPriorityDirectory;
+    }
+
+    public void setPriorityDirectory(boolean priorityDirectory) {
+        mPriorityDirectory = priorityDirectory;
+    }
+
+    /**
+     * Returns true if this directory supports photos.
+     */
+    public boolean isPhotoSupported() {
+        return mPhotoSupported;
+    }
+
+    public void setPhotoSupported(boolean flag) {
+        this.mPhotoSupported = flag;
+    }
+}
diff --git a/src/com/android/contacts/list/JoinContactListAdapter.java b/src/com/android/contacts/list/JoinContactListAdapter.java
new file mode 100644
index 0000000..c72ebcd
--- /dev/null
+++ b/src/com/android/contacts/list/JoinContactListAdapter.java
@@ -0,0 +1,233 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+
+import android.content.Context;
+import android.content.CursorLoader;
+import android.database.Cursor;
+import android.database.MatrixCursor;
+import android.net.Uri;
+import android.net.Uri.Builder;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Contacts.AggregationSuggestions;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+public class JoinContactListAdapter extends ContactListAdapter {
+
+    /** Maximum number of suggestions shown for joining aggregates */
+    private static final int MAX_SUGGESTIONS = 4;
+
+    public static final int PARTITION_SUGGESTIONS = 0;
+    public static final int PARTITION_SHOW_ALL_CONTACTS = 1;
+    public static final int PARTITION_ALL_CONTACTS = 2;
+
+    private long mTargetContactId;
+
+    private int mShowAllContactsViewType;
+
+    /**
+     * Determines whether we display a list item with the label
+     * "Show all contacts" or actually show all contacts
+     */
+    private boolean mAllContactsListShown;
+
+
+    public JoinContactListAdapter(Context context) {
+        super(context);
+        setPinnedPartitionHeadersEnabled(true);
+        setSectionHeaderDisplayEnabled(true);
+        setIndexedPartition(PARTITION_ALL_CONTACTS);
+        setDirectorySearchEnabled(false);
+        mShowAllContactsViewType = getViewTypeCount() - 1;
+    }
+
+    @Override
+    protected void addPartitions() {
+
+        // Partition 0: suggestions
+        addPartition(false, true);
+
+        // Partition 1: "Show all contacts"
+        addPartition(false, false);
+
+        // Partition 2: All contacts
+        addPartition(createDefaultDirectoryPartition());
+    }
+
+    public void setTargetContactId(long targetContactId) {
+        this.mTargetContactId = targetContactId;
+    }
+
+    @Override
+    public void configureLoader(CursorLoader cursorLoader, long directoryId) {
+        JoinContactLoader loader = (JoinContactLoader)cursorLoader;
+        loader.setLoadSuggestionsAndAllContacts(mAllContactsListShown);
+
+        Builder builder = Contacts.CONTENT_URI.buildUpon();
+        builder.appendEncodedPath(String.valueOf(mTargetContactId));
+        builder.appendEncodedPath(AggregationSuggestions.CONTENT_DIRECTORY);
+
+        String filter = getQueryString();
+        if (!TextUtils.isEmpty(filter)) {
+            builder.appendEncodedPath(Uri.encode(filter));
+        }
+
+        builder.appendQueryParameter("limit", String.valueOf(MAX_SUGGESTIONS));
+
+        loader.setSuggestionUri(builder.build());
+
+        // TODO simplify projection
+        loader.setProjection(PROJECTION_CONTACT);
+        loader.setUri(buildSectionIndexerUri(Contacts.CONTENT_URI));
+        loader.setSelection(Contacts.IN_VISIBLE_GROUP + "=1 AND " + Contacts._ID + "!=?");
+        loader.setSelectionArgs(new String[]{String.valueOf(mTargetContactId)});
+        if (getSortOrder() == ContactsContract.Preferences.SORT_ORDER_PRIMARY) {
+            loader.setSortOrder(Contacts.SORT_KEY_PRIMARY);
+        } else {
+            loader.setSortOrder(Contacts.SORT_KEY_ALTERNATIVE);
+        }
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return false;
+    }
+
+    public boolean isAllContactsListShown() {
+        return mAllContactsListShown;
+    }
+
+    public void setAllContactsListShown(boolean flag) {
+        mAllContactsListShown = flag;
+    }
+
+    public void setSuggestionsCursor(Cursor cursor) {
+        changeCursor(PARTITION_SUGGESTIONS, cursor);
+        if (cursor != null && cursor.getCount() != 0 && !mAllContactsListShown) {
+            changeCursor(PARTITION_SHOW_ALL_CONTACTS, getShowAllContactsLabelCursor());
+        } else {
+            changeCursor(PARTITION_SHOW_ALL_CONTACTS, null);
+        }
+    }
+
+    @Override
+    public void changeCursor(Cursor cursor) {
+        changeCursor(PARTITION_ALL_CONTACTS, cursor);
+    }
+
+    @Override
+    public void configureDefaultPartition(boolean showIfEmpty, boolean hasHeader) {
+         // Don't change default partition parameters from these defaults
+        super.configureDefaultPartition(false, true);
+    }
+
+    @Override
+    public int getViewTypeCount() {
+        return super.getViewTypeCount() + 1;
+    }
+
+    @Override
+    public int getItemViewType(int partition, int position) {
+        if (partition == PARTITION_SHOW_ALL_CONTACTS) {
+            return mShowAllContactsViewType;
+        }
+        return super.getItemViewType(partition, position);
+    }
+
+    @Override
+    protected View newHeaderView(Context context, int partition, Cursor cursor,
+            ViewGroup parent) {
+        switch (partition) {
+            case PARTITION_SUGGESTIONS: {
+              TextView view = (TextView) inflate(R.layout.list_separator, parent);
+              view.setText(R.string.separatorJoinAggregateSuggestions);
+              return view;
+            }
+            case PARTITION_ALL_CONTACTS: {
+              TextView view = (TextView) inflate(R.layout.list_separator, parent);
+              view.setText(R.string.separatorJoinAggregateAll);
+              return view;
+            }
+        }
+
+        return null;
+    }
+
+    @Override
+    protected void bindHeaderView(View view, int partitionIndex, Cursor cursor) {
+        // Header views are static - nothing needs to be bound
+    }
+
+    @Override
+    protected View newView(Context context, int partition, Cursor cursor, int position,
+            ViewGroup parent) {
+        switch (partition) {
+            case PARTITION_SUGGESTIONS:
+            case PARTITION_ALL_CONTACTS:
+                return super.newView(context, partition, cursor, position, parent);
+            case PARTITION_SHOW_ALL_CONTACTS:
+                return inflate(R.layout.contacts_list_show_all_item, parent);
+        }
+        return null;
+    }
+
+    private View inflate(int layoutId, ViewGroup parent) {
+        return LayoutInflater.from(getContext()).inflate(layoutId, parent, false);
+    }
+
+    @Override
+    protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        switch (partition) {
+            case PARTITION_SUGGESTIONS: {
+                final ContactListItemView view = (ContactListItemView)itemView;
+                bindPhoto(view, partition, cursor);
+                bindName(view, cursor);
+                break;
+            }
+            case PARTITION_SHOW_ALL_CONTACTS: {
+                break;
+            }
+            case PARTITION_ALL_CONTACTS: {
+                final ContactListItemView view = (ContactListItemView)itemView;
+                bindSectionHeaderAndDivider(view, position);
+                bindPhoto(view, partition, cursor);
+                bindName(view, cursor);
+                break;
+            }
+        }
+    }
+
+    public Cursor getShowAllContactsLabelCursor() {
+        MatrixCursor matrixCursor = new MatrixCursor(PROJECTION_CONTACT);
+        Object[] row = new Object[PROJECTION_CONTACT.length];
+        matrixCursor.addRow(row);
+        return matrixCursor;
+    }
+
+    @Override
+    public Uri getContactUri(int partitionIndex, Cursor cursor) {
+        long contactId = cursor.getLong(CONTACT_ID_COLUMN_INDEX);
+        String lookupKey = cursor.getString(CONTACT_LOOKUP_KEY_COLUMN_INDEX);
+        return Contacts.getLookupUri(contactId, lookupKey);
+    }
+}
diff --git a/src/com/android/contacts/list/JoinContactListFragment.java b/src/com/android/contacts/list/JoinContactListFragment.java
new file mode 100644
index 0000000..e17fbbf
--- /dev/null
+++ b/src/com/android/contacts/list/JoinContactListFragment.java
@@ -0,0 +1,166 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.R;
+
+import android.app.Activity;
+import android.app.LoaderManager.LoaderCallbacks;
+import android.content.ContentUris;
+import android.content.CursorLoader;
+import android.content.Intent;
+import android.content.Loader;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.provider.ContactsContract.Contacts;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+/**
+ * Fragment for the Join Contact list.
+ */
+public class JoinContactListFragment extends ContactEntryListFragment<JoinContactListAdapter> {
+
+    private static final int DISPLAY_NAME_LOADER = -2;
+
+    private OnContactPickerActionListener mListener;
+    private long mTargetContactId;
+    private boolean mAllContactsListShown = false;
+
+    private LoaderCallbacks<Cursor> mLoaderCallbacks = new LoaderCallbacks<Cursor>() {
+
+        @Override
+        public Loader<Cursor> onCreateLoader(int id, Bundle args) {
+            switch (id) {
+                case DISPLAY_NAME_LOADER: {
+                    // Loader for the display name of the target contact
+                    return new CursorLoader(getActivity(),
+                            ContentUris.withAppendedId(Contacts.CONTENT_URI, mTargetContactId),
+                            new String[] { Contacts.DISPLAY_NAME }, null, null, null);
+                }
+                case JoinContactListAdapter.PARTITION_ALL_CONTACTS: {
+                    JoinContactLoader loader = new JoinContactLoader(getActivity());
+                    JoinContactListAdapter adapter = getAdapter();
+                    if (adapter != null) {
+                        adapter.configureLoader(loader, 0);
+                    }
+                    return loader;
+                }
+            }
+            throw new IllegalArgumentException("No loader for ID=" + id);
+        }
+
+        @Override
+        public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+            switch (loader.getId()) {
+                case DISPLAY_NAME_LOADER: {
+                    if (data != null && data.moveToFirst()) {
+                        showTargetContactName(data.getString(0));
+                    }
+                    break;
+                }
+                case JoinContactListAdapter.PARTITION_ALL_CONTACTS: {
+                    setAizyEnabled(mAllContactsListShown);
+
+                    JoinContactListAdapter adapter = getAdapter();
+                    Cursor suggestionsCursor = ((JoinContactLoader)loader).getSuggestionsCursor();
+                    adapter.setSuggestionsCursor(suggestionsCursor);
+                    onPartitionLoaded(JoinContactListAdapter.PARTITION_ALL_CONTACTS, data);
+                    break;
+                }
+            }
+        }
+    };
+
+    public JoinContactListFragment() {
+        setPhotoLoaderEnabled(true);
+        setSectionHeaderDisplayEnabled(true);
+        setAizyEnabled(false);
+    }
+
+    public void setOnContactPickerActionListener(OnContactPickerActionListener listener) {
+        mListener = listener;
+    }
+
+    @Override
+    protected void startLoading() {
+        configureAdapter();
+
+        getLoaderManager().initLoader(DISPLAY_NAME_LOADER, null, mLoaderCallbacks);
+        getLoaderManager().initLoader(JoinContactListAdapter.PARTITION_ALL_CONTACTS,
+                null, mLoaderCallbacks);
+    }
+
+    private void showTargetContactName(String displayName) {
+        Activity activity = getActivity();
+        TextView blurbView = (TextView)activity.findViewById(R.id.join_contact_blurb);
+        String blurb = activity.getString(R.string.blurbJoinContactDataWith, displayName);
+        blurbView.setText(blurb);
+    }
+
+    public void setTargetContactId(long targetContactId) {
+        mTargetContactId = targetContactId;
+    }
+
+    @Override
+    public JoinContactListAdapter createListAdapter() {
+        return new JoinContactListAdapter(getActivity());
+    }
+
+    @Override
+    protected void configureAdapter() {
+        super.configureAdapter();
+        JoinContactListAdapter adapter = getAdapter();
+        adapter.setAllContactsListShown(mAllContactsListShown);
+        adapter.setTargetContactId(mTargetContactId);
+    }
+
+    @Override
+    protected View inflateView(LayoutInflater inflater, ViewGroup container) {
+        return inflater.inflate(R.layout.contacts_list_content_join, null);
+    }
+
+    @Override
+    protected void onItemClick(int position, long id) {
+        JoinContactListAdapter adapter = getAdapter();
+        int partition = adapter.getPartitionForPosition(position);
+        if (partition == JoinContactListAdapter.PARTITION_SHOW_ALL_CONTACTS) {
+            mAllContactsListShown = true;
+            configureAdapter();
+            getLoaderManager().restartLoader(JoinContactListAdapter.PARTITION_ALL_CONTACTS,
+                    null, mLoaderCallbacks);
+        } else {
+            mListener.onPickContactAction(adapter.getContactUri(position));
+        }
+    }
+
+    @Override
+    public void startSearch(String initialQuery) {
+        ContactsRequest request = new ContactsRequest();
+        request.setActionCode(ContactsRequest.ACTION_PICK_CONTACT);
+        request.setDirectorySearchEnabled(false);
+        ContactsSearchManager.startSearchForResult(getActivity(), initialQuery,
+                ACTIVITY_REQUEST_CODE_PICKER, request);
+    }
+
+    @Override
+    public void onPickerResult(Intent data) {
+        mListener.onPickContactAction(data.getData());
+    }
+}
diff --git a/src/com/android/contacts/list/JoinContactLoader.java b/src/com/android/contacts/list/JoinContactLoader.java
new file mode 100644
index 0000000..25c9ab4
--- /dev/null
+++ b/src/com/android/contacts/list/JoinContactLoader.java
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.Context;
+import android.content.CursorLoader;
+import android.database.Cursor;
+import android.database.MatrixCursor;
+import android.net.Uri;
+
+/**
+ * A specialized loader for the Join Contacts UI.  It executes two queries:
+ * join suggestions and (optionally) the full contact list.
+ */
+public class JoinContactLoader extends CursorLoader {
+
+    private boolean mLoadSuggestionsAndAllContact;
+    private String[] mProjection;
+    private Uri mSuggestionUri;
+    private MatrixCursor mSuggestionsCursor;
+
+    public JoinContactLoader(Context context) {
+        super(context, null, null, null, null, null);
+    }
+
+    public void setLoadSuggestionsAndAllContacts(boolean flag) {
+        mLoadSuggestionsAndAllContact = flag;
+    }
+
+    public void setSuggestionUri(Uri uri) {
+        this.mSuggestionUri = uri;
+    }
+
+    @Override
+    public void setProjection(String[] projection) {
+        super.setProjection(projection);
+        this.mProjection = projection;
+    }
+
+    public Cursor getSuggestionsCursor() {
+        return mSuggestionsCursor;
+    }
+
+    @Override
+    public Cursor loadInBackground() {
+        // First execute the suggestions query, then call super.loadInBackground
+        // to load the entire list
+        mSuggestionsCursor = loadSuggestions();
+        if (!mLoadSuggestionsAndAllContact && mSuggestionsCursor.getCount() != 0) {
+            // In case we only need suggestions, send "0" as the search query, which
+            // will always return an empty cursor (but we can still register to
+            // listen for changes on it).
+            setSelection("0");
+            setSelectionArgs(null);
+        }
+        return super.loadInBackground();
+    }
+
+    /**
+     * Loads join suggestions into a MatrixCursor.
+     */
+    private MatrixCursor loadSuggestions() {
+        Cursor cursor = getContext().getContentResolver().query(mSuggestionUri, mProjection,
+                null, null, null);
+        try {
+            MatrixCursor matrix = new MatrixCursor(mProjection);
+            Object[] row = new Object[mProjection.length];
+            while (cursor.moveToNext()) {
+                for (int i = 0; i < row.length; i++) {
+                    row[i] = cursor.getString(i);
+                }
+                matrix.addRow(row);
+            }
+            return matrix;
+        } finally {
+            cursor.close();
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/contacts/list/LegacyContactListAdapter.java b/src/com/android/contacts/list/LegacyContactListAdapter.java
new file mode 100644
index 0000000..39c0b53
--- /dev/null
+++ b/src/com/android/contacts/list/LegacyContactListAdapter.java
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.Contacts.People;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * A cursor adapter for the People.CONTENT_TYPE content type.
+ */
+@SuppressWarnings("deprecation")
+public class LegacyContactListAdapter extends ContactEntryListAdapter {
+
+    static final String[] PEOPLE_PROJECTION = new String[] {
+        People._ID,                         // 0
+        People.DISPLAY_NAME,                // 1
+        People.PHONETIC_NAME,               // 2
+        People.STARRED,                     // 3
+        People.PRESENCE_STATUS,             // 4
+    };
+
+    protected static final int PERSON_ID_COLUMN_INDEX = 0;
+    protected static final int PERSON_DISPLAY_NAME_COLUMN_INDEX = 1;
+    protected static final int PERSON_PHONETIC_NAME_COLUMN_INDEX = 2;
+    protected static final int PERSON_STARRED_COLUMN_INDEX = 3;
+    protected static final int PERSON_PRESENCE_STATUS_COLUMN_INDEX = 4;
+
+    private CharSequence mUnknownNameText;
+
+    public LegacyContactListAdapter(Context context) {
+        super(context);
+        mUnknownNameText = context.getText(android.R.string.unknownName);
+    }
+
+    @Override
+    public void configureLoader(CursorLoader loader, long directoryId) {
+        loader.setUri(People.CONTENT_URI);
+        loader.setProjection(PEOPLE_PROJECTION);
+        loader.setSortOrder(People.DISPLAY_NAME);
+    }
+
+    @Override
+    public String getContactDisplayName(int position) {
+        return ((Cursor)getItem(position)).getString(PERSON_DISPLAY_NAME_COLUMN_INDEX);
+    }
+
+    public Uri getPersonUri(int position) {
+        Cursor cursor = ((Cursor)getItem(position));
+        long personId = cursor.getLong(PERSON_ID_COLUMN_INDEX);
+        return ContentUris.withAppendedId(People.CONTENT_URI, personId);
+    }
+
+    @Override
+    protected View newView(Context context, int partition, Cursor cursor, int position,
+            ViewGroup parent) {
+        final ContactListItemView view = new ContactListItemView(context, null);
+        view.setUnknownNameText(mUnknownNameText);
+        return view;
+    }
+
+    @Override
+    protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        ContactListItemView view = (ContactListItemView)itemView;
+        bindName(view, cursor);
+        bindPresence(view, cursor);
+    }
+
+    protected void bindName(final ContactListItemView view, Cursor cursor) {
+        view.showDisplayName(cursor, PERSON_DISPLAY_NAME_COLUMN_INDEX, false, 0);
+        view.showPhoneticName(cursor, PERSON_PHONETIC_NAME_COLUMN_INDEX);
+    }
+
+    protected void bindPresence(final ContactListItemView view, Cursor cursor) {
+        view.showPresence(cursor, PERSON_PRESENCE_STATUS_COLUMN_INDEX);
+    }
+}
diff --git a/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java b/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java
new file mode 100644
index 0000000..47747fb
--- /dev/null
+++ b/src/com/android/contacts/list/LegacyPhoneNumberListAdapter.java
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.Contacts.People;
+import android.provider.Contacts.Phones;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * A cursor adapter for the Phones.CONTENT_TYPE content type.
+ */
+@SuppressWarnings("deprecation")
+public class LegacyPhoneNumberListAdapter extends ContactEntryListAdapter {
+
+    private static final String[] PHONES_PROJECTION = new String[] {
+        Phones._ID,             // 0
+        Phones.TYPE,            // 1
+        Phones.LABEL,           // 2
+        Phones.NUMBER,          // 3
+        People.DISPLAY_NAME,    // 4
+        People.PHONETIC_NAME,   // 5
+    };
+
+    private static final int PHONE_ID_COLUMN_INDEX = 0;
+    private static final int PHONE_TYPE_COLUMN_INDEX = 1;
+    private static final int PHONE_LABEL_COLUMN_INDEX = 2;
+    private static final int PHONE_NUMBER_COLUMN_INDEX = 3;
+    private static final int PHONE_DISPLAY_NAME_COLUMN_INDEX = 4;
+    private static final int PHONE_PHONETIC_NAME_COLUMN_INDEX = 5;
+
+    private CharSequence mUnknownNameText;
+
+    public LegacyPhoneNumberListAdapter(Context context) {
+        super(context);
+        mUnknownNameText = context.getText(android.R.string.unknownName);
+    }
+
+    @Override
+    public void configureLoader(CursorLoader loader, long directoryId) {
+        loader.setUri(Phones.CONTENT_URI);
+        loader.setProjection(PHONES_PROJECTION);
+        loader.setSortOrder(Phones.DISPLAY_NAME);
+    }
+
+    @Override
+    public String getContactDisplayName(int position) {
+        return ((Cursor)getItem(position)).getString(PHONE_DISPLAY_NAME_COLUMN_INDEX);
+    }
+
+    public Uri getPhoneUri(int position) {
+        Cursor cursor = ((Cursor)getItem(position));
+        long id = cursor.getLong(PHONE_ID_COLUMN_INDEX);
+        return ContentUris.withAppendedId(Phones.CONTENT_URI, id);
+    }
+
+    @Override
+    protected View newView(Context context, int partition, Cursor cursor, int position,
+            ViewGroup parent) {
+        final ContactListItemView view = new ContactListItemView(context, null);
+        view.setUnknownNameText(mUnknownNameText);
+        return view;
+    }
+
+    @Override
+    protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        ContactListItemView view = (ContactListItemView)itemView;
+        bindName(view, cursor);
+        bindPhoneNumber(view, cursor);
+    }
+
+    protected void bindName(final ContactListItemView view, Cursor cursor) {
+        view.showDisplayName(cursor, PHONE_DISPLAY_NAME_COLUMN_INDEX, false, 0);
+        view.showPhoneticName(cursor, PHONE_PHONETIC_NAME_COLUMN_INDEX);
+    }
+
+    protected void bindPhoneNumber(ContactListItemView view, Cursor cursor) {
+        CharSequence label = null;
+        if (!cursor.isNull(PHONE_TYPE_COLUMN_INDEX)) {
+            final int type = cursor.getInt(PHONE_TYPE_COLUMN_INDEX);
+            final String customLabel = cursor.getString(PHONE_LABEL_COLUMN_INDEX);
+
+            // TODO cache
+            label = Phone.getTypeLabel(getContext().getResources(), type, customLabel);
+        }
+        view.setLabel(label);
+        view.showData(cursor, PHONE_NUMBER_COLUMN_INDEX);
+    }
+}
diff --git a/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java b/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java
new file mode 100644
index 0000000..3796c62
--- /dev/null
+++ b/src/com/android/contacts/list/LegacyPostalAddressListAdapter.java
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.Contacts.ContactMethods;
+import android.provider.Contacts.People;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * A cursor adapter for the ContactMethods.CONTENT_TYPE content type.
+ */
+@SuppressWarnings("deprecation")
+public class LegacyPostalAddressListAdapter extends ContactEntryListAdapter {
+
+    static final String[] POSTALS_PROJECTION = new String[] {
+        ContactMethods._ID,     // 0
+        ContactMethods.TYPE,    // 1
+        ContactMethods.LABEL,   // 2
+        ContactMethods.DATA,    // 3
+        People.DISPLAY_NAME,    // 4
+        People.PHONETIC_NAME,   // 5
+    };
+
+    public static final int POSTAL_ID_COLUMN_INDEX = 0;
+    public static final int POSTAL_TYPE_COLUMN_INDEX = 1;
+    public static final int POSTAL_LABEL_COLUMN_INDEX = 2;
+    public static final int POSTAL_NUMBER_COLUMN_INDEX = 3;
+    public static final int POSTAL_DISPLAY_NAME_COLUMN_INDEX = 4;
+    public static final int POSTAL_PHONETIC_NAME_COLUMN_INDEX = 5;
+
+    private CharSequence mUnknownNameText;
+
+    public LegacyPostalAddressListAdapter(Context context) {
+        super(context);
+        mUnknownNameText = context.getText(android.R.string.unknownName);
+    }
+
+    @Override
+    public void configureLoader(CursorLoader loader, long directoryId) {
+        loader.setUri(ContactMethods.CONTENT_URI);
+        loader.setProjection(POSTALS_PROJECTION);
+        loader.setSortOrder(People.DISPLAY_NAME);
+        loader.setSelection(ContactMethods.KIND + "=" + android.provider.Contacts.KIND_POSTAL);
+    }
+
+    @Override
+    public String getContactDisplayName(int position) {
+        return ((Cursor)getItem(position)).getString(POSTAL_DISPLAY_NAME_COLUMN_INDEX);
+    }
+
+    public Uri getContactMethodUri(int position) {
+        Cursor cursor = ((Cursor)getItem(position));
+        long id = cursor.getLong(POSTAL_ID_COLUMN_INDEX);
+        return ContentUris.withAppendedId(ContactMethods.CONTENT_URI, id);
+    }
+
+    @Override
+    protected View newView(Context context, int partition, Cursor cursor, int position,
+            ViewGroup parent) {
+        final ContactListItemView view = new ContactListItemView(context, null);
+        view.setUnknownNameText(mUnknownNameText);
+        return view;
+    }
+
+    @Override
+    protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        ContactListItemView view = (ContactListItemView)itemView;
+        bindName(view, cursor);
+        bindPostalAddress(view, cursor);
+    }
+
+    protected void bindName(final ContactListItemView view, Cursor cursor) {
+        view.showDisplayName(cursor, POSTAL_DISPLAY_NAME_COLUMN_INDEX, false, 0);
+        view.showPhoneticName(cursor, POSTAL_PHONETIC_NAME_COLUMN_INDEX);
+    }
+
+    protected void bindPostalAddress(ContactListItemView view, Cursor cursor) {
+        CharSequence label = null;
+        if (!cursor.isNull(POSTAL_TYPE_COLUMN_INDEX)) {
+            final int type = cursor.getInt(POSTAL_TYPE_COLUMN_INDEX);
+            final String customLabel = cursor.getString(POSTAL_LABEL_COLUMN_INDEX);
+
+            // TODO cache
+            label = StructuredPostal.getTypeLabel(getContext().getResources(), type, customLabel);
+        }
+        view.setLabel(label);
+        view.showData(cursor, POSTAL_NUMBER_COLUMN_INDEX);
+    }
+}
diff --git a/src/com/android/contacts/list/MultiplePhonePickerAdapter.java b/src/com/android/contacts/list/MultiplePhonePickerAdapter.java
new file mode 100644
index 0000000..1eba085
--- /dev/null
+++ b/src/com/android/contacts/list/MultiplePhonePickerAdapter.java
@@ -0,0 +1,361 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+
+import android.content.ContentUris;
+import android.content.Context;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.text.TextUtils;
+import android.util.SparseIntArray;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CheckBox;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * List adapter for the multiple phone picker.
+ */
+public class MultiplePhonePickerAdapter extends PhoneNumberListAdapter {
+
+    public interface OnSelectionChangeListener {
+        void onSelectionChange();
+    }
+
+    private static final int[] CHIP_COLOR_ARRAY = {
+        R.drawable.appointment_indicator_leftside_1,
+        R.drawable.appointment_indicator_leftside_2,
+        R.drawable.appointment_indicator_leftside_3,
+        R.drawable.appointment_indicator_leftside_4,
+        R.drawable.appointment_indicator_leftside_5,
+        R.drawable.appointment_indicator_leftside_6,
+        R.drawable.appointment_indicator_leftside_7,
+        R.drawable.appointment_indicator_leftside_8,
+        R.drawable.appointment_indicator_leftside_9,
+        R.drawable.appointment_indicator_leftside_10,
+        R.drawable.appointment_indicator_leftside_11,
+        R.drawable.appointment_indicator_leftside_12,
+        R.drawable.appointment_indicator_leftside_13,
+        R.drawable.appointment_indicator_leftside_14,
+        R.drawable.appointment_indicator_leftside_15,
+        R.drawable.appointment_indicator_leftside_16,
+        R.drawable.appointment_indicator_leftside_17,
+        R.drawable.appointment_indicator_leftside_18,
+        R.drawable.appointment_indicator_leftside_19,
+        R.drawable.appointment_indicator_leftside_20,
+        R.drawable.appointment_indicator_leftside_21,
+    };
+
+    public static final long INVALID_PHONE_ID = -1;
+
+    /** The phone numbers */
+    private ArrayList<String> mPhoneNumbers = new ArrayList<String>();
+
+    /** The selected phone numbers in the PhoneNumberAdapter */
+    private HashSet<String> mSelectedPhoneNumbers = new HashSet<String>();
+
+    /** The phone numbers after the filtering */
+    private ArrayList<String> mFilteredPhoneNumbers = new ArrayList<String>();
+
+    /** The PHONE_ID of selected number in user contacts*/
+    private HashSet<Long> mSelectedPhoneIds = new HashSet<Long>();
+
+    private boolean mSelectionChanged;
+
+    private OnSelectionChangeListener mSelectionChangeListener;
+
+    /**
+     * This is a map from contact ID to color index. A colored chip is used to
+     * indicate the number of phone numbers belong to one contact
+     */
+    private SparseIntArray mContactColor = new SparseIntArray();
+
+    public MultiplePhonePickerAdapter(Context context) {
+        super(context);
+    }
+
+    public void setOnSelectionChangeListener(OnSelectionChangeListener listener) {
+        this.mSelectionChangeListener = listener;
+    }
+
+    public void setPhoneNumbers(ArrayList<String> phoneNumbers) {
+        mPhoneNumbers.clear();
+        mPhoneNumbers.addAll(phoneNumbers);
+    }
+
+    public int getSelectedCount() {
+        return mSelectedPhoneNumbers.size() + mSelectedPhoneIds.size();
+    }
+
+    public Uri[] getSelectedUris() {
+        Uri[] uris = new Uri[mSelectedPhoneNumbers.size() + mSelectedPhoneIds.size()];
+        int count = mPhoneNumbers.size();
+        int index = 0;
+        for (int i = 0; i < count; i++) {
+            String phoneNumber = mPhoneNumbers.get(i);
+            if (isSelected(phoneNumber)) {
+                uris[index++] = Uri.parse("tel:" + phoneNumber);
+            }
+        }
+        for (Long contactId : mSelectedPhoneIds) {
+            uris[index++] = ContentUris.withAppendedId(Phone.CONTENT_URI, contactId);
+        }
+        return uris;
+    }
+
+    public void setSelectedUris(Uri[] uris) {
+        mSelectedPhoneNumbers.clear();
+        mSelectedPhoneIds.clear();
+        if (uris != null) {
+            for (Uri uri : uris) {
+                String scheme = uri.getScheme();
+                if ("tel".equals(scheme)) {
+                    String phoneNumber = uri.getSchemeSpecificPart();
+                    if (!mPhoneNumbers.contains(phoneNumber)) {
+                        mPhoneNumbers.add(phoneNumber);
+                    }
+                    mSelectedPhoneNumbers.add(phoneNumber);
+            } else if ("content".equals(scheme)) {
+                mSelectedPhoneIds.add(ContentUris.parseId(uri));
+            }
+            }
+        }
+        mFilteredPhoneNumbers.clear();
+        mFilteredPhoneNumbers.addAll(mPhoneNumbers);
+    }
+
+    public void toggleSelection(int position) {
+        if (position < mFilteredPhoneNumbers.size()) {
+            String phoneNumber = mPhoneNumbers.get(position);
+            setPhoneSelected(phoneNumber, !isSelected(phoneNumber));
+        } else {
+            Cursor cursor = ((Cursor)getItem(position));
+            cursor.moveToPosition(position - mFilteredPhoneNumbers.size());
+            long phoneId = cursor.getLong(PHONE_ID_COLUMN_INDEX);
+            setPhoneSelected(phoneId, !isSelected(phoneId));
+        }
+        notifyDataSetChanged();
+    }
+
+    public boolean isSelectionChanged() {
+        return mSelectionChanged;
+    }
+
+    public void setSelectionChanged(boolean flag) {
+        mSelectionChanged = flag;
+        if (mSelectionChangeListener != null) {
+            mSelectionChangeListener.onSelectionChange();
+        }
+    }
+
+    public void setPhoneSelected(final String phoneNumber, boolean selected) {
+        if (!TextUtils.isEmpty(phoneNumber)) {
+            if (selected) {
+                mSelectedPhoneNumbers.add(phoneNumber);
+            } else {
+                mSelectedPhoneNumbers.remove(phoneNumber);
+            }
+        }
+        setSelectionChanged(true);
+    }
+
+    public void setPhoneSelected(long phoneId, boolean selected) {
+        if (selected) {
+            mSelectedPhoneIds.add(phoneId);
+        } else {
+            mSelectedPhoneIds.remove(phoneId);
+        }
+        setSelectionChanged(true);
+    }
+
+    public boolean isSelected(long phoneId) {
+        return mSelectedPhoneIds.contains(phoneId);
+    }
+
+    public boolean isSelected(final String phoneNumber) {
+        return mSelectedPhoneNumbers.contains(phoneNumber);
+    }
+
+    public void setAllPhonesSelected(boolean selected) {
+//        if (selected) {
+//            Cursor cursor = this.mMultiplePhoneSelectionActivity.mAdapter.getCursor();
+//            if (cursor != null) {
+//                int backupPos = cursor.getPosition();
+//                cursor.moveToPosition(-1);
+//                while (cursor.moveToNext()) {
+//                    setPhoneSelected(cursor
+//                            .getLong(MultiplePhonePickerActivity.PHONE_ID_COLUMN_INDEX), true);
+//                }
+//                cursor.moveToPosition(backupPos);
+//            }
+//            for (String number : this.mMultiplePhoneSelectionActivity.mPhoneNumberAdapter
+//                    .getFilteredPhoneNumbers()) {
+//                setPhoneSelected(number, true);
+//            }
+//        } else {
+//            mSelectedPhoneIds.clear();
+//            mSelectedPhoneNumbers.clear();
+//        }
+    }
+
+    public boolean isAllSelected() {
+        return false;
+//        return selectedCount() == this.mMultiplePhoneSelectionActivity.mPhoneNumberAdapter
+//                .getFilteredPhoneNumbers().size()
+//                + this.mMultiplePhoneSelectionActivity.mAdapter.getCount();
+    }
+
+    public Iterator<Long> getSelectedPhoneIds() {
+        return mSelectedPhoneIds.iterator();
+    }
+
+    @Override
+    public int getItemViewTypeCount() {
+        return 2;
+    }
+
+    @Override
+    public int getItemViewType(int position) {
+        return position < mPhoneNumbers.size() ? 0 : 1;
+    }
+
+    // TODO redo as two separate partitions
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        View view = null;
+//        if (convertView == null || convertView.getTag() == null) {
+//            view = newView(getContext(), null, parent);
+//        } else {
+//            view = convertView;
+//        }
+//
+//        boolean showingSuggestion = false;
+//
+//        if (position < mFilteredPhoneNumbers.size()) {
+//            bindExtraPhoneView(view, position);
+//        } else {
+//            Cursor cursor = ((Cursor)getItem(position));
+//            cursor.moveToPosition(position - mFilteredPhoneNumbers.size());
+//            bindView(view, getContext(), cursor);
+//        }
+        return view;
+    }
+
+    @Override
+    protected View newView(Context context, int partition, Cursor cursor, int position,
+            ViewGroup parent) {
+        final MultiplePhonePickerItemView view = new MultiplePhonePickerItemView(context, null);
+        view.setUnknownNameText(getUnknownNameText());
+        view.setTextWithHighlightingFactory(getTextWithHighlightingFactory());
+        return view;
+    }
+
+    private void bindExtraPhoneView(View itemView, int position) {
+        final MultiplePhonePickerItemView view = (MultiplePhonePickerItemView)itemView;
+        String phoneNumber = mFilteredPhoneNumbers.get(position);
+        view.getNameTextView().setText(phoneNumber);
+        CheckBox checkBox = view.getCheckBoxView();
+        checkBox.setChecked(isSelected(phoneNumber));
+        view.phoneId = INVALID_PHONE_ID;
+        view.phoneNumber = phoneNumber;
+    }
+
+    @Override
+    protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        super.bindView(itemView, partition, cursor, position);
+
+        final MultiplePhonePickerItemView view = (MultiplePhonePickerItemView)itemView;
+        view.phoneId = Long.valueOf(cursor.getLong(PHONE_ID_COLUMN_INDEX));
+        CheckBox checkBox = view.getCheckBoxView();
+        checkBox.setChecked(isSelected(view.phoneId));
+
+        long contactId = cursor.getLong(PHONE_CONTACT_ID_COLUMN_INDEX);
+        view.getChipView().setBackgroundResource(getChipColor(contactId));
+    }
+
+//    @Override
+//    protected void prepareEmptyView() {
+//        mMultiplePhonePickerActivity.mEmptyView.show(mMultiplePhonePickerActivity.mSearchMode,
+//                true, false, false, false, true, mMultiplePhonePickerActivity.mShowSelectedOnly);
+//    }
+
+    /**
+     * Get assigned chip color resource id for a given contact, 0 is returned if there is no mapped
+     * resource.
+     */
+    public int getChipColor(long contactId) {
+        return mContactColor.get((int)contactId);
+    }
+
+    // TODO filtering
+//    public void doFilter(final String constraint, boolean selectedOnly) {
+//        if (mPhoneNumbers == null) {
+//            return;
+//        }
+//        mFilteredPhoneNumbers.clear();
+//        for (String number : mPhoneNumbers) {
+//            if (selectedOnly && !mSelection.isSelected(number) ||
+//                    !TextUtils.isEmpty(constraint) && !number.startsWith(constraint)) {
+//                continue;
+//            }
+//            mFilteredPhoneNumbers.add(number);
+//        }
+//    }
+
+    @Override
+    public int getCount() {
+        return super.getCount() + mFilteredPhoneNumbers.size();
+    }
+
+    @Override
+    public void changeCursor(Cursor cursor) {
+        super.changeCursor(cursor);
+        updateChipColor(cursor);
+    }
+
+    /**
+     * Go through the cursor and assign the chip color to contact who has more
+     * than one phone numbers. Assume the cursor is clustered by CONTACT_ID.
+     */
+    public void updateChipColor(Cursor cursor) {
+        if (cursor == null || cursor.getCount() == 0) {
+            return;
+        }
+        mContactColor.clear();
+        cursor.moveToFirst();
+        int colorIndex = 0;
+        long prevContactId = cursor.getLong(PHONE_CONTACT_ID_COLUMN_INDEX);
+        while (cursor.moveToNext()) {
+            long contactId = cursor.getLong(PHONE_CONTACT_ID_COLUMN_INDEX);
+            if (prevContactId == contactId) {
+                if (mContactColor.indexOfKey((int)contactId) < 0) {
+                    mContactColor.put((int)contactId, CHIP_COLOR_ARRAY[colorIndex]);
+                    colorIndex++;
+                    if (colorIndex >= CHIP_COLOR_ARRAY.length) {
+                        colorIndex = 0;
+                    }
+                }
+            }
+            prevContactId = contactId;
+        }
+    }
+}
diff --git a/src/com/android/contacts/list/MultiplePhonePickerFragment.java b/src/com/android/contacts/list/MultiplePhonePickerFragment.java
new file mode 100644
index 0000000..bf75a9f
--- /dev/null
+++ b/src/com/android/contacts/list/MultiplePhonePickerFragment.java
@@ -0,0 +1,181 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+import com.android.contacts.list.MultiplePhonePickerAdapter.OnSelectionChangeListener;
+
+import android.app.Activity;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewStub;
+import android.view.View.OnClickListener;
+import android.view.animation.AnimationUtils;
+import android.widget.Button;
+
+/**
+ * Fragment for the multiple phone picker.
+ */
+public class MultiplePhonePickerFragment
+        extends ContactEntryListFragment<MultiplePhonePickerAdapter>
+        implements OnClickListener, OnSelectionChangeListener {
+
+    private static final String SELECTION_EXTRA_KEY = "selection";
+    private static final String SELECTION_CHANGED_EXTRA_KEY = "selectionChanged";
+
+    private OnMultiplePhoneNumberPickerActionListener mListener;
+
+    /**
+     * UI control of action panel in MODE_PICK_MULTIPLE_PHONES mode.
+     */
+    private View mFooterView;
+
+    private Uri[] mSelectedUris;
+    private boolean mSelectionChanged;
+
+    public MultiplePhonePickerFragment() {
+        setSectionHeaderDisplayEnabled(false);
+        setPhotoLoaderEnabled(true);
+    }
+
+    public void setOnMultiplePhoneNumberPickerActionListener(
+            OnMultiplePhoneNumberPickerActionListener listener) {
+        mListener = listener;
+    }
+
+    public Uri[] getSelectedUris() {
+        return getAdapter().getSelectedUris();
+    }
+
+    public void setSelectedUris(Parcelable[] extras) {
+        Uri[] uris = new Uri[extras == null ? 0 : extras.length];
+        if (extras != null) {
+            for (int i = 0; i < extras.length; i++) {
+                uris[i] = (Uri)extras[i];
+            }
+        }
+        setSelectedUris(uris);
+    }
+
+    public void setSelectedUris(Uri[] uris) {
+        mSelectedUris = uris;
+        MultiplePhonePickerAdapter adapter = getAdapter();
+        if (adapter != null) {
+            adapter.setSelectedUris(uris);
+        }
+    }
+
+    @Override
+    protected MultiplePhonePickerAdapter createListAdapter() {
+        return new MultiplePhonePickerAdapter(getActivity());
+    }
+
+    @Override
+    protected void configureAdapter() {
+        super.configureAdapter();
+        MultiplePhonePickerAdapter adapter = getAdapter();
+        adapter.setSelectedUris(mSelectedUris);
+        adapter.setSelectionChanged(mSelectionChanged);
+        adapter.setOnSelectionChangeListener(this);
+    }
+
+    @Override
+    protected View inflateView(LayoutInflater inflater, ViewGroup container) {
+        View view = inflater.inflate(R.layout.contacts_list_content, null);
+        ViewStub stub = (ViewStub)view.findViewById(R.id.footer_stub);
+        if (stub != null) {
+            View stubView = stub.inflate();
+            mFooterView = stubView.findViewById(R.id.footer);
+            mFooterView.setVisibility(View.GONE);
+            Button doneButton = (Button) stubView.findViewById(R.id.done);
+            doneButton.setOnClickListener(this);
+            Button revertButton = (Button) stubView.findViewById(R.id.revert);
+            revertButton.setOnClickListener(this);
+        }
+        return view;
+    }
+
+    @Override
+    protected void onItemClick(int position, long id) {
+        getAdapter().toggleSelection(position);
+    }
+
+    public void onClick(View v) {
+        int id = v.getId();
+        switch (id) {
+            case R.id.done:
+                mListener.onPhoneNumbersSelectedAction(getAdapter().getSelectedUris());
+                break;
+            case R.id.revert:
+                mListener.onFinishAction();
+                break;
+        }
+    }
+
+    @Override
+    public void onCreate(Bundle savedState) {
+        super.onCreate(savedState);
+        if (savedState != null) {
+            setSelectedUris(savedState.getParcelableArray(SELECTION_EXTRA_KEY));
+            mSelectionChanged = savedState.getBoolean(SELECTION_CHANGED_EXTRA_KEY, false);
+            if (getAdapter() != null) {
+                getAdapter().setSelectionChanged(mSelectionChanged);
+            }
+        }
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        updateWidgets();
+    }
+
+    public void onSelectionChange() {
+        updateWidgets();
+    }
+
+    private void updateWidgets() {
+        int selected = getAdapter().getSelectedCount();
+
+        Activity context = getActivity();
+        if (selected >= 1) {
+            final String format = context.getResources().getQuantityString(
+                    R.plurals.multiple_picker_title, selected);
+
+            // TODO: turn this into a callback
+            context.setTitle(String.format(format, selected));
+        } else {
+            // TODO: turn this into a callback
+            context.setTitle(context.getString(R.string.contactsList));
+        }
+
+        if (getAdapter().isSelectionChanged() && mFooterView.getVisibility() == View.GONE) {
+            mFooterView.setVisibility(View.VISIBLE);
+            mFooterView.startAnimation(AnimationUtils.loadAnimation(context, R.anim.footer_appear));
+        }
+    }
+
+    @Override
+    public void onSaveInstanceState(Bundle icicle) {
+        super.onSaveInstanceState(icicle);
+        icicle.putParcelableArray(SELECTION_EXTRA_KEY, getAdapter().getSelectedUris());
+        icicle.putBoolean(SELECTION_CHANGED_EXTRA_KEY, getAdapter().isSelectionChanged());
+    }
+}
diff --git a/src/com/android/contacts/list/MultiplePhonePickerItemView.java b/src/com/android/contacts/list/MultiplePhonePickerItemView.java
new file mode 100644
index 0000000..87f53bf
--- /dev/null
+++ b/src/com/android/contacts/list/MultiplePhonePickerItemView.java
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.CheckBox;
+
+/**
+ * A custom view for an item in the phone multi-picker list.
+ */
+public class MultiplePhonePickerItemView extends ContactListItemView {
+
+    // Used to indicate the sequence of phones belong to the same contact in multi-picker
+    private View mChipView;
+    // Used to select the phone in multi-picker
+    private CheckBox mCheckBox;
+
+    private int mChipWidth;
+    private int mChipRightMargin;
+    private int mCheckBoxMargin;
+
+    public long phoneId;
+    // phoneNumber only validates when phoneId = INVALID_PHONE_ID
+    public String phoneNumber;
+
+    public MultiplePhonePickerItemView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        TypedArray a = getContext().obtainStyledAttributes(
+                attrs, R.styleable.MultiplePhonePickerItemView);
+        mChipWidth = a.getDimensionPixelOffset(
+                R.styleable.MultiplePhonePickerItemView_list_item_header_chip_width, 0);
+        mChipRightMargin = a.getDimensionPixelOffset(
+                R.styleable.MultiplePhonePickerItemView_list_item_header_chip_right_margin, 0);
+        mCheckBoxMargin = a.getDimensionPixelOffset(
+                R.styleable.MultiplePhonePickerItemView_list_item_header_checkbox_margin, 0);
+        a.recycle();
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        if (isVisible(mChipView)) {
+            mChipView.measure(0, 0);
+        }
+
+        if (isVisible(mCheckBox)) {
+            mCheckBox.measure(0, 0);
+        }
+
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+    }
+
+    @Override
+    protected int layoutLeftSide(int height, int topBound, int bottomBound, int leftBound) {
+        if (mChipView != null) {
+            mChipView.layout(leftBound, topBound, leftBound + mChipWidth, height);
+            leftBound += mChipWidth + mChipRightMargin;
+        }
+
+        return super.layoutLeftSide(height, topBound, bottomBound, leftBound);
+    }
+
+    @Override
+    protected int layoutRightSide(int height, int topBound, int rightBound) {
+        rightBound = super.layoutRightSide(height, topBound, rightBound);
+
+        if (isVisible(mCheckBox)) {
+            int checkBoxWidth = mCheckBox.getMeasuredWidth();
+            int checkBoxHight = mCheckBox.getMeasuredHeight();
+            rightBound -= mCheckBoxMargin + checkBoxWidth;
+            int checkBoxTop = topBound + (height - topBound - checkBoxHight) / 2;
+            mCheckBox.layout(
+                    rightBound,
+                    checkBoxTop,
+                    rightBound + checkBoxWidth,
+                    checkBoxTop + checkBoxHight);
+        }
+
+        return rightBound;
+    }
+
+    /**
+     * Returns the chip view for the multipicker, creating it if necessary.
+     */
+    public View getChipView() {
+        if (mChipView == null) {
+            mChipView = new View(mContext);
+            addView(mChipView);
+        }
+        return mChipView;
+    }
+
+    /**
+     * Returns the CheckBox view for the multipicker, creating it if necessary.
+     */
+    public CheckBox getCheckBoxView() {
+        if (mCheckBox == null) {
+            mCheckBox = new CheckBox(mContext);
+            mCheckBox.setClickable(false);
+            mCheckBox.setFocusable(false);
+            addView(mCheckBox);
+        }
+        return mCheckBox;
+    }
+}
diff --git a/src/com/android/contacts/list/OnContactBrowserActionListener.java b/src/com/android/contacts/list/OnContactBrowserActionListener.java
new file mode 100644
index 0000000..239f8e1
--- /dev/null
+++ b/src/com/android/contacts/list/OnContactBrowserActionListener.java
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.net.Uri;
+
+/**
+ * Action callbacks that can be sent by a contact list.
+ */
+public interface OnContactBrowserActionListener  {
+
+    /**
+     * Opens the specified contact for viewing.
+     *
+     * @param contactLookupUri The lookup-uri of the Contact that should be opened
+     */
+    void onViewContactAction(Uri contactLookupUri);
+
+    /**
+     * Creates a new contact.
+     */
+    void onCreateNewContactAction();
+
+    /**
+     * Opens the specified contact for editing.
+     */
+    void onEditContactAction(Uri contactLookupUri);
+
+    /**
+     * Initiates the contact deletion process.
+     */
+    void onDeleteContactAction(Uri contactUri);
+
+    /**
+     * Adds the specified contact to favorites
+     */
+    void onAddToFavoritesAction(Uri contactUri);
+
+    /**
+     * Removes the specified contact from favorites.
+     */
+    void onRemoveFromFavoritesAction(Uri contactUri);
+
+    /**
+     * Places a call to the specified contact.
+     */
+    void onCallContactAction(Uri contactUri);
+
+    /**
+     * Initiates a text message to the specified contact.
+     */
+    void onSmsContactAction(Uri contactUri);
+
+    /**
+     * Closes the contact browser.
+     */
+    void onFinishAction();
+}
diff --git a/src/com/android/contacts/list/OnContactPickerActionListener.java b/src/com/android/contacts/list/OnContactPickerActionListener.java
new file mode 100644
index 0000000..1216888
--- /dev/null
+++ b/src/com/android/contacts/list/OnContactPickerActionListener.java
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.Intent;
+import android.net.Uri;
+
+/**
+ * Action callbacks that can be sent by a contact picker.
+ */
+public interface OnContactPickerActionListener  {
+
+    /**
+     * Creates a new contact and then returns it to the caller.
+     */
+    void onCreateNewContactAction();
+
+    /**
+     * Returns the selected contact to the requester.
+     */
+    void onPickContactAction(Uri contactUri);
+
+    /**
+     * Returns the selected contact as a shortcut intent.
+     */
+    void onShortcutIntentCreated(Intent intent);
+}
diff --git a/src/com/android/contacts/list/OnMultiplePhoneNumberPickerActionListener.java b/src/com/android/contacts/list/OnMultiplePhoneNumberPickerActionListener.java
new file mode 100644
index 0000000..ac010ba
--- /dev/null
+++ b/src/com/android/contacts/list/OnMultiplePhoneNumberPickerActionListener.java
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.net.Uri;
+
+/**
+ * Action callbacks that can be sent by a multiple phone number picker.
+ */
+public interface OnMultiplePhoneNumberPickerActionListener {
+
+    /**
+     * Returns the selected phone numbers to the requester.
+     */
+    void onPhoneNumbersSelectedAction(Uri[] dataUris);
+
+    /**
+     * Closes the picker without changing the selection.
+     */
+    void onFinishAction();
+}
diff --git a/src/com/android/contacts/list/OnPhoneNumberPickerActionListener.java b/src/com/android/contacts/list/OnPhoneNumberPickerActionListener.java
new file mode 100644
index 0000000..1a90122
--- /dev/null
+++ b/src/com/android/contacts/list/OnPhoneNumberPickerActionListener.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.Intent;
+import android.net.Uri;
+
+/**
+ * Action callbacks that can be sent by a phone number picker.
+ */
+public interface OnPhoneNumberPickerActionListener  {
+
+    /**
+     * Returns the selected phone number to the requester.
+     */
+    void onPickPhoneNumberAction(Uri dataUri);
+
+    /**
+     * Returns the selected number as a shortcut intent.
+     */
+    void onShortcutIntentCreated(Intent intent);
+}
diff --git a/src/com/android/contacts/list/OnPostalAddressPickerActionListener.java b/src/com/android/contacts/list/OnPostalAddressPickerActionListener.java
new file mode 100644
index 0000000..6ecde61
--- /dev/null
+++ b/src/com/android/contacts/list/OnPostalAddressPickerActionListener.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.net.Uri;
+
+/**
+ * Action callbacks that can be sent by a postal address picker.
+ */
+public interface OnPostalAddressPickerActionListener  {
+
+    /**
+     * Returns the selected phone number to the requester.
+     */
+    void onPickPostalAddressAction(Uri dataUri);
+}
diff --git a/src/com/android/contacts/list/PhoneNumberListAdapter.java b/src/com/android/contacts/list/PhoneNumberListAdapter.java
new file mode 100644
index 0000000..0bfd6dc
--- /dev/null
+++ b/src/com/android/contacts/list/PhoneNumberListAdapter.java
@@ -0,0 +1,220 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.database.Cursor;
+import android.net.Uri;
+import android.net.Uri.Builder;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.ContactCounts;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.Directory;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.text.TextUtils;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * A cursor adapter for the {@link Phone#CONTENT_TYPE} content type.
+ */
+public class PhoneNumberListAdapter extends ContactEntryListAdapter {
+
+    protected static final String[] PHONES_PROJECTION = new String[] {
+        Phone._ID,                          // 0
+        Phone.TYPE,                         // 1
+        Phone.LABEL,                        // 2
+        Phone.NUMBER,                       // 3
+        Phone.DISPLAY_NAME_PRIMARY,         // 4
+        Phone.DISPLAY_NAME_ALTERNATIVE,     // 5
+        Phone.CONTACT_ID,                   // 6
+        Phone.PHOTO_ID,                     // 7
+        Phone.PHONETIC_NAME,                // 8
+    };
+
+    protected static final int PHONE_ID_COLUMN_INDEX = 0;
+    protected static final int PHONE_TYPE_COLUMN_INDEX = 1;
+    protected static final int PHONE_LABEL_COLUMN_INDEX = 2;
+    protected static final int PHONE_NUMBER_COLUMN_INDEX = 3;
+    protected static final int PHONE_PRIMARY_DISPLAY_NAME_COLUMN_INDEX = 4;
+    protected static final int PHONE_ALTERNATIVE_DISPLAY_NAME_COLUMN_INDEX = 5;
+    protected static final int PHONE_CONTACT_ID_COLUMN_INDEX = 6;
+    protected static final int PHONE_PHOTO_ID_COLUMN_INDEX = 7;
+    protected static final int PHONE_PHONETIC_NAME_COLUMN_INDEX = 8;
+
+    private CharSequence mUnknownNameText;
+    private int mDisplayNameColumnIndex;
+    private int mAlternativeDisplayNameColumnIndex;
+    private boolean mVisibleContactsOnly = true;
+
+    public PhoneNumberListAdapter(Context context) {
+        super(context);
+
+        mUnknownNameText = context.getText(android.R.string.unknownName);
+    }
+
+    protected CharSequence getUnknownNameText() {
+        return mUnknownNameText;
+    }
+
+    public void setVisibleContactsOnly(boolean flag) {
+        mVisibleContactsOnly = flag;
+    }
+
+    @Override
+    public void configureLoader(CursorLoader loader, long directoryId) {
+        Uri uri;
+
+        if (isSearchMode()) {
+            String query = getQueryString();
+            Builder builder = Phone.CONTENT_FILTER_URI.buildUpon();
+            if (TextUtils.isEmpty(query)) {
+                builder.appendPath("");
+            } else {
+                builder.appendPath(query);      // Builder will encode the query
+            }
+
+            builder.appendQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY,
+                    String.valueOf(directoryId));
+            uri = builder.build();
+            // TODO a projection that includes the search snippet
+            loader.setProjection(PHONES_PROJECTION);
+        } else {
+            uri = Phone.CONTENT_URI;
+            loader.setProjection(PHONES_PROJECTION);
+        }
+
+        if (directoryId == Directory.DEFAULT) {
+            if (mVisibleContactsOnly) {
+                loader.setSelection(Contacts.IN_VISIBLE_GROUP + "=1");
+            }
+            if (isSectionHeaderDisplayEnabled()) {
+                uri = buildSectionIndexerUri(uri);
+            }
+        }
+
+        loader.setUri(uri);
+        if (getSortOrder() == ContactsContract.Preferences.SORT_ORDER_PRIMARY) {
+            loader.setSortOrder(Phone.SORT_KEY_PRIMARY);
+        } else {
+            loader.setSortOrder(Phone.SORT_KEY_ALTERNATIVE);
+        }
+    }
+
+    protected static Uri buildSectionIndexerUri(Uri uri) {
+        return uri.buildUpon()
+                .appendQueryParameter(ContactCounts.ADDRESS_BOOK_INDEX_EXTRAS, "true").build();
+    }
+
+    @Override
+    public String getContactDisplayName(int position) {
+        return ((Cursor)getItem(position)).getString(mDisplayNameColumnIndex);
+    }
+
+    @Override
+    public void setContactNameDisplayOrder(int displayOrder) {
+        super.setContactNameDisplayOrder(displayOrder);
+        if (getContactNameDisplayOrder() == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY) {
+            mDisplayNameColumnIndex = PHONE_PRIMARY_DISPLAY_NAME_COLUMN_INDEX;
+            mAlternativeDisplayNameColumnIndex = PHONE_ALTERNATIVE_DISPLAY_NAME_COLUMN_INDEX;
+        } else {
+            mDisplayNameColumnIndex = PHONE_ALTERNATIVE_DISPLAY_NAME_COLUMN_INDEX;
+            mAlternativeDisplayNameColumnIndex = PHONE_PRIMARY_DISPLAY_NAME_COLUMN_INDEX;
+        }
+    }
+
+    /**
+     * Builds a {@link Data#CONTENT_URI} for the given cursor position.
+     */
+    public Uri getDataUri(int position) {
+        Cursor cursor = ((Cursor)getItem(position));
+        long id = cursor.getLong(PHONE_ID_COLUMN_INDEX);
+        return ContentUris.withAppendedId(Data.CONTENT_URI, id);
+    }
+
+    @Override
+    protected View newView(Context context, int partition, Cursor cursor, int position,
+            ViewGroup parent) {
+        final ContactListItemView view = new ContactListItemView(context, null);
+        view.setUnknownNameText(mUnknownNameText);
+        view.setTextWithHighlightingFactory(getTextWithHighlightingFactory());
+        return view;
+    }
+
+    @Override
+    protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        ContactListItemView view = (ContactListItemView)itemView;
+        bindSectionHeaderAndDivider(view, position);
+        bindName(view, cursor);
+        bindPhoto(view, cursor);
+        bindPhoneNumber(view, cursor);
+    }
+
+    protected void bindPhoneNumber(ContactListItemView view, Cursor cursor) {
+        CharSequence label = null;
+        if (!cursor.isNull(PHONE_TYPE_COLUMN_INDEX)) {
+            final int type = cursor.getInt(PHONE_TYPE_COLUMN_INDEX);
+            final String customLabel = cursor.getString(PHONE_LABEL_COLUMN_INDEX);
+
+            // TODO cache
+            label = Phone.getTypeLabel(getContext().getResources(), type, customLabel);
+        }
+        view.setLabel(label);
+        view.showData(cursor, PHONE_NUMBER_COLUMN_INDEX);
+    }
+
+    protected void bindSectionHeaderAndDivider(final ContactListItemView view, int position) {
+        final int section = getSectionForPosition(position);
+        if (getPositionForSection(section) == position) {
+            String title = (String)getSections()[section];
+            view.setSectionHeader(title);
+        } else {
+            view.setDividerVisible(false);
+            view.setSectionHeader(null);
+        }
+
+        // move the divider for the last item in a section
+        if (getPositionForSection(section + 1) - 1 == position) {
+            view.setDividerVisible(false);
+        } else {
+            view.setDividerVisible(true);
+        }
+    }
+
+    protected void bindName(final ContactListItemView view, Cursor cursor) {
+        view.showDisplayName(cursor, mDisplayNameColumnIndex, isNameHighlightingEnabled(),
+                mAlternativeDisplayNameColumnIndex);
+        view.showPhoneticName(cursor, PHONE_PHONETIC_NAME_COLUMN_INDEX);
+    }
+
+    protected void bindPhoto(final ContactListItemView view, Cursor cursor) {
+        long photoId = 0;
+        if (!cursor.isNull(PHONE_PHOTO_ID_COLUMN_INDEX)) {
+            photoId = cursor.getLong(PHONE_PHOTO_ID_COLUMN_INDEX);
+        }
+
+        getPhotoLoader().loadPhoto(view.getPhotoView(), photoId);
+    }
+//
+//    protected void bindSearchSnippet(final ContactListItemView view, Cursor cursor) {
+//        view.showSnippet(cursor, SUMMARY_SNIPPET_MIMETYPE_COLUMN_INDEX,
+//                SUMMARY_SNIPPET_DATA1_COLUMN_INDEX, SUMMARY_SNIPPET_DATA4_COLUMN_INDEX);
+//    }
+
+}
diff --git a/src/com/android/contacts/list/PhoneNumberPickerFragment.java b/src/com/android/contacts/list/PhoneNumberPickerFragment.java
new file mode 100644
index 0000000..93b66ac
--- /dev/null
+++ b/src/com/android/contacts/list/PhoneNumberPickerFragment.java
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.R;
+import com.android.contacts.list.ShortcutIntentBuilder.OnShortcutIntentCreatedListener;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * Fragment containing a phone number list for picking.
+ */
+public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactEntryListAdapter>
+        implements OnShortcutIntentCreatedListener {
+    private OnPhoneNumberPickerActionListener mListener;
+    private String mShortcutAction;
+
+    public PhoneNumberPickerFragment() {
+        setPhotoLoaderEnabled(true);
+    }
+
+    public void setOnPhoneNumberPickerActionListener(OnPhoneNumberPickerActionListener listener) {
+        this.mListener = listener;
+    }
+
+    /**
+     * @param shortcutAction either {@link Intent#ACTION_CALL} or
+     *            {@link Intent#ACTION_SENDTO} or null.
+     */
+    public void setShortcutAction(String shortcutAction) {
+        this.mShortcutAction = shortcutAction;
+    }
+
+    @Override
+    protected void onItemClick(int position, long id) {
+        if (!isLegacyCompatibilityMode()) {
+            PhoneNumberListAdapter adapter = (PhoneNumberListAdapter)getAdapter();
+            pickPhoneNumber(adapter.getDataUri(position));
+        } else {
+            LegacyPhoneNumberListAdapter adapter = (LegacyPhoneNumberListAdapter)getAdapter();
+            pickPhoneNumber(adapter.getPhoneUri(position));
+        }
+    }
+
+    @Override
+    protected ContactEntryListAdapter createListAdapter() {
+        if (!isLegacyCompatibilityMode()) {
+            PhoneNumberListAdapter adapter = new PhoneNumberListAdapter(getActivity());
+            adapter.setDisplayPhotos(true);
+            return adapter;
+        } else {
+            LegacyPhoneNumberListAdapter adapter = new LegacyPhoneNumberListAdapter(getActivity());
+            adapter.setDisplayPhotos(true);
+            return adapter;
+        }
+    }
+
+    @Override
+    protected void configureAdapter() {
+        setSectionHeaderDisplayEnabled(!isSearchMode());
+        setAizyEnabled(!isSearchMode());
+        super.configureAdapter();
+    }
+
+    @Override
+    protected View inflateView(LayoutInflater inflater, ViewGroup container) {
+        return inflater.inflate(R.layout.contacts_list_content, null);
+    }
+
+    public void pickPhoneNumber(Uri uri) {
+        if (mShortcutAction == null) {
+            mListener.onPickPhoneNumberAction(uri);
+        } else {
+            if (isLegacyCompatibilityMode()) {
+                throw new UnsupportedOperationException();
+            }
+            ShortcutIntentBuilder builder = new ShortcutIntentBuilder(getActivity(), this);
+            builder.createPhoneNumberShortcutIntent(uri, mShortcutAction);
+        }
+    }
+
+    public void onShortcutIntentCreated(Uri uri, Intent shortcutIntent) {
+        mListener.onShortcutIntentCreated(shortcutIntent);
+    }
+
+    @Override
+    public void startSearch(String initialQuery) {
+        ContactsSearchManager.startSearchForResult(getActivity(), initialQuery,
+                ACTIVITY_REQUEST_CODE_PICKER, getContactsRequest());
+    }
+
+    @Override
+    public void onPickerResult(Intent data) {
+        mListener.onPickPhoneNumberAction(data.getData());
+    }
+}
diff --git a/src/com/android/contacts/list/PostalAddressListAdapter.java b/src/com/android/contacts/list/PostalAddressListAdapter.java
new file mode 100644
index 0000000..797089c
--- /dev/null
+++ b/src/com/android/contacts/list/PostalAddressListAdapter.java
@@ -0,0 +1,175 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.ContactCounts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * A cursor adapter for the {@link StructuredPostal#CONTENT_TYPE} content type.
+ */
+public class PostalAddressListAdapter extends ContactEntryListAdapter {
+
+    static final String[] POSTALS_PROJECTION = new String[] {
+        StructuredPostal._ID,                       // 0
+        StructuredPostal.TYPE,                      // 1
+        StructuredPostal.LABEL,                     // 2
+        StructuredPostal.DATA,                      // 3
+        StructuredPostal.DISPLAY_NAME_PRIMARY,      // 4
+        StructuredPostal.DISPLAY_NAME_ALTERNATIVE,  // 5
+        StructuredPostal.PHOTO_ID,                  // 6
+    };
+
+    protected static final int POSTAL_ID_COLUMN_INDEX = 0;
+    protected static final int POSTAL_TYPE_COLUMN_INDEX = 1;
+    protected static final int POSTAL_LABEL_COLUMN_INDEX = 2;
+    protected static final int POSTAL_ADDRESS_COLUMN_INDEX = 3;
+    protected static final int POSTAL_PRIMARY_DISPLAY_NAME_COLUMN_INDEX = 4;
+    protected static final int POSTAL_ALTERNATIVE_DISPLAY_NAME_COLUMN_INDEX = 5;
+    protected static final int POSTAL_PHOTO_ID_COLUMN_INDEX = 6;
+
+    private CharSequence mUnknownNameText;
+    private int mDisplayNameColumnIndex;
+    private int mAlternativeDisplayNameColumnIndex;
+
+    public PostalAddressListAdapter(Context context) {
+        super(context);
+
+        mUnknownNameText = context.getText(android.R.string.unknownName);
+    }
+
+    @Override
+    public void configureLoader(CursorLoader loader, long directoryId) {
+        loader.setUri(buildSectionIndexerUri(StructuredPostal.CONTENT_URI));
+        loader.setProjection(POSTALS_PROJECTION);
+
+        if (getSortOrder() == ContactsContract.Preferences.SORT_ORDER_PRIMARY) {
+            loader.setSortOrder(StructuredPostal.SORT_KEY_PRIMARY);
+        } else {
+            loader.setSortOrder(StructuredPostal.SORT_KEY_ALTERNATIVE);
+        }
+    }
+
+    protected static Uri buildSectionIndexerUri(Uri uri) {
+        return uri.buildUpon()
+                .appendQueryParameter(ContactCounts.ADDRESS_BOOK_INDEX_EXTRAS, "true").build();
+    }
+
+    @Override
+    public String getContactDisplayName(int position) {
+        return ((Cursor)getItem(position)).getString(mDisplayNameColumnIndex);
+    }
+
+    @Override
+    public void setContactNameDisplayOrder(int displayOrder) {
+        super.setContactNameDisplayOrder(displayOrder);
+        if (getContactNameDisplayOrder() == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY) {
+            mDisplayNameColumnIndex = POSTAL_PRIMARY_DISPLAY_NAME_COLUMN_INDEX;
+            mAlternativeDisplayNameColumnIndex = POSTAL_ALTERNATIVE_DISPLAY_NAME_COLUMN_INDEX;
+        } else {
+            mDisplayNameColumnIndex = POSTAL_ALTERNATIVE_DISPLAY_NAME_COLUMN_INDEX;
+            mAlternativeDisplayNameColumnIndex = POSTAL_PRIMARY_DISPLAY_NAME_COLUMN_INDEX;
+        }
+    }
+
+    /**
+     * Builds a {@link Data#CONTENT_URI} for the current cursor
+     * position.
+     */
+    public Uri getDataUri(int position) {
+        long id = ((Cursor)getItem(position)).getLong(POSTAL_ID_COLUMN_INDEX);
+        return ContentUris.withAppendedId(Data.CONTENT_URI, id);
+    }
+
+    @Override
+    protected View newView(Context context, int partition, Cursor cursor, int position,
+            ViewGroup parent) {
+        final ContactListItemView view = new ContactListItemView(context, null);
+        view.setUnknownNameText(mUnknownNameText);
+        view.setTextWithHighlightingFactory(getTextWithHighlightingFactory());
+        return view;
+    }
+
+    @Override
+    protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        ContactListItemView view = (ContactListItemView)itemView;
+        bindSectionHeaderAndDivider(view, position);
+        bindName(view, cursor);
+        bindPhoto(view, cursor);
+        bindPostalAddress(view, cursor);
+    }
+
+    protected void bindPostalAddress(ContactListItemView view, Cursor cursor) {
+        CharSequence label = null;
+        if (!cursor.isNull(POSTAL_TYPE_COLUMN_INDEX)) {
+            final int type = cursor.getInt(POSTAL_TYPE_COLUMN_INDEX);
+            final String customLabel = cursor.getString(POSTAL_LABEL_COLUMN_INDEX);
+
+            // TODO cache
+            label = StructuredPostal.getTypeLabel(getContext().getResources(), type, label);
+        }
+        view.setLabel(label);
+        view.showData(cursor, POSTAL_ADDRESS_COLUMN_INDEX);
+    }
+
+    protected void bindSectionHeaderAndDivider(final ContactListItemView view, int position) {
+        final int section = getSectionForPosition(position);
+        if (getPositionForSection(section) == position) {
+            String title = (String)getSections()[section];
+            view.setSectionHeader(title);
+        } else {
+            view.setDividerVisible(false);
+            view.setSectionHeader(null);
+        }
+
+        // move the divider for the last item in a section
+        if (getPositionForSection(section + 1) - 1 == position) {
+            view.setDividerVisible(false);
+        } else {
+            view.setDividerVisible(true);
+        }
+    }
+
+    protected void bindName(final ContactListItemView view, Cursor cursor) {
+        view.showDisplayName(cursor, mDisplayNameColumnIndex, isNameHighlightingEnabled(),
+                mAlternativeDisplayNameColumnIndex);
+//        view.showPhoneticName(cursor, PHONE_PHONETIC_NAME_COLUMN_INDEX);
+    }
+
+    protected void bindPhoto(final ContactListItemView view, Cursor cursor) {
+        long photoId = 0;
+        if (!cursor.isNull(POSTAL_PHOTO_ID_COLUMN_INDEX)) {
+            photoId = cursor.getLong(POSTAL_PHOTO_ID_COLUMN_INDEX);
+        }
+
+        getPhotoLoader().loadPhoto(view.getPhotoView(), photoId);
+    }
+//
+//    protected void bindSearchSnippet(final ContactListItemView view, Cursor cursor) {
+//        view.showSnippet(cursor, SUMMARY_SNIPPET_MIMETYPE_COLUMN_INDEX,
+//                SUMMARY_SNIPPET_DATA1_COLUMN_INDEX, SUMMARY_SNIPPET_DATA4_COLUMN_INDEX);
+//    }
+
+}
diff --git a/src/com/android/contacts/list/PostalAddressPickerFragment.java b/src/com/android/contacts/list/PostalAddressPickerFragment.java
new file mode 100644
index 0000000..1f07ce2
--- /dev/null
+++ b/src/com/android/contacts/list/PostalAddressPickerFragment.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+
+import android.net.Uri;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * Fragment containing a postal address list for picking.
+ */
+public class PostalAddressPickerFragment
+        extends ContactEntryListFragment<ContactEntryListAdapter> {
+    private OnPostalAddressPickerActionListener mListener;
+
+    public PostalAddressPickerFragment() {
+        setPhotoLoaderEnabled(true);
+        setSectionHeaderDisplayEnabled(true);
+    }
+
+    public void setOnPostalAddressPickerActionListener(
+            OnPostalAddressPickerActionListener listener) {
+        this.mListener = listener;
+    }
+
+    @Override
+    protected void onItemClick(int position, long id) {
+        if (!isLegacyCompatibilityMode()) {
+            PostalAddressListAdapter adapter = (PostalAddressListAdapter)getAdapter();
+//          if (adapter.isSearchAllContactsItemPosition(position)) {
+//              searchAllContacts();
+//          } else {
+            pickPostalAddress(adapter.getDataUri(position));
+//          }
+        } else {
+            LegacyPostalAddressListAdapter adapter = (LegacyPostalAddressListAdapter)getAdapter();
+            pickPostalAddress(adapter.getContactMethodUri(position));
+        }
+    }
+
+    @Override
+    protected ContactEntryListAdapter createListAdapter() {
+        if (!isLegacyCompatibilityMode()) {
+            PostalAddressListAdapter adapter = new PostalAddressListAdapter(getActivity());
+            adapter.setSectionHeaderDisplayEnabled(true);
+            adapter.setDisplayPhotos(true);
+            return adapter;
+        } else {
+            LegacyPostalAddressListAdapter adapter =
+                    new LegacyPostalAddressListAdapter(getActivity());
+            adapter.setSectionHeaderDisplayEnabled(false);
+            adapter.setDisplayPhotos(false);
+            return adapter;
+        }
+    }
+
+    @Override
+    protected View inflateView(LayoutInflater inflater, ViewGroup container) {
+        if (isSearchMode()) {
+            return inflater.inflate(R.layout.contacts_search_content, null);
+        } else {
+            return inflater.inflate(R.layout.contacts_list_content, null);
+        }
+    }
+
+    public void pickPostalAddress(Uri uri) {
+        mListener.onPickPostalAddressAction(uri);
+    }
+}
diff --git a/src/com/android/contacts/list/ProviderStatusLoader.java b/src/com/android/contacts/list/ProviderStatusLoader.java
new file mode 100644
index 0000000..2eb9672
--- /dev/null
+++ b/src/com/android/contacts/list/ProviderStatusLoader.java
@@ -0,0 +1,211 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.provider.ContactsContract.ProviderStatus;
+
+/**
+ * Checks provider status and configures a list adapter accordingly.
+ */
+public class ProviderStatusLoader {
+
+    private final Context mContext;
+
+    public ProviderStatusLoader(Context context) {
+        this.mContext = context;
+    }
+
+    public int getProviderStatus() {
+        // This query can be performed on the UI thread because
+        // the API explicitly allows such use.
+        Cursor cursor = mContext.getContentResolver().query(
+                ProviderStatus.CONTENT_URI,
+                new String[] { ProviderStatus.STATUS, ProviderStatus.DATA1 }, null, null, null);
+        if (cursor != null) {
+            try {
+                if (cursor.moveToFirst()) {
+                    return cursor.getInt(0);
+                }
+            } finally {
+                cursor.close();
+            }
+        }
+
+        return ProviderStatus.STATUS_NORMAL;
+    }
+
+
+//  View importFailureView = findViewById(R.id.import_failure);
+//  if (importFailureView == null) {
+//      return true;
+//  }
+//
+//  TextView messageView = (TextView) findViewById(R.id.emptyText);
+//
+//  // This query can be performed on the UI thread because
+//  // the API explicitly allows such use.
+//  Cursor cursor = getContentResolver().query(ProviderStatus.CONTENT_URI,
+//          new String[] { ProviderStatus.STATUS, ProviderStatus.DATA1 }, null, null, null);
+//  if (cursor != null) {
+//      try {
+//          if (cursor.moveToFirst()) {
+//              int status = cursor.getInt(0);
+//              if (status != mProviderStatus) {
+//                  mProviderStatus = status;
+//                  switch (status) {
+//                      case ProviderStatus.STATUS_NORMAL:
+//                          mAdapter.notifyDataSetInvalidated();
+//                          if (loadData) {
+//                              startQuery();
+//                          }
+//                          break;
+//
+//                      case ProviderStatus.STATUS_CHANGING_LOCALE:
+//                          messageView.setText(R.string.locale_change_in_progress);
+//                          mAdapter.changeCursor(null);
+//                          mAdapter.notifyDataSetInvalidated();
+//                          break;
+//
+//                      case ProviderStatus.STATUS_UPGRADING:
+//                          messageView.setText(R.string.upgrade_in_progress);
+//                          mAdapter.changeCursor(null);
+//                          mAdapter.notifyDataSetInvalidated();
+//                          break;
+//
+//                      case ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY:
+//                          long size = cursor.getLong(1);
+//                          String message = getResources().getString(
+//                                  R.string.upgrade_out_of_memory, new Object[] {size});
+//                          messageView.setText(message);
+//                          configureImportFailureView(importFailureView);
+//                          mAdapter.changeCursor(null);
+//                          mAdapter.notifyDataSetInvalidated();
+//                          break;
+//                  }
+//              }
+//          }
+//      } finally {
+//          cursor.close();
+//      }
+//  }
+//
+//  importFailureView.setVisibility(
+//          mProviderStatus == ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY
+//                  ? View.VISIBLE
+//                  : View.GONE);
+//  return mProviderStatus == ProviderStatus.STATUS_NORMAL;
+//}
+
+//
+//    /**
+//     * Obtains the contacts provider status and configures the UI accordingly.
+//     *
+//     * @param loadData true if the method needs to start a query when the
+//     *            provider is in the normal state
+//     * @return true if the provider status is normal
+//     */
+//    private boolean checkProviderState(boolean loadData) {
+//        View importFailureView = findViewById(R.id.import_failure);
+//        if (importFailureView == null) {
+//            return true;
+//        }
+//
+//        TextView messageView = (TextView) findViewById(R.id.emptyText);
+//
+//        // This query can be performed on the UI thread because
+//        // the API explicitly allows such use.
+//        Cursor cursor = getContentResolver().query(ProviderStatus.CONTENT_URI,
+//                new String[] { ProviderStatus.STATUS, ProviderStatus.DATA1 }, null, null, null);
+//        if (cursor != null) {
+//            try {
+//                if (cursor.moveToFirst()) {
+//                    int status = cursor.getInt(0);
+//                    if (status != mProviderStatus) {
+//                        mProviderStatus = status;
+//                        switch (status) {
+//                            case ProviderStatus.STATUS_NORMAL:
+//                                mAdapter.notifyDataSetInvalidated();
+//                                if (loadData) {
+//                                    startQuery();
+//                                }
+//                                break;
+//
+//                            case ProviderStatus.STATUS_CHANGING_LOCALE:
+//                                messageView.setText(R.string.locale_change_in_progress);
+//                                mAdapter.changeCursor(null);
+//                                mAdapter.notifyDataSetInvalidated();
+//                                break;
+//
+//                            case ProviderStatus.STATUS_UPGRADING:
+//                                messageView.setText(R.string.upgrade_in_progress);
+//                                mAdapter.changeCursor(null);
+//                                mAdapter.notifyDataSetInvalidated();
+//                                break;
+//
+//                            case ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY:
+//                                long size = cursor.getLong(1);
+//                                String message = getResources().getString(
+//                                        R.string.upgrade_out_of_memory, new Object[] {size});
+//                                messageView.setText(message);
+//                                configureImportFailureView(importFailureView);
+//                                mAdapter.changeCursor(null);
+//                                mAdapter.notifyDataSetInvalidated();
+//                                break;
+//                        }
+//                    }
+//                }
+//            } finally {
+//                cursor.close();
+//            }
+//        }
+//
+//        importFailureView.setVisibility(
+//                mProviderStatus == ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY
+//                        ? View.VISIBLE
+//                        : View.GONE);
+//        return mProviderStatus == ProviderStatus.STATUS_NORMAL;
+//    }
+//
+//    private void configureImportFailureView(View importFailureView) {
+//
+//        OnClickListener listener = new OnClickListener(){
+//
+//            public void onClick(View v) {
+//                switch(v.getId()) {
+//                    case R.id.import_failure_uninstall_apps: {
+//                        startActivity(new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS));
+//                        break;
+//                    }
+//                    case R.id.import_failure_retry_upgrade: {
+//                        // Send a provider status update, which will trigger a retry
+//                        ContentValues values = new ContentValues();
+//                        values.put(ProviderStatus.STATUS, ProviderStatus.STATUS_UPGRADING);
+//                        getContentResolver().update(ProviderStatus.CONTENT_URI, values, null, null);
+//                        break;
+//                    }
+//                }
+//            }};
+//
+//        Button uninstallApps = (Button) findViewById(R.id.import_failure_uninstall_apps);
+//        uninstallApps.setOnClickListener(listener);
+//
+//        Button retryUpgrade = (Button) findViewById(R.id.import_failure_retry_upgrade);
+//        retryUpgrade.setOnClickListener(listener);
+//    }
+
+}
diff --git a/src/com/android/contacts/list/ShortcutIntentBuilder.java b/src/com/android/contacts/list/ShortcutIntentBuilder.java
new file mode 100644
index 0000000..7a4f9de
--- /dev/null
+++ b/src/com/android/contacts/list/ShortcutIntentBuilder.java
@@ -0,0 +1,397 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+import com.android.contacts.util.Constants;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.Typeface;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+
+import java.util.Random;
+
+/**
+ * Constructs shortcut intents.
+ */
+public class ShortcutIntentBuilder {
+
+    private static final String[] CONTACT_COLUMNS = {
+        Contacts.DISPLAY_NAME,
+        Contacts.PHOTO_ID,
+    };
+
+    private static final int CONTACT_DISPLAY_NAME_COLUMN_INDEX = 0;
+    private static final int CONTACT_PHOTO_ID_COLUMN_INDEX = 1;
+
+    private static final String[] PHONE_COLUMNS = {
+        Phone.DISPLAY_NAME,
+        Phone.PHOTO_ID,
+        Phone.NUMBER,
+        Phone.TYPE,
+    };
+
+    private static final int PHONE_DISPLAY_NAME_COLUMN_INDEX = 0;
+    private static final int PHONE_PHOTO_ID_COLUMN_INDEX = 1;
+    private static final int PHONE_NUMBER_COLUMN_INDEX = 2;
+    private static final int PHONE_TYPE_COLUMN_INDEX = 3;
+
+    private static final String[] PHOTO_COLUMNS = {
+        Photo.PHOTO,
+    };
+
+    private static final int PHOTO_PHOTO_COLUMN_INDEX = 0;
+
+    private static final String PHOTO_SELECTION = Photo._ID + "=?";
+
+    private final OnShortcutIntentCreatedListener mListener;
+    private final Context mContext;
+    private final int mIconSize;
+
+    /**
+     * Listener interface.
+     */
+    public interface OnShortcutIntentCreatedListener {
+
+        /**
+         * Callback for shortcut intent creation.
+         *
+         * @param uri the original URI for which the shortcut intent has been
+         *            created.
+         * @param shortcutIntent resulting shortcut intent.
+         */
+        void onShortcutIntentCreated(Uri uri, Intent shortcutIntent);
+    }
+
+    public ShortcutIntentBuilder(Context context, OnShortcutIntentCreatedListener listener) {
+        mContext = context;
+        mListener = listener;
+
+        mIconSize = context.getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
+    }
+
+    public void createContactShortcutIntent(Uri contactUri) {
+        new ContactLoadingAsyncTask(contactUri).execute();
+    }
+
+    public void createPhoneNumberShortcutIntent(Uri dataUri, String shortcutAction) {
+        new PhoneNumberLoadingAsyncTask(dataUri, shortcutAction).execute();
+    }
+
+    /**
+     * An asynchronous task that loads name, photo and other data from the database.
+     */
+    private abstract class LoadingAsyncTask extends AsyncTask<Void, Void, Void> {
+        protected Uri mUri;
+        protected String mDisplayName;
+        protected byte[] mBitmapData;
+        protected long mPhotoId;
+
+        public LoadingAsyncTask(Uri uri) {
+            mUri = uri;
+        }
+
+        @Override
+        protected Void doInBackground(Void... params) {
+            loadData();
+            loadPhoto();
+            return null;
+        }
+
+        protected abstract void loadData();
+
+        private void loadPhoto() {
+            if (mPhotoId == 0) {
+                return;
+            }
+
+            ContentResolver resolver = mContext.getContentResolver();
+            Cursor cursor = resolver.query(Data.CONTENT_URI, PHOTO_COLUMNS, PHOTO_SELECTION,
+                    new String[] { String.valueOf(mPhotoId) }, null);
+            if (cursor != null) {
+                try {
+                    if (cursor.moveToFirst()) {
+                        mBitmapData = cursor.getBlob(PHOTO_PHOTO_COLUMN_INDEX);
+                    }
+                } finally {
+                    cursor.close();
+                }
+            }
+        }
+    }
+
+    private final class ContactLoadingAsyncTask extends LoadingAsyncTask {
+        public ContactLoadingAsyncTask(Uri uri) {
+            super(uri);
+        }
+
+        @Override
+        protected void loadData() {
+            ContentResolver resolver = mContext.getContentResolver();
+            Cursor cursor = resolver.query(mUri, CONTACT_COLUMNS, null, null, null);
+            if (cursor != null) {
+                try {
+                    if (cursor.moveToFirst()) {
+                        mDisplayName = cursor.getString(CONTACT_DISPLAY_NAME_COLUMN_INDEX);
+                        mPhotoId = cursor.getLong(CONTACT_PHOTO_ID_COLUMN_INDEX);
+                    }
+                } finally {
+                    cursor.close();
+                }
+            }
+        }
+        @Override
+        protected void onPostExecute(Void result) {
+            createContactShortcutIntent(mUri, mDisplayName, mBitmapData);
+        }
+    }
+
+    private final class PhoneNumberLoadingAsyncTask extends LoadingAsyncTask {
+        private final String mShortcutAction;
+        private String mPhoneNumber;
+        private int mPhoneType;
+
+        public PhoneNumberLoadingAsyncTask(Uri uri, String shortcutAction) {
+            super(uri);
+            mShortcutAction = shortcutAction;
+        }
+
+        @Override
+        protected void loadData() {
+            ContentResolver resolver = mContext.getContentResolver();
+            Cursor cursor = resolver.query(mUri, PHONE_COLUMNS, null, null, null);
+            if (cursor != null) {
+                try {
+                    if (cursor.moveToFirst()) {
+                        mDisplayName = cursor.getString(PHONE_DISPLAY_NAME_COLUMN_INDEX);
+                        mPhotoId = cursor.getLong(PHONE_PHOTO_ID_COLUMN_INDEX);
+                        mPhoneNumber = cursor.getString(PHONE_NUMBER_COLUMN_INDEX);
+                        mPhoneType = cursor.getInt(PHONE_TYPE_COLUMN_INDEX);
+                    }
+                } finally {
+                    cursor.close();
+                }
+            }
+        }
+
+        @Override
+        protected void onPostExecute(Void result) {
+            createPhoneNumberShortcutIntent(mUri, mDisplayName, mBitmapData, mPhoneNumber,
+                    mPhoneType, mShortcutAction);
+        }
+    }
+
+    private void createContactShortcutIntent(Uri contactUri, String displayName,
+            byte[] bitmapData) {
+        Bitmap bitmap;
+        if (bitmapData != null) {
+            bitmap = BitmapFactory.decodeByteArray(bitmapData, 0, bitmapData.length, null);
+        } else {
+            final int[] fallbacks = {
+                R.drawable.ic_contact_picture,
+                R.drawable.ic_contact_picture_2,
+                R.drawable.ic_contact_picture_3
+            };
+            bitmap = BitmapFactory.decodeResource(mContext.getResources(),
+                    fallbacks[new Random().nextInt(fallbacks.length)]);
+        }
+
+        Intent shortcutIntent;
+        // This is a simple shortcut to view a contact.
+        shortcutIntent = new Intent(ContactsContract.QuickContact.ACTION_QUICK_CONTACT);
+        shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
+                Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
+
+        shortcutIntent.setData(contactUri);
+        shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_MODE,
+                ContactsContract.QuickContact.MODE_LARGE);
+        shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_EXCLUDE_MIMES,
+                (String[]) null);
+        shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+
+        final Bitmap icon = scaleToAppIconSize(framePhoto(bitmap));
+
+        Intent intent = new Intent();
+        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
+        intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
+        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, displayName);
+
+        mListener.onShortcutIntentCreated(contactUri, intent);
+    }
+
+    private void createPhoneNumberShortcutIntent(Uri uri, String displayName, byte[] bitmapData,
+            String phoneNumber, int phoneType, String shortcutAction) {
+        Bitmap bitmap = null;
+        if (bitmapData != null) {
+            bitmap = BitmapFactory.decodeByteArray(bitmapData, 0, bitmapData.length, null);
+        }
+
+        Uri phoneUri;
+        if (Intent.ACTION_CALL.equals(shortcutAction)) {
+            // Make the URI a direct tel: URI so that it will always continue to work
+            phoneUri = Uri.fromParts(Constants.SCHEME_TEL, phoneNumber, null);
+            bitmap = generatePhoneNumberIcon(bitmap, phoneType, R.drawable.badge_action_call);
+        } else {
+            phoneUri = Uri.fromParts(Constants.SCHEME_SMSTO, phoneNumber, null);
+            bitmap = generatePhoneNumberIcon(bitmap, phoneType, R.drawable.badge_action_sms);
+        }
+
+        Intent shortcutIntent = new Intent(shortcutAction, phoneUri);
+        shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+
+        Intent intent = new Intent();
+        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, bitmap);
+        intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
+        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, displayName);
+
+        mListener.onShortcutIntentCreated(uri, intent);
+    }
+
+    private Bitmap framePhoto(Bitmap photo) {
+        final Resources r = mContext.getResources();
+        final Drawable frame = r.getDrawable(com.android.internal.R.drawable.quickcontact_badge);
+
+        final int width = r.getDimensionPixelSize(R.dimen.contact_shortcut_frame_width);
+        final int height = r.getDimensionPixelSize(R.dimen.contact_shortcut_frame_height);
+
+        frame.setBounds(0, 0, width, height);
+
+        final Rect padding = new Rect();
+        frame.getPadding(padding);
+
+        final Rect source = new Rect(0, 0, photo.getWidth(), photo.getHeight());
+        final Rect destination = new Rect(padding.left, padding.top,
+                width - padding.right, height - padding.bottom);
+
+        final int d = Math.max(width, height);
+        final Bitmap b = Bitmap.createBitmap(d, d, Bitmap.Config.ARGB_8888);
+        final Canvas c = new Canvas(b);
+
+        c.translate((d - width) / 2.0f, (d - height) / 2.0f);
+        frame.draw(c);
+        c.drawBitmap(photo, source, destination, new Paint(Paint.FILTER_BITMAP_FLAG));
+
+        return b;
+    }
+
+    private Bitmap scaleToAppIconSize(Bitmap photo) {
+
+        // Setup the drawing classes
+        Bitmap icon = Bitmap.createBitmap(mIconSize, mIconSize, Bitmap.Config.ARGB_8888);
+        Canvas canvas = new Canvas(icon);
+
+        // Copy in the photo
+        Paint photoPaint = new Paint();
+        photoPaint.setDither(true);
+        photoPaint.setFilterBitmap(true);
+        Rect src = new Rect(0,0, photo.getWidth(),photo.getHeight());
+        Rect dst = new Rect(0,0, mIconSize, mIconSize);
+        canvas.drawBitmap(photo, src, dst, photoPaint);
+
+        return icon;
+    }
+
+    /**
+     * Generates a phone number shortcut icon. Adds an overlay describing the type of the phone
+     * number, and if there is a photo also adds the call action icon.
+     */
+    private Bitmap generatePhoneNumberIcon(Bitmap photo, int phoneType, int actionResId) {
+        final Resources r = mContext.getResources();
+        boolean drawPhoneOverlay = true;
+        final float scaleDensity = r.getDisplayMetrics().scaledDensity;
+
+        Bitmap phoneIcon = ((BitmapDrawable) r.getDrawable(actionResId)).getBitmap();
+
+        // If there isn't a photo use the generic phone action icon instead
+        if (photo == null) {
+            photo = phoneIcon;
+            drawPhoneOverlay = false;
+        }
+
+        // Setup the drawing classes
+        Bitmap icon = Bitmap.createBitmap(mIconSize, mIconSize, Bitmap.Config.ARGB_8888);
+        Canvas canvas = new Canvas(icon);
+
+        // Copy in the photo
+        Paint photoPaint = new Paint();
+        photoPaint.setDither(true);
+        photoPaint.setFilterBitmap(true);
+        Rect src = new Rect(0, 0, photo.getWidth(), photo.getHeight());
+        Rect dst = new Rect(0, 0, mIconSize, mIconSize);
+        canvas.drawBitmap(photo, src, dst, photoPaint);
+
+        // Create an overlay for the phone number type
+        String overlay = null;
+        switch (phoneType) {
+            case Phone.TYPE_HOME:
+                overlay = mContext.getString(R.string.type_short_home);
+                break;
+
+            case Phone.TYPE_MOBILE:
+                overlay = mContext.getString(R.string.type_short_mobile);
+                break;
+
+            case Phone.TYPE_WORK:
+                overlay = mContext.getString(R.string.type_short_work);
+                break;
+
+            case Phone.TYPE_PAGER:
+                overlay = mContext.getString(R.string.type_short_pager);
+                break;
+
+            case Phone.TYPE_OTHER:
+                overlay = mContext.getString(R.string.type_short_other);
+                break;
+        }
+
+        if (overlay != null) {
+            Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);
+            textPaint.setTextSize(20.0f * scaleDensity);
+            textPaint.setTypeface(Typeface.DEFAULT_BOLD);
+            textPaint.setColor(r.getColor(R.color.textColorIconOverlay));
+            textPaint.setShadowLayer(3f, 1, 1, r.getColor(R.color.textColorIconOverlayShadow));
+            canvas.drawText(overlay, 2 * scaleDensity, 16 * scaleDensity, textPaint);
+        }
+
+        // Draw the phone action icon as an overlay
+        if (drawPhoneOverlay) {
+            src.set(0, 0, phoneIcon.getWidth(), phoneIcon.getHeight());
+            int iconWidth = icon.getWidth();
+            dst.set(iconWidth - ((int) (20 * scaleDensity)), -1,
+                    iconWidth, ((int) (19 * scaleDensity)));
+            canvas.drawBitmap(phoneIcon, src, dst, photoPaint);
+        }
+
+        return icon;
+    }
+}
diff --git a/src/com/android/contacts/list/StrequentContactListAdapter.java b/src/com/android/contacts/list/StrequentContactListAdapter.java
new file mode 100644
index 0000000..12c56f3
--- /dev/null
+++ b/src/com/android/contacts/list/StrequentContactListAdapter.java
@@ -0,0 +1,223 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+import com.android.contacts.util.PhoneCapabilityTester;
+
+import android.content.Context;
+import android.content.CursorLoader;
+import android.database.Cursor;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Contacts;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.View.OnClickListener;
+import android.widget.ListView;
+import android.widget.TextView;
+
+/**
+ * A cursor adapter for the {@link ContactsContract.Contacts#CONTENT_TYPE} content type loading
+ * a combination of starred and frequently contacted.
+ */
+public class StrequentContactListAdapter extends ContactListAdapter {
+
+    private int mFrequentSeparatorPos = ListView.INVALID_POSITION;
+    private TextView mSeparatorView;
+    private OnClickListener mCallButtonListener;
+    private int mCallButtonId;
+    private boolean mStarredContactsIncluded;
+    private boolean mFrequentlyContactedContactsIncluded;
+    private boolean mIsPhone;
+
+    public StrequentContactListAdapter(Context context, int callButtonId) {
+        super(context);
+        mCallButtonId = callButtonId;
+    }
+
+    public void setCallButtonListener(OnClickListener callButtonListener) {
+        mCallButtonListener = callButtonListener;
+    }
+
+    public void setStarredContactsIncluded(boolean flag) {
+        mStarredContactsIncluded = flag;
+    }
+
+    public void setFrequentlyContactedContactsIncluded(boolean flag) {
+        mFrequentlyContactedContactsIncluded = flag;
+    }
+
+    @Override
+    public void configureLoader(CursorLoader loader, long directoryId) {
+        String sortOrder = getSortOrder() == ContactsContract.Preferences.SORT_ORDER_PRIMARY
+                ? Contacts.SORT_KEY_PRIMARY
+                : Contacts.SORT_KEY_ALTERNATIVE;
+        if (mStarredContactsIncluded && mFrequentlyContactedContactsIncluded) {
+            loader.setUri(Contacts.CONTENT_STREQUENT_URI);
+        } else if (mStarredContactsIncluded) {
+            loader.setUri(Contacts.CONTENT_URI);
+            loader.setSelection(Contacts.STARRED + "!=0");
+        } else if (mFrequentlyContactedContactsIncluded) {
+            loader.setUri(Contacts.CONTENT_URI);
+            loader.setSelection(Contacts.TIMES_CONTACTED + " > 0");
+            sortOrder = Contacts.TIMES_CONTACTED + " DESC";
+        } else {
+            throw new UnsupportedOperationException("Neither StarredContactsIncluded nor "
+                    + "FrequentlyContactedContactsIncluded is set");
+        }
+
+        loader.setProjection(PROJECTION_CONTACT);
+        loader.setSortOrder(sortOrder);
+    }
+
+    @Override
+    protected void invalidate() {
+        super.invalidate();
+
+        // Sometimes the adapter is invalidated without calling changeCursor,
+        // need to reset the separator position then.
+        mFrequentSeparatorPos = ListView.INVALID_POSITION;
+        mIsPhone = PhoneCapabilityTester.isPhone(getContext());
+    }
+
+    @Override
+    public void changeCursor(int partition, Cursor cursor) {
+        super.changeCursor(partition, cursor);
+
+        // Get the split between starred and frequent items, if the mode is strequent
+        mFrequentSeparatorPos = ListView.INVALID_POSITION;
+
+        if (mStarredContactsIncluded && mFrequentlyContactedContactsIncluded) {
+            int count = 0;
+            if (cursor != null && (count = cursor.getCount()) > 0) {
+                cursor.moveToPosition(-1);
+                for (int i = 0; cursor.moveToNext(); i++) {
+                    int starred = cursor.getInt(CONTACT_STARRED_COLUMN_INDEX);
+                    if (starred == 0) {
+                        if (i > 0) {
+                            // Only add the separator when there are starred items present
+                            mFrequentSeparatorPos = i;
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public int getCount() {
+        if (mFrequentSeparatorPos == ListView.INVALID_POSITION) {
+            return super.getCount();
+        } else {
+            // Add a row for the separator
+            return super.getCount() + 1;
+        }
+    }
+
+    @Override
+    public boolean areAllItemsEnabled() {
+        return mFrequentSeparatorPos == ListView.INVALID_POSITION;
+    }
+
+    @Override
+    public boolean isEnabled(int position) {
+        return position != mFrequentSeparatorPos;
+    }
+
+    @Override
+    public Object getItem(int position) {
+        if (mFrequentSeparatorPos == ListView.INVALID_POSITION
+                || position < mFrequentSeparatorPos) {
+            return super.getItem(position);
+        } else {
+            return super.getItem(position - 1);
+        }
+    }
+
+    @Override
+    public long getItemId(int position) {
+        if (mFrequentSeparatorPos == ListView.INVALID_POSITION
+                || position < mFrequentSeparatorPos) {
+            return super.getItemId(position);
+        } else {
+            return super.getItemId(position - 1);
+        }
+    }
+
+    @Override
+    public int getItemViewType(int position) {
+        if (mFrequentSeparatorPos == ListView.INVALID_POSITION
+                || position < mFrequentSeparatorPos) {
+            return super.getItemViewType(position);
+        } else if (position == mFrequentSeparatorPos) {
+            return IGNORE_ITEM_VIEW_TYPE;
+        } else {
+            return super.getItemViewType(position - 1);
+        }
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        if (mFrequentSeparatorPos == ListView.INVALID_POSITION
+                || position < mFrequentSeparatorPos) {
+            return super.getView(position, convertView, parent);
+        } else if (position == mFrequentSeparatorPos) {
+            if (mSeparatorView == null) {
+                mSeparatorView = (TextView)LayoutInflater.from(getContext()).
+                        inflate(R.layout.list_separator, parent, false);
+                mSeparatorView.setText(R.string.favoritesFrquentSeparator);
+            }
+            return mSeparatorView;
+        } else {
+            return super.getView(position - 1, convertView, parent);
+        }
+    }
+
+    @Override
+    protected View newView(Context context, int partition, Cursor cursor, int position,
+            ViewGroup parent) {
+        ContactListItemView view = (ContactListItemView)super.newView(context, partition, cursor,
+                position, parent);
+        view.setOnCallButtonClickListener(mCallButtonListener);
+        return view;
+    }
+
+    @Override
+    protected void bindView(View itemView, int partition, Cursor cursor, int position) {
+        final ContactListItemView view = (ContactListItemView)itemView;
+
+        if (isSelectionVisible()) {
+            view.setActivated(isSelectedContact(partition, cursor));
+        }
+
+        bindName(view, cursor);
+        if (isQuickContactEnabled()) {
+            bindQuickContact(view, partition, cursor);
+        } else {
+            bindPhoto(view, partition, cursor);
+        }
+        bindPresence(view, cursor);
+
+        // Make the call button visible if requested.
+        if (mIsPhone && getHasPhoneNumber(position)) {
+            view.showCallButton(mCallButtonId, position);
+        } else {
+            view.hideCallButton();
+        }
+    }
+}
diff --git a/src/com/android/contacts/list/StrequentContactListFragment.java b/src/com/android/contacts/list/StrequentContactListFragment.java
new file mode 100644
index 0000000..393e698
--- /dev/null
+++ b/src/com/android/contacts/list/StrequentContactListFragment.java
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+package com.android.contacts.list;
+
+import com.android.contacts.R;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.View.OnClickListener;
+
+/**
+ * Fragment containing a list of starred contacts followed by a list of frequently contacted.
+ */
+public class StrequentContactListFragment extends ContactBrowseListFragment
+        implements OnClickListener {
+
+    private static final int CALL_BUTTON_ID = android.R.id.button1;
+
+    private boolean mStarredContactsIncluded = true;
+    private boolean mFrequentlyContactedContactsIncluded = true;
+
+    public StrequentContactListFragment() {
+        setSectionHeaderDisplayEnabled(false);
+        setPhotoLoaderEnabled(true);
+    }
+
+    @Override
+    protected boolean isNameHighlighingEnabled() {
+        // Since the list is not ordered alphabetically, we don't need to highlight the part
+        // that is used for sorting.
+        return false;
+    }
+
+    public void setStarredContactsIncluded(boolean flag) {
+        mStarredContactsIncluded = flag;
+        configureAdapter();
+    }
+
+    public void setFrequentlyContactedContactsIncluded(boolean flag) {
+        mFrequentlyContactedContactsIncluded = flag;
+        configureAdapter();
+    }
+
+    @Override
+    protected void onItemClick(int position, long id) {
+        ContactListAdapter adapter = getAdapter();
+        viewContact(adapter.getContactUri(position));
+    }
+
+    @Override
+    protected ContactListAdapter createListAdapter() {
+        StrequentContactListAdapter adapter =
+                new StrequentContactListAdapter(getActivity(), CALL_BUTTON_ID);
+        adapter.setSectionHeaderDisplayEnabled(false);
+        adapter.setDisplayPhotos(true);
+        adapter.setQuickContactEnabled(true);
+        adapter.setCallButtonListener(this);
+
+        return adapter;
+    }
+
+    @Override
+    protected void configureAdapter() {
+        super.configureAdapter();
+
+        StrequentContactListAdapter adapter = (StrequentContactListAdapter)getAdapter();
+        if (adapter != null) {
+            adapter.setStarredContactsIncluded(mStarredContactsIncluded);
+            adapter.setFrequentlyContactedContactsIncluded(mFrequentlyContactedContactsIncluded);
+        }
+    }
+
+    @Override
+    protected View inflateView(LayoutInflater inflater, ViewGroup container) {
+        return inflater.inflate(R.layout.contacts_list_content, null);
+    }
+
+    @Override
+    protected void prepareEmptyView() {
+        setEmptyText(R.string.noFavoritesHelpText);
+    }
+
+    @Override
+    public void onClick(View v) {
+        int id = v.getId();
+        switch (id) {
+            case CALL_BUTTON_ID: {
+                final int position = (Integer)v.getTag();
+                ContactListAdapter adapter = getAdapter();
+                callContact(adapter.getContactUri(position));
+                break;
+            }
+        }
+    }
+}
diff --git a/src/com/android/contacts/model/AccountTypes.java b/src/com/android/contacts/model/AccountTypes.java
new file mode 100644
index 0000000..acf9569
--- /dev/null
+++ b/src/com/android/contacts/model/AccountTypes.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright (C) 2009 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.contacts.model;
+
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.google.android.collect.Lists;
+import com.google.android.collect.Maps;
+import com.google.android.collect.Sets;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.AuthenticatorDescription;
+import android.accounts.OnAccountsUpdateListener;
+import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.IContentService;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.SyncAdapterType;
+import android.content.pm.PackageManager;
+import android.os.RemoteException;
+import android.provider.ContactsContract;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+
+/**
+ * Singleton holder for all parsed {@link BaseAccountType} available on the
+ * system, typically filled through {@link PackageManager} queries.
+ */
+public class AccountTypes extends BroadcastReceiver implements OnAccountsUpdateListener {
+    private static final String TAG = "AccountTypes";
+
+    private Context mContext;
+    private Context mApplicationContext;
+    private AccountManager mAccountManager;
+
+    private BaseAccountType mFallbackSource = null;
+
+    private HashMap<String, BaseAccountType> mSources = Maps.newHashMap();
+    private HashSet<String> mKnownPackages = Sets.newHashSet();
+
+    private static SoftReference<AccountTypes> sInstance = null;
+
+    /**
+     * Requests the singleton instance of {@link AccountTypes} with data bound from
+     * the available authenticators. This method can safely be called from the UI thread.
+     */
+    public static synchronized AccountTypes getInstance(Context context) {
+        AccountTypes sources = sInstance == null ? null : sInstance.get();
+        if (sources == null) {
+            sources = new AccountTypes(context);
+            sInstance = new SoftReference<AccountTypes>(sources);
+        }
+        return sources;
+    }
+
+    /**
+     * Internal constructor that only performs initial parsing.
+     */
+    private AccountTypes(Context context) {
+        mContext = context;
+        mApplicationContext = context.getApplicationContext();
+        mAccountManager = AccountManager.get(mApplicationContext);
+
+        // Create fallback contacts source for on-phone contacts
+        mFallbackSource = new FallbackAccountType();
+
+        queryAccounts();
+
+        // Request updates when packages or accounts change
+        IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
+        filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
+        filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
+        filter.addDataScheme("package");
+        mApplicationContext.registerReceiver(this, filter);
+        IntentFilter sdFilter = new IntentFilter();
+        sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
+        sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
+        mApplicationContext.registerReceiver(this, sdFilter);
+
+        // Request updates when locale is changed so that the order of each field will
+        // be able to be changed on the locale change.
+        filter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED);
+        mApplicationContext.registerReceiver(this, filter);
+
+        mAccountManager.addOnAccountsUpdatedListener(this, null, false);
+    }
+
+    /** @hide exposed for unit tests */
+    public AccountTypes(BaseAccountType... sources) {
+        for (BaseAccountType source : sources) {
+            addSource(source);
+        }
+    }
+
+    protected void addSource(BaseAccountType source) {
+        mSources.put(source.accountType, source);
+        mKnownPackages.add(source.resPackageName);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void onReceive(Context context, Intent intent) {
+        final String action = intent.getAction();
+
+        if (Intent.ACTION_PACKAGE_REMOVED.equals(action)
+                || Intent.ACTION_PACKAGE_ADDED.equals(action)
+                || Intent.ACTION_PACKAGE_CHANGED.equals(action) ||
+                Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(action) ||
+                Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(action)) {
+            String[] pkgList = null;
+            // Handle applications on sdcard.
+            if (Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(action) ||
+                    Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(action)) {
+                pkgList = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST);
+            } else {
+                final String packageName = intent.getData().getSchemeSpecificPart();
+                pkgList = new String[] { packageName };
+            }
+            if (pkgList != null) {
+                for (String packageName : pkgList) {
+                    final boolean knownPackage = mKnownPackages.contains(packageName);
+                    if (knownPackage) {
+                        // Invalidate cache of existing source
+                        invalidateCache(packageName);
+                    } else {
+                        // Unknown source, so reload from scratch
+                        queryAccounts();
+                    }
+                }
+            }
+        } else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
+            invalidateAllCache();
+        }
+    }
+
+    protected void invalidateCache(String packageName) {
+        for (BaseAccountType source : mSources.values()) {
+            if (TextUtils.equals(packageName, source.resPackageName)) {
+                // Invalidate any cache for the changed package
+                source.invalidateCache();
+            }
+        }
+    }
+
+    protected void invalidateAllCache() {
+        mFallbackSource.invalidateCache();
+        for (BaseAccountType source : mSources.values()) {
+            source.invalidateCache();
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void onAccountsUpdated(Account[] accounts) {
+        // Refresh to catch any changed accounts
+        queryAccounts();
+    }
+
+    /**
+     * Loads all {@link AuthenticatorDescription} known by the {@link AccountManager} on the system.
+     */
+    protected synchronized void queryAccounts() {
+        mSources.clear();
+        mKnownPackages.clear();
+
+        final AccountManager am = mAccountManager;
+        final IContentService cs = ContentResolver.getContentService();
+
+        try {
+            final SyncAdapterType[] syncs = cs.getSyncAdapterTypes();
+            final AuthenticatorDescription[] auths = am.getAuthenticatorTypes();
+
+            for (SyncAdapterType sync : syncs) {
+                if (!ContactsContract.AUTHORITY.equals(sync.authority)) {
+                    // Skip sync adapters that don't provide contact data.
+                    continue;
+                }
+
+                // Look for the formatting details provided by each sync
+                // adapter, using the authenticator to find general resources.
+                final String accountType = sync.accountType;
+                final AuthenticatorDescription auth = findAuthenticator(auths, accountType);
+
+                BaseAccountType source;
+                if (GoogleAccountType.ACCOUNT_TYPE.equals(accountType)) {
+                    source = new GoogleAccountType(auth.packageName);
+                } else if (ExchangeAccountType.ACCOUNT_TYPE.equals(accountType)) {
+                    source = new ExchangeAccountType(auth.packageName);
+                } else {
+                    // TODO: use syncadapter package instead, since it provides resources
+                    Log.d(TAG, "Creating external source for type=" + accountType
+                            + ", packageName=" + auth.packageName);
+                    source = new ExternalAccountType(auth.packageName);
+                    source.readOnly = !sync.supportsUploading();
+                }
+
+                source.accountType = auth.type;
+                source.titleRes = auth.labelId;
+                source.iconRes = auth.iconId;
+
+                addSource(source);
+            }
+        } catch (RemoteException e) {
+            Log.w(TAG, "Problem loading accounts: " + e.toString());
+        }
+    }
+
+    /**
+     * Find a specific {@link AuthenticatorDescription} in the provided list
+     * that matches the given account type.
+     */
+    protected static AuthenticatorDescription findAuthenticator(AuthenticatorDescription[] auths,
+            String accountType) {
+        for (AuthenticatorDescription auth : auths) {
+            if (accountType.equals(auth.type)) {
+                return auth;
+            }
+        }
+        throw new IllegalStateException("Couldn't find authenticator for specific account type");
+    }
+
+    /**
+     * Return list of all known, writable {@link BaseAccountType}. AccountTypes
+     * returned may require inflation before they can be used.
+     */
+    public ArrayList<Account> getAccounts(boolean writableOnly) {
+        final AccountManager am = mAccountManager;
+        final Account[] accounts = am.getAccounts();
+        final ArrayList<Account> matching = Lists.newArrayList();
+
+        for (Account account : accounts) {
+            // Ensure we have details loaded for each account
+            final BaseAccountType accountType = getInflatedSource(account.type,
+                    BaseAccountType.LEVEL_SUMMARY);
+            final boolean hasContacts = accountType != null;
+            final boolean matchesWritable =
+                    (!writableOnly || (writableOnly && !accountType.readOnly));
+            if (hasContacts && matchesWritable) {
+                matching.add(account);
+            }
+        }
+        return matching;
+    }
+
+    /**
+     * Find the best {@link DataKind} matching the requested
+     * {@link BaseAccountType#accountType} and {@link DataKind#mimeType}. If no
+     * direct match found, we try searching {@link #mFallbackSource}.
+     * When fourceRefresh is set to true, cache is refreshed and inflation of each
+     * EditField will occur.
+     */
+    public DataKind getKindOrFallback(String accountType, String mimeType, Context context,
+            int inflateLevel) {
+        DataKind kind = null;
+
+        // Try finding source and kind matching request
+        final BaseAccountType source = mSources.get(accountType);
+        if (source != null) {
+            source.ensureInflated(context, inflateLevel);
+            kind = source.getKindForMimetype(mimeType);
+        }
+
+        if (kind == null) {
+            // Nothing found, so try fallback as last resort
+            mFallbackSource.ensureInflated(context, inflateLevel);
+            kind = mFallbackSource.getKindForMimetype(mimeType);
+        }
+
+        if (kind == null) {
+            Log.w(TAG, "Unknown type=" + accountType + ", mime=" + mimeType);
+        }
+
+        return kind;
+    }
+
+    /**
+     * Return {@link BaseAccountType} for the given account type.
+     */
+    public BaseAccountType getInflatedSource(String accountType, int inflateLevel) {
+        // Try finding specific source, otherwise use fallback
+        BaseAccountType source = mSources.get(accountType);
+        if (source == null) source = mFallbackSource;
+
+        if (source.isInflated(inflateLevel)) {
+            // Already inflated, so return directly
+            return source;
+        } else {
+            // Not inflated, but requested that we force-inflate
+            source.ensureInflated(mContext, inflateLevel);
+            return source;
+        }
+    }
+}
diff --git a/src/com/android/contacts/model/BaseAccountType.java b/src/com/android/contacts/model/BaseAccountType.java
new file mode 100644
index 0000000..174195e
--- /dev/null
+++ b/src/com/android/contacts/model/BaseAccountType.java
@@ -0,0 +1,354 @@
+/*
+ * Copyright (C) 2009 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.contacts.model;
+
+import com.google.android.collect.Lists;
+import com.google.android.collect.Maps;
+
+import android.accounts.Account;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.database.Cursor;
+import android.graphics.drawable.Drawable;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.RawContacts;
+import android.view.View;
+import android.widget.EditText;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Internal structure that represents constraints and styles for a specific data
+ * source, such as the various data types they support, including details on how
+ * those types should be rendered and edited.
+ * <p>
+ * In the future this may be inflated from XML defined by a data source.
+ */
+public abstract class BaseAccountType {
+    /**
+     * The {@link RawContacts#ACCOUNT_TYPE} these constraints apply to.
+     */
+    public String accountType = null;
+
+    /**
+     * Package that resources should be loaded from, either defined through an
+     * {@link Account} or for matching against {@link Data#RES_PACKAGE}.
+     */
+    public String resPackageName;
+    public String summaryResPackageName;
+
+    public int titleRes;
+    public int iconRes;
+
+    public boolean readOnly;
+
+    /**
+     * Set of {@link DataKind} supported by this source.
+     */
+    private ArrayList<DataKind> mKinds = Lists.newArrayList();
+
+    /**
+     * Lookup map of {@link #mKinds} on {@link DataKind#mimeType}.
+     */
+    private HashMap<String, DataKind> mMimeKinds = Maps.newHashMap();
+
+    public static final int LEVEL_NONE = 0;
+    public static final int LEVEL_SUMMARY = 1;
+    public static final int LEVEL_MIMETYPES = 2;
+    public static final int LEVEL_CONSTRAINTS = 3;
+
+    private int mInflatedLevel = LEVEL_NONE;
+
+    public synchronized boolean isInflated(int inflateLevel) {
+        return mInflatedLevel >= inflateLevel;
+    }
+
+    /** @hide exposed for unit tests */
+    public void setInflatedLevel(int inflateLevel) {
+        mInflatedLevel = inflateLevel;
+    }
+
+    /**
+     * Ensure that this {@link BaseAccountType} has been inflated to the
+     * requested level.
+     */
+    public synchronized void ensureInflated(Context context, int inflateLevel) {
+        if (!isInflated(inflateLevel)) {
+            inflate(context, inflateLevel);
+        }
+    }
+
+    /**
+     * Perform the actual inflation to the requested level. Called by
+     * {@link #ensureInflated(Context, int)} when inflation is needed.
+     */
+    protected abstract void inflate(Context context, int inflateLevel);
+
+    /**
+     * Invalidate any cache for this {@link BaseAccountType}, removing all
+     * inflated data. Calling {@link #ensureInflated(Context, int)} will
+     * populate again from scratch.
+     */
+    public synchronized void invalidateCache() {
+        this.mKinds.clear();
+        this.mMimeKinds.clear();
+        setInflatedLevel(LEVEL_NONE);
+    }
+
+    public CharSequence getDisplayLabel(Context context) {
+        if (this.titleRes != -1 && this.summaryResPackageName != null) {
+            final PackageManager pm = context.getPackageManager();
+            return pm.getText(this.summaryResPackageName, this.titleRes, null);
+        } else if (this.titleRes != -1) {
+            return context.getText(this.titleRes);
+        } else {
+            return this.accountType;
+        }
+    }
+
+    public Drawable getDisplayIcon(Context context) {
+        if (this.titleRes != -1 && this.summaryResPackageName != null) {
+            final PackageManager pm = context.getPackageManager();
+            return pm.getDrawable(this.summaryResPackageName, this.iconRes, null);
+        } else if (this.titleRes != -1) {
+            return context.getResources().getDrawable(this.iconRes);
+        } else {
+            return null;
+        }
+    }
+
+    abstract public int getHeaderColor(Context context);
+
+    abstract public int getSideBarColor(Context context);
+
+    /**
+     * {@link Comparator} to sort by {@link DataKind#weight}.
+     */
+    private static Comparator<DataKind> sWeightComparator = new Comparator<DataKind>() {
+        public int compare(DataKind object1, DataKind object2) {
+            return object1.weight - object2.weight;
+        }
+    };
+
+    /**
+     * Return list of {@link DataKind} supported, sorted by
+     * {@link DataKind#weight}.
+     */
+    public ArrayList<DataKind> getSortedDataKinds() {
+        // TODO: optimize by marking if already sorted
+        Collections.sort(mKinds, sWeightComparator);
+        return mKinds;
+    }
+
+    /**
+     * Find the {@link DataKind} for a specific MIME-type, if it's handled by
+     * this data source. If you may need a fallback {@link DataKind}, use
+     * {@link AccountTypes#getKindOrFallback(String, String, Context, int)}.
+     */
+    public DataKind getKindForMimetype(String mimeType) {
+        return this.mMimeKinds.get(mimeType);
+    }
+
+    /**
+     * Add given {@link DataKind} to list of those provided by this source.
+     */
+    public DataKind addKind(DataKind kind) {
+        kind.resPackageName = this.resPackageName;
+        this.mKinds.add(kind);
+        this.mMimeKinds.put(kind.mimeType, kind);
+        return kind;
+    }
+
+    /**
+     * Description of a specific data type, usually marked by a unique
+     * {@link Data#MIMETYPE}. Includes details about how to view and edit
+     * {@link Data} rows of this kind, including the possible {@link EditType}
+     * labels and editable {@link EditField}.
+     */
+    public static class DataKind {
+        public String resPackageName;
+        public String mimeType;
+        public int titleRes;
+        public int iconRes;
+        public int iconAltRes;
+        public int weight;
+        public boolean secondary;
+        public boolean editable;
+
+        /**
+         * If this is true (default), the user can add and remove values.
+         * If false, the editor will always show a single field (which might be empty).
+         */
+        public boolean isList;
+
+        public StringInflater actionHeader;
+        public StringInflater actionAltHeader;
+        public StringInflater actionBody;
+
+        public boolean actionBodySocial = false;
+
+        public String typeColumn;
+
+        /**
+         * Maximum number of values allowed in the list. -1 represents infinity.
+         * If {@link DataKind#isList} is false, this value is ignored.
+         */
+        public int typeOverallMax;
+
+        public List<EditType> typeList;
+        public List<EditField> fieldList;
+
+        public ContentValues defaultValues;
+
+        public Class<? extends View> editorClass;
+
+        public DataKind() {
+        }
+
+        public DataKind(String mimeType, int titleRes, int iconRes, int weight, boolean editable) {
+            this(mimeType, titleRes, iconRes, weight, editable, null);
+        }
+
+        public DataKind(String mimeType, int titleRes, int iconRes, int weight, boolean editable,
+                Class<? extends View> editorClass) {
+            this.mimeType = mimeType;
+            this.titleRes = titleRes;
+            this.iconRes = iconRes;
+            this.weight = weight;
+            this.editable = editable;
+            this.isList = true;
+            this.typeOverallMax = -1;
+            this.editorClass = editorClass;
+        }
+    }
+
+    /**
+     * Description of a specific "type" or "label" of a {@link DataKind} row,
+     * such as {@link Phone#TYPE_WORK}. Includes constraints on total number of
+     * rows a {@link Contacts} may have of this type, and details on how
+     * user-defined labels are stored.
+     */
+    public static class EditType {
+        public int rawValue;
+        public int labelRes;
+//        public int actionRes;
+//        public int actionAltRes;
+        public boolean secondary;
+        public int specificMax;
+        public String customColumn;
+
+        public EditType(int rawValue, int labelRes) {
+            this.rawValue = rawValue;
+            this.labelRes = labelRes;
+            this.specificMax = -1;
+        }
+
+        public EditType setSecondary(boolean secondary) {
+            this.secondary = secondary;
+            return this;
+        }
+
+        public EditType setSpecificMax(int specificMax) {
+            this.specificMax = specificMax;
+            return this;
+        }
+
+        public EditType setCustomColumn(String customColumn) {
+            this.customColumn = customColumn;
+            return this;
+        }
+
+        @Override
+        public boolean equals(Object object) {
+            if (object instanceof EditType) {
+                final EditType other = (EditType)object;
+                return other.rawValue == rawValue;
+            }
+            return false;
+        }
+
+        @Override
+        public int hashCode() {
+            return rawValue;
+        }
+    }
+
+    /**
+     * Description of a user-editable field on a {@link DataKind} row, such as
+     * {@link Phone#NUMBER}. Includes flags to apply to an {@link EditText}, and
+     * the column where this field is stored.
+     */
+    public static class EditField {
+        public String column;
+        public int titleRes;
+        public int inputType;
+        public int minLines;
+        public boolean optional;
+        public boolean shortForm;
+        public boolean longForm;
+
+        public EditField(String column, int titleRes) {
+            this.column = column;
+            this.titleRes = titleRes;
+        }
+
+        public EditField(String column, int titleRes, int inputType) {
+            this(column, titleRes);
+            this.inputType = inputType;
+        }
+
+        public EditField setOptional(boolean optional) {
+            this.optional = optional;
+            return this;
+        }
+
+        public EditField setShortForm(boolean shortForm) {
+            this.shortForm = shortForm;
+            return this;
+        }
+
+        public EditField setLongForm(boolean longForm) {
+            this.longForm = longForm;
+            return this;
+        }
+
+        public EditField setMinLines(int minLines) {
+            this.minLines = minLines;
+            return this;
+        }
+    }
+
+    /**
+     * Generic method of inflating a given {@link Cursor} into a user-readable
+     * {@link CharSequence}. For example, an inflater could combine the multiple
+     * columns of {@link StructuredPostal} together using a string resource
+     * before presenting to the user.
+     */
+    public interface StringInflater {
+        public CharSequence inflateUsing(Context context, Cursor cursor);
+        public CharSequence inflateUsing(Context context, ContentValues values);
+    }
+
+}
diff --git a/src/com/android/contacts/model/ContactsSource.java b/src/com/android/contacts/model/ContactsSource.java
deleted file mode 100644
index d008482..0000000
--- a/src/com/android/contacts/model/ContactsSource.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.model;
-
-import com.google.android.collect.Lists;
-import com.google.android.collect.Maps;
-
-import android.accounts.Account;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.database.Cursor;
-import android.graphics.drawable.Drawable;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
-import android.widget.EditText;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * Internal structure that represents constraints and styles for a specific data
- * source, such as the various data types they support, including details on how
- * those types should be rendered and edited.
- * <p>
- * In the future this may be inflated from XML defined by a data source.
- */
-public abstract class ContactsSource {
-    /**
-     * The {@link RawContacts#ACCOUNT_TYPE} these constraints apply to.
-     */
-    public String accountType = null;
-
-    /**
-     * Package that resources should be loaded from, either defined through an
-     * {@link Account} or for matching against {@link Data#RES_PACKAGE}.
-     */
-    public String resPackageName;
-    public String summaryResPackageName;
-
-    public int titleRes;
-    public int iconRes;
-
-    public boolean readOnly;
-
-    /**
-     * Set of {@link DataKind} supported by this source.
-     */
-    private ArrayList<DataKind> mKinds = Lists.newArrayList();
-
-    /**
-     * Lookup map of {@link #mKinds} on {@link DataKind#mimeType}.
-     */
-    private HashMap<String, DataKind> mMimeKinds = Maps.newHashMap();
-
-    public static final int LEVEL_NONE = 0;
-    public static final int LEVEL_SUMMARY = 1;
-    public static final int LEVEL_MIMETYPES = 2;
-    public static final int LEVEL_CONSTRAINTS = 3;
-
-    private int mInflatedLevel = LEVEL_NONE;
-
-    public synchronized boolean isInflated(int inflateLevel) {
-        return mInflatedLevel >= inflateLevel;
-    }
-
-    /** @hide exposed for unit tests */
-    public void setInflatedLevel(int inflateLevel) {
-        mInflatedLevel = inflateLevel;
-    }
-
-    /**
-     * Ensure that this {@link ContactsSource} has been inflated to the
-     * requested level.
-     */
-    public synchronized void ensureInflated(Context context, int inflateLevel) {
-        if (!isInflated(inflateLevel)) {
-            inflate(context, inflateLevel);
-        }
-    }
-
-    /**
-     * Perform the actual inflation to the requested level. Called by
-     * {@link #ensureInflated(Context, int)} when inflation is needed.
-     */
-    protected abstract void inflate(Context context, int inflateLevel);
-
-    /**
-     * Invalidate any cache for this {@link ContactsSource}, removing all
-     * inflated data. Calling {@link #ensureInflated(Context, int)} will
-     * populate again from scratch.
-     */
-    public synchronized void invalidateCache() {
-        this.mKinds.clear();
-        this.mMimeKinds.clear();
-        setInflatedLevel(LEVEL_NONE);
-    }
-
-    public CharSequence getDisplayLabel(Context context) {
-        if (this.titleRes != -1 && this.summaryResPackageName != null) {
-            final PackageManager pm = context.getPackageManager();
-            return pm.getText(this.summaryResPackageName, this.titleRes, null);
-        } else if (this.titleRes != -1) {
-            return context.getText(this.titleRes);
-        } else {
-            return this.accountType;
-        }
-    }
-
-    public Drawable getDisplayIcon(Context context) {
-        if (this.titleRes != -1 && this.summaryResPackageName != null) {
-            final PackageManager pm = context.getPackageManager();
-            return pm.getDrawable(this.summaryResPackageName, this.iconRes, null);
-        } else if (this.titleRes != -1) {
-            return context.getResources().getDrawable(this.iconRes);
-        } else {
-            return null;
-        }
-    }
-
-    abstract public int getHeaderColor(Context context);
-
-    abstract public int getSideBarColor(Context context);
-
-    /**
-     * {@link Comparator} to sort by {@link DataKind#weight}.
-     */
-    private static Comparator<DataKind> sWeightComparator = new Comparator<DataKind>() {
-        public int compare(DataKind object1, DataKind object2) {
-            return object1.weight - object2.weight;
-        }
-    };
-
-    /**
-     * Return list of {@link DataKind} supported, sorted by
-     * {@link DataKind#weight}.
-     */
-    public ArrayList<DataKind> getSortedDataKinds() {
-        // TODO: optimize by marking if already sorted
-        Collections.sort(mKinds, sWeightComparator);
-        return mKinds;
-    }
-
-    /**
-     * Find the {@link DataKind} for a specific MIME-type, if it's handled by
-     * this data source. If you may need a fallback {@link DataKind}, use
-     * {@link Sources#getKindOrFallback(String, String, Context, int)}.
-     */
-    public DataKind getKindForMimetype(String mimeType) {
-        return this.mMimeKinds.get(mimeType);
-    }
-
-    /**
-     * Add given {@link DataKind} to list of those provided by this source.
-     */
-    public DataKind addKind(DataKind kind) {
-        kind.resPackageName = this.resPackageName;
-        this.mKinds.add(kind);
-        this.mMimeKinds.put(kind.mimeType, kind);
-        return kind;
-    }
-
-    /**
-     * Description of a specific data type, usually marked by a unique
-     * {@link Data#MIMETYPE}. Includes details about how to view and edit
-     * {@link Data} rows of this kind, including the possible {@link EditType}
-     * labels and editable {@link EditField}.
-     */
-    public static class DataKind {
-        public String resPackageName;
-        public String mimeType;
-        public int titleRes;
-        public int iconRes;
-        public int iconAltRes;
-        public int weight;
-        public boolean secondary;
-        public boolean editable;
-
-        /**
-         * If this is true (default), the user can add and remove values.
-         * If false, the editor will always show a single field (which might be empty).
-         */
-        public boolean isList;
-
-        public StringInflater actionHeader;
-        public StringInflater actionAltHeader;
-        public StringInflater actionBody;
-
-        public boolean actionBodySocial = false;
-
-        public String typeColumn;
-
-        /**
-         * Maximum number of values allowed in the list. -1 represents infinity.
-         * If {@link DataKind#isList} is false, this value is ignored.
-         */
-        public int typeOverallMax;
-
-        public List<EditType> typeList;
-        public List<EditField> fieldList;
-
-        public ContentValues defaultValues;
-
-        public DataKind() {
-        }
-
-        public DataKind(String mimeType, int titleRes, int iconRes, int weight, boolean editable) {
-            this.mimeType = mimeType;
-            this.titleRes = titleRes;
-            this.iconRes = iconRes;
-            this.weight = weight;
-            this.editable = editable;
-            this.isList = true;
-            this.typeOverallMax = -1;
-        }
-    }
-
-    /**
-     * Description of a specific "type" or "label" of a {@link DataKind} row,
-     * such as {@link Phone#TYPE_WORK}. Includes constraints on total number of
-     * rows a {@link Contacts} may have of this type, and details on how
-     * user-defined labels are stored.
-     */
-    public static class EditType {
-        public int rawValue;
-        public int labelRes;
-//        public int actionRes;
-//        public int actionAltRes;
-        public boolean secondary;
-        public int specificMax;
-        public String customColumn;
-
-        public EditType(int rawValue, int labelRes) {
-            this.rawValue = rawValue;
-            this.labelRes = labelRes;
-            this.specificMax = -1;
-        }
-
-        public EditType setSecondary(boolean secondary) {
-            this.secondary = secondary;
-            return this;
-        }
-
-        public EditType setSpecificMax(int specificMax) {
-            this.specificMax = specificMax;
-            return this;
-        }
-
-        public EditType setCustomColumn(String customColumn) {
-            this.customColumn = customColumn;
-            return this;
-        }
-
-        @Override
-        public boolean equals(Object object) {
-            if (object instanceof EditType) {
-                final EditType other = (EditType)object;
-                return other.rawValue == rawValue;
-            }
-            return false;
-        }
-
-        @Override
-        public int hashCode() {
-            return rawValue;
-        }
-    }
-
-    /**
-     * Description of a user-editable field on a {@link DataKind} row, such as
-     * {@link Phone#NUMBER}. Includes flags to apply to an {@link EditText}, and
-     * the column where this field is stored.
-     */
-    public static class EditField {
-        public String column;
-        public int titleRes;
-        public int inputType;
-        public int minLines;
-        public boolean optional;
-
-        public EditField(String column, int titleRes) {
-            this.column = column;
-            this.titleRes = titleRes;
-        }
-
-        public EditField(String column, int titleRes, int inputType) {
-            this(column, titleRes);
-            this.inputType = inputType;
-        }
-
-        public EditField setOptional(boolean optional) {
-            this.optional = optional;
-            return this;
-        }
-    }
-
-    /**
-     * Generic method of inflating a given {@link Cursor} into a user-readable
-     * {@link CharSequence}. For example, an inflater could combine the multiple
-     * columns of {@link StructuredPostal} together using a string resource
-     * before presenting to the user.
-     */
-    public interface StringInflater {
-        public CharSequence inflateUsing(Context context, Cursor cursor);
-        public CharSequence inflateUsing(Context context, ContentValues values);
-    }
-
-}
diff --git a/src/com/android/contacts/model/Editor.java b/src/com/android/contacts/model/Editor.java
deleted file mode 100644
index 473f0d3..0000000
--- a/src/com/android/contacts/model/Editor.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.model;
-
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.ui.ViewIdGenerator;
-
-import android.provider.ContactsContract.Data;
-
-/**
- * Generic definition of something that edits a {@link Data} row through an
- * {@link ValuesDelta} object.
- */
-public interface Editor {
-    /**
-     * Listener for an {@link Editor}, usually to handle deleted items.
-     */
-    public interface EditorListener {
-        /**
-         * Called when the given {@link Editor} has been deleted.
-         */
-        public void onDeleted(Editor editor);
-
-        /**
-         * Called when the given {@link Editor} has a request, for example it
-         * wants to select a photo.
-         */
-        public void onRequest(int request);
-
-        public static final int REQUEST_PICK_PHOTO = 1;
-        public static final int FIELD_CHANGED = 2;
-    }
-
-    /**
-     * Prepare this editor for the given {@link ValuesDelta}, which
-     * builds any needed views. Any changes performed by the user will be
-     * written back to that same object.
-     */
-    public void setValues(DataKind kind, ValuesDelta values, EntityDelta state, boolean readOnly,
-            ViewIdGenerator vig);
-
-    /**
-     * Add a specific {@link EditorListener} to this {@link Editor}.
-     */
-    public void setEditorListener(EditorListener listener);
-
-    /**
-     * Called internally when the contents of a specific field have changed,
-     * allowing advanced editors to persist data in a specific way.
-     */
-    public void onFieldChanged(String column, String value);
-}
diff --git a/src/com/android/contacts/model/EntityDelta.java b/src/com/android/contacts/model/EntityDelta.java
index cdf2e41..a1f3848 100644
--- a/src/com/android/contacts/model/EntityDelta.java
+++ b/src/com/android/contacts/model/EntityDelta.java
@@ -21,24 +21,23 @@
 import com.google.android.collect.Sets;
 
 import android.content.ContentProviderOperation;
+import android.content.ContentProviderOperation.Builder;
 import android.content.ContentValues;
 import android.content.Entity;
-import android.content.ContentProviderOperation.Builder;
 import android.content.Entity.NamedContentValues;
 import android.net.Uri;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.provider.BaseColumns;
-import android.provider.ContactsContract;
+import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
 import android.provider.ContactsContract.Data;
 import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
 import android.util.Log;
-import android.view.View;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -241,6 +240,18 @@
         return entry;
     }
 
+    public ArrayList<ContentValues> getContentValues() {
+        ArrayList<ContentValues> values = Lists.newArrayList();
+        for (ArrayList<ValuesDelta> mimeEntries : mEntries.values()) {
+            for (ValuesDelta entry : mimeEntries) {
+                if (!entry.isDelete()) {
+                    values.add(entry.getCompleteValues());
+                }
+            }
+        }
+        return values;
+    }
+
     /**
      * Find entry with the given {@link BaseColumns#_ID} value.
      */
@@ -578,6 +589,21 @@
             }
         }
 
+        public boolean isChanged(String key) {
+            if (mAfter == null || !mAfter.containsKey(key)) {
+                return false;
+            }
+
+            Object newValue = mAfter.get(key);
+            Object oldValue = mBefore.get(key);
+
+            if (oldValue == null) {
+                return newValue != null;
+            }
+
+            return !oldValue.equals(newValue);
+        }
+
         public String getMimetype() {
             return getAsString(Data.MIMETYPE);
         }
@@ -612,33 +638,45 @@
             return (mBefore != null && mBefore.containsKey(mIdColumn));
         }
 
+        /**
+         * When "after" is present, then visible
+         */
         public boolean isVisible() {
-            // When "after" is present, then visible
             return (mAfter != null);
         }
 
+        /**
+         * When "after" is wiped, action is "delete"
+         */
         public boolean isDelete() {
-            // When "after" is wiped, action is "delete"
             return beforeExists() && (mAfter == null);
         }
 
+        /**
+         * When no "before" or "after", is transient
+         */
         public boolean isTransient() {
-            // When no "before" or "after", is transient
             return (mBefore == null) && (mAfter == null);
         }
 
+        /**
+         * When "after" has some changes, action is "update"
+         */
         public boolean isUpdate() {
-            // When "after" has some changes, action is "update"
             return beforeExists() && (mAfter != null && mAfter.size() > 0);
         }
 
+        /**
+         * When "after" has no changes, action is no-op
+         */
         public boolean isNoop() {
-            // When "after" has no changes, action is no-op
             return beforeExists() && (mAfter != null && mAfter.size() == 0);
         }
 
+        /**
+         * When no "before" id, and has "after", action is "insert"
+         */
         public boolean isInsert() {
-            // When no "before" id, and has "after", action is "insert"
             return !beforeExists() && (mAfter != null);
         }
 
@@ -670,6 +708,16 @@
             mAfter.put(key, value);
         }
 
+        public void put(String key, long value) {
+            ensureUpdate();
+            mAfter.put(key, value);
+        }
+
+        public void putNull(String key) {
+            ensureUpdate();
+            mAfter.putNull(key);
+        }
+
         /**
          * Return set of all keys defined through this object.
          */
diff --git a/src/com/android/contacts/model/EntityDeltaList.java b/src/com/android/contacts/model/EntityDeltaList.java
new file mode 100644
index 0000000..455cced
--- /dev/null
+++ b/src/com/android/contacts/model/EntityDeltaList.java
@@ -0,0 +1,385 @@
+/*
+ * Copyright (C) 2009 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.contacts.model;
+
+import android.content.ContentProviderOperation;
+import android.content.ContentResolver;
+import android.content.Entity;
+import android.content.EntityIterator;
+import android.content.ContentProviderOperation.Builder;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.provider.ContactsContract.AggregationExceptions;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.RawContacts;
+import android.provider.ContactsContract.RawContactsEntity;
+
+import com.google.android.collect.Lists;
+
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Container for multiple {@link EntityDelta} objects, usually when editing
+ * together as an entire aggregate. Provides convenience methods for parceling
+ * and applying another {@link EntityDeltaList} over it.
+ */
+public class EntityDeltaList extends ArrayList<EntityDelta> implements Parcelable {
+    private boolean mSplitRawContacts;
+    private List<Long> mJoinWithRawContactIds;
+
+    private EntityDeltaList() {
+    }
+
+    /**
+     * Create an {@link EntityDeltaList} that contains the given {@link EntityDelta},
+     * usually when inserting a new {@link Contacts} entry.
+     */
+    public static EntityDeltaList fromSingle(EntityDelta delta) {
+        final EntityDeltaList state = new EntityDeltaList();
+        state.add(delta);
+        return state;
+    }
+
+    /**
+     * Create an {@link EntityDeltaList} based on {@link Contacts} specified by the
+     * given query parameters. This closes the {@link EntityIterator} when
+     * finished, so it doesn't subscribe to updates.
+     */
+    public static EntityDeltaList fromQuery(ContentResolver resolver, String selection,
+            String[] selectionArgs, String sortOrder) {
+        final EntityIterator iterator = RawContacts.newEntityIterator(resolver.query(
+                RawContactsEntity.CONTENT_URI, null, selection, selectionArgs,
+                sortOrder));
+        try {
+            return fromIterator(iterator);
+        } finally {
+            iterator.close();
+        }
+    }
+
+    /**
+     * Create an {@link EntityDeltaList} that contains the entities of the Iterator as before
+     * values.
+     */
+    public static EntityDeltaList fromIterator(Iterator<Entity> iterator) {
+        final EntityDeltaList state = new EntityDeltaList();
+        // Perform background query to pull contact details
+        while (iterator.hasNext()) {
+            // Read all contacts into local deltas to prepare for edits
+            final Entity before = iterator.next();
+            final EntityDelta entity = EntityDelta.fromBefore(before);
+            state.add(entity);
+        }
+        return state;
+    }
+
+    /**
+     * Merge the "after" values from the given {@link EntityDeltaList}, discarding any
+     * previous "after" states. This is typically used when re-parenting user
+     * edits onto an updated {@link EntityDeltaList}.
+     */
+    public static EntityDeltaList mergeAfter(EntityDeltaList local, EntityDeltaList remote) {
+        if (local == null) local = new EntityDeltaList();
+
+        // For each entity in the remote set, try matching over existing
+        for (EntityDelta remoteEntity : remote) {
+            final Long rawContactId = remoteEntity.getValues().getId();
+
+            // Find or create local match and merge
+            final EntityDelta localEntity = local.getByRawContactId(rawContactId);
+            final EntityDelta merged = EntityDelta.mergeAfter(localEntity, remoteEntity);
+
+            if (localEntity == null && merged != null) {
+                // No local entry before, so insert
+                local.add(merged);
+            }
+        }
+
+        return local;
+    }
+
+    /**
+     * Build a list of {@link ContentProviderOperation} that will transform all
+     * the "before" {@link Entity} states into the modified state which all
+     * {@link EntityDelta} objects represent. This method specifically creates
+     * any {@link AggregationExceptions} rules needed to groups edits together.
+     */
+    public ArrayList<ContentProviderOperation> buildDiff() {
+        final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
+
+        final long rawContactId = this.findRawContactId();
+        int firstInsertRow = -1;
+
+        // First pass enforces versions remain consistent
+        for (EntityDelta delta : this) {
+            delta.buildAssert(diff);
+        }
+
+        final int assertMark = diff.size();
+        int backRefs[] = new int[size()];
+
+        int rawContactIndex = 0;
+
+        // Second pass builds actual operations
+        for (EntityDelta delta : this) {
+            final int firstBatch = diff.size();
+            final boolean isInsert = delta.isContactInsert();
+            backRefs[rawContactIndex++] = isInsert ? firstBatch : -1;
+
+            delta.buildDiff(diff);
+
+            // If the user chose to join with some other existing raw contact(s) at save time,
+            // add aggregation exceptions for all those raw contacts.
+            if (mJoinWithRawContactIds != null) {
+                for (Long joinedRawContactId : mJoinWithRawContactIds) {
+                    final Builder builder = beginKeepTogether();
+                    builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, joinedRawContactId);
+                    if (rawContactId != -1) {
+                        builder.withValue(AggregationExceptions.RAW_CONTACT_ID2, rawContactId);
+                    } else {
+                        builder.withValueBackReference(
+                                AggregationExceptions.RAW_CONTACT_ID2, firstBatch);
+                    }
+                    diff.add(builder.build());
+                }
+            }
+
+            // Only create rules for inserts
+            if (!isInsert) continue;
+
+            // If we are going to split all contacts, there is no point in first combining them
+            if (mSplitRawContacts) continue;
+
+            if (rawContactId != -1) {
+                // Has existing contact, so bind to it strongly
+                final Builder builder = beginKeepTogether();
+                builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, rawContactId);
+                builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID2, firstBatch);
+                diff.add(builder.build());
+
+            } else if (firstInsertRow == -1) {
+                // First insert case, so record row
+                firstInsertRow = firstBatch;
+
+            } else {
+                // Additional insert case, so point at first insert
+                final Builder builder = beginKeepTogether();
+                builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID1,
+                        firstInsertRow);
+                builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID2, firstBatch);
+                diff.add(builder.build());
+            }
+        }
+
+        if (mSplitRawContacts) {
+            buildSplitContactDiff(diff, backRefs);
+        }
+
+        // No real changes if only left with asserts
+        if (diff.size() == assertMark) {
+            diff.clear();
+        }
+
+        return diff;
+    }
+
+    /**
+     * Start building a {@link ContentProviderOperation} that will keep two
+     * {@link RawContacts} together.
+     */
+    protected Builder beginKeepTogether() {
+        final Builder builder = ContentProviderOperation
+                .newUpdate(AggregationExceptions.CONTENT_URI);
+        builder.withValue(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_TOGETHER);
+        return builder;
+    }
+
+    /**
+     * Builds {@link AggregationExceptions} to split all constituent raw contacts into
+     * separate contacts.
+     */
+    private void buildSplitContactDiff(final ArrayList<ContentProviderOperation> diff,
+            int[] backRefs) {
+        int count = size();
+        for (int i = 0; i < count; i++) {
+            for (int j = 0; j < count; j++) {
+                if (i != j) {
+                    buildSplitContactDiff(diff, i, j, backRefs);
+                }
+            }
+        }
+    }
+
+    /**
+     * Construct a {@link AggregationExceptions#TYPE_KEEP_SEPARATE}.
+     */
+    private void buildSplitContactDiff(ArrayList<ContentProviderOperation> diff, int index1,
+            int index2, int[] backRefs) {
+        Builder builder =
+                ContentProviderOperation.newUpdate(AggregationExceptions.CONTENT_URI);
+        builder.withValue(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_SEPARATE);
+
+        Long rawContactId1 = get(index1).getValues().getAsLong(RawContacts._ID);
+        int backRef1 = backRefs[index1];
+        if (rawContactId1 != null && rawContactId1 >= 0) {
+            builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, rawContactId1);
+        } else if (backRef1 >= 0) {
+            builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID1, backRef1);
+        } else {
+            return;
+        }
+
+        Long rawContactId2 = get(index2).getValues().getAsLong(RawContacts._ID);
+        int backRef2 = backRefs[index2];
+        if (rawContactId2 != null && rawContactId2 >= 0) {
+            builder.withValue(AggregationExceptions.RAW_CONTACT_ID2, rawContactId2);
+        } else if (backRef2 >= 0) {
+            builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID2, backRef2);
+        } else {
+            return;
+        }
+
+        diff.add(builder.build());
+    }
+
+    /**
+     * Search all contained {@link EntityDelta} for the first one with an
+     * existing {@link RawContacts#_ID} value. Usually used when creating
+     * {@link AggregationExceptions} during an update.
+     */
+    public long findRawContactId() {
+        for (EntityDelta delta : this) {
+            final Long rawContactId = delta.getValues().getAsLong(RawContacts._ID);
+            if (rawContactId != null && rawContactId >= 0) {
+                return rawContactId;
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Find {@link RawContacts#_ID} of the requested {@link EntityDelta}.
+     */
+    public Long getRawContactId(int index) {
+        if (index >= 0 && index < this.size()) {
+            final EntityDelta delta = this.get(index);
+            final ValuesDelta values = delta.getValues();
+            if (values.isVisible()) {
+                return values.getAsLong(RawContacts._ID);
+            }
+        }
+        return null;
+    }
+
+    public EntityDelta getByRawContactId(Long rawContactId) {
+        final int index = this.indexOfRawContactId(rawContactId);
+        return (index == -1) ? null : this.get(index);
+    }
+
+    /**
+     * Find index of given {@link RawContacts#_ID} when present.
+     */
+    public int indexOfRawContactId(Long rawContactId) {
+        if (rawContactId == null) return -1;
+        final int size = this.size();
+        for (int i = 0; i < size; i++) {
+            final Long currentId = getRawContactId(i);
+            if (rawContactId.equals(currentId)) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    public ValuesDelta getSuperPrimaryEntry(final String mimeType) {
+        ValuesDelta primary = null;
+        ValuesDelta randomEntry = null;
+        for (EntityDelta delta : this) {
+            final ArrayList<ValuesDelta> mimeEntries = delta.getMimeEntries(mimeType);
+            if (mimeEntries == null) return null;
+
+            for (ValuesDelta entry : mimeEntries) {
+                if (entry.isSuperPrimary()) {
+                    return entry;
+                } else if (primary == null && entry.isPrimary()) {
+                    primary = entry;
+                } else if (randomEntry == null) {
+                    randomEntry = entry;
+                }
+            }
+        }
+        // When no direct super primary, return something
+        if (primary != null) {
+            return primary;
+        }
+        return randomEntry;
+    }
+
+    /**
+     * Sets a flag that will split ("explode") the raw_contacts into seperate contacts
+     */
+    public void markRawContactsForSplitting() {
+        mSplitRawContacts = true;
+    }
+
+    public void setJoinWithRawContacts(List<Long> rawContactIds) {
+        mJoinWithRawContactIds = rawContactIds;
+    }
+
+    /** {@inheritDoc} */
+    public int describeContents() {
+        // Nothing special about this parcel
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    public void writeToParcel(Parcel dest, int flags) {
+        final int size = this.size();
+        dest.writeInt(size);
+        for (EntityDelta delta : this) {
+            dest.writeParcelable(delta, flags);
+        }
+        dest.writeList(mJoinWithRawContactIds);
+    }
+
+    @SuppressWarnings("unchecked")
+    public void readFromParcel(Parcel source) {
+        final ClassLoader loader = getClass().getClassLoader();
+        final int size = source.readInt();
+        for (int i = 0; i < size; i++) {
+            this.add(source.<EntityDelta> readParcelable(loader));
+        }
+        mJoinWithRawContactIds = source.readArrayList(loader);
+    }
+
+    public static final Parcelable.Creator<EntityDeltaList> CREATOR =
+            new Parcelable.Creator<EntityDeltaList>() {
+        public EntityDeltaList createFromParcel(Parcel in) {
+            final EntityDeltaList state = new EntityDeltaList();
+            state.readFromParcel(in);
+            return state;
+        }
+
+        public EntityDeltaList[] newArray(int size) {
+            return new EntityDeltaList[size];
+        }
+    };
+}
diff --git a/src/com/android/contacts/model/EntityDiff.java b/src/com/android/contacts/model/EntityDiff.java
deleted file mode 100644
index ea46567..0000000
--- a/src/com/android/contacts/model/EntityDiff.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.model;
-
-import android.content.ContentProviderOperation;
-import android.content.ContentValues;
-import android.content.Entity;
-import android.content.ContentProviderOperation.Builder;
-import android.content.Entity.NamedContentValues;
-import android.net.Uri;
-import android.provider.BaseColumns;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-
-/**
- * Describes a set of {@link ContentProviderOperation} that need to be
- * executed to transform a database from one {@link Entity} to another.
- */
-@Deprecated
-public class EntityDiff extends ArrayList<ContentProviderOperation> {
-    private EntityDiff() {
-    }
-
-    /**
-     * Build the set of {@link ContentProviderOperation} needed to translate
-     * from "before" to "after". Tries its best to keep operations to
-     * minimal number required. Assumes that all {@link ContentValues} are
-     * keyed using {@link BaseColumns#_ID} values.
-     */
-    public static EntityDiff buildDiff(Entity before, Entity after, Uri targetUri,
-            String childForeignKey) {
-        final EntityDiff diff = new EntityDiff();
-
-        Builder builder;
-        ContentValues values;
-
-        if (before == null) {
-            // Before doesn't exist, so insert "after" values
-            builder = ContentProviderOperation.newInsert(targetUri);
-            builder.withValues(after.getEntityValues());
-            diff.add(builder.build());
-
-            for (NamedContentValues child : after.getSubValues()) {
-                // Add builder with reference to original _id when needed
-                builder = ContentProviderOperation.newInsert(child.uri);
-                builder.withValues(child.values);
-                if (childForeignKey != null) {
-                    builder.withValueBackReference(childForeignKey, 0);
-                }
-                diff.add(builder.build());
-            }
-
-        } else if (after == null) {
-            // After doesn't exist, so delete "before" values
-            for (NamedContentValues child : before.getSubValues()) {
-                builder = ContentProviderOperation.newDelete(child.uri);
-                builder.withSelection(getSelectIdClause(child.values), null);
-                diff.add(builder.build());
-            }
-
-            builder = ContentProviderOperation.newDelete(targetUri);
-            builder.withSelection(getSelectIdClause(before.getEntityValues()), null);
-            diff.add(builder.build());
-
-        } else {
-            // Somewhere between, so update any changed values
-            values = after.getEntityValues();
-            if (!before.getEntityValues().equals(values)) {
-                // Top-level values changed, so update
-                builder = ContentProviderOperation.newUpdate(targetUri);
-                builder.withSelection(getSelectIdClause(values), null);
-                builder.withValues(values);
-                diff.add(builder.build());
-            }
-
-            // Build lookup maps for children on both sides
-            final HashMap<String, NamedContentValues> beforeChildren = buildChildrenMap(before);
-            final HashMap<String, NamedContentValues> afterChildren = buildChildrenMap(after);
-
-            // Walk through "before" children looking for deletes and updates
-            for (NamedContentValues beforeChild : beforeChildren.values()) {
-                final String key = buildChildKey(beforeChild);
-                final NamedContentValues afterChild = afterChildren.get(key);
-
-                if (afterChild == null) {
-                    // After child doesn't exist, so delete "before" child
-                    builder = ContentProviderOperation.newDelete(beforeChild.uri);
-                    builder.withSelection(getSelectIdClause(beforeChild.values), null);
-                    diff.add(builder.build());
-                } else if (!beforeChild.values.equals(afterChild.values)) {
-                    // After child still exists, and is different, so update
-                    values = afterChild.values;
-                    builder = ContentProviderOperation.newUpdate(afterChild.uri);
-                    builder.withSelection(getSelectIdClause(values), null);
-                    builder.withValues(values);
-                    diff.add(builder.build());
-                }
-
-                // Remove the now-handled "after" child
-                afterChildren.remove(key);
-            }
-
-            // Walk through remaining "after" children, which are inserts
-            for (NamedContentValues afterChild : afterChildren.values()) {
-                builder = ContentProviderOperation.newInsert(afterChild.uri);
-                builder.withValues(afterChild.values);
-                diff.add(builder.build());
-            }
-        }
-
-        return diff;
-    }
-
-    private static String buildChildKey(NamedContentValues child) {
-        return child.uri.toString() + child.values.getAsString(BaseColumns._ID);
-    }
-
-    private static String getSelectIdClause(ContentValues values) {
-        return BaseColumns._ID + "=" + values.getAsLong(BaseColumns._ID);
-    }
-
-    private static HashMap<String, NamedContentValues> buildChildrenMap(Entity entity) {
-        final ArrayList<NamedContentValues> children = entity.getSubValues();
-        final HashMap<String, NamedContentValues> childrenMap = new HashMap<String, NamedContentValues>(
-                children.size());
-        for (NamedContentValues child : children) {
-            final String key = buildChildKey(child);
-            childrenMap.put(key, child);
-        }
-        return childrenMap;
-    }
-}
diff --git a/src/com/android/contacts/model/EntityModifier.java b/src/com/android/contacts/model/EntityModifier.java
index 2e6899e..8765a3f 100644
--- a/src/com/android/contacts/model/EntityModifier.java
+++ b/src/com/android/contacts/model/EntityModifier.java
@@ -17,9 +17,9 @@
 package com.android.contacts.model;
 
 import com.android.contacts.ContactsUtils;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.EditField;
-import com.android.contacts.model.ContactsSource.EditType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.EditField;
+import com.android.contacts.model.BaseAccountType.EditType;
 import com.android.contacts.model.EntityDelta.ValuesDelta;
 import com.google.android.collect.Lists;
 
@@ -27,6 +27,7 @@
 import android.content.Context;
 import android.database.Cursor;
 import android.os.Bundle;
+import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
 import android.provider.ContactsContract.Data;
 import android.provider.ContactsContract.Intents;
 import android.provider.ContactsContract.RawContacts;
@@ -50,7 +51,7 @@
 
 /**
  * Helper methods for modifying an {@link EntityDelta}, such as inserting
- * new rows, or enforcing {@link ContactsSource}.
+ * new rows, or enforcing {@link BaseAccountType}.
  */
 public class EntityModifier {
     private static final String TAG = "EntityModifier";
@@ -58,7 +59,7 @@
     /**
      * For the given {@link EntityDelta}, determine if the given
      * {@link DataKind} could be inserted under specific
-     * {@link ContactsSource}.
+     * {@link BaseAccountType}.
      */
     public static boolean canInsert(EntityDelta state, DataKind kind) {
         // Insert possible when have valid types and under overall maximum
@@ -81,7 +82,7 @@
      * Ensure that at least one of the given {@link DataKind} exists in the
      * given {@link EntityDelta} state, and try creating one if none exist.
      */
-    public static void ensureKindExists(EntityDelta state, ContactsSource source, String mimeType) {
+    public static void ensureKindExists(EntityDelta state, BaseAccountType source, String mimeType) {
         final DataKind kind = source.getKindForMimetype(mimeType);
         final boolean hasChild = state.getMimeEntriesCount(mimeType, true) > 0;
 
@@ -97,7 +98,7 @@
     /**
      * For the given {@link EntityDelta} and {@link DataKind}, return the
      * list possible {@link EditType} options available based on
-     * {@link ContactsSource}.
+     * {@link BaseAccountType}.
      */
     public static ArrayList<EditType> getValidTypes(EntityDelta state, DataKind kind) {
         return getValidTypes(state, kind, null, true, null);
@@ -106,7 +107,7 @@
     /**
      * For the given {@link EntityDelta} and {@link DataKind}, return the
      * list possible {@link EditType} options available based on
-     * {@link ContactsSource}.
+     * {@link BaseAccountType}.
      *
      * @param forceInclude Always include this {@link EditType} in the returned
      *            list, even when an otherwise-invalid choice. This is useful
@@ -120,7 +121,7 @@
     /**
      * For the given {@link EntityDelta} and {@link DataKind}, return the
      * list possible {@link EditType} options available based on
-     * {@link ContactsSource}.
+     * {@link BaseAccountType}.
      *
      * @param forceInclude Always include this {@link EditType} in the returned
      *            list, even when an otherwise-invalid choice. This is useful
@@ -348,26 +349,26 @@
 
     /**
      * Processing to trim any empty {@link ValuesDelta} and {@link EntityDelta}
-     * from the given {@link EntitySet}, assuming the given {@link Sources}
+     * from the given {@link EntityDeltaList}, assuming the given {@link AccountTypes}
      * dictates the structure for various fields. This method ignores rows not
-     * described by the {@link ContactsSource}.
+     * described by the {@link BaseAccountType}.
      */
-    public static void trimEmpty(EntitySet set, Sources sources) {
+    public static void trimEmpty(EntityDeltaList set, AccountTypes sources) {
         for (EntityDelta state : set) {
             final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
-            final ContactsSource source = sources.getInflatedSource(accountType,
-                    ContactsSource.LEVEL_MIMETYPES);
+            final BaseAccountType source = sources.getInflatedSource(accountType,
+                    BaseAccountType.LEVEL_MIMETYPES);
             trimEmpty(state, source);
         }
     }
 
     /**
      * Processing to trim any empty {@link ValuesDelta} rows from the given
-     * {@link EntityDelta}, assuming the given {@link ContactsSource} dictates
+     * {@link EntityDelta}, assuming the given {@link BaseAccountType} dictates
      * the structure for various fields. This method ignores rows not described
-     * by the {@link ContactsSource}.
+     * by the {@link BaseAccountType}.
      */
-    public static void trimEmpty(EntityDelta state, ContactsSource source) {
+    public static void trimEmpty(EntityDelta state, BaseAccountType source) {
         boolean hasValues = false;
 
         // Walk through entries for each well-known kind
@@ -385,7 +386,7 @@
                 }
 
                 // Test and remove this row if empty and it isn't a photo from google
-                final boolean isGoogleSource = TextUtils.equals(GoogleSource.ACCOUNT_TYPE,
+                final boolean isGoogleSource = TextUtils.equals(GoogleAccountType.ACCOUNT_TYPE,
                         state.getValues().getAsString(RawContacts.ACCOUNT_TYPE));
                 final boolean isPhoto = TextUtils.equals(Photo.CONTENT_ITEM_TYPE, kind.mimeType);
                 final boolean isGooglePhoto = isPhoto && isGoogleSource;
@@ -426,10 +427,28 @@
     }
 
     /**
+     * Compares corresponding fields in values1 and values2. Only the fields
+     * declared by the DataKind are taken into consideration.
+     */
+    protected static boolean areEqual(ValuesDelta values1, ContentValues values2, DataKind kind) {
+        if (kind.fieldList == null) return false;
+
+        for (EditField field : kind.fieldList) {
+            final String value1 = values1.getAsString(field.column);
+            final String value2 = values2.getAsString(field.column);
+            if (!TextUtils.equals(value1, value2)) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
      * Parse the given {@link Bundle} into the given {@link EntityDelta} state,
      * assuming the extras defined through {@link Intents}.
      */
-    public static void parseExtras(Context context, ContactsSource source, EntityDelta state,
+    public static void parseExtras(Context context, BaseAccountType source, EntityDelta state,
             Bundle extras) {
         if (extras == null || extras.size() == 0) {
             // Bail early if no useful data
@@ -443,7 +462,7 @@
 
             final String name = extras.getString(Insert.NAME);
             if (ContactsUtils.isGraphic(name)) {
-                child.put(StructuredName.GIVEN_NAME, name);
+                child.put(StructuredName.DISPLAY_NAME, name);
             }
 
             final String phoneticName = extras.getString(Insert.PHONETIC_NAME);
@@ -456,7 +475,7 @@
             // StructuredPostal
             final DataKind kind = source.getKindForMimetype(StructuredPostal.CONTENT_ITEM_TYPE);
             parseExtras(state, kind, extras, Insert.POSTAL_TYPE, Insert.POSTAL,
-                    StructuredPostal.STREET);
+                    StructuredPostal.FORMATTED_ADDRESS);
         }
 
         {
@@ -515,6 +534,187 @@
                 child.put(Note.NOTE, notes);
             }
         }
+
+        // Arbitrary additional data
+        ArrayList<ContentValues> values = extras.getParcelableArrayList(Insert.DATA);
+        if (values != null) {
+            parseValues(state, source, values);
+        }
+    }
+
+    private static void parseValues(
+            EntityDelta state, BaseAccountType source, ArrayList<ContentValues> dataValueList) {
+        for (ContentValues values : dataValueList) {
+            String mimeType = values.getAsString(Data.MIMETYPE);
+            if (TextUtils.isEmpty(mimeType)) {
+                Log.e(TAG, "Mimetype is required. Ignoring: " + values);
+                continue;
+            }
+
+            // Won't override the contact name
+            if (StructuredName.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                continue;
+            }
+
+            DataKind kind = source.getKindForMimetype(mimeType);
+            if (kind == null) {
+                Log.e(TAG, "Mimetype not supported for account type " + source.accountType
+                        + ". Ignoring: " + values);
+                continue;
+            }
+
+            ValuesDelta entry = ValuesDelta.fromAfter(values);
+            if (isEmpty(entry, kind)) {
+                continue;
+            }
+
+            ArrayList<ValuesDelta> entries = state.getMimeEntries(mimeType);
+
+            if (kind.isList || GroupMembership.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                // Check for duplicates
+                boolean addEntry = true;
+                int count = 0;
+                if (entries != null && entries.size() > 0) {
+                    for (ValuesDelta delta : entries) {
+                        if (!delta.isDelete()) {
+                            if (areEqual(delta, values, kind)) {
+                                addEntry = false;
+                                break;
+                            }
+                            count++;
+                        }
+                    }
+                }
+
+                if (kind.typeOverallMax != -1 && count >= kind.typeOverallMax) {
+                    Log.e(TAG, "Mimetype allows at most " + kind.typeOverallMax
+                            + " entries. Ignoring: " + values);
+                    addEntry = false;
+                }
+
+                if (addEntry) {
+                    addEntry = adjustType(entry, entries, kind);
+                }
+
+                if (addEntry) {
+                    state.addEntry(entry);
+                }
+            } else {
+                // Non-list entries should not be overridden
+                boolean addEntry = true;
+                if (entries != null && entries.size() > 0) {
+                    for (ValuesDelta delta : entries) {
+                        if (!delta.isDelete() && !isEmpty(delta, kind)) {
+                            addEntry = false;
+                            break;
+                        }
+                    }
+                    if (addEntry) {
+                        for (ValuesDelta delta : entries) {
+                            delta.markDeleted();
+                        }
+                    }
+                }
+
+                if (addEntry) {
+                    addEntry = adjustType(entry, entries, kind);
+                }
+
+                if (addEntry) {
+                    state.addEntry(entry);
+                } else if (Note.CONTENT_ITEM_TYPE.equals(mimeType)){
+                    // Note is most likely to contain large amounts of text
+                    // that we don't want to drop on the ground.
+                    for (ValuesDelta delta : entries) {
+                        if (!isEmpty(delta, kind)) {
+                            delta.put(Note.NOTE, delta.getAsString(Note.NOTE) + "\n"
+                                    + values.getAsString(Note.NOTE));
+                            break;
+                        }
+                    }
+                } else {
+                    Log.e(TAG, "Will not override mimetype " + mimeType + ". Ignoring: "
+                            + values);
+                }
+            }
+        }
+    }
+
+    /**
+     * Checks if the data kind allows addition of another entry (e.g. Exchange only
+     * supports two "work" phone numbers).  If not, tries to switch to one of the
+     * unused types.  If successful, returns true.
+     */
+    private static boolean adjustType(
+            ValuesDelta entry, ArrayList<ValuesDelta> entries, DataKind kind) {
+        if (kind.typeColumn == null || kind.typeList == null || kind.typeList.size() == 0) {
+            return true;
+        }
+
+        Integer typeInteger = entry.getAsInteger(kind.typeColumn);
+        int type = typeInteger != null ? typeInteger : kind.typeList.get(0).rawValue;
+
+        if (isTypeAllowed(type, entries, kind)) {
+            entry.put(kind.typeColumn, type);
+            return true;
+        }
+
+        // Specified type is not allowed - choose the first available type that is allowed
+        int size = kind.typeList.size();
+        for (int i = 0; i < size; i++) {
+            EditType editType = kind.typeList.get(i);
+            if (isTypeAllowed(editType.rawValue, entries, kind)) {
+                entry.put(kind.typeColumn, editType.rawValue);
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Checks if a new entry of the specified type can be added to the raw
+     * contact. For example, Exchange only supports two "work" phone numbers, so
+     * addition of a third would not be allowed.
+     */
+    private static boolean isTypeAllowed(int type, ArrayList<ValuesDelta> entries, DataKind kind) {
+        int max = 0;
+        int size = kind.typeList.size();
+        for (int i = 0; i < size; i++) {
+            EditType editType = kind.typeList.get(i);
+            if (editType.rawValue == type) {
+                max = editType.specificMax;
+                break;
+            }
+        }
+
+        if (max == 0) {
+            // This type is not allowed at all
+            return false;
+        }
+
+        if (max == -1) {
+            // Unlimited instances of this type are allowed
+            return true;
+        }
+
+        return getEntryCountByType(entries, kind.typeColumn, type) < max;
+    }
+
+    /**
+     * Counts occurrences of the specified type in the supplied entry list.
+     */
+    private static int getEntryCountByType(
+            ArrayList<ValuesDelta> entries, String typeColumn, int type) {
+        int count = 0;
+        int size = entries.size();
+        for (int i = 0; i < size; i++) {
+            Integer typeInteger = entries.get(i).getAsInteger(typeColumn);
+            if (typeInteger != null && typeInteger == type) {
+                count++;
+            }
+        }
+        return count;
     }
 
     /**
diff --git a/src/com/android/contacts/model/EntitySet.java b/src/com/android/contacts/model/EntitySet.java
deleted file mode 100644
index 830f8da..0000000
--- a/src/com/android/contacts/model/EntitySet.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.model;
-
-import android.content.ContentProviderOperation;
-import android.content.ContentResolver;
-import android.content.Entity;
-import android.content.EntityIterator;
-import android.content.ContentProviderOperation.Builder;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.provider.ContactsContract.AggregationExceptions;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.RawContactsEntity;
-
-import com.google.android.collect.Lists;
-
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-
-import java.util.ArrayList;
-
-/**
- * Container for multiple {@link EntityDelta} objects, usually when editing
- * together as an entire aggregate. Provides convenience methods for parceling
- * and applying another {@link EntitySet} over it.
- */
-public class EntitySet extends ArrayList<EntityDelta> implements Parcelable {
-    private boolean mSplitRawContacts;
-
-    private EntitySet() {
-    }
-
-    /**
-     * Create an {@link EntitySet} that contains the given {@link EntityDelta},
-     * usually when inserting a new {@link Contacts} entry.
-     */
-    public static EntitySet fromSingle(EntityDelta delta) {
-        final EntitySet state = new EntitySet();
-        state.add(delta);
-        return state;
-    }
-
-    /**
-     * Create an {@link EntitySet} based on {@link Contacts} specified by the
-     * given query parameters. This closes the {@link EntityIterator} when
-     * finished, so it doesn't subscribe to updates.
-     */
-    public static EntitySet fromQuery(ContentResolver resolver, String selection,
-            String[] selectionArgs, String sortOrder) {
-        EntityIterator iterator = RawContacts.newEntityIterator(resolver.query(
-                RawContactsEntity.CONTENT_URI, null, selection, selectionArgs,
-                sortOrder));
-        try {
-            final EntitySet state = new EntitySet();
-            // Perform background query to pull contact details
-            while (iterator.hasNext()) {
-                // Read all contacts into local deltas to prepare for edits
-                final Entity before = iterator.next();
-                final EntityDelta entity = EntityDelta.fromBefore(before);
-                state.add(entity);
-            }
-            return state;
-        } finally {
-            iterator.close();
-        }
-    }
-
-    /**
-     * Merge the "after" values from the given {@link EntitySet}, discarding any
-     * previous "after" states. This is typically used when re-parenting user
-     * edits onto an updated {@link EntitySet}.
-     */
-    public static EntitySet mergeAfter(EntitySet local, EntitySet remote) {
-        if (local == null) local = new EntitySet();
-
-        // For each entity in the remote set, try matching over existing
-        for (EntityDelta remoteEntity : remote) {
-            final Long rawContactId = remoteEntity.getValues().getId();
-
-            // Find or create local match and merge
-            final EntityDelta localEntity = local.getByRawContactId(rawContactId);
-            final EntityDelta merged = EntityDelta.mergeAfter(localEntity, remoteEntity);
-
-            if (localEntity == null && merged != null) {
-                // No local entry before, so insert
-                local.add(merged);
-            }
-        }
-
-        return local;
-    }
-
-    /**
-     * Build a list of {@link ContentProviderOperation} that will transform all
-     * the "before" {@link Entity} states into the modified state which all
-     * {@link EntityDelta} objects represent. This method specifically creates
-     * any {@link AggregationExceptions} rules needed to groups edits together.
-     */
-    public ArrayList<ContentProviderOperation> buildDiff() {
-        final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
-
-        final long rawContactId = this.findRawContactId();
-        int firstInsertRow = -1;
-
-        // First pass enforces versions remain consistent
-        for (EntityDelta delta : this) {
-            delta.buildAssert(diff);
-        }
-
-        final int assertMark = diff.size();
-        int backRefs[] = new int[size()];
-
-        int rawContactIndex = 0;
-
-        // Second pass builds actual operations
-        for (EntityDelta delta : this) {
-            final int firstBatch = diff.size();
-            final boolean isInsert = delta.isContactInsert();
-            backRefs[rawContactIndex++] = isInsert ? firstBatch : -1;
-
-            delta.buildDiff(diff);
-
-            // Only create rules for inserts
-            if (!isInsert) continue;
-
-            // If we are going to split all contacts, there is no point in first combining them
-            if (mSplitRawContacts) continue;
-
-            if (rawContactId != -1) {
-                // Has existing contact, so bind to it strongly
-                final Builder builder = beginKeepTogether();
-                builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, rawContactId);
-                builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID2, firstBatch);
-                diff.add(builder.build());
-
-            } else if (firstInsertRow == -1) {
-                // First insert case, so record row
-                firstInsertRow = firstBatch;
-
-            } else {
-                // Additional insert case, so point at first insert
-                final Builder builder = beginKeepTogether();
-                builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID1, firstInsertRow);
-                builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID2, firstBatch);
-                diff.add(builder.build());
-            }
-        }
-
-        if (mSplitRawContacts) {
-            buildSplitContactDiff(diff, backRefs);
-        }
-
-        // No real changes if only left with asserts
-        if (diff.size() == assertMark) {
-            diff.clear();
-        }
-
-        return diff;
-    }
-
-    /**
-     * Start building a {@link ContentProviderOperation} that will keep two
-     * {@link RawContacts} together.
-     */
-    protected Builder beginKeepTogether() {
-        final Builder builder = ContentProviderOperation
-                .newUpdate(AggregationExceptions.CONTENT_URI);
-        builder.withValue(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_TOGETHER);
-        return builder;
-    }
-
-    /**
-     * Builds {@link AggregationExceptions} to split all constituent raw contacts into
-     * separate contacts.
-     */
-    private void buildSplitContactDiff(final ArrayList<ContentProviderOperation> diff,
-            int[] backRefs) {
-        int count = size();
-        for (int i = 0; i < count; i++) {
-            for (int j = 0; j < count; j++) {
-                if (i != j) {
-                    buildSplitContactDiff(diff, i, j, backRefs);
-                }
-            }
-        }
-    }
-
-    /**
-     * Construct a {@link AggregationExceptions#TYPE_KEEP_SEPARATE}.
-     */
-    private void buildSplitContactDiff(ArrayList<ContentProviderOperation> diff, int index1,
-            int index2, int[] backRefs) {
-        Builder builder =
-                ContentProviderOperation.newUpdate(AggregationExceptions.CONTENT_URI);
-        builder.withValue(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_SEPARATE);
-
-        Long rawContactId1 = get(index1).getValues().getAsLong(RawContacts._ID);
-        int backRef1 = backRefs[index1];
-        if (rawContactId1 != null && rawContactId1 >= 0) {
-            builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, rawContactId1);
-        } else if (backRef1 >= 0) {
-            builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID1, backRef1);
-        } else {
-            return;
-        }
-
-        Long rawContactId2 = get(index2).getValues().getAsLong(RawContacts._ID);
-        int backRef2 = backRefs[index2];
-        if (rawContactId2 != null && rawContactId2 >= 0) {
-            builder.withValue(AggregationExceptions.RAW_CONTACT_ID2, rawContactId2);
-        } else if (backRef2 >= 0) {
-            builder.withValueBackReference(AggregationExceptions.RAW_CONTACT_ID2, backRef2);
-        } else {
-            return;
-        }
-
-        diff.add(builder.build());
-    }
-
-    /**
-     * Search all contained {@link EntityDelta} for the first one with an
-     * existing {@link RawContacts#_ID} value. Usually used when creating
-     * {@link AggregationExceptions} during an update.
-     */
-    public long findRawContactId() {
-        for (EntityDelta delta : this) {
-            final Long rawContactId = delta.getValues().getAsLong(RawContacts._ID);
-            if (rawContactId != null && rawContactId >= 0) {
-                return rawContactId;
-            }
-        }
-        return -1;
-    }
-
-    /**
-     * Find {@link RawContacts#_ID} of the requested {@link EntityDelta}.
-     */
-    public Long getRawContactId(int index) {
-        if (index >= 0 && index < this.size()) {
-            final EntityDelta delta = this.get(index);
-            final ValuesDelta values = delta.getValues();
-            if (values.isVisible()) {
-                return values.getAsLong(RawContacts._ID);
-            }
-        }
-        return null;
-    }
-
-    public EntityDelta getByRawContactId(Long rawContactId) {
-        final int index = this.indexOfRawContactId(rawContactId);
-        return (index == -1) ? null : this.get(index);
-    }
-
-    /**
-     * Find index of given {@link RawContacts#_ID} when present.
-     */
-    public int indexOfRawContactId(Long rawContactId) {
-        if (rawContactId == null) return -1;
-        final int size = this.size();
-        for (int i = 0; i < size; i++) {
-            final Long currentId = getRawContactId(i);
-            if (rawContactId.equals(currentId)) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-    public ValuesDelta getSuperPrimaryEntry(final String mimeType) {
-        ValuesDelta primary = null;
-        ValuesDelta randomEntry = null;
-        for (EntityDelta delta : this) {
-            final ArrayList<ValuesDelta> mimeEntries = delta.getMimeEntries(mimeType);
-            if (mimeEntries == null) return null;
-
-            for (ValuesDelta entry : mimeEntries) {
-                if (entry.isSuperPrimary()) {
-                    return entry;
-                } else if (primary == null && entry.isPrimary()) {
-                    primary = entry;
-                } else if (randomEntry == null) {
-                    randomEntry = entry;
-                }
-            }
-        }
-        // When no direct super primary, return something
-        if (primary != null) {
-            return primary;
-        }
-        return randomEntry;
-    }
-
-    public void splitRawContacts() {
-        mSplitRawContacts = true;
-    }
-
-    /** {@inheritDoc} */
-    public int describeContents() {
-        // Nothing special about this parcel
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    public void writeToParcel(Parcel dest, int flags) {
-        final int size = this.size();
-        dest.writeInt(size);
-        for (EntityDelta delta : this) {
-            dest.writeParcelable(delta, flags);
-        }
-    }
-
-    public void readFromParcel(Parcel source) {
-        final ClassLoader loader = getClass().getClassLoader();
-        final int size = source.readInt();
-        for (int i = 0; i < size; i++) {
-            this.add(source.<EntityDelta> readParcelable(loader));
-        }
-    }
-
-    public static final Parcelable.Creator<EntitySet> CREATOR = new Parcelable.Creator<EntitySet>() {
-        public EntitySet createFromParcel(Parcel in) {
-            final EntitySet state = new EntitySet();
-            state.readFromParcel(in);
-            return state;
-        }
-
-        public EntitySet[] newArray(int size) {
-            return new EntitySet[size];
-        }
-    };
-}
diff --git a/src/com/android/contacts/model/ExchangeAccountType.java b/src/com/android/contacts/model/ExchangeAccountType.java
new file mode 100644
index 0000000..910dfc6
--- /dev/null
+++ b/src/com/android/contacts/model/ExchangeAccountType.java
@@ -0,0 +1,312 @@
+/*
+ * Copyright (C) 2009 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.contacts.model;
+
+import com.android.contacts.R;
+import com.google.android.collect.Lists;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Im;
+import android.provider.ContactsContract.CommonDataKinds.Nickname;
+import android.provider.ContactsContract.CommonDataKinds.Note;
+import android.provider.ContactsContract.CommonDataKinds.Organization;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.provider.ContactsContract.CommonDataKinds.StructuredName;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.provider.ContactsContract.CommonDataKinds.Website;
+
+import java.util.Locale;
+
+public class ExchangeAccountType extends FallbackAccountType {
+
+    public static final String ACCOUNT_TYPE = "com.android.exchange";
+
+    public ExchangeAccountType(String resPackageName) {
+        this.accountType = ACCOUNT_TYPE;
+        this.resPackageName = null;
+        this.summaryResPackageName = resPackageName;
+    }
+
+    @Override
+    protected void inflate(Context context, int inflateLevel) {
+
+        inflateStructuredName(context, inflateLevel);
+        inflateNickname(context, inflateLevel);
+        inflatePhone(context, inflateLevel);
+        inflateEmail(context, inflateLevel);
+        inflateStructuredPostal(context, inflateLevel);
+        inflateIm(context, inflateLevel);
+        inflateOrganization(context, inflateLevel);
+        inflatePhoto(context, inflateLevel);
+        inflateNote(context, inflateLevel);
+        inflateEvent(context, inflateLevel);
+        inflateWebsite(context, inflateLevel);
+        inflateGroupMembership(context, inflateLevel);
+
+        setInflatedLevel(inflateLevel);
+    }
+
+    @Override
+    protected DataKind inflateStructuredName(Context context, int inflateLevel) {
+        final DataKind kind = super.inflateStructuredName(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            boolean displayOrderPrimary =
+                    context.getResources().getBoolean(R.bool.config_editor_field_order_primary);
+            kind.typeOverallMax = 1;
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(StructuredName.PREFIX, R.string.name_prefix,
+                    FLAGS_PERSON_NAME).setOptional(true));
+            if (!displayOrderPrimary) {
+                kind.fieldList.add(new EditField(StructuredName.FAMILY_NAME,
+                        R.string.name_family, FLAGS_PERSON_NAME));
+                kind.fieldList.add(new EditField(StructuredName.MIDDLE_NAME,
+                        R.string.name_middle, FLAGS_PERSON_NAME).setOptional(true));
+                kind.fieldList.add(new EditField(StructuredName.GIVEN_NAME,
+                        R.string.name_given, FLAGS_PERSON_NAME));
+                kind.fieldList.add(new EditField(StructuredName.SUFFIX,
+                        R.string.name_suffix, FLAGS_PERSON_NAME).setOptional(true));
+                kind.fieldList.add(new EditField(StructuredName.PHONETIC_FAMILY_NAME,
+                        R.string.name_phonetic_family, FLAGS_PHONETIC).setOptional(true));
+                kind.fieldList.add(new EditField(StructuredName.PHONETIC_GIVEN_NAME,
+                        R.string.name_phonetic_given, FLAGS_PHONETIC).setOptional(true));
+            } else {
+                kind.fieldList.add(new EditField(StructuredName.GIVEN_NAME,
+                        R.string.name_given, FLAGS_PERSON_NAME));
+                kind.fieldList.add(new EditField(StructuredName.MIDDLE_NAME,
+                        R.string.name_middle, FLAGS_PERSON_NAME).setOptional(true));
+                kind.fieldList.add(new EditField(StructuredName.FAMILY_NAME,
+                        R.string.name_family, FLAGS_PERSON_NAME));
+                kind.fieldList.add(new EditField(StructuredName.SUFFIX,
+                        R.string.name_suffix, FLAGS_PERSON_NAME).setOptional(true));
+                kind.fieldList.add(new EditField(StructuredName.PHONETIC_GIVEN_NAME,
+                        R.string.name_phonetic_given, FLAGS_PHONETIC).setOptional(true));
+                kind.fieldList.add(new EditField(StructuredName.PHONETIC_FAMILY_NAME,
+                        R.string.name_phonetic_family, FLAGS_PHONETIC).setOptional(true));
+            }
+        }
+
+        return kind;
+    }
+
+    @Override
+    protected DataKind inflateNickname(Context context, int inflateLevel) {
+        final DataKind kind = super.inflateNickname(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.isList = false;
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Nickname.NAME, R.string.nicknameLabelsGroup,
+                    FLAGS_PERSON_NAME));
+        }
+
+        return kind;
+    }
+
+    @Override
+    protected DataKind inflatePhone(Context context, int inflateLevel) {
+        final DataKind kind = super.inflatePhone(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.typeColumn = Phone.TYPE;
+            kind.typeList = Lists.newArrayList();
+            kind.typeList.add(buildPhoneType(Phone.TYPE_HOME).setSpecificMax(2));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE).setSpecificMax(1));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_WORK).setSpecificMax(2));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true)
+                    .setSpecificMax(1));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true)
+                    .setSpecificMax(1));
+            kind.typeList
+                    .add(buildPhoneType(Phone.TYPE_PAGER).setSecondary(true).setSpecificMax(1));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_CAR).setSecondary(true).setSpecificMax(1));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_COMPANY_MAIN).setSecondary(true)
+                    .setSpecificMax(1));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_MMS).setSecondary(true).setSpecificMax(1));
+            kind.typeList
+                    .add(buildPhoneType(Phone.TYPE_RADIO).setSecondary(true).setSpecificMax(1));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_ASSISTANT).setSecondary(true)
+                    .setSpecificMax(1));
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Phone.NUMBER, R.string.phoneLabelsGroup, FLAGS_PHONE));
+        }
+
+        return kind;
+    }
+
+    @Override
+    protected DataKind inflateEmail(Context context, int inflateLevel) {
+        final DataKind kind = super.inflateEmail(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.typeOverallMax = 3;
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Email.DATA, R.string.emailLabelsGroup, FLAGS_EMAIL));
+        }
+
+        return kind;
+    }
+
+    @Override
+    protected DataKind inflateStructuredPostal(Context context, int inflateLevel) {
+        final DataKind kind = super.inflateStructuredPostal(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            final boolean useJapaneseOrder =
+                Locale.JAPANESE.getLanguage().equals(Locale.getDefault().getLanguage());
+            kind.typeColumn = StructuredPostal.TYPE;
+            kind.typeList = Lists.newArrayList();
+            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_WORK).setSpecificMax(1));
+            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_HOME).setSpecificMax(1));
+            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_OTHER).setSpecificMax(1));
+
+            kind.fieldList = Lists.newArrayList();
+            if (useJapaneseOrder) {
+                kind.fieldList.add(new EditField(StructuredPostal.COUNTRY,
+                        R.string.postal_country, FLAGS_POSTAL).setOptional(true));
+                kind.fieldList.add(new EditField(StructuredPostal.POSTCODE,
+                        R.string.postal_postcode, FLAGS_POSTAL));
+                kind.fieldList.add(new EditField(StructuredPostal.REGION,
+                        R.string.postal_region, FLAGS_POSTAL));
+                kind.fieldList.add(new EditField(StructuredPostal.CITY,
+                        R.string.postal_city,FLAGS_POSTAL));
+                kind.fieldList.add(new EditField(StructuredPostal.STREET,
+                        R.string.postal_street, FLAGS_POSTAL));
+            } else {
+                kind.fieldList.add(new EditField(StructuredPostal.STREET,
+                        R.string.postal_street, FLAGS_POSTAL));
+                kind.fieldList.add(new EditField(StructuredPostal.CITY,
+                        R.string.postal_city,FLAGS_POSTAL));
+                kind.fieldList.add(new EditField(StructuredPostal.REGION,
+                        R.string.postal_region, FLAGS_POSTAL));
+                kind.fieldList.add(new EditField(StructuredPostal.POSTCODE,
+                        R.string.postal_postcode, FLAGS_POSTAL));
+                kind.fieldList.add(new EditField(StructuredPostal.COUNTRY,
+                        R.string.postal_country, FLAGS_POSTAL).setOptional(true));
+            }
+        }
+
+        return kind;
+    }
+
+    @Override
+    protected DataKind inflateIm(Context context, int inflateLevel) {
+        final DataKind kind = super.inflateIm(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.typeOverallMax = 3;
+
+            // NOTE: even though a traditional "type" exists, for editing
+            // purposes we're using the protocol to pick labels
+
+            kind.defaultValues = new ContentValues();
+            kind.defaultValues.put(Im.TYPE, Im.TYPE_OTHER);
+
+            kind.typeColumn = Im.PROTOCOL;
+            kind.typeList = Lists.newArrayList();
+            kind.typeList.add(buildImType(Im.PROTOCOL_AIM));
+            kind.typeList.add(buildImType(Im.PROTOCOL_MSN));
+            kind.typeList.add(buildImType(Im.PROTOCOL_YAHOO));
+            kind.typeList.add(buildImType(Im.PROTOCOL_SKYPE));
+            kind.typeList.add(buildImType(Im.PROTOCOL_QQ));
+            kind.typeList.add(buildImType(Im.PROTOCOL_GOOGLE_TALK));
+            kind.typeList.add(buildImType(Im.PROTOCOL_ICQ));
+            kind.typeList.add(buildImType(Im.PROTOCOL_JABBER));
+            kind.typeList.add(buildImType(Im.PROTOCOL_CUSTOM).setSecondary(true).setCustomColumn(
+                    Im.CUSTOM_PROTOCOL));
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Im.DATA, R.string.imLabelsGroup, FLAGS_EMAIL));
+        }
+
+        return kind;
+    }
+
+    @Override
+    protected DataKind inflateOrganization(Context context, int inflateLevel) {
+        final DataKind kind = super.inflateOrganization(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.isList = false;
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Organization.COMPANY, R.string.ghostData_company,
+                    FLAGS_GENERIC_NAME));
+            kind.fieldList.add(new EditField(Organization.TITLE, R.string.ghostData_title,
+                    FLAGS_GENERIC_NAME));
+        }
+
+        return kind;
+    }
+
+    @Override
+    protected DataKind inflatePhoto(Context context, int inflateLevel) {
+        final DataKind kind = super.inflatePhoto(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.typeOverallMax = 1;
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Photo.PHOTO, -1, -1));
+        }
+
+        return kind;
+    }
+
+    @Override
+    protected DataKind inflateNote(Context context, int inflateLevel) {
+        final DataKind kind = super.inflateNote(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
+        }
+
+        return kind;
+    }
+
+    @Override
+    protected DataKind inflateWebsite(Context context, int inflateLevel) {
+        final DataKind kind = super.inflateWebsite(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.isList = false;
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Website.URL, R.string.websiteLabelsGroup, FLAGS_WEBSITE));
+        }
+
+        return kind;
+    }
+
+    @Override
+    public int getHeaderColor(Context context) {
+        return 0xffd5ba96;
+    }
+
+    @Override
+    public int getSideBarColor(Context context) {
+        return 0xffb58e59;
+    }
+}
diff --git a/src/com/android/contacts/model/ExchangeSource.java b/src/com/android/contacts/model/ExchangeSource.java
deleted file mode 100644
index 3f2ab6c..0000000
--- a/src/com/android/contacts/model/ExchangeSource.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.model;
-
-import com.android.contacts.R;
-import com.google.android.collect.Lists;
-
-import android.content.ContentValues;
-import android.content.Context;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.Im;
-import android.provider.ContactsContract.CommonDataKinds.Nickname;
-import android.provider.ContactsContract.CommonDataKinds.Note;
-import android.provider.ContactsContract.CommonDataKinds.Organization;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.CommonDataKinds.Photo;
-import android.provider.ContactsContract.CommonDataKinds.StructuredName;
-import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
-import android.provider.ContactsContract.CommonDataKinds.Website;
-
-import java.util.Locale;
-
-public class ExchangeSource extends FallbackSource {
-
-    public static final String ACCOUNT_TYPE = "com.android.exchange";
-
-    public ExchangeSource(String resPackageName) {
-        this.accountType = ACCOUNT_TYPE;
-        this.resPackageName = null;
-        this.summaryResPackageName = resPackageName;
-    }
-
-    @Override
-    protected void inflate(Context context, int inflateLevel) {
-
-        inflateStructuredName(context, inflateLevel);
-        inflateNickname(context, inflateLevel);
-        inflatePhone(context, inflateLevel);
-        inflateEmail(context, inflateLevel);
-        inflateStructuredPostal(context, inflateLevel);
-        inflateIm(context, inflateLevel);
-        inflateOrganization(context, inflateLevel);
-        inflatePhoto(context, inflateLevel);
-        inflateNote(context, inflateLevel);
-        inflateWebsite(context, inflateLevel);
-
-        setInflatedLevel(inflateLevel);
-    }
-
-    @Override
-    protected DataKind inflateStructuredName(Context context, int inflateLevel) {
-        final DataKind kind = super.inflateStructuredName(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            boolean displayOrderPrimary =
-                    context.getResources().getBoolean(R.bool.config_editor_field_order_primary);
-            kind.typeOverallMax = 1;
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(StructuredName.PREFIX, R.string.name_prefix,
-                    FLAGS_PERSON_NAME).setOptional(true));
-            if (!displayOrderPrimary) {
-                kind.fieldList.add(new EditField(StructuredName.FAMILY_NAME,
-                        R.string.name_family, FLAGS_PERSON_NAME));
-                kind.fieldList.add(new EditField(StructuredName.MIDDLE_NAME,
-                        R.string.name_middle, FLAGS_PERSON_NAME).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.GIVEN_NAME,
-                        R.string.name_given, FLAGS_PERSON_NAME));
-                kind.fieldList.add(new EditField(StructuredName.SUFFIX,
-                        R.string.name_suffix, FLAGS_PERSON_NAME).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.PHONETIC_FAMILY_NAME,
-                        R.string.name_phonetic_family, FLAGS_PHONETIC).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.PHONETIC_GIVEN_NAME,
-                        R.string.name_phonetic_given, FLAGS_PHONETIC).setOptional(true));
-            } else {
-                kind.fieldList.add(new EditField(StructuredName.GIVEN_NAME,
-                        R.string.name_given, FLAGS_PERSON_NAME));
-                kind.fieldList.add(new EditField(StructuredName.MIDDLE_NAME,
-                        R.string.name_middle, FLAGS_PERSON_NAME).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.FAMILY_NAME,
-                        R.string.name_family, FLAGS_PERSON_NAME));
-                kind.fieldList.add(new EditField(StructuredName.SUFFIX,
-                        R.string.name_suffix, FLAGS_PERSON_NAME).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.PHONETIC_GIVEN_NAME,
-                        R.string.name_phonetic_given, FLAGS_PHONETIC).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.PHONETIC_FAMILY_NAME,
-                        R.string.name_phonetic_family, FLAGS_PHONETIC).setOptional(true));
-            }
-        }
-
-        return kind;
-    }
-
-    @Override
-    protected DataKind inflateNickname(Context context, int inflateLevel) {
-        final DataKind kind = super.inflateNickname(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.isList = false;
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Nickname.NAME, R.string.nicknameLabelsGroup,
-                    FLAGS_PERSON_NAME));
-        }
-
-        return kind;
-    }
-
-    @Override
-    protected DataKind inflatePhone(Context context, int inflateLevel) {
-        final DataKind kind = super.inflatePhone(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.typeColumn = Phone.TYPE;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildPhoneType(Phone.TYPE_HOME).setSpecificMax(2));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE).setSpecificMax(1));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_WORK).setSpecificMax(2));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true)
-                    .setSpecificMax(1));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true)
-                    .setSpecificMax(1));
-            kind.typeList
-                    .add(buildPhoneType(Phone.TYPE_PAGER).setSecondary(true).setSpecificMax(1));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_CAR).setSecondary(true).setSpecificMax(1));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_COMPANY_MAIN).setSecondary(true)
-                    .setSpecificMax(1));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_MMS).setSecondary(true).setSpecificMax(1));
-            kind.typeList
-                    .add(buildPhoneType(Phone.TYPE_RADIO).setSecondary(true).setSpecificMax(1));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_ASSISTANT).setSecondary(true)
-                    .setSpecificMax(1).setCustomColumn(Phone.LABEL));
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Phone.NUMBER, R.string.phoneLabelsGroup, FLAGS_PHONE));
-        }
-
-        return kind;
-    }
-
-    @Override
-    protected DataKind inflateEmail(Context context, int inflateLevel) {
-        final DataKind kind = super.inflateEmail(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.typeOverallMax = 3;
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Email.DATA, R.string.emailLabelsGroup, FLAGS_EMAIL));
-        }
-
-        return kind;
-    }
-
-    @Override
-    protected DataKind inflateStructuredPostal(Context context, int inflateLevel) {
-        final DataKind kind = super.inflateStructuredPostal(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            final boolean useJapaneseOrder =
-                Locale.JAPANESE.getLanguage().equals(Locale.getDefault().getLanguage());
-            kind.typeColumn = StructuredPostal.TYPE;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_WORK).setSpecificMax(1));
-            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_HOME).setSpecificMax(1));
-            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_OTHER).setSpecificMax(1));
-
-            kind.fieldList = Lists.newArrayList();
-            if (useJapaneseOrder) {
-                kind.fieldList.add(new EditField(StructuredPostal.COUNTRY,
-                        R.string.postal_country, FLAGS_POSTAL).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredPostal.POSTCODE,
-                        R.string.postal_postcode, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.REGION,
-                        R.string.postal_region, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.CITY,
-                        R.string.postal_city,FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.STREET,
-                        R.string.postal_street, FLAGS_POSTAL));
-            } else {
-                kind.fieldList.add(new EditField(StructuredPostal.STREET,
-                        R.string.postal_street, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.CITY,
-                        R.string.postal_city,FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.REGION,
-                        R.string.postal_region, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.POSTCODE,
-                        R.string.postal_postcode, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.COUNTRY,
-                        R.string.postal_country, FLAGS_POSTAL).setOptional(true));
-            }
-        }
-
-        return kind;
-    }
-
-    @Override
-    protected DataKind inflateIm(Context context, int inflateLevel) {
-        final DataKind kind = super.inflateIm(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.typeOverallMax = 3;
-
-            // NOTE: even though a traditional "type" exists, for editing
-            // purposes we're using the protocol to pick labels
-
-            kind.defaultValues = new ContentValues();
-            kind.defaultValues.put(Im.TYPE, Im.TYPE_OTHER);
-
-            kind.typeColumn = Im.PROTOCOL;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildImType(Im.PROTOCOL_AIM));
-            kind.typeList.add(buildImType(Im.PROTOCOL_MSN));
-            kind.typeList.add(buildImType(Im.PROTOCOL_YAHOO));
-            kind.typeList.add(buildImType(Im.PROTOCOL_SKYPE));
-            kind.typeList.add(buildImType(Im.PROTOCOL_QQ));
-            kind.typeList.add(buildImType(Im.PROTOCOL_GOOGLE_TALK));
-            kind.typeList.add(buildImType(Im.PROTOCOL_ICQ));
-            kind.typeList.add(buildImType(Im.PROTOCOL_JABBER));
-            kind.typeList.add(buildImType(Im.PROTOCOL_CUSTOM).setSecondary(true).setCustomColumn(
-                    Im.CUSTOM_PROTOCOL));
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Im.DATA, R.string.imLabelsGroup, FLAGS_EMAIL));
-        }
-
-        return kind;
-    }
-
-    @Override
-    protected DataKind inflateOrganization(Context context, int inflateLevel) {
-        final DataKind kind = super.inflateOrganization(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.isList = false;
-            kind.typeColumn = Organization.TYPE;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildOrgType(Organization.TYPE_WORK).setSpecificMax(1));
-            kind.typeList.add(buildOrgType(Organization.TYPE_OTHER).setSpecificMax(1));
-            kind.typeList.add(buildOrgType(Organization.TYPE_CUSTOM).setSecondary(true)
-                    .setSpecificMax(1));
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Organization.COMPANY, R.string.ghostData_company,
-                    FLAGS_GENERIC_NAME));
-            kind.fieldList.add(new EditField(Organization.TITLE, R.string.ghostData_title,
-                    FLAGS_GENERIC_NAME));
-        }
-
-        return kind;
-    }
-
-    @Override
-    protected DataKind inflatePhoto(Context context, int inflateLevel) {
-        final DataKind kind = super.inflatePhoto(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.typeOverallMax = 1;
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Photo.PHOTO, -1, -1));
-        }
-
-        return kind;
-    }
-
-    @Override
-    protected DataKind inflateNote(Context context, int inflateLevel) {
-        final DataKind kind = super.inflateNote(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
-        }
-
-        return kind;
-    }
-
-    @Override
-    protected DataKind inflateWebsite(Context context, int inflateLevel) {
-        final DataKind kind = super.inflateWebsite(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.isList = false;
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Website.URL, R.string.websiteLabelsGroup, FLAGS_WEBSITE));
-        }
-
-        return kind;
-    }
-
-    @Override
-    public int getHeaderColor(Context context) {
-        return 0xffd5ba96;
-    }
-
-    @Override
-    public int getSideBarColor(Context context) {
-        return 0xffb58e59;
-    }
-}
diff --git a/src/com/android/contacts/model/ExternalAccountType.java b/src/com/android/contacts/model/ExternalAccountType.java
new file mode 100644
index 0000000..ee6f603
--- /dev/null
+++ b/src/com/android/contacts/model/ExternalAccountType.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2009 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.contacts.model;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.content.res.TypedArray;
+import android.content.res.XmlResourceParser;
+import android.util.AttributeSet;
+import android.util.Xml;
+
+import java.io.IOException;
+import java.util.List;
+
+/*
+
+<!-- example of what SourceConstraints would look like in XML -->
+<!-- NOTE: may not directly match the current structure version -->
+
+<DataKind
+    mimeType="vnd.android.cursor.item/email"
+    title="@string/title_postal"
+    icon="@drawable/icon_postal"
+    weight="12"
+    editable="true">
+
+    <!-- these are defined using string-builder-ish -->
+    <ActionHeader></ActionHeader>
+    <ActionBody socialSummary="true" />  <!-- can pull together various columns -->
+
+    <!-- ordering handles precedence the "insert/add" case -->
+    <!-- assume uniform type when missing "column", use title in place -->
+    <EditTypes column="data5" overallMax="-1">
+        <EditType rawValue="0" label="@string/type_home" specificMax="-1" />
+        <EditType rawValue="1" label="@string/type_work" specificMax="-1" secondary="true" />
+        <EditType rawValue="4" label="@string/type_custom" customColumn="data6" specificMax="-1" secondary="true" />
+    </EditTypes>
+
+    <!-- when single edit field, simplifies edit case -->
+    <EditField column="data1" title="@string/field_family_name" android:inputType="textCapWords|textPhonetic" />
+    <EditField column="data2" title="@string/field_given_name" android:minLines="2" />
+    <EditField column="data3" title="@string/field_suffix" />
+
+</DataKind>
+
+*/
+
+/**
+ * Internal structure that represents constraints and styles for a specific data
+ * source, such as the various data types they support, including details on how
+ * those types should be rendered and edited.
+ * <p>
+ * In the future this may be inflated from XML defined by a data source.
+ */
+public class ExternalAccountType extends FallbackAccountType {
+    private static final String ACTION_SYNC_ADAPTER = "android.content.SyncAdapter";
+    private static final String METADATA_CONTACTS = "android.provider.CONTACTS_STRUCTURE";
+
+    private interface InflateTags {
+        final String CONTACTS_SOURCE_LEGACY = "ContactsSource";
+        final String CONTACTS_ACCOUNT_TYPE = "ContactsAccountType";
+        final String CONTACTS_DATA_KIND = "ContactsDataKind";
+    }
+
+    public ExternalAccountType(String resPackageName) {
+        this.resPackageName = resPackageName;
+        this.summaryResPackageName = resPackageName;
+    }
+
+    /**
+     * Ensure that the constraint rules behind this {@link BaseAccountType} have
+     * been inflated. Because this may involve parsing meta-data from
+     * {@link PackageManager}, it shouldn't be called from a UI thread.
+     */
+    @Override
+    public void inflate(Context context, int inflateLevel) {
+        // Handle unknown sources by searching their package
+        final PackageManager pm = context.getPackageManager();
+        final Intent syncAdapter = new Intent(ACTION_SYNC_ADAPTER);
+        final List<ResolveInfo> matches = pm.queryIntentServices(syncAdapter,
+                PackageManager.GET_META_DATA);
+        for (ResolveInfo info : matches) {
+            final XmlResourceParser parser = info.serviceInfo.loadXmlMetaData(pm,
+                    METADATA_CONTACTS);
+            if (parser == null) continue;
+            inflate(context, parser);
+        }
+
+        // Bring in name and photo from fallback source, which are non-optional
+        inflateStructuredName(context, inflateLevel);
+        inflatePhoto(context, inflateLevel);
+
+        setInflatedLevel(inflateLevel);
+    }
+
+    /**
+     * Inflate this {@link BaseAccountType} from the given parser. This may only
+     * load details matching the publicly-defined schema.
+     */
+    protected void inflate(Context context, XmlPullParser parser) {
+        final AttributeSet attrs = Xml.asAttributeSet(parser);
+
+        try {
+            int type;
+            while ((type = parser.next()) != XmlPullParser.START_TAG
+                    && type != XmlPullParser.END_DOCUMENT) {
+                // Drain comments and whitespace
+            }
+
+            if (type != XmlPullParser.START_TAG) {
+                throw new IllegalStateException("No start tag found");
+            }
+
+            String rootTag = parser.getName();
+            if (!InflateTags.CONTACTS_ACCOUNT_TYPE.equals(rootTag) &&
+                    !InflateTags.CONTACTS_SOURCE_LEGACY.equals(rootTag)) {
+                throw new IllegalStateException("Top level element must be "
+                        + InflateTags.CONTACTS_ACCOUNT_TYPE + ", not " + rootTag);
+            }
+
+            // Parse all children kinds
+            final int depth = parser.getDepth();
+            while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
+                    && type != XmlPullParser.END_DOCUMENT) {
+                if (type == XmlPullParser.END_TAG
+                        || !InflateTags.CONTACTS_DATA_KIND.equals(rootTag)) {
+                    continue;
+                }
+
+                final TypedArray a = context.obtainStyledAttributes(attrs,
+                        android.R.styleable.ContactsDataKind);
+                final DataKind kind = new DataKind();
+
+                kind.mimeType = a
+                        .getString(com.android.internal.R.styleable.ContactsDataKind_mimeType);
+                kind.iconRes = a.getResourceId(
+                        com.android.internal.R.styleable.ContactsDataKind_icon, -1);
+
+                final String summaryColumn = a
+                        .getString(com.android.internal.R.styleable.ContactsDataKind_summaryColumn);
+                if (summaryColumn != null) {
+                    // Inflate a specific column as summary when requested
+                    kind.actionHeader = new FallbackAccountType.SimpleInflater(summaryColumn);
+                }
+
+                final String detailColumn = a
+                        .getString(com.android.internal.R.styleable.ContactsDataKind_detailColumn);
+                final boolean detailSocialSummary = a.getBoolean(
+                        com.android.internal.R.styleable.ContactsDataKind_detailSocialSummary,
+                        false);
+
+                if (detailSocialSummary) {
+                    // Inflate social summary when requested
+                    kind.actionBodySocial = true;
+                }
+
+                if (detailColumn != null) {
+                    // Inflate specific column as summary
+                    kind.actionBody = new FallbackAccountType.SimpleInflater(detailColumn);
+                }
+
+                addKind(kind);
+            }
+        } catch (XmlPullParserException e) {
+            throw new IllegalStateException("Problem reading XML", e);
+        } catch (IOException e) {
+            throw new IllegalStateException("Problem reading XML", e);
+        }
+    }
+
+    @Override
+    public int getHeaderColor(Context context) {
+        return 0xff6d86b4;
+    }
+
+    @Override
+    public int getSideBarColor(Context context) {
+        return 0xff6d86b4;
+    }
+}
diff --git a/src/com/android/contacts/model/ExternalSource.java b/src/com/android/contacts/model/ExternalSource.java
deleted file mode 100644
index aa9d888..0000000
--- a/src/com/android/contacts/model/ExternalSource.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.model;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.res.TypedArray;
-import android.content.res.XmlResourceParser;
-import android.util.AttributeSet;
-import android.util.Xml;
-
-import java.io.IOException;
-import java.util.List;
-
-/*
-
-<!-- example of what SourceConstraints would look like in XML -->
-<!-- NOTE: may not directly match the current structure version -->
-
-<DataKind
-    mimeType="vnd.android.cursor.item/email"
-    title="@string/title_postal"
-    icon="@drawable/icon_postal"
-    weight="12"
-    editable="true">
-
-    <!-- these are defined using string-builder-ish -->
-    <ActionHeader></ActionHeader>
-    <ActionBody socialSummary="true" />  <!-- can pull together various columns -->
-
-    <!-- ordering handles precedence the "insert/add" case -->
-    <!-- assume uniform type when missing "column", use title in place -->
-    <EditTypes column="data5" overallMax="-1">
-        <EditType rawValue="0" label="@string/type_home" specificMax="-1" />
-        <EditType rawValue="1" label="@string/type_work" specificMax="-1" secondary="true" />
-        <EditType rawValue="4" label="@string/type_custom" customColumn="data6" specificMax="-1" secondary="true" />
-    </EditTypes>
-
-    <!-- when single edit field, simplifies edit case -->
-    <EditField column="data1" title="@string/field_family_name" android:inputType="textCapWords|textPhonetic" />
-    <EditField column="data2" title="@string/field_given_name" android:minLines="2" />
-    <EditField column="data3" title="@string/field_suffix" />
-
-</DataKind>
-
-*/
-
-/**
- * Internal structure that represents constraints and styles for a specific data
- * source, such as the various data types they support, including details on how
- * those types should be rendered and edited.
- * <p>
- * In the future this may be inflated from XML defined by a data source.
- */
-public class ExternalSource extends FallbackSource {
-    private static final String ACTION_SYNC_ADAPTER = "android.content.SyncAdapter";
-    private static final String METADATA_CONTACTS = "android.provider.CONTACTS_STRUCTURE";
-
-    private interface InflateTags {
-        final String CONTACTS_SOURCE = "ContactsSource";
-        final String CONTACTS_DATA_KIND = "ContactsDataKind";
-    }
-
-    public ExternalSource(String resPackageName) {
-        this.resPackageName = resPackageName;
-        this.summaryResPackageName = resPackageName;
-    }
-
-    /**
-     * Ensure that the constraint rules behind this {@link ContactsSource} have
-     * been inflated. Because this may involve parsing meta-data from
-     * {@link PackageManager}, it shouldn't be called from a UI thread.
-     */
-    @Override
-    public void inflate(Context context, int inflateLevel) {
-        // Handle unknown sources by searching their package
-        final PackageManager pm = context.getPackageManager();
-        final Intent syncAdapter = new Intent(ACTION_SYNC_ADAPTER);
-        final List<ResolveInfo> matches = pm.queryIntentServices(syncAdapter,
-                PackageManager.GET_META_DATA);
-        for (ResolveInfo info : matches) {
-            final XmlResourceParser parser = info.serviceInfo.loadXmlMetaData(pm,
-                    METADATA_CONTACTS);
-            if (parser == null) continue;
-            inflate(context, parser);
-        }
-
-        // Bring in name and photo from fallback source, which are non-optional
-        inflateStructuredName(context, inflateLevel);
-        inflatePhoto(context, inflateLevel);
-
-        setInflatedLevel(inflateLevel);
-    }
-
-    /**
-     * Inflate this {@link ContactsSource} from the given parser. This may only
-     * load details matching the publicly-defined schema.
-     */
-    protected void inflate(Context context, XmlPullParser parser) {
-        final AttributeSet attrs = Xml.asAttributeSet(parser);
-
-        try {
-            int type;
-            while ((type = parser.next()) != XmlPullParser.START_TAG
-                    && type != XmlPullParser.END_DOCUMENT) {
-                // Drain comments and whitespace
-            }
-
-            if (type != XmlPullParser.START_TAG) {
-                throw new IllegalStateException("No start tag found");
-            }
-
-            if (!InflateTags.CONTACTS_SOURCE.equals(parser.getName())) {
-                throw new IllegalStateException("Top level element must be "
-                        + InflateTags.CONTACTS_SOURCE);
-            }
-
-            // Parse all children kinds
-            final int depth = parser.getDepth();
-            while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
-                    && type != XmlPullParser.END_DOCUMENT) {
-                if (type == XmlPullParser.END_TAG
-                        || !InflateTags.CONTACTS_DATA_KIND.equals(parser.getName())) {
-                    continue;
-                }
-
-                final TypedArray a = context.obtainStyledAttributes(attrs,
-                        android.R.styleable.ContactsDataKind);
-                final DataKind kind = new DataKind();
-
-                kind.mimeType = a
-                        .getString(com.android.internal.R.styleable.ContactsDataKind_mimeType);
-                kind.iconRes = a.getResourceId(
-                        com.android.internal.R.styleable.ContactsDataKind_icon, -1);
-
-                final String summaryColumn = a
-                        .getString(com.android.internal.R.styleable.ContactsDataKind_summaryColumn);
-                if (summaryColumn != null) {
-                    // Inflate a specific column as summary when requested
-                    kind.actionHeader = new FallbackSource.SimpleInflater(summaryColumn);
-                }
-
-                final String detailColumn = a
-                        .getString(com.android.internal.R.styleable.ContactsDataKind_detailColumn);
-                final boolean detailSocialSummary = a.getBoolean(
-                        com.android.internal.R.styleable.ContactsDataKind_detailSocialSummary,
-                        false);
-
-                if (detailSocialSummary) {
-                    // Inflate social summary when requested
-                    kind.actionBodySocial = true;
-                }
-
-                if (detailColumn != null) {
-                    // Inflate specific column as summary
-                    kind.actionBody = new FallbackSource.SimpleInflater(detailColumn);
-                }
-
-                addKind(kind);
-            }
-        } catch (XmlPullParserException e) {
-            throw new IllegalStateException("Problem reading XML", e);
-        } catch (IOException e) {
-            throw new IllegalStateException("Problem reading XML", e);
-        }
-    }
-
-    @Override
-    public int getHeaderColor(Context context) {
-        return 0xff6d86b4;
-    }
-
-    @Override
-    public int getSideBarColor(Context context) {
-        return 0xff6d86b4;
-    }
-}
diff --git a/src/com/android/contacts/model/FallbackAccountType.java b/src/com/android/contacts/model/FallbackAccountType.java
new file mode 100644
index 0000000..4519bae
--- /dev/null
+++ b/src/com/android/contacts/model/FallbackAccountType.java
@@ -0,0 +1,717 @@
+/*
+ * Copyright (C) 2009 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.contacts.model;
+
+import com.android.contacts.R;
+import com.google.android.collect.Lists;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.res.Resources;
+import android.database.Cursor;
+import android.provider.ContactsContract.CommonDataKinds.BaseTypes;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Event;
+import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
+import android.provider.ContactsContract.CommonDataKinds.Im;
+import android.provider.ContactsContract.CommonDataKinds.Nickname;
+import android.provider.ContactsContract.CommonDataKinds.Note;
+import android.provider.ContactsContract.CommonDataKinds.Organization;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.provider.ContactsContract.CommonDataKinds.SipAddress;
+import android.provider.ContactsContract.CommonDataKinds.StructuredName;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.provider.ContactsContract.CommonDataKinds.Website;
+import android.view.inputmethod.EditorInfo;
+
+public class FallbackAccountType extends BaseAccountType {
+    protected static final int FLAGS_PHONE = EditorInfo.TYPE_CLASS_PHONE;
+    protected static final int FLAGS_EMAIL = EditorInfo.TYPE_CLASS_TEXT
+            | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
+    protected static final int FLAGS_PERSON_NAME = EditorInfo.TYPE_CLASS_TEXT
+            | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS | EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME;
+    protected static final int FLAGS_PHONETIC = EditorInfo.TYPE_CLASS_TEXT
+            | EditorInfo.TYPE_TEXT_VARIATION_PHONETIC;
+    protected static final int FLAGS_GENERIC_NAME = EditorInfo.TYPE_CLASS_TEXT
+            | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS;
+    protected static final int FLAGS_NOTE = EditorInfo.TYPE_CLASS_TEXT
+            | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
+    protected static final int FLAGS_EVENT = EditorInfo.TYPE_CLASS_TEXT;
+    protected static final int FLAGS_WEBSITE = EditorInfo.TYPE_CLASS_TEXT
+            | EditorInfo.TYPE_TEXT_VARIATION_URI;
+    protected static final int FLAGS_POSTAL = EditorInfo.TYPE_CLASS_TEXT
+            | EditorInfo.TYPE_TEXT_VARIATION_POSTAL_ADDRESS | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS
+            | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
+    protected static final int FLAGS_SIP_ADDRESS = EditorInfo.TYPE_CLASS_TEXT
+            | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;  // since SIP addresses have the same
+                                                             // basic format as email addresses
+
+    public FallbackAccountType() {
+        this.accountType = null;
+        this.titleRes = R.string.account_phone;
+        this.iconRes = R.drawable.ic_launcher_contacts;
+    }
+
+    @Override
+    protected void inflate(Context context, int inflateLevel) {
+
+        inflateStructuredName(context, inflateLevel);
+        inflateNickname(context, inflateLevel);
+        inflatePhone(context, inflateLevel);
+        inflateEmail(context, inflateLevel);
+        inflateStructuredPostal(context, inflateLevel);
+        inflateIm(context, inflateLevel);
+        inflateOrganization(context, inflateLevel);
+        inflatePhoto(context, inflateLevel);
+        inflateNote(context, inflateLevel);
+        inflateWebsite(context, inflateLevel);
+        inflateEvent(context, inflateLevel);
+        inflateSipAddress(context, inflateLevel);
+        inflateGroupMembership(context, inflateLevel);
+
+        setInflatedLevel(inflateLevel);
+
+    }
+
+    protected EditType buildPhoneType(int type) {
+        return new EditType(type, Phone.getTypeLabelResource(type));
+    }
+
+    protected EditType buildEmailType(int type) {
+        return new EditType(type, Email.getTypeLabelResource(type));
+    }
+
+    protected EditType buildPostalType(int type) {
+        return new EditType(type, StructuredPostal.getTypeLabelResource(type));
+    }
+
+    protected EditType buildImType(int type) {
+        return new EditType(type, Im.getProtocolLabelResource(type));
+    }
+
+    protected EditType buildEventType(int type) {
+        return new EditType(type, Event.getTypeResource(type));
+    }
+
+    protected DataKind inflateStructuredName(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(StructuredName.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(StructuredName.CONTENT_ITEM_TYPE,
+                    R.string.nameLabelsGroup, -1, -1, true));
+            kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
+            kind.actionBody = new SimpleInflater(Nickname.NAME);
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(StructuredName.DISPLAY_NAME,
+                    R.string.full_name, FLAGS_PERSON_NAME).setShortForm(true));
+
+            boolean displayOrderPrimary =
+                    context.getResources().getBoolean(R.bool.config_editor_field_order_primary);
+
+            if (!displayOrderPrimary) {
+                kind.fieldList.add(new EditField(StructuredName.PREFIX, R.string.name_prefix,
+                        FLAGS_PERSON_NAME).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.FAMILY_NAME, R.string.name_family,
+                        FLAGS_PERSON_NAME).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.MIDDLE_NAME, R.string.name_middle,
+                        FLAGS_PERSON_NAME).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.GIVEN_NAME, R.string.name_given,
+                        FLAGS_PERSON_NAME).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.SUFFIX, R.string.name_suffix,
+                        FLAGS_PERSON_NAME).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.PHONETIC_FAMILY_NAME,
+                        R.string.name_phonetic_family, FLAGS_PHONETIC).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.PHONETIC_MIDDLE_NAME,
+                        R.string.name_phonetic_middle, FLAGS_PHONETIC).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.PHONETIC_GIVEN_NAME,
+                        R.string.name_phonetic_given, FLAGS_PHONETIC).setLongForm(true));
+            } else {
+                kind.fieldList.add(new EditField(StructuredName.PREFIX, R.string.name_prefix,
+                        FLAGS_PERSON_NAME).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.GIVEN_NAME, R.string.name_given,
+                        FLAGS_PERSON_NAME).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.MIDDLE_NAME, R.string.name_middle,
+                        FLAGS_PERSON_NAME).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.FAMILY_NAME, R.string.name_family,
+                        FLAGS_PERSON_NAME).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.SUFFIX, R.string.name_suffix,
+                        FLAGS_PERSON_NAME).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.PHONETIC_GIVEN_NAME,
+                        R.string.name_phonetic_given, FLAGS_PHONETIC).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.PHONETIC_MIDDLE_NAME,
+                        R.string.name_phonetic_middle, FLAGS_PHONETIC).setLongForm(true));
+                kind.fieldList.add(new EditField(StructuredName.PHONETIC_FAMILY_NAME,
+                        R.string.name_phonetic_family, FLAGS_PHONETIC).setLongForm(true));
+            }
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflateNickname(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(Nickname.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(Nickname.CONTENT_ITEM_TYPE,
+                    R.string.nicknameLabelsGroup, -1, 115, true));
+            kind.secondary = true;
+            kind.isList = false;
+            kind.actionHeader = new SimpleInflater(R.string.nicknameLabelsGroup);
+            kind.actionBody = new SimpleInflater(Nickname.NAME);
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.defaultValues = new ContentValues();
+            kind.defaultValues.put(Nickname.TYPE, Nickname.TYPE_DEFAULT);
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Nickname.NAME, R.string.nicknameLabelsGroup,
+                    FLAGS_PERSON_NAME));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflatePhone(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(Phone.CONTENT_ITEM_TYPE, R.string.phoneLabelsGroup,
+                    android.R.drawable.sym_action_call, 10, true));
+            kind.iconAltRes = R.drawable.sym_action_sms;
+            kind.actionHeader = new PhoneActionInflater();
+            kind.actionAltHeader = new PhoneActionAltInflater();
+            kind.actionBody = new SimpleInflater(Phone.NUMBER);
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.typeColumn = Phone.TYPE;
+            kind.typeList = Lists.newArrayList();
+            kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_WORK));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_PAGER).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_CUSTOM).setSecondary(true).setCustomColumn(
+                    Phone.LABEL));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_CALLBACK).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_CAR).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_COMPANY_MAIN).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_ISDN).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_MAIN).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER_FAX).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_RADIO).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_TELEX).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_TTY_TDD).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_WORK_MOBILE).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_WORK_PAGER).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_ASSISTANT).setSecondary(true)
+                    .setCustomColumn(Phone.LABEL));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_MMS).setSecondary(true));
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Phone.NUMBER, R.string.phoneLabelsGroup, FLAGS_PHONE));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflateEmail(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(Email.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(Email.CONTENT_ITEM_TYPE,
+                    R.string.emailLabelsGroup, R.drawable.sym_action_email, 15, true));
+            kind.actionHeader = new EmailActionInflater();
+            kind.actionBody = new SimpleInflater(Email.DATA);
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.typeColumn = Email.TYPE;
+            kind.typeList = Lists.newArrayList();
+            kind.typeList.add(buildEmailType(Email.TYPE_HOME));
+            kind.typeList.add(buildEmailType(Email.TYPE_WORK));
+            kind.typeList.add(buildEmailType(Email.TYPE_OTHER));
+            kind.typeList.add(buildEmailType(Email.TYPE_MOBILE));
+            kind.typeList.add(buildEmailType(Email.TYPE_CUSTOM).setSecondary(true).setCustomColumn(
+                    Email.LABEL));
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Email.DATA, R.string.emailLabelsGroup, FLAGS_EMAIL));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflateStructuredPostal(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(StructuredPostal.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(StructuredPostal.CONTENT_ITEM_TYPE,
+                    R.string.postalLabelsGroup, R.drawable.sym_action_map, 25, true));
+            kind.actionHeader = new PostalActionInflater();
+            kind.actionBody = new SimpleInflater(StructuredPostal.FORMATTED_ADDRESS);
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.typeColumn = StructuredPostal.TYPE;
+            kind.typeList = Lists.newArrayList();
+            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_HOME));
+            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_WORK));
+            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_OTHER));
+            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_CUSTOM).setSecondary(true)
+                    .setCustomColumn(StructuredPostal.LABEL));
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(
+                    new EditField(StructuredPostal.FORMATTED_ADDRESS, R.string.postal_address,
+                            FLAGS_POSTAL).setMinLines(3));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflateIm(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(Im.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(Im.CONTENT_ITEM_TYPE, R.string.imLabelsGroup,
+                    android.R.drawable.sym_action_chat, 20, true));
+            kind.secondary = true;
+            kind.actionHeader = new ImActionInflater();
+            kind.actionBody = new SimpleInflater(Im.DATA);
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            // NOTE: even though a traditional "type" exists, for editing
+            // purposes we're using the protocol to pick labels
+
+            kind.defaultValues = new ContentValues();
+            kind.defaultValues.put(Im.TYPE, Im.TYPE_OTHER);
+
+            kind.typeColumn = Im.PROTOCOL;
+            kind.typeList = Lists.newArrayList();
+            kind.typeList.add(buildImType(Im.PROTOCOL_AIM));
+            kind.typeList.add(buildImType(Im.PROTOCOL_MSN));
+            kind.typeList.add(buildImType(Im.PROTOCOL_YAHOO));
+            kind.typeList.add(buildImType(Im.PROTOCOL_SKYPE));
+            kind.typeList.add(buildImType(Im.PROTOCOL_QQ));
+            kind.typeList.add(buildImType(Im.PROTOCOL_GOOGLE_TALK));
+            kind.typeList.add(buildImType(Im.PROTOCOL_ICQ));
+            kind.typeList.add(buildImType(Im.PROTOCOL_JABBER));
+            kind.typeList.add(buildImType(Im.PROTOCOL_CUSTOM).setSecondary(true).setCustomColumn(
+                    Im.CUSTOM_PROTOCOL));
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Im.DATA, R.string.imLabelsGroup, FLAGS_EMAIL));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflateOrganization(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(Organization.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(Organization.CONTENT_ITEM_TYPE,
+                    R.string.organizationLabelsGroup, -1, 5, true));
+            kind.actionHeader = new SimpleInflater(Organization.COMPANY);
+            kind.actionBody = new SimpleInflater(Organization.TITLE);
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.isList = false;
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Organization.COMPANY, R.string.ghostData_company,
+                    FLAGS_GENERIC_NAME));
+            kind.fieldList.add(new EditField(Organization.TITLE, R.string.ghostData_title,
+                    FLAGS_GENERIC_NAME));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflatePhoto(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(Photo.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(Photo.CONTENT_ITEM_TYPE, -1, -1, -1, true));
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Photo.PHOTO, -1, -1));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflateNote(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(Note.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(Note.CONTENT_ITEM_TYPE,
+                    R.string.label_notes, -1, 110, true));
+            kind.isList = false;
+            kind.secondary = true;
+            kind.actionHeader = new SimpleInflater(R.string.label_notes);
+            kind.actionBody = new SimpleInflater(Note.NOTE);
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflateWebsite(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(Website.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(Website.CONTENT_ITEM_TYPE,
+                    R.string.websiteLabelsGroup, -1, 120, true));
+            kind.secondary = true;
+            kind.actionHeader = new SimpleInflater(R.string.websiteLabelsGroup);
+            kind.actionBody = new SimpleInflater(Website.URL);
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.defaultValues = new ContentValues();
+            kind.defaultValues.put(Website.TYPE, Website.TYPE_OTHER);
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Website.URL, R.string.websiteLabelsGroup, FLAGS_WEBSITE));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflateEvent(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(Event.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            // TODO make the event field editable.  The difficulty is that Google Contacts
+            // drops incorrectly formatted dates.  This means that we would
+            // need to know exactly how the sync adapter wants the date formatted and
+            // then have a rigid UI and automatic formatting of the date for the sync adapter.
+            kind = addKind(new DataKind(Event.CONTENT_ITEM_TYPE,
+                    R.string.eventLabelsGroup, -1, 150, false));
+            kind.secondary = true;
+            kind.actionHeader = new EventActionInflater();
+            kind.actionBody = new SimpleInflater(Event.START_DATE);
+
+            kind.typeColumn = Event.TYPE;
+            kind.typeList = Lists.newArrayList();
+            kind.typeList.add(buildEventType(Event.TYPE_BIRTHDAY));
+            kind.typeList.add(buildEventType(Event.TYPE_ANNIVERSARY));
+            kind.typeList.add(buildEventType(Event.TYPE_OTHER));
+            kind.typeList.add(buildEventType(Event.TYPE_CUSTOM).setSecondary(true).setCustomColumn(
+                    Event.LABEL));
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Event.DATA, R.string.eventLabelsGroup, FLAGS_EVENT));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflateSipAddress(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(SipAddress.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            // The icon specified here is the one that gets displayed for
+            // "Internet call" items, in the "view contact" UI within the
+            // Contacts app.
+            //
+            // This is independent of the "SIP call" icon that gets
+            // displayed in the Quick Contacts widget, which comes from
+            // the android:icon attribute of the SIP-related
+            // intent-filters in the Phone app's manifest.
+
+            kind = addKind(new DataKind(SipAddress.CONTENT_ITEM_TYPE,
+                    R.string.label_sip_address, android.R.drawable.sym_action_call, 130, true));
+
+            kind.isList = false;
+            kind.secondary = true;
+            kind.actionHeader = new SimpleInflater(R.string.label_sip_address);
+            kind.actionBody = new SimpleInflater(SipAddress.SIP_ADDRESS);
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(SipAddress.SIP_ADDRESS,
+                                             R.string.label_sip_address, FLAGS_SIP_ADDRESS));
+        }
+
+        return kind;
+    }
+
+    protected DataKind inflateGroupMembership(Context context, int inflateLevel) {
+        DataKind kind = getKindForMimetype(GroupMembership.CONTENT_ITEM_TYPE);
+        if (kind == null) {
+            kind = addKind(new DataKind(GroupMembership.CONTENT_ITEM_TYPE,
+                    R.string.groupsLabel, android.R.drawable.sym_contact_card, 999, true));
+
+            kind.isList = false;
+        }
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(GroupMembership.GROUP_ROW_ID, -1, -1));
+        }
+
+        return kind;
+    }
+
+    /**
+     * Simple inflater that assumes a string resource has a "%s" that will be
+     * filled from the given column.
+     */
+    public static class SimpleInflater implements StringInflater {
+        private final int mStringRes;
+        private final String mColumnName;
+
+        public SimpleInflater(int stringRes) {
+            this(stringRes, null);
+        }
+
+        public SimpleInflater(String columnName) {
+            this(-1, columnName);
+        }
+
+        public SimpleInflater(int stringRes, String columnName) {
+            mStringRes = stringRes;
+            mColumnName = columnName;
+        }
+
+        public CharSequence inflateUsing(Context context, Cursor cursor) {
+            final int index = mColumnName != null ? cursor.getColumnIndex(mColumnName) : -1;
+            final boolean validString = mStringRes > 0;
+            final boolean validColumn = index != -1;
+
+            final CharSequence stringValue = validString ? context.getText(mStringRes) : null;
+            final CharSequence columnValue = validColumn ? cursor.getString(index) : null;
+
+            if (validString && validColumn) {
+                return String.format(stringValue.toString(), columnValue);
+            } else if (validString) {
+                return stringValue;
+            } else if (validColumn) {
+                return columnValue;
+            } else {
+                return null;
+            }
+        }
+
+        public CharSequence inflateUsing(Context context, ContentValues values) {
+            final boolean validColumn = values.containsKey(mColumnName);
+            final boolean validString = mStringRes > 0;
+
+            final CharSequence stringValue = validString ? context.getText(mStringRes) : null;
+            final CharSequence columnValue = validColumn ? values.getAsString(mColumnName) : null;
+
+            if (validString && validColumn) {
+                return String.format(stringValue.toString(), columnValue);
+            } else if (validString) {
+                return stringValue;
+            } else if (validColumn) {
+                return columnValue;
+            } else {
+                return null;
+            }
+        }
+    }
+
+    public static abstract class CommonInflater implements StringInflater {
+        protected abstract int getTypeLabelResource(Integer type);
+
+        protected boolean isCustom(Integer type) {
+            return type == BaseTypes.TYPE_CUSTOM;
+        }
+
+        protected String getTypeColumn() {
+            return Phone.TYPE;
+        }
+
+        protected String getLabelColumn() {
+            return Phone.LABEL;
+        }
+
+        protected CharSequence getTypeLabel(Resources res, Integer type, CharSequence label) {
+            final int labelRes = getTypeLabelResource(type);
+            if (type == null) {
+                return res.getText(labelRes);
+            } else if (isCustom(type)) {
+                return res.getString(labelRes, label == null ? "" : label);
+            } else {
+                return res.getText(labelRes);
+            }
+        }
+
+        public CharSequence inflateUsing(Context context, Cursor cursor) {
+            final Integer type = cursor.getInt(cursor.getColumnIndex(getTypeColumn()));
+            final String label = cursor.getString(cursor.getColumnIndex(getLabelColumn()));
+            return getTypeLabel(context.getResources(), type, label);
+        }
+
+        public CharSequence inflateUsing(Context context, ContentValues values) {
+            final Integer type = values.getAsInteger(getTypeColumn());
+            final String label = values.getAsString(getLabelColumn());
+            return getTypeLabel(context.getResources(), type, label);
+        }
+    }
+
+    public static class PhoneActionInflater extends CommonInflater {
+        @Override
+        protected boolean isCustom(Integer type) {
+            return type == Phone.TYPE_CUSTOM || type == Phone.TYPE_ASSISTANT;
+        }
+
+        @Override
+        protected int getTypeLabelResource(Integer type) {
+            if (type == null) return R.string.call_other;
+            switch (type) {
+                case Phone.TYPE_HOME: return R.string.call_home;
+                case Phone.TYPE_MOBILE: return R.string.call_mobile;
+                case Phone.TYPE_WORK: return R.string.call_work;
+                case Phone.TYPE_FAX_WORK: return R.string.call_fax_work;
+                case Phone.TYPE_FAX_HOME: return R.string.call_fax_home;
+                case Phone.TYPE_PAGER: return R.string.call_pager;
+                case Phone.TYPE_OTHER: return R.string.call_other;
+                case Phone.TYPE_CALLBACK: return R.string.call_callback;
+                case Phone.TYPE_CAR: return R.string.call_car;
+                case Phone.TYPE_COMPANY_MAIN: return R.string.call_company_main;
+                case Phone.TYPE_ISDN: return R.string.call_isdn;
+                case Phone.TYPE_MAIN: return R.string.call_main;
+                case Phone.TYPE_OTHER_FAX: return R.string.call_other_fax;
+                case Phone.TYPE_RADIO: return R.string.call_radio;
+                case Phone.TYPE_TELEX: return R.string.call_telex;
+                case Phone.TYPE_TTY_TDD: return R.string.call_tty_tdd;
+                case Phone.TYPE_WORK_MOBILE: return R.string.call_work_mobile;
+                case Phone.TYPE_WORK_PAGER: return R.string.call_work_pager;
+                case Phone.TYPE_ASSISTANT: return R.string.call_assistant;
+                case Phone.TYPE_MMS: return R.string.call_mms;
+                default: return R.string.call_custom;
+            }
+        }
+    }
+
+    public static class PhoneActionAltInflater extends CommonInflater {
+        @Override
+        protected boolean isCustom(Integer type) {
+            return (type == Phone.TYPE_CUSTOM || type == Phone.TYPE_ASSISTANT);
+        }
+
+        @Override
+        protected int getTypeLabelResource(Integer type) {
+            if (type == null) return R.string.sms_other;
+            switch (type) {
+                case Phone.TYPE_HOME: return R.string.sms_home;
+                case Phone.TYPE_MOBILE: return R.string.sms_mobile;
+                case Phone.TYPE_WORK: return R.string.sms_work;
+                case Phone.TYPE_FAX_WORK: return R.string.sms_fax_work;
+                case Phone.TYPE_FAX_HOME: return R.string.sms_fax_home;
+                case Phone.TYPE_PAGER: return R.string.sms_pager;
+                case Phone.TYPE_OTHER: return R.string.sms_other;
+                case Phone.TYPE_CALLBACK: return R.string.sms_callback;
+                case Phone.TYPE_CAR: return R.string.sms_car;
+                case Phone.TYPE_COMPANY_MAIN: return R.string.sms_company_main;
+                case Phone.TYPE_ISDN: return R.string.sms_isdn;
+                case Phone.TYPE_MAIN: return R.string.sms_main;
+                case Phone.TYPE_OTHER_FAX: return R.string.sms_other_fax;
+                case Phone.TYPE_RADIO: return R.string.sms_radio;
+                case Phone.TYPE_TELEX: return R.string.sms_telex;
+                case Phone.TYPE_TTY_TDD: return R.string.sms_tty_tdd;
+                case Phone.TYPE_WORK_MOBILE: return R.string.sms_work_mobile;
+                case Phone.TYPE_WORK_PAGER: return R.string.sms_work_pager;
+                case Phone.TYPE_ASSISTANT: return R.string.sms_assistant;
+                case Phone.TYPE_MMS: return R.string.sms_mms;
+                default: return R.string.sms_custom;
+            }
+        }
+    }
+
+    public static class EmailActionInflater extends CommonInflater {
+        @Override
+        protected int getTypeLabelResource(Integer type) {
+            if (type == null) return R.string.email;
+            switch (type) {
+                case Email.TYPE_HOME: return R.string.email_home;
+                case Email.TYPE_WORK: return R.string.email_work;
+                case Email.TYPE_OTHER: return R.string.email_other;
+                case Email.TYPE_MOBILE: return R.string.email_mobile;
+                default: return R.string.email_custom;
+            }
+        }
+    }
+
+    public static class EventActionInflater extends CommonInflater {
+        @Override
+        protected int getTypeLabelResource(Integer type) {
+            return Event.getTypeResource(type);
+        }
+    }
+
+    public static class PostalActionInflater extends CommonInflater {
+        @Override
+        protected int getTypeLabelResource(Integer type) {
+            if (type == null) return R.string.map_other;
+            switch (type) {
+                case StructuredPostal.TYPE_HOME: return R.string.map_home;
+                case StructuredPostal.TYPE_WORK: return R.string.map_work;
+                case StructuredPostal.TYPE_OTHER: return R.string.map_other;
+                default: return R.string.map_custom;
+            }
+        }
+    }
+
+    public static class ImActionInflater extends CommonInflater {
+        @Override
+        protected String getTypeColumn() {
+            return Im.PROTOCOL;
+        }
+
+        @Override
+        protected String getLabelColumn() {
+            return Im.CUSTOM_PROTOCOL;
+        }
+
+        @Override
+        protected int getTypeLabelResource(Integer type) {
+            if (type == null) return R.string.chat;
+            switch (type) {
+                case Im.PROTOCOL_AIM: return R.string.chat_aim;
+                case Im.PROTOCOL_MSN: return R.string.chat_msn;
+                case Im.PROTOCOL_YAHOO: return R.string.chat_yahoo;
+                case Im.PROTOCOL_SKYPE: return R.string.chat_skype;
+                case Im.PROTOCOL_QQ: return R.string.chat_qq;
+                case Im.PROTOCOL_GOOGLE_TALK: return R.string.chat_gtalk;
+                case Im.PROTOCOL_ICQ: return R.string.chat_icq;
+                case Im.PROTOCOL_JABBER: return R.string.chat_jabber;
+                case Im.PROTOCOL_NETMEETING: return R.string.chat;
+                default: return R.string.chat;
+            }
+        }
+    }
+
+    @Override
+    public int getHeaderColor(Context context) {
+        return 0xff7f93bc;
+    }
+
+    @Override
+    public int getSideBarColor(Context context) {
+        return 0xffbdc7b8;
+    }
+}
diff --git a/src/com/android/contacts/model/FallbackSource.java b/src/com/android/contacts/model/FallbackSource.java
deleted file mode 100644
index f36752a..0000000
--- a/src/com/android/contacts/model/FallbackSource.java
+++ /dev/null
@@ -1,713 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.model;
-
-import com.android.contacts.R;
-import com.google.android.collect.Lists;
-
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.res.Resources;
-import android.database.Cursor;
-import android.provider.ContactsContract.CommonDataKinds.BaseTypes;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.Event;
-import android.provider.ContactsContract.CommonDataKinds.Im;
-import android.provider.ContactsContract.CommonDataKinds.Nickname;
-import android.provider.ContactsContract.CommonDataKinds.Note;
-import android.provider.ContactsContract.CommonDataKinds.Organization;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.CommonDataKinds.Photo;
-import android.provider.ContactsContract.CommonDataKinds.SipAddress;
-import android.provider.ContactsContract.CommonDataKinds.StructuredName;
-import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
-import android.provider.ContactsContract.CommonDataKinds.Website;
-import android.view.inputmethod.EditorInfo;
-
-import java.util.Locale;
-
-public class FallbackSource extends ContactsSource {
-    protected static final int FLAGS_PHONE = EditorInfo.TYPE_CLASS_PHONE;
-    protected static final int FLAGS_EMAIL = EditorInfo.TYPE_CLASS_TEXT
-            | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
-    protected static final int FLAGS_PERSON_NAME = EditorInfo.TYPE_CLASS_TEXT
-            | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS | EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME;
-    protected static final int FLAGS_PHONETIC = EditorInfo.TYPE_CLASS_TEXT
-            | EditorInfo.TYPE_TEXT_VARIATION_PHONETIC;
-    protected static final int FLAGS_GENERIC_NAME = EditorInfo.TYPE_CLASS_TEXT
-            | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS;
-    protected static final int FLAGS_NOTE = EditorInfo.TYPE_CLASS_TEXT
-            | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
-    protected static final int FLAGS_WEBSITE = EditorInfo.TYPE_CLASS_TEXT
-            | EditorInfo.TYPE_TEXT_VARIATION_URI;
-    protected static final int FLAGS_POSTAL = EditorInfo.TYPE_CLASS_TEXT
-            | EditorInfo.TYPE_TEXT_VARIATION_POSTAL_ADDRESS | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS
-            | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
-    protected static final int FLAGS_SIP_ADDRESS = EditorInfo.TYPE_CLASS_TEXT
-            | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;  // since SIP addresses have the same
-                                                             // basic format as email addresses
-
-    public FallbackSource() {
-        this.accountType = null;
-        this.titleRes = R.string.account_phone;
-        this.iconRes = R.drawable.ic_launcher_contacts;
-    }
-
-    @Override
-    protected void inflate(Context context, int inflateLevel) {
-
-        inflateStructuredName(context, inflateLevel);
-        inflateNickname(context, inflateLevel);
-        inflatePhone(context, inflateLevel);
-        inflateEmail(context, inflateLevel);
-        inflateStructuredPostal(context, inflateLevel);
-        inflateIm(context, inflateLevel);
-        inflateOrganization(context, inflateLevel);
-        inflatePhoto(context, inflateLevel);
-        inflateNote(context, inflateLevel);
-        inflateWebsite(context, inflateLevel);
-        inflateEvent(context, inflateLevel);
-        inflateSipAddress(context, inflateLevel);
-
-        setInflatedLevel(inflateLevel);
-
-    }
-
-    protected EditType buildPhoneType(int type) {
-        return new EditType(type, Phone.getTypeLabelResource(type));
-    }
-
-    protected EditType buildEmailType(int type) {
-        return new EditType(type, Email.getTypeLabelResource(type));
-    }
-
-    protected EditType buildPostalType(int type) {
-        return new EditType(type, StructuredPostal.getTypeLabelResource(type));
-    }
-
-    protected EditType buildImType(int type) {
-        return new EditType(type, Im.getProtocolLabelResource(type));
-    }
-
-    protected EditType buildOrgType(int type) {
-        return new EditType(type, Organization.getTypeLabelResource(type));
-    }
-
-    protected DataKind inflateStructuredName(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(StructuredName.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(StructuredName.CONTENT_ITEM_TYPE,
-                    R.string.nameLabelsGroup, -1, -1, true));
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            boolean displayOrderPrimary =
-                    context.getResources().getBoolean(R.bool.config_editor_field_order_primary);
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(StructuredName.PREFIX, R.string.name_prefix,
-                    FLAGS_PERSON_NAME).setOptional(true));
-            if (!displayOrderPrimary) {
-                kind.fieldList.add(new EditField(StructuredName.FAMILY_NAME, R.string.name_family,
-                        FLAGS_PERSON_NAME));
-                kind.fieldList.add(new EditField(StructuredName.MIDDLE_NAME, R.string.name_middle,
-                        FLAGS_PERSON_NAME).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.GIVEN_NAME, R.string.name_given,
-                        FLAGS_PERSON_NAME));
-                kind.fieldList.add(new EditField(StructuredName.SUFFIX, R.string.name_suffix,
-                        FLAGS_PERSON_NAME).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.PHONETIC_FAMILY_NAME,
-                        R.string.name_phonetic_family, FLAGS_PHONETIC).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.PHONETIC_MIDDLE_NAME,
-                        R.string.name_phonetic_middle, FLAGS_PHONETIC).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.PHONETIC_GIVEN_NAME,
-                        R.string.name_phonetic_given, FLAGS_PHONETIC).setOptional(true));
-            } else {
-                kind.fieldList.add(new EditField(StructuredName.GIVEN_NAME, R.string.name_given,
-                        FLAGS_PERSON_NAME));
-                kind.fieldList.add(new EditField(StructuredName.MIDDLE_NAME, R.string.name_middle,
-                        FLAGS_PERSON_NAME).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.FAMILY_NAME, R.string.name_family,
-                        FLAGS_PERSON_NAME));
-                kind.fieldList.add(new EditField(StructuredName.SUFFIX, R.string.name_suffix,
-                        FLAGS_PERSON_NAME).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.PHONETIC_GIVEN_NAME,
-                        R.string.name_phonetic_given, FLAGS_PHONETIC).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.PHONETIC_MIDDLE_NAME,
-                        R.string.name_phonetic_middle, FLAGS_PHONETIC).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredName.PHONETIC_FAMILY_NAME,
-                        R.string.name_phonetic_family, FLAGS_PHONETIC).setOptional(true));
-            }
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflateNickname(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(Nickname.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(Nickname.CONTENT_ITEM_TYPE,
-                    R.string.nicknameLabelsGroup, -1, 115, true));
-            kind.secondary = true;
-            kind.isList = false;
-            kind.actionHeader = new SimpleInflater(R.string.nicknameLabelsGroup);
-            kind.actionBody = new SimpleInflater(Nickname.NAME);
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.defaultValues = new ContentValues();
-            kind.defaultValues.put(Nickname.TYPE, Nickname.TYPE_DEFAULT);
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Nickname.NAME, R.string.nicknameLabelsGroup,
-                    FLAGS_PERSON_NAME));
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflatePhone(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(Phone.CONTENT_ITEM_TYPE, R.string.phoneLabelsGroup,
-                    android.R.drawable.sym_action_call, 10, true));
-            kind.iconAltRes = R.drawable.sym_action_sms;
-            kind.actionHeader = new PhoneActionInflater();
-            kind.actionAltHeader = new PhoneActionAltInflater();
-            kind.actionBody = new SimpleInflater(Phone.NUMBER);
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.typeColumn = Phone.TYPE;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_WORK));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_PAGER).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_CUSTOM).setSecondary(true).setCustomColumn(
-                    Phone.LABEL));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_CALLBACK).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_CAR).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_COMPANY_MAIN).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_ISDN).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_MAIN).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER_FAX).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_RADIO).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_TELEX).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_TTY_TDD).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_WORK_MOBILE).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_WORK_PAGER).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_ASSISTANT).setSecondary(true)
-                    .setCustomColumn(Phone.LABEL));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_MMS).setSecondary(true));
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Phone.NUMBER, R.string.phoneLabelsGroup, FLAGS_PHONE));
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflateEmail(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(Email.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(Email.CONTENT_ITEM_TYPE,
-                    R.string.emailLabelsGroup, android.R.drawable.sym_action_email, 15, true));
-            kind.actionHeader = new EmailActionInflater();
-            kind.actionBody = new SimpleInflater(Email.DATA);
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.typeColumn = Email.TYPE;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildEmailType(Email.TYPE_HOME));
-            kind.typeList.add(buildEmailType(Email.TYPE_WORK));
-            kind.typeList.add(buildEmailType(Email.TYPE_OTHER));
-            kind.typeList.add(buildEmailType(Email.TYPE_MOBILE));
-            kind.typeList.add(buildEmailType(Email.TYPE_CUSTOM).setSecondary(true).setCustomColumn(
-                    Email.LABEL));
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Email.DATA, R.string.emailLabelsGroup, FLAGS_EMAIL));
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflateStructuredPostal(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(StructuredPostal.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(StructuredPostal.CONTENT_ITEM_TYPE,
-                    R.string.postalLabelsGroup, R.drawable.sym_action_map, 25, true));
-            kind.actionHeader = new PostalActionInflater();
-            kind.actionBody = new SimpleInflater(StructuredPostal.FORMATTED_ADDRESS);
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            final boolean useJapaneseOrder =
-                Locale.JAPANESE.getLanguage().equals(Locale.getDefault().getLanguage());
-            kind.typeColumn = StructuredPostal.TYPE;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_HOME));
-            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_WORK));
-            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_OTHER));
-            kind.typeList.add(buildPostalType(StructuredPostal.TYPE_CUSTOM).setSecondary(true)
-                    .setCustomColumn(StructuredPostal.LABEL));
-
-            kind.fieldList = Lists.newArrayList();
-
-            if (useJapaneseOrder) {
-                kind.fieldList.add(new EditField(StructuredPostal.COUNTRY,
-                        R.string.postal_country, FLAGS_POSTAL).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredPostal.POSTCODE,
-                        R.string.postal_postcode, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.REGION,
-                        R.string.postal_region, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.CITY,
-                        R.string.postal_city, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.NEIGHBORHOOD,
-                        R.string.postal_neighborhood, FLAGS_POSTAL).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredPostal.STREET,
-                        R.string.postal_street, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.POBOX,
-                        R.string.postal_pobox, FLAGS_POSTAL).setOptional(true));
-            } else {
-                kind.fieldList.add(new EditField(StructuredPostal.STREET,
-                        R.string.postal_street, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.POBOX,
-                        R.string.postal_pobox, FLAGS_POSTAL).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredPostal.NEIGHBORHOOD,
-                        R.string.postal_neighborhood, FLAGS_POSTAL).setOptional(true));
-                kind.fieldList.add(new EditField(StructuredPostal.CITY,
-                        R.string.postal_city, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.REGION,
-                        R.string.postal_region, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.POSTCODE,
-                        R.string.postal_postcode, FLAGS_POSTAL));
-                kind.fieldList.add(new EditField(StructuredPostal.COUNTRY,
-                        R.string.postal_country, FLAGS_POSTAL).setOptional(true));
-            }
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflateIm(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(Im.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(Im.CONTENT_ITEM_TYPE, R.string.imLabelsGroup,
-                    android.R.drawable.sym_action_chat, 20, true));
-            kind.secondary = true;
-            kind.actionHeader = new ImActionInflater();
-            kind.actionBody = new SimpleInflater(Im.DATA);
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            // NOTE: even though a traditional "type" exists, for editing
-            // purposes we're using the protocol to pick labels
-
-            kind.defaultValues = new ContentValues();
-            kind.defaultValues.put(Im.TYPE, Im.TYPE_OTHER);
-
-            kind.typeColumn = Im.PROTOCOL;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildImType(Im.PROTOCOL_AIM));
-            kind.typeList.add(buildImType(Im.PROTOCOL_MSN));
-            kind.typeList.add(buildImType(Im.PROTOCOL_YAHOO));
-            kind.typeList.add(buildImType(Im.PROTOCOL_SKYPE));
-            kind.typeList.add(buildImType(Im.PROTOCOL_QQ));
-            kind.typeList.add(buildImType(Im.PROTOCOL_GOOGLE_TALK));
-            kind.typeList.add(buildImType(Im.PROTOCOL_ICQ));
-            kind.typeList.add(buildImType(Im.PROTOCOL_JABBER));
-            kind.typeList.add(buildImType(Im.PROTOCOL_CUSTOM).setSecondary(true).setCustomColumn(
-                    Im.CUSTOM_PROTOCOL));
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Im.DATA, R.string.imLabelsGroup, FLAGS_EMAIL));
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflateOrganization(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(Organization.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(Organization.CONTENT_ITEM_TYPE,
-                    R.string.organizationLabelsGroup, R.drawable.sym_action_organization, 30, true));
-            kind.actionHeader = new SimpleInflater(Organization.COMPANY);
-            kind.actionBody = new SimpleInflater(Organization.TITLE);
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.typeColumn = Organization.TYPE;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildOrgType(Organization.TYPE_WORK));
-            kind.typeList.add(buildOrgType(Organization.TYPE_OTHER));
-            kind.typeList.add(buildOrgType(Organization.TYPE_CUSTOM).setSecondary(true)
-                    .setCustomColumn(Organization.LABEL));
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Organization.COMPANY, R.string.ghostData_company,
-                    FLAGS_GENERIC_NAME));
-            kind.fieldList.add(new EditField(Organization.TITLE, R.string.ghostData_title,
-                    FLAGS_GENERIC_NAME));
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflatePhoto(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(Photo.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(Photo.CONTENT_ITEM_TYPE, -1, -1, -1, true));
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Photo.PHOTO, -1, -1));
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflateNote(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(Note.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(Note.CONTENT_ITEM_TYPE,
-                    R.string.label_notes, R.drawable.sym_note, 110, true));
-            kind.isList = false;
-            kind.secondary = true;
-            kind.actionHeader = new SimpleInflater(R.string.label_notes);
-            kind.actionBody = new SimpleInflater(Note.NOTE);
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflateWebsite(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(Website.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(Website.CONTENT_ITEM_TYPE,
-                    R.string.websiteLabelsGroup, -1, 120, true));
-            kind.secondary = true;
-            kind.actionHeader = new SimpleInflater(R.string.websiteLabelsGroup);
-            kind.actionBody = new SimpleInflater(Website.URL);
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.defaultValues = new ContentValues();
-            kind.defaultValues.put(Website.TYPE, Website.TYPE_OTHER);
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Website.URL, R.string.websiteLabelsGroup, FLAGS_WEBSITE));
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflateEvent(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(Event.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            kind = addKind(new DataKind(Event.CONTENT_ITEM_TYPE,
-                    R.string.eventLabelsGroup, -1, 150, false));
-            kind.secondary = true;
-            kind.actionHeader = new EventActionInflater();
-            kind.actionBody = new SimpleInflater(Event.START_DATE);
-        }
-
-        return kind;
-    }
-
-    protected DataKind inflateSipAddress(Context context, int inflateLevel) {
-        DataKind kind = getKindForMimetype(SipAddress.CONTENT_ITEM_TYPE);
-        if (kind == null) {
-            // The icon specified here is the one that gets displayed for
-            // "Internet call" items, in the "view contact" UI within the
-            // Contacts app.
-            //
-            // This is independent of the "SIP call" icon that gets
-            // displayed in the Quick Contacts widget, which comes from
-            // the android:icon attribute of the SIP-related
-            // intent-filters in the Phone app's manifest.
-
-            kind = addKind(new DataKind(SipAddress.CONTENT_ITEM_TYPE,
-                    R.string.label_sip_address, android.R.drawable.sym_action_call, 130, true));
-
-            kind.isList = false;
-            kind.secondary = true;
-            kind.actionHeader = new SimpleInflater(R.string.label_sip_address);
-            kind.actionBody = new SimpleInflater(SipAddress.SIP_ADDRESS);
-        }
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(SipAddress.SIP_ADDRESS,
-                                             R.string.label_sip_address, FLAGS_SIP_ADDRESS));
-        }
-
-        return kind;
-    }
-
-    /**
-     * Simple inflater that assumes a string resource has a "%s" that will be
-     * filled from the given column.
-     */
-    public static class SimpleInflater implements StringInflater {
-        private final int mStringRes;
-        private final String mColumnName;
-
-        public SimpleInflater(int stringRes) {
-            this(stringRes, null);
-        }
-
-        public SimpleInflater(String columnName) {
-            this(-1, columnName);
-        }
-
-        public SimpleInflater(int stringRes, String columnName) {
-            mStringRes = stringRes;
-            mColumnName = columnName;
-        }
-
-        public CharSequence inflateUsing(Context context, Cursor cursor) {
-            final int index = mColumnName != null ? cursor.getColumnIndex(mColumnName) : -1;
-            final boolean validString = mStringRes > 0;
-            final boolean validColumn = index != -1;
-
-            final CharSequence stringValue = validString ? context.getText(mStringRes) : null;
-            final CharSequence columnValue = validColumn ? cursor.getString(index) : null;
-
-            if (validString && validColumn) {
-                return String.format(stringValue.toString(), columnValue);
-            } else if (validString) {
-                return stringValue;
-            } else if (validColumn) {
-                return columnValue;
-            } else {
-                return null;
-            }
-        }
-
-        public CharSequence inflateUsing(Context context, ContentValues values) {
-            final boolean validColumn = values.containsKey(mColumnName);
-            final boolean validString = mStringRes > 0;
-
-            final CharSequence stringValue = validString ? context.getText(mStringRes) : null;
-            final CharSequence columnValue = validColumn ? values.getAsString(mColumnName) : null;
-
-            if (validString && validColumn) {
-                return String.format(stringValue.toString(), columnValue);
-            } else if (validString) {
-                return stringValue;
-            } else if (validColumn) {
-                return columnValue;
-            } else {
-                return null;
-            }
-        }
-    }
-
-    public static abstract class CommonInflater implements StringInflater {
-        protected abstract int getTypeLabelResource(Integer type);
-
-        protected boolean isCustom(Integer type) {
-            return type == BaseTypes.TYPE_CUSTOM;
-        }
-
-        protected String getTypeColumn() {
-            return Phone.TYPE;
-        }
-
-        protected String getLabelColumn() {
-            return Phone.LABEL;
-        }
-
-        protected CharSequence getTypeLabel(Resources res, Integer type, CharSequence label) {
-            final int labelRes = getTypeLabelResource(type);
-            if (type == null) {
-                return res.getText(labelRes);
-            } else if (isCustom(type)) {
-                return res.getString(labelRes, label == null ? "" : label);
-            } else {
-                return res.getText(labelRes);
-            }
-        }
-
-        public CharSequence inflateUsing(Context context, Cursor cursor) {
-            final Integer type = cursor.getInt(cursor.getColumnIndex(getTypeColumn()));
-            final String label = cursor.getString(cursor.getColumnIndex(getLabelColumn()));
-            return getTypeLabel(context.getResources(), type, label);
-        }
-
-        public CharSequence inflateUsing(Context context, ContentValues values) {
-            final Integer type = values.getAsInteger(getTypeColumn());
-            final String label = values.getAsString(getLabelColumn());
-            return getTypeLabel(context.getResources(), type, label);
-        }
-    }
-
-    public static class PhoneActionInflater extends CommonInflater {
-        @Override
-        protected boolean isCustom(Integer type) {
-            return type == Phone.TYPE_CUSTOM || type == Phone.TYPE_ASSISTANT;
-        }
-
-        @Override
-        protected int getTypeLabelResource(Integer type) {
-            if (type == null) return R.string.call_other;
-            switch (type) {
-                case Phone.TYPE_HOME: return R.string.call_home;
-                case Phone.TYPE_MOBILE: return R.string.call_mobile;
-                case Phone.TYPE_WORK: return R.string.call_work;
-                case Phone.TYPE_FAX_WORK: return R.string.call_fax_work;
-                case Phone.TYPE_FAX_HOME: return R.string.call_fax_home;
-                case Phone.TYPE_PAGER: return R.string.call_pager;
-                case Phone.TYPE_OTHER: return R.string.call_other;
-                case Phone.TYPE_CALLBACK: return R.string.call_callback;
-                case Phone.TYPE_CAR: return R.string.call_car;
-                case Phone.TYPE_COMPANY_MAIN: return R.string.call_company_main;
-                case Phone.TYPE_ISDN: return R.string.call_isdn;
-                case Phone.TYPE_MAIN: return R.string.call_main;
-                case Phone.TYPE_OTHER_FAX: return R.string.call_other_fax;
-                case Phone.TYPE_RADIO: return R.string.call_radio;
-                case Phone.TYPE_TELEX: return R.string.call_telex;
-                case Phone.TYPE_TTY_TDD: return R.string.call_tty_tdd;
-                case Phone.TYPE_WORK_MOBILE: return R.string.call_work_mobile;
-                case Phone.TYPE_WORK_PAGER: return R.string.call_work_pager;
-                case Phone.TYPE_ASSISTANT: return R.string.call_assistant;
-                case Phone.TYPE_MMS: return R.string.call_mms;
-                default: return R.string.call_custom;
-            }
-        }
-    }
-
-    public static class PhoneActionAltInflater extends CommonInflater {
-        @Override
-        protected boolean isCustom(Integer type) {
-            return (type == Phone.TYPE_CUSTOM || type == Phone.TYPE_ASSISTANT);
-        }
-
-        @Override
-        protected int getTypeLabelResource(Integer type) {
-            if (type == null) return R.string.sms_other;
-            switch (type) {
-                case Phone.TYPE_HOME: return R.string.sms_home;
-                case Phone.TYPE_MOBILE: return R.string.sms_mobile;
-                case Phone.TYPE_WORK: return R.string.sms_work;
-                case Phone.TYPE_FAX_WORK: return R.string.sms_fax_work;
-                case Phone.TYPE_FAX_HOME: return R.string.sms_fax_home;
-                case Phone.TYPE_PAGER: return R.string.sms_pager;
-                case Phone.TYPE_OTHER: return R.string.sms_other;
-                case Phone.TYPE_CALLBACK: return R.string.sms_callback;
-                case Phone.TYPE_CAR: return R.string.sms_car;
-                case Phone.TYPE_COMPANY_MAIN: return R.string.sms_company_main;
-                case Phone.TYPE_ISDN: return R.string.sms_isdn;
-                case Phone.TYPE_MAIN: return R.string.sms_main;
-                case Phone.TYPE_OTHER_FAX: return R.string.sms_other_fax;
-                case Phone.TYPE_RADIO: return R.string.sms_radio;
-                case Phone.TYPE_TELEX: return R.string.sms_telex;
-                case Phone.TYPE_TTY_TDD: return R.string.sms_tty_tdd;
-                case Phone.TYPE_WORK_MOBILE: return R.string.sms_work_mobile;
-                case Phone.TYPE_WORK_PAGER: return R.string.sms_work_pager;
-                case Phone.TYPE_ASSISTANT: return R.string.sms_assistant;
-                case Phone.TYPE_MMS: return R.string.sms_mms;
-                default: return R.string.sms_custom;
-            }
-        }
-    }
-
-    public static class EmailActionInflater extends CommonInflater {
-        @Override
-        protected int getTypeLabelResource(Integer type) {
-            if (type == null) return R.string.email;
-            switch (type) {
-                case Email.TYPE_HOME: return R.string.email_home;
-                case Email.TYPE_WORK: return R.string.email_work;
-                case Email.TYPE_OTHER: return R.string.email_other;
-                case Email.TYPE_MOBILE: return R.string.email_mobile;
-                default: return R.string.email_custom;
-            }
-        }
-    }
-
-    public static class EventActionInflater extends CommonInflater {
-        @Override
-        protected int getTypeLabelResource(Integer type) {
-            return Event.getTypeResource(type);
-        }
-    }
-
-    public static class PostalActionInflater extends CommonInflater {
-        @Override
-        protected int getTypeLabelResource(Integer type) {
-            if (type == null) return R.string.map_other;
-            switch (type) {
-                case StructuredPostal.TYPE_HOME: return R.string.map_home;
-                case StructuredPostal.TYPE_WORK: return R.string.map_work;
-                case StructuredPostal.TYPE_OTHER: return R.string.map_other;
-                default: return R.string.map_custom;
-            }
-        }
-    }
-
-    public static class ImActionInflater extends CommonInflater {
-        @Override
-        protected String getTypeColumn() {
-            return Im.PROTOCOL;
-        }
-
-        @Override
-        protected String getLabelColumn() {
-            return Im.CUSTOM_PROTOCOL;
-        }
-
-        @Override
-        protected int getTypeLabelResource(Integer type) {
-            if (type == null) return R.string.chat;
-            switch (type) {
-                case Im.PROTOCOL_AIM: return R.string.chat_aim;
-                case Im.PROTOCOL_MSN: return R.string.chat_msn;
-                case Im.PROTOCOL_YAHOO: return R.string.chat_yahoo;
-                case Im.PROTOCOL_SKYPE: return R.string.chat_skype;
-                case Im.PROTOCOL_QQ: return R.string.chat_qq;
-                case Im.PROTOCOL_GOOGLE_TALK: return R.string.chat_gtalk;
-                case Im.PROTOCOL_ICQ: return R.string.chat_icq;
-                case Im.PROTOCOL_JABBER: return R.string.chat_jabber;
-                case Im.PROTOCOL_NETMEETING: return R.string.chat;
-                default: return R.string.chat;
-            }
-        }
-    }
-
-    @Override
-    public int getHeaderColor(Context context) {
-        return 0xff7f93bc;
-    }
-
-    @Override
-    public int getSideBarColor(Context context) {
-        return 0xffbdc7b8;
-    }
-}
diff --git a/src/com/android/contacts/model/GoogleAccountType.java b/src/com/android/contacts/model/GoogleAccountType.java
new file mode 100644
index 0000000..404c109
--- /dev/null
+++ b/src/com/android/contacts/model/GoogleAccountType.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2009 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.contacts.model;
+
+import com.android.contacts.R;
+import com.google.android.collect.Lists;
+
+import android.content.Context;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+
+public class GoogleAccountType extends FallbackAccountType {
+    public static final String ACCOUNT_TYPE = "com.google";
+
+    public GoogleAccountType(String resPackageName) {
+        this.accountType = ACCOUNT_TYPE;
+        this.resPackageName = null;
+        this.summaryResPackageName = resPackageName;
+    }
+
+    @Override
+    protected void inflate(Context context, int inflateLevel) {
+
+        inflateStructuredName(context, inflateLevel);
+        inflateNickname(context, inflateLevel);
+        inflatePhone(context, inflateLevel);
+        inflateEmail(context, inflateLevel);
+        inflateStructuredPostal(context, inflateLevel);
+        inflateIm(context, inflateLevel);
+        inflateOrganization(context, inflateLevel);
+        inflatePhoto(context, inflateLevel);
+        inflateNote(context, inflateLevel);
+        inflateWebsite(context, inflateLevel);
+        inflateEvent(context, inflateLevel);
+        inflateSipAddress(context, inflateLevel);
+        inflateGroupMembership(context, inflateLevel);
+
+        setInflatedLevel(inflateLevel);
+
+    }
+
+    @Override
+    protected DataKind inflatePhone(Context context, int inflateLevel) {
+        final DataKind kind = super.inflatePhone(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.typeColumn = Phone.TYPE;
+            kind.typeList = Lists.newArrayList();
+            kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_WORK));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_PAGER).setSecondary(true));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER));
+            kind.typeList.add(buildPhoneType(Phone.TYPE_CUSTOM).setSecondary(true).setCustomColumn(
+                    Phone.LABEL));
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Phone.NUMBER, R.string.phoneLabelsGroup, FLAGS_PHONE));
+        }
+
+        return kind;
+    }
+
+    @Override
+    protected DataKind inflateEmail(Context context, int inflateLevel) {
+        final DataKind kind = super.inflateEmail(context, BaseAccountType.LEVEL_MIMETYPES);
+
+        if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+            kind.typeColumn = Email.TYPE;
+            kind.typeList = Lists.newArrayList();
+            kind.typeList.add(buildEmailType(Email.TYPE_HOME));
+            kind.typeList.add(buildEmailType(Email.TYPE_WORK));
+            kind.typeList.add(buildEmailType(Email.TYPE_OTHER));
+            kind.typeList.add(buildEmailType(Email.TYPE_CUSTOM).setSecondary(true).setCustomColumn(
+                    Email.LABEL));
+
+            kind.fieldList = Lists.newArrayList();
+            kind.fieldList.add(new EditField(Email.DATA, R.string.emailLabelsGroup, FLAGS_EMAIL));
+        }
+
+        return kind;
+    }
+
+    @Override
+    public int getHeaderColor(Context context) {
+        return 0xff89c2c2;
+    }
+
+    @Override
+    public int getSideBarColor(Context context) {
+        return 0xff5bb4b4;
+    }
+}
diff --git a/src/com/android/contacts/model/GoogleSource.java b/src/com/android/contacts/model/GoogleSource.java
deleted file mode 100644
index d6dfbb6..0000000
--- a/src/com/android/contacts/model/GoogleSource.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.model;
-
-import com.android.contacts.R;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.google.android.collect.Lists;
-
-import android.accounts.Account;
-import android.content.ContentProviderOperation;
-import android.content.ContentProviderResult;
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.OperationApplicationException;
-import android.database.Cursor;
-import android.os.RemoteException;
-import android.provider.ContactsContract;
-import android.provider.ContactsContract.Groups;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.Contacts.Data;
-
-import java.util.ArrayList;
-
-public class GoogleSource extends FallbackSource {
-    public static final String ACCOUNT_TYPE = "com.google";
-
-    private static final String SELECTION_GROUPS_BY_TITLE_AND_ACCOUNT =
-            Groups.TITLE + "=? AND " + Groups.ACCOUNT_NAME + "=? AND " + Groups.ACCOUNT_TYPE + "=?";
-
-    public GoogleSource(String resPackageName) {
-        this.accountType = ACCOUNT_TYPE;
-        this.resPackageName = null;
-        this.summaryResPackageName = resPackageName;
-    }
-
-    @Override
-    protected void inflate(Context context, int inflateLevel) {
-
-        inflateStructuredName(context, inflateLevel);
-        inflateNickname(context, inflateLevel);
-        inflatePhone(context, inflateLevel);
-        inflateEmail(context, inflateLevel);
-        inflateStructuredPostal(context, inflateLevel);
-        inflateIm(context, inflateLevel);
-        inflateOrganization(context, inflateLevel);
-        inflatePhoto(context, inflateLevel);
-        inflateNote(context, inflateLevel);
-        inflateWebsite(context, inflateLevel);
-        inflateEvent(context, inflateLevel);
-        inflateSipAddress(context, inflateLevel);
-
-        // TODO: GOOGLE: GROUPMEMBERSHIP
-
-        setInflatedLevel(inflateLevel);
-
-    }
-
-    @Override
-    protected DataKind inflatePhone(Context context, int inflateLevel) {
-        final DataKind kind = super.inflatePhone(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.typeColumn = Phone.TYPE;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_WORK));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_PAGER).setSecondary(true));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER));
-            kind.typeList.add(buildPhoneType(Phone.TYPE_CUSTOM).setSecondary(true).setCustomColumn(
-                    Phone.LABEL));
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Phone.NUMBER, R.string.phoneLabelsGroup, FLAGS_PHONE));
-        }
-
-        return kind;
-    }
-
-    @Override
-    protected DataKind inflateEmail(Context context, int inflateLevel) {
-        final DataKind kind = super.inflateEmail(context, ContactsSource.LEVEL_MIMETYPES);
-
-        if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
-            kind.typeColumn = Email.TYPE;
-            kind.typeList = Lists.newArrayList();
-            kind.typeList.add(buildEmailType(Email.TYPE_HOME));
-            kind.typeList.add(buildEmailType(Email.TYPE_WORK));
-            kind.typeList.add(buildEmailType(Email.TYPE_OTHER));
-            kind.typeList.add(buildEmailType(Email.TYPE_CUSTOM).setSecondary(true).setCustomColumn(
-                    Email.LABEL));
-
-            kind.fieldList = Lists.newArrayList();
-            kind.fieldList.add(new EditField(Email.DATA, R.string.emailLabelsGroup, FLAGS_EMAIL));
-        }
-
-        return kind;
-    }
-
-    // TODO: this should come from resource in the future
-    // Note that frameworks/base/core/java/android/pim/vcard/VCardEntry.java also wants
-    // this String.
-    private static final String GOOGLE_MY_CONTACTS_GROUP = "System Group: My Contacts";
-
-    public static final void attemptMyContactsMembership(EntityDelta state, Context context) {
-        final ValuesDelta stateValues = state.getValues();
-	stateValues.setFromTemplate(true);
-        final String accountName = stateValues.getAsString(RawContacts.ACCOUNT_NAME);
-        final String accountType = stateValues.getAsString(RawContacts.ACCOUNT_TYPE);
-        attemptMyContactsMembership(state, accountName, accountType, context, true);
-    }
-
-    public static final void createMyContactsIfNotExist(Account account, Context context) {
-        attemptMyContactsMembership(null, account.name, account.type, context, true);
-    }
-
-    /**
-     *
-     * @param allowRecur If the group is created between querying/about to create, we recur.  But
-     *     to prevent excess recursion, we provide a flag to make sure we only do the recursion loop
-     *     once
-     */
-    private static final void attemptMyContactsMembership(EntityDelta state,
-                final String accountName, final String accountType, Context context,
-                boolean allowRecur) {
-        final ContentResolver resolver = context.getContentResolver();
-
-        Cursor cursor = resolver.query(Groups.CONTENT_URI,
-                new String[] {Groups.TITLE, Groups.SOURCE_ID, Groups.SHOULD_SYNC},
-                Groups.ACCOUNT_NAME + " =? AND " + Groups.ACCOUNT_TYPE + " =?",
-                new String[] {accountName, accountType}, null);
-
-        boolean myContactsExists = false;
-        long assignToGroupSourceId = -1;
-        while (cursor.moveToNext()) {
-            if (GOOGLE_MY_CONTACTS_GROUP.equals(cursor.getString(0))) {
-                myContactsExists = true;
-            }
-            if (assignToGroupSourceId == -1 && cursor.getInt(2) != 0) {
-                assignToGroupSourceId = cursor.getInt(1);
-            }
-
-            if (myContactsExists && assignToGroupSourceId != -1) {
-                break;
-            }
-        }
-
-        if (myContactsExists && state == null) {
-            return;
-        }
-
-        try {
-            final ContentValues values = new ContentValues();
-            values.put(Data.MIMETYPE, GroupMembership.CONTENT_ITEM_TYPE);
-
-            if (!myContactsExists) {
-                // create the group if it doesn't exist
-                final ContentValues newGroup = new ContentValues();
-                newGroup.put(Groups.TITLE, GOOGLE_MY_CONTACTS_GROUP);
-
-                newGroup.put(Groups.ACCOUNT_NAME, accountName);
-                newGroup.put(Groups.ACCOUNT_TYPE, accountType);
-                newGroup.put(Groups.GROUP_VISIBLE, "1");
-
-                ArrayList<ContentProviderOperation> operations =
-                    new ArrayList<ContentProviderOperation>();
-
-                operations.add(ContentProviderOperation
-                        .newAssertQuery(Groups.CONTENT_URI)
-                        .withSelection(SELECTION_GROUPS_BY_TITLE_AND_ACCOUNT,
-                                new String[] {GOOGLE_MY_CONTACTS_GROUP, accountName, accountType})
-                        .withExpectedCount(0).build());
-                operations.add(ContentProviderOperation
-                        .newInsert(Groups.CONTENT_URI)
-                        .withValues(newGroup)
-                        .build());
-                try {
-                    ContentProviderResult[] results = resolver.applyBatch(
-                            ContactsContract.AUTHORITY, operations);
-                    values.put(GroupMembership.GROUP_ROW_ID, ContentUris.parseId(results[1].uri));
-                } catch (RemoteException e) {
-                    throw new IllegalStateException("Problem querying for groups", e);
-                } catch (OperationApplicationException e) {
-                    // the group was created after the query but before we tried to create it
-                    if (allowRecur) {
-                        attemptMyContactsMembership(
-                                state, accountName, accountType, context, false);
-                    }
-                    return;
-                }
-            } else {
-                if (assignToGroupSourceId != -1) {
-                    values.put(GroupMembership.GROUP_SOURCE_ID, assignToGroupSourceId);
-                } else {
-                    // there are no Groups to add this contact to, so don't apply any membership
-                    // TODO: alert user that their contact will be dropped?
-                }
-            }
-            if (state != null) {
-                state.addEntry(ValuesDelta.fromAfter(values));
-            }
-        } finally {
-            cursor.close();
-        }
-    }
-
-    @Override
-    public int getHeaderColor(Context context) {
-        return 0xff89c2c2;
-    }
-
-    @Override
-    public int getSideBarColor(Context context) {
-        return 0xff5bb4b4;
-    }
-}
diff --git a/src/com/android/contacts/model/Sources.java b/src/com/android/contacts/model/Sources.java
deleted file mode 100644
index be3f17d..0000000
--- a/src/com/android/contacts/model/Sources.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.model;
-
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.google.android.collect.Lists;
-import com.google.android.collect.Maps;
-import com.google.android.collect.Sets;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.accounts.AuthenticatorDescription;
-import android.accounts.OnAccountsUpdateListener;
-import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.IContentService;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.SyncAdapterType;
-import android.content.pm.PackageManager;
-import android.os.RemoteException;
-import android.provider.ContactsContract;
-import android.text.TextUtils;
-import android.util.Log;
-
-import java.lang.ref.SoftReference;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-
-/**
- * Singleton holder for all parsed {@link ContactsSource} available on the
- * system, typically filled through {@link PackageManager} queries.
- */
-public class Sources extends BroadcastReceiver implements OnAccountsUpdateListener {
-    private static final String TAG = "Sources";
-
-    private Context mContext;
-    private Context mApplicationContext;
-    private AccountManager mAccountManager;
-
-    private ContactsSource mFallbackSource = null;
-
-    private HashMap<String, ContactsSource> mSources = Maps.newHashMap();
-    private HashSet<String> mKnownPackages = Sets.newHashSet();
-
-    private static SoftReference<Sources> sInstance = null;
-
-    /**
-     * Requests the singleton instance of {@link Sources} with data bound from
-     * the available authenticators. This method blocks until its interaction
-     * with {@link AccountManager} is finished, so don't call from a UI thread.
-     */
-    public static synchronized Sources getInstance(Context context) {
-        Sources sources = sInstance == null ? null : sInstance.get();
-        if (sources == null) {
-            sources = new Sources(context);
-            sInstance = new SoftReference<Sources>(sources);
-        }
-        return sources;
-    }
-
-    /**
-     * Internal constructor that only performs initial parsing.
-     */
-    private Sources(Context context) {
-        mContext = context;
-        mApplicationContext = context.getApplicationContext();
-        mAccountManager = AccountManager.get(mApplicationContext);
-
-        // Create fallback contacts source for on-phone contacts
-        mFallbackSource = new FallbackSource();
-
-        queryAccounts();
-
-        // Request updates when packages or accounts change
-        IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
-        filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
-        filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
-        filter.addDataScheme("package");
-        mApplicationContext.registerReceiver(this, filter);
-        IntentFilter sdFilter = new IntentFilter();
-        sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
-        sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
-        mApplicationContext.registerReceiver(this, sdFilter);
-
-        // Request updates when locale is changed so that the order of each field will
-        // be able to be changed on the locale change.
-        filter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED);
-        mApplicationContext.registerReceiver(this, filter);
-
-        mAccountManager.addOnAccountsUpdatedListener(this, null, false);
-    }
-
-    /** @hide exposed for unit tests */
-    public Sources(ContactsSource... sources) {
-        for (ContactsSource source : sources) {
-            addSource(source);
-        }
-    }
-
-    protected void addSource(ContactsSource source) {
-        mSources.put(source.accountType, source);
-        mKnownPackages.add(source.resPackageName);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        final String action = intent.getAction();
-
-        if (Intent.ACTION_PACKAGE_REMOVED.equals(action)
-                || Intent.ACTION_PACKAGE_ADDED.equals(action)
-                || Intent.ACTION_PACKAGE_CHANGED.equals(action) ||
-                Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(action) ||
-                Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(action)) {
-            String[] pkgList = null;
-            // Handle applications on sdcard.
-            if (Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(action) ||
-                    Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(action)) {
-                pkgList = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST);
-            } else {
-                final String packageName = intent.getData().getSchemeSpecificPart();
-                pkgList = new String[] { packageName };
-            }
-            if (pkgList != null) {
-                for (String packageName : pkgList) {
-                    final boolean knownPackage = mKnownPackages.contains(packageName);
-                    if (knownPackage) {
-                        // Invalidate cache of existing source
-                        invalidateCache(packageName);
-                    } else {
-                        // Unknown source, so reload from scratch
-                        queryAccounts();
-                    }
-                }
-            }
-        } else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
-            invalidateAllCache();
-        }
-    }
-
-    protected void invalidateCache(String packageName) {
-        for (ContactsSource source : mSources.values()) {
-            if (TextUtils.equals(packageName, source.resPackageName)) {
-                // Invalidate any cache for the changed package
-                source.invalidateCache();
-            }
-        }
-    }
-
-    protected void invalidateAllCache() {
-        mFallbackSource.invalidateCache();
-        for (ContactsSource source : mSources.values()) {
-            source.invalidateCache();
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void onAccountsUpdated(Account[] accounts) {
-        // Refresh to catch any changed accounts
-        queryAccounts();
-    }
-
-    /**
-     * Blocking call to load all {@link AuthenticatorDescription} known by the
-     * {@link AccountManager} on the system.
-     */
-    protected synchronized void queryAccounts() {
-        mSources.clear();
-        mKnownPackages.clear();
-
-        final AccountManager am = mAccountManager;
-        final IContentService cs = ContentResolver.getContentService();
-
-        try {
-            final SyncAdapterType[] syncs = cs.getSyncAdapterTypes();
-            final AuthenticatorDescription[] auths = am.getAuthenticatorTypes();
-
-            for (SyncAdapterType sync : syncs) {
-                if (!ContactsContract.AUTHORITY.equals(sync.authority)) {
-                    // Skip sync adapters that don't provide contact data.
-                    continue;
-                }
-
-                // Look for the formatting details provided by each sync
-                // adapter, using the authenticator to find general resources.
-                final String accountType = sync.accountType;
-                final AuthenticatorDescription auth = findAuthenticator(auths, accountType);
-
-                ContactsSource source;
-                if (GoogleSource.ACCOUNT_TYPE.equals(accountType)) {
-                    source = new GoogleSource(auth.packageName);
-                } else if (ExchangeSource.ACCOUNT_TYPE.equals(accountType)) {
-                    source = new ExchangeSource(auth.packageName);
-                } else {
-                    // TODO: use syncadapter package instead, since it provides resources
-                    Log.d(TAG, "Creating external source for type=" + accountType
-                            + ", packageName=" + auth.packageName);
-                    source = new ExternalSource(auth.packageName);
-                    source.readOnly = !sync.supportsUploading();
-                }
-
-                source.accountType = auth.type;
-                source.titleRes = auth.labelId;
-                source.iconRes = auth.iconId;
-
-                addSource(source);
-            }
-        } catch (RemoteException e) {
-            Log.w(TAG, "Problem loading accounts: " + e.toString());
-        }
-    }
-
-    /**
-     * Find a specific {@link AuthenticatorDescription} in the provided list
-     * that matches the given account type.
-     */
-    protected static AuthenticatorDescription findAuthenticator(AuthenticatorDescription[] auths,
-            String accountType) {
-        for (AuthenticatorDescription auth : auths) {
-            if (accountType.equals(auth.type)) {
-                return auth;
-            }
-        }
-        throw new IllegalStateException("Couldn't find authenticator for specific account type");
-    }
-
-    /**
-     * Return list of all known, writable {@link ContactsSource}. Sources
-     * returned may require inflation before they can be used.
-     */
-    public ArrayList<Account> getAccounts(boolean writableOnly) {
-        final AccountManager am = mAccountManager;
-        final Account[] accounts = am.getAccounts();
-        final ArrayList<Account> matching = Lists.newArrayList();
-
-        for (Account account : accounts) {
-            // Ensure we have details loaded for each account
-            final ContactsSource source = getInflatedSource(account.type,
-                    ContactsSource.LEVEL_SUMMARY);
-            final boolean hasContacts = source != null;
-            final boolean matchesWritable = (!writableOnly || (writableOnly && !source.readOnly));
-            if (hasContacts && matchesWritable) {
-                matching.add(account);
-            }
-        }
-        return matching;
-    }
-
-    /**
-     * Find the best {@link DataKind} matching the requested
-     * {@link ContactsSource#accountType} and {@link DataKind#mimeType}. If no
-     * direct match found, we try searching {@link #mFallbackSource}.
-     * When fourceRefresh is set to true, cache is refreshed and inflation of each
-     * EditField will occur.
-     */
-    public DataKind getKindOrFallback(String accountType, String mimeType, Context context,
-            int inflateLevel) {
-        DataKind kind = null;
-
-        // Try finding source and kind matching request
-        final ContactsSource source = mSources.get(accountType);
-        if (source != null) {
-            source.ensureInflated(context, inflateLevel);
-            kind = source.getKindForMimetype(mimeType);
-        }
-
-        if (kind == null) {
-            // Nothing found, so try fallback as last resort
-            mFallbackSource.ensureInflated(context, inflateLevel);
-            kind = mFallbackSource.getKindForMimetype(mimeType);
-        }
-
-        if (kind == null) {
-            Log.w(TAG, "Unknown type=" + accountType + ", mime=" + mimeType);
-        }
-
-        return kind;
-    }
-
-    /**
-     * Return {@link ContactsSource} for the given account type.
-     */
-    public ContactsSource getInflatedSource(String accountType, int inflateLevel) {
-        // Try finding specific source, otherwise use fallback
-        ContactsSource source = mSources.get(accountType);
-        if (source == null) source = mFallbackSource;
-
-        if (source.isInflated(inflateLevel)) {
-            // Already inflated, so return directly
-            return source;
-        } else {
-            // Not inflated, but requested that we force-inflate
-            source.ensureInflated(mContext, inflateLevel);
-            return source;
-        }
-    }
-}
diff --git a/src/com/android/contacts/preference/ContactsPreferenceActivity.java b/src/com/android/contacts/preference/ContactsPreferenceActivity.java
new file mode 100644
index 0000000..3ec2e61
--- /dev/null
+++ b/src/com/android/contacts/preference/ContactsPreferenceActivity.java
@@ -0,0 +1,1100 @@
+/*
+ * Copyright (C) 2009 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.contacts.preference;
+
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.android.contacts.model.GoogleAccountType;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.util.EmptyService;
+import com.android.contacts.util.LocalizedNameResolver;
+import com.android.contacts.util.WeakAsyncTask;
+import com.google.android.collect.Lists;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.ExpandableListActivity;
+import android.app.ProgressDialog;
+import android.content.ContentProviderOperation;
+import android.content.ContentProviderOperation.Builder;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.EntityIterator;
+import android.content.Intent;
+import android.content.OperationApplicationException;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceActivity.Header;
+import android.preference.PreferenceManager;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Groups;
+import android.provider.ContactsContract.Settings;
+import android.util.Log;
+import android.view.ContextMenu;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.MenuItem.OnMenuItemClickListener;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseExpandableListAdapter;
+import android.widget.CheckBox;
+import android.widget.ExpandableListAdapter;
+import android.widget.ExpandableListView;
+import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Contacts settings.
+ */
+public final class ContactsPreferenceActivity extends PreferenceActivity
+//implements
+//        AdapterView.OnItemClickListener, View.OnClickListener
+        {
+    private static final String TAG = "ContactsSettingsActivity";
+
+    /**
+     * Populate the activity with the top-level headers.
+     */
+    @Override
+    public void onBuildHeaders(List<Header> target) {
+        loadHeadersFromResource(R.xml.preference_headers, target);
+    }
+
+
+//    public interface Prefs {
+//        public static final String DISPLAY_ONLY_PHONES = "only_phones";
+//        public static final boolean DISPLAY_ONLY_PHONES_DEFAULT = false;
+//
+//    }
+//
+//    private static final int DIALOG_SORT_ORDER = 1;
+//    private static final int DIALOG_DISPLAY_ORDER = 2;
+//
+//    private ExpandableListView mList;
+//    private DisplayAdapter mAdapter;
+//
+//    private SharedPreferences mPrefs;
+//    private ContactsPreferences mContactsPrefs;
+//
+//    private CheckBox mDisplayPhones;
+//
+//    private View mHeaderPhones;
+//    private View mHeaderSeparator;
+//
+//    private View mSortOrderView;
+//    private TextView mSortOrderTextView;
+//    private int mSortOrder;
+//
+//    private View mDisplayOrderView;
+//    private TextView mDisplayOrderTextView;
+//    private int mDisplayOrder;
+//
+//    @Override
+//    protected void onCreate(Bundle icicle) {
+//        super.onCreate(icicle);
+//        setContentView(R.layout.contacts_preferences);
+//
+//        mList = getExpandableListView();
+//        mList.setHeaderDividersEnabled(true);
+//        mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
+//        mContactsPrefs = new ContactsPreferences(this);
+//        mAdapter = new DisplayAdapter(this);
+//
+//        final LayoutInflater inflater = getLayoutInflater();
+//
+//        createWithPhonesOnlyPreferenceView(inflater);
+//        createSortOrderPreferenceView(inflater);
+//        createDisplayOrderPreferenceView(inflater);
+//        createDisplayGroupHeader(inflater);
+//
+//        findViewById(R.id.btn_done).setOnClickListener(this);
+//        findViewById(R.id.btn_discard).setOnClickListener(this);
+//
+//        // Catch clicks on the header views
+//        mList.setOnItemClickListener(this);
+//        mList.setOnCreateContextMenuListener(this);
+//
+//        mSortOrder = mContactsPrefs.getSortOrder();
+//        mDisplayOrder = mContactsPrefs.getDisplayOrder();
+//    }
+//
+//    private void createWithPhonesOnlyPreferenceView(LayoutInflater inflater) {
+//        // Add the "Only contacts with phones" header modifier.
+//        mHeaderPhones = inflater.inflate(R.layout.display_options_phones_only, mList, false);
+//        mHeaderPhones.setId(R.id.header_phones);
+//        mDisplayPhones = (CheckBox) mHeaderPhones.findViewById(android.R.id.checkbox);
+//        mDisplayPhones.setChecked(mPrefs.getBoolean(Prefs.DISPLAY_ONLY_PHONES,
+//                Prefs.DISPLAY_ONLY_PHONES_DEFAULT));
+//        {
+//            final TextView text1 = (TextView)mHeaderPhones.findViewById(android.R.id.text1);
+//            final TextView text2 = (TextView)mHeaderPhones.findViewById(android.R.id.text2);
+//            text1.setText(R.string.showFilterPhones);
+//            text2.setText(R.string.showFilterPhonesDescrip);
+//        }
+//    }
+//
+//    private void createSortOrderPreferenceView(LayoutInflater inflater) {
+//        mSortOrderView = inflater.inflate(R.layout.preference_with_more_button, mList, false);
+//
+//        View preferenceLayout = mSortOrderView.findViewById(R.id.preference);
+//
+//        TextView label = (TextView)preferenceLayout.findViewById(R.id.label);
+//        label.setText(getString(R.string.display_options_sort_list_by));
+//
+//        mSortOrderTextView = (TextView)preferenceLayout.findViewById(R.id.data);
+//    }
+//
+//    private void createDisplayOrderPreferenceView(LayoutInflater inflater) {
+//        mDisplayOrderView = inflater.inflate(R.layout.preference_with_more_button, mList, false);
+//        View preferenceLayout = mDisplayOrderView.findViewById(R.id.preference);
+//
+//        TextView label = (TextView)preferenceLayout.findViewById(R.id.label);
+//        label.setText(getString(R.string.display_options_view_names_as));
+//
+//        mDisplayOrderTextView = (TextView)preferenceLayout.findViewById(R.id.data);
+//    }
+//
+//    private void createDisplayGroupHeader(LayoutInflater inflater) {
+//        // Add the separator before showing the detailed group list.
+//        mHeaderSeparator = inflater.inflate(R.layout.list_separator, mList, false);
+//        {
+//            final TextView text1 = (TextView)mHeaderSeparator;
+//            text1.setText(R.string.headerContactGroups);
+//        }
+//    }
+//
+//    @Override
+//    protected void onResume() {
+//        super.onResume();
+//        mList.removeHeaderView(mHeaderPhones);
+//        mList.removeHeaderView(mSortOrderView);
+//        mList.removeHeaderView(mDisplayOrderView);
+//        mList.removeHeaderView(mHeaderSeparator);
+//
+//        // List adapter needs to be reset, because header views cannot be added
+//        // to a list with an existing adapter.
+//        setListAdapter(null);
+//
+//        mList.addHeaderView(mHeaderPhones, null, true);
+//        if (mContactsPrefs.isSortOrderUserChangeable()) {
+//            mList.addHeaderView(mSortOrderView, null, true);
+//        }
+//
+//        if (mContactsPrefs.isSortOrderUserChangeable()) {
+//            mList.addHeaderView(mDisplayOrderView, null, true);
+//        }
+//
+//        mList.addHeaderView(mHeaderSeparator, null, false);
+//
+//        setListAdapter(mAdapter);
+//
+//        bindView();
+//
+//        // Start background query to find account details
+//        new QueryGroupsTask(this).execute();
+//    }
+//
+//    private void bindView() {
+//        mSortOrderTextView.setText(
+//                mSortOrder == ContactsContract.Preferences.SORT_ORDER_PRIMARY
+//                        ? getString(R.string.display_options_sort_by_given_name)
+//                        : getString(R.string.display_options_sort_by_family_name));
+//
+//        mDisplayOrderTextView.setText(
+//                mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY
+//                        ? getString(R.string.display_options_view_given_name_first)
+//                        : getString(R.string.display_options_view_family_name_first));
+//    }
+//
+//    @Override
+//    protected Dialog onCreateDialog(int id, Bundle args) {
+//        switch (id) {
+//            case DIALOG_SORT_ORDER:
+//                return createSortOrderDialog();
+//            case DIALOG_DISPLAY_ORDER:
+//                return createDisplayOrderDialog();
+//        }
+//
+//        return null;
+//    }
+//
+//    private Dialog createSortOrderDialog() {
+//        String[] items = new String[] {
+//                getString(R.string.display_options_sort_by_given_name),
+//                getString(R.string.display_options_sort_by_family_name),
+//        };
+//
+//        return new AlertDialog.Builder(this)
+//            .setIcon(com.android.internal.R.drawable.ic_dialog_menu_generic)
+//            .setTitle(R.string.display_options_sort_list_by)
+//            .setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
+//                    public void onClick(DialogInterface dialog, int whichButton) {
+//                        setSortOrder(dialog);
+//                        dialog.dismiss();
+//                    }
+//                })
+//            .setNegativeButton(android.R.string.cancel, null)
+//            .create();
+//    }
+//
+//    private Dialog createDisplayOrderDialog() {
+//        String[] items = new String[] {
+//                getString(R.string.display_options_view_given_name_first),
+//                getString(R.string.display_options_view_family_name_first),
+//        };
+//
+//        return new AlertDialog.Builder(this)
+//            .setIcon(com.android.internal.R.drawable.ic_dialog_menu_generic)
+//            .setTitle(R.string.display_options_view_names_as)
+//            .setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
+//                    public void onClick(DialogInterface dialog, int whichButton) {
+//                        setDisplayOrder(dialog);
+//                        dialog.dismiss();
+//                    }
+//                })
+//            .setNegativeButton(android.R.string.cancel, null)
+//            .create();
+//    }
+//
+//    @Override
+//    protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
+//        switch (id) {
+//            case DIALOG_SORT_ORDER:
+//                setCheckedItem(dialog,
+//                        mSortOrder == ContactsContract.Preferences.SORT_ORDER_PRIMARY ? 0 : 1);
+//                break;
+//            case DIALOG_DISPLAY_ORDER:
+//                setCheckedItem(dialog,
+//                        mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY
+//                                ? 0 : 1);
+//                break;
+//        }
+//    }
+//
+//    private void setCheckedItem(Dialog dialog, int position) {
+//        ListView listView = ((AlertDialog)dialog).getListView();
+//        listView.setItemChecked(position, true);
+//        listView.setSelection(position);
+//    }
+//
+//    protected void setSortOrder(DialogInterface dialog) {
+//        ListView listView = ((AlertDialog)dialog).getListView();
+//        int checked = listView.getCheckedItemPosition();
+//        mSortOrder = checked == 0
+//                ? ContactsContract.Preferences.SORT_ORDER_PRIMARY
+//                : ContactsContract.Preferences.SORT_ORDER_ALTERNATIVE;
+//
+//        bindView();
+//    }
+//
+//    protected void setDisplayOrder(DialogInterface dialog) {
+//        ListView listView = ((AlertDialog)dialog).getListView();
+//        int checked = listView.getCheckedItemPosition();
+//        mDisplayOrder = checked == 0
+//                ? ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY
+//                : ContactsContract.Preferences.DISPLAY_ORDER_ALTERNATIVE;
+//
+//        bindView();
+//    }
+//
+//    /**
+//     * Background operation to build set of {@link AccountDisplay} for each
+//     * {@link AccountTypes#getAccounts(boolean)} that provides groups.
+//     */
+//    private static class QueryGroupsTask extends
+//            WeakAsyncTask<Void, Void, AccountSet, ContactsPreferenceActivity> {
+//        public QueryGroupsTask(ContactsPreferenceActivity target) {
+//            super(target);
+//        }
+//
+//        @Override
+//        protected AccountSet doInBackground(ContactsPreferenceActivity target,
+//                Void... params) {
+//            final Context context = target;
+//            final AccountTypes sources = AccountTypes.getInstance(context);
+//            final ContentResolver resolver = context.getContentResolver();
+//
+//            // Inflate groups entry for each account
+//            final AccountSet accounts = new AccountSet();
+//            for (Account account : sources.getAccounts(false)) {
+//                accounts.add(new AccountDisplay(resolver, account.name, account.type));
+//            }
+//
+//            return accounts;
+//        }
+//
+//        @Override
+//        protected void onPostExecute(ContactsPreferenceActivity target, AccountSet result) {
+//            target.mAdapter.setAccounts(result);
+//        }
+//    }
+//
+//    private static final int DEFAULT_SHOULD_SYNC = 1;
+//    private static final int DEFAULT_VISIBLE = 0;
+//
+//    /**
+//     * Entry holding any changes to {@link Groups} or {@link Settings} rows,
+//     * such as {@link Groups#SHOULD_SYNC} or {@link Groups#GROUP_VISIBLE}.
+//     */
+//    protected static class GroupDelta extends ValuesDelta {
+//        private boolean mUngrouped = false;
+//        private boolean mAccountHasGroups;
+//
+//        private GroupDelta() {
+//            super();
+//        }
+//
+//        /**
+//         * Build {@link GroupDelta} from the {@link Settings} row for the given
+//         * {@link Settings#ACCOUNT_NAME} and {@link Settings#ACCOUNT_TYPE}.
+//         */
+//        public static GroupDelta fromSettings(ContentResolver resolver, String accountName,
+//                String accountType, boolean accountHasGroups) {
+//            final Uri settingsUri = Settings.CONTENT_URI.buildUpon()
+//                    .appendQueryParameter(Settings.ACCOUNT_NAME, accountName)
+//                    .appendQueryParameter(Settings.ACCOUNT_TYPE, accountType).build();
+//            final Cursor cursor = resolver.query(settingsUri, new String[] {
+//                    Settings.SHOULD_SYNC, Settings.UNGROUPED_VISIBLE
+//            }, null, null, null);
+//
+//            try {
+//                final ContentValues values = new ContentValues();
+//                values.put(Settings.ACCOUNT_NAME, accountName);
+//                values.put(Settings.ACCOUNT_TYPE, accountType);
+//
+//                if (cursor != null && cursor.moveToFirst()) {
+//                    // Read existing values when present
+//                    values.put(Settings.SHOULD_SYNC, cursor.getInt(0));
+//                    values.put(Settings.UNGROUPED_VISIBLE, cursor.getInt(1));
+//                    return fromBefore(values).setUngrouped(accountHasGroups);
+//                } else {
+//                    // Nothing found, so treat as create
+//                    values.put(Settings.SHOULD_SYNC, DEFAULT_SHOULD_SYNC);
+//                    values.put(Settings.UNGROUPED_VISIBLE, DEFAULT_VISIBLE);
+//                    return fromAfter(values).setUngrouped(accountHasGroups);
+//                }
+//            } finally {
+//                if (cursor != null) cursor.close();
+//            }
+//        }
+//
+//        public static GroupDelta fromBefore(ContentValues before) {
+//            final GroupDelta entry = new GroupDelta();
+//            entry.mBefore = before;
+//            entry.mAfter = new ContentValues();
+//            return entry;
+//        }
+//
+//        public static GroupDelta fromAfter(ContentValues after) {
+//            final GroupDelta entry = new GroupDelta();
+//            entry.mBefore = null;
+//            entry.mAfter = after;
+//            return entry;
+//        }
+//
+//        protected GroupDelta setUngrouped(boolean accountHasGroups) {
+//            mUngrouped = true;
+//            mAccountHasGroups = accountHasGroups;
+//            return this;
+//        }
+//
+//        @Override
+//        public boolean beforeExists() {
+//            return mBefore != null;
+//        }
+//
+//        public boolean getShouldSync() {
+//            return getAsInteger(mUngrouped ? Settings.SHOULD_SYNC : Groups.SHOULD_SYNC,
+//                    DEFAULT_SHOULD_SYNC) != 0;
+//        }
+//
+//        public boolean getVisible() {
+//            return getAsInteger(mUngrouped ? Settings.UNGROUPED_VISIBLE : Groups.GROUP_VISIBLE,
+//                    DEFAULT_VISIBLE) != 0;
+//        }
+//
+//        public void putShouldSync(boolean shouldSync) {
+//            put(mUngrouped ? Settings.SHOULD_SYNC : Groups.SHOULD_SYNC, shouldSync ? 1 : 0);
+//        }
+//
+//        public void putVisible(boolean visible) {
+//            put(mUngrouped ? Settings.UNGROUPED_VISIBLE : Groups.GROUP_VISIBLE, visible ? 1 : 0);
+//        }
+//
+//        private String getAccountType() {
+//            return (mBefore == null ? mAfter : mBefore).getAsString(Settings.ACCOUNT_TYPE);
+//        }
+//
+//        public CharSequence getTitle(Context context) {
+//            if (mUngrouped) {
+//                final String customAllContactsName =
+//                        LocalizedNameResolver.getAllContactsName(context, getAccountType());
+//                if (customAllContactsName != null) {
+//                    return customAllContactsName;
+//                }
+//                if (mAccountHasGroups) {
+//                    return context.getText(R.string.display_ungrouped);
+//                } else {
+//                    return context.getText(R.string.display_all_contacts);
+//                }
+//            } else {
+//                final Integer titleRes = getAsInteger(Groups.TITLE_RES);
+//                if (titleRes != null) {
+//                    final String packageName = getAsString(Groups.RES_PACKAGE);
+//                    return context.getPackageManager().getText(packageName, titleRes, null);
+//                } else {
+//                    return getAsString(Groups.TITLE);
+//                }
+//            }
+//        }
+//
+//        /**
+//         * Build a possible {@link ContentProviderOperation} to persist any
+//         * changes to the {@link Groups} or {@link Settings} row described by
+//         * this {@link GroupDelta}.
+//         */
+//        public ContentProviderOperation buildDiff() {
+//            if (isNoop()) {
+//                return null;
+//            } else if (isUpdate()) {
+//                // When has changes and "before" exists, then "update"
+//                final Builder builder = ContentProviderOperation
+//                        .newUpdate(mUngrouped ? Settings.CONTENT_URI : addCallerIsSyncAdapterParameter(Groups.CONTENT_URI));
+//                if (mUngrouped) {
+//                    builder.withSelection(Settings.ACCOUNT_NAME + "=? AND " + Settings.ACCOUNT_TYPE
+//                            + "=?", new String[] {
+//                            this.getAsString(Settings.ACCOUNT_NAME),
+//                            this.getAsString(Settings.ACCOUNT_TYPE)
+//                    });
+//                } else {
+//                    builder.withSelection(Groups._ID + "=" + this.getId(), null);
+//                }
+//                builder.withValues(mAfter);
+//                return builder.build();
+//            } else if (isInsert() && mUngrouped) {
+//                // Only allow inserts for Settings
+//                mAfter.remove(mIdColumn);
+//                final Builder builder = ContentProviderOperation.newInsert(Settings.CONTENT_URI);
+//                builder.withValues(mAfter);
+//                return builder.build();
+//            } else {
+//                throw new IllegalStateException("Unexpected delete or insert");
+//            }
+//        }
+//    }
+//
+//    private static Uri addCallerIsSyncAdapterParameter(Uri uri) {
+//        return uri.buildUpon()
+//	        .appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
+//	        .build();
+//    }
+//
+//    /**
+//     * {@link Comparator} to sort by {@link Groups#_ID}.
+//     */
+//    private static Comparator<GroupDelta> sIdComparator = new Comparator<GroupDelta>() {
+//        public int compare(GroupDelta object1, GroupDelta object2) {
+//            final Long id1 = object1.getId();
+//            final Long id2 = object2.getId();
+//            if (id1 == null && id2 == null) {
+//                return 0;
+//            } else if (id1 == null) {
+//                return -1;
+//            } else if (id2 == null) {
+//                return 1;
+//            } else if (id1 < id2) {
+//                return -1;
+//            } else if (id1 > id2) {
+//                return 1;
+//            } else {
+//                return 0;
+//            }
+//        }
+//    };
+//
+//    /**
+//     * Set of all {@link AccountDisplay} entries, one for each source.
+//     */
+//    protected static class AccountSet extends ArrayList<AccountDisplay> {
+//        public ArrayList<ContentProviderOperation> buildDiff() {
+//            final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
+//            for (AccountDisplay account : this) {
+//                account.buildDiff(diff);
+//            }
+//            return diff;
+//        }
+//    }
+//
+//    /**
+//     * {@link GroupDelta} details for a single {@link Account}, usually shown as
+//     * children under a single expandable group.
+//     */
+//    protected static class AccountDisplay {
+//        public String mName;
+//        public String mType;
+//
+//        public GroupDelta mUngrouped;
+//        public ArrayList<GroupDelta> mSyncedGroups = Lists.newArrayList();
+//        public ArrayList<GroupDelta> mUnsyncedGroups = Lists.newArrayList();
+//
+//        /**
+//         * Build an {@link AccountDisplay} covering all {@link Groups} under the
+//         * given {@link Account}.
+//         */
+//        public AccountDisplay(ContentResolver resolver, String accountName, String accountType) {
+//            mName = accountName;
+//            mType = accountType;
+//
+//            final Uri groupsUri = Groups.CONTENT_URI.buildUpon()
+//                    .appendQueryParameter(Groups.ACCOUNT_NAME, accountName)
+//                    .appendQueryParameter(Groups.ACCOUNT_TYPE, accountType).build();
+//            EntityIterator iterator = ContactsContract.Groups.newEntityIterator(resolver.query(
+//                    groupsUri, null, null, null, null));
+//            try {
+//                boolean hasGroups = false;
+//
+//                // Create entries for each known group
+//                while (iterator.hasNext()) {
+//                    final ContentValues values = iterator.next().getEntityValues();
+//                    final GroupDelta group = GroupDelta.fromBefore(values);
+//                    addGroup(group);
+//                    hasGroups = true;
+//                }
+//                // Create single entry handling ungrouped status
+//                mUngrouped = GroupDelta.fromSettings(resolver, accountName, accountType, hasGroups);
+//                addGroup(mUngrouped);
+//            } finally {
+//                iterator.close();
+//            }
+//        }
+//
+//        /**
+//         * Add the given {@link GroupDelta} internally, filing based on its
+//         * {@link GroupDelta#getShouldSync()} status.
+//         */
+//        private void addGroup(GroupDelta group) {
+//            if (group.getShouldSync()) {
+//                mSyncedGroups.add(group);
+//            } else {
+//                mUnsyncedGroups.add(group);
+//            }
+//        }
+//
+//        /**
+//         * Set the {@link GroupDelta#putShouldSync(boolean)} value for all
+//         * children {@link GroupDelta} rows.
+//         */
+//        public void setShouldSync(boolean shouldSync) {
+//            final Iterator<GroupDelta> oppositeChildren = shouldSync ?
+//                    mUnsyncedGroups.iterator() : mSyncedGroups.iterator();
+//            while (oppositeChildren.hasNext()) {
+//                final GroupDelta child = oppositeChildren.next();
+//                setShouldSync(child, shouldSync, false);
+//                oppositeChildren.remove();
+//            }
+//        }
+//
+//        public void setShouldSync(GroupDelta child, boolean shouldSync) {
+//            setShouldSync(child, shouldSync, true);
+//        }
+//
+//        /**
+//         * Set {@link GroupDelta#putShouldSync(boolean)}, and file internally
+//         * based on updated state.
+//         */
+//        public void setShouldSync(GroupDelta child, boolean shouldSync, boolean attemptRemove) {
+//            child.putShouldSync(shouldSync);
+//            if (shouldSync) {
+//                if (attemptRemove) {
+//                    mUnsyncedGroups.remove(child);
+//                }
+//                mSyncedGroups.add(child);
+//                Collections.sort(mSyncedGroups, sIdComparator);
+//            } else {
+//                if (attemptRemove) {
+//                    mSyncedGroups.remove(child);
+//                }
+//                mUnsyncedGroups.add(child);
+//            }
+//        }
+//
+//        /**
+//         * Build set of {@link ContentProviderOperation} to persist any user
+//         * changes to {@link GroupDelta} rows under this {@link Account}.
+//         */
+//        public void buildDiff(ArrayList<ContentProviderOperation> diff) {
+//            for (GroupDelta group : mSyncedGroups) {
+//                final ContentProviderOperation oper = group.buildDiff();
+//                if (oper != null) diff.add(oper);
+//            }
+//            for (GroupDelta group : mUnsyncedGroups) {
+//                final ContentProviderOperation oper = group.buildDiff();
+//                if (oper != null) diff.add(oper);
+//            }
+//        }
+//    }
+//
+//    /**
+//     * {@link ExpandableListAdapter} that shows {@link GroupDelta} settings,
+//     * grouped by {@link Account} source. Shows footer row when any groups are
+//     * unsynced, as determined through {@link AccountDisplay#mUnsyncedGroups}.
+//     */
+//    protected static class DisplayAdapter extends BaseExpandableListAdapter {
+//        private Context mContext;
+//        private LayoutInflater mInflater;
+//        private AccountTypes mSources;
+//        private AccountSet mAccounts;
+//
+//        private boolean mChildWithPhones = false;
+//
+//        public DisplayAdapter(Context context) {
+//            mContext = context;
+//            mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+//            mSources = AccountTypes.getInstance(context);
+//        }
+//
+//        public void setAccounts(AccountSet accounts) {
+//            mAccounts = accounts;
+//            notifyDataSetChanged();
+//        }
+//
+//        /**
+//         * In group descriptions, show the number of contacts with phone
+//         * numbers, in addition to the total contacts.
+//         */
+//        public void setChildDescripWithPhones(boolean withPhones) {
+//            mChildWithPhones = withPhones;
+//        }
+//
+//        /** {@inheritDoc} */
+//        public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
+//                View convertView, ViewGroup parent) {
+//            if (convertView == null) {
+//                convertView = mInflater.inflate(R.layout.display_child, parent, false);
+//            }
+//
+//            final TextView text1 = (TextView)convertView.findViewById(android.R.id.text1);
+//            final TextView text2 = (TextView)convertView.findViewById(android.R.id.text2);
+//            final CheckBox checkbox = (CheckBox)convertView.findViewById(android.R.id.checkbox);
+//
+//            final AccountDisplay account = mAccounts.get(groupPosition);
+//            final GroupDelta child = (GroupDelta)this.getChild(groupPosition, childPosition);
+//            if (child != null) {
+//                // Handle normal group, with title and checkbox
+//                final boolean groupVisible = child.getVisible();
+//                checkbox.setVisibility(View.VISIBLE);
+//                checkbox.setChecked(groupVisible);
+//
+//                final CharSequence groupTitle = child.getTitle(mContext);
+//                text1.setText(groupTitle);
+//
+////              final int count = cursor.getInt(GroupsQuery.SUMMARY_COUNT);
+////              final int withPhones = cursor.getInt(GroupsQuery.SUMMARY_WITH_PHONES);
+//
+////              final CharSequence descrip = mContext.getResources().getQuantityString(
+////                      mChildWithPhones ? R.plurals.groupDescripPhones : R.plurals.groupDescrip,
+////                      count, count, withPhones);
+//
+////              text2.setText(descrip);
+//                text2.setVisibility(View.GONE);
+//            } else {
+//                // When unknown child, this is "more" footer view
+//                checkbox.setVisibility(View.GONE);
+//                text1.setText(R.string.display_more_groups);
+//                text2.setVisibility(View.GONE);
+//            }
+//
+//            return convertView;
+//        }
+//
+//        /** {@inheritDoc} */
+//        public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
+//                ViewGroup parent) {
+//            if (convertView == null) {
+//                convertView = mInflater.inflate(R.layout.display_group, parent, false);
+//            }
+//
+//            final TextView text1 = (TextView)convertView.findViewById(android.R.id.text1);
+//            final TextView text2 = (TextView)convertView.findViewById(android.R.id.text2);
+//
+//            final AccountDisplay account = (AccountDisplay)this.getGroup(groupPosition);
+//
+//            final BaseAccountType source = mSources.getInflatedSource(account.mType,
+//                    BaseAccountType.LEVEL_SUMMARY);
+//
+//            text1.setText(account.mName);
+//            text2.setText(source.getDisplayLabel(mContext));
+//            text2.setVisibility(account.mName == null ? View.GONE : View.VISIBLE);
+//
+//            return convertView;
+//        }
+//
+//        /** {@inheritDoc} */
+//        public Object getChild(int groupPosition, int childPosition) {
+//            final AccountDisplay account = mAccounts.get(groupPosition);
+//            final boolean validChild = childPosition >= 0
+//                    && childPosition < account.mSyncedGroups.size();
+//            if (validChild) {
+//                return account.mSyncedGroups.get(childPosition);
+//            } else {
+//                return null;
+//            }
+//        }
+//
+//        /** {@inheritDoc} */
+//        public long getChildId(int groupPosition, int childPosition) {
+//            final GroupDelta child = (GroupDelta)getChild(groupPosition, childPosition);
+//            if (child != null) {
+//                final Long childId = child.getId();
+//                return childId != null ? childId : Long.MIN_VALUE;
+//            } else {
+//                return Long.MIN_VALUE;
+//            }
+//        }
+//
+//        /** {@inheritDoc} */
+//        public int getChildrenCount(int groupPosition) {
+//            // Count is any synced groups, plus possible footer
+//            final AccountDisplay account = mAccounts.get(groupPosition);
+//            final boolean anyHidden = account.mUnsyncedGroups.size() > 0;
+//            return account.mSyncedGroups.size() + (anyHidden ? 1 : 0);
+//        }
+//
+//        /** {@inheritDoc} */
+//        public Object getGroup(int groupPosition) {
+//            return mAccounts.get(groupPosition);
+//        }
+//
+//        /** {@inheritDoc} */
+//        public int getGroupCount() {
+//            if (mAccounts == null) {
+//                return 0;
+//            }
+//            return mAccounts.size();
+//        }
+//
+//        /** {@inheritDoc} */
+//        public long getGroupId(int groupPosition) {
+//            return groupPosition;
+//        }
+//
+//        /** {@inheritDoc} */
+//        public boolean hasStableIds() {
+//            return true;
+//        }
+//
+//        /** {@inheritDoc} */
+//        public boolean isChildSelectable(int groupPosition, int childPosition) {
+//            return true;
+//        }
+//    }
+//
+//    /**
+//     * Handle any clicks on header views added to our {@link #mAdapter}, which
+//     * are usually the global modifier checkboxes.
+//     */
+//    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+//        Log.d(TAG, "OnItemClick, position=" + position + ", id=" + id);
+//        if (view == mHeaderPhones) {
+//            mDisplayPhones.toggle();
+//            return;
+//        }
+//        if (view == mDisplayOrderView) {
+//            Log.d(TAG, "Showing Display Order dialog");
+//            showDialog(DIALOG_DISPLAY_ORDER);
+//            return;
+//        }
+//        if (view == mSortOrderView) {
+//            Log.d(TAG, "Showing Sort Order dialog");
+//            showDialog(DIALOG_SORT_ORDER);
+//            return;
+//        }
+//    }
+//
+//    /** {@inheritDoc} */
+//    public void onClick(View view) {
+//        switch (view.getId()) {
+//            case R.id.btn_done: {
+//                this.doSaveAction();
+//                break;
+//            }
+//            case R.id.btn_discard: {
+//                this.finish();
+//                break;
+//            }
+//        }
+//    }
+//
+//    /**
+//     * Assign a specific value to {@link Prefs#DISPLAY_ONLY_PHONES}, refreshing
+//     * the visible list as needed.
+//     */
+//    protected void setDisplayOnlyPhones(boolean displayOnlyPhones) {
+//        mDisplayPhones.setChecked(displayOnlyPhones);
+//
+//        Editor editor = mPrefs.edit();
+//        editor.putBoolean(Prefs.DISPLAY_ONLY_PHONES, displayOnlyPhones);
+//        editor.apply();
+//
+//        mAdapter.setChildDescripWithPhones(displayOnlyPhones);
+//        mAdapter.notifyDataSetChanged();
+//    }
+//
+//    /**
+//     * Handle any clicks on {@link ExpandableListAdapter} children, which
+//     * usually mean toggling its visible state.
+//     */
+//    @Override
+//    public boolean onChildClick(ExpandableListView parent, View view, int groupPosition,
+//            int childPosition, long id) {
+//        final CheckBox checkbox = (CheckBox)view.findViewById(android.R.id.checkbox);
+//
+//        final AccountDisplay account = (AccountDisplay)mAdapter.getGroup(groupPosition);
+//        final GroupDelta child = (GroupDelta)mAdapter.getChild(groupPosition, childPosition);
+//        if (child != null) {
+//            checkbox.toggle();
+//            child.putVisible(checkbox.isChecked());
+//        } else {
+//            // Open context menu for bringing back unsynced
+//            this.openContextMenu(view);
+//        }
+//        return true;
+//    }
+//
+//    // TODO: move these definitions to framework constants when we begin
+//    // defining this mode through <sync-adapter> tags
+//    private static final int SYNC_MODE_UNSUPPORTED = 0;
+//    private static final int SYNC_MODE_UNGROUPED = 1;
+//    private static final int SYNC_MODE_EVERYTHING = 2;
+//
+//    protected int getSyncMode(AccountDisplay account) {
+//        // TODO: read sync mode through <sync-adapter> definition
+//        if (GoogleAccountType.ACCOUNT_TYPE.equals(account.mType)) {
+//            return SYNC_MODE_EVERYTHING;
+//        } else {
+//            return SYNC_MODE_UNSUPPORTED;
+//        }
+//    }
+//
+//    @Override
+//    public void onCreateContextMenu(ContextMenu menu, View view,
+//            ContextMenu.ContextMenuInfo menuInfo) {
+//        super.onCreateContextMenu(menu, view, menuInfo);
+//
+//        // Bail if not working with expandable long-press, or if not child
+//        if (!(menuInfo instanceof ExpandableListContextMenuInfo)) return;
+//
+//        final ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
+//        final int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);
+//        final int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition);
+//
+//        // Skip long-press on expandable parents
+//        if (childPosition == -1) return;
+//
+//        final AccountDisplay account = (AccountDisplay)mAdapter.getGroup(groupPosition);
+//        final GroupDelta child = (GroupDelta)mAdapter.getChild(groupPosition, childPosition);
+//
+//        // Ignore when selective syncing unsupported
+//        final int syncMode = getSyncMode(account);
+//        if (syncMode == SYNC_MODE_UNSUPPORTED) return;
+//
+//        if (child != null) {
+//            showRemoveSync(menu, account, child, syncMode);
+//        } else {
+//            showAddSync(menu, account, syncMode);
+//        }
+//    }
+//
+//    protected void showRemoveSync(ContextMenu menu, final AccountDisplay account,
+//            final GroupDelta child, final int syncMode) {
+//        final CharSequence title = child.getTitle(this);
+//
+//        menu.setHeaderTitle(title);
+//        menu.add(R.string.menu_sync_remove).setOnMenuItemClickListener(
+//                new OnMenuItemClickListener() {
+//                    public boolean onMenuItemClick(MenuItem item) {
+//                        handleRemoveSync(account, child, syncMode, title);
+//                        return true;
+//                    }
+//                });
+//    }
+//
+//    protected void handleRemoveSync(final AccountDisplay account, final GroupDelta child,
+//            final int syncMode, CharSequence title) {
+//        final boolean shouldSyncUngrouped = account.mUngrouped.getShouldSync();
+//        if (syncMode == SYNC_MODE_EVERYTHING && shouldSyncUngrouped
+//                && !child.equals(account.mUngrouped)) {
+//            // Warn before removing this group when it would cause ungrouped to stop syncing
+//            final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+//            final CharSequence removeMessage = this.getString(
+//                    R.string.display_warn_remove_ungrouped, title);
+//            builder.setTitle(R.string.menu_sync_remove);
+//            builder.setMessage(removeMessage);
+//            builder.setNegativeButton(android.R.string.cancel, null);
+//            builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+//                public void onClick(DialogInterface dialog, int which) {
+//                    // Mark both this group and ungrouped to stop syncing
+//                    account.setShouldSync(account.mUngrouped, false);
+//                    account.setShouldSync(child, false);
+//                    mAdapter.notifyDataSetChanged();
+//                }
+//            });
+//            builder.show();
+//        } else {
+//            // Mark this group to not sync
+//            account.setShouldSync(child, false);
+//            mAdapter.notifyDataSetChanged();
+//        }
+//    }
+//
+//    protected void showAddSync(ContextMenu menu, final AccountDisplay account, final int syncMode) {
+//        menu.setHeaderTitle(R.string.dialog_sync_add);
+//
+//        // Create item for each available, unsynced group
+//        for (final GroupDelta child : account.mUnsyncedGroups) {
+//            if (!child.getShouldSync()) {
+//                final CharSequence title = child.getTitle(this);
+//                menu.add(title).setOnMenuItemClickListener(new OnMenuItemClickListener() {
+//                    public boolean onMenuItemClick(MenuItem item) {
+//                        // Adding specific group for syncing
+//                        if (child.mUngrouped && syncMode == SYNC_MODE_EVERYTHING) {
+//                            account.setShouldSync(true);
+//                        } else {
+//                            account.setShouldSync(child, true);
+//                        }
+//                        mAdapter.notifyDataSetChanged();
+//                        return true;
+//                    }
+//                });
+//            }
+//        }
+//    }
+//
+//    /** {@inheritDoc} */
+//    @Override
+//    public void onBackPressed() {
+//        doSaveAction();
+//    }
+//
+//    private void doSaveAction() {
+//        mContactsPrefs.setSortOrder(mSortOrder);
+//        mContactsPrefs.setDisplayOrder(mDisplayOrder);
+//
+//        if (mAdapter == null || mAdapter.mAccounts == null) {
+//            return;
+//        }
+//        setDisplayOnlyPhones(mDisplayPhones.isChecked());
+//        new UpdateTask(this).execute(mAdapter.mAccounts);
+//    }
+//
+//    /**
+//     * Background task that persists changes to {@link Groups#GROUP_VISIBLE},
+//     * showing spinner dialog to user while updating.
+//     */
+//    public static class UpdateTask extends
+//            WeakAsyncTask<AccountSet, Void, Void, Activity> {
+//        private WeakReference<ProgressDialog> mProgress;
+//
+//        public UpdateTask(Activity target) {
+//            super(target);
+//        }
+//
+//        /** {@inheritDoc} */
+//        @Override
+//        protected void onPreExecute(Activity target) {
+//            final Context context = target;
+//
+//            mProgress = new WeakReference<ProgressDialog>(ProgressDialog.show(context, null,
+//                    context.getText(R.string.savingDisplayGroups)));
+//
+//            // Before starting this task, start an empty service to protect our
+//            // process from being reclaimed by the system.
+//            context.startService(new Intent(context, EmptyService.class));
+//        }
+//
+//        /** {@inheritDoc} */
+//        @Override
+//        protected Void doInBackground(Activity target, AccountSet... params) {
+//            final Context context = target;
+//            final ContentValues values = new ContentValues();
+//            final ContentResolver resolver = context.getContentResolver();
+//
+//            try {
+//                // Build changes and persist in transaction
+//                final AccountSet set = params[0];
+//                final ArrayList<ContentProviderOperation> diff = set.buildDiff();
+//                resolver.applyBatch(ContactsContract.AUTHORITY, diff);
+//            } catch (RemoteException e) {
+//                Log.e(TAG, "Problem saving display groups", e);
+//            } catch (OperationApplicationException e) {
+//                Log.e(TAG, "Problem saving display groups", e);
+//            }
+//
+//            return null;
+//        }
+//
+//        /** {@inheritDoc} */
+//        @Override
+//        protected void onPostExecute(Activity target, Void result) {
+//            final Context context = target;
+//
+//            final ProgressDialog dialog = mProgress.get();
+//            if (dialog != null) {
+//                try {
+//                    dialog.dismiss();
+//                } catch (Exception e) {
+//                    Log.e(TAG, "Error dismissing progress dialog", e);
+//                }
+//            }
+//
+//            target.finish();
+//
+//            // Stop the service that was protecting us
+//            context.stopService(new Intent(context, EmptyService.class));
+//        }
+//    }
+//
+//    @Override
+//    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
+//            boolean globalSearch) {
+//        if (globalSearch) {
+//            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
+//        } else {
+//            ContactsSearchManager.startSearch(this, initialQuery);
+//        }
+//    }
+}
diff --git a/src/com/android/contacts/preference/ContactsPreferences.java b/src/com/android/contacts/preference/ContactsPreferences.java
new file mode 100644
index 0000000..540158d
--- /dev/null
+++ b/src/com/android/contacts/preference/ContactsPreferences.java
@@ -0,0 +1,160 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.preference;
+
+import com.android.contacts.R;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.database.ContentObserver;
+import android.os.Handler;
+import android.provider.ContactsContract;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
+
+/**
+ * Manages user preferences for contacts.
+ */
+public final class ContactsPreferences extends ContentObserver {
+
+    public static final String PREF_DISPLAY_ONLY_PHONES = "only_phones";
+    public static final boolean PREF_DISPLAY_ONLY_PHONES_DEFAULT = false;
+
+    private Context mContext;
+    private int mSortOrder = -1;
+    private int mDisplayOrder = -1;
+    private ChangeListener mListener = null;
+    private Handler mHandler;
+
+    public ContactsPreferences(Context context) {
+        super(null);
+        mContext = context;
+        mHandler = new Handler();
+    }
+
+    public boolean isSortOrderUserChangeable() {
+        return mContext.getResources().getBoolean(R.bool.config_sort_order_user_changeable);
+    }
+
+    public int getDefaultSortOrder() {
+        if (mContext.getResources().getBoolean(R.bool.config_default_sort_order_primary)) {
+            return ContactsContract.Preferences.SORT_ORDER_PRIMARY;
+        } else {
+            return ContactsContract.Preferences.SORT_ORDER_ALTERNATIVE;
+        }
+    }
+
+    public int getSortOrder() {
+        if (!isSortOrderUserChangeable()) {
+            return getDefaultSortOrder();
+        }
+
+        if (mSortOrder == -1) {
+            try {
+                mSortOrder = Settings.System.getInt(mContext.getContentResolver(),
+                        ContactsContract.Preferences.SORT_ORDER);
+            } catch (SettingNotFoundException e) {
+                mSortOrder = getDefaultSortOrder();
+            }
+        }
+        return mSortOrder;
+    }
+
+    public void setSortOrder(int sortOrder) {
+        mSortOrder = sortOrder;
+        Settings.System.putInt(mContext.getContentResolver(),
+                ContactsContract.Preferences.SORT_ORDER, sortOrder);
+    }
+
+    public boolean isDisplayOrderUserChangeable() {
+        return mContext.getResources().getBoolean(R.bool.config_display_order_user_changeable);
+    }
+
+    public int getDefaultDisplayOrder() {
+        if (mContext.getResources().getBoolean(R.bool.config_default_display_order_primary)) {
+            return ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY;
+        } else {
+            return ContactsContract.Preferences.DISPLAY_ORDER_ALTERNATIVE;
+        }
+    }
+
+    public int getDisplayOrder() {
+        if (!isDisplayOrderUserChangeable()) {
+            return getDefaultDisplayOrder();
+        }
+
+        if (mDisplayOrder == -1) {
+            try {
+                mDisplayOrder = Settings.System.getInt(mContext.getContentResolver(),
+                        ContactsContract.Preferences.DISPLAY_ORDER);
+            } catch (SettingNotFoundException e) {
+                mDisplayOrder = getDefaultDisplayOrder();
+            }
+        }
+        return mDisplayOrder;
+    }
+
+    public void setDisplayOrder(int displayOrder) {
+        mDisplayOrder = displayOrder;
+        Settings.System.putInt(mContext.getContentResolver(),
+                ContactsContract.Preferences.DISPLAY_ORDER, displayOrder);
+    }
+
+    public void registerChangeListener(ChangeListener listener) {
+        if (mListener != null) unregisterChangeListener();
+
+        mListener = listener;
+
+        // Reset preferences to "unknown" because they may have changed while the
+        // observer was unregistered.
+        mDisplayOrder = -1;
+        mSortOrder = -1;
+
+        final ContentResolver contentResolver = mContext.getContentResolver();
+        contentResolver.registerContentObserver(
+                Settings.System.getUriFor(
+                        ContactsContract.Preferences.SORT_ORDER), false, this);
+        contentResolver.registerContentObserver(
+                Settings.System.getUriFor(
+                        ContactsContract.Preferences.DISPLAY_ORDER), false, this);
+    }
+
+    public void unregisterChangeListener() {
+        if (mListener != null) {
+            mContext.getContentResolver().unregisterContentObserver(this);
+            mListener = null;
+        }
+    }
+
+    @Override
+    public void onChange(boolean selfChange) {
+        // This notification is not sent on the Ui thread. Use the previously created Handler
+        // to switch to the Ui thread
+        mHandler.post(new Runnable() {
+            @Override
+            public void run() {
+                mSortOrder = -1;
+                mDisplayOrder = -1;
+                if (mListener != null) mListener.onChange();
+            }
+        });
+    }
+
+    public interface ChangeListener {
+        void onChange();
+    }
+}
diff --git a/src/com/android/contacts/preference/DisplayOptionsPreferenceFragment.java b/src/com/android/contacts/preference/DisplayOptionsPreferenceFragment.java
new file mode 100644
index 0000000..db4a94e
--- /dev/null
+++ b/src/com/android/contacts/preference/DisplayOptionsPreferenceFragment.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.preference;
+
+import com.android.contacts.R;
+
+import android.os.Bundle;
+import android.preference.PreferenceFragment;
+
+/**
+ * This fragment shows the preferences for the first header.
+ */
+public class DisplayOptionsPreferenceFragment extends PreferenceFragment {
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // Load the preferences from an XML resource
+        addPreferencesFromResource(R.xml.preference_display_options);
+    }
+}
+
diff --git a/src/com/android/contacts/preference/DisplayOrderPreference.java b/src/com/android/contacts/preference/DisplayOrderPreference.java
new file mode 100644
index 0000000..fea01c8
--- /dev/null
+++ b/src/com/android/contacts/preference/DisplayOrderPreference.java
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.preference;
+
+import com.android.contacts.R;
+
+import android.content.Context;
+import android.preference.ListPreference;
+import android.provider.ContactsContract;
+import android.util.AttributeSet;
+
+/**
+ * Custom preference: view-name-as (first name first or last name first).
+ */
+public final class DisplayOrderPreference extends ListPreference {
+
+    private ContactsPreferences mPreferences;
+    private Context mContext;
+
+    public DisplayOrderPreference(Context context) {
+        super(context);
+        prepare();
+    }
+
+    public DisplayOrderPreference(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        prepare();
+    }
+
+    private void prepare() {
+        mContext = getContext();
+        mPreferences = new ContactsPreferences(mContext);
+        setEntries(new String[]{
+                mContext.getString(R.string.display_options_view_given_name_first),
+                mContext.getString(R.string.display_options_view_family_name_first),
+        });
+        setEntryValues(new String[]{
+                String.valueOf(ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY),
+                String.valueOf(ContactsContract.Preferences.DISPLAY_ORDER_ALTERNATIVE),
+        });
+        setValue(String.valueOf(mPreferences.getDisplayOrder()));
+    }
+
+    @Override
+    protected boolean shouldPersist() {
+        return false;   // This preference takes care of its own storage
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        switch (mPreferences.getDisplayOrder()) {
+            case ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY:
+                return mContext.getString(R.string.display_options_view_given_name_first);
+            case ContactsContract.Preferences.DISPLAY_ORDER_ALTERNATIVE:
+                return mContext.getString(R.string.display_options_view_family_name_first);
+        }
+        return null;
+    }
+
+    @Override
+    protected boolean persistString(String value) {
+        int newValue = Integer.parseInt(value);
+        if (newValue != mPreferences.getDisplayOrder()) {
+            mPreferences.setDisplayOrder(newValue);
+            notifyChanged();
+        }
+        return true;
+    }
+}
diff --git a/src/com/android/contacts/preference/SortOrderPreference.java b/src/com/android/contacts/preference/SortOrderPreference.java
new file mode 100644
index 0000000..81b034c
--- /dev/null
+++ b/src/com/android/contacts/preference/SortOrderPreference.java
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.preference;
+
+import com.android.contacts.R;
+
+import android.content.Context;
+import android.preference.ListPreference;
+import android.provider.ContactsContract;
+import android.util.AttributeSet;
+
+/**
+ * Custom preference: sort-by.
+ */
+public final class SortOrderPreference extends ListPreference {
+
+    private ContactsPreferences mPreferences;
+    private Context mContext;
+
+    public SortOrderPreference(Context context) {
+        super(context);
+        prepare();
+    }
+
+    public SortOrderPreference(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        prepare();
+    }
+
+    private void prepare() {
+        mContext = getContext();
+        mPreferences = new ContactsPreferences(mContext);
+        setEntries(new String[]{
+                mContext.getString(R.string.display_options_sort_by_given_name),
+                mContext.getString(R.string.display_options_sort_by_family_name),
+        });
+        setEntryValues(new String[]{
+                String.valueOf(ContactsContract.Preferences.SORT_ORDER_PRIMARY),
+                String.valueOf(ContactsContract.Preferences.SORT_ORDER_ALTERNATIVE),
+        });
+        setValue(String.valueOf(mPreferences.getSortOrder()));
+    }
+
+    @Override
+    protected boolean shouldPersist() {
+        return false;   // This preference takes care of its own storage
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        switch (mPreferences.getSortOrder()) {
+            case ContactsContract.Preferences.SORT_ORDER_PRIMARY:
+                return mContext.getString(R.string.display_options_sort_by_given_name);
+            case ContactsContract.Preferences.SORT_ORDER_ALTERNATIVE:
+                return mContext.getString(R.string.display_options_sort_by_family_name);
+        }
+        return null;
+    }
+
+    @Override
+    protected boolean persistString(String value) {
+        int newValue = Integer.parseInt(value);
+        if (newValue != mPreferences.getSortOrder()) {
+            mPreferences.setSortOrder(newValue);
+            notifyChanged();
+        }
+        return true;
+    }
+}
diff --git a/src/com/android/contacts/quickcontact/CheckableImageView.java b/src/com/android/contacts/quickcontact/CheckableImageView.java
new file mode 100644
index 0000000..d1b75cb
--- /dev/null
+++ b/src/com/android/contacts/quickcontact/CheckableImageView.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2008 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.contacts.quickcontact;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.Checkable;
+import android.widget.ImageView;
+
+/**
+ * A special variation of ImageView that can be used as a checkable object.
+ * This is used as the background view of quickcontact chiclet, which is in checked state
+ * when disambig list is shown. Otherwise, it works identically to a ImageView.
+ */
+public class CheckableImageView extends ImageView implements Checkable {
+    private boolean mChecked;
+
+    private static final int[] CHECKED_STATE_SET = {
+        android.R.attr.state_checked
+    };
+
+    public CheckableImageView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    @Override
+    public int[] onCreateDrawableState(int extraSpace) {
+        final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
+        if (isChecked()) {
+            mergeDrawableStates(drawableState, CHECKED_STATE_SET);
+        }
+        return drawableState;
+    }
+
+    public void toggle() {
+        setChecked(!mChecked);
+    }
+
+    public boolean isChecked() {
+        return mChecked;
+    }
+
+    public void setChecked(boolean checked) {
+        if (mChecked != checked) {
+            mChecked = checked;
+            refreshDrawableState();
+        }
+    }
+}
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
new file mode 100644
index 0000000..97df680
--- /dev/null
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2009 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.contacts.quickcontact;
+
+import android.app.Activity;
+import android.content.ContentUris;
+import android.content.Intent;
+import android.graphics.Rect;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract.QuickContact;
+import android.provider.ContactsContract.RawContacts;
+import android.util.Log;
+
+/**
+ * Stub translucent activity that just shows {@link QuickContactWindow} floating
+ * above the caller. This temporary hack should eventually be replaced with
+ * direct framework support.
+ */
+public final class QuickContactActivity extends Activity implements
+        QuickContactWindow.OnDismissListener {
+    private static final String TAG = "QuickContactActivity";
+
+    static final boolean LOGV = false;
+    static final boolean FORCE_CREATE = false;
+
+    private QuickContactWindow mQuickContact;
+
+    @Override
+    protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        if (LOGV) Log.d(TAG, "onCreate");
+
+        this.onNewIntent(getIntent());
+    }
+
+    @Override
+    public void onNewIntent(Intent intent) {
+        super.onNewIntent(intent);
+        if (LOGV) Log.d(TAG, "onNewIntent");
+
+        if (QuickContactWindow.TRACE_LAUNCH) {
+            android.os.Debug.startMethodTracing(QuickContactWindow.TRACE_TAG);
+        }
+
+        if (mQuickContact == null || FORCE_CREATE) {
+            if (LOGV) Log.d(TAG, "Preparing window");
+            mQuickContact = new QuickContactWindow(this, this);
+        }
+
+        // Use our local window token for now
+        Uri lookupUri = intent.getData();
+        // Check to see whether it comes from the old version.
+        if (android.provider.Contacts.AUTHORITY.equals(lookupUri.getAuthority())) {
+            final long rawContactId = ContentUris.parseId(lookupUri);
+            lookupUri = RawContacts.getContactLookupUri(getContentResolver(),
+                    ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId));
+        }
+        final Bundle extras = intent.getExtras();
+
+        // Read requested parameters for displaying
+        final Rect target = intent.getSourceBounds();
+        final int mode = extras.getInt(QuickContact.EXTRA_MODE, QuickContact.MODE_MEDIUM);
+        final String[] excludeMimes = extras.getStringArray(QuickContact.EXTRA_EXCLUDE_MIMES);
+
+        mQuickContact.show(lookupUri, target, mode, excludeMimes);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void onBackPressed() {
+        if (LOGV) Log.w(TAG, "Unexpected back captured by stub activity");
+        finish();
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        if (LOGV) Log.d(TAG, "onPause");
+
+        // Dismiss any dialog when pausing
+        mQuickContact.dismiss();
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        if (LOGV) Log.d(TAG, "onDestroy");
+    }
+
+    /** {@inheritDoc} */
+    public void onDismiss(QuickContactWindow dialog) {
+        if (LOGV) Log.d(TAG, "onDismiss");
+
+        if (isTaskRoot() && !FORCE_CREATE) {
+            // Instead of stopping, simply push this to the back of the stack.
+            // This is only done when running at the top of the stack;
+            // otherwise, we have been launched by someone else so need to
+            // allow the user to go back to the caller.
+            moveTaskToBack(false);
+        } else {
+            finish();
+        }
+    }
+}
diff --git a/src/com/android/contacts/quickcontact/QuickContactWindow.java b/src/com/android/contacts/quickcontact/QuickContactWindow.java
new file mode 100644
index 0000000..454ac70
--- /dev/null
+++ b/src/com/android/contacts/quickcontact/QuickContactWindow.java
@@ -0,0 +1,1718 @@
+/*
+ * Copyright (C) 2009 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.contacts.quickcontact;
+
+import com.android.contacts.Collapser;
+import com.android.contacts.ContactPresenceIconUtil;
+import com.android.contacts.ContactsUtils;
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.util.Constants;
+import com.android.contacts.util.DataStatus;
+import com.android.contacts.util.NotifyingAsyncQueryHandler;
+import com.android.contacts.util.PhoneCapabilityTester;
+import com.android.internal.policy.PolicyManager;
+import com.google.android.collect.Sets;
+
+import android.content.ActivityNotFoundException;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Im;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.provider.ContactsContract.CommonDataKinds.SipAddress;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.provider.ContactsContract.CommonDataKinds.Website;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.QuickContact;
+import android.provider.ContactsContract.RawContacts;
+import android.provider.ContactsContract.StatusUpdates;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.ActionMode;
+import android.view.ContextThemeWrapper;
+import android.view.Gravity;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewStub;
+import android.view.ViewTreeObserver.OnGlobalLayoutListener;
+import android.view.Window;
+import android.view.WindowManager;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
+import android.widget.AbsListView;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.HorizontalScrollView;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Window that shows QuickContact dialog for a specific {@link Contacts#_ID}.
+ */
+public class QuickContactWindow implements Window.Callback,
+        NotifyingAsyncQueryHandler.AsyncQueryListener, View.OnClickListener,
+        AbsListView.OnItemClickListener, CompoundButton.OnCheckedChangeListener, KeyEvent.Callback,
+        OnGlobalLayoutListener {
+    private static final String TAG = "QuickContactWindow";
+
+    /**
+     * Interface used to allow the person showing a {@link QuickContactWindow} to
+     * know when the window has been dismissed.
+     */
+    public interface OnDismissListener {
+        public void onDismiss(QuickContactWindow dialog);
+    }
+
+    /**
+     * Custom layout the sole purpose of which is to intercept the BACK key and
+     * close QC even when the soft keyboard is open.
+     */
+    public static class RootLayout extends RelativeLayout {
+
+        QuickContactWindow mQuickContactWindow;
+
+        public RootLayout(Context context, AttributeSet attrs) {
+            super(context, attrs);
+        }
+
+        /**
+         * Intercepts the BACK key event and dismisses QuickContact window.
+         */
+        @Override
+        public boolean dispatchKeyEventPreIme(KeyEvent event) {
+            if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
+                mQuickContactWindow.onBackPressed();
+                return true;
+            } else {
+                return super.dispatchKeyEventPreIme(event);
+            }
+        }
+    }
+
+    private final Context mContext;
+    private final LayoutInflater mInflater;
+    private final WindowManager mWindowManager;
+    private Window mWindow;
+    private View mDecor;
+    private final Rect mRect = new Rect();
+
+    private boolean mDismissed = false;
+    private boolean mQuerying = false;
+    private boolean mShowing = false;
+
+    private NotifyingAsyncQueryHandler mHandler;
+    private OnDismissListener mDismissListener;
+    private ResolveCache mResolveCache;
+
+    private Uri mLookupUri;
+    private Rect mAnchor;
+
+    private int mShadowHoriz;
+    private int mShadowVert;
+    private int mShadowTouch;
+
+    private int mScreenWidth;
+    private int mScreenHeight;
+    private int mRequestedY;
+
+    private boolean mHasValidSocial = false;
+    private boolean mMakePrimary = false;
+
+    private ImageView mArrowUp;
+    private ImageView mArrowDown;
+
+    private int mMode;
+    private RootLayout mRootView;
+    private View mHeader;
+    private HorizontalScrollView mTrackScroll;
+    private ViewGroup mTrack;
+    private Animation mTrackAnim;
+
+    private View mFooter;
+    private View mFooterDisambig;
+    private ListView mResolveList;
+    private CheckableImageView mLastAction;
+    private CheckBox mSetPrimaryCheckBox;
+
+    private int mWindowRecycled = 0;
+    private int mActionRecycled = 0;
+
+    /**
+     * Set of {@link Action} that are associated with the aggregate currently
+     * displayed by this dialog, represented as a map from {@link String}
+     * MIME-type to {@link ActionList}.
+     */
+    private ActionMap mActions = new ActionMap();
+
+    /**
+     * Pool of unused {@link CheckableImageView} that have previously been
+     * inflated, and are ready to be recycled through {@link #obtainView()}.
+     */
+    private LinkedList<View> mActionPool = new LinkedList<View>();
+
+    private String[] mExcludeMimes;
+
+    /**
+     * {@link #PRECEDING_MIMETYPES} and {@link #FOLLOWING_MIMETYPES} are used to sort MIME-types.
+     *
+     * <p>The MIME-types in {@link #PRECEDING_MIMETYPES} appear in the front of the dialog,
+     * in the order in the array.
+     *
+     * <p>The ones in {@link #FOLLOWING_MIMETYPES} appear in the end of the dialog, in alphabetical
+     * order.
+     *
+     * <p>The rest go between them, in the order in the array.
+     */
+    private static final String[] PRECEDING_MIMETYPES = new String[] {
+            Phone.CONTENT_ITEM_TYPE,
+            SipAddress.CONTENT_ITEM_TYPE,
+            Contacts.CONTENT_ITEM_TYPE,
+            Constants.MIME_SMS_ADDRESS,
+            Email.CONTENT_ITEM_TYPE,
+    };
+
+    /**
+     * See {@link #PRECEDING_MIMETYPES}.
+     */
+    private static final String[] FOLLOWING_MIMETYPES = new String[] {
+            StructuredPostal.CONTENT_ITEM_TYPE,
+            Website.CONTENT_ITEM_TYPE,
+    };
+
+    /**
+     * Specific list {@link ApplicationInfo#packageName} of apps that are
+     * prefered <strong>only</strong> for the purposes of default icons when
+     * multiple {@link ResolveInfo} are found to match. This only happens when
+     * the user has not selected a default app yet, and they will still be
+     * presented with the system disambiguation dialog.
+     */
+    private static final HashSet<String> sPreferResolve = Sets.newHashSet(
+            "com.android.email",
+            "com.android.calendar",
+            "com.android.contacts",
+            "com.android.mms",
+            "com.android.phone",
+            "com.android.browser");
+
+    private static final int TOKEN_DATA = 1;
+
+    static final boolean LOGD = false;
+
+    static final boolean TRACE_LAUNCH = false;
+    static final String TRACE_TAG = "quickcontact";
+
+    /**
+     * Prepare a dialog to show in the given {@link Context}.
+     */
+    public QuickContactWindow(Context context) {
+        mContext = new ContextThemeWrapper(context, R.style.QuickContact);
+        mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
+
+        mWindow = PolicyManager.makeNewWindow(mContext);
+        mWindow.setCallback(this);
+        mWindow.setWindowManager(mWindowManager, null, null);
+        mWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED);
+
+        mWindow.setContentView(R.layout.quickcontact);
+
+        mRootView = (RootLayout)mWindow.findViewById(R.id.root);
+        mRootView.mQuickContactWindow = this;
+        mRootView.setFocusable(true);
+        mRootView.setFocusableInTouchMode(true);
+        mRootView.setDescendantFocusability(RootLayout.FOCUS_AFTER_DESCENDANTS);
+
+        mArrowUp = (ImageView)mWindow.findViewById(R.id.arrow_up);
+        mArrowDown = (ImageView)mWindow.findViewById(R.id.arrow_down);
+
+        mResolveCache = new ResolveCache(mContext);
+
+        final Resources res = mContext.getResources();
+        mShadowHoriz = res.getDimensionPixelSize(R.dimen.quickcontact_shadow_horiz);
+        mShadowVert = res.getDimensionPixelSize(R.dimen.quickcontact_shadow_vert);
+        mShadowTouch = res.getDimensionPixelSize(R.dimen.quickcontact_shadow_touch);
+
+        mScreenWidth = mWindowManager.getDefaultDisplay().getWidth();
+        mScreenHeight = mWindowManager.getDefaultDisplay().getHeight();
+
+        mTrack = (ViewGroup)mWindow.findViewById(R.id.quickcontact);
+        mTrackScroll = (HorizontalScrollView)mWindow.findViewById(R.id.scroll);
+
+        mFooter = mWindow.findViewById(R.id.footer);
+        mFooterDisambig = mWindow.findViewById(R.id.footer_disambig);
+        mResolveList = (ListView)mWindow.findViewById(android.R.id.list);
+        mSetPrimaryCheckBox = (CheckBox)mWindow.findViewById(android.R.id.checkbox);
+
+        mSetPrimaryCheckBox.setOnCheckedChangeListener(this);
+
+        // Prepare track entrance animation
+        mTrackAnim = AnimationUtils.loadAnimation(mContext, R.anim.quickcontact);
+        mTrackAnim.setInterpolator(new Interpolator() {
+            public float getInterpolation(float t) {
+                // Pushes past the target area, then snaps back into place.
+                // Equation for graphing: 1.2-((x*1.6)-1.1)^2
+                final float inner = (t * 1.55f) - 1.1f;
+                return 1.2f - inner * inner;
+            }
+        });
+
+        mHandler = new NotifyingAsyncQueryHandler(mContext, this);
+    }
+
+    /**
+     * Prepare a dialog to show in the given {@link Context}, and notify the
+     * given {@link OnDismissListener} each time this dialog is dismissed.
+     */
+    public QuickContactWindow(Context context, OnDismissListener dismissListener) {
+        this(context);
+        mDismissListener = dismissListener;
+    }
+
+    private View getHeaderView(int mode) {
+        View header = null;
+        switch (mode) {
+            case QuickContact.MODE_SMALL:
+                header = mWindow.findViewById(R.id.header_small);
+                break;
+            case QuickContact.MODE_MEDIUM:
+                header = mWindow.findViewById(R.id.header_medium);
+                break;
+            case QuickContact.MODE_LARGE:
+                header = mWindow.findViewById(R.id.header_large);
+                break;
+        }
+
+        if (header instanceof ViewStub) {
+            // Inflate actual header if we picked a stub
+            final ViewStub stub = (ViewStub)header;
+            header = stub.inflate();
+        } else if (header != null) {
+            header.setVisibility(View.VISIBLE);
+        }
+
+        return header;
+    }
+
+    /**
+     * Start showing a dialog for the given {@link Contacts#_ID} pointing
+     * towards the given location.
+     */
+    public synchronized void show(Uri lookupUri, Rect anchor, int mode, String[] excludeMimes) {
+        if (mQuerying || mShowing) {
+            Log.w(TAG, "dismissing before showing");
+            dismissInternal();
+        }
+
+        if (TRACE_LAUNCH && !android.os.Debug.isMethodTracingActive()) {
+            android.os.Debug.startMethodTracing(TRACE_TAG);
+        }
+
+        // Validate incoming parameters
+        final boolean validMode = (mode == QuickContact.MODE_SMALL
+                || mode == QuickContact.MODE_MEDIUM || mode == QuickContact.MODE_LARGE);
+        if (!validMode) {
+            throw new IllegalArgumentException("Invalid mode, expecting MODE_LARGE, "
+                    + "MODE_MEDIUM, or MODE_SMALL");
+        }
+
+        if (anchor == null) {
+            throw new IllegalArgumentException("Missing anchor rectangle");
+        }
+
+        // Prepare header view for requested mode
+        mLookupUri = lookupUri;
+        mAnchor = new Rect(anchor);
+        mMode = mode;
+        mExcludeMimes = excludeMimes;
+
+        mHeader = getHeaderView(mode);
+
+        setHeaderText(R.id.name, R.string.quickcontact_missing_name);
+
+        setHeaderText(R.id.status, null);
+        setHeaderText(R.id.timestamp, null);
+
+        setHeaderImage(R.id.presence, null);
+
+        resetTrack();
+
+        // We need to have a focused view inside the QuickContact window so
+        // that the BACK key event can be intercepted
+        mRootView.requestFocus();
+
+        mHasValidSocial = false;
+        mDismissed = false;
+        mQuerying = true;
+
+        // Start background query for data, but only select photo rows when they
+        // directly match the super-primary PHOTO_ID.
+        final Uri dataUri = getDataUri(lookupUri);
+        mHandler.cancelOperation(TOKEN_DATA);
+
+        // Only request photo data when required by mode
+        if (mMode == QuickContact.MODE_LARGE) {
+            // Select photos, but only super-primary
+            mHandler.startQuery(TOKEN_DATA, lookupUri, dataUri, DataQuery.PROJECTION, Data.MIMETYPE
+                    + "!=? OR (" + Data.MIMETYPE + "=? AND " + Data._ID + "=" + Contacts.PHOTO_ID
+                    + ")", new String[] { Photo.CONTENT_ITEM_TYPE, Photo.CONTENT_ITEM_TYPE }, null);
+        } else {
+            // Exclude all photos from cursor
+            mHandler.startQuery(TOKEN_DATA, lookupUri, dataUri, DataQuery.PROJECTION, Data.MIMETYPE
+                    + "!=?", new String[] { Photo.CONTENT_ITEM_TYPE }, null);
+        }
+    }
+
+    /**
+     * Build a {@link Uri} into the {@link Data} table for the requested
+     * {@link Contacts#CONTENT_LOOKUP_URI} style {@link Uri}.
+     */
+    private Uri getDataUri(Uri lookupUri) {
+        // TODO: Formalize method of extracting LOOKUP_KEY
+        final List<String> path = lookupUri.getPathSegments();
+        final boolean validLookup = path.size() >= 3 && "lookup".equals(path.get(1));
+        if (!validLookup) {
+            // We only accept valid lookup-style Uris
+            throw new IllegalArgumentException("Expecting lookup-style Uri");
+        } else if (path.size() == 3) {
+            // No direct _ID provided, so force a lookup
+            lookupUri = Contacts.lookupContact(mContext.getContentResolver(), lookupUri);
+        }
+
+        final long contactId = ContentUris.parseId(lookupUri);
+        return Uri.withAppendedPath(ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId),
+                Contacts.Data.CONTENT_DIRECTORY);
+    }
+
+    /**
+     * Show the correct call-out arrow based on a {@link R.id} reference.
+     */
+    private void showArrow(int whichArrow, int requestedX) {
+        final View showArrow = (whichArrow == R.id.arrow_up) ? mArrowUp : mArrowDown;
+        final View hideArrow = (whichArrow == R.id.arrow_up) ? mArrowDown : mArrowUp;
+
+        final int arrowWidth = mArrowUp.getMeasuredWidth();
+
+        showArrow.setVisibility(View.VISIBLE);
+        ViewGroup.MarginLayoutParams param = (ViewGroup.MarginLayoutParams)showArrow.getLayoutParams();
+        param.leftMargin = requestedX - arrowWidth / 2;
+
+        hideArrow.setVisibility(View.INVISIBLE);
+    }
+
+    /**
+     * Actual internal method to show this dialog. Called only by
+     * {@link #considerShowing()} when all data requirements have been met.
+     */
+    private void showInternal() {
+        mDecor = mWindow.getDecorView();
+        mDecor.getViewTreeObserver().addOnGlobalLayoutListener(this);
+        WindowManager.LayoutParams l = mWindow.getAttributes();
+
+        l.width = mScreenWidth + mShadowHoriz + mShadowHoriz;
+        l.height = WindowManager.LayoutParams.WRAP_CONTENT;
+
+        // Force layout measuring pass so we have baseline numbers
+        mDecor.measure(l.width, l.height);
+        final int blockHeight = mDecor.getMeasuredHeight();
+
+        l.gravity = Gravity.TOP | Gravity.LEFT;
+        l.x = -mShadowHoriz;
+
+        if (mAnchor.top > blockHeight) {
+            // Show downwards callout when enough room, aligning bottom block
+            // edge with top of anchor area, and adjusting to inset arrow.
+            showArrow(R.id.arrow_down, mAnchor.centerX());
+            l.y = mAnchor.top - blockHeight + mShadowVert;
+            l.windowAnimations = R.style.QuickContactAboveAnimation;
+
+        } else {
+            // Otherwise show upwards callout, aligning block top with bottom of
+            // anchor area, and adjusting to inset arrow.
+            showArrow(R.id.arrow_up, mAnchor.centerX());
+            l.y = mAnchor.bottom - mShadowVert;
+            l.windowAnimations = R.style.QuickContactBelowAnimation;
+
+        }
+
+        l.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+                | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
+
+        mRequestedY = l.y;
+        mWindowManager.addView(mDecor, l);
+        mShowing = true;
+        mQuerying = false;
+        mDismissed = false;
+
+        mTrack.startAnimation(mTrackAnim);
+
+        if (TRACE_LAUNCH) {
+            android.os.Debug.stopMethodTracing();
+            Log.d(TAG, "Window recycled " + mWindowRecycled + " times, chiclets "
+                    + mActionRecycled + " times");
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void onGlobalLayout() {
+        layoutInScreen();
+    }
+
+    /**
+     * Adjust vertical {@link WindowManager.LayoutParams} to fit window as best
+     * as possible, shifting up to display content as needed.
+     */
+    private void layoutInScreen() {
+        if (!mShowing) return;
+
+        final WindowManager.LayoutParams l = mWindow.getAttributes();
+        final int originalY = l.y;
+
+        final int blockHeight = mDecor.getHeight();
+
+        l.y = mRequestedY;
+        if (mRequestedY + blockHeight > mScreenHeight) {
+            // Shift up from bottom when overflowing
+            l.y = mScreenHeight - blockHeight;
+        }
+
+        if (originalY != l.y) {
+            // Only update when value is changed
+            mWindow.setAttributes(l);
+        }
+    }
+
+    /**
+     * Dismiss this dialog if showing.
+     */
+    public synchronized void dismiss() {
+        // Notify any listeners that we've been dismissed
+        if (mDismissListener != null) {
+            mDismissListener.onDismiss(this);
+        }
+
+        dismissInternal();
+    }
+
+    private void dismissInternal() {
+        // Remove any attached window decor for recycling
+        boolean hadDecor = mDecor != null;
+        if (hadDecor) {
+            mWindowManager.removeView(mDecor);
+            mWindowRecycled++;
+            mDecor.getViewTreeObserver().removeGlobalOnLayoutListener(this);
+            mDecor = null;
+            mWindow.closeAllPanels();
+        }
+        mShowing = false;
+        mDismissed = true;
+
+        // Cancel any pending queries
+        mHandler.cancelOperation(TOKEN_DATA);
+        mQuerying = false;
+
+        // Completely hide header and reset track
+        mHeader.setVisibility(View.GONE);
+        resetTrack();
+    }
+
+    /**
+     * Reset track to initial state, recycling any chiclets.
+     */
+    private void resetTrack() {
+        // Release reference to last chiclet
+        mLastAction = null;
+
+        // Clear track actions and scroll to hard left
+        mResolveCache.clear();
+        mActions.clear();
+
+        // Recycle any chiclets in use
+        while (mTrack.getChildCount() > 2) {
+            this.releaseView(mTrack.getChildAt(1));
+            mTrack.removeViewAt(1);
+        }
+
+        mTrackScroll.fullScroll(View.FOCUS_LEFT);
+        mWasDownArrow = false;
+
+        // Clear any primary requests
+        mMakePrimary = false;
+        mSetPrimaryCheckBox.setChecked(false);
+
+        setResolveVisible(false, null);
+    }
+
+    /**
+     * Consider showing this window, which will only call through to
+     * {@link #showInternal()} when all data items are present.
+     */
+    private void considerShowing() {
+        if (!mShowing && !mDismissed) {
+            if (mMode == QuickContact.MODE_MEDIUM && !mHasValidSocial) {
+                // Missing valid social, swap medium for small header
+                mHeader.setVisibility(View.GONE);
+                mHeader = getHeaderView(QuickContact.MODE_SMALL);
+            }
+
+            // All queries have returned, pull curtain
+            showInternal();
+        }
+    }
+
+    /** {@inheritDoc} */
+    public synchronized void onQueryComplete(int token, Object cookie, Cursor cursor) {
+        // Bail early when query is stale
+        if (cookie != mLookupUri) return;
+
+        if (cursor == null) {
+            // Problem while running query, so bail without showing
+            Log.w(TAG, "Missing cursor for token=" + token);
+            this.dismiss();
+            return;
+        }
+
+        handleData(cursor);
+
+        if (!cursor.isClosed()) {
+            cursor.close();
+        }
+
+        considerShowing();
+    }
+
+    /** Assign this string to the view, if found in {@link #mHeader}. */
+    private void setHeaderText(int id, int resId) {
+        setHeaderText(id, mContext.getResources().getText(resId));
+    }
+
+    /** Assign this string to the view, if found in {@link #mHeader}. */
+    private void setHeaderText(int id, CharSequence value) {
+        final View view = mHeader.findViewById(id);
+        if (view instanceof TextView) {
+            ((TextView)view).setText(value);
+            view.setVisibility(TextUtils.isEmpty(value) ? View.GONE : View.VISIBLE);
+        }
+    }
+
+    /** Assign this image to the view, if found in {@link #mHeader}. */
+    private void setHeaderImage(int id, Drawable drawable) {
+        final View view = mHeader.findViewById(id);
+        if (view instanceof ImageView) {
+            ((ImageView)view).setImageDrawable(drawable);
+            view.setVisibility(drawable == null ? View.GONE : View.VISIBLE);
+        }
+    }
+
+    /**
+     * Find the QuickContact-specific presence icon for showing in chiclets.
+     */
+    private Drawable getTrackPresenceIcon(int status) {
+        int resId;
+        switch (status) {
+            case StatusUpdates.AVAILABLE:
+                resId = R.drawable.quickcontact_slider_presence_active;
+                break;
+            case StatusUpdates.IDLE:
+            case StatusUpdates.AWAY:
+                resId = R.drawable.quickcontact_slider_presence_away;
+                break;
+            case StatusUpdates.DO_NOT_DISTURB:
+                resId = R.drawable.quickcontact_slider_presence_busy;
+                break;
+            case StatusUpdates.INVISIBLE:
+                resId = R.drawable.quickcontact_slider_presence_inactive;
+                break;
+            case StatusUpdates.OFFLINE:
+            default:
+                resId = R.drawable.quickcontact_slider_presence_inactive;
+        }
+        return mContext.getResources().getDrawable(resId);
+    }
+
+    /** Read {@link String} from the given {@link Cursor}. */
+    private static String getAsString(Cursor cursor, String columnName) {
+        final int index = cursor.getColumnIndex(columnName);
+        return cursor.getString(index);
+    }
+
+    /** Read {@link Integer} from the given {@link Cursor}. */
+    private static int getAsInt(Cursor cursor, String columnName) {
+        final int index = cursor.getColumnIndex(columnName);
+        return cursor.getInt(index);
+    }
+
+    /**
+     * Abstract definition of an action that could be performed, along with
+     * string description and icon.
+     */
+    private interface Action extends Collapser.Collapsible<Action> {
+        public CharSequence getHeader();
+        public CharSequence getBody();
+
+        public String getMimeType();
+        public Drawable getFallbackIcon();
+
+        /**
+         * Build an {@link Intent} that will perform this action.
+         */
+        public Intent getIntent();
+
+        /**
+         * Checks if the contact data for this action is primary.
+         */
+        public Boolean isPrimary();
+
+        /**
+         * Returns a lookup (@link Uri) for the contact data item.
+         */
+        public Uri getDataUri();
+    }
+
+    /**
+     * Description of a specific {@link Data#_ID} item, with style information
+     * defined by a {@link DataKind}.
+     */
+    private static class DataAction implements Action {
+        private final Context mContext;
+        private final DataKind mKind;
+        private final String mMimeType;
+
+        private CharSequence mHeader;
+        private CharSequence mBody;
+        private Intent mIntent;
+
+        private boolean mAlternate;
+        private Uri mDataUri;
+        private boolean mIsPrimary;
+
+        /**
+         * Create an action from common {@link Data} elements.
+         */
+        public DataAction(Context context, String mimeType, DataKind kind,
+                long dataId, Cursor cursor) {
+            mContext = context;
+            mKind = kind;
+            mMimeType = mimeType;
+
+            // Inflate strings from cursor
+            mAlternate = Constants.MIME_SMS_ADDRESS.equals(mimeType);
+            if (mAlternate && mKind.actionAltHeader != null) {
+                mHeader = mKind.actionAltHeader.inflateUsing(context, cursor);
+            } else if (mKind.actionHeader != null) {
+                mHeader = mKind.actionHeader.inflateUsing(context, cursor);
+            }
+
+            if (getAsInt(cursor, Data.IS_SUPER_PRIMARY) != 0) {
+                mIsPrimary = true;
+            }
+
+            if (mKind.actionBody != null) {
+                mBody = mKind.actionBody.inflateUsing(context, cursor);
+            }
+
+            mDataUri = ContentUris.withAppendedId(Data.CONTENT_URI, dataId);
+
+            // Handle well-known MIME-types with special care
+            if (Phone.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                if (PhoneCapabilityTester.isPhone(mContext)) {
+                    final String number = getAsString(cursor, Phone.NUMBER);
+                    if (!TextUtils.isEmpty(number)) {
+                        final Uri callUri = Uri.fromParts(Constants.SCHEME_TEL, number, null);
+                        mIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED, callUri);
+                    }
+                }
+            } else if (SipAddress.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                if (PhoneCapabilityTester.isSipPhone(mContext)) {
+                    final String address = getAsString(cursor, SipAddress.SIP_ADDRESS);
+                    if (!TextUtils.isEmpty(address)) {
+                        final Uri callUri = Uri.fromParts(Constants.SCHEME_SIP, address, null);
+                        mIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED, callUri);
+                        // Note that this item will get a SIP-specific variant
+                        // of the "call phone" icon, rather than the standard
+                        // app icon for the Phone app (which we show for
+                        // regular phone numbers.)  That's because the phone
+                        // app explicitly specifies an android:icon attribute
+                        // for the SIP-related intent-filters in its manifest.
+                    }
+                }
+            } else if (Constants.MIME_SMS_ADDRESS.equals(mimeType)) {
+                if (PhoneCapabilityTester.isSmsIntentRegistered(mContext)) {
+                    final String number = getAsString(cursor, Phone.NUMBER);
+                    if (!TextUtils.isEmpty(number)) {
+                        final Uri smsUri = Uri.fromParts(Constants.SCHEME_SMSTO, number, null);
+                        mIntent = new Intent(Intent.ACTION_SENDTO, smsUri);
+                    }
+                }
+            } else if (Email.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                final String address = getAsString(cursor, Email.DATA);
+                if (!TextUtils.isEmpty(address)) {
+                    final Uri mailUri = Uri.fromParts(Constants.SCHEME_MAILTO, address, null);
+                    mIntent = new Intent(Intent.ACTION_SENDTO, mailUri);
+                }
+
+            } else if (Website.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                final String url = getAsString(cursor, Website.URL);
+                if (!TextUtils.isEmpty(url)) {
+                    mIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+                }
+
+            } else if (Im.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                final boolean isEmail = Email.CONTENT_ITEM_TYPE.equals(
+                        getAsString(cursor, Data.MIMETYPE));
+                if (isEmail || isProtocolValid(cursor)) {
+                    final int protocol = isEmail ? Im.PROTOCOL_GOOGLE_TALK :
+                            getAsInt(cursor, Im.PROTOCOL);
+
+                    if (isEmail) {
+                        // Use Google Talk string when using Email, and clear data
+                        // Uri so we don't try saving Email as primary.
+                        mHeader = context.getText(R.string.chat_gtalk);
+                        mDataUri = null;
+                    }
+
+                    String host = getAsString(cursor, Im.CUSTOM_PROTOCOL);
+                    String data = getAsString(cursor, isEmail ? Email.DATA : Im.DATA);
+                    if (protocol != Im.PROTOCOL_CUSTOM) {
+                        // Try bringing in a well-known host for specific protocols
+                        host = ContactsUtils.lookupProviderNameFromId(protocol);
+                    }
+
+                    if (!TextUtils.isEmpty(host) && !TextUtils.isEmpty(data)) {
+                        final String authority = host.toLowerCase();
+                        final Uri imUri = new Uri.Builder().scheme(Constants.SCHEME_IMTO).authority(
+                                authority).appendPath(data).build();
+                        mIntent = new Intent(Intent.ACTION_SENDTO, imUri);
+                    }
+                }
+            }
+
+            if (mIntent == null) {
+                // Otherwise fall back to default VIEW action
+                mIntent = new Intent(Intent.ACTION_VIEW, mDataUri);
+            }
+
+            // Always launch as new task, since we're like a launcher
+            mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        }
+
+        private boolean isProtocolValid(Cursor cursor) {
+            final int columnIndex = cursor.getColumnIndex(Im.PROTOCOL);
+            if (cursor.isNull(columnIndex)) {
+                return false;
+            }
+            try {
+                Integer.valueOf(cursor.getString(columnIndex));
+            } catch (NumberFormatException e) {
+                return false;
+            }
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        public CharSequence getHeader() {
+            return mHeader;
+        }
+
+        /** {@inheritDoc} */
+        public CharSequence getBody() {
+            return mBody;
+        }
+
+        /** {@inheritDoc} */
+        public String getMimeType() {
+            return mMimeType;
+        }
+
+        /** {@inheritDoc} */
+        public Uri getDataUri() {
+            return mDataUri;
+        }
+
+        /** {@inheritDoc} */
+        public Boolean isPrimary() {
+            return mIsPrimary;
+        }
+
+        /** {@inheritDoc} */
+        public Drawable getFallbackIcon() {
+            // Bail early if no valid resources
+            final String resPackageName = mKind.resPackageName;
+            if (resPackageName == null) return null;
+
+            final PackageManager pm = mContext.getPackageManager();
+            if (mAlternate && mKind.iconAltRes != -1) {
+                return pm.getDrawable(resPackageName, mKind.iconAltRes, null);
+            } else if (mKind.iconRes != -1) {
+                return pm.getDrawable(resPackageName, mKind.iconRes, null);
+            } else {
+                return null;
+            }
+        }
+
+        /** {@inheritDoc} */
+        public Intent getIntent() {
+            return mIntent;
+        }
+
+        /** {@inheritDoc} */
+        public boolean collapseWith(Action other) {
+            if (!shouldCollapseWith(other)) {
+                return false;
+            }
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        public boolean shouldCollapseWith(Action t) {
+            if (t == null) {
+                return false;
+            }
+            if (!(t instanceof DataAction)) {
+                Log.e(TAG, "t must be DataAction");
+                return false;
+            }
+            DataAction other = (DataAction)t;
+            if (!ContactsUtils.areObjectsEqual(mKind, other.mKind)) {
+                return false;
+            }
+            if (!ContactsUtils.shouldCollapse(mContext, mMimeType, mBody, other.mMimeType,
+                    other.mBody)) {
+                return false;
+            }
+            if (!TextUtils.equals(mMimeType, other.mMimeType)
+                    || !ContactsUtils.areIntentActionEqual(mIntent, other.mIntent)
+                    ) {
+                return false;
+            }
+            return true;
+        }
+    }
+
+    /**
+     * Specific action that launches the profile card.
+     */
+    private static class ProfileAction implements Action {
+        private final Context mContext;
+        private final Uri mLookupUri;
+
+        public ProfileAction(Context context, Uri lookupUri) {
+            mContext = context;
+            mLookupUri = lookupUri;
+        }
+
+        /** {@inheritDoc} */
+        public CharSequence getHeader() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        public CharSequence getBody() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        public String getMimeType() {
+            return Contacts.CONTENT_ITEM_TYPE;
+        }
+
+        /** {@inheritDoc} */
+        public Drawable getFallbackIcon() {
+            return mContext.getResources().getDrawable(R.drawable.ic_contacts_details);
+        }
+
+        /** {@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;
+        }
+
+        /** {@inheritDoc} */
+        public Boolean isPrimary() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        public Uri getDataUri() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        public boolean collapseWith(Action t) {
+            return false; // Never dup.
+        }
+
+        /** {@inheritDoc} */
+        public boolean shouldCollapseWith(Action t) {
+            return false; // Never dup.
+        }
+    }
+
+    /**
+     * Internally hold a cache of scaled icons based on {@link PackageManager}
+     * queries, keyed internally on MIME-type.
+     */
+    private static class ResolveCache {
+        private PackageManager mPackageManager;
+
+        /**
+         * Cached entry holding the best {@link ResolveInfo} for a specific
+         * MIME-type, along with a {@link SoftReference} to its icon.
+         */
+        private static class Entry {
+            public ResolveInfo bestResolve;
+            public SoftReference<Drawable> icon;
+        }
+
+        private HashMap<String, Entry> mCache = new HashMap<String, Entry>();
+
+        public ResolveCache(Context context) {
+            mPackageManager = context.getPackageManager();
+        }
+
+        /**
+         * Get the {@link Entry} best associated with the given {@link Action},
+         * or create and populate a new one if it doesn't exist.
+         */
+        protected Entry getEntry(Action action) {
+            final String mimeType = action.getMimeType();
+            Entry entry = mCache.get(mimeType);
+            if (entry != null) return entry;
+            entry = new Entry();
+
+            final Intent intent = action.getIntent();
+            if (intent != null) {
+                final List<ResolveInfo> matches = mPackageManager.queryIntentActivities(intent,
+                        PackageManager.MATCH_DEFAULT_ONLY);
+
+                // Pick first match, otherwise best found
+                ResolveInfo bestResolve = null;
+                final int size = matches.size();
+                if (size == 1) {
+                    bestResolve = matches.get(0);
+                } else if (size > 1) {
+                    bestResolve = getBestResolve(intent, matches);
+                }
+
+                if (bestResolve != null) {
+                    final Drawable icon = bestResolve.loadIcon(mPackageManager);
+
+                    entry.bestResolve = bestResolve;
+                    entry.icon = new SoftReference<Drawable>(icon);
+                }
+            }
+
+            mCache.put(mimeType, entry);
+            return entry;
+        }
+
+        /**
+         * Best {@link ResolveInfo} when multiple found. Ties are broken by
+         * selecting first from the {QuickContactWindow#sPreferResolve} list of
+         * preferred packages, second by apps that live on the system partition,
+         * otherwise the app from the top of the list. This is
+         * <strong>only</strong> used for selecting a default icon for
+         * displaying in the track, and does not shortcut the system
+         * {@link Intent} disambiguation dialog.
+         */
+        protected ResolveInfo getBestResolve(Intent intent, List<ResolveInfo> matches) {
+            // Try finding preferred activity, otherwise detect disambig
+            final ResolveInfo foundResolve = mPackageManager.resolveActivity(intent,
+                    PackageManager.MATCH_DEFAULT_ONLY);
+            final boolean foundDisambig = (foundResolve.match &
+                    IntentFilter.MATCH_CATEGORY_MASK) == 0;
+
+            if (!foundDisambig) {
+                // Found concrete match, so return directly
+                return foundResolve;
+            }
+
+            // Accept any package from prefer list, otherwise first system app
+            ResolveInfo firstSystem = null;
+            for (ResolveInfo info : matches) {
+                final boolean isSystem = (info.activityInfo.applicationInfo.flags
+                        & ApplicationInfo.FLAG_SYSTEM) != 0;
+                final boolean isPrefer = QuickContactWindow.sPreferResolve
+                        .contains(info.activityInfo.applicationInfo.packageName);
+
+
+
+                if (isPrefer) return info;
+                if (isSystem && firstSystem == null) firstSystem = info;
+            }
+
+            // Return first system found, otherwise first from list
+            return firstSystem != null ? firstSystem : matches.get(0);
+        }
+
+        /**
+         * Check {@link PackageManager} to see if any apps offer to handle the
+         * given {@link Action}.
+         */
+        public boolean hasResolve(Action action) {
+            return getEntry(action).bestResolve != null;
+        }
+
+        /**
+         * Find the best description for the given {@link Action}, usually used
+         * for accessibility purposes.
+         */
+        public CharSequence getDescription(Action action) {
+            final CharSequence actionHeader = action.getHeader();
+            final ResolveInfo info = getEntry(action).bestResolve;
+            if (!TextUtils.isEmpty(actionHeader)) {
+                return actionHeader;
+            } else if (info != null) {
+                return info.loadLabel(mPackageManager);
+            } else {
+                return null;
+            }
+        }
+
+        /**
+         * Return the best icon for the given {@link Action}, which is usually
+         * based on the {@link ResolveInfo} found through a
+         * {@link PackageManager} query.
+         */
+        public Drawable getIcon(Action action) {
+            final SoftReference<Drawable> iconRef = getEntry(action).icon;
+            return (iconRef == null) ? null : iconRef.get();
+        }
+
+        public void clear() {
+            mCache.clear();
+        }
+    }
+
+    /**
+     * Provide a strongly-typed {@link LinkedList} that holds a list of
+     * {@link Action} objects.
+     */
+    private class ActionList extends ArrayList<Action> {
+    }
+
+    /**
+     * Provide a simple way of collecting one or more {@link Action} objects
+     * under a MIME-type key.
+     */
+    private class ActionMap extends HashMap<String, ActionList> {
+        private void collect(String mimeType, Action info) {
+            // Create list for this MIME-type when needed
+            ActionList collectList = get(mimeType);
+            if (collectList == null) {
+                collectList = new ActionList();
+                put(mimeType, collectList);
+            }
+            collectList.add(info);
+        }
+    }
+
+    /**
+     * Check if the given MIME-type appears in the list of excluded MIME-types
+     * that the most-recent caller requested.
+     */
+    private boolean isMimeExcluded(String mimeType) {
+        if (mExcludeMimes == null) return false;
+        for (String excludedMime : mExcludeMimes) {
+            if (TextUtils.equals(excludedMime, mimeType)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Handle the result from the {@link #TOKEN_DATA} query.
+     */
+    private void handleData(Cursor cursor) {
+        if (cursor == null) return;
+
+        if (!isMimeExcluded(Contacts.CONTENT_ITEM_TYPE)) {
+            // Add the profile shortcut action
+            final Action action = new ProfileAction(mContext, mLookupUri);
+            mActions.collect(Contacts.CONTENT_ITEM_TYPE, action);
+        }
+
+        final DataStatus status = new DataStatus();
+        final AccountTypes sources = AccountTypes.getInstance(mContext);
+        final ImageView photoView = (ImageView)mHeader.findViewById(R.id.photo);
+
+        Bitmap photoBitmap = null;
+        while (cursor.moveToNext()) {
+            final long dataId = cursor.getLong(DataQuery._ID);
+            final String accountType = cursor.getString(DataQuery.ACCOUNT_TYPE);
+            final String mimeType = cursor.getString(DataQuery.MIMETYPE);
+
+            // Handle any social status updates from this row
+            status.possibleUpdate(cursor);
+
+            // Skip this data item if MIME-type excluded
+            if (isMimeExcluded(mimeType)) continue;
+
+            // Handle photos included as data row
+            if (Photo.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                final int colPhoto = cursor.getColumnIndex(Photo.PHOTO);
+                final byte[] photoBlob = cursor.getBlob(colPhoto);
+                if (photoBlob != null) {
+                    photoBitmap = BitmapFactory.decodeByteArray(photoBlob, 0, photoBlob.length);
+                }
+                continue;
+            }
+
+            final DataKind kind = sources.getKindOrFallback(accountType, mimeType, mContext,
+                    BaseAccountType.LEVEL_MIMETYPES);
+
+            if (kind != null) {
+                // Build an action for this data entry, find a mapping to a UI
+                // element, build its summary from the cursor, and collect it
+                // along with all others of this MIME-type.
+                final Action action = new DataAction(mContext, mimeType, kind, dataId, cursor);
+                considerAdd(action, mimeType);
+            }
+
+            // If phone number, also insert as text message action
+            if (Phone.CONTENT_ITEM_TYPE.equals(mimeType) && kind != null) {
+                final Action action = new DataAction(mContext, Constants.MIME_SMS_ADDRESS,
+                        kind, dataId, cursor);
+                considerAdd(action, Constants.MIME_SMS_ADDRESS);
+            }
+
+            // Handle Email rows with presence data as Im entry
+            final boolean hasPresence = !cursor.isNull(DataQuery.PRESENCE);
+            if (hasPresence && Email.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                final DataKind imKind = sources.getKindOrFallback(accountType,
+                        Im.CONTENT_ITEM_TYPE, mContext, BaseAccountType.LEVEL_MIMETYPES);
+                if (imKind != null) {
+                    final Action action = new DataAction(mContext, Im.CONTENT_ITEM_TYPE, imKind,
+                            dataId, cursor);
+                    considerAdd(action, Im.CONTENT_ITEM_TYPE);
+                }
+            }
+        }
+
+        if (cursor.moveToLast()) {
+            // Read contact information from last data row
+            final String name = cursor.getString(DataQuery.DISPLAY_NAME);
+            final int presence = cursor.getInt(DataQuery.CONTACT_PRESENCE);
+            final Drawable statusIcon = ContactPresenceIconUtil.getPresenceIcon(mContext, presence);
+
+            setHeaderText(R.id.name, name);
+            setHeaderImage(R.id.presence, statusIcon);
+        }
+
+        if (photoView != null) {
+            // Place photo when discovered in data, otherwise hide
+            photoView.setVisibility(photoBitmap != null ? View.VISIBLE : View.GONE);
+            photoView.setImageBitmap(photoBitmap);
+        }
+
+        mHasValidSocial = status.isValid();
+        if (mHasValidSocial && mMode != QuickContact.MODE_SMALL) {
+            // Update status when valid was found
+            setHeaderText(R.id.status, status.getStatus());
+            setHeaderText(R.id.timestamp, status.getTimestampLabel(mContext));
+        }
+
+        // Turn our list of actions into UI elements
+
+        // Index where we start adding child views.
+        int index = mTrack.getChildCount() - 1;
+
+        // 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);
+            }
+        }
+
+        // Keep the current index to append non PRECEDING/FOLLOWING items.
+        final int indexAfterPreceding = index;
+
+        // 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);
+            }
+        }
+
+        // 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++);
+        }
+    }
+
+    /**
+     * Consider adding the given {@link Action}, which will only happen if
+     * {@link PackageManager} finds an application to handle
+     * {@link Action#getIntent()}.
+     */
+    private void considerAdd(Action action, String mimeType) {
+        if (mResolveCache.hasResolve(action)) {
+            mActions.collect(mimeType, action);
+        }
+    }
+
+    /**
+     * Obtain a new {@link CheckableImageView} for a new chiclet, either by
+     * recycling one from {@link #mActionPool}, or by inflating a new one. When
+     * finished, use {@link #releaseView(View)} to return back into the pool for
+     * later recycling.
+     */
+    private synchronized View obtainView() {
+        View view = mActionPool.poll();
+        if (view == null || QuickContactActivity.FORCE_CREATE) {
+            view = mInflater.inflate(R.layout.quickcontact_item, mTrack, false);
+        }
+        return view;
+    }
+
+    /**
+     * Return the given {@link CheckableImageView} into our internal pool for
+     * possible recycling during another pass.
+     */
+    private synchronized void releaseView(View view) {
+        // Only add CheckableImageViews
+        if (!(view instanceof CheckableImageView)) {
+            return;
+        }
+        mActionPool.offer(view);
+        mActionRecycled++;
+    }
+
+    /**
+     * Inflate the in-track view for the action of the given MIME-type, collapsing duplicate values.
+     * Will use the icon provided by the {@link DataKind}.
+     */
+    private View inflateAction(String mimeType) {
+        final CheckableImageView view = (CheckableImageView)obtainView();
+        boolean isActionSet = false;
+
+        // Add direct intent if single child, otherwise flag for multiple
+        ActionList children = mActions.get(mimeType);
+        if (children.size() > 1) {
+            Collapser.collapseList(children);
+        }
+        Action firstInfo = children.get(0);
+        if (children.size() == 1) {
+            view.setTag(firstInfo);
+        } else {
+            for (Action action : children) {
+                if (action.isPrimary()) {
+                    view.setTag(action);
+                    isActionSet = true;
+                    break;
+                }
+            }
+            if (!isActionSet) {
+                view.setTag(children);
+            }
+        }
+
+        // Set icon and listen for clicks
+        final CharSequence descrip = mResolveCache.getDescription(firstInfo);
+        final Drawable icon = mResolveCache.getIcon(firstInfo);
+        view.setChecked(false);
+        view.setContentDescription(descrip);
+        view.setImageDrawable(icon);
+        view.setOnClickListener(this);
+        return view;
+    }
+
+    /** {@inheritDoc} */
+    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+        // Pass list item clicks along so that Intents are handled uniformly
+        onClick(view);
+    }
+
+    /**
+     * Flag indicating if {@link #mArrowDown} was visible during the last call
+     * to {@link #setResolveVisible(boolean, CheckableImageView)}. Used to
+     * decide during a later call if the arrow should be restored.
+     */
+    private boolean mWasDownArrow = false;
+
+    /**
+     * Helper for showing and hiding {@link #mFooterDisambig}, which will
+     * correctly manage {@link #mArrowDown} as needed.
+     */
+    private void setResolveVisible(boolean visible, CheckableImageView actionView) {
+        // Show or hide the resolve list if needed
+        boolean visibleNow = mFooterDisambig.getVisibility() == View.VISIBLE;
+
+        if (mLastAction != null) mLastAction.setChecked(false);
+        if (actionView != null) actionView.setChecked(true);
+        mLastAction = actionView;
+
+        // Bail early if already in desired state
+        if (visible == visibleNow) return;
+
+        mFooter.setVisibility(visible ? View.GONE : View.VISIBLE);
+        mFooterDisambig.setVisibility(visible ? View.VISIBLE : View.GONE);
+
+        if (visible) {
+            // If showing list, then hide and save state of down arrow
+            mWasDownArrow = mWasDownArrow || (mArrowDown.getVisibility() == View.VISIBLE);
+            mArrowDown.setVisibility(View.INVISIBLE);
+        } else {
+            // If hiding list, restore any down arrow state
+            mArrowDown.setVisibility(mWasDownArrow ? View.VISIBLE : View.INVISIBLE);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void onClick(View view) {
+        final boolean isActionView = (view instanceof CheckableImageView);
+        final CheckableImageView actionView = isActionView ? (CheckableImageView)view : null;
+        final Object tag = view.getTag();
+        if (tag instanceof Action) {
+            // Incoming tag is concrete intent, so try launching
+            final Action action = (Action)tag;
+            final boolean makePrimary = mMakePrimary;
+
+            try {
+                mContext.startActivity(action.getIntent());
+            } catch (ActivityNotFoundException e) {
+                Toast.makeText(mContext, R.string.quickcontact_missing_app, Toast.LENGTH_SHORT)
+                        .show();
+            }
+
+            // Hide the resolution list, if present
+            setResolveVisible(false, null);
+            this.dismiss();
+
+            if (makePrimary) {
+                ContentValues values = new ContentValues(1);
+                values.put(Data.IS_SUPER_PRIMARY, 1);
+                final Uri dataUri = action.getDataUri();
+                if (dataUri != null) {
+                    mContext.getContentResolver().update(dataUri, values, null, null);
+                }
+            }
+        } else if (tag instanceof ActionList) {
+            // Incoming tag is a MIME-type, so show resolution list
+            final ActionList children = (ActionList)tag;
+
+            // Show resolution list and set adapter
+            setResolveVisible(true, actionView);
+
+            mResolveList.setOnItemClickListener(this);
+            mResolveList.setAdapter(new BaseAdapter() {
+                public int getCount() {
+                    return children.size();
+                }
+
+                public Object getItem(int position) {
+                    return children.get(position);
+                }
+
+                public long getItemId(int position) {
+                    return position;
+                }
+
+                public View getView(int position, View convertView, ViewGroup parent) {
+                    if (convertView == null) {
+                        convertView = mInflater.inflate(
+                                R.layout.quickcontact_resolve_item, parent, false);
+                    }
+
+                    // Set action title based on summary value
+                    final Action action = (Action)getItem(position);
+
+                    TextView text1 = (TextView)convertView.findViewById(android.R.id.text1);
+                    TextView text2 = (TextView)convertView.findViewById(android.R.id.text2);
+
+                    text1.setText(action.getHeader());
+                    text2.setText(action.getBody());
+
+                    convertView.setTag(action);
+                    return convertView;
+                }
+            });
+
+            // Make sure we resize to make room for ListView
+            mDecor.forceLayout();
+            mDecor.invalidate();
+
+        }
+    }
+
+    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+        mMakePrimary = isChecked;
+    }
+
+    private void onBackPressed() {
+        // Back key will first dismiss any expanded resolve list, otherwise
+        // it will close the entire dialog.
+        if (mFooterDisambig.getVisibility() == View.VISIBLE) {
+            setResolveVisible(false, null);
+            mDecor.forceLayout();
+            mDecor.invalidate();
+        } else {
+            dismiss();
+        }
+    }
+
+    /** {@inheritDoc} */
+    public boolean dispatchKeyEvent(KeyEvent event) {
+        if (mWindow.superDispatchKeyEvent(event)) {
+            return true;
+        }
+        return event.dispatch(this, mDecor != null
+                ? mDecor.getKeyDispatcherState() : null, this);
+    }
+
+    /** {@inheritDoc} */
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        if (keyCode == KeyEvent.KEYCODE_BACK) {
+            event.startTracking();
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    public boolean onKeyUp(int keyCode, KeyEvent event) {
+        if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking()
+                && !event.isCanceled()) {
+            onBackPressed();
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    public boolean onKeyLongPress(int keyCode, KeyEvent event) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    public boolean onKeyMultiple(int keyCode, int count, KeyEvent event) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
+        // TODO: make this window accessible
+        return false;
+    }
+
+    /**
+     * Detect if the given {@link MotionEvent} is outside the boundaries of this
+     * window, which usually means we should dismiss.
+     */
+    protected void detectEventOutside(MotionEvent event) {
+        if (event.getAction() == MotionEvent.ACTION_DOWN && mDecor != null) {
+            // Only try detecting outside events on down-press
+            mDecor.getHitRect(mRect);
+            mRect.top = mRect.top + mShadowTouch;
+            mRect.bottom = mRect.bottom - mShadowTouch;
+            final int x = (int)event.getX();
+            final int y = (int)event.getY();
+            if (!mRect.contains(x, y)) {
+                event.setAction(MotionEvent.ACTION_OUTSIDE);
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    public boolean dispatchTouchEvent(MotionEvent event) {
+        detectEventOutside(event);
+        if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
+            dismiss();
+            return true;
+        } else {
+            return mWindow.superDispatchTouchEvent(event);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public boolean dispatchTrackballEvent(MotionEvent event) {
+        return mWindow.superDispatchTrackballEvent(event);
+    }
+
+    /** {@inheritDoc} */
+    public void onContentChanged() {
+    }
+
+    /** {@inheritDoc} */
+    public boolean onCreatePanelMenu(int featureId, Menu menu) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    public View onCreatePanelView(int featureId) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    public boolean onMenuItemSelected(int featureId, MenuItem item) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    public boolean onMenuOpened(int featureId, Menu menu) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    public void onPanelClosed(int featureId, Menu menu) {
+    }
+
+    /** {@inheritDoc} */
+    public boolean onPreparePanel(int featureId, View view, Menu menu) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    public boolean onSearchRequested() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams attrs) {
+        if (mDecor != null) {
+            mWindowManager.updateViewLayout(mDecor, attrs);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void onWindowFocusChanged(boolean hasFocus) {
+    }
+
+    /** {@inheritDoc} */
+    public void onAttachedToWindow() {
+        // No actions
+    }
+
+    /** {@inheritDoc} */
+    public void onDetachedFromWindow() {
+        // No actions
+    }
+
+    /** {@inheritDoc} */
+    public ActionMode onStartActionMode(ActionMode.Callback callback) {
+        return null;
+    }
+
+    private interface DataQuery {
+        final String[] PROJECTION = new String[] {
+                Data._ID,
+
+                RawContacts.ACCOUNT_TYPE,
+                Contacts.STARRED,
+                Contacts.DISPLAY_NAME,
+                Contacts.CONTACT_PRESENCE,
+
+                Data.STATUS,
+                Data.STATUS_RES_PACKAGE,
+                Data.STATUS_ICON,
+                Data.STATUS_LABEL,
+                Data.STATUS_TIMESTAMP,
+                Data.PRESENCE,
+
+                Data.RES_PACKAGE,
+                Data.MIMETYPE,
+                Data.IS_PRIMARY,
+                Data.IS_SUPER_PRIMARY,
+                Data.RAW_CONTACT_ID,
+
+                Data.DATA1, Data.DATA2, Data.DATA3, Data.DATA4, Data.DATA5,
+                Data.DATA6, Data.DATA7, Data.DATA8, Data.DATA9, Data.DATA10, Data.DATA11,
+                Data.DATA12, Data.DATA13, Data.DATA14, Data.DATA15,
+        };
+
+        final int _ID = 0;
+
+        final int ACCOUNT_TYPE = 1;
+        final int STARRED = 2;
+        final int DISPLAY_NAME = 3;
+        final int CONTACT_PRESENCE = 4;
+
+        final int STATUS = 5;
+        final int STATUS_RES_PACKAGE = 6;
+        final int STATUS_ICON = 7;
+        final int STATUS_LABEL = 8;
+        final int STATUS_TIMESTAMP = 9;
+        final int PRESENCE = 10;
+
+        final int RES_PACKAGE = 11;
+        final int MIMETYPE = 12;
+        final int IS_PRIMARY = 13;
+        final int IS_SUPER_PRIMARY = 14;
+    }
+}
diff --git a/src/com/android/contacts/socialwidget/SocialWidgetConfigureActivity.java b/src/com/android/contacts/socialwidget/SocialWidgetConfigureActivity.java
new file mode 100644
index 0000000..f5033fe
--- /dev/null
+++ b/src/com/android/contacts/socialwidget/SocialWidgetConfigureActivity.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.socialwidget;
+
+import android.app.Activity;
+import android.appwidget.AppWidgetManager;
+import android.content.Intent;
+import android.os.Bundle;
+import android.provider.ContactsContract.Contacts;
+
+public class SocialWidgetConfigureActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        // If the user presses back, we want to cancel
+        setResult(RESULT_CANCELED);
+
+        // Forward the Intent to the picker
+        final Intent pickerIntent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
+        startActivityForResult(pickerIntent, 0);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        // We came back from the Picker. If the user actually selected a contact,
+        // return it now
+        if (resultCode == Activity.RESULT_OK) {
+            final Bundle extras = getIntent().getExtras();
+            if (extras == null) throw new IllegalStateException("Intent extras are null");
+            final int widgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,
+                    AppWidgetManager.INVALID_APPWIDGET_ID);
+
+            // Save the setting
+            final SocialWidgetConfigureActivity context = SocialWidgetConfigureActivity.this;
+            SocialWidgetSettings.setContactUri(context, widgetId, data.getData());
+
+            // Update the widget
+            SocialWidgetProvider.startLoading(context, widgetId);
+
+            // Return OK so that the system won't remove the widget
+            final Intent resultValue = new Intent();
+            resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
+            setResult(RESULT_OK, resultValue);
+        }
+        finish();
+    }
+}
diff --git a/src/com/android/contacts/socialwidget/SocialWidgetProvider.java b/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
new file mode 100644
index 0000000..32bbffb
--- /dev/null
+++ b/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
@@ -0,0 +1,146 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.socialwidget;
+
+import com.android.contacts.R;
+import com.android.contacts.util.ContactBadgeUtil;
+import com.android.contacts.views.ContactLoader;
+
+import android.app.PendingIntent;
+import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProvider;
+import android.content.Context;
+import android.content.Intent;
+import android.content.Loader;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.provider.ContactsContract.QuickContact;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+import android.widget.RemoteViews;
+
+public class SocialWidgetProvider extends AppWidgetProvider {
+    private static final String TAG = "SocialWidgetProvider";
+
+    @Override
+    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
+        for (int appWidgetId : appWidgetIds) {
+            startLoading(context, appWidgetId);
+        }
+    }
+
+    public static void startLoading(final Context context, final int widgetId) {
+        // Show that we are loading
+        final AppWidgetManager widgetManager = AppWidgetManager.getInstance(context);
+        final RemoteViews loadingViews =
+            new RemoteViews(context.getPackageName(), R.layout.social_widget);
+        loadingViews.setTextViewText(R.id.name, "Loading...");
+        widgetManager.updateAppWidget(widgetId, loadingViews);
+
+        // Load
+        final Uri contactUri = SocialWidgetSettings.getContactUri(context, widgetId);
+        if (contactUri == null) {
+            // Not yet set-up (this can happen while the Configuration activity is visible)
+            return;
+        }
+        final ContactLoader contactLoader = new ContactLoader(context, contactUri);
+        contactLoader.registerListener(0,
+                new ContactLoader.OnLoadCompleteListener<ContactLoader.Result>() {
+                    @Override
+                    public void onLoadComplete(Loader<ContactLoader.Result> loader,
+                            ContactLoader.Result contactData) {
+                        if (contactData == ContactLoader.Result.ERROR ||
+                                contactData == ContactLoader.Result.NOT_FOUND) {
+                            return;
+                        }
+                        Log.d(TAG, "Loaded " + contactData.getLookupKey());
+                        final RemoteViews views = new RemoteViews(context.getPackageName(),
+                                R.layout.social_widget);
+
+                        setDisplayName(views, contactData.getDisplayName(),
+                                contactData.getPhoneticName());
+                        final Bitmap bitmap = ContactBadgeUtil.getPhoto(contactData);
+                        setPhoto(views, bitmap == null
+                                ? ContactBadgeUtil.loadPlaceholderPhoto(context) : bitmap);
+                        setSocialSnippet(views, contactData.getSocialSnippet());
+                        setStatusAttribution(views, ContactBadgeUtil.getSocialDate(
+                                contactData, context));
+
+                        // OnClick launch QuickContact
+                        final Intent intent = new Intent(QuickContact.ACTION_QUICK_CONTACT);
+                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                                | Intent.FLAG_ACTIVITY_CLEAR_TOP
+                                | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
+
+                        intent.setData(contactData.getLookupUri());
+                        intent.putExtra(QuickContact.EXTRA_MODE, QuickContact.MODE_SMALL);
+
+                        final PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
+                                intent, 0);
+                        views.setOnClickPendingIntent(R.id.image, pendingIntent);
+
+                        // Configure Ui
+                        widgetManager.updateAppWidget(widgetId, views);
+                    }
+
+                    private void setPhoto(RemoteViews views, Bitmap photo) {
+                        views.setImageViewBitmap(R.id.image, photo);
+                    }
+
+                    /**
+                     * Set the display name and phonetic name to show in the header.
+                     */
+                    private void setDisplayName(RemoteViews views, CharSequence displayName,
+                            CharSequence phoneticName) {
+                        views.setTextViewText(R.id.name, displayName);
+                        if (TextUtils.isEmpty(phoneticName)) {
+                            views.setViewVisibility(R.id.phonetic_name, View.GONE);
+                        } else {
+                            views.setTextViewText(R.id.phonetic_name, phoneticName);
+                            views.setViewVisibility(R.id.phonetic_name, View.VISIBLE);
+                        }
+                    }
+
+                    /**
+                     * Set the social snippet text to display in the header.
+                     */
+                    private void setSocialSnippet(RemoteViews views, CharSequence snippet) {
+                        if (TextUtils.isEmpty(snippet)) {
+                            views.setViewVisibility(R.id.status, View.GONE);
+                        } else {
+                            views.setTextViewText(R.id.status, snippet);
+                            views.setViewVisibility(R.id.status, View.VISIBLE);
+                        }
+                    }
+
+                    /**
+                     * Set the status attribution text to display in the header.
+                     */
+                    private void setStatusAttribution(RemoteViews views,
+                            CharSequence attribution) {
+                        if (attribution == null) {
+                            views.setViewVisibility(R.id.status_date, View.GONE);
+                        } else {
+                            views.setTextViewText(R.id.status_date, attribution);
+                            views.setViewVisibility(R.id.status_date, View.VISIBLE);
+                        }
+                    }
+                });
+        contactLoader.startLoading();
+    }
+}
diff --git a/src/com/android/contacts/socialwidget/SocialWidgetSettings.java b/src/com/android/contacts/socialwidget/SocialWidgetSettings.java
new file mode 100644
index 0000000..4377991
--- /dev/null
+++ b/src/com/android/contacts/socialwidget/SocialWidgetSettings.java
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.socialwidget;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.net.Uri;
+import android.util.Log;
+
+public class SocialWidgetSettings {
+    private static final String TAG = "SocialWidgetSettings";
+
+    private static final String PREFS_NAME = "WidgetSettings";
+    private static final String CONTACT_URI = "CONTACT_URI_%";
+
+    private static String getSettingsString(int widgetId) {
+        return CONTACT_URI.replace("%", Integer.toString(widgetId));
+    }
+
+    // TODO: Think about how to remove not-used Ids...we need a way to detect removed
+    // widgets
+
+    public static Uri getContactUri(Context context, int widgetId) {
+        final SharedPreferences settings =
+                context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
+        final String resultString = settings.getString(getSettingsString(widgetId), null);
+        final Uri result = resultString == null ? null : Uri.parse(resultString);
+        Log.d(TAG, "getContactUri(" + widgetId + ") --> " + result);
+        return result;
+    }
+
+    public static void setContactUri(Context context, int widgetId, Uri contactLookupUri) {
+        Log.d(TAG, "setContactUri(" + widgetId + ", " + contactLookupUri + ")");
+        final SharedPreferences settings =
+                context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
+        final Editor editor = settings.edit();
+        if (contactLookupUri == null) {
+            editor.remove(getSettingsString(widgetId));
+        } else {
+            editor.putString(getSettingsString(widgetId), contactLookupUri.toString());
+        }
+        editor.commit();
+    }
+}
diff --git a/src/com/android/contacts/ui/ContactsPreferences.java b/src/com/android/contacts/ui/ContactsPreferences.java
deleted file mode 100644
index 14c6e05..0000000
--- a/src/com/android/contacts/ui/ContactsPreferences.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.contacts.ui;
-
-import com.android.contacts.R;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.database.ContentObserver;
-import android.os.Handler;
-import android.provider.ContactsContract;
-import android.provider.Settings;
-import android.provider.Settings.SettingNotFoundException;
-
-/**
- * Manages user preferences for contacts.
- */
-public final class ContactsPreferences extends ContentObserver {
-    private Context mContext;
-    private int mSortOrder = -1;
-    private int mDisplayOrder = -1;
-    private ChangeListener mListener = null;
-    private Handler mHandler;
-
-    public ContactsPreferences(Context context) {
-        super(null);
-        mContext = context;
-        mHandler = new Handler();
-    }
-
-    public boolean isSortOrderUserChangeable() {
-        return mContext.getResources().getBoolean(R.bool.config_sort_order_user_changeable);
-    }
-
-    private int getDefaultSortOrder() {
-        if (mContext.getResources().getBoolean(R.bool.config_default_sort_order_primary)) {
-            return ContactsContract.Preferences.SORT_ORDER_PRIMARY;
-        } else {
-            return ContactsContract.Preferences.SORT_ORDER_ALTERNATIVE;
-        }
-    }
-
-    public int getSortOrder() {
-        if (!isSortOrderUserChangeable()) {
-            return getDefaultSortOrder();
-        }
-
-        if (mSortOrder == -1) {
-            try {
-                mSortOrder = Settings.System.getInt(mContext.getContentResolver(),
-                        ContactsContract.Preferences.SORT_ORDER);
-            } catch (SettingNotFoundException e) {
-                mSortOrder = getDefaultSortOrder();
-            }
-        }
-        return mSortOrder;
-    }
-
-    public void setSortOrder(int sortOrder) {
-        mSortOrder = sortOrder;
-        Settings.System.putInt(mContext.getContentResolver(),
-                ContactsContract.Preferences.SORT_ORDER, sortOrder);
-    }
-
-    public boolean isDisplayOrderUserChangeable() {
-        return mContext.getResources().getBoolean(R.bool.config_display_order_user_changeable);
-    }
-
-    private int getDefaultDisplayOrder() {
-        if (mContext.getResources().getBoolean(R.bool.config_default_display_order_primary)) {
-            return ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY;
-        } else {
-            return ContactsContract.Preferences.DISPLAY_ORDER_ALTERNATIVE;
-        }
-    }
-
-    public int getDisplayOrder() {
-        if (!isDisplayOrderUserChangeable()) {
-            return getDefaultDisplayOrder();
-        }
-
-        if (mDisplayOrder == -1) {
-            try {
-                mDisplayOrder = Settings.System.getInt(mContext.getContentResolver(),
-                        ContactsContract.Preferences.DISPLAY_ORDER);
-            } catch (SettingNotFoundException e) {
-                mDisplayOrder = getDefaultDisplayOrder();
-            }
-        }
-        return mDisplayOrder;
-    }
-
-    public void setDisplayOrder(int displayOrder) {
-        mDisplayOrder = displayOrder;
-        Settings.System.putInt(mContext.getContentResolver(),
-                ContactsContract.Preferences.DISPLAY_ORDER, displayOrder);
-    }
-
-    public void registerChangeListener(ChangeListener listener) {
-        if (mListener != null) unregisterChangeListener();
-
-        // We didn't watch before, so ensure that we actually forget our cache here
-        mSortOrder = -1;
-        mDisplayOrder = -1;
-
-        mListener = listener;
-        final ContentResolver contentResolver = mContext.getContentResolver();
-        contentResolver.registerContentObserver(
-                Settings.System.getUriFor(
-                        ContactsContract.Preferences.SORT_ORDER), false, this);
-        contentResolver.registerContentObserver(
-                Settings.System.getUriFor(
-                        ContactsContract.Preferences.DISPLAY_ORDER), false, this);
-    }
-
-    public void unregisterChangeListener() {
-        if (mListener != null) {
-            mContext.getContentResolver().unregisterContentObserver(this);
-            mListener = null;
-        }
-    }
-
-    @Override
-    public void onChange(boolean selfChange) {
-        // This notification is not sent on the Ui thread. Use the previously created Handler
-        // to switch to the Ui thread
-        mHandler.post(new Runnable() {
-            @Override
-            public void run() {
-                mSortOrder = -1;
-                mDisplayOrder = -1;
-                if (mListener != null) mListener.onChange();
-            }
-        });
-    }
-
-    public interface ChangeListener {
-        void onChange();
-    }
-}
diff --git a/src/com/android/contacts/ui/ContactsPreferencesActivity.java b/src/com/android/contacts/ui/ContactsPreferencesActivity.java
deleted file mode 100644
index 6bc9be8..0000000
--- a/src/com/android/contacts/ui/ContactsPreferencesActivity.java
+++ /dev/null
@@ -1,1075 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui;
-
-import com.android.contacts.ContactsSearchManager;
-import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.GoogleSource;
-import com.android.contacts.model.Sources;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.util.EmptyService;
-import com.android.contacts.util.WeakAsyncTask;
-import com.google.android.collect.Lists;
-
-import android.accounts.Account;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ExpandableListActivity;
-import android.app.ProgressDialog;
-import android.content.ContentProviderOperation;
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.EntityIterator;
-import android.content.Intent;
-import android.content.OperationApplicationException;
-import android.content.SharedPreferences;
-import android.content.ContentProviderOperation.Builder;
-import android.content.SharedPreferences.Editor;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.preference.PreferenceManager;
-import android.provider.ContactsContract;
-import android.provider.ContactsContract.Groups;
-import android.provider.ContactsContract.Settings;
-import android.util.Log;
-import android.view.ContextMenu;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.MenuItem.OnMenuItemClickListener;
-import android.widget.AdapterView;
-import android.widget.BaseExpandableListAdapter;
-import android.widget.CheckBox;
-import android.widget.ExpandableListAdapter;
-import android.widget.ExpandableListView;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-
-/**
- * Shows a list of all available {@link Groups} available, letting the user
- * select which ones they want to be visible.
- */
-public final class ContactsPreferencesActivity extends ExpandableListActivity implements
-        AdapterView.OnItemClickListener, View.OnClickListener {
-    private static final String TAG = "DisplayGroupsActivity";
-
-    public interface Prefs {
-        public static final String DISPLAY_ONLY_PHONES = "only_phones";
-        public static final boolean DISPLAY_ONLY_PHONES_DEFAULT = false;
-
-    }
-
-    private static final int DIALOG_SORT_ORDER = 1;
-    private static final int DIALOG_DISPLAY_ORDER = 2;
-
-    private ExpandableListView mList;
-    private DisplayAdapter mAdapter;
-
-    private SharedPreferences mPrefs;
-    private ContactsPreferences mContactsPrefs;
-
-    private CheckBox mDisplayPhones;
-
-    private View mHeaderPhones;
-    private View mHeaderSeparator;
-
-    private View mSortOrderView;
-    private TextView mSortOrderTextView;
-    private int mSortOrder;
-
-    private View mDisplayOrderView;
-    private TextView mDisplayOrderTextView;
-    private int mDisplayOrder;
-
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        setContentView(R.layout.contacts_preferences);
-
-        mList = getExpandableListView();
-        mList.setHeaderDividersEnabled(true);
-        mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
-        mContactsPrefs = new ContactsPreferences(this);
-        mAdapter = new DisplayAdapter(this);
-
-        final LayoutInflater inflater = getLayoutInflater();
-
-        createWithPhonesOnlyPreferenceView(inflater);
-        createSortOrderPreferenceView(inflater);
-        createDisplayOrderPreferenceView(inflater);
-        createDisplayGroupHeader(inflater);
-
-        findViewById(R.id.btn_done).setOnClickListener(this);
-        findViewById(R.id.btn_discard).setOnClickListener(this);
-
-        // Catch clicks on the header views
-        mList.setOnItemClickListener(this);
-        mList.setOnCreateContextMenuListener(this);
-
-        mSortOrder = mContactsPrefs.getSortOrder();
-        mDisplayOrder = mContactsPrefs.getDisplayOrder();
-    }
-
-    private void createWithPhonesOnlyPreferenceView(LayoutInflater inflater) {
-        // Add the "Only contacts with phones" header modifier.
-        mHeaderPhones = inflater.inflate(R.layout.display_options_phones_only, mList, false);
-        mHeaderPhones.setId(R.id.header_phones);
-        mDisplayPhones = (CheckBox) mHeaderPhones.findViewById(android.R.id.checkbox);
-        mDisplayPhones.setChecked(mPrefs.getBoolean(Prefs.DISPLAY_ONLY_PHONES,
-                Prefs.DISPLAY_ONLY_PHONES_DEFAULT));
-        {
-            final TextView text1 = (TextView)mHeaderPhones.findViewById(android.R.id.text1);
-            final TextView text2 = (TextView)mHeaderPhones.findViewById(android.R.id.text2);
-            text1.setText(R.string.showFilterPhones);
-            text2.setText(R.string.showFilterPhonesDescrip);
-        }
-    }
-
-    private void createSortOrderPreferenceView(LayoutInflater inflater) {
-        mSortOrderView = inflater.inflate(R.layout.preference_with_more_button, mList, false);
-
-        View preferenceLayout = mSortOrderView.findViewById(R.id.preference);
-
-        TextView label = (TextView)preferenceLayout.findViewById(R.id.label);
-        label.setText(getString(R.string.display_options_sort_list_by));
-
-        mSortOrderTextView = (TextView)preferenceLayout.findViewById(R.id.data);
-    }
-
-    private void createDisplayOrderPreferenceView(LayoutInflater inflater) {
-        mDisplayOrderView = inflater.inflate(R.layout.preference_with_more_button, mList, false);
-        View preferenceLayout = mDisplayOrderView.findViewById(R.id.preference);
-
-        TextView label = (TextView)preferenceLayout.findViewById(R.id.label);
-        label.setText(getString(R.string.display_options_view_names_as));
-
-        mDisplayOrderTextView = (TextView)preferenceLayout.findViewById(R.id.data);
-    }
-
-    private void createDisplayGroupHeader(LayoutInflater inflater) {
-        // Add the separator before showing the detailed group list.
-        mHeaderSeparator = inflater.inflate(R.layout.list_separator, mList, false);
-        {
-            final TextView text1 = (TextView)mHeaderSeparator;
-            text1.setText(R.string.headerContactGroups);
-        }
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        mList.removeHeaderView(mHeaderPhones);
-        mList.removeHeaderView(mSortOrderView);
-        mList.removeHeaderView(mDisplayOrderView);
-        mList.removeHeaderView(mHeaderSeparator);
-
-        // List adapter needs to be reset, because header views cannot be added
-        // to a list with an existing adapter.
-        setListAdapter(null);
-
-        mList.addHeaderView(mHeaderPhones, null, true);
-        if (mContactsPrefs.isSortOrderUserChangeable()) {
-            mList.addHeaderView(mSortOrderView, null, true);
-        }
-
-        if (mContactsPrefs.isSortOrderUserChangeable()) {
-            mList.addHeaderView(mDisplayOrderView, null, true);
-        }
-
-        mList.addHeaderView(mHeaderSeparator, null, false);
-
-        setListAdapter(mAdapter);
-
-        bindView();
-
-        // Start background query to find account details
-        new QueryGroupsTask(this).execute();
-    }
-
-    private void bindView() {
-        mSortOrderTextView.setText(
-                mSortOrder == ContactsContract.Preferences.SORT_ORDER_PRIMARY
-                        ? getString(R.string.display_options_sort_by_given_name)
-                        : getString(R.string.display_options_sort_by_family_name));
-
-        mDisplayOrderTextView.setText(
-                mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY
-                        ? getString(R.string.display_options_view_given_name_first)
-                        : getString(R.string.display_options_view_family_name_first));
-    }
-
-    @Override
-    protected Dialog onCreateDialog(int id, Bundle args) {
-        switch (id) {
-            case DIALOG_SORT_ORDER:
-                return createSortOrderDialog();
-            case DIALOG_DISPLAY_ORDER:
-                return createDisplayOrderDialog();
-        }
-
-        return null;
-    }
-
-    private Dialog createSortOrderDialog() {
-        String[] items = new String[] {
-                getString(R.string.display_options_sort_by_given_name),
-                getString(R.string.display_options_sort_by_family_name),
-        };
-
-        return new AlertDialog.Builder(this)
-            .setTitle(R.string.display_options_sort_list_by)
-            .setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
-                    public void onClick(DialogInterface dialog, int whichButton) {
-                        setSortOrder(dialog);
-                        dialog.dismiss();
-                    }
-                })
-            .setNegativeButton(android.R.string.cancel, null)
-            .create();
-    }
-
-    private Dialog createDisplayOrderDialog() {
-        String[] items = new String[] {
-                getString(R.string.display_options_view_given_name_first),
-                getString(R.string.display_options_view_family_name_first),
-        };
-
-        return new AlertDialog.Builder(this)
-            .setTitle(R.string.display_options_view_names_as)
-            .setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
-                    public void onClick(DialogInterface dialog, int whichButton) {
-                        setDisplayOrder(dialog);
-                        dialog.dismiss();
-                    }
-                })
-            .setNegativeButton(android.R.string.cancel, null)
-            .create();
-    }
-
-    @Override
-    protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
-        switch (id) {
-            case DIALOG_SORT_ORDER:
-                setCheckedItem(dialog,
-                        mSortOrder == ContactsContract.Preferences.SORT_ORDER_PRIMARY ? 0 : 1);
-                break;
-            case DIALOG_DISPLAY_ORDER:
-                setCheckedItem(dialog,
-                        mDisplayOrder == ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY
-                                ? 0 : 1);
-                break;
-        }
-    }
-
-    private void setCheckedItem(Dialog dialog, int position) {
-        ListView listView = ((AlertDialog)dialog).getListView();
-        listView.setItemChecked(position, true);
-        listView.setSelection(position);
-    }
-
-    protected void setSortOrder(DialogInterface dialog) {
-        ListView listView = ((AlertDialog)dialog).getListView();
-        int checked = listView.getCheckedItemPosition();
-        mSortOrder = checked == 0
-                ? ContactsContract.Preferences.SORT_ORDER_PRIMARY
-                : ContactsContract.Preferences.SORT_ORDER_ALTERNATIVE;
-
-        bindView();
-    }
-
-    protected void setDisplayOrder(DialogInterface dialog) {
-        ListView listView = ((AlertDialog)dialog).getListView();
-        int checked = listView.getCheckedItemPosition();
-        mDisplayOrder = checked == 0
-                ? ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY
-                : ContactsContract.Preferences.DISPLAY_ORDER_ALTERNATIVE;
-
-        bindView();
-    }
-
-    /**
-     * Background operation to build set of {@link AccountDisplay} for each
-     * {@link Sources#getAccounts(boolean)} that provides groups.
-     */
-    private static class QueryGroupsTask extends
-            WeakAsyncTask<Void, Void, AccountSet, ContactsPreferencesActivity> {
-        public QueryGroupsTask(ContactsPreferencesActivity target) {
-            super(target);
-        }
-
-        @Override
-        protected AccountSet doInBackground(ContactsPreferencesActivity target,
-                Void... params) {
-            final Context context = target;
-            final Sources sources = Sources.getInstance(context);
-            final ContentResolver resolver = context.getContentResolver();
-
-            // Inflate groups entry for each account
-            final AccountSet accounts = new AccountSet();
-            for (Account account : sources.getAccounts(false)) {
-                accounts.add(new AccountDisplay(resolver, account.name, account.type));
-            }
-
-            return accounts;
-        }
-
-        @Override
-        protected void onPostExecute(ContactsPreferencesActivity target, AccountSet result) {
-            target.mAdapter.setAccounts(result);
-        }
-    }
-
-    private static final int DEFAULT_SHOULD_SYNC = 1;
-    private static final int DEFAULT_VISIBLE = 0;
-
-    /**
-     * Entry holding any changes to {@link Groups} or {@link Settings} rows,
-     * such as {@link Groups#SHOULD_SYNC} or {@link Groups#GROUP_VISIBLE}.
-     */
-    protected static class GroupDelta extends ValuesDelta {
-        private boolean mUngrouped = false;
-        private boolean mAccountHasGroups;
-
-        private GroupDelta() {
-            super();
-        }
-
-        /**
-         * Build {@link GroupDelta} from the {@link Settings} row for the given
-         * {@link Settings#ACCOUNT_NAME} and {@link Settings#ACCOUNT_TYPE}.
-         */
-        public static GroupDelta fromSettings(ContentResolver resolver, String accountName,
-                String accountType, boolean accountHasGroups) {
-            final Uri settingsUri = Settings.CONTENT_URI.buildUpon()
-                    .appendQueryParameter(Settings.ACCOUNT_NAME, accountName)
-                    .appendQueryParameter(Settings.ACCOUNT_TYPE, accountType).build();
-            final Cursor cursor = resolver.query(settingsUri, new String[] {
-                    Settings.SHOULD_SYNC, Settings.UNGROUPED_VISIBLE
-            }, null, null, null);
-
-            try {
-                final ContentValues values = new ContentValues();
-                values.put(Settings.ACCOUNT_NAME, accountName);
-                values.put(Settings.ACCOUNT_TYPE, accountType);
-
-                if (cursor != null && cursor.moveToFirst()) {
-                    // Read existing values when present
-                    values.put(Settings.SHOULD_SYNC, cursor.getInt(0));
-                    values.put(Settings.UNGROUPED_VISIBLE, cursor.getInt(1));
-                    return fromBefore(values).setUngrouped(accountHasGroups);
-                } else {
-                    // Nothing found, so treat as create
-                    values.put(Settings.SHOULD_SYNC, DEFAULT_SHOULD_SYNC);
-                    values.put(Settings.UNGROUPED_VISIBLE, DEFAULT_VISIBLE);
-                    return fromAfter(values).setUngrouped(accountHasGroups);
-                }
-            } finally {
-                if (cursor != null) cursor.close();
-            }
-        }
-
-        public static GroupDelta fromBefore(ContentValues before) {
-            final GroupDelta entry = new GroupDelta();
-            entry.mBefore = before;
-            entry.mAfter = new ContentValues();
-            return entry;
-        }
-
-        public static GroupDelta fromAfter(ContentValues after) {
-            final GroupDelta entry = new GroupDelta();
-            entry.mBefore = null;
-            entry.mAfter = after;
-            return entry;
-        }
-
-        protected GroupDelta setUngrouped(boolean accountHasGroups) {
-            mUngrouped = true;
-            mAccountHasGroups = accountHasGroups;
-            return this;
-        }
-
-        @Override
-        public boolean beforeExists() {
-            return mBefore != null;
-        }
-
-        public boolean getShouldSync() {
-            return getAsInteger(mUngrouped ? Settings.SHOULD_SYNC : Groups.SHOULD_SYNC,
-                    DEFAULT_SHOULD_SYNC) != 0;
-        }
-
-        public boolean getVisible() {
-            return getAsInteger(mUngrouped ? Settings.UNGROUPED_VISIBLE : Groups.GROUP_VISIBLE,
-                    DEFAULT_VISIBLE) != 0;
-        }
-
-        public void putShouldSync(boolean shouldSync) {
-            put(mUngrouped ? Settings.SHOULD_SYNC : Groups.SHOULD_SYNC, shouldSync ? 1 : 0);
-        }
-
-        public void putVisible(boolean visible) {
-            put(mUngrouped ? Settings.UNGROUPED_VISIBLE : Groups.GROUP_VISIBLE, visible ? 1 : 0);
-        }
-
-        public CharSequence getTitle(Context context) {
-            if (mUngrouped) {
-                if (mAccountHasGroups) {
-                    return context.getText(R.string.display_ungrouped);
-                } else {
-                    return context.getText(R.string.display_all_contacts);
-                }
-            } else {
-                final Integer titleRes = getAsInteger(Groups.TITLE_RES);
-                if (titleRes != null) {
-                    final String packageName = getAsString(Groups.RES_PACKAGE);
-                    return context.getPackageManager().getText(packageName, titleRes, null);
-                } else {
-                    return getAsString(Groups.TITLE);
-                }
-            }
-        }
-
-        /**
-         * Build a possible {@link ContentProviderOperation} to persist any
-         * changes to the {@link Groups} or {@link Settings} row described by
-         * this {@link GroupDelta}.
-         */
-        public ContentProviderOperation buildDiff() {
-            if (isNoop()) {
-                return null;
-            } else if (isUpdate()) {
-                // When has changes and "before" exists, then "update"
-                final Builder builder = ContentProviderOperation
-                        .newUpdate(mUngrouped ? Settings.CONTENT_URI : addCallerIsSyncAdapterParameter(Groups.CONTENT_URI));
-                if (mUngrouped) {
-                    builder.withSelection(Settings.ACCOUNT_NAME + "=? AND " + Settings.ACCOUNT_TYPE
-                            + "=?", new String[] {
-                            this.getAsString(Settings.ACCOUNT_NAME),
-                            this.getAsString(Settings.ACCOUNT_TYPE)
-                    });
-                } else {
-                    builder.withSelection(Groups._ID + "=" + this.getId(), null);
-                }
-                builder.withValues(mAfter);
-                return builder.build();
-            } else if (isInsert() && mUngrouped) {
-                // Only allow inserts for Settings
-                mAfter.remove(mIdColumn);
-                final Builder builder = ContentProviderOperation.newInsert(Settings.CONTENT_URI);
-                builder.withValues(mAfter);
-                return builder.build();
-            } else {
-                throw new IllegalStateException("Unexpected delete or insert");
-            }
-        }
-    }
-
-    private static Uri addCallerIsSyncAdapterParameter(Uri uri) {
-        return uri.buildUpon()
-	        .appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
-	        .build();
-    }
-
-    /**
-     * {@link Comparator} to sort by {@link Groups#_ID}.
-     */
-    private static Comparator<GroupDelta> sIdComparator = new Comparator<GroupDelta>() {
-        public int compare(GroupDelta object1, GroupDelta object2) {
-            final Long id1 = object1.getId();
-            final Long id2 = object2.getId();
-            if (id1 == null && id2 == null) {
-                return 0;
-            } else if (id1 == null) {
-                return -1;
-            } else if (id2 == null) {
-                return 1;
-            } else if (id1 < id2) {
-                return -1;
-            } else if (id1 > id2) {
-                return 1;
-            } else {
-                return 0;
-            }
-        }
-    };
-
-    /**
-     * Set of all {@link AccountDisplay} entries, one for each source.
-     */
-    protected static class AccountSet extends ArrayList<AccountDisplay> {
-        public ArrayList<ContentProviderOperation> buildDiff() {
-            final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
-            for (AccountDisplay account : this) {
-                account.buildDiff(diff);
-            }
-            return diff;
-        }
-    }
-
-    /**
-     * {@link GroupDelta} details for a single {@link Account}, usually shown as
-     * children under a single expandable group.
-     */
-    protected static class AccountDisplay {
-        public String mName;
-        public String mType;
-
-        public GroupDelta mUngrouped;
-        public ArrayList<GroupDelta> mSyncedGroups = Lists.newArrayList();
-        public ArrayList<GroupDelta> mUnsyncedGroups = Lists.newArrayList();
-
-        /**
-         * Build an {@link AccountDisplay} covering all {@link Groups} under the
-         * given {@link Account}.
-         */
-        public AccountDisplay(ContentResolver resolver, String accountName, String accountType) {
-            mName = accountName;
-            mType = accountType;
-
-            final Uri groupsUri = Groups.CONTENT_URI.buildUpon()
-                    .appendQueryParameter(Groups.ACCOUNT_NAME, accountName)
-                    .appendQueryParameter(Groups.ACCOUNT_TYPE, accountType).build();
-            EntityIterator iterator = ContactsContract.Groups.newEntityIterator(resolver.query(
-                    groupsUri, null, null, null, null));
-            try {
-                boolean hasGroups = false;
-
-                // Create entries for each known group
-                while (iterator.hasNext()) {
-                    final ContentValues values = iterator.next().getEntityValues();
-                    final GroupDelta group = GroupDelta.fromBefore(values);
-                    addGroup(group);
-                    hasGroups = true;
-                }
-                // Create single entry handling ungrouped status
-                mUngrouped = GroupDelta.fromSettings(resolver, accountName, accountType, hasGroups);
-                addGroup(mUngrouped);
-            } finally {
-                iterator.close();
-            }
-        }
-
-        /**
-         * Add the given {@link GroupDelta} internally, filing based on its
-         * {@link GroupDelta#getShouldSync()} status.
-         */
-        private void addGroup(GroupDelta group) {
-            if (group.getShouldSync()) {
-                mSyncedGroups.add(group);
-            } else {
-                mUnsyncedGroups.add(group);
-            }
-        }
-
-        /**
-         * Set the {@link GroupDelta#putShouldSync(boolean)} value for all
-         * children {@link GroupDelta} rows.
-         */
-        public void setShouldSync(boolean shouldSync) {
-            final Iterator<GroupDelta> oppositeChildren = shouldSync ?
-                    mUnsyncedGroups.iterator() : mSyncedGroups.iterator();
-            while (oppositeChildren.hasNext()) {
-                final GroupDelta child = oppositeChildren.next();
-                setShouldSync(child, shouldSync, false);
-                oppositeChildren.remove();
-            }
-        }
-
-        public void setShouldSync(GroupDelta child, boolean shouldSync) {
-            setShouldSync(child, shouldSync, true);
-        }
-
-        /**
-         * Set {@link GroupDelta#putShouldSync(boolean)}, and file internally
-         * based on updated state.
-         */
-        public void setShouldSync(GroupDelta child, boolean shouldSync, boolean attemptRemove) {
-            child.putShouldSync(shouldSync);
-            if (shouldSync) {
-                if (attemptRemove) {
-                    mUnsyncedGroups.remove(child);
-                }
-                mSyncedGroups.add(child);
-                Collections.sort(mSyncedGroups, sIdComparator);
-            } else {
-                if (attemptRemove) {
-                    mSyncedGroups.remove(child);
-                }
-                mUnsyncedGroups.add(child);
-            }
-        }
-
-        /**
-         * Build set of {@link ContentProviderOperation} to persist any user
-         * changes to {@link GroupDelta} rows under this {@link Account}.
-         */
-        public void buildDiff(ArrayList<ContentProviderOperation> diff) {
-            for (GroupDelta group : mSyncedGroups) {
-                final ContentProviderOperation oper = group.buildDiff();
-                if (oper != null) diff.add(oper);
-            }
-            for (GroupDelta group : mUnsyncedGroups) {
-                final ContentProviderOperation oper = group.buildDiff();
-                if (oper != null) diff.add(oper);
-            }
-        }
-    }
-
-    /**
-     * {@link ExpandableListAdapter} that shows {@link GroupDelta} settings,
-     * grouped by {@link Account} source. Shows footer row when any groups are
-     * unsynced, as determined through {@link AccountDisplay#mUnsyncedGroups}.
-     */
-    protected static class DisplayAdapter extends BaseExpandableListAdapter {
-        private Context mContext;
-        private LayoutInflater mInflater;
-        private Sources mSources;
-        private AccountSet mAccounts;
-
-        private boolean mChildWithPhones = false;
-
-        public DisplayAdapter(Context context) {
-            mContext = context;
-            mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-            mSources = Sources.getInstance(context);
-        }
-
-        public void setAccounts(AccountSet accounts) {
-            mAccounts = accounts;
-            notifyDataSetChanged();
-        }
-
-        /**
-         * In group descriptions, show the number of contacts with phone
-         * numbers, in addition to the total contacts.
-         */
-        public void setChildDescripWithPhones(boolean withPhones) {
-            mChildWithPhones = withPhones;
-        }
-
-        /** {@inheritDoc} */
-        public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
-                View convertView, ViewGroup parent) {
-            if (convertView == null) {
-                convertView = mInflater.inflate(R.layout.display_child, parent, false);
-            }
-
-            final TextView text1 = (TextView)convertView.findViewById(android.R.id.text1);
-            final TextView text2 = (TextView)convertView.findViewById(android.R.id.text2);
-            final CheckBox checkbox = (CheckBox)convertView.findViewById(android.R.id.checkbox);
-
-            final AccountDisplay account = mAccounts.get(groupPosition);
-            final GroupDelta child = (GroupDelta)this.getChild(groupPosition, childPosition);
-            if (child != null) {
-                // Handle normal group, with title and checkbox
-                final boolean groupVisible = child.getVisible();
-                checkbox.setVisibility(View.VISIBLE);
-                checkbox.setChecked(groupVisible);
-
-                final CharSequence groupTitle = child.getTitle(mContext);
-                text1.setText(groupTitle);
-
-//              final int count = cursor.getInt(GroupsQuery.SUMMARY_COUNT);
-//              final int withPhones = cursor.getInt(GroupsQuery.SUMMARY_WITH_PHONES);
-
-//              final CharSequence descrip = mContext.getResources().getQuantityString(
-//                      mChildWithPhones ? R.plurals.groupDescripPhones : R.plurals.groupDescrip,
-//                      count, count, withPhones);
-
-//              text2.setText(descrip);
-                text2.setVisibility(View.GONE);
-            } else {
-                // When unknown child, this is "more" footer view
-                checkbox.setVisibility(View.GONE);
-                text1.setText(R.string.display_more_groups);
-                text2.setVisibility(View.GONE);
-            }
-
-            return convertView;
-        }
-
-        /** {@inheritDoc} */
-        public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
-                ViewGroup parent) {
-            if (convertView == null) {
-                convertView = mInflater.inflate(R.layout.display_group, parent, false);
-            }
-
-            final TextView text1 = (TextView)convertView.findViewById(android.R.id.text1);
-            final TextView text2 = (TextView)convertView.findViewById(android.R.id.text2);
-
-            final AccountDisplay account = (AccountDisplay)this.getGroup(groupPosition);
-
-            final ContactsSource source = mSources.getInflatedSource(account.mType,
-                    ContactsSource.LEVEL_SUMMARY);
-
-            text1.setText(account.mName);
-            text2.setText(source.getDisplayLabel(mContext));
-            text2.setVisibility(account.mName == null ? View.GONE : View.VISIBLE);
-
-            return convertView;
-        }
-
-        /** {@inheritDoc} */
-        public Object getChild(int groupPosition, int childPosition) {
-            final AccountDisplay account = mAccounts.get(groupPosition);
-            final boolean validChild = childPosition >= 0
-                    && childPosition < account.mSyncedGroups.size();
-            if (validChild) {
-                return account.mSyncedGroups.get(childPosition);
-            } else {
-                return null;
-            }
-        }
-
-        /** {@inheritDoc} */
-        public long getChildId(int groupPosition, int childPosition) {
-            final GroupDelta child = (GroupDelta)getChild(groupPosition, childPosition);
-            if (child != null) {
-                final Long childId = child.getId();
-                return childId != null ? childId : Long.MIN_VALUE;
-            } else {
-                return Long.MIN_VALUE;
-            }
-        }
-
-        /** {@inheritDoc} */
-        public int getChildrenCount(int groupPosition) {
-            // Count is any synced groups, plus possible footer
-            final AccountDisplay account = mAccounts.get(groupPosition);
-            final boolean anyHidden = account.mUnsyncedGroups.size() > 0;
-            return account.mSyncedGroups.size() + (anyHidden ? 1 : 0);
-        }
-
-        /** {@inheritDoc} */
-        public Object getGroup(int groupPosition) {
-            return mAccounts.get(groupPosition);
-        }
-
-        /** {@inheritDoc} */
-        public int getGroupCount() {
-            if (mAccounts == null) {
-                return 0;
-            }
-            return mAccounts.size();
-        }
-
-        /** {@inheritDoc} */
-        public long getGroupId(int groupPosition) {
-            return groupPosition;
-        }
-
-        /** {@inheritDoc} */
-        public boolean hasStableIds() {
-            return true;
-        }
-
-        /** {@inheritDoc} */
-        public boolean isChildSelectable(int groupPosition, int childPosition) {
-            return true;
-        }
-    }
-
-    /**
-     * Handle any clicks on header views added to our {@link #mAdapter}, which
-     * are usually the global modifier checkboxes.
-     */
-    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-        Log.d(TAG, "OnItemClick, position=" + position + ", id=" + id);
-        if (view == mHeaderPhones) {
-            mDisplayPhones.toggle();
-            return;
-        }
-        if (view == mDisplayOrderView) {
-            Log.d(TAG, "Showing Display Order dialog");
-            showDialog(DIALOG_DISPLAY_ORDER);
-            return;
-        }
-        if (view == mSortOrderView) {
-            Log.d(TAG, "Showing Sort Order dialog");
-            showDialog(DIALOG_SORT_ORDER);
-            return;
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void onClick(View view) {
-        switch (view.getId()) {
-            case R.id.btn_done: {
-                this.doSaveAction();
-                break;
-            }
-            case R.id.btn_discard: {
-                this.finish();
-                break;
-            }
-        }
-    }
-
-    /**
-     * Assign a specific value to {@link Prefs#DISPLAY_ONLY_PHONES}, refreshing
-     * the visible list as needed.
-     */
-    protected void setDisplayOnlyPhones(boolean displayOnlyPhones) {
-        mDisplayPhones.setChecked(displayOnlyPhones);
-
-        Editor editor = mPrefs.edit();
-        editor.putBoolean(Prefs.DISPLAY_ONLY_PHONES, displayOnlyPhones);
-        editor.apply();
-
-        mAdapter.setChildDescripWithPhones(displayOnlyPhones);
-        mAdapter.notifyDataSetChanged();
-    }
-
-    /**
-     * Handle any clicks on {@link ExpandableListAdapter} children, which
-     * usually mean toggling its visible state.
-     */
-    @Override
-    public boolean onChildClick(ExpandableListView parent, View view, int groupPosition,
-            int childPosition, long id) {
-        final CheckBox checkbox = (CheckBox)view.findViewById(android.R.id.checkbox);
-
-        final AccountDisplay account = (AccountDisplay)mAdapter.getGroup(groupPosition);
-        final GroupDelta child = (GroupDelta)mAdapter.getChild(groupPosition, childPosition);
-        if (child != null) {
-            checkbox.toggle();
-            child.putVisible(checkbox.isChecked());
-        } else {
-            // Open context menu for bringing back unsynced
-            this.openContextMenu(view);
-        }
-        return true;
-    }
-
-    // TODO: move these definitions to framework constants when we begin
-    // defining this mode through <sync-adapter> tags
-    private static final int SYNC_MODE_UNSUPPORTED = 0;
-    private static final int SYNC_MODE_UNGROUPED = 1;
-    private static final int SYNC_MODE_EVERYTHING = 2;
-
-    protected int getSyncMode(AccountDisplay account) {
-        // TODO: read sync mode through <sync-adapter> definition
-        if (GoogleSource.ACCOUNT_TYPE.equals(account.mType)) {
-            return SYNC_MODE_EVERYTHING;
-        } else {
-            return SYNC_MODE_UNSUPPORTED;
-        }
-    }
-
-    @Override
-    public void onCreateContextMenu(ContextMenu menu, View view,
-            ContextMenu.ContextMenuInfo menuInfo) {
-        super.onCreateContextMenu(menu, view, menuInfo);
-
-        // Bail if not working with expandable long-press, or if not child
-        if (!(menuInfo instanceof ExpandableListContextMenuInfo)) return;
-
-        final ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
-        final int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);
-        final int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition);
-
-        // Skip long-press on expandable parents
-        if (childPosition == -1) return;
-
-        final AccountDisplay account = (AccountDisplay)mAdapter.getGroup(groupPosition);
-        final GroupDelta child = (GroupDelta)mAdapter.getChild(groupPosition, childPosition);
-
-        // Ignore when selective syncing unsupported
-        final int syncMode = getSyncMode(account);
-        if (syncMode == SYNC_MODE_UNSUPPORTED) return;
-
-        if (child != null) {
-            showRemoveSync(menu, account, child, syncMode);
-        } else {
-            showAddSync(menu, account, syncMode);
-        }
-    }
-
-    protected void showRemoveSync(ContextMenu menu, final AccountDisplay account,
-            final GroupDelta child, final int syncMode) {
-        final CharSequence title = child.getTitle(this);
-
-        menu.setHeaderTitle(title);
-        menu.add(R.string.menu_sync_remove).setOnMenuItemClickListener(
-                new OnMenuItemClickListener() {
-                    public boolean onMenuItemClick(MenuItem item) {
-                        handleRemoveSync(account, child, syncMode, title);
-                        return true;
-                    }
-                });
-    }
-
-    protected void handleRemoveSync(final AccountDisplay account, final GroupDelta child,
-            final int syncMode, CharSequence title) {
-        final boolean shouldSyncUngrouped = account.mUngrouped.getShouldSync();
-        if (syncMode == SYNC_MODE_EVERYTHING && shouldSyncUngrouped
-                && !child.equals(account.mUngrouped)) {
-            // Warn before removing this group when it would cause ungrouped to stop syncing
-            final AlertDialog.Builder builder = new AlertDialog.Builder(this);
-            final CharSequence removeMessage = this.getString(
-                    R.string.display_warn_remove_ungrouped, title);
-            builder.setTitle(R.string.menu_sync_remove);
-            builder.setMessage(removeMessage);
-            builder.setNegativeButton(android.R.string.cancel, null);
-            builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
-                public void onClick(DialogInterface dialog, int which) {
-                    // Mark both this group and ungrouped to stop syncing
-                    account.setShouldSync(account.mUngrouped, false);
-                    account.setShouldSync(child, false);
-                    mAdapter.notifyDataSetChanged();
-                }
-            });
-            builder.show();
-        } else {
-            // Mark this group to not sync
-            account.setShouldSync(child, false);
-            mAdapter.notifyDataSetChanged();
-        }
-    }
-
-    protected void showAddSync(ContextMenu menu, final AccountDisplay account, final int syncMode) {
-        menu.setHeaderTitle(R.string.dialog_sync_add);
-
-        // Create item for each available, unsynced group
-        for (final GroupDelta child : account.mUnsyncedGroups) {
-            if (!child.getShouldSync()) {
-                final CharSequence title = child.getTitle(this);
-                menu.add(title).setOnMenuItemClickListener(new OnMenuItemClickListener() {
-                    public boolean onMenuItemClick(MenuItem item) {
-                        // Adding specific group for syncing
-                        if (child.mUngrouped && syncMode == SYNC_MODE_EVERYTHING) {
-                            account.setShouldSync(true);
-                        } else {
-                            account.setShouldSync(child, true);
-                        }
-                        mAdapter.notifyDataSetChanged();
-                        return true;
-                    }
-                });
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void onBackPressed() {
-        doSaveAction();
-    }
-
-    private void doSaveAction() {
-        mContactsPrefs.setSortOrder(mSortOrder);
-        mContactsPrefs.setDisplayOrder(mDisplayOrder);
-
-        if (mAdapter == null || mAdapter.mAccounts == null) {
-            return;
-        }
-        setDisplayOnlyPhones(mDisplayPhones.isChecked());
-        new UpdateTask(this).execute(mAdapter.mAccounts);
-    }
-
-    /**
-     * Background task that persists changes to {@link Groups#GROUP_VISIBLE},
-     * showing spinner dialog to user while updating.
-     */
-    public static class UpdateTask extends
-            WeakAsyncTask<AccountSet, Void, Void, Activity> {
-        private WeakReference<ProgressDialog> mProgress;
-
-        public UpdateTask(Activity target) {
-            super(target);
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        protected void onPreExecute(Activity target) {
-            final Context context = target;
-
-            mProgress = new WeakReference<ProgressDialog>(ProgressDialog.show(context, null,
-                    context.getText(R.string.savingDisplayGroups)));
-
-            // Before starting this task, start an empty service to protect our
-            // process from being reclaimed by the system.
-            context.startService(new Intent(context, EmptyService.class));
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        protected Void doInBackground(Activity target, AccountSet... params) {
-            final Context context = target;
-            final ContentValues values = new ContentValues();
-            final ContentResolver resolver = context.getContentResolver();
-
-            try {
-                // Build changes and persist in transaction
-                final AccountSet set = params[0];
-                final ArrayList<ContentProviderOperation> diff = set.buildDiff();
-                resolver.applyBatch(ContactsContract.AUTHORITY, diff);
-            } catch (RemoteException e) {
-                Log.e(TAG, "Problem saving display groups", e);
-            } catch (OperationApplicationException e) {
-                Log.e(TAG, "Problem saving display groups", e);
-            }
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        protected void onPostExecute(Activity target, Void result) {
-            final Context context = target;
-
-            final ProgressDialog dialog = mProgress.get();
-            if (dialog != null) {
-                try {
-                    dialog.dismiss();
-                } catch (Exception e) {
-                    Log.e(TAG, "Error dismissing progress dialog", e);
-                }
-            }
-
-            target.finish();
-
-            // Stop the service that was protecting us
-            context.stopService(new Intent(context, EmptyService.class));
-        }
-    }
-
-    @Override
-    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
-            boolean globalSearch) {
-        if (globalSearch) {
-            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
-        } else {
-            ContactsSearchManager.startSearch(this, initialQuery);
-        }
-    }
-}
diff --git a/src/com/android/contacts/ui/EditContactActivity.java b/src/com/android/contacts/ui/EditContactActivity.java
deleted file mode 100644
index e37aade..0000000
--- a/src/com/android/contacts/ui/EditContactActivity.java
+++ /dev/null
@@ -1,1434 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui;
-
-import com.android.contacts.ContactsListActivity;
-import com.android.contacts.ContactsSearchManager;
-import com.android.contacts.ContactsUtils;
-import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Editor;
-import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.EntityModifier;
-import com.android.contacts.model.EntitySet;
-import com.android.contacts.model.GoogleSource;
-import com.android.contacts.model.Sources;
-import com.android.contacts.model.ContactsSource.EditType;
-import com.android.contacts.model.Editor.EditorListener;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.ui.widget.BaseContactEditorView;
-import com.android.contacts.ui.widget.PhotoEditorView;
-import com.android.contacts.util.EmptyService;
-import com.android.contacts.util.WeakAsyncTask;
-import com.google.android.collect.Lists;
-
-import android.accounts.Account;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ProgressDialog;
-import android.content.ActivityNotFoundException;
-import android.content.ContentProviderOperation;
-import android.content.ContentProviderResult;
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Entity;
-import android.content.Intent;
-import android.content.OperationApplicationException;
-import android.content.ContentProviderOperation.Builder;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.media.MediaScannerConnection;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.RemoteException;
-import android.provider.ContactsContract;
-import android.provider.MediaStore;
-import android.provider.ContactsContract.AggregationExceptions;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.Contacts.Data;
-import android.util.Log;
-import android.view.ContextThemeWrapper;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.LinearLayout;
-import android.widget.ListAdapter;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import java.io.File;
-import java.lang.ref.WeakReference;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-
-/**
- * Activity for editing or inserting a contact.
- */
-public final class EditContactActivity extends Activity
-        implements View.OnClickListener, Comparator<EntityDelta> {
-
-    private static final String TAG = "EditContactActivity";
-
-    /** The launch code when picking a photo and the raw data is returned */
-    private static final int PHOTO_PICKED_WITH_DATA = 3021;
-
-    /** The launch code when a contact to join with is returned */
-    private static final int REQUEST_JOIN_CONTACT = 3022;
-
-    /** The launch code when taking a picture */
-    private static final int CAMERA_WITH_DATA = 3023;
-
-    private static final String KEY_EDIT_STATE = "state";
-    private static final String KEY_RAW_CONTACT_ID_REQUESTING_PHOTO = "photorequester";
-    private static final String KEY_VIEW_ID_GENERATOR = "viewidgenerator";
-    private static final String KEY_CURRENT_PHOTO_FILE = "currentphotofile";
-    private static final String KEY_QUERY_SELECTION = "queryselection";
-    private static final String KEY_CONTACT_ID_FOR_JOIN = "contactidforjoin";
-
-    /** The result code when view activity should close after edit returns */
-    public static final int RESULT_CLOSE_VIEW_ACTIVITY = 777;
-
-    public static final int SAVE_MODE_DEFAULT = 0;
-    public static final int SAVE_MODE_SPLIT = 1;
-    public static final int SAVE_MODE_JOIN = 2;
-
-    private long mRawContactIdRequestingPhoto = -1;
-
-    private static final int DIALOG_CONFIRM_DELETE = 1;
-    private static final int DIALOG_CONFIRM_READONLY_DELETE = 2;
-    private static final int DIALOG_CONFIRM_MULTIPLE_DELETE = 3;
-    private static final int DIALOG_CONFIRM_READONLY_HIDE = 4;
-
-    private static final int ICON_SIZE = 96;
-
-    private static final File PHOTO_DIR = new File(
-            Environment.getExternalStorageDirectory() + "/DCIM/Camera");
-
-    private File mCurrentPhotoFile;
-
-    String mQuerySelection;
-
-    private long mContactIdForJoin;
-
-    private static final int STATUS_LOADING = 0;
-    private static final int STATUS_EDITING = 1;
-    private static final int STATUS_SAVING = 2;
-
-    private int mStatus;
-    private boolean mActivityActive;  // true after onCreate/onResume, false at onPause
-
-    EntitySet mState;
-
-    /** The linear layout holding the ContactEditorViews */
-    LinearLayout mContent;
-
-    private ArrayList<Dialog> mManagedDialogs = Lists.newArrayList();
-
-    private ViewIdGenerator mViewIdGenerator;
-
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        final Intent intent = getIntent();
-        final String action = intent.getAction();
-
-        setContentView(R.layout.act_edit);
-
-        // Build editor and listen for photo requests
-        mContent = (LinearLayout) findViewById(R.id.editors);
-
-        findViewById(R.id.btn_done).setOnClickListener(this);
-        findViewById(R.id.btn_discard).setOnClickListener(this);
-
-        // Handle initial actions only when existing state missing
-        final boolean hasIncomingState = icicle != null && icicle.containsKey(KEY_EDIT_STATE);
-
-        mActivityActive = true;
-
-        if (Intent.ACTION_EDIT.equals(action) && !hasIncomingState) {
-            setTitle(R.string.editContact_title_edit);
-            mStatus = STATUS_LOADING;
-
-            // Read initial state from database
-            new QueryEntitiesTask(this).execute(intent);
-        } else if (Intent.ACTION_INSERT.equals(action) && !hasIncomingState) {
-            setTitle(R.string.editContact_title_insert);
-            mStatus = STATUS_EDITING;
-            // Trigger dialog to pick account type
-            doAddAction();
-        }
-
-        if (icicle == null) {
-            // If icicle is non-null, onRestoreInstanceState() will restore the generator.
-            mViewIdGenerator = new ViewIdGenerator();
-        }
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        mActivityActive = true;
-    }
-
-    @Override
-    protected void onPause() {
-        super.onResume();
-        mActivityActive = false;
-    }
-
-    private static class QueryEntitiesTask extends
-            WeakAsyncTask<Intent, Void, EntitySet, EditContactActivity> {
-
-        private String mSelection;
-
-        public QueryEntitiesTask(EditContactActivity target) {
-            super(target);
-        }
-
-        @Override
-        protected EntitySet doInBackground(EditContactActivity target, Intent... params) {
-            final Intent intent = params[0];
-
-            final ContentResolver resolver = target.getContentResolver();
-
-            // Handle both legacy and new authorities
-            final Uri data = intent.getData();
-            final String authority = data.getAuthority();
-            final String mimeType = intent.resolveType(resolver);
-
-            mSelection = "0";
-            if (ContactsContract.AUTHORITY.equals(authority)) {
-                if (Contacts.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                    // Handle selected aggregate
-                    final long contactId = ContentUris.parseId(data);
-                    mSelection = RawContacts.CONTACT_ID + "=" + contactId;
-                } else if (RawContacts.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                    final long rawContactId = ContentUris.parseId(data);
-                    final long contactId = ContactsUtils.queryForContactId(resolver, rawContactId);
-                    mSelection = RawContacts.CONTACT_ID + "=" + contactId;
-                }
-            } else if (android.provider.Contacts.AUTHORITY.equals(authority)) {
-                final long rawContactId = ContentUris.parseId(data);
-                mSelection = Data.RAW_CONTACT_ID + "=" + rawContactId;
-            }
-
-            return EntitySet.fromQuery(target.getContentResolver(), mSelection, null, null);
-        }
-
-        @Override
-        protected void onPostExecute(EditContactActivity target, EntitySet entitySet) {
-            target.mQuerySelection = mSelection;
-
-            // Load edit details in background
-            final Context context = target;
-            final Sources sources = Sources.getInstance(context);
-
-            // Handle any incoming values that should be inserted
-            final Bundle extras = target.getIntent().getExtras();
-            final boolean hasExtras = extras != null && extras.size() > 0;
-            final boolean hasState = entitySet.size() > 0;
-            if (hasExtras && hasState) {
-                // Find source defining the first RawContact found
-                final EntityDelta state = entitySet.get(0);
-                final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
-                final ContactsSource source = sources.getInflatedSource(accountType,
-                        ContactsSource.LEVEL_CONSTRAINTS);
-                EntityModifier.parseExtras(context, source, state, extras);
-            }
-
-            target.mState = entitySet;
-
-            // Bind UI to new background state
-            target.bindEditors();
-        }
-    }
-
-    @Override
-    protected void onSaveInstanceState(Bundle outState) {
-        if (hasValidState()) {
-            // Store entities with modifications
-            outState.putParcelable(KEY_EDIT_STATE, mState);
-        }
-
-        outState.putLong(KEY_RAW_CONTACT_ID_REQUESTING_PHOTO, mRawContactIdRequestingPhoto);
-        outState.putParcelable(KEY_VIEW_ID_GENERATOR, mViewIdGenerator);
-        if (mCurrentPhotoFile != null) {
-            outState.putString(KEY_CURRENT_PHOTO_FILE, mCurrentPhotoFile.toString());
-        }
-        outState.putString(KEY_QUERY_SELECTION, mQuerySelection);
-        outState.putLong(KEY_CONTACT_ID_FOR_JOIN, mContactIdForJoin);
-        super.onSaveInstanceState(outState);
-    }
-
-    @Override
-    protected void onRestoreInstanceState(Bundle savedInstanceState) {
-        // Read modifications from instance
-        mState = savedInstanceState.<EntitySet> getParcelable(KEY_EDIT_STATE);
-        mRawContactIdRequestingPhoto = savedInstanceState.getLong(
-                KEY_RAW_CONTACT_ID_REQUESTING_PHOTO);
-        mViewIdGenerator = savedInstanceState.getParcelable(KEY_VIEW_ID_GENERATOR);
-        String fileName = savedInstanceState.getString(KEY_CURRENT_PHOTO_FILE);
-        if (fileName != null) {
-            mCurrentPhotoFile = new File(fileName);
-        }
-        mQuerySelection = savedInstanceState.getString(KEY_QUERY_SELECTION);
-        mContactIdForJoin = savedInstanceState.getLong(KEY_CONTACT_ID_FOR_JOIN);
-
-        bindEditors();
-
-        super.onRestoreInstanceState(savedInstanceState);
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-
-        for (Dialog dialog : mManagedDialogs) {
-            dismissDialog(dialog);
-        }
-    }
-
-    @Override
-    protected Dialog onCreateDialog(int id, Bundle bundle) {
-        switch (id) {
-            case DIALOG_CONFIRM_DELETE:
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.deleteConfirmation)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .setPositiveButton(android.R.string.ok, new DeleteClickListener())
-                        .setCancelable(false)
-                        .create();
-            case DIALOG_CONFIRM_READONLY_DELETE:
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.readOnlyContactDeleteConfirmation)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .setPositiveButton(android.R.string.ok, new DeleteClickListener())
-                        .setCancelable(false)
-                        .create();
-            case DIALOG_CONFIRM_MULTIPLE_DELETE:
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.multipleContactDeleteConfirmation)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .setPositiveButton(android.R.string.ok, new DeleteClickListener())
-                        .setCancelable(false)
-                        .create();
-            case DIALOG_CONFIRM_READONLY_HIDE:
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.deleteConfirmation_title)
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(R.string.readOnlyContactWarning)
-                        .setPositiveButton(android.R.string.ok, new DeleteClickListener())
-                        .setCancelable(false)
-                        .create();
-        }
-        return null;
-    }
-
-    /**
-     * Start managing this {@link Dialog} along with the {@link Activity}.
-     */
-    private void startManagingDialog(Dialog dialog) {
-        synchronized (mManagedDialogs) {
-            mManagedDialogs.add(dialog);
-        }
-    }
-
-    /**
-     * Show this {@link Dialog} and manage with the {@link Activity}.
-     */
-    void showAndManageDialog(Dialog dialog) {
-        startManagingDialog(dialog);
-        dialog.show();
-    }
-
-    /**
-     * Dismiss the given {@link Dialog}.
-     */
-    static void dismissDialog(Dialog dialog) {
-        try {
-            // Only dismiss when valid reference and still showing
-            if (dialog != null && dialog.isShowing()) {
-                dialog.dismiss();
-            }
-        } catch (Exception e) {
-            Log.w(TAG, "Ignoring exception while dismissing dialog: " + e.toString());
-        }
-    }
-
-    /**
-     * Check if our internal {@link #mState} is valid, usually checked before
-     * performing user actions.
-     */
-    protected boolean hasValidState() {
-        return mStatus == STATUS_EDITING && mState != null && mState.size() > 0;
-    }
-
-    /**
-     * Rebuild the editors to match our underlying {@link #mState} object, usually
-     * called once we've parsed {@link Entity} data or have inserted a new
-     * {@link RawContacts}.
-     */
-    protected void bindEditors() {
-        if (mState == null) {
-            return;
-        }
-
-        final LayoutInflater inflater = (LayoutInflater) getSystemService(
-                Context.LAYOUT_INFLATER_SERVICE);
-        final Sources sources = Sources.getInstance(this);
-
-        // Sort the editors
-        Collections.sort(mState, this);
-
-        // Remove any existing editors and rebuild any visible
-        mContent.removeAllViews();
-        int size = mState.size();
-        for (int i = 0; i < size; i++) {
-            // TODO ensure proper ordering of entities in the list
-            EntityDelta entity = mState.get(i);
-            final ValuesDelta values = entity.getValues();
-            if (!values.isVisible()) continue;
-
-            final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
-            final ContactsSource source = sources.getInflatedSource(accountType,
-                    ContactsSource.LEVEL_CONSTRAINTS);
-            final long rawContactId = values.getAsLong(RawContacts._ID);
-
-            BaseContactEditorView editor;
-            if (!source.readOnly) {
-                editor = (BaseContactEditorView) inflater.inflate(R.layout.item_contact_editor,
-                        mContent, false);
-            } else {
-                editor = (BaseContactEditorView) inflater.inflate(
-                        R.layout.item_read_only_contact_editor, mContent, false);
-            }
-            PhotoEditorView photoEditor = editor.getPhotoEditor();
-            photoEditor.setEditorListener(new PhotoListener(rawContactId, source.readOnly,
-                    photoEditor));
-
-            mContent.addView(editor);
-            editor.setState(entity, source, mViewIdGenerator);
-        }
-
-        // Show editor now that we've loaded state
-        mContent.setVisibility(View.VISIBLE);
-        mStatus = STATUS_EDITING;
-    }
-
-    /**
-     * Class that listens to requests coming from photo editors
-     */
-    private class PhotoListener implements EditorListener, DialogInterface.OnClickListener {
-        private long mRawContactId;
-        private boolean mReadOnly;
-        private PhotoEditorView mEditor;
-
-        public PhotoListener(long rawContactId, boolean readOnly, PhotoEditorView editor) {
-            mRawContactId = rawContactId;
-            mReadOnly = readOnly;
-            mEditor = editor;
-        }
-
-        public void onDeleted(Editor editor) {
-            // Do nothing
-        }
-
-        public void onRequest(int request) {
-            if (!hasValidState()) return;
-
-            if (request == EditorListener.REQUEST_PICK_PHOTO) {
-                if (mEditor.hasSetPhoto()) {
-                    // There is an existing photo, offer to remove, replace, or promoto to primary
-                    createPhotoDialog().show();
-                } else if (!mReadOnly) {
-                    // No photo set and not read-only, try to set the photo
-                    doPickPhotoAction(mRawContactId);
-                }
-            }
-        }
-
-        /**
-         * Prepare dialog for picking a new {@link EditType} or entering a
-         * custom label. This dialog is limited to the valid types as determined
-         * by {@link EntityModifier}.
-         */
-        public Dialog createPhotoDialog() {
-            Context context = EditContactActivity.this;
-
-            // Wrap our context to inflate list items using correct theme
-            final Context dialogContext = new ContextThemeWrapper(context,
-                    android.R.style.Theme_Light);
-
-            String[] choices;
-            if (mReadOnly) {
-                choices = new String[1];
-                choices[0] = getString(R.string.use_photo_as_primary);
-            } else {
-                choices = new String[3];
-                choices[0] = getString(R.string.use_photo_as_primary);
-                choices[1] = getString(R.string.removePicture);
-                choices[2] = getString(R.string.changePicture);
-            }
-            final ListAdapter adapter = new ArrayAdapter<String>(dialogContext,
-                    android.R.layout.simple_list_item_1, choices);
-
-            final AlertDialog.Builder builder = new AlertDialog.Builder(dialogContext);
-            builder.setTitle(R.string.attachToContact);
-            builder.setSingleChoiceItems(adapter, -1, this);
-            return builder.create();
-        }
-
-        /**
-         * Called when something in the dialog is clicked
-         */
-        public void onClick(DialogInterface dialog, int which) {
-            dialog.dismiss();
-
-            switch (which) {
-                case 0:
-                    // Set the photo as super primary
-                    mEditor.setSuperPrimary(true);
-
-                    // And set all other photos as not super primary
-                    int count = mContent.getChildCount();
-                    for (int i = 0; i < count; i++) {
-                        View childView = mContent.getChildAt(i);
-                        if (childView instanceof BaseContactEditorView) {
-                            BaseContactEditorView editor = (BaseContactEditorView) childView;
-                            PhotoEditorView photoEditor = editor.getPhotoEditor();
-                            if (!photoEditor.equals(mEditor)) {
-                                photoEditor.setSuperPrimary(false);
-                            }
-                        }
-                    }
-                    break;
-
-                case 1:
-                    // Remove the photo
-                    mEditor.setPhotoBitmap(null);
-                    break;
-
-                case 2:
-                    // Pick a new photo for the contact
-                    doPickPhotoAction(mRawContactId);
-                    break;
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void onClick(View view) {
-        switch (view.getId()) {
-            case R.id.btn_done:
-                doSaveAction(SAVE_MODE_DEFAULT);
-                break;
-            case R.id.btn_discard:
-                doRevertAction();
-                break;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void onBackPressed() {
-        doSaveAction(SAVE_MODE_DEFAULT);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        // Ignore failed requests
-        if (resultCode != RESULT_OK) return;
-
-        switch (requestCode) {
-            case PHOTO_PICKED_WITH_DATA: {
-                BaseContactEditorView requestingEditor = null;
-                for (int i = 0; i < mContent.getChildCount(); i++) {
-                    View childView = mContent.getChildAt(i);
-                    if (childView instanceof BaseContactEditorView) {
-                        BaseContactEditorView editor = (BaseContactEditorView) childView;
-                        if (editor.getRawContactId() == mRawContactIdRequestingPhoto) {
-                            requestingEditor = editor;
-                            break;
-                        }
-                    }
-                }
-
-                if (requestingEditor != null) {
-                    final Bitmap photo = data.getParcelableExtra("data");
-                    requestingEditor.setPhotoBitmap(photo);
-                    mRawContactIdRequestingPhoto = -1;
-                } else {
-                    // The contact that requested the photo is no longer present.
-                    // TODO: Show error message
-                }
-
-                break;
-            }
-
-            case CAMERA_WITH_DATA: {
-                doCropPhoto(mCurrentPhotoFile);
-                break;
-            }
-
-            case REQUEST_JOIN_CONTACT: {
-                if (resultCode == RESULT_OK && data != null) {
-                    final long contactId = ContentUris.parseId(data.getData());
-                    joinAggregate(contactId);
-                }
-            }
-        }
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        super.onCreateOptionsMenu(menu);
-
-        MenuInflater inflater = getMenuInflater();
-        inflater.inflate(R.menu.edit, menu);
-
-
-        return true;
-    }
-
-    @Override
-    public boolean onPrepareOptionsMenu(Menu menu) {
-        menu.findItem(R.id.menu_split).setVisible(mState != null && mState.size() > 1);
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case R.id.menu_done:
-                return doSaveAction(SAVE_MODE_DEFAULT);
-            case R.id.menu_discard:
-                return doRevertAction();
-            case R.id.menu_add:
-                return doAddAction();
-            case R.id.menu_delete:
-                return doDeleteAction();
-            case R.id.menu_split:
-                return doSplitContactAction();
-            case R.id.menu_join:
-                return doJoinContactAction();
-        }
-        return false;
-    }
-
-    /**
-     * Background task for persisting edited contact data, using the changes
-     * defined by a set of {@link EntityDelta}. This task starts
-     * {@link EmptyService} to make sure the background thread can finish
-     * persisting in cases where the system wants to reclaim our process.
-     */
-    public static class PersistTask extends
-            WeakAsyncTask<EntitySet, Void, Integer, EditContactActivity> {
-        private static final int PERSIST_TRIES = 3;
-
-        private static final int RESULT_UNCHANGED = 0;
-        private static final int RESULT_SUCCESS = 1;
-        private static final int RESULT_FAILURE = 2;
-
-        private WeakReference<ProgressDialog> mProgress;
-
-        private int mSaveMode;
-        private Uri mContactLookupUri = null;
-
-        public PersistTask(EditContactActivity target, int saveMode) {
-            super(target);
-            mSaveMode = saveMode;
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        protected void onPreExecute(EditContactActivity target) {
-            mProgress = new WeakReference<ProgressDialog>(ProgressDialog.show(target, null,
-                    target.getText(R.string.savingContact)));
-
-            // Before starting this task, start an empty service to protect our
-            // process from being reclaimed by the system.
-            final Context context = target;
-            context.startService(new Intent(context, EmptyService.class));
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        protected Integer doInBackground(EditContactActivity target, EntitySet... params) {
-            final Context context = target;
-            final ContentResolver resolver = context.getContentResolver();
-
-            EntitySet state = params[0];
-
-            // Trim any empty fields, and RawContacts, before persisting
-            final Sources sources = Sources.getInstance(context);
-            EntityModifier.trimEmpty(state, sources);
-
-            // Attempt to persist changes
-            int tries = 0;
-            Integer result = RESULT_FAILURE;
-            while (tries++ < PERSIST_TRIES) {
-                try {
-                    // Build operations and try applying
-                    final ArrayList<ContentProviderOperation> diff = state.buildDiff();
-                    ContentProviderResult[] results = null;
-                    if (!diff.isEmpty()) {
-                         results = resolver.applyBatch(ContactsContract.AUTHORITY, diff);
-                    }
-
-                    final long rawContactId = getRawContactId(state, diff, results);
-                    if (rawContactId != -1) {
-                        final Uri rawContactUri = ContentUris.withAppendedId(
-                                RawContacts.CONTENT_URI, rawContactId);
-
-                        // convert the raw contact URI to a contact URI
-                        mContactLookupUri = RawContacts.getContactLookupUri(resolver,
-                                rawContactUri);
-                    }
-                    result = (diff.size() > 0) ? RESULT_SUCCESS : RESULT_UNCHANGED;
-                    break;
-
-                } catch (RemoteException e) {
-                    // Something went wrong, bail without success
-                    Log.e(TAG, "Problem persisting user edits", e);
-                    break;
-
-                } catch (OperationApplicationException e) {
-                    // Version consistency failed, re-parent change and try again
-                    Log.w(TAG, "Version consistency failed, re-parenting: " + e.toString());
-                    final EntitySet newState = EntitySet.fromQuery(resolver,
-                            target.mQuerySelection, null, null);
-                    state = EntitySet.mergeAfter(newState, state);
-                }
-            }
-
-            return result;
-        }
-
-        private long getRawContactId(EntitySet state,
-                final ArrayList<ContentProviderOperation> diff,
-                final ContentProviderResult[] results) {
-            long rawContactId = state.findRawContactId();
-            if (rawContactId != -1) {
-                return rawContactId;
-            }
-
-            // we gotta do some searching for the id
-            final int diffSize = diff.size();
-            for (int i = 0; i < diffSize; i++) {
-                ContentProviderOperation operation = diff.get(i);
-                if (operation.getType() == ContentProviderOperation.TYPE_INSERT
-                        && operation.getUri().getEncodedPath().contains(
-                                RawContacts.CONTENT_URI.getEncodedPath())) {
-                    return ContentUris.parseId(results[i].uri);
-                }
-            }
-            return -1;
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        protected void onPostExecute(EditContactActivity target, Integer result) {
-            final Context context = target;
-            final ProgressDialog progress = mProgress.get();
-
-            if (result == RESULT_SUCCESS && mSaveMode != SAVE_MODE_JOIN) {
-                Toast.makeText(context, R.string.contactSavedToast, Toast.LENGTH_SHORT).show();
-            } else if (result == RESULT_FAILURE) {
-                Toast.makeText(context, R.string.contactSavedErrorToast, Toast.LENGTH_LONG).show();
-            }
-
-            dismissDialog(progress);
-
-            // Stop the service that was protecting us
-            context.stopService(new Intent(context, EmptyService.class));
-
-            target.onSaveCompleted(result != RESULT_FAILURE, mSaveMode, mContactLookupUri);
-        }
-    }
-
-    /**
-     * Saves or creates the contact based on the mode, and if successful
-     * finishes the activity.
-     */
-    boolean doSaveAction(int saveMode) {
-        if (!hasValidState()) {
-            return false;
-        }
-
-        mStatus = STATUS_SAVING;
-        final PersistTask task = new PersistTask(this, saveMode);
-        task.execute(mState);
-
-        return true;
-    }
-
-    private class DeleteClickListener implements DialogInterface.OnClickListener {
-
-        public void onClick(DialogInterface dialog, int which) {
-            Sources sources = Sources.getInstance(EditContactActivity.this);
-            // Mark all raw contacts for deletion
-            for (EntityDelta delta : mState) {
-                delta.markDeleted();
-            }
-            // Save the deletes
-            doSaveAction(SAVE_MODE_DEFAULT);
-            finish();
-        }
-    }
-
-    private void onSaveCompleted(boolean success, int saveMode, Uri contactLookupUri) {
-        switch (saveMode) {
-            case SAVE_MODE_DEFAULT:
-                if (success && contactLookupUri != null) {
-                    final Intent resultIntent = new Intent();
-
-                    final Uri requestData = getIntent().getData();
-                    final String requestAuthority = requestData == null ? null : requestData
-                            .getAuthority();
-
-                    if (android.provider.Contacts.AUTHORITY.equals(requestAuthority)) {
-                        // Build legacy Uri when requested by caller
-                        final long contactId = ContentUris.parseId(Contacts.lookupContact(
-                                getContentResolver(), contactLookupUri));
-                        final Uri legacyUri = ContentUris.withAppendedId(
-                                android.provider.Contacts.People.CONTENT_URI, contactId);
-                        resultIntent.setData(legacyUri);
-                    } else {
-                        // Otherwise pass back a lookup-style Uri
-                        resultIntent.setData(contactLookupUri);
-                    }
-
-                    setResult(RESULT_OK, resultIntent);
-                } else {
-                    setResult(RESULT_CANCELED, null);
-                }
-                finish();
-                break;
-
-            case SAVE_MODE_SPLIT:
-                if (success) {
-                    Intent intent = new Intent();
-                    intent.setData(contactLookupUri);
-                    setResult(RESULT_CLOSE_VIEW_ACTIVITY, intent);
-                }
-                finish();
-                break;
-
-            case SAVE_MODE_JOIN:
-                mStatus = STATUS_EDITING;
-                if (success) {
-                    showJoinAggregateActivity(contactLookupUri);
-                }
-                break;
-        }
-    }
-
-    /**
-     * Shows a list of aggregates that can be joined into the currently viewed aggregate.
-     *
-     * @param contactLookupUri the fresh URI for the currently edited contact (after saving it)
-     */
-    public void showJoinAggregateActivity(Uri contactLookupUri) {
-        if (contactLookupUri == null) {
-            return;
-        }
-
-        mContactIdForJoin = ContentUris.parseId(contactLookupUri);
-        Intent intent = new Intent(ContactsListActivity.JOIN_AGGREGATE);
-        intent.putExtra(ContactsListActivity.EXTRA_AGGREGATE_ID, mContactIdForJoin);
-        startActivityForResult(intent, REQUEST_JOIN_CONTACT);
-    }
-
-    private interface JoinContactQuery {
-        String[] PROJECTION = {
-                RawContacts._ID,
-                RawContacts.CONTACT_ID,
-                RawContacts.NAME_VERIFIED,
-        };
-
-        String SELECTION = RawContacts.CONTACT_ID + "=? OR " + RawContacts.CONTACT_ID + "=?";
-
-        int _ID = 0;
-        int CONTACT_ID = 1;
-        int NAME_VERIFIED = 2;
-    }
-
-    /**
-     * Performs aggregation with the contact selected by the user from suggestions or A-Z list.
-     */
-    private void joinAggregate(final long contactId) {
-        ContentResolver resolver = getContentResolver();
-
-        // Load raw contact IDs for all raw contacts involved - currently edited and selected
-        // in the join UIs
-        Cursor c = resolver.query(RawContacts.CONTENT_URI,
-                JoinContactQuery.PROJECTION,
-                JoinContactQuery.SELECTION,
-                new String[]{String.valueOf(contactId), String.valueOf(mContactIdForJoin)}, null);
-
-        long rawContactIds[];
-        long verifiedNameRawContactId = -1;
-        try {
-            rawContactIds = new long[c.getCount()];
-            for (int i = 0; i < rawContactIds.length; i++) {
-                c.moveToNext();
-                long rawContactId = c.getLong(JoinContactQuery._ID);
-                rawContactIds[i] = rawContactId;
-                if (c.getLong(JoinContactQuery.CONTACT_ID) == mContactIdForJoin) {
-                    if (verifiedNameRawContactId == -1
-                            || c.getInt(JoinContactQuery.NAME_VERIFIED) != 0) {
-                        verifiedNameRawContactId = rawContactId;
-                    }
-                }
-            }
-        } finally {
-            c.close();
-        }
-
-        // For each pair of raw contacts, insert an aggregation exception
-        ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
-        for (int i = 0; i < rawContactIds.length; i++) {
-            for (int j = 0; j < rawContactIds.length; j++) {
-                if (i != j) {
-                    buildJoinContactDiff(operations, rawContactIds[i], rawContactIds[j]);
-                }
-            }
-        }
-
-        // Mark the original contact as "name verified" to make sure that the contact
-        // display name does not change as a result of the join
-        Builder builder = ContentProviderOperation.newUpdate(
-                    ContentUris.withAppendedId(RawContacts.CONTENT_URI, verifiedNameRawContactId));
-        builder.withValue(RawContacts.NAME_VERIFIED, 1);
-        operations.add(builder.build());
-
-        // Apply all aggregation exceptions as one batch
-        try {
-            getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations);
-
-            // We can use any of the constituent raw contacts to refresh the UI - why not the first
-            Intent intent = new Intent();
-            intent.setData(ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactIds[0]));
-
-            // Reload the new state from database
-            new QueryEntitiesTask(this).execute(intent);
-
-            Toast.makeText(this, R.string.contactsJoinedMessage, Toast.LENGTH_LONG).show();
-        } catch (RemoteException e) {
-            Log.e(TAG, "Failed to apply aggregation exception batch", e);
-            Toast.makeText(this, R.string.contactSavedErrorToast, Toast.LENGTH_LONG).show();
-        } catch (OperationApplicationException e) {
-            Log.e(TAG, "Failed to apply aggregation exception batch", e);
-            Toast.makeText(this, R.string.contactSavedErrorToast, Toast.LENGTH_LONG).show();
-        }
-    }
-
-    /**
-     * Construct a {@link AggregationExceptions#TYPE_KEEP_TOGETHER} ContentProviderOperation.
-     */
-    private void buildJoinContactDiff(ArrayList<ContentProviderOperation> operations,
-            long rawContactId1, long rawContactId2) {
-        Builder builder =
-                ContentProviderOperation.newUpdate(AggregationExceptions.CONTENT_URI);
-        builder.withValue(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_TOGETHER);
-        builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, rawContactId1);
-        builder.withValue(AggregationExceptions.RAW_CONTACT_ID2, rawContactId2);
-        operations.add(builder.build());
-    }
-
-    /**
-     * Revert any changes the user has made, and finish the activity.
-     */
-    private boolean doRevertAction() {
-        finish();
-        return true;
-    }
-
-    /**
-     * Create a new {@link RawContacts} which will exist as another
-     * {@link EntityDelta} under the currently edited {@link Contacts}.
-     */
-    private boolean doAddAction() {
-        if (mStatus != STATUS_EDITING) {
-            return false;
-        }
-
-        // Adding is okay when missing state
-        new AddContactTask(this).execute();
-        return true;
-    }
-
-    /**
-     * Delete the entire contact currently being edited, which usually asks for
-     * user confirmation before continuing.
-     */
-    private boolean doDeleteAction() {
-        if (!hasValidState())
-            return false;
-        int readOnlySourcesCnt = 0;
-        int writableSourcesCnt = 0;
-        Sources sources = Sources.getInstance(EditContactActivity.this);
-        for (EntityDelta delta : mState) {
-            final String accountType = delta.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
-            final ContactsSource contactsSource = sources.getInflatedSource(accountType,
-                    ContactsSource.LEVEL_CONSTRAINTS);
-            if (contactsSource != null && contactsSource.readOnly) {
-                readOnlySourcesCnt += 1;
-            } else {
-                writableSourcesCnt += 1;
-            }
-        }
-
-        if (readOnlySourcesCnt > 0 && writableSourcesCnt > 0) {
-            showDialog(DIALOG_CONFIRM_READONLY_DELETE);
-        } else if (readOnlySourcesCnt > 0 && writableSourcesCnt == 0) {
-            showDialog(DIALOG_CONFIRM_READONLY_HIDE);
-        } else if (readOnlySourcesCnt == 0 && writableSourcesCnt > 1) {
-            showDialog(DIALOG_CONFIRM_MULTIPLE_DELETE);
-        } else {
-            showDialog(DIALOG_CONFIRM_DELETE);
-        }
-        return true;
-    }
-
-    /**
-     * Pick a specific photo to be added under the currently selected tab.
-     */
-    boolean doPickPhotoAction(long rawContactId) {
-        if (!hasValidState()) return false;
-
-        mRawContactIdRequestingPhoto = rawContactId;
-
-        showAndManageDialog(createPickPhotoDialog());
-
-        return true;
-    }
-
-    /**
-     * Creates a dialog offering two options: take a photo or pick a photo from the gallery.
-     */
-    private Dialog createPickPhotoDialog() {
-        Context context = EditContactActivity.this;
-
-        // Wrap our context to inflate list items using correct theme
-        final Context dialogContext = new ContextThemeWrapper(context,
-                android.R.style.Theme_Light);
-
-        String[] choices;
-        choices = new String[2];
-        choices[0] = getString(R.string.take_photo);
-        choices[1] = getString(R.string.pick_photo);
-        final ListAdapter adapter = new ArrayAdapter<String>(dialogContext,
-                android.R.layout.simple_list_item_1, choices);
-
-        final AlertDialog.Builder builder = new AlertDialog.Builder(dialogContext);
-        builder.setTitle(R.string.attachToContact);
-        builder.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                dialog.dismiss();
-                switch(which) {
-                    case 0:
-                        doTakePhoto();
-                        break;
-                    case 1:
-                        doPickPhotoFromGallery();
-                        break;
-                }
-            }
-        });
-        return builder.create();
-    }
-
-    /**
-     * Create a file name for the icon photo using current time.
-     */
-    private String getPhotoFileName() {
-        Date date = new Date(System.currentTimeMillis());
-        SimpleDateFormat dateFormat = new SimpleDateFormat("'IMG'_yyyyMMdd_HHmmss");
-        return dateFormat.format(date) + ".jpg";
-    }
-
-    /**
-     * Launches Camera to take a picture and store it in a file.
-     */
-    protected void doTakePhoto() {
-        try {
-            // Launch camera to take photo for selected contact
-            PHOTO_DIR.mkdirs();
-            mCurrentPhotoFile = new File(PHOTO_DIR, getPhotoFileName());
-            final Intent intent = getTakePickIntent(mCurrentPhotoFile);
-            startActivityForResult(intent, CAMERA_WITH_DATA);
-        } catch (ActivityNotFoundException e) {
-            Toast.makeText(this, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
-        }
-    }
-
-    /**
-     * Constructs an intent for capturing a photo and storing it in a temporary file.
-     */
-    public static Intent getTakePickIntent(File f) {
-        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);
-        intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
-        return intent;
-    }
-
-    /**
-     * Sends a newly acquired photo to Gallery for cropping
-     */
-    protected void doCropPhoto(File f) {
-        try {
-
-            // Add the image to the media store
-            MediaScannerConnection.scanFile(
-                    this,
-                    new String[] { f.getAbsolutePath() },
-                    new String[] { null },
-                    null);
-
-            // Launch gallery to crop the photo
-            final Intent intent = getCropImageIntent(Uri.fromFile(f));
-            startActivityForResult(intent, PHOTO_PICKED_WITH_DATA);
-        } catch (Exception e) {
-            Log.e(TAG, "Cannot crop image", e);
-            Toast.makeText(this, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
-        }
-    }
-
-    /**
-     * Constructs an intent for image cropping.
-     */
-    public static Intent getCropImageIntent(Uri photoUri) {
-        Intent intent = new Intent("com.android.camera.action.CROP");
-        intent.setDataAndType(photoUri, "image/*");
-        intent.putExtra("crop", "true");
-        intent.putExtra("aspectX", 1);
-        intent.putExtra("aspectY", 1);
-        intent.putExtra("outputX", ICON_SIZE);
-        intent.putExtra("outputY", ICON_SIZE);
-        intent.putExtra("return-data", true);
-        return intent;
-    }
-
-    /**
-     * Launches Gallery to pick a photo.
-     */
-    protected void doPickPhotoFromGallery() {
-        try {
-            // Launch picker to choose photo for selected contact
-            final Intent intent = getPhotoPickIntent();
-            startActivityForResult(intent, PHOTO_PICKED_WITH_DATA);
-        } catch (ActivityNotFoundException e) {
-            Toast.makeText(this, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
-        }
-    }
-
-    /**
-     * Constructs an intent for picking a photo from Gallery, cropping it and returning the bitmap.
-     */
-    public static Intent getPhotoPickIntent() {
-        Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
-        intent.setType("image/*");
-        intent.putExtra("crop", "true");
-        intent.putExtra("aspectX", 1);
-        intent.putExtra("aspectY", 1);
-        intent.putExtra("outputX", ICON_SIZE);
-        intent.putExtra("outputY", ICON_SIZE);
-        intent.putExtra("return-data", true);
-        return intent;
-    }
-
-    /** {@inheritDoc} */
-    public void onDeleted(Editor editor) {
-        // Ignore any editor deletes
-    }
-
-    private boolean doSplitContactAction() {
-        if (!hasValidState()) return false;
-
-        showAndManageDialog(createSplitDialog());
-        return true;
-    }
-
-    private Dialog createSplitDialog() {
-        final AlertDialog.Builder builder = new AlertDialog.Builder(this);
-        builder.setTitle(R.string.splitConfirmation_title);
-        builder.setIcon(android.R.drawable.ic_dialog_alert);
-        builder.setMessage(R.string.splitConfirmation);
-        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                // Split the contacts
-                mState.splitRawContacts();
-                doSaveAction(SAVE_MODE_SPLIT);
-            }
-        });
-        builder.setNegativeButton(android.R.string.cancel, null);
-        builder.setCancelable(false);
-        return builder.create();
-    }
-
-    private boolean doJoinContactAction() {
-        return doSaveAction(SAVE_MODE_JOIN);
-    }
-
-    /**
-     * Build dialog that handles adding a new {@link RawContacts} after the user
-     * picks a specific {@link ContactsSource}.
-     */
-    private static class AddContactTask extends
-            WeakAsyncTask<Void, Void, ArrayList<Account>, EditContactActivity> {
-
-        public AddContactTask(EditContactActivity target) {
-            super(target);
-        }
-
-        @Override
-        protected ArrayList<Account> doInBackground(final EditContactActivity target,
-                Void... params) {
-            return Sources.getInstance(target).getAccounts(true);
-        }
-
-        @Override
-        protected void onPostExecute(final EditContactActivity target, ArrayList<Account> accounts) {
-            if (!target.mActivityActive) {
-                // A monkey or very fast user.
-                return;
-            }
-            target.selectAccountAndCreateContact(accounts);
-        }
-    }
-
-    public void selectAccountAndCreateContact(ArrayList<Account> accounts) {
-        // No Accounts available.  Create a phone-local contact.
-        if (accounts.isEmpty()) {
-            createContact(null);
-            return;  // Don't show a dialog.
-        }
-
-        // In the common case of a single account being writable, auto-select
-        // it without showing a dialog.
-        if (accounts.size() == 1) {
-            createContact(accounts.get(0));
-            return;  // Don't show a dialog.
-        }
-
-        // Wrap our context to inflate list items using correct theme
-        final Context dialogContext = new ContextThemeWrapper(this, android.R.style.Theme_Light);
-        final LayoutInflater dialogInflater =
-            (LayoutInflater)dialogContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
-        final Sources sources = Sources.getInstance(this);
-
-        final ArrayAdapter<Account> accountAdapter = new ArrayAdapter<Account>(this,
-                android.R.layout.simple_list_item_2, accounts) {
-            @Override
-            public View getView(int position, View convertView, ViewGroup parent) {
-                if (convertView == null) {
-                    convertView = dialogInflater.inflate(android.R.layout.simple_list_item_2,
-                            parent, false);
-                }
-
-                // TODO: show icon along with title
-                final TextView text1 = (TextView)convertView.findViewById(android.R.id.text1);
-                final TextView text2 = (TextView)convertView.findViewById(android.R.id.text2);
-
-                final Account account = this.getItem(position);
-                final ContactsSource source = sources.getInflatedSource(account.type,
-                        ContactsSource.LEVEL_SUMMARY);
-
-                text1.setText(account.name);
-                text2.setText(source.getDisplayLabel(EditContactActivity.this));
-
-                return convertView;
-            }
-        };
-
-        final DialogInterface.OnClickListener clickListener =
-                new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                dialog.dismiss();
-
-                // Create new contact based on selected source
-                final Account account = accountAdapter.getItem(which);
-                createContact(account);
-            }
-        };
-
-        final DialogInterface.OnCancelListener cancelListener =
-                new DialogInterface.OnCancelListener() {
-            public void onCancel(DialogInterface dialog) {
-                // If nothing remains, close activity
-                if (!hasValidState()) {
-                    finish();
-                }
-            }
-        };
-
-        final AlertDialog.Builder builder = new AlertDialog.Builder(this);
-        builder.setTitle(R.string.dialog_new_contact_account);
-        builder.setSingleChoiceItems(accountAdapter, 0, clickListener);
-        builder.setOnCancelListener(cancelListener);
-        showAndManageDialog(builder.create());
-    }
-
-    /**
-     * @param account may be null to signal a device-local contact should
-     *     be created.
-     */
-    private void createContact(Account account) {
-        final Sources sources = Sources.getInstance(this);
-        final ContentValues values = new ContentValues();
-        if (account != null) {
-            values.put(RawContacts.ACCOUNT_NAME, account.name);
-            values.put(RawContacts.ACCOUNT_TYPE, account.type);
-        } else {
-            values.putNull(RawContacts.ACCOUNT_NAME);
-            values.putNull(RawContacts.ACCOUNT_TYPE);
-        }
-
-        // Parse any values from incoming intent
-        EntityDelta insert = new EntityDelta(ValuesDelta.fromAfter(values));
-        final ContactsSource source = sources.getInflatedSource(
-            account != null ? account.type : null,
-            ContactsSource.LEVEL_CONSTRAINTS);
-        final Bundle extras = getIntent().getExtras();
-        EntityModifier.parseExtras(this, source, insert, extras);
-
-        // Ensure we have some default fields
-        EntityModifier.ensureKindExists(insert, source, Phone.CONTENT_ITEM_TYPE);
-        EntityModifier.ensureKindExists(insert, source, Email.CONTENT_ITEM_TYPE);
-
-        // Create "My Contacts" membership for Google contacts
-        // TODO: move this off into "templates" for each given source
-        if (GoogleSource.ACCOUNT_TYPE.equals(source.accountType)) {
-            GoogleSource.attemptMyContactsMembership(insert, this);
-        }
-
-        if (mState == null) {
-            // Create state if none exists yet
-            mState = EntitySet.fromSingle(insert);
-        } else {
-            // Add contact onto end of existing state
-            mState.add(insert);
-        }
-
-        bindEditors();
-    }
-
-    /**
-     * Compare EntityDeltas for sorting the stack of editors.
-     */
-    public int compare(EntityDelta one, EntityDelta two) {
-        // Check direct equality
-        if (one.equals(two)) {
-            return 0;
-        }
-
-        final Sources sources = Sources.getInstance(this);
-        String accountType = one.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
-        final ContactsSource oneSource = sources.getInflatedSource(accountType,
-                ContactsSource.LEVEL_SUMMARY);
-        accountType = two.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
-        final ContactsSource twoSource = sources.getInflatedSource(accountType,
-                ContactsSource.LEVEL_SUMMARY);
-
-        // Check read-only
-        if (oneSource.readOnly && !twoSource.readOnly) {
-            return 1;
-        } else if (twoSource.readOnly && !oneSource.readOnly) {
-            return -1;
-        }
-
-        // Check account type
-        boolean skipAccountTypeCheck = false;
-        boolean oneIsGoogle = oneSource instanceof GoogleSource;
-        boolean twoIsGoogle = twoSource instanceof GoogleSource;
-        if (oneIsGoogle && !twoIsGoogle) {
-            return -1;
-        } else if (twoIsGoogle && !oneIsGoogle) {
-            return 1;
-        } else if (oneIsGoogle && twoIsGoogle){
-            skipAccountTypeCheck = true;
-        }
-
-        int value;
-        if (!skipAccountTypeCheck) {
-            if (oneSource.accountType == null) {
-                return 1;
-            }
-            value = oneSource.accountType.compareTo(twoSource.accountType);
-            if (value != 0) {
-                return value;
-            }
-        }
-
-        // Check account name
-        ValuesDelta oneValues = one.getValues();
-        String oneAccount = oneValues.getAsString(RawContacts.ACCOUNT_NAME);
-        if (oneAccount == null) oneAccount = "";
-        ValuesDelta twoValues = two.getValues();
-        String twoAccount = twoValues.getAsString(RawContacts.ACCOUNT_NAME);
-        if (twoAccount == null) twoAccount = "";
-        value = oneAccount.compareTo(twoAccount);
-        if (value != 0) {
-            return value;
-        }
-
-        // Both are in the same account, fall back to contact ID
-        Long oneId = oneValues.getAsLong(RawContacts._ID);
-        Long twoId = twoValues.getAsLong(RawContacts._ID);
-        if (oneId == null) {
-            return -1;
-        } else if (twoId == null) {
-            return 1;
-        }
-
-        return (int)(oneId - twoId);
-    }
-
-    @Override
-    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
-            boolean globalSearch) {
-        if (globalSearch) {
-            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
-        } else {
-            ContactsSearchManager.startSearch(this, initialQuery);
-        }
-    }
-}
diff --git a/src/com/android/contacts/ui/QuickContactActivity.java b/src/com/android/contacts/ui/QuickContactActivity.java
deleted file mode 100644
index ec8f44d..0000000
--- a/src/com/android/contacts/ui/QuickContactActivity.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui;
-
-import com.android.contacts.StickyTabs;
-
-import android.app.Activity;
-import android.content.ContentUris;
-import android.content.Intent;
-import android.graphics.Rect;
-import android.net.Uri;
-import android.os.Bundle;
-import android.provider.ContactsContract.QuickContact;
-import android.provider.ContactsContract.RawContacts;
-import android.util.Log;
-
-/**
- * Stub translucent activity that just shows {@link QuickContactWindow} floating
- * above the caller. This temporary hack should eventually be replaced with
- * direct framework support.
- */
-public final class QuickContactActivity extends Activity implements
-        QuickContactWindow.OnDismissListener {
-    private static final String TAG = "QuickContactActivity";
-
-    static final boolean LOGV = false;
-    static final boolean FORCE_CREATE = false;
-
-    private QuickContactWindow mQuickContact;
-
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        if (LOGV) Log.d(TAG, "onCreate");
-
-        this.onNewIntent(getIntent());
-    }
-
-    @Override
-    public void onNewIntent(Intent intent) {
-        super.onNewIntent(intent);
-        if (LOGV) Log.d(TAG, "onNewIntent");
-
-        if (QuickContactWindow.TRACE_LAUNCH) {
-            android.os.Debug.startMethodTracing(QuickContactWindow.TRACE_TAG);
-        }
-
-        if (mQuickContact == null || FORCE_CREATE) {
-            if (LOGV) Log.d(TAG, "Preparing window");
-            mQuickContact = new QuickContactWindow(this, this);
-        }
-        mQuickContact.setLastSelectedContactsAppTab(StickyTabs.getTab(intent));
-
-        // Use our local window token for now
-        Uri lookupUri = intent.getData();
-        // Check to see whether it comes from the old version.
-        if (android.provider.Contacts.AUTHORITY.equals(lookupUri.getAuthority())) {
-            final long rawContactId = ContentUris.parseId(lookupUri);
-            lookupUri = RawContacts.getContactLookupUri(getContentResolver(),
-                    ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId));
-        }
-        final Bundle extras = intent.getExtras();
-
-        // Read requested parameters for displaying
-        final Rect target = intent.getSourceBounds();
-        final int mode = extras.getInt(QuickContact.EXTRA_MODE, QuickContact.MODE_MEDIUM);
-        final String[] excludeMimes = extras.getStringArray(QuickContact.EXTRA_EXCLUDE_MIMES);
-
-        mQuickContact.show(lookupUri, target, mode, excludeMimes);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void onBackPressed() {
-        if (LOGV) Log.w(TAG, "Unexpected back captured by stub activity");
-        finish();
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        if (LOGV) Log.d(TAG, "onPause");
-
-        // Dismiss any dialog when pausing
-        mQuickContact.dismiss();
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        if (LOGV) Log.d(TAG, "onDestroy");
-    }
-
-    /** {@inheritDoc} */
-    public void onDismiss(QuickContactWindow dialog) {
-        if (LOGV) Log.d(TAG, "onDismiss");
-
-        if (isTaskRoot() && !FORCE_CREATE) {
-            // Instead of stopping, simply push this to the back of the stack.
-            // This is only done when running at the top of the stack;
-            // otherwise, we have been launched by someone else so need to
-            // allow the user to go back to the caller.
-            moveTaskToBack(false);
-        } else {
-            finish();
-        }
-    }
-}
diff --git a/src/com/android/contacts/ui/QuickContactWindow.java b/src/com/android/contacts/ui/QuickContactWindow.java
deleted file mode 100644
index 889749e..0000000
--- a/src/com/android/contacts/ui/QuickContactWindow.java
+++ /dev/null
@@ -1,1719 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui;
-
-import com.android.contacts.Collapser;
-import com.android.contacts.ContactPresenceIconUtil;
-import com.android.contacts.ContactsUtils;
-import com.android.contacts.R;
-import com.android.contacts.StickyTabs;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Sources;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.ui.widget.CheckableImageView;
-import com.android.contacts.util.Constants;
-import com.android.contacts.util.DataStatus;
-import com.android.contacts.util.NotifyingAsyncQueryHandler;
-import com.android.internal.policy.PolicyManager;
-import com.google.android.collect.Sets;
-
-import android.content.ActivityNotFoundException;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.res.Resources;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.QuickContact;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.StatusUpdates;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.Im;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.CommonDataKinds.Photo;
-import android.provider.ContactsContract.CommonDataKinds.SipAddress;
-import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
-import android.provider.ContactsContract.CommonDataKinds.Website;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.ContextThemeWrapper;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewStub;
-import android.view.Window;
-import android.view.WindowManager;
-import android.view.ViewTreeObserver.OnGlobalLayoutListener;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.view.animation.Interpolator;
-import android.widget.AbsListView;
-import android.widget.AdapterView;
-import android.widget.BaseAdapter;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
-import android.widget.HorizontalScrollView;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import java.lang.ref.SoftReference;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Window that shows QuickContact dialog for a specific {@link Contacts#_ID}.
- */
-public class QuickContactWindow implements Window.Callback,
-        NotifyingAsyncQueryHandler.AsyncQueryListener, View.OnClickListener,
-        AbsListView.OnItemClickListener, CompoundButton.OnCheckedChangeListener, KeyEvent.Callback,
-        OnGlobalLayoutListener {
-    private static final String TAG = "QuickContactWindow";
-
-    /**
-     * Interface used to allow the person showing a {@link QuickContactWindow} to
-     * know when the window has been dismissed.
-     */
-    public interface OnDismissListener {
-        public void onDismiss(QuickContactWindow dialog);
-    }
-
-    /**
-     * Custom layout the sole purpose of which is to intercept the BACK key and
-     * close QC even when the soft keyboard is open.
-     */
-    public static class RootLayout extends RelativeLayout {
-
-        QuickContactWindow mQuickContactWindow;
-
-        public RootLayout(Context context, AttributeSet attrs) {
-            super(context, attrs);
-        }
-
-        /**
-         * Intercepts the BACK key event and dismisses QuickContact window.
-         */
-        @Override
-        public boolean dispatchKeyEventPreIme(KeyEvent event) {
-            if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
-                mQuickContactWindow.onBackPressed();
-                return true;
-            } else {
-                return super.dispatchKeyEventPreIme(event);
-            }
-        }
-    }
-
-    private final Context mContext;
-    private final LayoutInflater mInflater;
-    private final WindowManager mWindowManager;
-    private Window mWindow;
-    private View mDecor;
-    private final Rect mRect = new Rect();
-
-    private boolean mDismissed = false;
-    private boolean mQuerying = false;
-    private boolean mShowing = false;
-
-    private NotifyingAsyncQueryHandler mHandler;
-    private OnDismissListener mDismissListener;
-    private ResolveCache mResolveCache;
-
-    /** Last selected tab of the Dialtacs-Activity. This is -1 if not called out of contacts app */
-    private int mLastSelectedContactsAppTab;
-
-    private Uri mLookupUri;
-    private Rect mAnchor;
-
-    private int mShadowHoriz;
-    private int mShadowVert;
-    private int mShadowTouch;
-
-    private int mScreenWidth;
-    private int mScreenHeight;
-    private int mRequestedY;
-
-    private boolean mHasValidSocial = false;
-    private boolean mMakePrimary = false;
-
-    private ImageView mArrowUp;
-    private ImageView mArrowDown;
-
-    private int mMode;
-    private RootLayout mRootView;
-    private View mHeader;
-    private HorizontalScrollView mTrackScroll;
-    private ViewGroup mTrack;
-    private Animation mTrackAnim;
-
-    private View mFooter;
-    private View mFooterDisambig;
-    private ListView mResolveList;
-    private CheckableImageView mLastAction;
-    private CheckBox mSetPrimaryCheckBox;
-
-    private int mWindowRecycled = 0;
-    private int mActionRecycled = 0;
-
-    /**
-     * Set of {@link Action} that are associated with the aggregate currently
-     * displayed by this dialog, represented as a map from {@link String}
-     * MIME-type to {@link ActionList}.
-     */
-    private ActionMap mActions = new ActionMap();
-
-    /**
-     * Pool of unused {@link CheckableImageView} that have previously been
-     * inflated, and are ready to be recycled through {@link #obtainView()}.
-     */
-    private LinkedList<View> mActionPool = new LinkedList<View>();
-
-    private String[] mExcludeMimes;
-
-    /**
-     * {@link #PRECEDING_MIMETYPES} and {@link #FOLLOWING_MIMETYPES} are used to sort MIME-types.
-     *
-     * <p>The MIME-types in {@link #PRECEDING_MIMETYPES} appear in the front of the dialog,
-     * in the order in the array.
-     *
-     * <p>The ones in {@link #FOLLOWING_MIMETYPES} appear in the end of the dialog, in alphabetical
-     * order.
-     *
-     * <p>The rest go between them, in the order in the array.
-     */
-    private static final String[] PRECEDING_MIMETYPES = new String[] {
-            Phone.CONTENT_ITEM_TYPE,
-            SipAddress.CONTENT_ITEM_TYPE,
-            Contacts.CONTENT_ITEM_TYPE,
-            Constants.MIME_SMS_ADDRESS,
-            Email.CONTENT_ITEM_TYPE,
-    };
-
-    /**
-     * See {@link #PRECEDING_MIMETYPES}.
-     */
-    private static final String[] FOLLOWING_MIMETYPES = new String[] {
-            StructuredPostal.CONTENT_ITEM_TYPE,
-            Website.CONTENT_ITEM_TYPE,
-    };
-
-    /**
-     * Specific list {@link ApplicationInfo#packageName} of apps that are
-     * prefered <strong>only</strong> for the purposes of default icons when
-     * multiple {@link ResolveInfo} are found to match. This only happens when
-     * the user has not selected a default app yet, and they will still be
-     * presented with the system disambiguation dialog.
-     */
-    private static final HashSet<String> sPreferResolve = Sets.newHashSet(
-            "com.android.email",
-            "com.android.calendar",
-            "com.android.contacts",
-            "com.android.mms",
-            "com.android.phone",
-            "com.android.browser");
-
-    private static final int TOKEN_DATA = 1;
-
-    static final boolean LOGD = false;
-
-    static final boolean TRACE_LAUNCH = false;
-    static final String TRACE_TAG = "quickcontact";
-
-    /**
-     * Prepare a dialog to show in the given {@link Context}.
-     */
-    public QuickContactWindow(Context context) {
-        mContext = new ContextThemeWrapper(context, R.style.QuickContact);
-        mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
-
-        mWindow = PolicyManager.makeNewWindow(mContext);
-        mWindow.setCallback(this);
-        mWindow.setWindowManager(mWindowManager, null, null);
-        mWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED);
-
-        mWindow.setContentView(R.layout.quickcontact);
-
-        mRootView = (RootLayout)mWindow.findViewById(R.id.root);
-        mRootView.mQuickContactWindow = this;
-        mRootView.setFocusable(true);
-        mRootView.setFocusableInTouchMode(true);
-        mRootView.setDescendantFocusability(RootLayout.FOCUS_AFTER_DESCENDANTS);
-
-        mArrowUp = (ImageView)mWindow.findViewById(R.id.arrow_up);
-        mArrowDown = (ImageView)mWindow.findViewById(R.id.arrow_down);
-
-        mResolveCache = new ResolveCache(mContext);
-
-        final Resources res = mContext.getResources();
-        mShadowHoriz = res.getDimensionPixelSize(R.dimen.quickcontact_shadow_horiz);
-        mShadowVert = res.getDimensionPixelSize(R.dimen.quickcontact_shadow_vert);
-        mShadowTouch = res.getDimensionPixelSize(R.dimen.quickcontact_shadow_touch);
-
-        mScreenWidth = mWindowManager.getDefaultDisplay().getWidth();
-        mScreenHeight = mWindowManager.getDefaultDisplay().getHeight();
-
-        mTrack = (ViewGroup)mWindow.findViewById(R.id.quickcontact);
-        mTrackScroll = (HorizontalScrollView)mWindow.findViewById(R.id.scroll);
-
-        mFooter = mWindow.findViewById(R.id.footer);
-        mFooterDisambig = mWindow.findViewById(R.id.footer_disambig);
-        mResolveList = (ListView)mWindow.findViewById(android.R.id.list);
-        mSetPrimaryCheckBox = (CheckBox)mWindow.findViewById(android.R.id.checkbox);
-
-        mSetPrimaryCheckBox.setOnCheckedChangeListener(this);
-
-        // Prepare track entrance animation
-        mTrackAnim = AnimationUtils.loadAnimation(mContext, R.anim.quickcontact);
-        mTrackAnim.setInterpolator(new Interpolator() {
-            public float getInterpolation(float t) {
-                // Pushes past the target area, then snaps back into place.
-                // Equation for graphing: 1.2-((x*1.6)-1.1)^2
-                final float inner = (t * 1.55f) - 1.1f;
-                return 1.2f - inner * inner;
-            }
-        });
-
-        mHandler = new NotifyingAsyncQueryHandler(mContext, this);
-    }
-
-    /**
-     * Prepare a dialog to show in the given {@link Context}, and notify the
-     * given {@link OnDismissListener} each time this dialog is dismissed.
-     */
-    public QuickContactWindow(Context context, OnDismissListener dismissListener) {
-        this(context);
-        mDismissListener = dismissListener;
-    }
-
-    public void setLastSelectedContactsAppTab(int value) {
-        mLastSelectedContactsAppTab = value;
-    }
-
-    private View getHeaderView(int mode) {
-        View header = null;
-        switch (mode) {
-            case QuickContact.MODE_SMALL:
-                header = mWindow.findViewById(R.id.header_small);
-                break;
-            case QuickContact.MODE_MEDIUM:
-                header = mWindow.findViewById(R.id.header_medium);
-                break;
-            case QuickContact.MODE_LARGE:
-                header = mWindow.findViewById(R.id.header_large);
-                break;
-        }
-
-        if (header instanceof ViewStub) {
-            // Inflate actual header if we picked a stub
-            final ViewStub stub = (ViewStub)header;
-            header = stub.inflate();
-        } else if (header != null) {
-            header.setVisibility(View.VISIBLE);
-        }
-
-        return header;
-    }
-
-    /**
-     * Start showing a dialog for the given {@link Contacts#_ID} pointing
-     * towards the given location.
-     */
-    public synchronized void show(Uri lookupUri, Rect anchor, int mode, String[] excludeMimes) {
-        if (mQuerying || mShowing) {
-            Log.w(TAG, "dismissing before showing");
-            dismissInternal();
-        }
-
-        if (TRACE_LAUNCH && !android.os.Debug.isMethodTracingActive()) {
-            android.os.Debug.startMethodTracing(TRACE_TAG);
-        }
-
-        // Validate incoming parameters
-        final boolean validMode = (mode == QuickContact.MODE_SMALL
-                || mode == QuickContact.MODE_MEDIUM || mode == QuickContact.MODE_LARGE);
-        if (!validMode) {
-            throw new IllegalArgumentException("Invalid mode, expecting MODE_LARGE, "
-                    + "MODE_MEDIUM, or MODE_SMALL");
-        }
-
-        if (anchor == null) {
-            throw new IllegalArgumentException("Missing anchor rectangle");
-        }
-
-        // Prepare header view for requested mode
-        mLookupUri = lookupUri;
-        mAnchor = new Rect(anchor);
-        mMode = mode;
-        mExcludeMimes = excludeMimes;
-
-        mHeader = getHeaderView(mode);
-
-        setHeaderText(R.id.name, R.string.quickcontact_missing_name);
-
-        setHeaderText(R.id.status, null);
-        setHeaderText(R.id.timestamp, null);
-
-        setHeaderImage(R.id.presence, null);
-
-        resetTrack();
-
-        // We need to have a focused view inside the QuickContact window so
-        // that the BACK key event can be intercepted
-        mRootView.requestFocus();
-
-        mHasValidSocial = false;
-        mDismissed = false;
-        mQuerying = true;
-
-        // Start background query for data, but only select photo rows when they
-        // directly match the super-primary PHOTO_ID.
-        final Uri dataUri = getDataUri(lookupUri);
-        mHandler.cancelOperation(TOKEN_DATA);
-
-        // Only request photo data when required by mode
-        if (mMode == QuickContact.MODE_LARGE) {
-            // Select photos, but only super-primary
-            mHandler.startQuery(TOKEN_DATA, lookupUri, dataUri, DataQuery.PROJECTION, Data.MIMETYPE
-                    + "!=? OR (" + Data.MIMETYPE + "=? AND " + Data._ID + "=" + Contacts.PHOTO_ID
-                    + ")", new String[] { Photo.CONTENT_ITEM_TYPE, Photo.CONTENT_ITEM_TYPE }, null);
-        } else {
-            // Exclude all photos from cursor
-            mHandler.startQuery(TOKEN_DATA, lookupUri, dataUri, DataQuery.PROJECTION, Data.MIMETYPE
-                    + "!=?", new String[] { Photo.CONTENT_ITEM_TYPE }, null);
-        }
-    }
-
-    /**
-     * Build a {@link Uri} into the {@link Data} table for the requested
-     * {@link Contacts#CONTENT_LOOKUP_URI} style {@link Uri}.
-     */
-    private Uri getDataUri(Uri lookupUri) {
-        // TODO: Formalize method of extracting LOOKUP_KEY
-        final List<String> path = lookupUri.getPathSegments();
-        final boolean validLookup = path.size() >= 3 && "lookup".equals(path.get(1));
-        if (!validLookup) {
-            // We only accept valid lookup-style Uris
-            throw new IllegalArgumentException("Expecting lookup-style Uri");
-        } else if (path.size() == 3) {
-            // No direct _ID provided, so force a lookup
-            lookupUri = Contacts.lookupContact(mContext.getContentResolver(), lookupUri);
-        }
-
-        final long contactId = ContentUris.parseId(lookupUri);
-        return Uri.withAppendedPath(ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId),
-                Contacts.Data.CONTENT_DIRECTORY);
-    }
-
-    /**
-     * Show the correct call-out arrow based on a {@link R.id} reference.
-     */
-    private void showArrow(int whichArrow, int requestedX) {
-        final View showArrow = (whichArrow == R.id.arrow_up) ? mArrowUp : mArrowDown;
-        final View hideArrow = (whichArrow == R.id.arrow_up) ? mArrowDown : mArrowUp;
-
-        final int arrowWidth = mArrowUp.getMeasuredWidth();
-
-        showArrow.setVisibility(View.VISIBLE);
-        ViewGroup.MarginLayoutParams param = (ViewGroup.MarginLayoutParams)showArrow.getLayoutParams();
-        param.leftMargin = requestedX - arrowWidth / 2;
-
-        hideArrow.setVisibility(View.INVISIBLE);
-    }
-
-    /**
-     * Actual internal method to show this dialog. Called only by
-     * {@link #considerShowing()} when all data requirements have been met.
-     */
-    private void showInternal() {
-        mDecor = mWindow.getDecorView();
-        mDecor.getViewTreeObserver().addOnGlobalLayoutListener(this);
-        WindowManager.LayoutParams l = mWindow.getAttributes();
-
-        l.width = mScreenWidth + mShadowHoriz + mShadowHoriz;
-        l.height = WindowManager.LayoutParams.WRAP_CONTENT;
-
-        // Force layout measuring pass so we have baseline numbers
-        mDecor.measure(l.width, l.height);
-        final int blockHeight = mDecor.getMeasuredHeight();
-
-        l.gravity = Gravity.TOP | Gravity.LEFT;
-        l.x = -mShadowHoriz;
-
-        if (mAnchor.top > blockHeight) {
-            // Show downwards callout when enough room, aligning bottom block
-            // edge with top of anchor area, and adjusting to inset arrow.
-            showArrow(R.id.arrow_down, mAnchor.centerX());
-            l.y = mAnchor.top - blockHeight + mShadowVert;
-            l.windowAnimations = R.style.QuickContactAboveAnimation;
-
-        } else {
-            // Otherwise show upwards callout, aligning block top with bottom of
-            // anchor area, and adjusting to inset arrow.
-            showArrow(R.id.arrow_up, mAnchor.centerX());
-            l.y = mAnchor.bottom - mShadowVert;
-            l.windowAnimations = R.style.QuickContactBelowAnimation;
-
-        }
-
-        l.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
-                | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
-
-        mRequestedY = l.y;
-        mWindowManager.addView(mDecor, l);
-        mShowing = true;
-        mQuerying = false;
-        mDismissed = false;
-
-        mTrack.startAnimation(mTrackAnim);
-
-        if (TRACE_LAUNCH) {
-            android.os.Debug.stopMethodTracing();
-            Log.d(TAG, "Window recycled " + mWindowRecycled + " times, chiclets "
-                    + mActionRecycled + " times");
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void onGlobalLayout() {
-        layoutInScreen();
-    }
-
-    /**
-     * Adjust vertical {@link WindowManager.LayoutParams} to fit window as best
-     * as possible, shifting up to display content as needed.
-     */
-    private void layoutInScreen() {
-        if (!mShowing) return;
-
-        final WindowManager.LayoutParams l = mWindow.getAttributes();
-        final int originalY = l.y;
-
-        final int blockHeight = mDecor.getHeight();
-
-        l.y = mRequestedY;
-        if (mRequestedY + blockHeight > mScreenHeight) {
-            // Shift up from bottom when overflowing
-            l.y = mScreenHeight - blockHeight;
-        }
-
-        if (originalY != l.y) {
-            // Only update when value is changed
-            mWindow.setAttributes(l);
-        }
-    }
-
-    /**
-     * Dismiss this dialog if showing.
-     */
-    public synchronized void dismiss() {
-        // Notify any listeners that we've been dismissed
-        if (mDismissListener != null) {
-            mDismissListener.onDismiss(this);
-        }
-
-        dismissInternal();
-    }
-
-    private void dismissInternal() {
-        // Remove any attached window decor for recycling
-        boolean hadDecor = mDecor != null;
-        if (hadDecor) {
-            mWindowManager.removeView(mDecor);
-            mWindowRecycled++;
-            mDecor.getViewTreeObserver().removeGlobalOnLayoutListener(this);
-            mDecor = null;
-            mWindow.closeAllPanels();
-        }
-        mShowing = false;
-        mDismissed = true;
-
-        // Cancel any pending queries
-        mHandler.cancelOperation(TOKEN_DATA);
-        mQuerying = false;
-
-        // Completely hide header and reset track
-        mHeader.setVisibility(View.GONE);
-        resetTrack();
-    }
-
-    /**
-     * Reset track to initial state, recycling any chiclets.
-     */
-    private void resetTrack() {
-        // Release reference to last chiclet
-        mLastAction = null;
-
-        // Clear track actions and scroll to hard left
-        mResolveCache.clear();
-        mActions.clear();
-
-        // Recycle any chiclets in use
-        while (mTrack.getChildCount() > 2) {
-            this.releaseView(mTrack.getChildAt(1));
-            mTrack.removeViewAt(1);
-        }
-
-        mTrackScroll.fullScroll(View.FOCUS_LEFT);
-        mWasDownArrow = false;
-
-        // Clear any primary requests
-        mMakePrimary = false;
-        mSetPrimaryCheckBox.setChecked(false);
-
-        setResolveVisible(false, null);
-    }
-
-    /**
-     * Consider showing this window, which will only call through to
-     * {@link #showInternal()} when all data items are present.
-     */
-    private void considerShowing() {
-        if (!mShowing && !mDismissed) {
-            if (mMode == QuickContact.MODE_MEDIUM && !mHasValidSocial) {
-                // Missing valid social, swap medium for small header
-                mHeader.setVisibility(View.GONE);
-                mHeader = getHeaderView(QuickContact.MODE_SMALL);
-            }
-
-            // All queries have returned, pull curtain
-            showInternal();
-        }
-    }
-
-    /** {@inheritDoc} */
-    public synchronized void onQueryComplete(int token, Object cookie, Cursor cursor) {
-        // Bail early when query is stale
-        if (cookie != mLookupUri) return;
-
-        if (cursor == null) {
-            // Problem while running query, so bail without showing
-            Log.w(TAG, "Missing cursor for token=" + token);
-            this.dismiss();
-            return;
-        }
-
-        handleData(cursor);
-
-        if (!cursor.isClosed()) {
-            cursor.close();
-        }
-
-        considerShowing();
-    }
-
-    /** Assign this string to the view, if found in {@link #mHeader}. */
-    private void setHeaderText(int id, int resId) {
-        setHeaderText(id, mContext.getResources().getText(resId));
-    }
-
-    /** Assign this string to the view, if found in {@link #mHeader}. */
-    private void setHeaderText(int id, CharSequence value) {
-        final View view = mHeader.findViewById(id);
-        if (view instanceof TextView) {
-            ((TextView)view).setText(value);
-            view.setVisibility(TextUtils.isEmpty(value) ? View.GONE : View.VISIBLE);
-        }
-    }
-
-    /** Assign this image to the view, if found in {@link #mHeader}. */
-    private void setHeaderImage(int id, Drawable drawable) {
-        final View view = mHeader.findViewById(id);
-        if (view instanceof ImageView) {
-            ((ImageView)view).setImageDrawable(drawable);
-            view.setVisibility(drawable == null ? View.GONE : View.VISIBLE);
-        }
-    }
-
-    /**
-     * Find the QuickContact-specific presence icon for showing in chiclets.
-     */
-    private Drawable getTrackPresenceIcon(int status) {
-        int resId;
-        switch (status) {
-            case StatusUpdates.AVAILABLE:
-                resId = R.drawable.quickcontact_slider_presence_active;
-                break;
-            case StatusUpdates.IDLE:
-            case StatusUpdates.AWAY:
-                resId = R.drawable.quickcontact_slider_presence_away;
-                break;
-            case StatusUpdates.DO_NOT_DISTURB:
-                resId = R.drawable.quickcontact_slider_presence_busy;
-                break;
-            case StatusUpdates.INVISIBLE:
-                resId = R.drawable.quickcontact_slider_presence_inactive;
-                break;
-            case StatusUpdates.OFFLINE:
-            default:
-                resId = R.drawable.quickcontact_slider_presence_inactive;
-        }
-        return mContext.getResources().getDrawable(resId);
-    }
-
-    /** Read {@link String} from the given {@link Cursor}. */
-    private static String getAsString(Cursor cursor, String columnName) {
-        final int index = cursor.getColumnIndex(columnName);
-        return cursor.getString(index);
-    }
-
-    /** Read {@link Integer} from the given {@link Cursor}. */
-    private static int getAsInt(Cursor cursor, String columnName) {
-        final int index = cursor.getColumnIndex(columnName);
-        return cursor.getInt(index);
-    }
-
-    /**
-     * Abstract definition of an action that could be performed, along with
-     * string description and icon.
-     */
-    private interface Action extends Collapser.Collapsible<Action> {
-        public CharSequence getHeader();
-        public CharSequence getBody();
-
-        public String getMimeType();
-        public Drawable getFallbackIcon();
-
-        /**
-         * Build an {@link Intent} that will perform this action.
-         */
-        public Intent getIntent();
-
-        /**
-         * Checks if the contact data for this action is primary.
-         */
-        public Boolean isPrimary();
-
-        /**
-         * Returns a lookup (@link Uri) for the contact data item.
-         */
-        public Uri getDataUri();
-    }
-
-    /**
-     * Description of a specific {@link Data#_ID} item, with style information
-     * defined by a {@link DataKind}.
-     */
-    private static class DataAction implements Action {
-        private final Context mContext;
-        private final DataKind mKind;
-        private final String mMimeType;
-
-        private CharSequence mHeader;
-        private CharSequence mBody;
-        private Intent mIntent;
-
-        private boolean mAlternate;
-        private Uri mDataUri;
-        private boolean mIsPrimary;
-
-        /**
-         * Create an action from common {@link Data} elements.
-         */
-        public DataAction(Context context, String mimeType, DataKind kind,
-                long dataId, Cursor cursor) {
-            mContext = context;
-            mKind = kind;
-            mMimeType = mimeType;
-
-            // Inflate strings from cursor
-            mAlternate = Constants.MIME_SMS_ADDRESS.equals(mimeType);
-            if (mAlternate && mKind.actionAltHeader != null) {
-                mHeader = mKind.actionAltHeader.inflateUsing(context, cursor);
-            } else if (mKind.actionHeader != null) {
-                mHeader = mKind.actionHeader.inflateUsing(context, cursor);
-            }
-
-            if (getAsInt(cursor, Data.IS_SUPER_PRIMARY) != 0) {
-                mIsPrimary = true;
-            }
-
-            if (mKind.actionBody != null) {
-                mBody = mKind.actionBody.inflateUsing(context, cursor);
-            }
-
-            mDataUri = ContentUris.withAppendedId(Data.CONTENT_URI, dataId);
-
-            // Handle well-known MIME-types with special care
-            if (Phone.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                final String number = getAsString(cursor, Phone.NUMBER);
-                if (!TextUtils.isEmpty(number)) {
-                    final Uri callUri = Uri.fromParts(Constants.SCHEME_TEL, number, null);
-                    mIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED, callUri);
-                }
-            } else if (SipAddress.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                final String address = getAsString(cursor, SipAddress.SIP_ADDRESS);
-                if (!TextUtils.isEmpty(address)) {
-                    final Uri callUri = Uri.fromParts(Constants.SCHEME_SIP, address, null);
-                    mIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED, callUri);
-                    // Note that this item will get a SIP-specific variant
-                    // of the "call phone" icon, rather than the standard
-                    // app icon for the Phone app (which we show for
-                    // regular phone numbers.)  That's because the phone
-                    // app explicitly specifies an android:icon attribute
-                    // for the SIP-related intent-filters in its manifest.
-                }
-            } else if (Constants.MIME_SMS_ADDRESS.equals(mimeType)) {
-                final String number = getAsString(cursor, Phone.NUMBER);
-                if (!TextUtils.isEmpty(number)) {
-                    final Uri smsUri = Uri.fromParts(Constants.SCHEME_SMSTO, number, null);
-                    mIntent = new Intent(Intent.ACTION_SENDTO, smsUri);
-                }
-
-            } else if (Email.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                final String address = getAsString(cursor, Email.DATA);
-                if (!TextUtils.isEmpty(address)) {
-                    final Uri mailUri = Uri.fromParts(Constants.SCHEME_MAILTO, address, null);
-                    mIntent = new Intent(Intent.ACTION_SENDTO, mailUri);
-                }
-
-            } else if (Website.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                final String url = getAsString(cursor, Website.URL);
-                if (!TextUtils.isEmpty(url)) {
-                    mIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
-                }
-
-            } else if (Im.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                final boolean isEmail = Email.CONTENT_ITEM_TYPE.equals(
-                        getAsString(cursor, Data.MIMETYPE));
-                if (isEmail || isProtocolValid(cursor)) {
-                    final int protocol = isEmail ? Im.PROTOCOL_GOOGLE_TALK :
-                            getAsInt(cursor, Im.PROTOCOL);
-
-                    if (isEmail) {
-                        // Use Google Talk string when using Email, and clear data
-                        // Uri so we don't try saving Email as primary.
-                        mHeader = context.getText(R.string.chat_gtalk);
-                        mDataUri = null;
-                    }
-
-                    String host = getAsString(cursor, Im.CUSTOM_PROTOCOL);
-                    String data = getAsString(cursor, isEmail ? Email.DATA : Im.DATA);
-                    if (protocol != Im.PROTOCOL_CUSTOM) {
-                        // Try bringing in a well-known host for specific protocols
-                        host = ContactsUtils.lookupProviderNameFromId(protocol);
-                    }
-
-                    if (!TextUtils.isEmpty(host) && !TextUtils.isEmpty(data)) {
-                        final String authority = host.toLowerCase();
-                        final Uri imUri = new Uri.Builder().scheme(Constants.SCHEME_IMTO).authority(
-                                authority).appendPath(data).build();
-                        mIntent = new Intent(Intent.ACTION_SENDTO, imUri);
-                    }
-                }
-            }
-
-            if (mIntent == null) {
-                // Otherwise fall back to default VIEW action
-                mIntent = new Intent(Intent.ACTION_VIEW, mDataUri);
-            }
-
-            // Always launch as new task, since we're like a launcher
-            mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
-        }
-
-        private boolean isProtocolValid(Cursor cursor) {
-            final int columnIndex = cursor.getColumnIndex(Im.PROTOCOL);
-            if (cursor.isNull(columnIndex)) {
-                return false;
-            }
-            try {
-                Integer.valueOf(cursor.getString(columnIndex));
-            } catch (NumberFormatException e) {
-                return false;
-            }
-            return true;
-        }
-
-        /** {@inheritDoc} */
-        public CharSequence getHeader() {
-            return mHeader;
-        }
-
-        /** {@inheritDoc} */
-        public CharSequence getBody() {
-            return mBody;
-        }
-
-        /** {@inheritDoc} */
-        public String getMimeType() {
-            return mMimeType;
-        }
-
-        /** {@inheritDoc} */
-        public Uri getDataUri() {
-            return mDataUri;
-        }
-
-        /** {@inheritDoc} */
-        public Boolean isPrimary() {
-            return mIsPrimary;
-        }
-
-        /** {@inheritDoc} */
-        public Drawable getFallbackIcon() {
-            // Bail early if no valid resources
-            final String resPackageName = mKind.resPackageName;
-            if (resPackageName == null) return null;
-
-            final PackageManager pm = mContext.getPackageManager();
-            if (mAlternate && mKind.iconAltRes != -1) {
-                return pm.getDrawable(resPackageName, mKind.iconAltRes, null);
-            } else if (mKind.iconRes != -1) {
-                return pm.getDrawable(resPackageName, mKind.iconRes, null);
-            } else {
-                return null;
-            }
-        }
-
-        /** {@inheritDoc} */
-        public Intent getIntent() {
-            return mIntent;
-        }
-
-        /** {@inheritDoc} */
-        public boolean collapseWith(Action other) {
-            if (!shouldCollapseWith(other)) {
-                return false;
-            }
-            return true;
-        }
-
-        /** {@inheritDoc} */
-        public boolean shouldCollapseWith(Action t) {
-            if (t == null) {
-                return false;
-            }
-            if (!(t instanceof DataAction)) {
-                Log.e(TAG, "t must be DataAction");
-                return false;
-            }
-            DataAction other = (DataAction)t;
-            if (!ContactsUtils.areObjectsEqual(mKind, other.mKind)) {
-                return false;
-            }
-            if (!ContactsUtils.shouldCollapse(mContext, mMimeType, mBody, other.mMimeType,
-                    other.mBody)) {
-                return false;
-            }
-            if (!TextUtils.equals(mMimeType, other.mMimeType)
-                    || !ContactsUtils.areIntentActionEqual(mIntent, other.mIntent)
-                    ) {
-                return false;
-            }
-            return true;
-        }
-    }
-
-    /**
-     * Specific action that launches the profile card.
-     */
-    private static class ProfileAction implements Action {
-        private final Context mContext;
-        private final Uri mLookupUri;
-
-        public ProfileAction(Context context, Uri lookupUri) {
-            mContext = context;
-            mLookupUri = lookupUri;
-        }
-
-        /** {@inheritDoc} */
-        public CharSequence getHeader() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        public CharSequence getBody() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        public String getMimeType() {
-            return Contacts.CONTENT_ITEM_TYPE;
-        }
-
-        /** {@inheritDoc} */
-        public Drawable getFallbackIcon() {
-            return mContext.getResources().getDrawable(R.drawable.ic_contacts_details);
-        }
-
-        /** {@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;
-        }
-
-        /** {@inheritDoc} */
-        public Boolean isPrimary() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        public Uri getDataUri() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        public boolean collapseWith(Action t) {
-            return false; // Never dup.
-        }
-
-        /** {@inheritDoc} */
-        public boolean shouldCollapseWith(Action t) {
-            return false; // Never dup.
-        }
-    }
-
-    /**
-     * Internally hold a cache of scaled icons based on {@link PackageManager}
-     * queries, keyed internally on MIME-type.
-     */
-    private static class ResolveCache {
-        private PackageManager mPackageManager;
-
-        /**
-         * Cached entry holding the best {@link ResolveInfo} for a specific
-         * MIME-type, along with a {@link SoftReference} to its icon.
-         */
-        private static class Entry {
-            public ResolveInfo bestResolve;
-            public SoftReference<Drawable> icon;
-        }
-
-        private HashMap<String, Entry> mCache = new HashMap<String, Entry>();
-
-        public ResolveCache(Context context) {
-            mPackageManager = context.getPackageManager();
-        }
-
-        /**
-         * Get the {@link Entry} best associated with the given {@link Action},
-         * or create and populate a new one if it doesn't exist.
-         */
-        protected Entry getEntry(Action action) {
-            final String mimeType = action.getMimeType();
-            Entry entry = mCache.get(mimeType);
-            if (entry != null) return entry;
-            entry = new Entry();
-
-            final Intent intent = action.getIntent();
-            if (intent != null) {
-                final List<ResolveInfo> matches = mPackageManager.queryIntentActivities(intent,
-                        PackageManager.MATCH_DEFAULT_ONLY);
-
-                // Pick first match, otherwise best found
-                ResolveInfo bestResolve = null;
-                final int size = matches.size();
-                if (size == 1) {
-                    bestResolve = matches.get(0);
-                } else if (size > 1) {
-                    bestResolve = getBestResolve(intent, matches);
-                }
-
-                if (bestResolve != null) {
-                    final Drawable icon = bestResolve.loadIcon(mPackageManager);
-
-                    entry.bestResolve = bestResolve;
-                    entry.icon = new SoftReference<Drawable>(icon);
-                }
-            }
-
-            mCache.put(mimeType, entry);
-            return entry;
-        }
-
-        /**
-         * Best {@link ResolveInfo} when multiple found. Ties are broken by
-         * selecting first from the {QuickContactWindow#sPreferResolve} list of
-         * preferred packages, second by apps that live on the system partition,
-         * otherwise the app from the top of the list. This is
-         * <strong>only</strong> used for selecting a default icon for
-         * displaying in the track, and does not shortcut the system
-         * {@link Intent} disambiguation dialog.
-         */
-        protected ResolveInfo getBestResolve(Intent intent, List<ResolveInfo> matches) {
-            // Try finding preferred activity, otherwise detect disambig
-            final ResolveInfo foundResolve = mPackageManager.resolveActivity(intent,
-                    PackageManager.MATCH_DEFAULT_ONLY);
-            final boolean foundDisambig = (foundResolve.match &
-                    IntentFilter.MATCH_CATEGORY_MASK) == 0;
-
-            if (!foundDisambig) {
-                // Found concrete match, so return directly
-                return foundResolve;
-            }
-
-            // Accept any package from prefer list, otherwise first system app
-            ResolveInfo firstSystem = null;
-            for (ResolveInfo info : matches) {
-                final boolean isSystem = (info.activityInfo.applicationInfo.flags
-                        & ApplicationInfo.FLAG_SYSTEM) != 0;
-                final boolean isPrefer = QuickContactWindow.sPreferResolve
-                        .contains(info.activityInfo.applicationInfo.packageName);
-
-
-
-                if (isPrefer) return info;
-                if (isSystem && firstSystem != null) firstSystem = info;
-            }
-
-            // Return first system found, otherwise first from list
-            return firstSystem != null ? firstSystem : matches.get(0);
-        }
-
-        /**
-         * Check {@link PackageManager} to see if any apps offer to handle the
-         * given {@link Action}.
-         */
-        public boolean hasResolve(Action action) {
-            return getEntry(action).bestResolve != null;
-        }
-
-        /**
-         * Find the best description for the given {@link Action}, usually used
-         * for accessibility purposes.
-         */
-        public CharSequence getDescription(Action action) {
-            final CharSequence actionHeader = action.getHeader();
-            final ResolveInfo info = getEntry(action).bestResolve;
-            if (!TextUtils.isEmpty(actionHeader)) {
-                return actionHeader;
-            } else if (info != null) {
-                return info.loadLabel(mPackageManager);
-            } else {
-                return null;
-            }
-        }
-
-        /**
-         * Return the best icon for the given {@link Action}, which is usually
-         * based on the {@link ResolveInfo} found through a
-         * {@link PackageManager} query.
-         */
-        public Drawable getIcon(Action action) {
-            final SoftReference<Drawable> iconRef = getEntry(action).icon;
-            return (iconRef == null) ? null : iconRef.get();
-        }
-
-        public void clear() {
-            mCache.clear();
-        }
-    }
-
-    /**
-     * Provide a strongly-typed {@link LinkedList} that holds a list of
-     * {@link Action} objects.
-     */
-    private class ActionList extends ArrayList<Action> {
-    }
-
-    /**
-     * Provide a simple way of collecting one or more {@link Action} objects
-     * under a MIME-type key.
-     */
-    private class ActionMap extends HashMap<String, ActionList> {
-        private void collect(String mimeType, Action info) {
-            // Create list for this MIME-type when needed
-            ActionList collectList = get(mimeType);
-            if (collectList == null) {
-                collectList = new ActionList();
-                put(mimeType, collectList);
-            }
-            collectList.add(info);
-        }
-    }
-
-    /**
-     * Check if the given MIME-type appears in the list of excluded MIME-types
-     * that the most-recent caller requested.
-     */
-    private boolean isMimeExcluded(String mimeType) {
-        if (mExcludeMimes == null) return false;
-        for (String excludedMime : mExcludeMimes) {
-            if (TextUtils.equals(excludedMime, mimeType)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Handle the result from the {@link #TOKEN_DATA} query.
-     */
-    private void handleData(Cursor cursor) {
-        if (cursor == null) return;
-
-        if (!isMimeExcluded(Contacts.CONTENT_ITEM_TYPE)) {
-            // Add the profile shortcut action
-            final Action action = new ProfileAction(mContext, mLookupUri);
-            mActions.collect(Contacts.CONTENT_ITEM_TYPE, action);
-        }
-
-        final DataStatus status = new DataStatus();
-        final Sources sources = Sources.getInstance(mContext);
-        final ImageView photoView = (ImageView)mHeader.findViewById(R.id.photo);
-
-        Bitmap photoBitmap = null;
-        while (cursor.moveToNext()) {
-            final long dataId = cursor.getLong(DataQuery._ID);
-            final String accountType = cursor.getString(DataQuery.ACCOUNT_TYPE);
-            final String mimeType = cursor.getString(DataQuery.MIMETYPE);
-
-            // Handle any social status updates from this row
-            status.possibleUpdate(cursor);
-
-            // Skip this data item if MIME-type excluded
-            if (isMimeExcluded(mimeType)) continue;
-
-            // Handle photos included as data row
-            if (Photo.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                final int colPhoto = cursor.getColumnIndex(Photo.PHOTO);
-                final byte[] photoBlob = cursor.getBlob(colPhoto);
-                if (photoBlob != null) {
-                    photoBitmap = BitmapFactory.decodeByteArray(photoBlob, 0, photoBlob.length);
-                }
-                continue;
-            }
-
-            final DataKind kind = sources.getKindOrFallback(accountType, mimeType, mContext,
-                    ContactsSource.LEVEL_MIMETYPES);
-
-            if (kind != null) {
-                // Build an action for this data entry, find a mapping to a UI
-                // element, build its summary from the cursor, and collect it
-                // along with all others of this MIME-type.
-                final Action action = new DataAction(mContext, mimeType, kind, dataId, cursor);
-                considerAdd(action, mimeType);
-            }
-
-            // If phone number, also insert as text message action
-            if (Phone.CONTENT_ITEM_TYPE.equals(mimeType) && kind != null) {
-                final Action action = new DataAction(mContext, Constants.MIME_SMS_ADDRESS,
-                        kind, dataId, cursor);
-                considerAdd(action, Constants.MIME_SMS_ADDRESS);
-            }
-
-            // Handle Email rows with presence data as Im entry
-            final boolean hasPresence = !cursor.isNull(DataQuery.PRESENCE);
-            if (hasPresence && Email.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                final DataKind imKind = sources.getKindOrFallback(accountType,
-                        Im.CONTENT_ITEM_TYPE, mContext, ContactsSource.LEVEL_MIMETYPES);
-                if (imKind != null) {
-                    final Action action = new DataAction(mContext, Im.CONTENT_ITEM_TYPE, imKind,
-                            dataId, cursor);
-                    considerAdd(action, Im.CONTENT_ITEM_TYPE);
-                }
-            }
-        }
-
-        if (cursor.moveToLast()) {
-            // Read contact information from last data row
-            final String name = cursor.getString(DataQuery.DISPLAY_NAME);
-            final int presence = cursor.getInt(DataQuery.CONTACT_PRESENCE);
-            final Drawable statusIcon = ContactPresenceIconUtil.getPresenceIcon(mContext, presence);
-
-            setHeaderText(R.id.name, name);
-            setHeaderImage(R.id.presence, statusIcon);
-        }
-
-        if (photoView != null) {
-            // Place photo when discovered in data, otherwise hide
-            photoView.setVisibility(photoBitmap != null ? View.VISIBLE : View.GONE);
-            photoView.setImageBitmap(photoBitmap);
-        }
-
-        mHasValidSocial = status.isValid();
-        if (mHasValidSocial && mMode != QuickContact.MODE_SMALL) {
-            // Update status when valid was found
-            setHeaderText(R.id.status, status.getStatus());
-            setHeaderText(R.id.timestamp, status.getTimestampLabel(mContext));
-        }
-
-        // Turn our list of actions into UI elements
-
-        // Index where we start adding child views.
-        int index = mTrack.getChildCount() - 1;
-
-        // 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);
-            }
-        }
-
-        // Keep the current index to append non PRECEDING/FOLLOWING items.
-        final int indexAfterPreceding = index;
-
-        // 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);
-            }
-        }
-
-        // 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++);
-        }
-    }
-
-    /**
-     * Consider adding the given {@link Action}, which will only happen if
-     * {@link PackageManager} finds an application to handle
-     * {@link Action#getIntent()}.
-     */
-    private void considerAdd(Action action, String mimeType) {
-        if (mResolveCache.hasResolve(action)) {
-            mActions.collect(mimeType, action);
-        }
-    }
-
-    /**
-     * Obtain a new {@link CheckableImageView} for a new chiclet, either by
-     * recycling one from {@link #mActionPool}, or by inflating a new one. When
-     * finished, use {@link #releaseView(View)} to return back into the pool for
-     * later recycling.
-     */
-    private synchronized View obtainView() {
-        View view = mActionPool.poll();
-        if (view == null || QuickContactActivity.FORCE_CREATE) {
-            view = mInflater.inflate(R.layout.quickcontact_item, mTrack, false);
-        }
-        return view;
-    }
-
-    /**
-     * Return the given {@link CheckableImageView} into our internal pool for
-     * possible recycling during another pass.
-     */
-    private synchronized void releaseView(View view) {
-        // Only add CheckableImageViews
-        if (!(view instanceof CheckableImageView)) {
-            return;
-        }
-        mActionPool.offer(view);
-        mActionRecycled++;
-    }
-
-    /**
-     * Inflate the in-track view for the action of the given MIME-type, collapsing duplicate values.
-     * Will use the icon provided by the {@link DataKind}.
-     */
-    private View inflateAction(String mimeType) {
-        final CheckableImageView view = (CheckableImageView)obtainView();
-        boolean isActionSet = false;
-
-        // Add direct intent if single child, otherwise flag for multiple
-        ActionList children = mActions.get(mimeType);
-        if (children.size() > 1) {
-            Collapser.collapseList(children);
-        }
-        Action firstInfo = children.get(0);
-        if (children.size() == 1) {
-            view.setTag(firstInfo);
-        } else {
-            for (Action action : children) {
-                if (action.isPrimary()) {
-                    view.setTag(action);
-                    isActionSet = true;
-                    break;
-                }
-            }
-            if (!isActionSet) {
-                view.setTag(children);
-            }
-        }
-
-        // Set icon and listen for clicks
-        final CharSequence descrip = mResolveCache.getDescription(firstInfo);
-        final Drawable icon = mResolveCache.getIcon(firstInfo);
-        view.setChecked(false);
-        view.setContentDescription(descrip);
-        view.setImageDrawable(icon);
-        view.setOnClickListener(this);
-        return view;
-    }
-
-    /** {@inheritDoc} */
-    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-        // Pass list item clicks along so that Intents are handled uniformly
-        onClick(view);
-    }
-
-    /**
-     * Flag indicating if {@link #mArrowDown} was visible during the last call
-     * to {@link #setResolveVisible(boolean, CheckableImageView)}. Used to
-     * decide during a later call if the arrow should be restored.
-     */
-    private boolean mWasDownArrow = false;
-
-    /**
-     * Helper for showing and hiding {@link #mFooterDisambig}, which will
-     * correctly manage {@link #mArrowDown} as needed.
-     */
-    private void setResolveVisible(boolean visible, CheckableImageView actionView) {
-        // Show or hide the resolve list if needed
-        boolean visibleNow = mFooterDisambig.getVisibility() == View.VISIBLE;
-
-        if (mLastAction != null) mLastAction.setChecked(false);
-        if (actionView != null) actionView.setChecked(true);
-        mLastAction = actionView;
-
-        // Bail early if already in desired state
-        if (visible == visibleNow) return;
-
-        mFooter.setVisibility(visible ? View.GONE : View.VISIBLE);
-        mFooterDisambig.setVisibility(visible ? View.VISIBLE : View.GONE);
-
-        if (visible) {
-            // If showing list, then hide and save state of down arrow
-            mWasDownArrow = mWasDownArrow || (mArrowDown.getVisibility() == View.VISIBLE);
-            mArrowDown.setVisibility(View.INVISIBLE);
-        } else {
-            // If hiding list, restore any down arrow state
-            mArrowDown.setVisibility(mWasDownArrow ? View.VISIBLE : View.INVISIBLE);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void onClick(View view) {
-        final boolean isActionView = (view instanceof CheckableImageView);
-        final CheckableImageView actionView = isActionView ? (CheckableImageView)view : null;
-        final Object tag = view.getTag();
-        if (tag instanceof Action) {
-            // Incoming tag is concrete intent, so try launching
-            final Action action = (Action)tag;
-            final boolean makePrimary = mMakePrimary;
-
-            if (Intent.ACTION_CALL_PRIVILEGED.equals(action.getIntent().getAction())) {
-                StickyTabs.saveTab(mContext, mLastSelectedContactsAppTab);
-            }
-
-            try {
-                mContext.startActivity(action.getIntent());
-            } catch (ActivityNotFoundException e) {
-                Toast.makeText(mContext, R.string.quickcontact_missing_app, Toast.LENGTH_SHORT)
-                        .show();
-            }
-
-            // Hide the resolution list, if present
-            setResolveVisible(false, null);
-            this.dismiss();
-
-            if (makePrimary) {
-                ContentValues values = new ContentValues(1);
-                values.put(Data.IS_SUPER_PRIMARY, 1);
-                final Uri dataUri = action.getDataUri();
-                if (dataUri != null) {
-                    mContext.getContentResolver().update(dataUri, values, null, null);
-                }
-            }
-        } else if (tag instanceof ActionList) {
-            // Incoming tag is a MIME-type, so show resolution list
-            final ActionList children = (ActionList)tag;
-
-            // Show resolution list and set adapter
-            setResolveVisible(true, actionView);
-
-            mResolveList.setOnItemClickListener(this);
-            mResolveList.setAdapter(new BaseAdapter() {
-                public int getCount() {
-                    return children.size();
-                }
-
-                public Object getItem(int position) {
-                    return children.get(position);
-                }
-
-                public long getItemId(int position) {
-                    return position;
-                }
-
-                public View getView(int position, View convertView, ViewGroup parent) {
-                    if (convertView == null) {
-                        convertView = mInflater.inflate(
-                                R.layout.quickcontact_resolve_item, parent, false);
-                    }
-
-                    // Set action title based on summary value
-                    final Action action = (Action)getItem(position);
-
-                    TextView text1 = (TextView)convertView.findViewById(android.R.id.text1);
-                    TextView text2 = (TextView)convertView.findViewById(android.R.id.text2);
-
-                    text1.setText(action.getHeader());
-                    text2.setText(action.getBody());
-
-                    convertView.setTag(action);
-                    return convertView;
-                }
-            });
-
-            // Make sure we resize to make room for ListView
-            mDecor.forceLayout();
-            mDecor.invalidate();
-
-        }
-    }
-
-    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-        mMakePrimary = isChecked;
-    }
-
-    private void onBackPressed() {
-        // Back key will first dismiss any expanded resolve list, otherwise
-        // it will close the entire dialog.
-        if (mFooterDisambig.getVisibility() == View.VISIBLE) {
-            setResolveVisible(false, null);
-            mDecor.forceLayout();
-            mDecor.invalidate();
-        } else {
-            dismiss();
-        }
-    }
-
-    /** {@inheritDoc} */
-    public boolean dispatchKeyEvent(KeyEvent event) {
-        if (mWindow.superDispatchKeyEvent(event)) {
-            return true;
-        }
-        return event.dispatch(this, mDecor != null
-                ? mDecor.getKeyDispatcherState() : null, this);
-    }
-
-    /** {@inheritDoc} */
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        if (keyCode == KeyEvent.KEYCODE_BACK) {
-            event.startTracking();
-            return true;
-        }
-
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean onKeyUp(int keyCode, KeyEvent event) {
-        if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking()
-                && !event.isCanceled()) {
-            onBackPressed();
-            return true;
-        }
-
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean onKeyLongPress(int keyCode, KeyEvent event) {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean onKeyMultiple(int keyCode, int count, KeyEvent event) {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
-        // TODO: make this window accessible
-        return false;
-    }
-
-    /**
-     * Detect if the given {@link MotionEvent} is outside the boundaries of this
-     * window, which usually means we should dismiss.
-     */
-    protected void detectEventOutside(MotionEvent event) {
-        if (event.getAction() == MotionEvent.ACTION_DOWN && mDecor != null) {
-            // Only try detecting outside events on down-press
-            mDecor.getHitRect(mRect);
-            mRect.top = mRect.top + mShadowTouch;
-            mRect.bottom = mRect.bottom - mShadowTouch;
-            final int x = (int)event.getX();
-            final int y = (int)event.getY();
-            if (!mRect.contains(x, y)) {
-                event.setAction(MotionEvent.ACTION_OUTSIDE);
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    public boolean dispatchTouchEvent(MotionEvent event) {
-        detectEventOutside(event);
-        if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
-            dismiss();
-            return true;
-        } else {
-            return mWindow.superDispatchTouchEvent(event);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public boolean dispatchTrackballEvent(MotionEvent event) {
-        return mWindow.superDispatchTrackballEvent(event);
-    }
-
-    /** {@inheritDoc} */
-    public void onContentChanged() {
-    }
-
-    /** {@inheritDoc} */
-    public boolean onCreatePanelMenu(int featureId, Menu menu) {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public View onCreatePanelView(int featureId) {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    public boolean onMenuItemSelected(int featureId, MenuItem item) {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean onMenuOpened(int featureId, Menu menu) {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public void onPanelClosed(int featureId, Menu menu) {
-    }
-
-    /** {@inheritDoc} */
-    public boolean onPreparePanel(int featureId, View view, Menu menu) {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean onSearchRequested() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams attrs) {
-        if (mDecor != null) {
-            mWindowManager.updateViewLayout(mDecor, attrs);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void onWindowFocusChanged(boolean hasFocus) {
-    }
-
-    /** {@inheritDoc} */
-    public void onAttachedToWindow() {
-        // No actions
-    }
-
-    /** {@inheritDoc} */
-    public void onDetachedFromWindow() {
-        // No actions
-    }
-
-    private interface DataQuery {
-        final String[] PROJECTION = new String[] {
-                Data._ID,
-
-                RawContacts.ACCOUNT_TYPE,
-                Contacts.STARRED,
-                Contacts.DISPLAY_NAME,
-                Contacts.CONTACT_PRESENCE,
-
-                Data.STATUS,
-                Data.STATUS_RES_PACKAGE,
-                Data.STATUS_ICON,
-                Data.STATUS_LABEL,
-                Data.STATUS_TIMESTAMP,
-                Data.PRESENCE,
-
-                Data.RES_PACKAGE,
-                Data.MIMETYPE,
-                Data.IS_PRIMARY,
-                Data.IS_SUPER_PRIMARY,
-                Data.RAW_CONTACT_ID,
-
-                Data.DATA1, Data.DATA2, Data.DATA3, Data.DATA4, Data.DATA5,
-                Data.DATA6, Data.DATA7, Data.DATA8, Data.DATA9, Data.DATA10, Data.DATA11,
-                Data.DATA12, Data.DATA13, Data.DATA14, Data.DATA15,
-        };
-
-        final int _ID = 0;
-
-        final int ACCOUNT_TYPE = 1;
-        final int STARRED = 2;
-        final int DISPLAY_NAME = 3;
-        final int CONTACT_PRESENCE = 4;
-
-        final int STATUS = 5;
-        final int STATUS_RES_PACKAGE = 6;
-        final int STATUS_ICON = 7;
-        final int STATUS_LABEL = 8;
-        final int STATUS_TIMESTAMP = 9;
-        final int PRESENCE = 10;
-
-        final int RES_PACKAGE = 11;
-        final int MIMETYPE = 12;
-        final int IS_PRIMARY = 13;
-        final int IS_SUPER_PRIMARY = 14;
-    }
-}
diff --git a/src/com/android/contacts/ui/ShowOrCreateActivity.java b/src/com/android/contacts/ui/ShowOrCreateActivity.java
deleted file mode 100755
index e0781d2..0000000
--- a/src/com/android/contacts/ui/ShowOrCreateActivity.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui;
-
-import com.android.contacts.ContactsSearchManager;
-import com.android.contacts.ContactsListActivity;
-import com.android.contacts.R;
-import com.android.contacts.util.Constants;
-import com.android.contacts.util.NotifyingAsyncQueryHandler;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.ComponentName;
-import android.content.ContentUris;
-import android.content.DialogInterface;
-import android.content.EntityIterator;
-import android.content.Intent;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Bundle;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Intents;
-import android.provider.ContactsContract.PhoneLookup;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.util.Log;
-
-/**
- * Handle several edge cases around showing or possibly creating contacts in
- * connected with a specific E-mail address or phone number. Will search based
- * on incoming {@link Intent#getData()} as described by
- * {@link Intents#SHOW_OR_CREATE_CONTACT}.
- * <ul>
- * <li>If no matching contacts found, will prompt user with dialog to add to a
- * contact, then will use {@link Intent#ACTION_INSERT_OR_EDIT} to let create new
- * contact or edit new data into an existing one.
- * <li>If one matching contact found, directly show {@link Intent#ACTION_VIEW}
- * that specific contact.
- * <li>If more than one matching found, show list of matching contacts using
- * {@link Intent#ACTION_SEARCH}.
- * </ul>
- */
-public final class ShowOrCreateActivity extends Activity implements
-        NotifyingAsyncQueryHandler.AsyncQueryListener {
-    static final String TAG = "ShowOrCreateActivity";
-    static final boolean LOGD = false;
-
-    static final String[] PHONES_PROJECTION = new String[] {
-        PhoneLookup._ID,
-    };
-
-    static final String[] CONTACTS_PROJECTION = new String[] {
-        RawContacts.CONTACT_ID,
-    };
-
-    static final int CONTACT_ID_INDEX = 0;
-
-    static final int CREATE_CONTACT_DIALOG = 1;
-
-    static final int QUERY_TOKEN = 42;
-
-    private NotifyingAsyncQueryHandler mQueryHandler;
-
-    private Bundle mCreateExtras;
-    private String mCreateDescrip;
-    private boolean mCreateForce;
-
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        // Create handler if doesn't exist, otherwise cancel any running
-        if (mQueryHandler == null) {
-            mQueryHandler = new NotifyingAsyncQueryHandler(this, this);
-        } else {
-            mQueryHandler.cancelOperation(QUERY_TOKEN);
-        }
-
-        final Intent intent = getIntent();
-        final Uri data = intent.getData();
-
-        // Unpack scheme and target data from intent
-        String scheme = null;
-        String ssp = null;
-        if (data != null) {
-            scheme = data.getScheme();
-            ssp = data.getSchemeSpecificPart();
-        }
-
-        // Build set of extras for possible use when creating contact
-        mCreateExtras = new Bundle();
-        Bundle originalExtras = intent.getExtras();
-        if (originalExtras != null) {
-            mCreateExtras.putAll(originalExtras);
-        }
-
-        // Read possible extra with specific title
-        mCreateDescrip = intent.getStringExtra(Intents.EXTRA_CREATE_DESCRIPTION);
-        if (mCreateDescrip == null) {
-            mCreateDescrip = ssp;
-        }
-
-        // Allow caller to bypass dialog prompt
-        mCreateForce = intent.getBooleanExtra(Intents.EXTRA_FORCE_CREATE, false);
-
-        // Handle specific query request
-        if (Constants.SCHEME_MAILTO.equals(scheme)) {
-            mCreateExtras.putString(Intents.Insert.EMAIL, ssp);
-
-            Uri uri = Uri.withAppendedPath(Email.CONTENT_FILTER_URI, Uri.encode(ssp));
-            mQueryHandler.startQuery(QUERY_TOKEN, null, uri, CONTACTS_PROJECTION, null, null, null);
-
-        } else if (Constants.SCHEME_TEL.equals(scheme)) {
-            mCreateExtras.putString(Intents.Insert.PHONE, ssp);
-
-            Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, ssp);
-            mQueryHandler.startQuery(QUERY_TOKEN, null, uri, PHONES_PROJECTION, null, null, null);
-
-        } else {
-            Log.w(TAG, "Invalid intent:" + getIntent());
-            finish();
-        }
-    }
-
-    @Override
-    protected void onStop() {
-        super.onStop();
-        if (mQueryHandler != null) {
-            mQueryHandler.cancelOperation(QUERY_TOKEN);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void onQueryComplete(int token, Object cookie, Cursor cursor) {
-        if (cursor == null) {
-            // Bail when problem running query in background
-            finish();
-            return;
-        }
-
-        // Count contacts found by query
-        int count = 0;
-        long contactId = -1;
-        try {
-            count = cursor.getCount();
-            if (count == 1 && cursor.moveToFirst()) {
-                // Try reading ID if only one contact returned
-                contactId = cursor.getLong(CONTACT_ID_INDEX);
-            }
-        } finally {
-            cursor.close();
-        }
-
-        if (count == 1 && contactId != -1) {
-            // If we only found one item, jump right to viewing it
-            final Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
-            final Intent viewIntent = new Intent(Intent.ACTION_VIEW, contactUri);
-            startActivity(viewIntent);
-            finish();
-
-        } else if (count > 1) {
-            // If more than one, show pick list
-            Intent listIntent = new Intent(Intent.ACTION_SEARCH);
-            listIntent.setComponent(new ComponentName(this, ContactsListActivity.class));
-            listIntent.putExtras(mCreateExtras);
-            startActivity(listIntent);
-            finish();
-
-        } else {
-            // No matching contacts found
-            if (mCreateForce) {
-                // Forced to create new contact
-                Intent createIntent = new Intent(Intent.ACTION_INSERT, RawContacts.CONTENT_URI);
-                createIntent.putExtras(mCreateExtras);
-                createIntent.setType(RawContacts.CONTENT_TYPE);
-
-                startActivity(createIntent);
-                finish();
-
-            } else {
-	        showDialog(CREATE_CONTACT_DIALOG);
-           }
-        }
-    }
-
-    @Override
-    protected Dialog onCreateDialog(int id) {
-        switch(id) {
-	    case CREATE_CONTACT_DIALOG:
-                // Prompt user to insert or edit contact
-                final Intent createIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
-                createIntent.putExtras(mCreateExtras);
-                createIntent.setType(RawContacts.CONTENT_ITEM_TYPE);
-
-                final CharSequence message = getResources().getString(
-                        R.string.add_contact_dlg_message_fmt, mCreateDescrip);
-
-                return new AlertDialog.Builder(this)
-                        .setTitle(R.string.add_contact_dlg_title)
-                        .setMessage(message)
-                        .setPositiveButton(android.R.string.ok,
-                                new IntentClickListener(this, createIntent))
-                        .setNegativeButton(android.R.string.cancel,
-                                new IntentClickListener(this, null))
-                        .create();
-        }
-	return super.onCreateDialog(id);
-    }
-
-    /**
-     * Listener for {@link DialogInterface} that launches a given {@link Intent}
-     * when clicked. When clicked, this also closes the parent using
-     * {@link Activity#finish()}.
-     */
-    private static class IntentClickListener implements DialogInterface.OnClickListener {
-        private Activity mParent;
-        private Intent mIntent;
-
-        /**
-         * @param parent {@link Activity} to use for launching target.
-         * @param intent Target {@link Intent} to launch when clicked.
-         */
-        public IntentClickListener(Activity parent, Intent intent) {
-            mParent = parent;
-            mIntent = intent;
-        }
-
-        public void onClick(DialogInterface dialog, int which) {
-            if (mIntent != null) {
-                mParent.startActivity(mIntent);
-            }
-            mParent.finish();
-        }
-    }
-
-    @Override
-    public void startSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData,
-            boolean globalSearch) {
-        if (globalSearch) {
-            super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
-        } else {
-            ContactsSearchManager.startSearch(this, initialQuery);
-        }
-    }
-}
diff --git a/src/com/android/contacts/ui/ViewIdGenerator.java b/src/com/android/contacts/ui/ViewIdGenerator.java
deleted file mode 100644
index f7281d4..0000000
--- a/src/com/android/contacts/ui/ViewIdGenerator.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui;
-
-import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.ui.widget.GenericEditorView;
-import com.android.contacts.ui.widget.KindSectionView;
-
-import android.os.Bundle;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * A class that provides unique view ids for {@link ContentEditorView}, {@link KindSectionView},
- * {@link GenericEditorView} and {@link EditView} on {@link EditContactActivity}.
- * It is used to assign a unique but consistent id to each view across {@link EditContactActivity}'s
- * lifecycle, so that we can re-construct view state (e.g. focused view) when the screen rotates.
- *
- * <p>This class is not thread safe.
- */
-public final class ViewIdGenerator implements Parcelable {
-    private static final int INVALID_VIEW_ID = 0;
-    private static final int INITIAL_VIEW_ID = 1;
-
-    public static final int NO_VIEW_INDEX = -1;
-
-    private int mNextId;
-
-    /**
-     * Used as a map from the "key" of the views to actual ids.  {@link #getId()} generates keys for
-     * the views.
-     */
-    private Bundle mIdMap = new Bundle();
-
-    private static final char KEY_SEPARATOR = '*';
-
-    private final static StringBuilder sWorkStringBuilder = new StringBuilder();
-
-    public ViewIdGenerator() {
-        mNextId = INITIAL_VIEW_ID;
-    }
-
-    /** {@inheritDoc} */
-    public int describeContents() {
-        return 0;
-    }
-
-    /**
-     * Returns an id for a view associated with specified contact field.
-     *
-     * @param entity {@link EntityDelta} associated with the view
-     * @param kind {@link DataKind} associated with the view, or null if none exists.
-     * @param values {@link ValuesDelta} associated with the view, or null if none exists.
-     * @param viewIndex index of the view in the parent {@link Editor}, if it's a leave view.
-     *     Otherwise, pass {@link #NO_VIEW_INDEX}.
-     */
-    public int getId(EntityDelta entity, DataKind kind, ValuesDelta values,
-            int viewIndex) {
-        final String k = getMapKey(entity, kind, values, viewIndex);
-
-        int id = mIdMap.getInt(k, INVALID_VIEW_ID);
-        if (id == INVALID_VIEW_ID) {
-            // Make sure the new id won't conflict with auto-generated ids by masking with 0xffff.
-            id = (mNextId++) & 0xFFFF;
-            mIdMap.putInt(k, id);
-        }
-        return id;
-    }
-
-    private static String getMapKey(EntityDelta entity, DataKind kind, ValuesDelta values,
-            int viewIndex) {
-        sWorkStringBuilder.setLength(0);
-        if (entity != null) {
-            sWorkStringBuilder.append(entity.getValues().getId());
-
-            if (kind != null) {
-                sWorkStringBuilder.append(KEY_SEPARATOR);
-                sWorkStringBuilder.append(kind.mimeType);
-
-                if (values != null) {
-                    sWorkStringBuilder.append(KEY_SEPARATOR);
-                    sWorkStringBuilder.append(values.getId());
-
-                    if (viewIndex != NO_VIEW_INDEX) {
-                        sWorkStringBuilder.append(KEY_SEPARATOR);
-                        sWorkStringBuilder.append(viewIndex);
-                    }
-                }
-            }
-        }
-        return sWorkStringBuilder.toString();
-    }
-
-    /** {@Override} */
-    public void writeToParcel(Parcel dest, int flags) {
-        dest.writeInt(mNextId);
-        dest.writeBundle(mIdMap);
-    }
-
-    private void readFromParcel(Parcel src) {
-        mNextId = src.readInt();
-        mIdMap = src.readBundle();
-    }
-
-    public static final Parcelable.Creator<ViewIdGenerator> CREATOR =
-            new Parcelable.Creator<ViewIdGenerator>() {
-        public ViewIdGenerator createFromParcel(Parcel in) {
-            final ViewIdGenerator vig = new ViewIdGenerator();
-            vig.readFromParcel(in);
-            return vig;
-        }
-
-        public ViewIdGenerator[] newArray(int size) {
-            return new ViewIdGenerator[size];
-        }
-    };
-}
diff --git a/src/com/android/contacts/ui/widget/BaseContactEditorView.java b/src/com/android/contacts/ui/widget/BaseContactEditorView.java
deleted file mode 100644
index c2f9136..0000000
--- a/src/com/android/contacts/ui/widget/BaseContactEditorView.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui.widget;
-
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.EntityModifier;
-import com.android.contacts.model.ContactsSource.EditType;
-import com.android.contacts.model.Editor.EditorListener;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.ui.ViewIdGenerator;
-
-import android.content.Context;
-import android.content.Entity;
-import android.graphics.Bitmap;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Photo;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.widget.LinearLayout;
-
-/**
- * Base view that provides common code for the editor interaction for a specific
- * RawContact represented through an {@link EntityDelta}. Callers can
- * reuse this view and quickly rebuild its contents through
- * {@link #setState(EntityDelta, ContactsSource)}.
- * <p>
- * Internal updates are performed against {@link ValuesDelta} so that the
- * source {@link Entity} can be swapped out. Any state-based changes, such as
- * adding {@link Data} rows or changing {@link EditType}, are performed through
- * {@link EntityModifier} to ensure that {@link ContactsSource} are enforced.
- */
-public abstract class BaseContactEditorView extends LinearLayout {
-    protected LayoutInflater mInflater;
-
-    protected PhotoEditorView mPhoto;
-    protected boolean mHasPhotoEditor = false;
-
-    public BaseContactEditorView(Context context) {
-        super(context);
-    }
-
-    public BaseContactEditorView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    /**
-     * Assign the given {@link Bitmap} to the internal {@link PhotoEditorView}
-     * for the {@link EntityDelta} currently being edited.
-     */
-    public void setPhotoBitmap(Bitmap bitmap) {
-        mPhoto.setPhotoBitmap(bitmap);
-    }
-
-    /**
-     * Return true if the current {@link RawContacts} supports {@link Photo},
-     * which means that {@link PhotoEditorView} is enabled.
-     */
-    public boolean hasPhotoEditor() {
-        return mHasPhotoEditor;
-    }
-
-    /**
-     * Return true if internal {@link PhotoEditorView} has a {@link Photo} set.
-     */
-    public boolean hasSetPhoto() {
-        return mPhoto.hasSetPhoto();
-    }
-
-    public PhotoEditorView getPhotoEditor() {
-        return mPhoto;
-    }
-
-    /**
-     * @return the RawContact ID that this editor is editing.
-     */
-    public abstract long getRawContactId();
-
-    /**
-     * Set the internal state for this view, given a current
-     * {@link EntityDelta} state and the {@link ContactsSource} that
-     * apply to that state.
-     */
-    public abstract void setState(EntityDelta state, ContactsSource source, ViewIdGenerator vig);
-
-    /**
-     * Sets the {@link EditorListener} on the name field
-     */
-    public abstract void setNameEditorListener(EditorListener listener);
-}
diff --git a/src/com/android/contacts/ui/widget/CheckableImageView.java b/src/com/android/contacts/ui/widget/CheckableImageView.java
deleted file mode 100644
index ff5abc0..0000000
--- a/src/com/android/contacts/ui/widget/CheckableImageView.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2008 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.contacts.ui.widget;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.widget.Checkable;
-import android.widget.ImageView;
-
-/**
- * A special variation of ImageView that can be used as a checkable object.
- * This is used as the background view of quickcontact chiclet, which is in checked state
- * when disambig list is shown. Otherwise, it works identically to a ImageView.
- */
-public class CheckableImageView extends ImageView implements Checkable {
-    private boolean mChecked;
-
-    private static final int[] CHECKED_STATE_SET = {
-        android.R.attr.state_checked
-    };
-
-    public CheckableImageView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    @Override
-    public int[] onCreateDrawableState(int extraSpace) {
-        final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
-        if (isChecked()) {
-            mergeDrawableStates(drawableState, CHECKED_STATE_SET);
-        }
-        return drawableState;
-    }
-
-    public void toggle() {
-        setChecked(!mChecked);
-    }
-
-    public boolean isChecked() {
-        return mChecked;
-    }
-
-    public void setChecked(boolean checked) {
-        if (mChecked != checked) {
-            mChecked = checked;
-            refreshDrawableState();
-        }
-    }
-}
diff --git a/src/com/android/contacts/ui/widget/ContactEditorView.java b/src/com/android/contacts/ui/widget/ContactEditorView.java
deleted file mode 100644
index 83bf2fb..0000000
--- a/src/com/android/contacts/ui/widget/ContactEditorView.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui.widget;
-
-import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.EntityModifier;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.EditType;
-import com.android.contacts.model.Editor.EditorListener;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.ui.ViewIdGenerator;
-
-import android.content.Context;
-import android.content.Entity;
-import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Photo;
-import android.provider.ContactsContract.CommonDataKinds.StructuredName;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.View.OnClickListener;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-/**
- * Custom view that provides all the editor interaction for a specific
- * {@link Contacts} represented through an {@link EntityDelta}. Callers can
- * reuse this view and quickly rebuild its contents through
- * {@link #setState(EntityDelta, ContactsSource)}.
- * <p>
- * Internal updates are performed against {@link ValuesDelta} so that the
- * source {@link Entity} can be swapped out. Any state-based changes, such as
- * adding {@link Data} rows or changing {@link EditType}, are performed through
- * {@link EntityModifier} to ensure that {@link ContactsSource} are enforced.
- */
-public class ContactEditorView extends BaseContactEditorView implements OnClickListener {
-    private TextView mReadOnly;
-    private TextView mReadOnlyName;
-
-    private View mPhotoStub;
-    private GenericEditorView mName;
-
-    private boolean mIsSourceReadOnly;
-    private ViewGroup mGeneral;
-    private ViewGroup mSecondary;
-    private boolean mSecondaryVisible;
-
-    private TextView mSecondaryHeader;
-
-    private Drawable mSecondaryOpen;
-    private Drawable mSecondaryClosed;
-
-    private View mHeaderColorBar;
-    private View mSideBar;
-    private ImageView mHeaderIcon;
-    private TextView mHeaderAccountType;
-    private TextView mHeaderAccountName;
-
-    private long mRawContactId = -1;
-
-    public ContactEditorView(Context context) {
-        super(context);
-    }
-
-    public ContactEditorView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void onFinishInflate() {
-        super.onFinishInflate();
-
-        mInflater = (LayoutInflater)getContext().getSystemService(
-                Context.LAYOUT_INFLATER_SERVICE);
-
-        mPhoto = (PhotoEditorView)findViewById(R.id.edit_photo);
-        mPhotoStub = findViewById(R.id.stub_photo);
-
-        final int photoSize = getResources().getDimensionPixelSize(R.dimen.edit_photo_size);
-
-        mReadOnly = (TextView)findViewById(R.id.edit_read_only);
-
-        mName = (GenericEditorView)findViewById(R.id.edit_name);
-        mName.setMinimumHeight(photoSize);
-        mName.setDeletable(false);
-
-        mReadOnlyName = (TextView) findViewById(R.id.read_only_name);
-
-        mGeneral = (ViewGroup)findViewById(R.id.sect_general);
-        mSecondary = (ViewGroup)findViewById(R.id.sect_secondary);
-
-        mHeaderColorBar = findViewById(R.id.header_color_bar);
-        mSideBar = findViewById(R.id.color_bar);
-        mHeaderIcon = (ImageView) findViewById(R.id.header_icon);
-        mHeaderAccountType = (TextView) findViewById(R.id.header_account_type);
-        mHeaderAccountName = (TextView) findViewById(R.id.header_account_name);
-
-        mSecondaryHeader = (TextView)findViewById(R.id.head_secondary);
-        mSecondaryHeader.setOnClickListener(this);
-
-        final Resources res = getResources();
-        mSecondaryOpen = res.getDrawable(com.android.internal.R.drawable.expander_ic_maximized);
-        mSecondaryClosed = res.getDrawable(com.android.internal.R.drawable.expander_ic_minimized);
-
-        this.setSecondaryVisible(false);
-    }
-
-    /** {@inheritDoc} */
-    public void onClick(View v) {
-        // Toggle visibility of secondary kinds
-        final boolean makeVisible = mSecondary.getVisibility() != View.VISIBLE;
-        this.setSecondaryVisible(makeVisible);
-    }
-
-    /**
-     * Set the visibility of secondary sections, along with header icon.
-     *
-     * <p>If the source is read-only and there's no secondary fields, the entire secondary section
-     * will be hidden.
-     */
-    private void setSecondaryVisible(boolean makeVisible) {
-        mSecondaryVisible = makeVisible;
-
-        if (!mIsSourceReadOnly && mSecondary.getChildCount() > 0) {
-            mSecondaryHeader.setVisibility(View.VISIBLE);
-            mSecondaryHeader.setCompoundDrawablesWithIntrinsicBounds(
-                    makeVisible ? mSecondaryOpen : mSecondaryClosed, null, null, null);
-            mSecondary.setVisibility(makeVisible ? View.VISIBLE : View.GONE);
-        } else {
-            mSecondaryHeader.setVisibility(View.GONE);
-            mSecondary.setVisibility(View.GONE);
-        }
-    }
-
-    /**
-     * Set the internal state for this view, given a current
-     * {@link EntityDelta} state and the {@link ContactsSource} that
-     * apply to that state.
-     */
-    @Override
-    public void setState(EntityDelta state, ContactsSource source, ViewIdGenerator vig) {
-        // Remove any existing sections
-        mGeneral.removeAllViews();
-        mSecondary.removeAllViews();
-
-        // Bail if invalid state or source
-        if (state == null || source == null) return;
-
-        setId(vig.getId(state, null, null, ViewIdGenerator.NO_VIEW_INDEX));
-
-        mIsSourceReadOnly = source.readOnly;
-
-        // Make sure we have StructuredName
-        EntityModifier.ensureKindExists(state, source, StructuredName.CONTENT_ITEM_TYPE);
-
-        // Fill in the header info
-        ValuesDelta values = state.getValues();
-        String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
-        CharSequence accountType = source.getDisplayLabel(mContext);
-        if (TextUtils.isEmpty(accountType)) {
-            accountType = mContext.getString(R.string.account_phone);
-        }
-        if (!TextUtils.isEmpty(accountName)) {
-            mHeaderAccountName.setText(
-                    mContext.getString(R.string.from_account_format, accountName));
-        }
-        mHeaderAccountType.setText(mContext.getString(R.string.account_type_format, accountType));
-        mHeaderIcon.setImageDrawable(source.getDisplayIcon(mContext));
-
-        mRawContactId = values.getAsLong(RawContacts._ID);
-
-        // Show photo editor when supported
-        EntityModifier.ensureKindExists(state, source, Photo.CONTENT_ITEM_TYPE);
-        mHasPhotoEditor = (source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null);
-        mPhoto.setVisibility(mHasPhotoEditor ? View.VISIBLE : View.GONE);
-        mPhoto.setEnabled(!mIsSourceReadOnly);
-        mName.setEnabled(!mIsSourceReadOnly);
-
-        // Show and hide the appropriate views
-        if (mIsSourceReadOnly) {
-            mGeneral.setVisibility(View.GONE);
-            mName.setVisibility(View.GONE);
-            mReadOnly.setVisibility(View.VISIBLE);
-            mReadOnly.setText(mContext.getString(R.string.contact_read_only, accountType));
-            mReadOnlyName.setVisibility(View.VISIBLE);
-        } else {
-            mGeneral.setVisibility(View.VISIBLE);
-            mName.setVisibility(View.VISIBLE);
-            mReadOnly.setVisibility(View.GONE);
-            mReadOnlyName.setVisibility(View.GONE);
-        }
-
-        boolean anySecondaryFieldFilled = false;
-        // Create editor sections for each possible data kind
-        for (DataKind kind : source.getSortedDataKinds()) {
-            // Skip kind of not editable
-            if (!kind.editable) continue;
-
-            final String mimeType = kind.mimeType;
-            if (StructuredName.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                // Handle special case editor for structured name
-                final ValuesDelta primary = state.getPrimaryEntry(mimeType);
-                if (!mIsSourceReadOnly) {
-                    mName.setValues(kind, primary, state, mIsSourceReadOnly, vig);
-                } else {
-                    String displayName = primary.getAsString(StructuredName.DISPLAY_NAME);
-                    mReadOnlyName.setText(displayName);
-                }
-            } else if (Photo.CONTENT_ITEM_TYPE.equals(mimeType)) {
-                // Handle special case editor for photos
-                final ValuesDelta primary = state.getPrimaryEntry(mimeType);
-                mPhoto.setValues(kind, primary, state, mIsSourceReadOnly, vig);
-                if (mIsSourceReadOnly && !mPhoto.hasSetPhoto()) {
-                    mPhotoStub.setVisibility(View.GONE);
-                } else {
-                    mPhotoStub.setVisibility(View.VISIBLE);
-                }
-            } else if (!mIsSourceReadOnly) {
-                // Otherwise use generic section-based editors
-                if (kind.fieldList == null) continue;
-                final ViewGroup parent = kind.secondary ? mSecondary : mGeneral;
-                final KindSectionView section = (KindSectionView)mInflater.inflate(
-                        R.layout.item_kind_section, parent, false);
-                section.setState(kind, state, mIsSourceReadOnly, vig);
-                if (kind.secondary && section.isAnyEditorFilledOut()) {
-                    anySecondaryFieldFilled = true;
-                }
-                parent.addView(section);
-            }
-        }
-
-        setSecondaryVisible(anySecondaryFieldFilled);
-    }
-
-    /**
-     * Sets the {@link EditorListener} on the name field
-     */
-    @Override
-    public void setNameEditorListener(EditorListener listener) {
-        mName.setEditorListener(listener);
-    }
-
-    @Override
-    public long getRawContactId() {
-        return mRawContactId;
-    }
-
-    private static class SavedState extends BaseSavedState {
-        public boolean mSecondaryVisible;
-
-        SavedState(Parcelable superState) {
-            super(superState);
-        }
-
-        private SavedState(Parcel in) {
-            super(in);
-            mSecondaryVisible = (in.readInt() == 0 ? false : true);
-        }
-
-        @Override
-        public void writeToParcel(Parcel out, int flags) {
-            super.writeToParcel(out, flags);
-            out.writeInt(mSecondaryVisible ? 1 : 0);
-        }
-
-        public static final Parcelable.Creator<SavedState> CREATOR
-                = new Parcelable.Creator<SavedState>() {
-            public SavedState createFromParcel(Parcel in) {
-                return new SavedState(in);
-            }
-
-            public SavedState[] newArray(int size) {
-                return new SavedState[size];
-            }
-        };
-    }
-
-    /**
-     * Saves the visibility of the secondary field.
-     */
-    @Override
-    protected Parcelable onSaveInstanceState() {
-        Parcelable superState = super.onSaveInstanceState();
-        SavedState ss = new SavedState(superState);
-
-        ss.mSecondaryVisible = mSecondaryVisible;
-        return ss;
-    }
-
-    /**
-     * Restores the visibility of the secondary field.
-     */
-    @Override
-    protected void onRestoreInstanceState(Parcelable state) {
-        SavedState ss = (SavedState) state;
-        super.onRestoreInstanceState(ss.getSuperState());
-
-        setSecondaryVisible(ss.mSecondaryVisible);
-    }
-}
diff --git a/src/com/android/contacts/ui/widget/DontPressWithParentImageView.java b/src/com/android/contacts/ui/widget/DontPressWithParentImageView.java
deleted file mode 100644
index bdb0e0a..0000000
--- a/src/com/android/contacts/ui/widget/DontPressWithParentImageView.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui.widget;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.ImageView;
-
-/**
- * Special class to to allow the parent to be pressed without being pressed itself.
- * This way the line of a tab can be pressed, but the image itself is not.
- */
-public class DontPressWithParentImageView extends ImageView {
-
-    public DontPressWithParentImageView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    @Override
-    public void setPressed(boolean pressed) {
-        // If the parent is pressed, do not set to pressed.
-        if (pressed && ((View) getParent()).isPressed()) {
-            return;
-        }
-        super.setPressed(pressed);
-    }
-}
diff --git a/src/com/android/contacts/ui/widget/GenericEditorView.java b/src/com/android/contacts/ui/widget/GenericEditorView.java
deleted file mode 100644
index 24262bb..0000000
--- a/src/com/android/contacts/ui/widget/GenericEditorView.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui.widget;
-
-import com.android.contacts.ContactsUtils;
-import com.android.contacts.R;
-import com.android.contacts.model.Editor;
-import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.EntityModifier;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.EditField;
-import com.android.contacts.model.ContactsSource.EditType;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.ui.ViewIdGenerator;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Entity;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.telephony.PhoneNumberFormattingTextWatcher;
-import android.text.Editable;
-import android.text.InputType;
-import android.text.TextUtils;
-import android.text.TextWatcher;
-import android.util.AttributeSet;
-import android.view.ContextThemeWrapper;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.inputmethod.EditorInfo;
-import android.widget.ArrayAdapter;
-import android.widget.EditText;
-import android.widget.ListAdapter;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import java.util.List;
-
-/**
- * Simple editor that handles labels and any {@link EditField} defined for
- * the entry. Uses {@link ValuesDelta} to read any existing
- * {@link Entity} values, and to correctly write any changes values.
- */
-public class GenericEditorView extends RelativeLayout implements Editor, View.OnClickListener {
-    protected static final int RES_FIELD = R.layout.item_editor_field;
-    protected static final int RES_LABEL_ITEM = android.R.layout.simple_list_item_1;
-
-    protected LayoutInflater mInflater;
-
-    protected static final int INPUT_TYPE_CUSTOM = EditorInfo.TYPE_CLASS_TEXT
-            | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS;
-
-    protected TextView mLabel;
-    protected ViewGroup mFields;
-    protected View mDelete;
-    protected View mMore;
-    protected View mLess;
-
-    protected DataKind mKind;
-    protected ValuesDelta mEntry;
-    protected EntityDelta mState;
-    protected boolean mReadOnly;
-
-    protected boolean mHideOptional = true;
-
-    protected EditType mType;
-    // Used only when a user tries to use custom label.
-    private EditType mPendingType;
-
-    private ViewIdGenerator mViewIdGenerator;
-
-    public GenericEditorView(Context context) {
-        super(context);
-    }
-
-    public GenericEditorView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void onFinishInflate() {
-        mInflater = (LayoutInflater)getContext().getSystemService(
-                Context.LAYOUT_INFLATER_SERVICE);
-
-        mLabel = (TextView)findViewById(R.id.edit_label);
-        mLabel.setOnClickListener(this);
-
-        mFields = (ViewGroup)findViewById(R.id.edit_fields);
-
-        mDelete = findViewById(R.id.edit_delete);
-        mDelete.setOnClickListener(this);
-
-        mMore = findViewById(R.id.edit_more);
-        mMore.setOnClickListener(this);
-
-        mLess = findViewById(R.id.edit_less);
-        mLess.setOnClickListener(this);
-    }
-
-    protected EditorListener mListener;
-
-    public void setEditorListener(EditorListener listener) {
-        mListener = listener;
-    }
-
-    public void setDeletable(boolean deletable) {
-        mDelete.setVisibility(deletable ? View.VISIBLE : View.INVISIBLE);
-    }
-
-    @Override
-    public void setEnabled(boolean enabled) {
-        mLabel.setEnabled(enabled);
-        final int count = mFields.getChildCount();
-        for (int pos = 0; pos < count; pos++) {
-            final View v = mFields.getChildAt(pos);
-            v.setEnabled(enabled);
-        }
-        mMore.setEnabled(enabled);
-        mLess.setEnabled(enabled);
-    }
-
-    /**
-     * Build the current label state based on selected {@link EditType} and
-     * possible custom label string.
-     */
-    private void rebuildLabel() {
-        // Handle undetected types
-        if (mType == null) {
-            mLabel.setText(R.string.unknown);
-            return;
-        }
-
-        if (mType.customColumn != null) {
-            // Use custom label string when present
-            final String customText = mEntry.getAsString(mType.customColumn);
-            if (customText != null) {
-                mLabel.setText(customText);
-                return;
-            }
-        }
-
-        // Otherwise fall back to using default label
-        mLabel.setText(mType.labelRes);
-    }
-
-    /** {@inheritDoc} */
-    public void onFieldChanged(String column, String value) {
-        // Field changes are saved directly
-        mEntry.put(column, value);
-        if (mListener != null) {
-            mListener.onRequest(EditorListener.FIELD_CHANGED);
-        }
-    }
-
-    public boolean isAnyFieldFilledOut() {
-        int childCount = mFields.getChildCount();
-        for (int i = 0; i < childCount; i++) {
-            EditText editorView = (EditText) mFields.getChildAt(i);
-            if (!TextUtils.isEmpty(editorView.getText())) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private void rebuildValues() {
-        setValues(mKind, mEntry, mState, mReadOnly, mViewIdGenerator);
-    }
-
-    /**
-     * Prepare this editor using the given {@link DataKind} for defining
-     * structure and {@link ValuesDelta} describing the content to edit.
-     */
-    public void setValues(DataKind kind, ValuesDelta entry, EntityDelta state, boolean readOnly,
-            ViewIdGenerator vig) {
-        mKind = kind;
-        mEntry = entry;
-        mState = state;
-        mReadOnly = readOnly;
-        mViewIdGenerator = vig;
-        setId(vig.getId(state, kind, entry, ViewIdGenerator.NO_VIEW_INDEX));
-
-        final boolean enabled = !readOnly;
-
-        if (!entry.isVisible()) {
-            // Hide ourselves entirely if deleted
-            setVisibility(View.GONE);
-            return;
-        } else {
-            setVisibility(View.VISIBLE);
-        }
-
-        // Display label selector if multiple types available
-        final boolean hasTypes = EntityModifier.hasEditTypes(kind);
-        mLabel.setVisibility(hasTypes ? View.VISIBLE : View.GONE);
-        mLabel.setEnabled(enabled);
-        if (hasTypes) {
-            mType = EntityModifier.getCurrentType(entry, kind);
-            rebuildLabel();
-        }
-
-        // Build out set of fields
-        mFields.removeAllViews();
-        boolean hidePossible = false;
-        int n = 0;
-        for (EditField field : kind.fieldList) {
-            // Inflate field from definition
-            EditText fieldView = (EditText)mInflater.inflate(RES_FIELD, mFields, false);
-            fieldView.setId(vig.getId(state, kind, entry, n++));
-            if (field.titleRes > 0) {
-                fieldView.setHint(field.titleRes);
-            }
-            int inputType = field.inputType;
-            fieldView.setInputType(inputType);
-            if (inputType == InputType.TYPE_CLASS_PHONE) {
-                fieldView.addTextChangedListener(new PhoneNumberFormattingTextWatcher());
-            }
-            fieldView.setMinLines(field.minLines);
-
-            // Read current value from state
-            final String column = field.column;
-            final String value = entry.getAsString(column);
-            fieldView.setText(value);
-
-            // Prepare listener for writing changes
-            fieldView.addTextChangedListener(new TextWatcher() {
-                public void afterTextChanged(Editable s) {
-                    // Trigger event for newly changed value
-                    onFieldChanged(column, s.toString());
-                }
-
-                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-                }
-
-                public void onTextChanged(CharSequence s, int start, int before, int count) {
-                }
-            });
-
-            // Hide field when empty and optional value
-            final boolean couldHide = (!ContactsUtils.isGraphic(value) && field.optional);
-            final boolean willHide = (mHideOptional && couldHide);
-            fieldView.setVisibility(willHide ? View.GONE : View.VISIBLE);
-            fieldView.setEnabled(enabled);
-            hidePossible = hidePossible || couldHide;
-
-            mFields.addView(fieldView);
-        }
-
-        // When hiding fields, place expandable
-        if (hidePossible) {
-            mMore.setVisibility(mHideOptional ? View.VISIBLE : View.GONE);
-            mLess.setVisibility(mHideOptional ? View.GONE : View.VISIBLE);
-        } else {
-            mMore.setVisibility(View.GONE);
-            mLess.setVisibility(View.GONE);
-        }
-        mMore.setEnabled(enabled);
-        mLess.setEnabled(enabled);
-    }
-
-    /**
-     * Prepare dialog for entering a custom label. The input value is trimmed: white spaces before
-     * and after the input text is removed.
-     * <p>
-     * If the final value is empty, this change request is ignored;
-     * no empty text is allowed in any custom label.
-     */
-    private Dialog createCustomDialog() {
-        final EditText customType = new EditText(mContext);
-        customType.setInputType(INPUT_TYPE_CUSTOM);
-        customType.requestFocus();
-
-        final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
-        builder.setTitle(R.string.customLabelPickerTitle);
-        builder.setView(customType);
-
-        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                final String customText = customType.getText().toString().trim();
-                if (ContactsUtils.isGraphic(customText)) {
-                    // Now we're sure it's ok to actually change the type value.
-                    mType = mPendingType;
-                    mPendingType = null;
-                    mEntry.put(mKind.typeColumn, mType.rawValue);
-                    mEntry.put(mType.customColumn, customText);
-                    rebuildLabel();
-                    if (!mFields.hasFocus())
-                        mFields.requestFocus();
-                }
-            }
-        });
-
-        builder.setNegativeButton(android.R.string.cancel, null);
-
-        return builder.create();
-    }
-
-    /**
-     * Prepare dialog for picking a new {@link EditType} or entering a
-     * custom label. This dialog is limited to the valid types as determined
-     * by {@link EntityModifier}.
-     */
-    public Dialog createLabelDialog() {
-        // Build list of valid types, including the current value
-        final List<EditType> validTypes = EntityModifier.getValidTypes(mState, mKind, mType);
-
-        // Wrap our context to inflate list items using correct theme
-        final Context dialogContext = new ContextThemeWrapper(mContext,
-                android.R.style.Theme_Light);
-        final LayoutInflater dialogInflater = mInflater.cloneInContext(dialogContext);
-
-        final ListAdapter typeAdapter = new ArrayAdapter<EditType>(mContext, RES_LABEL_ITEM,
-                validTypes) {
-            @Override
-            public View getView(int position, View convertView, ViewGroup parent) {
-                if (convertView == null) {
-                    convertView = dialogInflater.inflate(RES_LABEL_ITEM, parent, false);
-                }
-
-                final EditType type = this.getItem(position);
-                final TextView textView = (TextView)convertView;
-                textView.setText(type.labelRes);
-                return textView;
-            }
-        };
-
-        final DialogInterface.OnClickListener clickListener =
-                new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                dialog.dismiss();
-
-                final EditType selected = validTypes.get(which);
-                if (selected.customColumn != null) {
-                    // Show custom label dialog if requested by type.
-                    //
-                    // Only when the custum value input in the next step is correct one.
-                    // this method also set the type value to what the user requested here.
-                    mPendingType = selected;
-                    createCustomDialog().show();
-                } else {
-                    // User picked type, and we're sure it's ok to actually write the entry.
-                    mType = selected;
-                    mEntry.put(mKind.typeColumn, mType.rawValue);
-                    rebuildLabel();
-                    if (!mFields.hasFocus())
-                        mFields.requestFocus();
-                }
-            }
-        };
-
-        final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
-        builder.setTitle(R.string.selectLabel);
-        builder.setSingleChoiceItems(typeAdapter, 0, clickListener);
-        return builder.create();
-    }
-
-    /** {@inheritDoc} */
-    public void onClick(View v) {
-        switch (v.getId()) {
-            case R.id.edit_label: {
-                createLabelDialog().show();
-                break;
-            }
-            case R.id.edit_delete: {
-                // Keep around in model, but mark as deleted
-                mEntry.markDeleted();
-
-                // Remove editor from parent view
-                final ViewGroup parent = (ViewGroup)getParent();
-                parent.removeView(this);
-
-                if (mListener != null) {
-                    // Notify listener when present
-                    mListener.onDeleted(this);
-                }
-                break;
-            }
-            case R.id.edit_more:
-            case R.id.edit_less: {
-                mHideOptional = !mHideOptional;
-                rebuildValues();
-                break;
-            }
-        }
-    }
-
-    private static class SavedState extends BaseSavedState {
-        public boolean mHideOptional;
-        public int[] mVisibilities;
-
-        SavedState(Parcelable superState) {
-            super(superState);
-        }
-
-        private SavedState(Parcel in) {
-            super(in);
-            mVisibilities = new int[in.readInt()];
-            in.readIntArray(mVisibilities);
-        }
-
-        @Override
-        public void writeToParcel(Parcel out, int flags) {
-            super.writeToParcel(out, flags);
-            out.writeInt(mVisibilities.length);
-            out.writeIntArray(mVisibilities);
-        }
-
-        public static final Parcelable.Creator<SavedState> CREATOR
-                = new Parcelable.Creator<SavedState>() {
-            public SavedState createFromParcel(Parcel in) {
-                return new SavedState(in);
-            }
-
-            public SavedState[] newArray(int size) {
-                return new SavedState[size];
-            }
-        };
-    }
-
-    /**
-     * Saves the visibility of the child EditTexts, and mHideOptional.
-     */
-    @Override
-    protected Parcelable onSaveInstanceState() {
-        Parcelable superState = super.onSaveInstanceState();
-        SavedState ss = new SavedState(superState);
-
-        ss.mHideOptional = mHideOptional;
-
-        final int numChildren = mFields.getChildCount();
-        ss.mVisibilities = new int[numChildren];
-        for (int i = 0; i < numChildren; i++) {
-            ss.mVisibilities[i] = mFields.getChildAt(i).getVisibility();
-        }
-
-        return ss;
-    }
-
-    /**
-     * Restores the visibility of the child EditTexts, and mHideOptional.
-     */
-    @Override
-    protected void onRestoreInstanceState(Parcelable state) {
-        SavedState ss = (SavedState) state;
-        super.onRestoreInstanceState(ss.getSuperState());
-
-        mHideOptional = ss.mHideOptional;
-
-        int numChildren = Math.min(mFields.getChildCount(), ss.mVisibilities.length);
-        for (int i = 0; i < numChildren; i++) {
-            mFields.getChildAt(i).setVisibility(ss.mVisibilities[i]);
-        }
-    }
-}
diff --git a/src/com/android/contacts/ui/widget/KindSectionView.java b/src/com/android/contacts/ui/widget/KindSectionView.java
deleted file mode 100644
index 221bc16..0000000
--- a/src/com/android/contacts/ui/widget/KindSectionView.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui.widget;
-
-import com.android.contacts.R;
-import com.android.contacts.model.Editor;
-import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.EntityModifier;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.Editor.EditorListener;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.ui.ViewIdGenerator;
-
-import android.content.Context;
-import android.provider.ContactsContract.Data;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.View.OnClickListener;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-/**
- * Custom view for an entire section of data as segmented by
- * {@link DataKind} around a {@link Data#MIMETYPE}. This view shows a
- * section header and a trigger for adding new {@link Data} rows.
- */
-public class KindSectionView extends LinearLayout implements OnClickListener, EditorListener {
-    private static final String TAG = "KindSectionView";
-
-    private LayoutInflater mInflater;
-
-    private ViewGroup mEditors;
-    private View mAdd;
-    private ImageView mAddPlusButton;
-    private TextView mTitle;
-
-    private DataKind mKind;
-    private EntityDelta mState;
-    private boolean mReadOnly;
-
-    private ViewIdGenerator mViewIdGenerator;
-
-    public KindSectionView(Context context) {
-        super(context);
-    }
-
-    public KindSectionView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void onFinishInflate() {
-        mInflater = (LayoutInflater)getContext().getSystemService(
-                Context.LAYOUT_INFLATER_SERVICE);
-
-        setDrawingCacheEnabled(true);
-        setAlwaysDrawnWithCacheEnabled(true);
-
-        mEditors = (ViewGroup)findViewById(R.id.kind_editors);
-
-        mAdd = findViewById(R.id.kind_header);
-        mAdd.setOnClickListener(this);
-
-        mAddPlusButton = (ImageView) findViewById(R.id.kind_plus);
-
-        mTitle = (TextView)findViewById(R.id.kind_title);
-    }
-
-    /** {@inheritDoc} */
-    public void onDeleted(Editor editor) {
-        this.updateAddEnabled();
-        this.updateEditorsVisible();
-    }
-
-    /** {@inheritDoc} */
-    public void onRequest(int request) {
-        // Ignore requests
-    }
-
-    public void setState(DataKind kind, EntityDelta state, boolean readOnly, ViewIdGenerator vig) {
-        mKind = kind;
-        mState = state;
-        mReadOnly = readOnly;
-        mViewIdGenerator = vig;
-
-        setId(mViewIdGenerator.getId(state, kind, null, ViewIdGenerator.NO_VIEW_INDEX));
-
-        // TODO: handle resources from remote packages
-        mTitle.setText(kind.titleRes);
-
-        // Only show the add button if this is a list
-        mAddPlusButton.setVisibility(mKind.isList ? View.VISIBLE : View.GONE);
-
-        this.rebuildFromState();
-        this.updateAddEnabled();
-        this.updateEditorsVisible();
-    }
-
-    public boolean isAnyEditorFilledOut() {
-        if (mState == null) {
-            return false;
-        }
-
-        if (!mState.hasMimeEntries(mKind.mimeType)) {
-            return false;
-        }
-
-        int editorCount = mEditors.getChildCount();
-        for (int i = 0; i < editorCount; i++) {
-            GenericEditorView editorView = (GenericEditorView) mEditors.getChildAt(i);
-            if (editorView.isAnyFieldFilledOut()) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Build editors for all current {@link #mState} rows.
-     */
-    public void rebuildFromState() {
-        // Remove any existing editors
-        mEditors.removeAllViews();
-
-        // Check if we are displaying anything here
-        boolean hasEntries = mState.hasMimeEntries(mKind.mimeType);
-
-        if (!mKind.isList) {
-            if (hasEntries) {
-                // we might have no visible entries. check that, too
-                for (ValuesDelta entry : mState.getMimeEntries(mKind.mimeType)) {
-                    if (!entry.isVisible()) {
-                        hasEntries = false;
-                        break;
-                    }
-                }
-            }
-
-            if (!hasEntries) {
-                EntityModifier.insertChild(mState, mKind);
-                hasEntries = true;
-            }
-        }
-
-        if (hasEntries) {
-            int entryIndex = 0;
-            for (ValuesDelta entry : mState.getMimeEntries(mKind.mimeType)) {
-                // Skip entries that aren't visible
-                if (!entry.isVisible()) continue;
-
-                final GenericEditorView editor = (GenericEditorView)mInflater.inflate(
-                        R.layout.item_generic_editor, mEditors, false);
-                editor.setValues(mKind, entry, mState, mReadOnly, mViewIdGenerator);
-                // older versions of android had lists where we now have a single value
-                // in these cases we should show the remove button for all but the first value
-                // to ensure that nothing is removed
-                editor.mDelete.setVisibility((mKind.isList || (entryIndex != 0))
-                        ? View.VISIBLE : View.GONE);
-                editor.setEditorListener(this);
-                mEditors.addView(editor);
-                entryIndex++;
-            }
-        }
-    }
-
-    protected void updateEditorsVisible() {
-        final boolean hasChildren = mEditors.getChildCount() > 0;
-        mEditors.setVisibility(hasChildren ? View.VISIBLE : View.GONE);
-    }
-
-    protected void updateAddEnabled() {
-        // Set enabled state on the "add" view
-        final boolean canInsert = EntityModifier.canInsert(mState, mKind);
-        final boolean isEnabled = !mReadOnly && canInsert;
-        mAdd.setEnabled(isEnabled);
-    }
-
-    /** {@inheritDoc} */
-    public void onClick(View v) {
-        // if this is not a list the plus button is not visible but the user might have clicked
-        // the text.
-        if (!mKind.isList)
-            return;
-
-        // Insert a new child and rebuild
-        final ValuesDelta newValues = EntityModifier.insertChild(mState, mKind);
-        this.rebuildFromState();
-        this.updateAddEnabled();
-        this.updateEditorsVisible();
-
-        // Find the newly added EditView and set focus.
-        final int newFieldId = mViewIdGenerator.getId(mState, mKind, newValues, 0);
-        final View newField = findViewById(newFieldId);
-        if (newField != null) {
-            newField.requestFocus();
-        }
-    }
-}
diff --git a/src/com/android/contacts/ui/widget/PhotoEditorView.java b/src/com/android/contacts/ui/widget/PhotoEditorView.java
deleted file mode 100644
index eff39d0..0000000
--- a/src/com/android/contacts/ui/widget/PhotoEditorView.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui.widget;
-
-import com.android.contacts.R;
-import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.model.Editor;
-import com.android.contacts.ui.ViewIdGenerator;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.provider.ContactsContract.CommonDataKinds.Photo;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.ImageView;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-/**
- * Simple editor for {@link Photo}.
- */
-public class PhotoEditorView extends ImageView implements Editor, OnClickListener {
-    private static final String TAG = "PhotoEditorView";
-
-    private ValuesDelta mEntry;
-    private EditorListener mListener;
-
-    private boolean mHasSetPhoto = false;
-    private boolean mReadOnly;
-
-    public PhotoEditorView(Context context) {
-        super(context);
-    }
-
-    public PhotoEditorView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void onFinishInflate() {
-        super.onFinishInflate();
-        this.setOnClickListener(this);
-    }
-
-    /** {@inheritDoc} */
-    public void onClick(View v) {
-        if (mListener != null) {
-            mListener.onRequest(EditorListener.REQUEST_PICK_PHOTO);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void onFieldChanged(String column, String value) {
-        throw new UnsupportedOperationException("Photos don't support direct field changes");
-    }
-
-    /** {@inheritDoc} */
-    public void setValues(DataKind kind, ValuesDelta values, EntityDelta state, boolean readOnly,
-            ViewIdGenerator vig) {
-        mEntry = values;
-        mReadOnly = readOnly;
-
-        setId(vig.getId(state, kind, values, 0));
-
-        if (values != null) {
-            // Try decoding photo if actual entry
-            final byte[] photoBytes = values.getAsByteArray(Photo.PHOTO);
-            if (photoBytes != null) {
-                final Bitmap photo = BitmapFactory.decodeByteArray(photoBytes, 0,
-                        photoBytes.length);
-
-                setScaleType(ImageView.ScaleType.CENTER_CROP);
-                setImageBitmap(photo);
-                setEnabled(true);
-                mHasSetPhoto = true;
-                mEntry.setFromTemplate(false);
-            } else {
-                resetDefault();
-            }
-        } else {
-            resetDefault();
-        }
-    }
-
-    /**
-     * Return true if a valid {@link Photo} has been set.
-     */
-    public boolean hasSetPhoto() {
-        return mHasSetPhoto;
-    }
-
-    /**
-     * Assign the given {@link Bitmap} as the new value, updating UI and
-     * readying for persisting through {@link ValuesDelta}.
-     */
-    public void setPhotoBitmap(Bitmap photo) {
-        if (photo == null) {
-            // Clear any existing photo and return
-            mEntry.put(Photo.PHOTO, (byte[])null);
-            resetDefault();
-            return;
-        }
-
-        final int size = photo.getWidth() * photo.getHeight() * 4;
-        final ByteArrayOutputStream out = new ByteArrayOutputStream(size);
-
-        try {
-            photo.compress(Bitmap.CompressFormat.PNG, 100, out);
-            out.flush();
-            out.close();
-
-            mEntry.put(Photo.PHOTO, out.toByteArray());
-            setImageBitmap(photo);
-            setEnabled(true);
-            mHasSetPhoto = true;
-            mEntry.setFromTemplate(false);
-
-            // When the user chooses a new photo mark it as super primary
-            mEntry.put(Photo.IS_SUPER_PRIMARY, 1);
-        } catch (IOException e) {
-            Log.w(TAG, "Unable to serialize photo: " + e.toString());
-        }
-    }
-
-    /**
-     * Set the super primary bit on the photo.
-     */
-    public void setSuperPrimary(boolean superPrimary) {
-        mEntry.put(Photo.IS_SUPER_PRIMARY, superPrimary ? 1 : 0);
-    }
-
-    protected void resetDefault() {
-        // Invalid photo, show default "add photo" place-holder
-        setScaleType(ImageView.ScaleType.CENTER);
-        if (mReadOnly) {
-            setImageResource(R.drawable.ic_contact_picture);
-            setEnabled(false);
-        } else {
-            setImageResource(R.drawable.ic_menu_add_picture);
-            setEnabled(true);
-        }
-        mHasSetPhoto = false;
-        mEntry.setFromTemplate(true);
-    }
-
-    /** {@inheritDoc} */
-    public void setEditorListener(EditorListener listener) {
-        mListener = listener;
-    }
-}
diff --git a/src/com/android/contacts/ui/widget/ReadOnlyContactEditorView.java b/src/com/android/contacts/ui/widget/ReadOnlyContactEditorView.java
deleted file mode 100644
index 4635f6a..0000000
--- a/src/com/android/contacts/ui/widget/ReadOnlyContactEditorView.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts.ui.widget;
-
-import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.EntityModifier;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.EditType;
-import com.android.contacts.model.Editor.EditorListener;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.ui.ViewIdGenerator;
-
-import android.content.Context;
-import android.content.Entity;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.CommonDataKinds.Photo;
-import android.provider.ContactsContract.CommonDataKinds.StructuredName;
-import android.telephony.PhoneNumberUtils;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-
-/**
- * Custom view that displays read-only contacts in the edit screen.
- */
-class ReadOnlyContactEditorView extends BaseContactEditorView {
-
-    private View mPhotoStub;
-    private TextView mName;
-    private TextView mReadOnlyWarning;
-    private ViewGroup mGeneral;
-
-    private View mHeaderColorBar;
-    private View mSideBar;
-    private ImageView mHeaderIcon;
-    private TextView mHeaderAccountType;
-    private TextView mHeaderAccountName;
-
-    private long mRawContactId = -1;
-
-    public ReadOnlyContactEditorView(Context context) {
-        super(context);
-    }
-
-    public ReadOnlyContactEditorView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void onFinishInflate() {
-        super.onFinishInflate();
-
-        mInflater = (LayoutInflater)getContext().getSystemService(
-                Context.LAYOUT_INFLATER_SERVICE);
-
-        mPhoto = (PhotoEditorView)findViewById(R.id.edit_photo);
-        mPhotoStub = findViewById(R.id.stub_photo);
-
-        mName = (TextView) findViewById(R.id.read_only_name);
-        mReadOnlyWarning = (TextView) findViewById(R.id.read_only_warning);
-        mGeneral = (ViewGroup)findViewById(R.id.sect_general);
-
-        mHeaderColorBar = findViewById(R.id.header_color_bar);
-        mSideBar = findViewById(R.id.color_bar);
-        mHeaderIcon = (ImageView) findViewById(R.id.header_icon);
-        mHeaderAccountType = (TextView) findViewById(R.id.header_account_type);
-        mHeaderAccountName = (TextView) findViewById(R.id.header_account_name);
-    }
-
-    /**
-     * Set the internal state for this view, given a current
-     * {@link EntityDelta} state and the {@link ContactsSource} that
-     * apply to that state.
-     *
-     * TODO: make this more generic using data from the source
-     */
-    @Override
-    public void setState(EntityDelta state, ContactsSource source, ViewIdGenerator vig) {
-        // Remove any existing sections
-        mGeneral.removeAllViews();
-
-        // Bail if invalid state or source
-        if (state == null || source == null) return;
-
-        // Make sure we have StructuredName
-        EntityModifier.ensureKindExists(state, source, StructuredName.CONTENT_ITEM_TYPE);
-
-        // Fill in the header info
-        ValuesDelta values = state.getValues();
-        String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
-        CharSequence accountType = source.getDisplayLabel(mContext);
-        if (TextUtils.isEmpty(accountType)) {
-            accountType = mContext.getString(R.string.account_phone);
-        }
-        if (!TextUtils.isEmpty(accountName)) {
-            mHeaderAccountName.setText(
-                    mContext.getString(R.string.from_account_format, accountName));
-        }
-        mHeaderAccountType.setText(mContext.getString(R.string.account_type_format, accountType));
-        mHeaderIcon.setImageDrawable(source.getDisplayIcon(mContext));
-
-        mRawContactId = values.getAsLong(RawContacts._ID);
-
-        ValuesDelta primary;
-
-        // Photo
-        DataKind kind = source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE);
-        if (kind != null) {
-            EntityModifier.ensureKindExists(state, source, Photo.CONTENT_ITEM_TYPE);
-            mHasPhotoEditor = (source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null);
-            primary = state.getPrimaryEntry(Photo.CONTENT_ITEM_TYPE);
-            mPhoto.setValues(kind, primary, state, source.readOnly, vig);
-            if (!mHasPhotoEditor || !mPhoto.hasSetPhoto()) {
-                mPhotoStub.setVisibility(View.GONE);
-            } else {
-                mPhotoStub.setVisibility(View.VISIBLE);
-            }
-        } else {
-            mPhotoStub.setVisibility(View.VISIBLE);
-        }
-
-        // Name
-        primary = state.getPrimaryEntry(StructuredName.CONTENT_ITEM_TYPE);
-        mName.setText(primary.getAsString(StructuredName.DISPLAY_NAME));
-
-        // Read only warning
-        mReadOnlyWarning.setText(mContext.getString(R.string.contact_read_only, accountType));
-
-        // Phones
-        ArrayList<ValuesDelta> phones = state.getMimeEntries(Phone.CONTENT_ITEM_TYPE);
-        if (phones != null) {
-            for (ValuesDelta phone : phones) {
-                View field = mInflater.inflate(
-                        R.layout.item_read_only_field, mGeneral, false);
-                TextView v;
-                v = (TextView) field.findViewById(R.id.label);
-                v.setText(mContext.getText(R.string.phoneLabelsGroup));
-                v = (TextView) field.findViewById(R.id.data);
-                v.setText(PhoneNumberUtils.formatNumber(phone.getAsString(Phone.NUMBER)));
-                mGeneral.addView(field);
-            }
-        }
-
-        // Emails
-        ArrayList<ValuesDelta> emails = state.getMimeEntries(Email.CONTENT_ITEM_TYPE);
-        if (emails != null) {
-            for (ValuesDelta email : emails) {
-                View field = mInflater.inflate(
-                        R.layout.item_read_only_field, mGeneral, false);
-                TextView v;
-                v = (TextView) field.findViewById(R.id.label);
-                v.setText(mContext.getText(R.string.emailLabelsGroup));
-                v = (TextView) field.findViewById(R.id.data);
-                v.setText(email.getAsString(Email.DATA));
-                mGeneral.addView(field);
-            }
-        }
-
-        // Hide mGeneral if it's empty
-        if (mGeneral.getChildCount() > 0) {
-            mGeneral.setVisibility(View.VISIBLE);
-        } else {
-            mGeneral.setVisibility(View.GONE);
-        }
-    }
-
-    /**
-     * Sets the {@link EditorListener} on the name field
-     */
-    @Override
-    public void setNameEditorListener(EditorListener listener) {
-        // do nothing
-    }
-
-    @Override
-    public long getRawContactId() {
-        return mRawContactId;
-    }
-}
diff --git a/src/com/android/contacts/util/AccountSelectionUtil.java b/src/com/android/contacts/util/AccountSelectionUtil.java
index cc46d2b..6609a87 100644
--- a/src/com/android/contacts/util/AccountSelectionUtil.java
+++ b/src/com/android/contacts/util/AccountSelectionUtil.java
@@ -16,18 +16,13 @@
 
 package com.android.contacts.util;
 
-import com.android.contacts.ImportVCardActivity;
-import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.GoogleSource;
-import com.android.contacts.model.Sources;
-
 import android.accounts.Account;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.net.Uri;
 import android.util.Log;
 import android.view.ContextThemeWrapper;
 import android.view.LayoutInflater;
@@ -35,7 +30,10 @@
 import android.view.ViewGroup;
 import android.widget.ArrayAdapter;
 import android.widget.TextView;
-import android.net.Uri;
+
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountTypes;
 
 import java.util.List;
 
@@ -89,7 +87,7 @@
     public static Dialog getSelectAccountDialog(Context context, int resId,
             DialogInterface.OnClickListener onClickListener,
             DialogInterface.OnCancelListener onCancelListener) {
-        final Sources sources = Sources.getInstance(context);
+        final AccountTypes sources = AccountTypes.getInstance(context);
         final List<Account> writableAccountList = sources.getAccounts(true);
 
         // Assume accountList.size() > 1
@@ -118,9 +116,9 @@
                         (TextView)convertView.findViewById(android.R.id.text2);
 
                 final Account account = this.getItem(position);
-                final ContactsSource source =
+                final BaseAccountType source =
                     sources.getInflatedSource(account.type,
-                            ContactsSource.LEVEL_SUMMARY);
+                            BaseAccountType.LEVEL_SUMMARY);
                 final Context context = getContext();
 
                 text1.setText(account.name);
@@ -163,10 +161,6 @@
     }
 
     public static void doImportFromSim(Context context, Account account) {
-        if (account != null) {
-            GoogleSource.createMyContactsIfNotExist(account, context);
-        }
-
         Intent importIntent = new Intent(Intent.ACTION_VIEW);
         importIntent.setType("vnd.android.cursor.item/sim-contact");
         if (account != null) {
@@ -178,11 +172,8 @@
     }
 
     public static void doImportFromSdCard(Context context, Account account) {
-        if (account != null) {
-            GoogleSource.createMyContactsIfNotExist(account, context);
-        }
-
-        Intent importIntent = new Intent(context, ImportVCardActivity.class);
+        Intent importIntent = new Intent(context,
+                com.android.contacts.vcard.ImportVCardActivity.class);
         if (account != null) {
             importIntent.putExtra("account_name", account.name);
             importIntent.putExtra("account_type", account.type);
diff --git a/src/com/android/contacts/util/AccountsListAdapter.java b/src/com/android/contacts/util/AccountsListAdapter.java
new file mode 100644
index 0000000..09189bb
--- /dev/null
+++ b/src/com/android/contacts/util/AccountsListAdapter.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.util;
+
+import com.android.contacts.R;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.model.BaseAccountType;
+
+import android.accounts.Account;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import java.util.List;
+
+/**
+ * List-Adapter for Account selection
+ */
+public final class AccountsListAdapter extends BaseAdapter {
+    private final LayoutInflater mInflater;
+    private final List<Account> mAccounts;
+    private final AccountTypes mSources;
+    private final Context mContext;
+
+    public AccountsListAdapter(Context context, boolean writableOnly) {
+        mContext = context;
+        mSources = AccountTypes.getInstance(context);
+        mAccounts = mSources.getAccounts(writableOnly);
+        mInflater = LayoutInflater.from(context);
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        final View resultView = convertView != null ? convertView
+                : mInflater.inflate(R.layout.account_selector_list_item, parent, false);
+
+        final TextView text1 = (TextView)resultView.findViewById(android.R.id.text1);
+        final TextView text2 = (TextView)resultView.findViewById(android.R.id.text2);
+        final ImageView icon = (ImageView)resultView.findViewById(android.R.id.icon);
+
+        final Account account = mAccounts.get(position);
+        final BaseAccountType source = mSources.getInflatedSource(account.type,
+                BaseAccountType.LEVEL_SUMMARY);
+
+        text1.setText(account.name);
+        text2.setText(source.getDisplayLabel(mContext));
+        icon.setImageDrawable(source.getDisplayIcon(mContext));
+
+        return resultView;
+    }
+
+    @Override
+    public int getCount() {
+        return mAccounts.size();
+    }
+
+    @Override
+    public Account getItem(int position) {
+        return mAccounts.get(position);
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+}
+
diff --git a/src/com/android/contacts/util/Constants.java b/src/com/android/contacts/util/Constants.java
index a94608b..1d1e4e2 100644
--- a/src/com/android/contacts/util/Constants.java
+++ b/src/com/android/contacts/util/Constants.java
@@ -16,14 +16,8 @@
 
 package com.android.contacts.util;
 
-import android.app.Service;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
 
-/**
- * Background {@link Service} that is used to keep our process alive long enough
- * for background threads to finish. Started and stopped directly by specific
- * background tasks when needed.
- */
 public class Constants {
     /**
      * Specific MIME-type for {@link Phone#CONTENT_ITEM_TYPE} entries that
diff --git a/src/com/android/contacts/util/ContactBadgeUtil.java b/src/com/android/contacts/util/ContactBadgeUtil.java
new file mode 100644
index 0000000..d779701
--- /dev/null
+++ b/src/com/android/contacts/util/ContactBadgeUtil.java
@@ -0,0 +1,163 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.util;
+
+import com.android.contacts.R;
+import com.android.contacts.views.ContactLoader;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Entity;
+import android.content.Entity.NamedContentValues;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.Resources;
+import android.content.res.Resources.NotFoundException;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.SystemClock;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.text.TextUtils;
+import android.text.format.DateUtils;
+import android.util.Log;
+
+/**
+ * Provides static functions to extract summary information for aggregate contacts
+ */
+public class ContactBadgeUtil {
+    private static final String TAG = "ContactBadgeUtil";
+
+    /**
+     * Looks for the photo data item in entities. If found, creates a new Bitmap instance. If
+     * not found, returns null
+     */
+    public static Bitmap getPhoto(ContactLoader.Result contactData) {
+        final long photoId = contactData.getPhotoId();
+        if (photoId <= 0) {
+            // No photo ID
+            return null;
+        }
+
+        for (Entity entity : contactData.getEntities()) {
+            for (NamedContentValues subValue : entity.getSubValues()) {
+                final ContentValues entryValues = subValue.values;
+                final long dataId = entryValues.getAsLong(Data._ID);
+                if (dataId == photoId) {
+                    final String mimeType = entryValues.getAsString(Data.MIMETYPE);
+                    // Correct Data Id but incorrect MimeType? Don't load
+                    if (!Photo.CONTENT_ITEM_TYPE.equals(mimeType)) return null;
+                    final byte[] binaryData = entryValues.getAsByteArray(Photo.PHOTO);
+                    if (binaryData == null) return null;
+                    return BitmapFactory.decodeByteArray(binaryData, 0, binaryData.length);
+                }
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns the social snippet attribution, including the date
+     */
+    public static CharSequence getSocialDate(ContactLoader.Result contactData,
+            Context context) {
+        if (TextUtils.isEmpty(contactData.getSocialSnippet())) {
+            return null;
+        }
+
+        final CharSequence timestampDisplayValue;
+
+        final Long statusTimestamp = contactData.getStatusTimestamp();
+        if (statusTimestamp  != null) {
+            // Set the date/time field by mixing relative and absolute
+            // times.
+            int flags = DateUtils.FORMAT_ABBREV_RELATIVE;
+
+            timestampDisplayValue = DateUtils.getRelativeTimeSpanString(
+                    statusTimestamp.longValue(), System.currentTimeMillis(),
+                    DateUtils.MINUTE_IN_MILLIS, flags);
+        } else {
+            timestampDisplayValue = null;
+        }
+
+
+        String labelDisplayValue = null;
+
+        final Integer statusLabel = contactData.getStatusLabel();
+        final String statusResPackage = contactData.getStatusResPackage();
+        if (statusLabel  != null) {
+            Resources resources;
+            if (TextUtils.isEmpty(statusResPackage)) {
+                resources = context.getResources();
+            } else {
+                PackageManager pm = context.getPackageManager();
+                try {
+                    resources = pm.getResourcesForApplication(statusResPackage);
+                } catch (NameNotFoundException e) {
+                    Log.w(TAG, "Contact status update resource package not found: "
+                            + statusResPackage);
+                    resources = null;
+                }
+            }
+
+            if (resources != null) {
+                try {
+                    labelDisplayValue = resources.getString(statusLabel.intValue());
+                } catch (NotFoundException e) {
+                    Log.w(TAG, "Contact status update resource not found: " + statusResPackage + "@"
+                            + statusLabel.intValue());
+                }
+            }
+        }
+
+        final CharSequence attribution;
+        if (timestampDisplayValue != null && labelDisplayValue != null) {
+            attribution = context.getString(
+                    R.string.contact_status_update_attribution_with_date,
+                    timestampDisplayValue, labelDisplayValue);
+        } else if (timestampDisplayValue == null && labelDisplayValue != null) {
+            attribution = context.getString(
+                    R.string.contact_status_update_attribution,
+                    labelDisplayValue);
+        } else if (timestampDisplayValue != null) {
+            attribution = timestampDisplayValue;
+        } else {
+            attribution = null;
+        }
+        return attribution;
+    }
+
+    public static Bitmap loadPlaceholderPhoto(Context context) {
+        // Set the photo with a random "no contact" image
+        final long now = SystemClock.elapsedRealtime();
+        final int num = (int) now & 0xf;
+        final int resourceId;
+        if (num < 9) {
+            // Leaning in from right, common
+            resourceId = R.drawable.ic_contact_picture;
+        } else if (num < 14) {
+            // Leaning in from left uncommon
+            resourceId = R.drawable.ic_contact_picture_2;
+        } else {
+            // Coming in from the top, rare
+            resourceId = R.drawable.ic_contact_picture_3;
+        }
+
+        return BitmapFactory.decodeResource(context.getResources(), resourceId);
+    }
+}
diff --git a/src/com/android/contacts/util/DataStatus.java b/src/com/android/contacts/util/DataStatus.java
index 88c6594..ec3c1e5 100644
--- a/src/com/android/contacts/util/DataStatus.java
+++ b/src/com/android/contacts/util/DataStatus.java
@@ -24,6 +24,8 @@
 import android.text.TextUtils;
 import android.text.format.DateUtils;
 
+import com.android.contacts.R;
+
 /**
  * Storage for a social status update. Holds a single update, but can use
  * {@link #possibleUpdate(Cursor)} to consider updating when a better status
@@ -112,11 +114,11 @@
 
         if (validTimestamp && validLabel) {
             return context.getString(
-                    com.android.internal.R.string.contact_status_update_attribution_with_date,
+                    R.string.contact_status_update_attribution_with_date,
                     timeClause, labelClause);
         } else if (validLabel) {
             return context.getString(
-                    com.android.internal.R.string.contact_status_update_attribution,
+                    R.string.contact_status_update_attribution,
                     labelClause);
         } else if (validTimestamp) {
             return timeClause;
diff --git a/src/com/android/contacts/util/DateUtils.java b/src/com/android/contacts/util/DateUtils.java
new file mode 100644
index 0000000..39eeb84
--- /dev/null
+++ b/src/com/android/contacts/util/DateUtils.java
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.util;
+
+import android.content.Context;
+import android.text.format.DateFormat;
+
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Utility methods for processing dates.
+ */
+public class DateUtils {
+
+    private static final SimpleDateFormat NO_YEAR_DATE_FORMAT = new SimpleDateFormat("--MM-dd");
+
+    private static final SimpleDateFormat[] DATE_FORMATS = {
+        NO_YEAR_DATE_FORMAT,
+        new SimpleDateFormat("yyyy-MM-dd"),
+        new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"),
+    };
+    static {
+        for (SimpleDateFormat format : DATE_FORMATS) {
+            format.setLenient(true);
+        }
+    }
+
+    private static final java.text.DateFormat FORMAT_WITHOUT_YEAR_MONTH_FIRST =
+            new SimpleDateFormat("MMMM dd");
+
+    private static final java.text.DateFormat FORMAT_WITHOUT_YEAR_DATE_FIRST =
+            new SimpleDateFormat("dd MMMM");
+
+    /**
+     * Parses the supplied string to see if it looks like a date. If so,
+     * returns the same date in a cleaned-up format.  Otherwise, returns
+     * the supplied string unchanged.
+     */
+    public static String formatDate(Context context, String string) {
+        if (string == null) {
+            return null;
+        }
+
+        string = string.trim();
+        if (string.length() == 0) {
+            return string;
+        }
+
+        ParsePosition parsePosition = new ParsePosition(0);
+
+        for (int i = 0; i < DATE_FORMATS.length; i++) {
+            SimpleDateFormat f = DATE_FORMATS[i];
+            synchronized (f) {
+                parsePosition.setIndex(0);
+                Date date = f.parse(string, parsePosition);
+                if (parsePosition.getIndex() == string.length()) {
+                    java.text.DateFormat outFormat;
+                    if (f == NO_YEAR_DATE_FORMAT) {
+                        outFormat = isMonthBeforeDate(context) ? FORMAT_WITHOUT_YEAR_MONTH_FIRST
+                                : FORMAT_WITHOUT_YEAR_DATE_FIRST;
+                    } else {
+                        outFormat = DateFormat.getDateFormat(context);
+                    }
+
+                    synchronized (outFormat) {
+                        return outFormat.format(date);
+                    }
+                }
+            }
+        }
+        return string;
+    }
+
+    private static boolean isMonthBeforeDate(Context context) {
+        char[] dateFormatOrder = DateFormat.getDateFormatOrder(context);
+        for (int i = 0; i < dateFormatOrder.length; i++) {
+            if (dateFormatOrder[i] == DateFormat.DATE) {
+                return false;
+            }
+            if (dateFormatOrder[i] == DateFormat.MONTH) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
diff --git a/src/com/android/contacts/util/DialogManager.java b/src/com/android/contacts/util/DialogManager.java
new file mode 100644
index 0000000..f1bae0f
--- /dev/null
+++ b/src/com/android/contacts/util/DialogManager.java
@@ -0,0 +1,129 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.util;
+
+import com.android.contacts.R;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnDismissListener;
+import android.os.Bundle;
+import android.view.View;
+
+/**
+ * Manages creation and destruction of Dialogs that are to be shown by Views. Unlike how Dialogs
+ * are regularly used, the Dialogs are not recycled but immediately destroyed after dismissal.
+ * To be able to do that, two IDs are required which are used consecutively.
+ * How to use:<ul>
+ * <li>The owning Activity creates on instance of this class, passing itself and two Ids that are
+ *    not used by other Dialogs of the Activity.</li>
+ * <li>Views owning Dialogs must implement {@link DialogManager.DialogShowingView}</li>
+ * <li>After creating the Views, configureManagingViews must be called to configure all views
+ *    that implement {@link DialogManager.DialogShowingView}</li>
+ * <li>In the implementation of {@link Activity#onCreateDialog}, calls for the
+ *    ViewId are forwarded to {@link DialogManager#onCreateDialog(int, Bundle)}</li>
+ * </ul>
+ * To actually show a Dialog, the View uses {@link DialogManager#showDialogInView(View, Bundle)},
+ * passing itself as a first parameter
+ */
+public class DialogManager {
+    private final Activity mActivity;
+    private boolean mUseDialogId2 = false;
+    public final static String VIEW_ID_KEY = "view_id";
+
+    public static final boolean isManagedId(int id) {
+        return (id == R.id.dialog_manager_id_1) || (id == R.id.dialog_manager_id_2);
+    }
+
+    /**
+     * Creates a new instance of this class for the given Activity.
+     * @param activity The activity this object is used for
+     */
+    public DialogManager(final Activity activity) {
+        if (activity == null) throw new IllegalArgumentException("activity must not be null");
+        mActivity = activity;
+    }
+
+    /**
+     * Called by a View to show a dialog. It has to pass itself and a Bundle with extra information.
+     * If the view can show several dialogs, it should distinguish them using an item in the Bundle.
+     * The View needs to have a valid and unique Id. This function modifies the bundle by adding a
+     * new item named {@link DialogManager#VIEW_ID_KEY}
+     */
+    public void showDialogInView(final View view, final Bundle bundle) {
+        final int viewId = view.getId();
+        if (bundle.containsKey(VIEW_ID_KEY)) {
+            throw new IllegalArgumentException("Bundle already contains a " + VIEW_ID_KEY);
+        }
+        if (viewId == View.NO_ID) {
+            throw new IllegalArgumentException("View does not have a proper ViewId");
+        }
+        bundle.putInt(VIEW_ID_KEY, viewId);
+        int dialogId = mUseDialogId2 ? R.id.dialog_manager_id_2 : R.id.dialog_manager_id_1;
+        mActivity.showDialog(dialogId, bundle);
+    }
+
+    /**
+     * Callback function called by the Activity to handle View-managed Dialogs.
+     * This function returns null if the id is not one of the two reserved Ids.
+     */
+    public Dialog onCreateDialog(final int id, final Bundle bundle) {
+        if (id == R.id.dialog_manager_id_1) {
+            mUseDialogId2 = true;
+        } else if (id == R.id.dialog_manager_id_2) {
+            mUseDialogId2 = false;
+        } else {
+            return null;
+        }
+        if (!bundle.containsKey(VIEW_ID_KEY)) {
+            throw new IllegalArgumentException("Bundle does not contain a ViewId");
+        }
+        final int viewId = bundle.getInt(VIEW_ID_KEY);
+        final View view = mActivity.findViewById(viewId);
+        if (view == null || !(view instanceof DialogShowingView)) {
+            return null;
+        }
+        final Dialog dialog = ((DialogShowingView)view).createDialog(bundle);
+
+        // As we will never re-use this dialog, we can completely kill it here
+        dialog.setOnDismissListener(new OnDismissListener() {
+            public void onDismiss(DialogInterface dialogInterface) {
+                mActivity.removeDialog(id);
+            }
+        });
+        return dialog;
+    }
+
+    /**
+     * Interface to implemented by Views that show Dialogs
+     */
+    public interface DialogShowingView {
+        /**
+         * Callback function to create a Dialog. Notice that the DialogManager overwrites the
+         * OnDismissListener on the returned Dialog, so the View should not use this Listener itself
+         */
+        Dialog createDialog(Bundle bundle);
+    }
+
+    /**
+     * Interface to implemented by Activities that host View-showing dialogs
+     */
+    public interface DialogShowingViewActivity {
+        DialogManager getDialogManager();
+    }
+}
diff --git a/src/com/android/contacts/util/LocalizedNameResolver.java b/src/com/android/contacts/util/LocalizedNameResolver.java
new file mode 100644
index 0000000..c2ee90a
--- /dev/null
+++ b/src/com/android/contacts/util/LocalizedNameResolver.java
@@ -0,0 +1,161 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.util;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import android.accounts.AccountManager;
+import android.accounts.AuthenticatorDescription;
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.ServiceInfo;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.content.res.XmlResourceParser;
+import android.content.res.Resources.NotFoundException;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.util.Xml;
+
+import java.io.IOException;
+
+/**
+ * Retrieves localized names per account type. This allows customizing texts like
+ * "All Contacts" for certain account types, but e.g. "All Friends" or "All Connections" for others.
+ */
+public class LocalizedNameResolver  {
+    private static final String TAG = "LocalizedNameResolver";
+
+    /**
+     * Meta-data key for the contacts configuration associated with a sync service.
+     */
+    private static final String METADATA_CONTACTS = "android.provider.CONTACTS_STRUCTURE";
+
+    private static final String CONTACTS_DATA_KIND = "ContactsDataKind";
+
+    /**
+     * Returns the name for All Contacts for the specified account type.
+     */
+    public static String getAllContactsName(Context context, String accountType) {
+        if (context == null) throw new IllegalArgumentException("Context must not be null");
+        if (accountType == null) return null;
+
+        return resolveAllContactsName(context, accountType);
+     }
+
+    /**
+     * Finds "All Contacts"-Name for the specified account type.
+     */
+    private static String resolveAllContactsName(Context context, String accountType) {
+        final AccountManager am = AccountManager.get(context);
+
+        for (AuthenticatorDescription auth : am.getAuthenticatorTypes()) {
+            if (accountType.equals(auth.type)) {
+                return resolveAllContactsNameFromMetaData(context, auth.packageName);
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Finds the meta-data XML containing the contacts configuration and
+     * reads the picture priority from that file.
+     */
+    private static String resolveAllContactsNameFromMetaData(Context context, String packageName) {
+        final PackageManager pm = context.getPackageManager();
+        try {
+            PackageInfo pi = pm.getPackageInfo(packageName, PackageManager.GET_SERVICES
+                    | PackageManager.GET_META_DATA);
+            if (pi != null && pi.services != null) {
+                for (ServiceInfo si : pi.services) {
+                    final XmlResourceParser parser = si.loadXmlMetaData(pm, METADATA_CONTACTS);
+                    if (parser != null) {
+                        return loadAllContactsNameFromXml(context, parser, packageName);
+                    }
+                }
+            }
+        } catch (NameNotFoundException e) {
+            Log.w(TAG, "Problem loading \"All Contacts\"-name: " + e.toString());
+        }
+        return null;
+    }
+
+    private static String loadAllContactsNameFromXml(Context context, XmlPullParser parser,
+            String packageName) {
+        try {
+            final AttributeSet attrs = Xml.asAttributeSet(parser);
+            int type;
+            while ((type = parser.next()) != XmlPullParser.START_TAG
+                    && type != XmlPullParser.END_DOCUMENT) {
+                // Drain comments and whitespace
+            }
+
+            if (type != XmlPullParser.START_TAG) {
+                throw new IllegalStateException("No start tag found");
+            }
+
+            final int depth = parser.getDepth();
+            while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
+                    && type != XmlPullParser.END_DOCUMENT) {
+                String name = parser.getName();
+                if (type == XmlPullParser.START_TAG && CONTACTS_DATA_KIND.equals(name)) {
+                    final TypedArray typedArray = context.obtainStyledAttributes(attrs,
+                            android.R.styleable.ContactsDataKind);
+                    try {
+                        // See if a string has been hardcoded directly into the xml
+                        final String nonResourceString = typedArray.getNonResourceString(
+                                android.R.styleable.ContactsDataKind_allContactsName);
+                        if (nonResourceString != null) {
+                            return nonResourceString;
+                        }
+
+                        // See if a resource is referenced. We can't rely on getString
+                        // to automatically resolve it as the resource lives in a different package
+                        int id = typedArray.getResourceId(
+                                android.R.styleable.ContactsDataKind_allContactsName, 0);
+                        if (id == 0) return null;
+
+                        // Resolve the resource Id
+                        final PackageManager packageManager = context.getPackageManager();
+                        final Resources resources;
+                        try {
+                            resources = packageManager.getResourcesForApplication(packageName);
+                        } catch (NameNotFoundException e) {
+                            return null;
+                        }
+                        try {
+                            return resources.getString(id);
+                        } catch (NotFoundException e) {
+                            return null;
+                        }
+                    } finally {
+                        typedArray.recycle();
+                    }
+                }
+            }
+            return null;
+        } catch (XmlPullParserException e) {
+            throw new IllegalStateException("Problem reading XML", e);
+        } catch (IOException e) {
+            throw new IllegalStateException("Problem reading XML", e);
+        }
+    }
+}
diff --git a/src/com/android/contacts/util/PhoneCapabilityTester.java b/src/com/android/contacts/util/PhoneCapabilityTester.java
new file mode 100644
index 0000000..fa34b92
--- /dev/null
+++ b/src/com/android/contacts/util/PhoneCapabilityTester.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.util;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.net.Uri;
+import android.net.sip.SipManager;
+
+import java.util.List;
+
+public final class PhoneCapabilityTester {
+    /**
+     * Tests whether the Intent has a receiver registered. This can be used to show/hide
+     * functionality (like Phone, SMS)
+     */
+    public static boolean isIntentRegistered(Context context, Intent intent) {
+        final PackageManager packageManager = context.getPackageManager();
+        final List<ResolveInfo> receiverList = packageManager.queryIntentActivities(intent,
+                PackageManager.MATCH_DEFAULT_ONLY);
+        return receiverList.size() > 0;
+    }
+
+    /**
+     * Returns true if this device can be used to make phone calls
+     */
+    public static boolean isPhone(Context context) {
+        // Is the device physically capabable of making phone calls?
+        if (!context.getResources().getBoolean(com.android.internal.R.bool.config_voice_capable)) {
+            return false;
+        }
+
+        // Is there an app registered that accepts the call intent?
+        final Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
+                Uri.fromParts(Constants.SCHEME_TEL, "", null));
+        return isIntentRegistered(context, intent);
+    }
+
+    /**
+     * Returns true if this device can be used to make sip calls
+     */
+    public static boolean isSipPhone(Context context) {
+        return SipManager.isVoipSupported(context);
+    }
+
+    /**
+     * Returns true if the device has an SMS application installed.
+     */
+    public static boolean isSmsIntentRegistered(Context context) {
+        final Intent intent = new Intent(Intent.ACTION_SENDTO,
+                Uri.fromParts(Constants.SCHEME_SMSTO, "", null));
+        return isIntentRegistered(context, intent);
+    }
+}
diff --git a/src/com/android/contacts/util/PhonebookCollatorFactory.java b/src/com/android/contacts/util/PhonebookCollatorFactory.java
new file mode 100644
index 0000000..08ce27a
--- /dev/null
+++ b/src/com/android/contacts/util/PhonebookCollatorFactory.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.util;
+
+import java.text.Collator;
+import java.util.Locale;
+
+/**
+ * Returns the collator that can be used to sort contact list entries. This
+ * collator is the same as the one that is used in sqlite.
+ */
+public final class PhonebookCollatorFactory {
+    public static final Collator getCollator() {
+        final Locale defaultLocale = Locale.getDefault();
+        final String defaultLocaleString = defaultLocale.toString();
+        // For Japanese we use a special collator that puts japanese characters before foreign
+        // ones (this is called a dictionary collator)
+        // Warning: This function has to match the behavior in sqlite3_android.cpp (located in
+        // the framework)
+        final Locale locale;
+        if ("ja".equals(defaultLocaleString) || "ja_JP".equals(defaultLocaleString)) {
+            locale = new Locale("ja@collation=phonebook");
+        } else {
+            locale = defaultLocale;
+        }
+
+        return Collator.getInstance(locale);
+    }
+}
diff --git a/src/com/android/contacts/vcard/AnimatedImageView.java b/src/com/android/contacts/vcard/AnimatedImageView.java
new file mode 100644
index 0000000..8911b52
--- /dev/null
+++ b/src/com/android/contacts/vcard/AnimatedImageView.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2008 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.contacts.vcard;
+
+import android.content.Context;
+import android.graphics.drawable.AnimationDrawable;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+import android.widget.RemoteViews.RemoteView;
+
+/**
+ * Just a bare copy from SystemUI. Do not edit. 
+ */
+public class AnimatedImageView extends ImageView {
+    AnimationDrawable mAnim;
+    boolean mAttached;
+
+    public AnimatedImageView(Context context) {
+        super(context);
+    }
+
+    public AnimatedImageView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    private void updateAnim() {
+        Drawable drawable = getDrawable();
+        if (mAttached && mAnim != null) {
+            mAnim.stop();
+        }
+        if (drawable instanceof AnimationDrawable) {
+            mAnim = (AnimationDrawable)drawable;
+            if (mAttached) {
+                mAnim.start();
+            }
+        } else {
+            mAnim = null;
+        }
+    }
+
+    @Override
+    public void setImageDrawable(Drawable drawable) {
+        super.setImageDrawable(drawable);
+        updateAnim();
+    }
+
+    @Override
+    @android.view.RemotableViewMethod
+    public void setImageResource(int resid) {
+        super.setImageResource(resid);
+        updateAnim();
+    }
+
+    @Override
+    public void onAttachedToWindow() {
+        super.onAttachedToWindow();
+        if (mAnim != null) {
+            mAnim.start();
+        }
+        mAttached = true;
+    }
+
+    @Override
+    public void onDetachedFromWindow() {
+        super.onDetachedFromWindow();
+        if (mAnim != null) {
+            mAnim.stop();
+        }
+        mAttached = false;
+    }
+}
+
diff --git a/src/com/android/contacts/vcard/CancelImportActivity.java b/src/com/android/contacts/vcard/CancelImportActivity.java
new file mode 100644
index 0000000..22de0da
--- /dev/null
+++ b/src/com/android/contacts/vcard/CancelImportActivity.java
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.RemoteException;
+import android.util.Log;
+
+import com.android.contacts.R;
+
+/**
+ * The Activity for canceling ongoing vCard import.
+ *
+ * Currently we ignore tha case where there are more than one import requests
+ * with a same Uri in the queue.
+ */
+public class CancelImportActivity extends Activity {
+    private final String LOG_TAG = "CancelImportActivity";
+
+    /* package */ final String EXTRA_TARGET_URI = "extra_target_uri";
+
+    private class CustomConnection implements ServiceConnection {
+        private Messenger mMessenger;
+        public void doBindService() {
+            bindService(new Intent(CancelImportActivity.this,
+                    VCardService.class), this, Context.BIND_AUTO_CREATE);
+        }
+        @Override
+        public void onServiceConnected(ComponentName name, IBinder service) {
+            mMessenger = new Messenger(service);
+
+            try {
+                mMessenger.send(Message.obtain(null,
+                        VCardService.MSG_CANCEL_IMPORT_REQUEST,
+                        null));
+                finish();
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "RemoteException is thrown when trying to send request");
+                CancelImportActivity.this.showDialog(R.string.fail_reason_unknown);
+            }
+        }
+        @Override
+        public void onServiceDisconnected(ComponentName name) {
+            mMessenger = null;
+        }
+    }
+
+    private class RequestCancelImportListener implements DialogInterface.OnClickListener {
+        @Override
+        public void onClick(DialogInterface dialog, int which) {
+            mConnection.doBindService();
+        }
+    }
+
+    private class CancelListener
+            implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener {
+        @Override
+        public void onClick(DialogInterface dialog, int which) {
+            finish();
+        }
+        @Override
+        public void onCancel(DialogInterface dialog) {
+            finish();
+        }
+    }
+
+    private final CancelListener mCancelListener = new CancelListener();
+    private final CustomConnection mConnection = new CustomConnection();
+    // private String mTargetUri;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        showDialog(R.id.dialog_cancel_import_confirmation);
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int resId, Bundle bundle) {
+        switch (resId) {
+
+        case R.id.dialog_cancel_import_confirmation: {
+            return getConfirmationDialog();
+        }
+        case R.string.fail_reason_unknown:
+            final AlertDialog.Builder builder = new AlertDialog.Builder(this)
+                .setTitle(getString(R.string.reading_vcard_failed_title))
+                .setIcon(android.R.drawable.ic_dialog_alert)
+                .setMessage(getString(resId))
+                .setOnCancelListener(mCancelListener)
+                .setPositiveButton(android.R.string.ok, mCancelListener);
+            return builder.create();
+        }
+        return super.onCreateDialog(resId, bundle);
+    }
+
+    private Dialog getConfirmationDialog() {
+        final AlertDialog.Builder builder = new AlertDialog.Builder(this)
+                .setTitle(R.string.cancel_import_confirmation_title)
+                .setMessage(R.string.cancel_import_confirmation_message)
+                .setPositiveButton(android.R.string.ok, new RequestCancelImportListener())
+                .setOnCancelListener(mCancelListener)
+                .setNegativeButton(android.R.string.cancel, mCancelListener);
+        return builder.create();
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/contacts/vcard/CancelImportRequest.java b/src/com/android/contacts/vcard/CancelImportRequest.java
new file mode 100644
index 0000000..dd10187
--- /dev/null
+++ b/src/com/android/contacts/vcard/CancelImportRequest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.net.Uri;
+
+/**
+ * Class representing one request for canceling vCard import (given as a Uri).
+ */
+public class CancelImportRequest {
+    public final Uri uri;
+    public CancelImportRequest(Uri uri) {
+        this.uri = uri;
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/contacts/vcard/ExportProcessor.java b/src/com/android/contacts/vcard/ExportProcessor.java
new file mode 100644
index 0000000..2532cb2
--- /dev/null
+++ b/src/com/android/contacts/vcard/ExportProcessor.java
@@ -0,0 +1,267 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.net.Uri;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.android.contacts.R;
+import com.android.contacts.activities.ContactBrowserActivity;
+import com.android.vcard.VCardComposer;
+import com.android.vcard.VCardConfig;
+
+import java.io.FileNotFoundException;
+import java.io.OutputStream;
+import java.util.LinkedList;
+import java.util.Queue;
+
+public class ExportProcessor {
+    private static final String LOG_TAG = "ExportProcessor";
+
+    private final Context mContext;
+
+    private ContentResolver mResolver;
+    private NotificationManager mNotificationManager;
+
+    boolean mCanceled;
+
+    boolean mReadyForRequest;
+    private final Queue<ExportRequest> mPendingRequests =
+        new LinkedList<ExportRequest>();
+
+    public ExportProcessor(Context context) {
+        mContext = context;
+    }
+
+    /* package */ ThreadStarter mThreadStarter = new ThreadStarter() {
+        public void start() {
+            final Thread thread = new Thread(new Runnable() {
+                public void run() {
+                    process();
+                }
+            });
+            thread.start();
+        }
+    };
+
+    public synchronized void pushRequest(ExportRequest parameter) {
+        if (mResolver == null) {
+            // Service object may not ready at the construction time
+            // (e.g. ContentResolver may be null).
+            mResolver = mContext.getContentResolver();
+            mNotificationManager =
+                    (NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE);
+        }
+
+        final boolean needThreadStart;
+        if (!mReadyForRequest) {
+            needThreadStart = true;
+        } else {
+            needThreadStart = false;
+        }
+        mPendingRequests.add(parameter);
+        if (needThreadStart) {
+            mThreadStarter.start();
+        }
+
+        mReadyForRequest = true;
+    }
+
+    /* package */ void process() {
+        if (!mReadyForRequest) {
+            throw new RuntimeException(
+                    "process() is called before request being pushed "
+                    + "or after this object's finishing its processing.");
+        }
+
+        try {
+            while (!mCanceled) {
+                final ExportRequest parameter;
+                synchronized (this) {
+                    if (mPendingRequests.size() == 0) {
+                        mReadyForRequest = false;
+                        break;
+                    } else {
+                        parameter = mPendingRequests.poll();
+                    }
+                }  // synchronized (this)
+                handleOneRequest(parameter);
+            }
+
+            doFinishNotification(mContext.getString(R.string.exporting_vcard_finished_title),
+                    "");
+        } finally {
+            // Not thread safe. Just in case.
+            // TODO: verify this works fine.
+            mReadyForRequest = false;
+        }
+    }
+
+    /* package */ void handleOneRequest(ExportRequest request) {
+        boolean shouldCallFinish = true;
+        VCardComposer composer = null;
+        try {
+            final Uri uri = request.destUri;
+            final OutputStream outputStream;
+            try {
+                outputStream = mResolver.openOutputStream(uri);
+            } catch (FileNotFoundException e) {
+                // Need concise title.
+
+                final String errorReason =
+                    mContext.getString(R.string.fail_reason_could_not_open_file,
+                            uri, e.getMessage());
+                shouldCallFinish = false;
+                doFinishNotification(errorReason, "");
+                return;
+            }
+            final String exportType = request.exportType;
+            final int vcardType;
+            if (TextUtils.isEmpty(exportType)) {
+                vcardType = VCardConfig.getVCardTypeFromString(
+                        mContext.getString(R.string.config_export_vcard_type));
+            } else {
+                vcardType = VCardConfig.getVCardTypeFromString(exportType);
+            }
+
+            composer = new VCardComposer(mContext, vcardType, true);
+
+            // for test
+            // int vcardType = (VCardConfig.VCARD_TYPE_V21_GENERIC |
+            //     VCardConfig.FLAG_USE_QP_TO_PRIMARY_PROPERTIES);
+            // composer = new VCardComposer(ExportVCardActivity.this, vcardType, true);
+
+            composer.addHandler(composer.new HandlerForOutputStream(outputStream));
+
+            if (!composer.init()) {
+                final String errorReason = composer.getErrorReason();
+                Log.e(LOG_TAG, "initialization of vCard composer failed: " + errorReason);
+                final String translatedErrorReason =
+                        translateComposerError(errorReason);
+                final String title =
+                        mContext.getString(R.string.fail_reason_could_not_initialize_exporter,
+                                translatedErrorReason);
+                doFinishNotification(title, "");
+                return;
+            }
+
+            final int total = composer.getCount();
+            if (total == 0) {
+                final String title =
+                        mContext.getString(R.string.fail_reason_no_exportable_contact);
+                doFinishNotification(title, "");
+                return;
+            }
+
+            int current = 1;  // 1-origin
+            while (!composer.isAfterLast()) {
+                if (mCanceled) {
+                    return;
+                }
+                if (!composer.createOneEntry()) {
+                    final String errorReason = composer.getErrorReason();
+                    Log.e(LOG_TAG, "Failed to read a contact: " + errorReason);
+                    final String translatedErrorReason =
+                            translateComposerError(errorReason);
+                    final String title =
+                            mContext.getString(R.string.fail_reason_error_occurred_during_export,
+                                    translatedErrorReason);
+                    doFinishNotification(title, "");
+                    return;
+                }
+                doProgressNotification(uri, total, current);
+                current++;
+            }
+        } finally {
+            if (composer != null) {
+                composer.terminate();
+            }
+        }
+    }
+
+    private String translateComposerError(String errorMessage) {
+        final Resources resources = mContext.getResources();
+        if (VCardComposer.FAILURE_REASON_FAILED_TO_GET_DATABASE_INFO.equals(errorMessage)) {
+            return resources.getString(R.string.composer_failed_to_get_database_infomation);
+        } else if (VCardComposer.FAILURE_REASON_NO_ENTRY.equals(errorMessage)) {
+            return resources.getString(R.string.composer_has_no_exportable_contact);
+        } else if (VCardComposer.FAILURE_REASON_NOT_INITIALIZED.equals(errorMessage)) {
+            return resources.getString(R.string.composer_not_initialized);
+        } else {
+            return errorMessage;
+        }
+    }
+
+    private void doProgressNotification(Uri uri, int total, int current) {
+        final String title = mContext.getString(R.string.exporting_contact_list_title);
+        final String description =
+                mContext.getString(R.string.exporting_contact_list_message, uri);
+
+        /* TODO: fix this
+        final RemoteViews remoteViews = new RemoteViews(mService.getPackageName(),
+                R.layout.status_bar_ongoing_event_progress_bar);
+        remoteViews.setTextViewText(R.id.status_description, message);
+        remoteViews.setProgressBar(R.id.status_progress_bar, total, current, (total == -1));
+
+        final String percentage = mService.getString(R.string.percentage,
+                String.valueOf((current * 100)/total));
+        remoteViews.setTextViewText(R.id.status_progress_text, percentage);
+        remoteViews.setImageViewResource(R.id.status_icon, android.R.drawable.stat_sys_upload);
+
+        final Notification notification = new Notification();
+        notification.icon = android.R.drawable.stat_sys_upload;
+        notification.flags |= Notification.FLAG_ONGOING_EVENT;
+        notification.tickerText = title;
+        notification.contentView = remoteViews;
+        notification.contentIntent =
+                PendingIntent.getActivity(mService, 0,
+                        new Intent(mService, ContactBrowserActivity.class), 0);*/
+
+        final long when = System.currentTimeMillis();
+        final Notification notification = new Notification(
+                android.R.drawable.stat_sys_upload,
+                description,
+                when);
+
+        final Context context = mContext.getApplicationContext();
+        final PendingIntent pendingIntent =
+                PendingIntent.getActivity(context, 0,
+                        new Intent(context, ContactBrowserActivity.class),
+                        PendingIntent.FLAG_UPDATE_CURRENT);
+
+        notification.setLatestEventInfo(context, title, description, pendingIntent);
+        mNotificationManager.notify(VCardService.EXPORT_NOTIFICATION_ID, notification);
+    }
+
+    private void doFinishNotification(final String title, final String message) {
+        final Notification notification = new Notification();
+        notification.icon = android.R.drawable.stat_sys_upload_done;
+        notification.flags |= Notification.FLAG_AUTO_CANCEL;
+        notification.setLatestEventInfo(mContext, title, message, null);
+        final Intent intent = new Intent(mContext, ContactBrowserActivity.class);
+        notification.contentIntent =
+                PendingIntent.getActivity(mContext, 0, intent, 0);
+        mNotificationManager.notify(VCardService.EXPORT_NOTIFICATION_ID, notification);
+    }
+}
diff --git a/src/com/android/contacts/vcard/ExportRequest.java b/src/com/android/contacts/vcard/ExportRequest.java
new file mode 100644
index 0000000..fae2d07
--- /dev/null
+++ b/src/com/android/contacts/vcard/ExportRequest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.net.Uri;
+
+public class ExportRequest {
+    public final Uri destUri;
+    /**
+     * Can be null.
+     */
+    public final String exportType;
+
+    public ExportRequest(Uri destUri) {
+        this(destUri, null);
+    }
+
+    public ExportRequest(Uri destUri, String exportType) {
+        this.destUri = destUri;
+        this.exportType = exportType;
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/contacts/vcard/ExportVCardActivity.java b/src/com/android/contacts/vcard/ExportVCardActivity.java
new file mode 100644
index 0000000..fbe6d48
--- /dev/null
+++ b/src/com/android/contacts/vcard/ExportVCardActivity.java
@@ -0,0 +1,391 @@
+/*
+ * Copyright (C) 2009 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.contacts.vcard;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.content.res.Resources;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.RemoteException;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.android.contacts.R;
+import com.android.vcard.VCardComposer;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.Set;
+
+/**
+ * Class for exporting vCard.
+ *
+ * Note that this Activity assumes that the instance is a "one-shot Activity", which will be
+ * finished (with the method {@link Activity#finish()}) after the export and never reuse
+ * any Dialog in the instance. So this code is careless about the management around managed
+ * dialogs stuffs (like how onCreateDialog() is used).
+ */
+public class ExportVCardActivity extends Activity {
+    private static final String LOG_TAG = "ExportVCardActivity";
+
+    // If true, VCardExporter is able to emits files longer than 8.3 format.
+    private static final boolean ALLOW_LONG_FILE_NAME = false;
+    private String mTargetDirectory;
+    private String mFileNamePrefix;
+    private String mFileNameSuffix;
+    private int mFileIndexMinimum;
+    private int mFileIndexMaximum;
+    private String mFileNameExtension;
+    private Set<String> mExtensionsToConsider;
+
+    // Used temporarily when asking users to confirm the file name
+    private String mTargetFileName;
+
+    // String for storing error reason temporarily.
+    private String mErrorReason;
+
+
+    private class CustomConnection implements ServiceConnection {
+        private Messenger mMessenger;
+        private Queue<ExportRequest> mPendingRequests = new LinkedList<ExportRequest>();
+
+        public void doBindService() {
+            bindService(new Intent(ExportVCardActivity.this,
+                    VCardService.class), this, Context.BIND_AUTO_CREATE);
+        }
+
+        public synchronized void requestSend(final ExportRequest parameter) {
+            if (mMessenger != null) {
+                sendMessage(parameter);
+            } else {
+                mPendingRequests.add(parameter);
+            }
+        }
+
+        private void sendMessage(final ExportRequest request) {
+            try {
+                mMessenger.send(Message.obtain(null,
+                        VCardService.MSG_EXPORT_REQUEST,
+                        request));
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "RemoteException is thrown when trying to send request");
+                runOnUiThread(new ErrorReasonDisplayer(
+                        getString(R.string.fail_reason_unknown)));
+            }
+        }
+
+        public void onServiceConnected(ComponentName name, IBinder service) {
+            synchronized (this) {
+                mMessenger = new Messenger(service);
+                // Send pending requests thrown from this Activity before an actual connection
+                // is established.
+                while (!mPendingRequests.isEmpty()) {
+                    final ExportRequest parameter = mPendingRequests.poll();
+                    if (parameter == null) {
+                        throw new NullPointerException();
+                    }
+                    sendMessage(parameter);
+                }
+
+                unbindService(this);
+                finish();
+            }
+        }
+
+        public void onServiceDisconnected(ComponentName name) {
+            synchronized (this) {
+                if (!mPendingRequests.isEmpty()) {
+                    Log.w(LOG_TAG, "Some request(s) are dropped.");
+                }
+                // Set to null so that we can detect inappropriate re-connection toward
+                // the Service via NullPointerException;
+                mPendingRequests = null;
+                mMessenger = null;
+            }
+        }
+    }
+
+    private final CustomConnection mConnection = new CustomConnection();
+
+    private class CancelListener
+            implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener {
+        public void onClick(DialogInterface dialog, int which) {
+            finish();
+        }
+        public void onCancel(DialogInterface dialog) {
+            finish();
+        }
+    }
+
+    private CancelListener mCancelListener = new CancelListener();
+
+    private class ErrorReasonDisplayer implements Runnable {
+        private final int mResId;
+        public ErrorReasonDisplayer(int resId) {
+            mResId = resId;
+        }
+        public ErrorReasonDisplayer(String errorReason) {
+            mResId = R.id.dialog_fail_to_export_with_reason;
+            mErrorReason = errorReason;
+        }
+        public void run() {
+            // Show the Dialog only when the parent Activity is still alive.
+            if (!ExportVCardActivity.this.isFinishing()) {
+                showDialog(mResId);
+            }
+        }
+    }
+
+    private class ExportConfirmationListener implements DialogInterface.OnClickListener {
+        private final Uri mDestUri;
+
+        public ExportConfirmationListener(String fileName) {
+            this(Uri.parse("file://" + fileName));
+        }
+
+        public ExportConfirmationListener(Uri uri) {
+            mDestUri = uri;
+        }
+
+        public void onClick(DialogInterface dialog, int which) {
+            if (which == DialogInterface.BUTTON_POSITIVE) {
+                mConnection.doBindService();
+
+                final ExportRequest request = new ExportRequest(mDestUri);
+
+                // The connection object will call finish().
+                mConnection.requestSend(request);
+            }
+        }
+    }
+
+    private String translateComposerError(String errorMessage) {
+        Resources resources = getResources();
+        if (VCardComposer.FAILURE_REASON_FAILED_TO_GET_DATABASE_INFO.equals(errorMessage)) {
+            return resources.getString(R.string.composer_failed_to_get_database_infomation);
+        } else if (VCardComposer.FAILURE_REASON_NO_ENTRY.equals(errorMessage)) {
+            return resources.getString(R.string.composer_has_no_exportable_contact);
+        } else if (VCardComposer.FAILURE_REASON_NOT_INITIALIZED.equals(errorMessage)) {
+            return resources.getString(R.string.composer_not_initialized);
+        } else {
+            return errorMessage;
+        }
+    }
+
+    @Override
+    protected void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+
+        mTargetDirectory = getString(R.string.config_export_dir);
+        mFileNamePrefix = getString(R.string.config_export_file_prefix);
+        mFileNameSuffix = getString(R.string.config_export_file_suffix);
+        mFileNameExtension = getString(R.string.config_export_file_extension);
+
+        mExtensionsToConsider = new HashSet<String>();
+        mExtensionsToConsider.add(mFileNameExtension);
+
+        final String additionalExtensions =
+            getString(R.string.config_export_extensions_to_consider);
+        if (!TextUtils.isEmpty(additionalExtensions)) {
+            for (String extension : additionalExtensions.split(",")) {
+                String trimed = extension.trim();
+                if (trimed.length() > 0) {
+                    mExtensionsToConsider.add(trimed);
+                }
+            }
+        }
+
+        final Resources resources = getResources();
+        mFileIndexMinimum = resources.getInteger(R.integer.config_export_file_min_index);
+        mFileIndexMaximum = resources.getInteger(R.integer.config_export_file_max_index);
+
+        startExportVCardToSdCard();
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int id, Bundle bundle) {
+        switch (id) {
+            case R.id.dialog_export_confirmation: {
+                return getExportConfirmationDialog();
+            }
+            case R.string.fail_reason_too_many_vcard: {
+                return new AlertDialog.Builder(this)
+                    .setTitle(R.string.exporting_contact_failed_title)
+                    .setMessage(getString(R.string.exporting_contact_failed_message,
+                                getString(R.string.fail_reason_too_many_vcard)))
+                                .setPositiveButton(android.R.string.ok, mCancelListener)
+                                .create();
+            }
+            case R.id.dialog_fail_to_export_with_reason: {
+                return getErrorDialogWithReason();
+            }
+            case R.id.dialog_sdcard_not_found: {
+                AlertDialog.Builder builder = new AlertDialog.Builder(this)
+                .setTitle(R.string.no_sdcard_title)
+                .setIcon(android.R.drawable.ic_dialog_alert)
+                .setMessage(R.string.no_sdcard_message)
+                .setPositiveButton(android.R.string.ok, mCancelListener);
+                return builder.create();
+            }
+        }
+        return super.onCreateDialog(id, bundle);
+    }
+
+    @Override
+    protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
+        if (id == R.id.dialog_fail_to_export_with_reason) {
+            ((AlertDialog)dialog).setMessage(getErrorReason());
+        } else if (id == R.id.dialog_export_confirmation) {
+            ((AlertDialog)dialog).setMessage(
+                    getString(R.string.confirm_export_message, mTargetFileName));
+        } else {
+            super.onPrepareDialog(id, dialog, args);
+        }
+    }
+
+    @Override
+    protected void onStop() {
+        super.onStop();
+
+        if (!isFinishing()) {
+            finish();
+        }
+    }
+
+    /**
+     * Tries to start exporting VCard. If there's no SDCard available,
+     * an error dialog is shown.
+     */
+    public void startExportVCardToSdCard() {
+        File targetDirectory = new File(mTargetDirectory);
+
+        if (!(targetDirectory.exists() &&
+                targetDirectory.isDirectory() &&
+                targetDirectory.canRead()) &&
+                !targetDirectory.mkdirs()) {
+            showDialog(R.id.dialog_sdcard_not_found);
+        } else {
+            mTargetFileName = getAppropriateFileName(mTargetDirectory);
+            if (TextUtils.isEmpty(mTargetFileName)) {
+                mTargetFileName = null;
+                // finish() is called via the error dialog. Do not call the method here.
+                return;
+            }
+
+            showDialog(R.id.dialog_export_confirmation);
+        }
+    }
+
+    /**
+     * Tries to get an appropriate filename. Returns null if it fails.
+     */
+    private String getAppropriateFileName(final String destDirectory) {
+        int fileNumberStringLength = 0;
+        {
+            // Calling Math.Log10() is costly.
+            int tmp;
+            for (fileNumberStringLength = 0, tmp = mFileIndexMaximum; tmp > 0;
+                fileNumberStringLength++, tmp /= 10) {
+            }
+        }
+        String bodyFormat = "%s%0" + fileNumberStringLength + "d%s";
+
+        if (!ALLOW_LONG_FILE_NAME) {
+            String possibleBody = String.format(bodyFormat,mFileNamePrefix, 1, mFileNameSuffix);
+            if (possibleBody.length() > 8 || mFileNameExtension.length() > 3) {
+                Log.e(LOG_TAG, "This code does not allow any long file name.");
+                mErrorReason = getString(R.string.fail_reason_too_long_filename,
+                        String.format("%s.%s", possibleBody, mFileNameExtension));
+                showDialog(R.id.dialog_fail_to_export_with_reason);
+                // finish() is called via the error dialog. Do not call the method here.
+                return null;
+            }
+        }
+
+        // Note that this logic assumes that the target directory is case insensitive.
+        // As of 2009-07-16, it is true since the external storage is only sdcard, and
+        // it is formated as FAT/VFAT.
+        // TODO: fix this.
+        for (int i = mFileIndexMinimum; i <= mFileIndexMaximum; i++) {
+            boolean numberIsAvailable = true;
+            // SD Association's specification seems to require this feature, though we cannot
+            // have the specification since it is proprietary...
+            String body = null;
+            for (String possibleExtension : mExtensionsToConsider) {
+                body = String.format(bodyFormat, mFileNamePrefix, i, mFileNameSuffix);
+                File file = new File(String.format("%s/%s.%s",
+                        destDirectory, body, possibleExtension));
+                if (file.exists()) {
+                    numberIsAvailable = false;
+                    break;
+                }
+            }
+            if (numberIsAvailable) {
+                return String.format("%s/%s.%s", destDirectory, body, mFileNameExtension);
+            }
+        }
+        showDialog(R.string.fail_reason_too_many_vcard);
+        return null;
+    }
+
+    public Dialog getExportConfirmationDialog() {
+        if (TextUtils.isEmpty(mTargetFileName)) {
+            Log.e(LOG_TAG, "Target file name is empty, which must not be!");
+            // This situation is not acceptable (probably a bug!), but we don't have no reason to
+            // show...
+            mErrorReason = null;
+            return getErrorDialogWithReason();
+        }
+
+        return new AlertDialog.Builder(this)
+            .setTitle(R.string.confirm_export_title)
+            .setMessage(getString(R.string.confirm_export_message, mTargetFileName))
+            .setPositiveButton(android.R.string.ok,
+                    new ExportConfirmationListener(mTargetFileName))
+            .setNegativeButton(android.R.string.cancel, mCancelListener)
+            .setOnCancelListener(mCancelListener)
+            .create();
+    }
+
+    public Dialog getErrorDialogWithReason() {
+        if (mErrorReason == null) {
+            Log.e(LOG_TAG, "Error reason must have been set.");
+            mErrorReason = getString(R.string.fail_reason_unknown);
+        }
+        return new AlertDialog.Builder(this)
+            .setTitle(R.string.exporting_contact_failed_title)
+                .setMessage(getString(R.string.exporting_contact_failed_message, mErrorReason))
+            .setPositiveButton(android.R.string.ok, mCancelListener)
+            .setOnCancelListener(mCancelListener)
+            .create();
+    }
+
+    public String getErrorReason() {
+        return mErrorReason;
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/contacts/vcard/ImportProcessor.java b/src/com/android/contacts/vcard/ImportProcessor.java
new file mode 100644
index 0000000..6a7dbe6
--- /dev/null
+++ b/src/com/android/contacts/vcard/ImportProcessor.java
@@ -0,0 +1,442 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.accounts.Account;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.app.Service;
+import android.content.ComponentName;
+import android.content.ContentResolver;
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.net.Uri;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.RemoteException;
+import android.provider.ContactsContract.RawContacts;
+import android.util.Log;
+
+import com.android.contacts.R;
+import com.android.vcard.VCardEntryCommitter;
+import com.android.vcard.VCardEntryConstructor;
+import com.android.vcard.VCardInterpreter;
+import com.android.vcard.VCardParser;
+import com.android.vcard.VCardParser_V21;
+import com.android.vcard.VCardParser_V30;
+import com.android.vcard.exception.VCardException;
+import com.android.vcard.exception.VCardNestedException;
+import com.android.vcard.exception.VCardNotSupportedException;
+import com.android.vcard.exception.VCardVersionException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+
+/**
+ * Class for processing incoming import request from {@link ImportVCardActivity}.
+ *
+ * This class is designed so that a user ({@link Service}) does not need to (and should not)
+ * recreate multiple instances, as this holds total count of vCard entries to be imported.
+ */
+public class ImportProcessor {
+    private static final String LOG_TAG = ImportProcessor.class.getSimpleName();
+
+    private class ImportProcessorConnection implements ServiceConnection {
+        private Messenger mMessenger;
+        private boolean mBound;
+
+        public synchronized void tryBind() {
+            if (!mContext.bindService(new Intent(mContext, VCardService.class),
+                    mConnection, Context.BIND_AUTO_CREATE)) {
+                throw new RuntimeException("Failed to bind to VCardService.");
+            }
+            mBound = true;
+        }
+
+        public synchronized void tryUnbind() {
+            if (mBound) {
+                mContext.unbindService(mConnection);
+            } else {
+                // TODO: Not graceful.
+                Log.w(LOG_TAG, "unbind() is tried while ServiceConnection is not bound yet");
+            }
+            mBound = false;
+        }
+
+        public void sendFinishNotification() {
+            try {
+                mMessenger.send(Message.obtain(null,
+                        VCardService.MSG_NOTIFY_IMPORT_FINISHED,
+                        null));
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "RemoteException is thrown when trying to send request");
+            }
+        }
+
+        @Override
+        public void onServiceConnected(ComponentName name, IBinder service) {
+            mMessenger = new Messenger(service);
+        }
+        @Override
+        public void onServiceDisconnected(ComponentName name) {
+            mMessenger = null;
+        }
+    }
+
+    private final Context mContext;
+
+    private final ImportProcessorConnection mConnection = new ImportProcessorConnection();
+
+    private ContentResolver mResolver;
+    private NotificationManager mNotificationManager;
+
+    private final List<Uri> mFailedUris = new ArrayList<Uri>();
+    private final List<Uri> mCreatedUris = new ArrayList<Uri>();
+    private final ImportProgressNotifier mNotifier = new ImportProgressNotifier();
+
+    private VCardParser mVCardParser;
+
+    /**
+     * Meaning a controller of this object requests the operation should be canceled
+     * or not, which implies {@link #mReadyForRequest} should be set to false soon, but
+     * it does not meaning cancel request is able to immediately stop this object,
+     * so we have two variables.
+     */
+    private boolean mCanceled;
+
+    /**
+     * Meaning that this object is able to accept import requests.
+     */
+    private boolean mReadyForRequest;
+    private final Queue<ImportRequest> mPendingRequests =
+            new LinkedList<ImportRequest>();
+
+    // For testability.
+    /* package */ ThreadStarter mThreadStarter = new ThreadStarter() {
+        public void start() {
+            final Thread thread = new Thread(new Runnable() {
+                public void run() {
+                    process();
+                }
+            });
+            thread.start();
+        }
+    };
+    /* package */ interface CommitterGenerator {
+        public VCardEntryCommitter generate(ContentResolver resolver);
+    }
+    /* package */ class DefaultCommitterGenerator implements CommitterGenerator {
+        public VCardEntryCommitter generate(ContentResolver resolver) {
+            return new VCardEntryCommitter(mResolver);
+        }
+    }
+
+    private CommitterGenerator mCommitterGenerator =
+        new DefaultCommitterGenerator();
+
+    public ImportProcessor(final Context context) {
+        mContext = context;
+
+        mConnection.tryBind();
+    }
+
+    /**
+     * Checks this object and initialize it if not.
+     *
+     * This method is needed since {@link VCardService} is not ready when this object is
+     * created and we need to delay this initialization, while we want to initialize
+     * this object soon in tests.
+     */
+    /* package */ void ensureInit() {
+        if (mResolver == null) {
+            // Service object may not ready at the construction time
+            // (e.g. ContentResolver may be null).
+            mResolver = mContext.getContentResolver();
+            mNotificationManager =
+                    (NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE);
+        }
+    }
+
+    public synchronized void pushRequest(final ImportRequest request) {
+        ensureInit();
+
+        final boolean needThreadStart;
+        if (!mReadyForRequest) {
+            mFailedUris.clear();
+            mCreatedUris.clear();
+
+            mNotifier.init(mContext, mNotificationManager);
+            needThreadStart = true;
+        } else {
+            needThreadStart = false;
+        }
+        final int count = request.entryCount;
+        if (count > 0) {
+            mNotifier.addTotalCount(count);
+        }
+        mPendingRequests.add(request);
+        if (needThreadStart) {
+            mThreadStarter.start();
+        }
+
+        mReadyForRequest = true;
+    }
+
+    /**
+     * Starts processing import requests. Never stops until all given requests are
+     * processed or some error happens, assuming this method is called from a
+     * {@link Thread} object.
+     */
+    private void process() {
+        if (!mReadyForRequest) {
+            mConnection.tryUnbind();
+            throw new RuntimeException(
+                    "process() is called before request being pushed "
+                    + "or after this object's finishing its processing.");
+        }
+
+        try {
+            while (!mCanceled) {
+                final ImportRequest parameter;
+                synchronized (this) {
+                    if (mPendingRequests.size() == 0) {
+                        mReadyForRequest = false;
+                        break;
+                    } else {
+                        parameter = mPendingRequests.poll();
+                    }
+                }  // synchronized (this)
+                handleOneRequest(parameter);
+            }
+
+            // Currenty we don't have an appropriate way to let users see all URIs imported.
+            // Instead, we show one only when there's just one created uri.
+            doFinishNotification(mCreatedUris.size() > 0 ? mCreatedUris.get(0) : null);
+            mConnection.sendFinishNotification();
+        } finally {
+            // TODO: verify this works fine.
+            mReadyForRequest = false;  // Just in case.
+            mNotifier.resetTotalCount();
+            mConnection.tryUnbind();
+        }
+    }
+
+    /**
+     * Would be run inside synchronized block.
+     */
+    /* package */ boolean handleOneRequest(final ImportRequest request) {
+        if (mCanceled) {
+            Log.i(LOG_TAG, "Canceled before actually handling parameter ("
+                    + request.uri + ")");
+            return false;
+        }
+        final int[] possibleVCardVersions;
+        if (request.vcardVersion == ImportVCardActivity.VCARD_VERSION_AUTO_DETECT) {
+            /**
+             * Note: this code assumes that a given Uri is able to be opened more than once,
+             * which may not be true in certain conditions.
+             */
+            possibleVCardVersions = new int[] {
+                    ImportVCardActivity.VCARD_VERSION_V21,
+                    ImportVCardActivity.VCARD_VERSION_V30
+            };
+        } else {
+            possibleVCardVersions = new int[] {
+                    request.vcardVersion
+            };
+        }
+
+        final Uri uri = request.uri;
+        final Account account = request.account;
+        final int estimatedVCardType = request.estimatedVCardType;
+        final String estimatedCharset = request.estimatedCharset;
+
+        final VCardEntryConstructor constructor =
+                new VCardEntryConstructor(estimatedVCardType, account, estimatedCharset);
+        final VCardEntryCommitter committer = mCommitterGenerator.generate(mResolver);
+        constructor.addEntryHandler(committer);
+        constructor.addEntryHandler(mNotifier);
+
+        final boolean successful =
+            readOneVCard(uri, estimatedVCardType, estimatedCharset,
+                    constructor, possibleVCardVersions);
+        if (successful) {
+            List<Uri> uris = committer.getCreatedUris();
+            if (uris != null) {
+                mCreatedUris.addAll(uris);
+            } else {
+                // Not critical, but suspicious.
+                Log.w(LOG_TAG,
+                        "Created Uris is null while the creation itself is successful.");
+            }
+        } else {
+            mFailedUris.add(uri);
+        }
+
+        return successful;
+    }
+
+    /*
+    private void doErrorNotification(int id) {
+        final Notification notification = new Notification();
+        notification.icon = android.R.drawable.stat_sys_download_done;
+        notification.flags |= Notification.FLAG_AUTO_CANCEL;
+        final String title = mService.getString(R.string.reading_vcard_failed_title);
+        final PendingIntent intent =
+                PendingIntent.getActivity(mService, 0, new Intent(), 0);
+        notification.setLatestEventInfo(mService, title, "", intent);
+        mNotificationManager.notify(MESSAGE_ID, notification);
+    }
+    */
+
+    private void doFinishNotification(final Uri createdUri) {
+        final Notification notification = new Notification();
+        final String title;
+        notification.flags |= Notification.FLAG_AUTO_CANCEL;
+
+        if (isCanceled()) {
+            notification.icon = android.R.drawable.stat_notify_error;
+            title = mContext.getString(R.string.importing_vcard_canceled_title);
+        } else {
+            notification.icon = android.R.drawable.stat_sys_download_done;
+            title = mContext.getString(R.string.importing_vcard_finished_title);
+        }
+
+        final Intent intent;
+        if (createdUri != null) {
+            final long rawContactId = ContentUris.parseId(createdUri);
+            final Uri contactUri = RawContacts.getContactLookupUri(
+                    mResolver, ContentUris.withAppendedId(
+                            RawContacts.CONTENT_URI, rawContactId));
+            intent = new Intent(Intent.ACTION_VIEW, contactUri);
+        } else {
+            intent = null;
+        }
+
+        notification.setLatestEventInfo(mContext, title, "",
+                PendingIntent.getActivity(mContext, 0, intent, 0));
+        mNotificationManager.notify(VCardService.IMPORT_NOTIFICATION_ID, notification);
+    }
+
+    // Make package private for testing use.
+    /* package */ boolean readOneVCard(Uri uri, int vcardType, String charset,
+            final VCardInterpreter interpreter,
+            final int[] possibleVCardVersions) {
+        boolean successful = false;
+        final int length = possibleVCardVersions.length;
+        for (int i = 0; i < length; i++) {
+            InputStream is = null;
+            final int vcardVersion = possibleVCardVersions[i];
+            try {
+                if (i > 0 && (interpreter instanceof VCardEntryConstructor)) {
+                    // Let the object clean up internal temporary objects,
+                    ((VCardEntryConstructor) interpreter).clear();
+                }
+
+                is = mResolver.openInputStream(uri);
+
+                // We need synchronized block here,
+                // since we need to handle mCanceled and mVCardParser at once.
+                // In the worst case, a user may call cancel() just before creating
+                // mVCardParser.
+                synchronized (this) {
+                    mVCardParser = (vcardVersion == ImportVCardActivity.VCARD_VERSION_V30 ?
+                            new VCardParser_V30(vcardType) :
+                                new VCardParser_V21(vcardType));
+                    if (mCanceled) {
+                        mVCardParser.cancel();
+                    }
+                }
+                mVCardParser.parse(is, interpreter);
+
+                successful = true;
+                break;
+            } catch (IOException e) {
+                Log.e(LOG_TAG, "IOException was emitted: " + e.getMessage());
+            } catch (VCardNestedException e) {
+                // This exception should not be thrown here. We should instead handle it
+                // in the preprocessing session in ImportVCardActivity, as we don't try
+                // to detect the type of given vCard here.
+                //
+                // TODO: Handle this case appropriately, which should mean we have to have
+                // code trying to auto-detect the type of given vCard twice (both in
+                // ImportVCardActivity and ImportVCardService).
+                Log.e(LOG_TAG, "Nested Exception is found.");
+            } catch (VCardNotSupportedException e) {
+                Log.e(LOG_TAG, e.getMessage());
+            } catch (VCardVersionException e) {
+                if (i == length - 1) {
+                    Log.e(LOG_TAG, "Appropriate version for this vCard is not found.");
+                } else {
+                    // We'll try the other (v30) version.
+                }
+            } catch (VCardException e) {
+                Log.e(LOG_TAG, e.getMessage());
+            } finally {
+                if (is != null) {
+                    try {
+                        is.close();
+                    } catch (IOException e) {
+                    }
+                }
+            }
+        }
+
+        return successful;
+    }
+
+    public synchronized boolean isReadyForRequest() {
+        return mReadyForRequest;
+    }
+
+    public boolean isCanceled() {
+        return mCanceled;
+    }
+
+    public void cancel() {
+        mCanceled = true;
+        synchronized (this) {
+            if (mVCardParser != null) {
+                mVCardParser.cancel();
+            }
+        }
+    }
+
+    public List<Uri> getCreatedUrisForTest() {
+        return mCreatedUris;
+    }
+
+    public List<Uri> getFailedUrisForTest() {
+        return mFailedUris;
+    }
+
+    public void injectCommitterGeneratorForTest(
+            final CommitterGenerator generator) {
+        mCommitterGenerator = generator;
+    }
+
+    public void initNotifierForTest() {
+        mNotifier.init(mContext, mNotificationManager);
+    }
+}
diff --git a/src/com/android/contacts/vcard/ImportProgressNotifier.java b/src/com/android/contacts/vcard/ImportProgressNotifier.java
new file mode 100644
index 0000000..99a6f55
--- /dev/null
+++ b/src/com/android/contacts/vcard/ImportProgressNotifier.java
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.widget.RemoteViews;
+
+import com.android.contacts.R;
+import com.android.vcard.VCardEntry;
+import com.android.vcard.VCardEntryHandler;
+
+/**
+ * {@link VCardEntryHandler} implementation which lets the system update
+ * the current status of vCard import.
+ */
+public class ImportProgressNotifier implements VCardEntryHandler {
+    private Context mContext;
+    private NotificationManager mNotificationManager;
+
+    private int mCurrentCount;
+    private int mTotalCount;
+
+    public void init(Context context, NotificationManager notificationManager) {
+        mContext = context;
+        mNotificationManager = notificationManager;
+    }
+
+    public void onStart() {
+    }
+
+    public void onEntryCreated(VCardEntry contactStruct) {
+        mCurrentCount++;  // 1 origin.
+        if (contactStruct.isIgnorable()) {
+            return;
+        }
+
+        // We don't use startEntry() since:
+        // - We cannot know name there but here.
+        // - There's high probability where name comes soon after the beginning of entry, so
+        //   we don't need to hurry to show something.
+
+
+        final String totalCountString;
+        synchronized (this) {
+            totalCountString = String.valueOf(mTotalCount);
+        }
+        final String tickerText =
+                mContext.getString(R.string.progress_notifier_message,
+                        String.valueOf(mCurrentCount),
+                        totalCountString,
+                        contactStruct.getDisplayName());
+
+
+        final Context context = mContext.getApplicationContext();
+
+        final String description = mContext.getString(R.string.importing_vcard_description,
+                contactStruct.getDisplayName());
+        final RemoteViews remoteViews =
+                new RemoteViews(context.getPackageName(),
+                R.layout.status_bar_ongoing_event_progress_bar);
+        remoteViews.setTextViewText(R.id.status_description, description);
+        remoteViews.setProgressBar(R.id.status_progress_bar, mTotalCount, mCurrentCount,
+                mTotalCount == -1);
+        final String percentage;
+        if (mTotalCount > 0) {
+            percentage = context.getString(R.string.percentage,
+                    String.valueOf(mCurrentCount * 100/mTotalCount));
+        } else {
+            percentage = "";
+        }
+        remoteViews.setTextViewText(R.id.status_progress_text, percentage);
+        remoteViews.setImageViewResource(R.id.status_icon, android.R.drawable.stat_sys_download);
+
+        final Notification notification = new Notification();
+        notification.icon = android.R.drawable.stat_sys_download;
+        notification.tickerText = tickerText;
+        notification.contentView = remoteViews;
+        notification.flags |= Notification.FLAG_ONGOING_EVENT;
+
+        final PendingIntent pendingIntent =
+                PendingIntent.getActivity(context, 0,
+                        new Intent(context, CancelImportActivity.class),
+                        PendingIntent.FLAG_UPDATE_CURRENT);
+
+        notification.contentIntent = pendingIntent;
+        // notification.setLatestEventInfo(context, title, description, pendingIntent);
+        mNotificationManager.notify(VCardService.IMPORT_NOTIFICATION_ID, notification);
+    }
+
+    public synchronized void addTotalCount(int additionalCount) {
+        mTotalCount += additionalCount;
+    }
+
+    public synchronized void resetTotalCount() {
+        mTotalCount = 0;
+    }
+
+    public void onEnd() {
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/contacts/vcard/ImportRequest.java b/src/com/android/contacts/vcard/ImportRequest.java
new file mode 100644
index 0000000..5d46166
--- /dev/null
+++ b/src/com/android/contacts/vcard/ImportRequest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.accounts.Account;
+import android.net.Uri;
+
+import com.android.vcard.VCardSourceDetector;
+
+/**
+ * Class representing one request for importing vCard (given as a Uri).
+ *
+ * Mainly used when {@link ImportVCardActivity} requests {@link VCardService}
+ * to import some specific Uri.
+ *
+ * Note: This object's accepting only One Uri does NOT mean that
+ * there's only one vCard entry inside the instance, as one Uri often has multiple
+ * vCard entries inside it.
+ */
+public class ImportRequest {
+    /**
+     * Can be null (typically when there's no Account available in the system).
+     */
+    public final Account account;
+    public final Uri uri;
+    /**
+     * Can be {@link VCardSourceDetector#PARSE_TYPE_UNKNOWN}.
+     */
+    public final int estimatedVCardType;
+    /**
+     * Can be null, meaning no preferable charset is available.
+     */
+    public final String estimatedCharset;
+    /**
+     * Assumes that one Uri contains only one version, while there's a (tiny) possibility
+     * we may have two types in one vCard.
+     *
+     * e.g.
+     * BEGIN:VCARD
+     * VERSION:2.1
+     * ...
+     * END:VCARD
+     * BEGIN:VCARD
+     * VERSION:3.0
+     * ...
+     * END:VCARD
+     *
+     * We've never seen this kind of a file, but we may have to cope with it in the future.
+     */
+    public final int vcardVersion;
+
+    /**
+     * The count of vCard entries in {@link #uri}. A receiver of this object can use it
+     * when showing the progress of import. Thus a receiver must be able to torelate this
+     * variable being invalid because of vCard's limitation.
+     *
+     * vCard does not let us know this count without looking over a whole file content,
+     * which means we have to open and scan over {@link #uri} to know this value, while
+     * it may not be opened more than once (Uri does not require it to be opened multiple times
+     * and may become invalid after its close() request).
+     */
+    public final int entryCount;
+    public ImportRequest(Account account,
+            Uri uri, int estimatedType, String estimatedCharset,
+            int vcardVersion, int entryCount) {
+        this.account = account;
+        this.uri = uri;
+        this.estimatedVCardType = estimatedType;
+        this.estimatedCharset = estimatedCharset;
+        this.vcardVersion = vcardVersion;
+        this.entryCount = entryCount;
+    }
+}
diff --git a/src/com/android/contacts/vcard/ImportVCardActivity.java b/src/com/android/contacts/vcard/ImportVCardActivity.java
new file mode 100644
index 0000000..faa8bf3
--- /dev/null
+++ b/src/com/android/contacts/vcard/ImportVCardActivity.java
@@ -0,0 +1,1040 @@
+/*
+ * Copyright (C) 2009 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.contacts.vcard;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.content.ComponentName;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.content.DialogInterface.OnCancelListener;
+import android.content.DialogInterface.OnClickListener;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.PowerManager;
+import android.os.RemoteException;
+import android.text.SpannableStringBuilder;
+import android.text.Spanned;
+import android.text.TextUtils;
+import android.text.style.RelativeSizeSpan;
+import android.util.Log;
+
+import com.android.contacts.R;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.util.AccountSelectionUtil;
+import com.android.vcard.VCardEntryCounter;
+import com.android.vcard.VCardInterpreterCollection;
+import com.android.vcard.VCardParser;
+import com.android.vcard.VCardParser_V21;
+import com.android.vcard.VCardParser_V30;
+import com.android.vcard.VCardSourceDetector;
+import com.android.vcard.exception.VCardException;
+import com.android.vcard.exception.VCardNestedException;
+import com.android.vcard.exception.VCardVersionException;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+import java.util.Set;
+import java.util.Vector;
+
+/**
+ * The class letting users to import vCard. This includes the UI part for letting them select
+ * an Account and posssibly a file if there's no Uri is given from its caller Activity.
+ *
+ * Note that this Activity assumes that the instance is a "one-shot Activity", which will be
+ * finished (with the method {@link Activity#finish()}) after the import and never reuse
+ * any Dialog in the instance. So this code is careless about the management around managed
+ * dialogs stuffs (like how onCreateDialog() is used).
+ */
+public class ImportVCardActivity extends Activity {
+    private static final String LOG_TAG = "ImportVCardActivity";
+
+    private static final int SELECT_ACCOUNT = 0;
+
+    /* package */ static final String VCARD_URI_ARRAY = "vcard_uri";
+    /* package */ static final String ESTIMATED_VCARD_TYPE_ARRAY = "estimated_vcard_type";
+    /* package */ static final String ESTIMATED_CHARSET_ARRAY = "estimated_charset";
+    /* package */ static final String VCARD_VERSION_ARRAY = "vcard_version";
+    /* package */ static final String ENTRY_COUNT_ARRAY = "entry_count";
+
+    /* package */ final static int VCARD_VERSION_AUTO_DETECT = 0;
+    /* package */ final static int VCARD_VERSION_V21 = 1;
+    /* package */ final static int VCARD_VERSION_V30 = 2;
+
+    private static final String SECURE_DIRECTORY_NAME = ".android_secure";
+
+    final static String CACHED_URIS = "cached_uris";
+
+    private AccountSelectionUtil.AccountSelectedListener mAccountSelectionListener;
+
+    private Account mAccount;
+
+    private String mAction;
+    private Uri mUri;
+
+    private ProgressDialog mProgressDialogForScanVCard;
+    private ProgressDialog mProgressDialogForCacheVCard;
+
+    private List<VCardFile> mAllVCardFileList;
+    private VCardScanThread mVCardScanThread;
+
+    private VCardCacheThread mVCardCacheThread;
+
+    private String mErrorMessage;
+
+    private class CustomConnection implements ServiceConnection {
+        private Messenger mMessenger;
+        /**
+         * Stores {@link ImportRequest} objects until actual connection is established.
+         */
+        private Queue<ImportRequest> mPendingRequests =
+                new LinkedList<ImportRequest>();
+
+        private boolean mConnected = false;
+        private boolean mNeedToCallFinish = false;
+        private boolean mDisconnectAndFinishDone = false;
+
+        public void doBindService() {
+            bindService(new Intent(ImportVCardActivity.this,
+                    VCardService.class), this, Context.BIND_AUTO_CREATE);
+        }
+
+        /**
+         * Tries to unbind this connection and call {@link ImportVCardActivity#finish()}.
+         * When timing is not appropriate, this object remembers this call and
+         * call {@link ImportVCardActivity#unbindService(ServiceConnection)} and
+         * {@link ImportVCardActivity#finish()} afterwards.
+         */
+        public void tryDisconnectAndFinish() {
+            synchronized (this) {
+                if (!mDisconnectAndFinishDone) {
+                    mNeedToCallFinish = true;
+                    if (mConnected) {
+                        // onServiceConnected() is already finished and we need to
+                        // "manually" call unbindService() here.
+                        unbindService(this);
+                        mConnected = false;
+                        mDisconnectAndFinishDone = true;
+                        finish();
+                    } else {
+                        // If not connected, finish() must be called when connected, as
+                        // We cannot call finish() now.
+                    }
+                }
+            }
+        }
+
+        public void requestSend(final ImportRequest parameter) {
+            synchronized (mPendingRequests) {
+                if (mMessenger != null) {
+                    sendMessage(parameter);
+                } else {
+                    mPendingRequests.add(parameter);
+                }
+            }
+        }
+
+        private void sendMessage(final ImportRequest request) {
+            try {
+                mMessenger.send(Message.obtain(null,
+                        VCardService.MSG_IMPORT_REQUEST,
+                        request));
+            } catch (RemoteException e) {
+                Log.e(LOG_TAG, "RemoteException is thrown when trying to send request");
+                runOnUiThread(new DialogDisplayer(
+                        getString(R.string.fail_reason_unknown)));
+            }
+        }
+
+        @Override
+        public void onServiceConnected(ComponentName name, IBinder service) {
+            synchronized (mPendingRequests) {
+                mMessenger = new Messenger(service);
+
+                // Send pending requests thrown from this Activity before an actual connection
+                // is established.
+                while (!mPendingRequests.isEmpty()) {
+                    final ImportRequest parameter = mPendingRequests.poll();
+                    if (parameter == null) {
+                        throw new NullPointerException();
+                    }
+                    sendMessage(parameter);
+                }
+            }
+
+            synchronized (this) {
+                if (!mDisconnectAndFinishDone) {
+                    mConnected = true;
+                    if (mNeedToCallFinish) {
+                        mDisconnectAndFinishDone = true;
+                        finish();
+                    }
+                }
+            }
+        }
+
+        @Override
+        public void onServiceDisconnected(ComponentName name) {
+            synchronized (mPendingRequests) {
+                if (!mPendingRequests.isEmpty()) {
+                    Log.w(LOG_TAG, "Some request(s) are dropped.");
+                }
+            }
+
+            // Set to null so that we can detect inappropriate re-connection toward
+            // the Service via NullPointerException;
+            mPendingRequests = null;
+            mMessenger = null;
+        }
+    }
+
+    private final CustomConnection mConnection = new CustomConnection();
+
+    private static class VCardFile {
+        private final String mName;
+        private final String mCanonicalPath;
+        private final long mLastModified;
+
+        public VCardFile(String name, String canonicalPath, long lastModified) {
+            mName = name;
+            mCanonicalPath = canonicalPath;
+            mLastModified = lastModified;
+        }
+
+        public String getName() {
+            return mName;
+        }
+
+        public String getCanonicalPath() {
+            return mCanonicalPath;
+        }
+
+        public long getLastModified() {
+            return mLastModified;
+        }
+    }
+
+    // Runs on the UI thread.
+    private class DialogDisplayer implements Runnable {
+        private final int mResId;
+        public DialogDisplayer(int resId) {
+            mResId = resId;
+        }
+        public DialogDisplayer(String errorMessage) {
+            mResId = R.id.dialog_error_with_message;
+            mErrorMessage = errorMessage;
+        }
+        public void run() {
+            showDialog(mResId);
+        }
+    }
+
+    private class CancelListener
+        implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener {
+        public void onClick(DialogInterface dialog, int which) {
+            finish();
+        }
+
+        public void onCancel(DialogInterface dialog) {
+            finish();
+        }
+    }
+
+    private CancelListener mCancelListener = new CancelListener();
+
+    /**
+     * Caches all vCard data into local data directory so that we allow
+     * {@link VCardService} to access all the contents in given Uris, some of
+     * which may not be accessible from other components due to permission problem.
+     * (Activity which gives the Uri may allow only this Activity to access that content,
+     * not the other components like {@link VCardService}.
+     *
+     * We also allow the Service to happen to exit during the vCard import procedure.
+     */
+    private class VCardCacheThread extends Thread
+            implements DialogInterface.OnCancelListener {
+        private static final String CACHE_FILE_PREFIX = "import_tmp_";
+        private boolean mCanceled;
+        private PowerManager.WakeLock mWakeLock;
+        private VCardParser mVCardParser;
+        private final Uri[] mSourceUris;
+
+        public VCardCacheThread(final Uri[] sourceUris) {
+            mSourceUris = sourceUris;
+            final int length = sourceUris.length;
+            final Context context = ImportVCardActivity.this;
+            final PowerManager powerManager =
+                    (PowerManager)context.getSystemService(Context.POWER_SERVICE);
+            mWakeLock = powerManager.newWakeLock(
+                    PowerManager.SCREEN_DIM_WAKE_LOCK |
+                    PowerManager.ON_AFTER_RELEASE, LOG_TAG);
+        }
+
+        @Override
+        public void finalize() {
+            if (mWakeLock != null && mWakeLock.isHeld()) {
+                mWakeLock.release();
+            }
+        }
+
+        @Override
+        public void run() {
+            final Context context = ImportVCardActivity.this;
+            final ContentResolver resolver = context.getContentResolver();
+            String errorMessage = null;
+            mWakeLock.acquire();
+            try {
+                clearOldCache();
+                mConnection.doBindService();
+
+                final int length = mSourceUris.length;
+                // Uris given from caller applications may not be opened twice: consider when
+                // it is not from local storage (e.g. "file:///...") but from some special
+                // provider (e.g. "content://...").
+                // Thus we have to once copy the content of Uri into local storage, and read
+                // it after it. This copy is also useful fro the view of stability of the import,
+                // as we are able to restore the procedure even when it is aborted during it.
+                // Imagine the case the importer encountered memory-low situation when
+                // reading 10th entry of a vCard file.
+                //
+                // We may be able to read content of each vCard file during copying them
+                // to local storage, but currently vCard code does not allow us to do so.
+                for (int i = 0; i < length; i++) {
+                    final Uri sourceUri = mSourceUris[i];
+                    final Uri localDataUri = copyToLocal(sourceUri, i);
+                    if (mCanceled) {
+                        break;
+                    }
+                    if (localDataUri == null) {
+                        Log.w(LOG_TAG, "destUri is null");
+                        break;
+                    }
+                    final ImportRequest parameter = constructRequestParameter(localDataUri);
+                    if (mCanceled) {
+                        return;
+                    }
+                    mConnection.requestSend(parameter);
+                }
+            } catch (OutOfMemoryError e) {
+                Log.e(LOG_TAG, "OutOfMemoryError");
+                // We should take care of this case since Android devices may have
+                // smaller memory than we usually expect.
+                System.gc();
+                runOnUiThread(new DialogDisplayer(
+                        getString(R.string.fail_reason_low_memory_during_import)));
+            } catch (IOException e) {
+                Log.e(LOG_TAG, e.getMessage());
+                runOnUiThread(new DialogDisplayer(
+                        getString(R.string.fail_reason_io_error)));
+            } finally {
+                mWakeLock.release();
+                mProgressDialogForCacheVCard.dismiss();
+                mConnection.tryDisconnectAndFinish();
+            }
+        }
+
+        /**
+         * Copy the content of sourceUri to local storage. 
+         */
+        private Uri copyToLocal(final Uri sourceUri, int i) throws IOException {
+            final Context context = ImportVCardActivity.this;
+            final ContentResolver resolver = context.getContentResolver();
+            ReadableByteChannel inputChannel = null;
+            WritableByteChannel outputChannel = null;
+            Uri destUri;
+            try {
+                // XXX: better way to copy stream?
+                {
+                    inputChannel = Channels.newChannel(resolver.openInputStream(mSourceUris[i]));
+                    final String filename = CACHE_FILE_PREFIX + i + ".vcf";
+                    destUri = Uri.parse(context.getFileStreamPath(filename).toURI().toString());
+                    outputChannel =
+                            context.openFileOutput(filename, Context.MODE_PRIVATE).getChannel();
+                    final ByteBuffer buffer = ByteBuffer.allocateDirect(8192);
+                    while (inputChannel.read(buffer) != -1) {
+                        if (mCanceled) {
+                            Log.d(LOG_TAG, "Canceled during caching " + mSourceUris[i]);
+                            return null;
+                        }
+                        buffer.flip();
+                        outputChannel.write(buffer);
+                        buffer.compact();
+                    }
+                    buffer.flip();
+                    while (buffer.hasRemaining()) {
+                        outputChannel.write(buffer);
+                    }
+                }
+            } finally {
+                if (inputChannel != null) {
+                    try {
+                        inputChannel.close();
+                    } catch (IOException e) {
+                        Log.w(LOG_TAG, "Failed to close inputChannel.");
+                    }
+                }
+                if (outputChannel != null) {
+                    try {
+                        outputChannel.close();
+                    } catch(IOException e) {
+                        Log.w(LOG_TAG, "Failed to close outputChannel");
+                    }
+                }
+            }
+            return destUri;
+        }
+
+        /**
+         * Reads the Uri once (or twice) and constructs {@link ImportRequest} from
+         * its content.
+         */
+        private ImportRequest constructRequestParameter(final Uri uri) {
+            final ContentResolver resolver =
+                    ImportVCardActivity.this.getContentResolver();
+            VCardEntryCounter counter = null;
+            VCardSourceDetector detector = null;
+            VCardInterpreterCollection interpreter = null;
+            int vcardVersion = VCARD_VERSION_V21;
+            try {
+                boolean shouldUseV30 = false;
+                InputStream is;
+
+                is = resolver.openInputStream(uri);
+                mVCardParser = new VCardParser_V21();
+                try {
+                    counter = new VCardEntryCounter();
+                    detector = new VCardSourceDetector();
+                    interpreter =
+                            new VCardInterpreterCollection(
+                                    Arrays.asList(counter, detector));
+                    mVCardParser.parse(is, interpreter);
+                } catch (VCardVersionException e1) {
+                    try {
+                        is.close();
+                    } catch (IOException e) {
+                    }
+
+                    shouldUseV30 = true;
+                    is = resolver.openInputStream(uri);
+                    mVCardParser = new VCardParser_V30();
+                    try {
+                        counter = new VCardEntryCounter();
+                        detector = new VCardSourceDetector();
+                        interpreter =
+                                new VCardInterpreterCollection(
+                                        Arrays.asList(counter, detector));
+                        mVCardParser.parse(is, interpreter);
+                    } catch (VCardVersionException e2) {
+                        throw new VCardException("vCard with unspported version.");
+                    }
+                } finally {
+                    if (is != null) {
+                        try {
+                            is.close();
+                        } catch (IOException e) {
+                        }
+                    }
+                }
+
+                vcardVersion = shouldUseV30 ? VCARD_VERSION_V30 : VCARD_VERSION_V21;
+            } catch (VCardNestedException e) {
+                Log.w(LOG_TAG, "Nested Exception is found (it may be false-positive).");
+                // Go through without returning null.
+            } catch (VCardException e) {
+                Log.e(LOG_TAG, e.getMessage());
+                return null;
+            } catch (IOException e) {
+                Log.e(LOG_TAG, "IOException was emitted: " + e.getMessage());
+                return null;
+            }
+            return new ImportRequest(mAccount, uri,
+                    detector.getEstimatedType(),
+                    detector.getEstimatedCharset(),
+                    vcardVersion, counter.getCount());
+        }
+
+        /**
+         * We (currently) don't have any way to clean up cache files used in the previous
+         * import process,
+         * TODO(dmiyakawa): Can we do it after Service being done?
+         */
+        private void clearOldCache() {
+            final Context context = ImportVCardActivity.this;
+            final String[] fileLists = context.fileList();
+            for (String fileName : fileLists) {
+                if (fileName.startsWith(CACHE_FILE_PREFIX)) {
+                    Log.d(LOG_TAG, "Remove temporary file: " + fileName);
+                    context.deleteFile(fileName);
+                }
+            }
+        }
+
+        public Uri[] getSourceUris() {
+            return mSourceUris;
+        }
+
+        public void cancel() {
+            mCanceled = true;
+            if (mVCardParser != null) {
+                mVCardParser.cancel();
+            }
+        }
+
+        public void onCancel(DialogInterface dialog) {
+            cancel();
+        }
+    }
+
+    private class ImportTypeSelectedListener implements
+            DialogInterface.OnClickListener {
+        public static final int IMPORT_ONE = 0;
+        public static final int IMPORT_MULTIPLE = 1;
+        public static final int IMPORT_ALL = 2;
+        public static final int IMPORT_TYPE_SIZE = 3;
+
+        private int mCurrentIndex;
+
+        public void onClick(DialogInterface dialog, int which) {
+            if (which == DialogInterface.BUTTON_POSITIVE) {
+                switch (mCurrentIndex) {
+                case IMPORT_ALL:
+                    importVCardFromSDCard(mAllVCardFileList);
+                    break;
+                case IMPORT_MULTIPLE:
+                    showDialog(R.id.dialog_select_multiple_vcard);
+                    break;
+                default:
+                    showDialog(R.id.dialog_select_one_vcard);
+                    break;
+                }
+            } else if (which == DialogInterface.BUTTON_NEGATIVE) {
+                finish();
+            } else {
+                mCurrentIndex = which;
+            }
+        }
+    }
+
+    private class VCardSelectedListener implements
+            DialogInterface.OnClickListener, DialogInterface.OnMultiChoiceClickListener {
+        private int mCurrentIndex;
+        private Set<Integer> mSelectedIndexSet;
+
+        public VCardSelectedListener(boolean multipleSelect) {
+            mCurrentIndex = 0;
+            if (multipleSelect) {
+                mSelectedIndexSet = new HashSet<Integer>();
+            }
+        }
+
+        public void onClick(DialogInterface dialog, int which) {
+            if (which == DialogInterface.BUTTON_POSITIVE) {
+                if (mSelectedIndexSet != null) {
+                    List<VCardFile> selectedVCardFileList = new ArrayList<VCardFile>();
+                    final int size = mAllVCardFileList.size();
+                    // We'd like to sort the files by its index, so we do not use Set iterator.
+                    for (int i = 0; i < size; i++) {
+                        if (mSelectedIndexSet.contains(i)) {
+                            selectedVCardFileList.add(mAllVCardFileList.get(i));
+                        }
+                    }
+                    importVCardFromSDCard(selectedVCardFileList);
+                } else {
+                    importVCardFromSDCard(mAllVCardFileList.get(mCurrentIndex));
+                }
+            } else if (which == DialogInterface.BUTTON_NEGATIVE) {
+                finish();
+            } else {
+                // Some file is selected.
+                mCurrentIndex = which;
+                if (mSelectedIndexSet != null) {
+                    if (mSelectedIndexSet.contains(which)) {
+                        mSelectedIndexSet.remove(which);
+                    } else {
+                        mSelectedIndexSet.add(which);
+                    }
+                }
+            }
+        }
+
+        public void onClick(DialogInterface dialog, int which, boolean isChecked) {
+            if (mSelectedIndexSet == null || (mSelectedIndexSet.contains(which) == isChecked)) {
+                Log.e(LOG_TAG, String.format("Inconsist state in index %d (%s)", which,
+                        mAllVCardFileList.get(which).getCanonicalPath()));
+            } else {
+                onClick(dialog, which);
+            }
+        }
+    }
+
+    /**
+     * Thread scanning VCard from SDCard. After scanning, the dialog which lets a user select
+     * a vCard file is shown. After the choice, VCardReadThread starts running.
+     */
+    private class VCardScanThread extends Thread implements OnCancelListener, OnClickListener {
+        private boolean mCanceled;
+        private boolean mGotIOException;
+        private File mRootDirectory;
+
+        // To avoid recursive link.
+        private Set<String> mCheckedPaths;
+        private PowerManager.WakeLock mWakeLock;
+
+        private class CanceledException extends Exception {
+        }
+
+        public VCardScanThread(File sdcardDirectory) {
+            mCanceled = false;
+            mGotIOException = false;
+            mRootDirectory = sdcardDirectory;
+            mCheckedPaths = new HashSet<String>();
+            PowerManager powerManager = (PowerManager)ImportVCardActivity.this.getSystemService(
+                    Context.POWER_SERVICE);
+            mWakeLock = powerManager.newWakeLock(
+                    PowerManager.SCREEN_DIM_WAKE_LOCK |
+                    PowerManager.ON_AFTER_RELEASE, LOG_TAG);
+        }
+
+        @Override
+        public void run() {
+            mAllVCardFileList = new Vector<VCardFile>();
+            try {
+                mWakeLock.acquire();
+                getVCardFileRecursively(mRootDirectory);
+            } catch (CanceledException e) {
+                mCanceled = true;
+            } catch (IOException e) {
+                mGotIOException = true;
+            } finally {
+                mWakeLock.release();
+            }
+
+            if (mCanceled) {
+                mAllVCardFileList = null;
+            }
+
+            mProgressDialogForScanVCard.dismiss();
+            mProgressDialogForScanVCard = null;
+
+            if (mGotIOException) {
+                runOnUiThread(new DialogDisplayer(R.id.dialog_io_exception));
+            } else if (mCanceled) {
+                finish();
+            } else {
+                int size = mAllVCardFileList.size();
+                final Context context = ImportVCardActivity.this;
+                if (size == 0) {
+                    runOnUiThread(new DialogDisplayer(R.id.dialog_vcard_not_found));
+                } else {
+                    startVCardSelectAndImport();
+                }
+            }
+        }
+
+        private void getVCardFileRecursively(File directory)
+                throws CanceledException, IOException {
+            if (mCanceled) {
+                throw new CanceledException();
+            }
+
+            // e.g. secured directory may return null toward listFiles().
+            final File[] files = directory.listFiles();
+            if (files == null) {
+                final String currentDirectoryPath = directory.getCanonicalPath();
+                final String secureDirectoryPath =
+                        mRootDirectory.getCanonicalPath().concat(SECURE_DIRECTORY_NAME);
+                if (!TextUtils.equals(currentDirectoryPath, secureDirectoryPath)) {
+                    Log.w(LOG_TAG, "listFiles() returned null (directory: " + directory + ")");
+                }
+                return;
+            }
+            for (File file : directory.listFiles()) {
+                if (mCanceled) {
+                    throw new CanceledException();
+                }
+                String canonicalPath = file.getCanonicalPath();
+                if (mCheckedPaths.contains(canonicalPath)) {
+                    continue;
+                }
+
+                mCheckedPaths.add(canonicalPath);
+
+                if (file.isDirectory()) {
+                    getVCardFileRecursively(file);
+                } else if (canonicalPath.toLowerCase().endsWith(".vcf") &&
+                        file.canRead()){
+                    String fileName = file.getName();
+                    VCardFile vcardFile = new VCardFile(
+                            fileName, canonicalPath, file.lastModified());
+                    mAllVCardFileList.add(vcardFile);
+                }
+            }
+        }
+
+        public void onCancel(DialogInterface dialog) {
+            mCanceled = true;
+        }
+
+        public void onClick(DialogInterface dialog, int which) {
+            if (which == DialogInterface.BUTTON_NEGATIVE) {
+                mCanceled = true;
+            }
+        }
+    }
+
+    private void startVCardSelectAndImport() {
+        int size = mAllVCardFileList.size();
+        if (getResources().getBoolean(R.bool.config_import_all_vcard_from_sdcard_automatically) ||
+                size == 1) {
+            importVCardFromSDCard(mAllVCardFileList);
+        } else if (getResources().getBoolean(R.bool.config_allow_users_select_all_vcard_import)) {
+            runOnUiThread(new DialogDisplayer(R.id.dialog_select_import_type));
+        } else {
+            runOnUiThread(new DialogDisplayer(R.id.dialog_select_one_vcard));
+        }
+    }
+
+    private void importVCardFromSDCard(final List<VCardFile> selectedVCardFileList) {
+        final int size = selectedVCardFileList.size();
+        String[] uriStrings = new String[size];
+        int i = 0;
+        for (VCardFile vcardFile : selectedVCardFileList) {
+            uriStrings[i] = "file://" + vcardFile.getCanonicalPath();
+            i++;
+        }
+        importVCard(uriStrings);
+    }
+    
+    private void importVCardFromSDCard(final VCardFile vcardFile) {
+        importVCard(new Uri[] {Uri.parse("file://" + vcardFile.getCanonicalPath())});
+    }
+
+    private void importVCard(final Uri uri) {
+        importVCard(new Uri[] {uri});
+    }
+
+    private void importVCard(final String[] uriStrings) {
+        final int length = uriStrings.length;
+        final Uri[] uris = new Uri[length];
+        for (int i = 0; i < length; i++) {
+            uris[i] = Uri.parse(uriStrings[i]);
+        }
+        importVCard(uris);
+    }
+
+    private void importVCard(final Uri[] uris) {
+        runOnUiThread(new Runnable() {
+            public void run() {
+                mVCardCacheThread = new VCardCacheThread(uris);
+                showDialog(R.id.dialog_cache_vcard);
+            }
+        });
+    }
+
+    private Dialog getSelectImportTypeDialog() {
+        final DialogInterface.OnClickListener listener = new ImportTypeSelectedListener();
+        final AlertDialog.Builder builder = new AlertDialog.Builder(this)
+                .setTitle(R.string.select_vcard_title)
+                .setPositiveButton(android.R.string.ok, listener)
+                .setOnCancelListener(mCancelListener)
+                .setNegativeButton(android.R.string.cancel, mCancelListener);
+
+        final String[] items = new String[ImportTypeSelectedListener.IMPORT_TYPE_SIZE];
+        items[ImportTypeSelectedListener.IMPORT_ONE] =
+                getString(R.string.import_one_vcard_string);
+        items[ImportTypeSelectedListener.IMPORT_MULTIPLE] =
+                getString(R.string.import_multiple_vcard_string);
+        items[ImportTypeSelectedListener.IMPORT_ALL] =
+                getString(R.string.import_all_vcard_string);
+        builder.setSingleChoiceItems(items, ImportTypeSelectedListener.IMPORT_ONE, listener);
+        return builder.create();
+    }
+
+    private Dialog getVCardFileSelectDialog(boolean multipleSelect) {
+        final int size = mAllVCardFileList.size();
+        final VCardSelectedListener listener = new VCardSelectedListener(multipleSelect);
+        final AlertDialog.Builder builder =
+                new AlertDialog.Builder(this)
+                        .setTitle(R.string.select_vcard_title)
+                        .setPositiveButton(android.R.string.ok, listener)
+                        .setOnCancelListener(mCancelListener)
+                        .setNegativeButton(android.R.string.cancel, mCancelListener);
+
+        CharSequence[] items = new CharSequence[size];
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        for (int i = 0; i < size; i++) {
+            VCardFile vcardFile = mAllVCardFileList.get(i);
+            SpannableStringBuilder stringBuilder = new SpannableStringBuilder();
+            stringBuilder.append(vcardFile.getName());
+            stringBuilder.append('\n');
+            int indexToBeSpanned = stringBuilder.length();
+            // Smaller date text looks better, since each file name becomes easier to read.
+            // The value set to RelativeSizeSpan is arbitrary. You can change it to any other
+            // value (but the value bigger than 1.0f would not make nice appearance :)
+            stringBuilder.append(
+                        "(" + dateFormat.format(new Date(vcardFile.getLastModified())) + ")");
+            stringBuilder.setSpan(
+                    new RelativeSizeSpan(0.7f), indexToBeSpanned, stringBuilder.length(),
+                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+            items[i] = stringBuilder;
+        }
+        if (multipleSelect) {
+            builder.setMultiChoiceItems(items, (boolean[])null, listener);
+        } else {
+            builder.setSingleChoiceItems(items, 0, listener);
+        }
+        return builder.create();
+    }
+
+    @Override
+    protected void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+
+        String accountName = null;
+        String accountType = null;
+        final Intent intent = getIntent();
+        if (intent != null) {
+            accountName = intent.getStringExtra(SelectAccountActivity.ACCOUNT_NAME);
+            accountType = intent.getStringExtra(SelectAccountActivity.ACCOUNT_TYPE);
+            mAction = intent.getAction();
+            mUri = intent.getData();
+        } else {
+            Log.e(LOG_TAG, "intent does not exist");
+        }
+
+        if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(accountType)) {
+            mAccount = new Account(accountName, accountType);
+        } else {
+            final AccountTypes sources = AccountTypes.getInstance(this);
+            final List<Account> accountList = sources.getAccounts(true);
+            if (accountList.size() == 0) {
+                mAccount = null;
+            } else if (accountList.size() == 1) {
+                mAccount = accountList.get(0);
+            } else {
+                startActivityForResult(new Intent(this, SelectAccountActivity.class),
+                        SELECT_ACCOUNT);
+                return;
+            }
+        }
+
+        startImport(mAction, mUri);
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+        if (requestCode == SELECT_ACCOUNT) {
+            if (resultCode == RESULT_OK) {
+                mAccount = new Account(
+                        intent.getStringExtra(SelectAccountActivity.ACCOUNT_NAME),
+                        intent.getStringExtra(SelectAccountActivity.ACCOUNT_TYPE));
+                startImport(mAction, mUri);
+            } else {
+                if (resultCode != RESULT_CANCELED) {
+                    Log.w(LOG_TAG, "Result code was not OK nor CANCELED: " + resultCode);
+                }
+                finish();
+            }
+        }
+    }
+
+    private void startImport(String action, Uri uri) {
+        Log.d(LOG_TAG, "action = " + action + " ; path = " + uri);
+
+        if (uri != null) {
+            importVCard(uri);
+        } else {
+            doScanExternalStorageAndImportVCard();
+        }
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int resId, Bundle bundle) {
+        switch (resId) {
+            case R.string.import_from_sdcard: {
+                if (mAccountSelectionListener == null) {
+                    throw new NullPointerException(
+                            "mAccountSelectionListener must not be null.");
+                }
+                return AccountSelectionUtil.getSelectAccountDialog(this, resId,
+                        mAccountSelectionListener, mCancelListener);
+            }
+            case R.id.dialog_searching_vcard: {
+                if (mProgressDialogForScanVCard == null) {
+                    String title = getString(R.string.searching_vcard_title);
+                    String message = getString(R.string.searching_vcard_message);
+                    mProgressDialogForScanVCard =
+                        ProgressDialog.show(this, title, message, true, false);
+                    mProgressDialogForScanVCard.setOnCancelListener(mVCardScanThread);
+                    mVCardScanThread.start();
+                }
+                return mProgressDialogForScanVCard;
+            }
+            case R.id.dialog_sdcard_not_found: {
+                AlertDialog.Builder builder = new AlertDialog.Builder(this)
+                    .setTitle(R.string.no_sdcard_title)
+                    .setIcon(android.R.drawable.ic_dialog_alert)
+                    .setMessage(R.string.no_sdcard_message)
+                    .setOnCancelListener(mCancelListener)
+                    .setPositiveButton(android.R.string.ok, mCancelListener);
+                return builder.create();
+            }
+            case R.id.dialog_vcard_not_found: {
+                String message = (getString(R.string.scanning_sdcard_failed_message,
+                        getString(R.string.fail_reason_no_vcard_file)));
+                AlertDialog.Builder builder = new AlertDialog.Builder(this)
+                    .setTitle(R.string.scanning_sdcard_failed_title)
+                    .setMessage(message)
+                    .setOnCancelListener(mCancelListener)
+                    .setPositiveButton(android.R.string.ok, mCancelListener);
+                return builder.create();
+            }
+            case R.id.dialog_select_import_type: {
+                return getSelectImportTypeDialog();
+            }
+            case R.id.dialog_select_multiple_vcard: {
+                return getVCardFileSelectDialog(true);
+            }
+            case R.id.dialog_select_one_vcard: {
+                return getVCardFileSelectDialog(false);
+            }
+            case R.id.dialog_cache_vcard: {
+                if (mProgressDialogForCacheVCard == null) {
+                    final String title = getString(R.string.caching_vcard_title);
+                    final String message = getString(R.string.caching_vcard_message);
+                    mProgressDialogForCacheVCard = new ProgressDialog(this);
+                    mProgressDialogForCacheVCard.setTitle(title);
+                    mProgressDialogForCacheVCard.setMessage(message);
+                    mProgressDialogForCacheVCard.setProgressStyle(ProgressDialog.STYLE_SPINNER);
+                    mProgressDialogForCacheVCard.setOnCancelListener(mVCardCacheThread);
+                    mVCardCacheThread.start();
+                }
+                return mProgressDialogForCacheVCard;
+            }
+            case R.id.dialog_io_exception: {
+                String message = (getString(R.string.scanning_sdcard_failed_message,
+                        getString(R.string.fail_reason_io_error)));
+                AlertDialog.Builder builder = new AlertDialog.Builder(this)
+                    .setTitle(R.string.scanning_sdcard_failed_title)
+                    .setIcon(android.R.drawable.ic_dialog_alert)
+                    .setMessage(message)
+                    .setOnCancelListener(mCancelListener)
+                    .setPositiveButton(android.R.string.ok, mCancelListener);
+                return builder.create();
+            }
+            case R.id.dialog_error_with_message: {
+                String message = mErrorMessage;
+                if (TextUtils.isEmpty(message)) {
+                    Log.e(LOG_TAG, "Error message is null while it must not.");
+                    message = getString(R.string.fail_reason_unknown);
+                }
+                final AlertDialog.Builder builder = new AlertDialog.Builder(this)
+                    .setTitle(getString(R.string.reading_vcard_failed_title))
+                    .setIcon(android.R.drawable.ic_dialog_alert)
+                    .setMessage(message)
+                    .setOnCancelListener(mCancelListener)
+                    .setPositiveButton(android.R.string.ok, mCancelListener);
+                return builder.create();
+            }
+        }
+
+        return super.onCreateDialog(resId, bundle);
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        if (mVCardCacheThread != null) {
+            final Uri[] uris = mVCardCacheThread.getSourceUris();
+            final int length = uris.length;
+            final String[] uriStrings = new String[length];
+            for (int i = 0; i < length; i++) {
+                    uriStrings[i] = uris[i].toString();
+            }
+            outState.putStringArray(CACHED_URIS, uriStrings);
+
+            mVCardCacheThread.cancel();
+        }
+    }
+
+    @Override
+    protected void onRestoreInstanceState(Bundle inState) {
+        final String[] uriStrings = inState.getStringArray(CACHED_URIS);
+        if (uriStrings != null && uriStrings.length > 0) {
+            final int length = uriStrings.length;
+            final Uri[] uris = new Uri[length];
+            for (int i = 0; i < length; i++) {
+                uris[i] = Uri.parse(uriStrings[i]);
+            }
+
+            mVCardCacheThread = new VCardCacheThread(uris);
+        }
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+
+        mConnection.tryDisconnectAndFinish();
+
+        // ImportVCardActivity should not be persistent. In other words, if there's some
+        // event calling onPause(), this Activity should finish its work and give the main
+        // screen back to the caller Activity.
+        if (!isFinishing()) {
+            finish();
+        }
+    }
+
+    /**
+     * Scans vCard in external storage (typically SDCard) and tries to import it.
+     * - When there's no SDCard available, an error dialog is shown.
+     * - When multiple vCard files are available, asks a user to select one.
+     */
+    private void doScanExternalStorageAndImportVCard() {
+        // TODO: should use getExternalStorageState().
+        final File file = Environment.getExternalStorageDirectory();
+        if (!file.exists() || !file.isDirectory() || !file.canRead()) {
+            showDialog(R.id.dialog_sdcard_not_found);
+        } else {
+            mVCardScanThread = new VCardScanThread(file);
+            showDialog(R.id.dialog_searching_vcard);
+        }
+    }
+}
diff --git a/src/com/android/contacts/vcard/SelectAccountActivity.java b/src/com/android/contacts/vcard/SelectAccountActivity.java
new file mode 100644
index 0000000..3b78921
--- /dev/null
+++ b/src/com/android/contacts/vcard/SelectAccountActivity.java
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.android.contacts.R;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.util.AccountSelectionUtil;
+
+import java.util.List;
+
+public class SelectAccountActivity extends Activity {
+    private static final String LOG_TAG = "SelectAccountActivity";
+
+    public static final String ACCOUNT_NAME = "account_name";
+    public static final String ACCOUNT_TYPE = "account_type";
+
+    private class CancelListener
+            implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener {
+        public void onClick(DialogInterface dialog, int which) {
+            finish();
+        }
+        public void onCancel(DialogInterface dialog) {
+            finish();
+        }
+    }
+
+    private AccountSelectionUtil.AccountSelectedListener mAccountSelectionListener;
+
+    @Override
+    protected void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+
+        // There's three possibilities:
+        // - more than one accounts -> ask the user
+        // - just one account -> use the account without asking the user
+        // - no account -> use phone-local storage without asking the user
+        final int resId = R.string.import_from_sdcard;
+        final AccountTypes sources = AccountTypes.getInstance(this);
+        final List<Account> accountList = sources.getAccounts(true);
+        if (accountList.size() == 0) {
+            Log.w(LOG_TAG, "Account does not exist");
+            finish();
+        } else if (accountList.size() == 1) {
+            final Account account = accountList.get(0);
+            final Intent intent = new Intent();
+            intent.putExtra(ACCOUNT_NAME, account.name);
+            intent.putExtra(ACCOUNT_TYPE, account.type);
+            setResult(RESULT_OK, intent);
+            finish();
+        }
+
+        // Multiple accounts. Let users to select one.
+        mAccountSelectionListener =
+                new AccountSelectionUtil.AccountSelectedListener(
+                        this, accountList, resId) {
+                    @Override
+                    public void onClick(DialogInterface dialog, int which) {
+                        dialog.dismiss();
+                        final Account account = mAccountList.get(which);
+                        final Intent intent = new Intent();
+                        intent.putExtra(ACCOUNT_NAME, account.name);
+                        intent.putExtra(ACCOUNT_TYPE, account.type);
+                        setResult(RESULT_OK, intent);
+                        finish();
+                    }
+                };
+        showDialog(resId);
+        return;
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int resId, Bundle bundle) {
+        switch (resId) {
+            case R.string.import_from_sdcard: {
+                if (mAccountSelectionListener == null) {
+                    throw new NullPointerException(
+                            "mAccountSelectionListener must not be null.");
+                }
+                return AccountSelectionUtil.getSelectAccountDialog(this, resId,
+                        mAccountSelectionListener,
+                        new CancelListener());
+            }
+        }
+        return super.onCreateDialog(resId, bundle);
+    }
+}
diff --git a/src/com/android/contacts/vcard/ThreadStarter.java b/src/com/android/contacts/vcard/ThreadStarter.java
new file mode 100644
index 0000000..d7adad6
--- /dev/null
+++ b/src/com/android/contacts/vcard/ThreadStarter.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+public interface ThreadStarter {
+    public void start();
+}
\ No newline at end of file
diff --git a/src/com/android/contacts/vcard/VCardService.java b/src/com/android/contacts/vcard/VCardService.java
new file mode 100644
index 0000000..1e855ab
--- /dev/null
+++ b/src/com/android/contacts/vcard/VCardService.java
@@ -0,0 +1,127 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.android.contacts.R;
+
+/**
+ * The class responsible for importing vCard from one ore multiple Uris.
+ */
+public class VCardService extends Service {
+    private final static String LOG_TAG = VCardService.class.getSimpleName();
+
+    /* package */ static final int MSG_IMPORT_REQUEST = 1;
+    /* package */ static final int MSG_EXPORT_REQUEST = 2;
+    /* package */ static final int MSG_CANCEL_IMPORT_REQUEST = 3;
+    /* package */ static final int MSG_NOTIFY_IMPORT_FINISHED = 5;
+
+    /* package */ static final int IMPORT_NOTIFICATION_ID = 1000;
+    /* package */ static final int EXPORT_NOTIFICATION_ID = 1001;
+
+    /**
+     * Small vCard file is imported soon, so any meassage saying "vCard import started" is
+     * not needed. We show the message when the size of vCard is larger than this constant. 
+     */
+    private static final int IMPORT_NOTIFICATION_THRESHOLD = 10;
+
+    public class ImportRequestHandler extends Handler {
+        private ImportProcessor mImportProcessor;
+        private ExportProcessor mExportProcessor = new ExportProcessor(VCardService.this);
+        private boolean mDoDelayedCancel = false;
+
+        public ImportRequestHandler() {
+            super();
+        }
+
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case MSG_IMPORT_REQUEST: {
+                    if (mDoDelayedCancel) {
+                        Log.i(LOG_TAG, "A cancel request came before import request. " +
+                                "Refrain current import once.");
+                        mDoDelayedCancel = false;
+                    } else {
+                        final ImportRequest parameter = (ImportRequest)msg.obj;
+
+                        if (mImportProcessor == null || !mImportProcessor.isReadyForRequest()) {
+                            mImportProcessor = new ImportProcessor(VCardService.this);
+                        } else if (mImportProcessor.isCanceled()) {
+                            Log.i(LOG_TAG,
+                                    "Existing ImporterProcessor is canceled. create another.");
+                            mImportProcessor = new ImportProcessor(VCardService.this);
+                        }
+
+                        mImportProcessor.pushRequest(parameter);
+                        if (parameter.entryCount > IMPORT_NOTIFICATION_THRESHOLD) {
+                            Toast.makeText(VCardService.this,
+                                    getString(R.string.vcard_importer_start_message),
+                                    Toast.LENGTH_LONG).show();
+                        }
+                    }
+                    break;
+                }
+                case MSG_EXPORT_REQUEST: {
+                    final ExportRequest parameter = (ExportRequest)msg.obj;
+                    mExportProcessor.pushRequest(parameter);
+                    Toast.makeText(VCardService.this,
+                            getString(R.string.vcard_exporter_start_message),
+                            Toast.LENGTH_LONG).show();
+                    break;
+                }
+                case MSG_CANCEL_IMPORT_REQUEST: {
+                    if (mImportProcessor != null) {
+                        mImportProcessor.cancel();
+                    } else {
+                        Log.w(LOG_TAG, "ImportProcessor isn't ready. Delay the cancel request.");
+                        mDoDelayedCancel = true;
+                    }
+                    break;
+                }
+                case MSG_NOTIFY_IMPORT_FINISHED: {
+                    Log.d(LOG_TAG, "MSG_NOTIFY_IMPORT_FINISHED");
+                    break;
+                }
+                default: {
+                    Log.e(LOG_TAG, "Unknown request type: " + msg.what);
+                    super.hasMessages(msg.what);
+                }
+            }
+        }
+    }
+
+    private ImportRequestHandler mHandler = new ImportRequestHandler();
+    private Messenger mMessenger = new Messenger(mHandler);
+
+    @Override
+    public int onStartCommand(Intent intent, int flags, int id) {
+        return START_STICKY;
+    }
+
+    @Override
+    public IBinder onBind(Intent intent) {
+        return mMessenger.getBinder();
+    }
+}
diff --git a/src/com/android/contacts/views/ContactLoader.java b/src/com/android/contacts/views/ContactLoader.java
new file mode 100644
index 0000000..d272f59
--- /dev/null
+++ b/src/com/android/contacts/views/ContactLoader.java
@@ -0,0 +1,851 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.views;
+
+import com.android.contacts.util.DataStatus;
+
+import android.content.ContentResolver;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Entity;
+import android.content.Entity.NamedContentValues;
+import android.content.Loader;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.Resources;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.Directory;
+import android.provider.ContactsContract.DisplayNameSources;
+import android.provider.ContactsContract.Groups;
+import android.provider.ContactsContract.RawContacts;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Loads a single Contact and all it constituent RawContacts.
+ */
+public class ContactLoader extends Loader<ContactLoader.Result> {
+    private static final String TAG = "ContactLoader";
+
+    private Uri mLookupUri;
+    private boolean mLoadGroupMetaData;
+    private Result mContact;
+    private ForceLoadContentObserver mObserver;
+    private boolean mDestroyed;
+
+
+    public interface Listener {
+        public void onContactLoaded(Result contact);
+    }
+
+    /**
+     * The result of a load operation. Contains all data necessary to display the contact.
+     */
+    public static final class Result {
+        /**
+         * Singleton instance that represents "No Contact Found"
+         */
+        public static final Result NOT_FOUND = new Result();
+
+        /**
+         * Singleton instance that represents an error, e.g. because of an invalid Uri
+         * TODO: We should come up with something nicer here. Maybe use an Either type so
+         * that we can capture the Exception?
+         */
+        public static final Result ERROR = new Result();
+
+        private final Uri mLookupUri;
+        private final Uri mUri;
+        private final long mDirectoryId;
+        private final String mLookupKey;
+        private final long mId;
+        private final long mNameRawContactId;
+        private final int mDisplayNameSource;
+        private final long mPhotoId;
+        private final String mPhotoUri;
+        private final String mDisplayName;
+        private final String mPhoneticName;
+        private final boolean mStarred;
+        private final Integer mPresence;
+        private final ArrayList<Entity> mEntities;
+        private final HashMap<Long, DataStatus> mStatuses;
+        private final String mStatus;
+        private final Long mStatusTimestamp;
+        private final Integer mStatusLabel;
+        private final String mStatusResPackage;
+
+        private String mDirectoryDisplayName;
+        private String mDirectoryType;
+        private String mDirectoryAccountType;
+        private String mDirectoryAccountName;
+        private int mDirectoryExportSupport;
+
+        private ArrayList<GroupMetaData> mGroups;
+
+        /**
+         * Constructor for case "no contact found". This must only be used for the
+         * final {@link Result#NOT_FOUND} singleton
+         */
+        private Result() {
+            mLookupUri = null;
+            mUri = null;
+            mDirectoryId = -1;
+            mLookupKey = null;
+            mId = -1;
+            mEntities = null;
+            mStatuses = null;
+            mNameRawContactId = -1;
+            mDisplayNameSource = DisplayNameSources.UNDEFINED;
+            mPhotoId = -1;
+            mPhotoUri = null;
+            mDisplayName = null;
+            mPhoneticName = null;
+            mStarred = false;
+            mPresence = null;
+            mStatus = null;
+            mStatusTimestamp = null;
+            mStatusLabel = null;
+            mStatusResPackage = null;
+        }
+
+        /**
+         * Constructor to call when contact was found
+         * @param photoUri TODO
+         */
+        private Result(Uri uri, Uri lookupUri, long directoryId, String lookupKey, long id,
+                long nameRawContactId, int displayNameSource, long photoId, String photoUri,
+                String displayName, String phoneticName, boolean starred, Integer presence,
+                String status, Long statusTimestamp, Integer statusLabel, String statusResPackage) {
+            mLookupUri = lookupUri;
+            mUri = uri;
+            mDirectoryId = directoryId;
+            mLookupKey = lookupKey;
+            mId = id;
+            mEntities = new ArrayList<Entity>();
+            mStatuses = new HashMap<Long, DataStatus>();
+            mNameRawContactId = nameRawContactId;
+            mDisplayNameSource = displayNameSource;
+            mPhotoId = photoId;
+            mPhotoUri = photoUri;
+            mDisplayName = displayName;
+            mPhoneticName = phoneticName;
+            mStarred = starred;
+            mPresence = presence;
+            mStatus = status;
+            mStatusTimestamp = statusTimestamp;
+            mStatusLabel = statusLabel;
+            mStatusResPackage = statusResPackage;
+        }
+
+        /**
+         * @param exportSupport See {@link Directory#EXPORT_SUPPORT}.
+         */
+        private void setDirectoryMetaData(String displayName, String directoryType,
+                String accountType, String accountName, int exportSupport) {
+            mDirectoryDisplayName = displayName;
+            mDirectoryType = directoryType;
+            mDirectoryAccountType = accountType;
+            mDirectoryAccountName = accountName;
+            mDirectoryExportSupport = exportSupport;
+        }
+
+        public Uri getLookupUri() {
+            return mLookupUri;
+        }
+        public String getLookupKey() {
+            return mLookupKey;
+        }
+        public Uri getUri() {
+            return mUri;
+        }
+        public long getId() {
+            return mId;
+        }
+        public long getNameRawContactId() {
+            return mNameRawContactId;
+        }
+        public int getDisplayNameSource() {
+            return mDisplayNameSource;
+        }
+        public long getPhotoId() {
+            return mPhotoId;
+        }
+        public String getPhotoUri() {
+            return mPhotoUri;
+        }
+        public String getDisplayName() {
+            return mDisplayName;
+        }
+        public String getPhoneticName() {
+            return mPhoneticName;
+        }
+        public boolean getStarred() {
+            return mStarred;
+        }
+        public Integer getPresence() {
+            return mPresence;
+        }
+        public String getSocialSnippet() {
+            return mStatus;
+        }
+        public Long getStatusTimestamp() {
+            return mStatusTimestamp;
+        }
+        public Integer getStatusLabel() {
+            return mStatusLabel;
+        }
+        public String getStatusResPackage() {
+            return mStatusResPackage;
+        }
+        public ArrayList<Entity> getEntities() {
+            return mEntities;
+        }
+        public HashMap<Long, DataStatus> getStatuses() {
+            return mStatuses;
+        }
+
+        public long getDirectoryId() {
+            return mDirectoryId;
+        }
+
+        public boolean isDirectoryEntry() {
+            return mDirectoryId != -1 && mDirectoryId != Directory.DEFAULT
+                    && mDirectoryId != Directory.LOCAL_INVISIBLE;
+        }
+
+        public int getDirectoryExportSupport() {
+            return mDirectoryExportSupport;
+        }
+
+        public String getDirectoryDisplayName() {
+            return mDirectoryDisplayName;
+        }
+
+        public String getDirectoryType() {
+            return mDirectoryType;
+        }
+
+        public String getDirectoryAccountType() {
+            return mDirectoryAccountType;
+        }
+
+        public String getDirectoryAccountName() {
+            return mDirectoryAccountName;
+        }
+
+        public ArrayList<ContentValues> getContentValues() {
+            if (mEntities.size() != 1) {
+                throw new IllegalStateException(
+                        "Cannot extract content values from an aggregated contact");
+            }
+
+            Entity entity = mEntities.get(0);
+            ArrayList<ContentValues> result = new ArrayList<ContentValues>();
+            ArrayList<NamedContentValues> subValues = entity.getSubValues();
+            if (subValues != null) {
+                int size = subValues.size();
+                for (int i = 0; i < size; i++) {
+                    NamedContentValues pair = subValues.get(i);
+                    if (Data.CONTENT_URI.equals(pair.uri)) {
+                        result.add(pair.values);
+                    }
+                }
+            }
+            return result;
+        }
+
+        private void addGroupMetaData(GroupMetaData group) {
+            if (mGroups == null) {
+                mGroups = new ArrayList<GroupMetaData>();
+            }
+            mGroups.add(group);
+        }
+
+        public List<GroupMetaData> getGroupMetaData() {
+            return mGroups;
+        }
+    }
+
+    private static class ContactQuery {
+        // Projection used for the query that loads all data for the entire contact.
+        final static String[] COLUMNS = new String[] {
+                Contacts.NAME_RAW_CONTACT_ID,
+                Contacts.DISPLAY_NAME_SOURCE,
+                Contacts.LOOKUP_KEY,
+                Contacts.DISPLAY_NAME,
+                Contacts.PHONETIC_NAME,
+                Contacts.PHOTO_ID,
+                Contacts.STARRED,
+                Contacts.CONTACT_PRESENCE,
+                Contacts.CONTACT_STATUS,
+                Contacts.CONTACT_STATUS_TIMESTAMP,
+                Contacts.CONTACT_STATUS_RES_PACKAGE,
+                Contacts.CONTACT_STATUS_LABEL,
+                Contacts.Entity.CONTACT_ID,
+                Contacts.Entity.RAW_CONTACT_ID,
+
+                RawContacts.ACCOUNT_NAME,
+                RawContacts.ACCOUNT_TYPE,
+                RawContacts.DIRTY,
+                RawContacts.VERSION,
+                RawContacts.SOURCE_ID,
+                RawContacts.SYNC1,
+                RawContacts.SYNC2,
+                RawContacts.SYNC3,
+                RawContacts.SYNC4,
+                RawContacts.DELETED,
+                RawContacts.IS_RESTRICTED,
+                RawContacts.NAME_VERIFIED,
+
+                Contacts.Entity.DATA_ID,
+                Data.DATA1,
+                Data.DATA2,
+                Data.DATA3,
+                Data.DATA4,
+                Data.DATA5,
+                Data.DATA6,
+                Data.DATA7,
+                Data.DATA8,
+                Data.DATA9,
+                Data.DATA10,
+                Data.DATA11,
+                Data.DATA12,
+                Data.DATA13,
+                Data.DATA14,
+                Data.DATA15,
+                Data.SYNC1,
+                Data.SYNC2,
+                Data.SYNC3,
+                Data.SYNC4,
+                Data.DATA_VERSION,
+                Data.IS_PRIMARY,
+                Data.IS_SUPER_PRIMARY,
+                Data.MIMETYPE,
+                Data.RES_PACKAGE,
+
+                GroupMembership.GROUP_SOURCE_ID,
+
+                Data.PRESENCE,
+                Data.CHAT_CAPABILITY,
+                Data.STATUS,
+                Data.STATUS_RES_PACKAGE,
+                Data.STATUS_ICON,
+                Data.STATUS_LABEL,
+                Data.STATUS_TIMESTAMP,
+
+                Contacts.PHOTO_URI,
+        };
+
+        public final static int NAME_RAW_CONTACT_ID = 0;
+        public final static int DISPLAY_NAME_SOURCE = 1;
+        public final static int LOOKUP_KEY = 2;
+        public final static int DISPLAY_NAME = 3;
+        public final static int PHONETIC_NAME = 4;
+        public final static int PHOTO_ID = 5;
+        public final static int STARRED = 6;
+        public final static int CONTACT_PRESENCE = 7;
+        public final static int CONTACT_STATUS = 8;
+        public final static int CONTACT_STATUS_TIMESTAMP = 9;
+        public final static int CONTACT_STATUS_RES_PACKAGE = 10;
+        public final static int CONTACT_STATUS_LABEL = 11;
+        public final static int CONTACT_ID = 12;
+        public final static int RAW_CONTACT_ID = 13;
+
+        public final static int ACCOUNT_NAME = 14;
+        public final static int ACCOUNT_TYPE = 15;
+        public final static int DIRTY = 16;
+        public final static int VERSION = 17;
+        public final static int SOURCE_ID = 18;
+        public final static int SYNC1 = 19;
+        public final static int SYNC2 = 20;
+        public final static int SYNC3 = 21;
+        public final static int SYNC4 = 22;
+        public final static int DELETED = 23;
+        public final static int IS_RESTRICTED = 24;
+        public final static int NAME_VERIFIED = 25;
+
+        public final static int DATA_ID = 26;
+        public final static int DATA1 = 27;
+        public final static int DATA2 = 28;
+        public final static int DATA3 = 29;
+        public final static int DATA4 = 30;
+        public final static int DATA5 = 31;
+        public final static int DATA6 = 32;
+        public final static int DATA7 = 33;
+        public final static int DATA8 = 34;
+        public final static int DATA9 = 35;
+        public final static int DATA10 = 36;
+        public final static int DATA11 = 37;
+        public final static int DATA12 = 38;
+        public final static int DATA13 = 39;
+        public final static int DATA14 = 40;
+        public final static int DATA15 = 41;
+        public final static int DATA_SYNC1 = 42;
+        public final static int DATA_SYNC2 = 43;
+        public final static int DATA_SYNC3 = 44;
+        public final static int DATA_SYNC4 = 45;
+        public final static int DATA_VERSION = 46;
+        public final static int IS_PRIMARY = 47;
+        public final static int IS_SUPERPRIMARY = 48;
+        public final static int MIMETYPE = 49;
+        public final static int RES_PACKAGE = 50;
+
+        public final static int GROUP_SOURCE_ID = 51;
+
+        public final static int PRESENCE = 52;
+        public final static int CHAT_CAPABILITY = 53;
+        public final static int STATUS = 54;
+        public final static int STATUS_RES_PACKAGE = 55;
+        public final static int STATUS_ICON = 56;
+        public final static int STATUS_LABEL = 57;
+        public final static int STATUS_TIMESTAMP = 58;
+
+        public final static int PHOTO_URI = 59;
+    }
+
+    private static class DirectoryQuery {
+        // Projection used for the query that loads all data for the entire contact.
+        final static String[] COLUMNS = new String[] {
+            Directory.DISPLAY_NAME,
+            Directory.PACKAGE_NAME,
+            Directory.TYPE_RESOURCE_ID,
+            Directory.ACCOUNT_TYPE,
+            Directory.ACCOUNT_NAME,
+            Directory.EXPORT_SUPPORT,
+        };
+
+        public final static int DISPLAY_NAME = 0;
+        public final static int PACKAGE_NAME = 1;
+        public final static int TYPE_RESOURCE_ID = 2;
+        public final static int ACCOUNT_TYPE = 3;
+        public final static int ACCOUNT_NAME = 4;
+        public final static int EXPORT_SUPPORT = 5;
+    }
+
+    private static class GroupQuery {
+        final static String[] COLUMNS = new String[] {
+            Groups.ACCOUNT_NAME,
+            Groups.ACCOUNT_TYPE,
+            Groups._ID,
+            Groups.TITLE,
+            Groups.AUTO_ADD,
+            Groups.FAVORITES,
+        };
+
+        public final static int ACCOUNT_NAME = 0;
+        public final static int ACCOUNT_TYPE = 1;
+        public final static int ID = 2;
+        public final static int TITLE = 3;
+        public final static int AUTO_ADD = 4;
+        public final static int FAVORITES = 5;
+    }
+
+    private final class LoadContactTask extends AsyncTask<Void, Void, Result> {
+
+        @Override
+        protected Result doInBackground(Void... args) {
+            try {
+                final ContentResolver resolver = getContext().getContentResolver();
+                final Uri uriCurrentFormat = ensureIsContactUri(resolver, mLookupUri);
+                Result result = loadContactEntity(resolver, uriCurrentFormat);
+                if (result != Result.NOT_FOUND) {
+                    if (result.isDirectoryEntry()) {
+                        loadDirectoryMetaData(result);
+                    } else if (mLoadGroupMetaData) {
+                        loadGroupMetaData(result);
+                    }
+                }
+                return result;
+            } catch (Exception e) {
+                Log.e(TAG, "Error loading the contact: " + mLookupUri, e);
+                return Result.ERROR;
+            }
+        }
+
+        /**
+         * Transforms the given Uri and returns a Lookup-Uri that represents the contact.
+         * For legacy contacts, a raw-contact lookup is performed.
+         * @param resolver
+         */
+        private Uri ensureIsContactUri(final ContentResolver resolver, final Uri uri) {
+            if (uri == null) throw new IllegalArgumentException("uri must not be null");
+
+            final String authority = uri.getAuthority();
+
+            // Current Style Uri?
+            if (ContactsContract.AUTHORITY.equals(authority)) {
+                final String type = resolver.getType(uri);
+                // Contact-Uri? Good, return it
+                if (Contacts.CONTENT_ITEM_TYPE.equals(type)) {
+                    return uri;
+                }
+
+                // RawContact-Uri? Transform it to ContactUri
+                if (RawContacts.CONTENT_ITEM_TYPE.equals(type)) {
+                    final long rawContactId = ContentUris.parseId(uri);
+                    return RawContacts.getContactLookupUri(getContext().getContentResolver(),
+                            ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId));
+                }
+
+                // Anything else? We don't know what this is
+                throw new IllegalArgumentException("uri format is unknown");
+            }
+
+            // Legacy Style? Convert to RawContact
+            final String OBSOLETE_AUTHORITY = "contacts";
+            if (OBSOLETE_AUTHORITY.equals(authority)) {
+                // Legacy Format. Convert to RawContact-Uri and then lookup the contact
+                final long rawContactId = ContentUris.parseId(uri);
+                return RawContacts.getContactLookupUri(resolver,
+                        ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId));
+            }
+
+            throw new IllegalArgumentException("uri authority is unknown");
+        }
+
+        private Result loadContactEntity(ContentResolver resolver, Uri contactUri) {
+            Uri entityUri = Uri.withAppendedPath(contactUri, Contacts.Entity.CONTENT_DIRECTORY);
+            Cursor cursor = resolver.query(entityUri, ContactQuery.COLUMNS, null, null,
+                    Contacts.Entity.RAW_CONTACT_ID);
+            if (cursor == null) {
+                Log.e(TAG, "No cursor returned in loadContactEntity");
+                return Result.NOT_FOUND;
+            }
+
+            try {
+                if (!cursor.moveToFirst()) {
+                    cursor.close();
+                    return Result.NOT_FOUND;
+                }
+
+                long currentRawContactId = -1;
+                Entity entity = null;
+                Result result = loadContactHeaderData(cursor, contactUri);
+                ArrayList<Entity> entities = result.getEntities();
+                HashMap<Long, DataStatus> statuses = result.getStatuses();
+                for (; !cursor.isAfterLast(); cursor.moveToNext()) {
+                    long rawContactId = cursor.getLong(ContactQuery.RAW_CONTACT_ID);
+                    if (rawContactId != currentRawContactId) {
+                        currentRawContactId = rawContactId;
+                        entity = new android.content.Entity(loadRawContact(cursor));
+                        entities.add(entity);
+                    }
+                    if (!cursor.isNull(ContactQuery.DATA_ID)) {
+                        ContentValues data = loadData(cursor);
+                        entity.addSubValue(ContactsContract.Data.CONTENT_URI, data);
+
+                        if (!cursor.isNull(ContactQuery.PRESENCE)
+                                || !cursor.isNull(ContactQuery.STATUS)) {
+                            final DataStatus status = new DataStatus(cursor);
+                            final long dataId = cursor.getLong(ContactQuery.DATA_ID);
+                            statuses.put(dataId, status);
+                        }
+                    }
+                }
+
+                return result;
+            } finally {
+                cursor.close();
+            }
+        }
+
+        /**
+         * Extracts Contact level columns from the cursor.
+         */
+        private Result loadContactHeaderData(final Cursor cursor, Uri contactUri) {
+            final String directoryParameter =
+                    contactUri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY);
+            final long directoryId = directoryParameter == null
+                    ? Directory.DEFAULT
+                    : Long.parseLong(directoryParameter);
+            final long contactId = cursor.getLong(ContactQuery.CONTACT_ID);
+            final String lookupKey = cursor.getString(ContactQuery.LOOKUP_KEY);
+            final long nameRawContactId = cursor.getLong(ContactQuery.NAME_RAW_CONTACT_ID);
+            final int displayNameSource = cursor.getInt(ContactQuery.DISPLAY_NAME_SOURCE);
+            final String displayName = cursor.getString(ContactQuery.DISPLAY_NAME);
+            final String phoneticName = cursor.getString(ContactQuery.PHONETIC_NAME);
+            final long photoId = cursor.getLong(ContactQuery.PHOTO_ID);
+            final String photoUri = cursor.getString(ContactQuery.PHOTO_URI);
+            final boolean starred = cursor.getInt(ContactQuery.STARRED) != 0;
+            final Integer presence = cursor.isNull(ContactQuery.CONTACT_PRESENCE)
+                    ? null
+                    : cursor.getInt(ContactQuery.CONTACT_PRESENCE);
+            final String status = cursor.getString(ContactQuery.CONTACT_STATUS);
+            final Long statusTimestamp = cursor.isNull(ContactQuery.CONTACT_STATUS_TIMESTAMP)
+                    ? null
+                    : cursor.getLong(ContactQuery.CONTACT_STATUS_TIMESTAMP);
+            final Integer statusLabel = cursor.isNull(ContactQuery.CONTACT_STATUS_LABEL)
+                    ? null
+                    : cursor.getInt(ContactQuery.CONTACT_STATUS_LABEL);
+            final String statusResPackage = cursor.getString(
+                    ContactQuery.CONTACT_STATUS_RES_PACKAGE);
+
+            Uri lookupUri = ContentUris.withAppendedId(
+                    Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), contactId);
+            return new Result(contactUri, lookupUri, directoryId, lookupKey, contactId,
+                    nameRawContactId, displayNameSource, photoId, photoUri, displayName,
+                    phoneticName, starred, presence, status, statusTimestamp, statusLabel,
+                    statusResPackage);
+        }
+
+        /**
+         * Extracts RawContact level columns from the cursor.
+         */
+        private ContentValues loadRawContact(Cursor cursor) {
+            ContentValues cv = new ContentValues();
+
+            cv.put(RawContacts._ID, cursor.getLong(ContactQuery.RAW_CONTACT_ID));
+
+            cursorColumnToContentValues(cursor, cv, ContactQuery.ACCOUNT_NAME);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.ACCOUNT_TYPE);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DIRTY);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.VERSION);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.SOURCE_ID);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.SYNC1);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.SYNC2);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.SYNC3);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.SYNC4);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DELETED);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.CONTACT_ID);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.STARRED);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.IS_RESTRICTED);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.NAME_VERIFIED);
+
+            return cv;
+        }
+
+        /**
+         * Extracts Data level columns from the cursor.
+         */
+        private ContentValues loadData(Cursor cursor) {
+            ContentValues cv = new ContentValues();
+
+            cv.put(Data._ID, cursor.getLong(ContactQuery.DATA_ID));
+
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA1);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA2);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA3);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA4);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA5);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA6);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA7);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA8);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA9);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA10);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA11);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA12);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA13);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA14);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA15);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA_SYNC1);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA_SYNC2);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA_SYNC3);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA_SYNC4);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.DATA_VERSION);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.IS_PRIMARY);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.IS_SUPERPRIMARY);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.MIMETYPE);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.RES_PACKAGE);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.GROUP_SOURCE_ID);
+            cursorColumnToContentValues(cursor, cv, ContactQuery.CHAT_CAPABILITY);
+
+            return cv;
+        }
+
+        private void cursorColumnToContentValues(
+                Cursor cursor, ContentValues values, int index) {
+            switch (cursor.getType(index)) {
+                case Cursor.FIELD_TYPE_NULL:
+                    // don't put anything in the content values
+                    break;
+                case Cursor.FIELD_TYPE_INTEGER:
+                    values.put(ContactQuery.COLUMNS[index], cursor.getLong(index));
+                    break;
+                case Cursor.FIELD_TYPE_STRING:
+                    values.put(ContactQuery.COLUMNS[index], cursor.getString(index));
+                    break;
+                case Cursor.FIELD_TYPE_BLOB:
+                    values.put(ContactQuery.COLUMNS[index], cursor.getBlob(index));
+                    break;
+                default:
+                    throw new IllegalStateException("Invalid or unhandled data type");
+            }
+        }
+
+        private void loadDirectoryMetaData(Result result) {
+            long directoryId = result.getDirectoryId();
+
+            Cursor cursor = getContext().getContentResolver().query(
+                    ContentUris.withAppendedId(Directory.CONTENT_URI, directoryId),
+                    DirectoryQuery.COLUMNS, null, null, null);
+            if (cursor == null) {
+                return;
+            }
+            try {
+                if (cursor.moveToFirst()) {
+                    final String displayName = cursor.getString(DirectoryQuery.DISPLAY_NAME);
+                    final String packageName = cursor.getString(DirectoryQuery.PACKAGE_NAME);
+                    final int typeResourceId = cursor.getInt(DirectoryQuery.TYPE_RESOURCE_ID);
+                    final String accountType = cursor.getString(DirectoryQuery.ACCOUNT_TYPE);
+                    final String accountName = cursor.getString(DirectoryQuery.ACCOUNT_NAME);
+                    final int exportSupport = cursor.getInt(DirectoryQuery.EXPORT_SUPPORT);
+                    String directoryType = null;
+                    if (!TextUtils.isEmpty(packageName)) {
+                        PackageManager pm = getContext().getPackageManager();
+                        try {
+                            Resources resources = pm.getResourcesForApplication(packageName);
+                            directoryType = resources.getString(typeResourceId);
+                        } catch (NameNotFoundException e) {
+                            Log.w(TAG, "Contact directory resource not found: "
+                                    + packageName + "." + typeResourceId);
+                        }
+                    }
+
+                    result.setDirectoryMetaData(
+                            displayName, directoryType, accountType, accountName, exportSupport);
+                }
+            } finally {
+                cursor.close();
+            }
+        }
+
+        /**
+         * Loads groups meta-data for all groups associated with all constituent raw contacts'
+         * accounts.
+         */
+        private void loadGroupMetaData(Result result) {
+            StringBuilder selection = new StringBuilder();
+            ArrayList<String> selectionArgs = new ArrayList<String>();
+            for (Entity entity : result.mEntities) {
+                ContentValues values = entity.getEntityValues();
+                String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
+                String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
+                if (accountName != null && accountType != null) {
+                    if (selection.length() != 0) {
+                        selection.append(" OR ");
+                    }
+                    selection.append(
+                            "(" + Groups.ACCOUNT_NAME + "=? AND " + Groups.ACCOUNT_TYPE + "=?)");
+                    selectionArgs.add(accountName);
+                    selectionArgs.add(accountType);
+                }
+            }
+            Cursor cursor = getContext().getContentResolver().query(Groups.CONTENT_URI,
+                    GroupQuery.COLUMNS, selection.toString(), selectionArgs.toArray(new String[0]),
+                    null);
+            try {
+                while (cursor.moveToNext()) {
+                    final String accountName = cursor.getString(GroupQuery.ACCOUNT_NAME);
+                    final String accountType = cursor.getString(GroupQuery.ACCOUNT_TYPE);
+                    final long groupId = cursor.getLong(GroupQuery.ID);
+                    final String title = cursor.getString(GroupQuery.TITLE);
+                    final boolean defaultGroup = cursor.isNull(GroupQuery.AUTO_ADD)
+                            ? false
+                            : cursor.getInt(GroupQuery.AUTO_ADD) != 0;
+                    final boolean favorites = cursor.isNull(GroupQuery.FAVORITES)
+                            ? false
+                            : cursor.getInt(GroupQuery.FAVORITES) != 0;
+
+                    result.addGroupMetaData(new GroupMetaData(
+                            accountName, accountType, groupId, title, defaultGroup, favorites));
+                }
+            } finally {
+                cursor.close();
+            }
+        }
+
+        @Override
+        protected void onPostExecute(Result result) {
+            // The creator isn't interested in any further updates
+            if (mDestroyed) {
+                return;
+            }
+
+            mContact = result;
+            if (result != null) {
+                mLookupUri = result.getLookupUri();
+                unregisterObserver();
+                if (mObserver == null) {
+                    mObserver = new ForceLoadContentObserver();
+                }
+                Log.i(TAG, "Registering content observer for " + mLookupUri);
+
+                if (result != Result.ERROR && result != Result.NOT_FOUND) {
+                    getContext().getContentResolver().registerContentObserver(mLookupUri, true,
+                            mObserver);
+                }
+                deliverResult(result);
+            }
+        }
+    }
+
+    private void unregisterObserver() {
+        if (mObserver != null) {
+            getContext().getContentResolver().unregisterContentObserver(mObserver);
+            mObserver = null;
+        }
+    }
+
+    public ContactLoader(Context context, Uri lookupUri) {
+        this(context, lookupUri, false);
+    }
+
+    public ContactLoader(Context context, Uri lookupUri, boolean loadGroupMetaData) {
+        super(context);
+        mLookupUri = lookupUri;
+        mLoadGroupMetaData = loadGroupMetaData;
+    }
+
+    @Override
+    public void startLoading() {
+        if (mContact != null) {
+            deliverResult(mContact);
+        } else {
+            forceLoad();
+        }
+    }
+
+    @Override
+    public void forceLoad() {
+        final LoadContactTask task = new LoadContactTask();
+        task.execute((Void[])null);
+    }
+
+    @Override
+    public void stopLoading() {
+        unregisterObserver();
+        mContact = null;
+    }
+
+    @Override
+    public void destroy() {
+        unregisterObserver();
+        mContact = null;
+        mDestroyed = true;
+    }
+}
diff --git a/src/com/android/contacts/views/ContactSaveService.java b/src/com/android/contacts/views/ContactSaveService.java
new file mode 100644
index 0000000..91d2413
--- /dev/null
+++ b/src/com/android/contacts/views/ContactSaveService.java
@@ -0,0 +1,172 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.views;
+
+import com.android.contacts.activities.ContactBrowserActivity;
+import com.google.android.collect.Sets;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.IntentService;
+import android.content.ContentProviderOperation;
+import android.content.ContentProviderResult;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.content.OperationApplicationException;
+import android.net.Uri;
+import android.os.Parcelable;
+import android.os.RemoteException;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.RawContacts;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+public class ContactSaveService extends IntentService {
+    private static final String TAG = "ContactSaveService";
+
+    public static final String ACTION_NEW_RAW_CONTACT = "newRawContact";
+
+    public static final String EXTRA_ACCOUNT_NAME = "accountName";
+    public static final String EXTRA_ACCOUNT_TYPE = "accountType";
+    public static final String EXTRA_CONTENT_VALUES = "contentValues";
+    public static final String EXTRA_CALLBACK_INTENT = "callbackIntent";
+
+    public static final String EXTRA_OPERATIONS = "Operations";
+
+    private static final HashSet<String> ALLOWED_DATA_COLUMNS = Sets.newHashSet(
+        Data.MIMETYPE,
+        Data.IS_PRIMARY,
+        Data.DATA1,
+        Data.DATA2,
+        Data.DATA3,
+        Data.DATA4,
+        Data.DATA5,
+        Data.DATA6,
+        Data.DATA7,
+        Data.DATA8,
+        Data.DATA9,
+        Data.DATA10,
+        Data.DATA11,
+        Data.DATA12,
+        Data.DATA13,
+        Data.DATA14,
+        Data.DATA15
+    );
+
+    public ContactSaveService() {
+        super(TAG);
+        setIntentRedelivery(true);
+    }
+
+    @Override
+    protected void onHandleIntent(Intent intent) {
+        String action = intent.getAction();
+        if (ACTION_NEW_RAW_CONTACT.equals(action)) {
+            createRawContact(intent);
+        } else {
+            performContentProviderOperations(intent);
+        }
+    }
+
+    private void createRawContact(Intent intent) {
+        String accountName = intent.getStringExtra(EXTRA_ACCOUNT_NAME);
+        String accountType = intent.getStringExtra(EXTRA_ACCOUNT_TYPE);
+        List<ContentValues> valueList = intent.getParcelableArrayListExtra(EXTRA_CONTENT_VALUES);
+        Intent callbackIntent = intent.getParcelableExtra(EXTRA_CALLBACK_INTENT);
+
+        ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
+        operations.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI)
+                .withValue(RawContacts.ACCOUNT_NAME, accountName)
+                .withValue(RawContacts.ACCOUNT_TYPE, accountType)
+                .build());
+
+        int size = valueList.size();
+        for (int i = 0; i < size; i++) {
+            ContentValues values = valueList.get(i);
+            values.keySet().retainAll(ALLOWED_DATA_COLUMNS);
+            operations.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
+                    .withValueBackReference(Data.RAW_CONTACT_ID, 0)
+                    .withValues(values)
+                    .build());
+        }
+
+        ContentResolver resolver = getContentResolver();
+        ContentProviderResult[] results;
+        try {
+            results = resolver.applyBatch(ContactsContract.AUTHORITY, operations);
+        } catch (Exception e) {
+            throw new RuntimeException("Failed to store new contact", e);
+        }
+
+        Uri result = ContactsContract.Directory.CONTENT_URI;
+        Uri rawContactUri = results[0].uri;
+        callbackIntent.setData(RawContacts.getContactLookupUri(resolver, rawContactUri));
+
+        startActivity(callbackIntent);
+    }
+
+    private void performContentProviderOperations(Intent intent) {
+        final Parcelable[] operationsArray = intent.getParcelableArrayExtra(EXTRA_OPERATIONS);
+
+        // We have to cast each item individually here
+        final ArrayList<ContentProviderOperation> operations =
+                new ArrayList<ContentProviderOperation>(operationsArray.length);
+        for (Parcelable p : operationsArray) {
+            operations.add((ContentProviderOperation) p);
+        }
+
+        try {
+            getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations);
+        } catch (RemoteException e) {
+            Log.e(TAG, "Error saving", e);
+        } catch (OperationApplicationException e) {
+            Log.e(TAG, "Error saving", e);
+        }
+    }
+
+    /**
+     * Creates an intent that can be sent to this service to create a new raw contact
+     * using data presented as a set of ContentValues.
+     */
+    public static Intent createNewRawContactIntent(
+            Activity activity, ArrayList<ContentValues> values, Account account) {
+        Intent serviceIntent = new Intent(
+                activity, ContactSaveService.class);
+        serviceIntent.setAction(ContactSaveService.ACTION_NEW_RAW_CONTACT);
+        if (account != null) {
+            serviceIntent.putExtra(ContactSaveService.EXTRA_ACCOUNT_NAME, account.name);
+            serviceIntent.putExtra(ContactSaveService.EXTRA_ACCOUNT_TYPE, account.type);
+        }
+        serviceIntent.putParcelableArrayListExtra(
+                ContactSaveService.EXTRA_CONTENT_VALUES, values);
+
+        // Callback intent will be invoked by the service once the new contact is
+        // created.  The service will put the URI of the new contact as "data" on
+        // the callback intent.
+        Intent callbackIntent = new Intent(activity, activity.getClass());
+        callbackIntent.setAction(Intent.ACTION_VIEW);
+        callbackIntent.setFlags(
+                Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
+        serviceIntent.putExtra(ContactSaveService.EXTRA_CALLBACK_INTENT, callbackIntent);
+        return serviceIntent;
+    }
+}
diff --git a/src/com/android/contacts/views/GroupMetaData.java b/src/com/android/contacts/views/GroupMetaData.java
new file mode 100644
index 0000000..dd52eb0
--- /dev/null
+++ b/src/com/android/contacts/views/GroupMetaData.java
@@ -0,0 +1,61 @@
+/*
+ * 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
+ */
+package com.android.contacts.views;
+
+/**
+ * Meta-data for a contact group.  We load all groups associated with the contact's
+ * constituent accounts.
+ */
+public final class GroupMetaData {
+    private String mAccountName;
+    private String mAccountType;
+    private long mGroupId;
+    private String mTitle;
+    private boolean mDefaultGroup;
+    private boolean mFavorites;
+
+    public GroupMetaData(String accountName, String accountType, long groupId, String title,
+            boolean defaultGroup, boolean favorites) {
+        this.mGroupId = groupId;
+        this.mTitle = title;
+        this.mDefaultGroup = defaultGroup;
+        this.mFavorites = favorites;
+    }
+
+    public String getAccountName() {
+        return mAccountName;
+    }
+
+    public String getAccountType() {
+        return mAccountType;
+    }
+
+    public long getGroupId() {
+        return mGroupId;
+    }
+
+    public String getTitle() {
+        return mTitle;
+    }
+
+    public boolean isDefaultGroup() {
+        return mDefaultGroup;
+    }
+
+    public boolean isFavorites() {
+        return mFavorites;
+    }
+}
diff --git a/src/com/android/contacts/views/GroupMetaDataLoader.java b/src/com/android/contacts/views/GroupMetaDataLoader.java
new file mode 100644
index 0000000..adfe0bf
--- /dev/null
+++ b/src/com/android/contacts/views/GroupMetaDataLoader.java
@@ -0,0 +1,46 @@
+/*
+ * 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
+ */
+package com.android.contacts.views;
+
+import android.content.Context;
+import android.content.CursorLoader;
+import android.provider.ContactsContract.Groups;
+
+/**
+ * Group meta-data loader.  Loads all groups from the database.
+ */
+public final class GroupMetaDataLoader extends CursorLoader {
+
+    private final static String[] COLUMNS = new String[] {
+        Groups.ACCOUNT_NAME,
+        Groups.ACCOUNT_TYPE,
+        Groups._ID,
+        Groups.TITLE,
+        Groups.AUTO_ADD,
+        Groups.FAVORITES,
+    };
+
+    public final static int ACCOUNT_NAME = 0;
+    public final static int ACCOUNT_TYPE = 1;
+    public final static int GROUP_ID = 2;
+    public final static int TITLE = 3;
+    public final static int AUTO_ADD = 4;
+    public final static int FAVORITES = 5;
+
+    public GroupMetaDataLoader(Context context) {
+        super(context, Groups.CONTENT_URI, COLUMNS, null, null, null);
+    }
+}
diff --git a/src/com/android/contacts/views/detail/ContactDetailFragment.java b/src/com/android/contacts/views/detail/ContactDetailFragment.java
new file mode 100644
index 0000000..e2d04ef
--- /dev/null
+++ b/src/com/android/contacts/views/detail/ContactDetailFragment.java
@@ -0,0 +1,1229 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.views.detail;
+
+import com.android.contacts.Collapser;
+import com.android.contacts.Collapser.Collapsible;
+import com.android.contacts.ContactOptionsActivity;
+import com.android.contacts.ContactPresenceIconUtil;
+import com.android.contacts.ContactsUtils;
+import com.android.contacts.ContactsUtils.ImActions;
+import com.android.contacts.R;
+import com.android.contacts.TypePrecedence;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.util.Constants;
+import com.android.contacts.util.DataStatus;
+import com.android.contacts.util.DateUtils;
+import com.android.contacts.util.PhoneCapabilityTester;
+import com.android.contacts.views.ContactLoader;
+import com.android.contacts.views.GroupMetaData;
+import com.android.contacts.views.editor.SelectAccountDialogFragment;
+import com.android.internal.telephony.ITelephony;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.LoaderManager;
+import android.app.LoaderManager.LoaderCallbacks;
+import android.content.ActivityNotFoundException;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Entity;
+import android.content.Entity.NamedContentValues;
+import android.content.Intent;
+import android.content.Loader;
+import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
+import android.net.ParseException;
+import android.net.Uri;
+import android.net.WebAddress;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.provider.ContactsContract.CommonDataKinds;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Event;
+import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
+import android.provider.ContactsContract.CommonDataKinds.Im;
+import android.provider.ContactsContract.CommonDataKinds.Nickname;
+import android.provider.ContactsContract.CommonDataKinds.Note;
+import android.provider.ContactsContract.CommonDataKinds.Organization;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.SipAddress;
+import android.provider.ContactsContract.CommonDataKinds.StructuredName;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.provider.ContactsContract.CommonDataKinds.Website;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.Directory;
+import android.provider.ContactsContract.DisplayNameSources;
+import android.provider.ContactsContract.PhoneLookup;
+import android.provider.ContactsContract.RawContacts;
+import android.provider.ContactsContract.StatusUpdates;
+import android.telephony.PhoneNumberUtils;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.ContextMenu;
+import android.view.ContextMenu.ContextMenuInfo;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnCreateContextMenuListener;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.BaseAdapter;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
+public class ContactDetailFragment extends Fragment implements OnCreateContextMenuListener,
+        OnItemClickListener, SelectAccountDialogFragment.Listener {
+    private static final String TAG = "ContactDetailFragment";
+
+    private static final int LOADER_DETAILS = 1;
+
+    private Context mContext;
+    private Uri mLookupUri;
+    private Listener mListener;
+
+    private ContactLoader.Result mContactData;
+    private ContactDetailHeaderView mHeaderView;
+    private ListView mListView;
+    private ViewAdapter mAdapter;
+    private Uri mPrimaryPhoneUri = null;
+
+    private Button mCopyGalToLocalButton;
+    private boolean mAllRestricted;
+    private final ArrayList<Long> mWritableRawContactIds = new ArrayList<Long>();
+    private int mNumPhoneNumbers = 0;
+    private String mDefaultCountryIso;
+
+    /**
+     * Device capability: Set during buildEntries and used in the long-press context menu
+     */
+    private boolean mHasPhone;
+
+    /**
+     * Device capability: Set during buildEntries and used in the long-press context menu
+     */
+    private boolean mHasSms;
+
+    /**
+     * Device capability: Set during buildEntries and used in the long-press context menu
+     */
+    private boolean mHasSip;
+
+    /**
+     * The view shown if the detail list is empty.
+     * We set this to the list view when first bind the adapter, so that it won't be shown while
+     * we're loading data.
+     */
+    private View mEmptyView;
+
+    /**
+     * A list of distinct contact IDs included in the current contact.
+     */
+    private ArrayList<Long> mRawContactIds = new ArrayList<Long>();
+    private ArrayList<ViewEntry> mPhoneEntries = new ArrayList<ViewEntry>();
+    private ArrayList<ViewEntry> mSmsEntries = new ArrayList<ViewEntry>();
+    private ArrayList<ViewEntry> mEmailEntries = new ArrayList<ViewEntry>();
+    private ArrayList<ViewEntry> mPostalEntries = new ArrayList<ViewEntry>();
+    private ArrayList<ViewEntry> mImEntries = new ArrayList<ViewEntry>();
+    private ArrayList<ViewEntry> mNicknameEntries = new ArrayList<ViewEntry>();
+    private ArrayList<ViewEntry> mGroupEntries = new ArrayList<ViewEntry>();
+    private ArrayList<ViewEntry> mOtherEntries = new ArrayList<ViewEntry>();
+    private ArrayList<ArrayList<ViewEntry>> mSections = new ArrayList<ArrayList<ViewEntry>>();
+    private LayoutInflater mInflater;
+
+    public ContactDetailFragment() {
+        // Explicit constructor for inflation
+
+        // Build the list of sections. The order they're added to mSections dictates the
+        // order they are displayed in the list.
+        mSections.add(mPhoneEntries);
+        mSections.add(mSmsEntries);
+        mSections.add(mEmailEntries);
+        mSections.add(mImEntries);
+        mSections.add(mPostalEntries);
+        mSections.add(mNicknameEntries);
+        mSections.add(mOtherEntries);
+        mSections.add(mGroupEntries);
+    }
+
+    @Override
+    public void onAttach(Activity activity) {
+        super.onAttach(activity);
+        mContext = activity;
+        mDefaultCountryIso = ContactsUtils.getCurrentCountryIso(mContext);
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
+        final View view = inflater.inflate(R.layout.contact_detail_fragment, container, false);
+
+        setHasOptionsMenu(true);
+
+        mInflater = inflater;
+
+        mHeaderView = (ContactDetailHeaderView) view.findViewById(R.id.contact_header_widget);
+        mHeaderView.setListener(mHeaderViewListener);
+
+        mListView = (ListView) view.findViewById(android.R.id.list);
+        mListView.setOnCreateContextMenuListener(this);
+        mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
+        mListView.setOnItemClickListener(this);
+        // Don't set it to mListView yet.  We do so later when we bind the adapter.
+        mEmptyView = view.findViewById(android.R.id.empty);
+
+        mCopyGalToLocalButton = (Button) view.findViewById(R.id.copyLocal);
+        mCopyGalToLocalButton.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                makePersonalCopy();
+            }
+        });
+
+        return view;
+    }
+
+    public void setListener(Listener value) {
+        mListener = value;
+    }
+
+    public Uri getUri() {
+        return mLookupUri;
+    }
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+
+        getLoaderManager().initLoader(LOADER_DETAILS, null, mDetailLoaderListener);
+    }
+
+    public void loadUri(Uri lookupUri) {
+        mLookupUri = lookupUri;
+        if (getActivity() != null) {
+            getLoaderManager().restartLoader(LOADER_DETAILS, null, mDetailLoaderListener);
+        }
+    }
+
+    private void bindData() {
+        // Set the header
+        mHeaderView.loadData(mContactData);
+
+        // Build up the contact entries
+        buildEntries();
+
+        // Collapse similar data items in select sections.
+        Collapser.collapseList(mPhoneEntries);
+        Collapser.collapseList(mSmsEntries);
+        Collapser.collapseList(mEmailEntries);
+        Collapser.collapseList(mPostalEntries);
+        Collapser.collapseList(mImEntries);
+
+        if (mAdapter == null) {
+            mAdapter = new ViewAdapter();
+            mListView.setAdapter(mAdapter);
+        } else {
+            mAdapter.notifyDataSetChanged();
+        }
+        mListView.setEmptyView(mEmptyView);
+
+        // Configure copy gal button
+        if (mContactData.isDirectoryEntry()) {
+            final int exportSupport = mContactData.getDirectoryExportSupport();
+            if (exportSupport == Directory.EXPORT_SUPPORT_ANY_ACCOUNT
+                    || exportSupport == Directory.EXPORT_SUPPORT_SAME_ACCOUNT_ONLY) {
+                mCopyGalToLocalButton.setVisibility(View.VISIBLE);
+            } else {
+                mCopyGalToLocalButton.setVisibility(View.GONE);
+            }
+        } else {
+            mCopyGalToLocalButton.setVisibility(View.GONE);
+        }
+
+        getActivity().invalidateOptionsMenu();
+    }
+
+    /**
+     * Build up the entries to display on the screen.
+     */
+    private final void buildEntries() {
+        mHasPhone = PhoneCapabilityTester.isPhone(mContext);
+        mHasSms = PhoneCapabilityTester.isSmsIntentRegistered(mContext);
+        mHasSip = PhoneCapabilityTester.isSipPhone(mContext);
+
+        // Clear out the old entries
+        final int numSections = mSections.size();
+        for (int i = 0; i < numSections; i++) {
+            mSections.get(i).clear();
+        }
+
+        mRawContactIds.clear();
+
+        mAllRestricted = true;
+        mPrimaryPhoneUri = null;
+        mNumPhoneNumbers = 0;
+
+        mWritableRawContactIds.clear();
+
+        final AccountTypes sources = AccountTypes.getInstance(mContext);
+
+        // Build up method entries
+        if (mContactData == null) {
+            return;
+        }
+
+        ArrayList<String> groups = new ArrayList<String>();
+        for (Entity entity: mContactData.getEntities()) {
+            final ContentValues entValues = entity.getEntityValues();
+            final String accountType = entValues.getAsString(RawContacts.ACCOUNT_TYPE);
+            final long rawContactId = entValues.getAsLong(RawContacts._ID);
+
+            // Mark when this contact has any unrestricted components
+            Integer restricted = entValues.getAsInteger(RawContacts.IS_RESTRICTED);
+            final boolean isRestricted = restricted != null && restricted != 0;
+            if (!isRestricted) mAllRestricted = false;
+
+            if (!mRawContactIds.contains(rawContactId)) {
+                mRawContactIds.add(rawContactId);
+            }
+            BaseAccountType contactsSource = sources.getInflatedSource(accountType,
+                    BaseAccountType.LEVEL_SUMMARY);
+            if (contactsSource == null || !contactsSource.readOnly) {
+                mWritableRawContactIds.add(rawContactId);
+            }
+
+            for (NamedContentValues subValue : entity.getSubValues()) {
+                final ContentValues entryValues = subValue.values;
+                entryValues.put(Data.RAW_CONTACT_ID, rawContactId);
+
+                final long dataId = entryValues.getAsLong(Data._ID);
+                final String mimeType = entryValues.getAsString(Data.MIMETYPE);
+                if (mimeType == null) continue;
+
+                if (GroupMembership.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                    Long groupId = entryValues.getAsLong(GroupMembership.GROUP_ROW_ID);
+                    if (groupId != null) {
+                        handleGroupMembership(groups, mContactData.getGroupMetaData(), groupId);
+                    }
+                    continue;
+                }
+
+                final DataKind kind = sources.getKindOrFallback(accountType, mimeType, mContext,
+                        BaseAccountType.LEVEL_CONSTRAINTS);
+                if (kind == null) continue;
+
+                final ViewEntry entry = ViewEntry.fromValues(mContext, mimeType, kind, dataId,
+                        entryValues);
+
+                final boolean hasData = !TextUtils.isEmpty(entry.data);
+                Integer superPrimary = entryValues.getAsInteger(Data.IS_SUPER_PRIMARY);
+                final boolean isSuperPrimary = superPrimary != null && superPrimary != 0;
+
+                if (StructuredName.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                    // Always ignore the name. It is shown in the header if set
+                } else if (Phone.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
+                    // Build phone entries
+                    mNumPhoneNumbers++;
+                    String phoneNumberE164 =
+                            entryValues.getAsString(PhoneLookup.NORMALIZED_NUMBER);
+                    entry.data = PhoneNumberUtils.formatNumber(
+                            entry.data, phoneNumberE164, mDefaultCountryIso);
+                    final Intent phoneIntent = mHasPhone ? new Intent(Intent.ACTION_CALL_PRIVILEGED,
+                            Uri.fromParts(Constants.SCHEME_TEL, entry.data, null)) : null;
+                    final Intent smsIntent = mHasSms ? new Intent(Intent.ACTION_SENDTO,
+                            Uri.fromParts(Constants.SCHEME_SMSTO, entry.data, null)) : null;
+
+                    // Configure Icons and Intents. Notice actionIcon is already set to the phone
+                    if (mHasPhone && mHasSms) {
+                        entry.intent = phoneIntent;
+                        entry.secondaryIntent = smsIntent;
+                        entry.secondaryActionIcon = kind.iconAltRes;
+                    } else if (mHasPhone) {
+                        entry.intent = phoneIntent;
+                    } else if (mHasSms) {
+                        entry.intent = smsIntent;
+                        entry.actionIcon = kind.iconAltRes;
+                    } else {
+                        entry.intent = null;
+                        entry.actionIcon = -1;
+                    }
+
+
+                    // Remember super-primary phone
+                    if (isSuperPrimary) mPrimaryPhoneUri = entry.uri;
+
+                    entry.isPrimary = isSuperPrimary;
+                    mPhoneEntries.add(entry);
+                } else if (Email.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
+                    // Build email entries
+                    entry.intent = new Intent(Intent.ACTION_SENDTO,
+                            Uri.fromParts(Constants.SCHEME_MAILTO, entry.data, null));
+                    entry.isPrimary = isSuperPrimary;
+                    mEmailEntries.add(entry);
+
+                    // When Email rows have status, create additional Im row
+                    final DataStatus status = mContactData.getStatuses().get(entry.id);
+                    if (status != null) {
+                        final String imMime = Im.CONTENT_ITEM_TYPE;
+                        final DataKind imKind = sources.getKindOrFallback(accountType,
+                                imMime, mContext, BaseAccountType.LEVEL_MIMETYPES);
+                        final ViewEntry imEntry = ViewEntry.fromValues(mContext,
+                                imMime, imKind, dataId, entryValues);
+                        final ImActions imActions = ContactsUtils.buildImActions(entryValues);
+                        if (imActions != null) {
+                            imEntry.actionIcon = imActions.getPrimaryActionIcon();
+                            imEntry.secondaryActionIcon = imActions.getSecondaryActionIcon();
+                            imEntry.intent = imActions.getPrimaryIntent();
+                            imEntry.secondaryIntent = imActions.getSecondaryIntent();
+                        }
+                        imEntry.applyStatus(status, false);
+                        mImEntries.add(imEntry);
+                    }
+                } else if (StructuredPostal.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
+                    // Build postal entries
+                    entry.maxLines = 4;
+                    entry.intent = new Intent(Intent.ACTION_VIEW, entry.uri);
+                    mPostalEntries.add(entry);
+                } else if (Im.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
+                    // Build IM entries
+                    final ImActions imActions = ContactsUtils.buildImActions(entryValues);
+                    if (imActions != null) {
+                        entry.actionIcon = imActions.getPrimaryActionIcon();
+                        entry.secondaryActionIcon = imActions.getSecondaryActionIcon();
+                        entry.intent = imActions.getPrimaryIntent();
+                        entry.secondaryIntent = imActions.getSecondaryIntent();
+                    }
+                    if (TextUtils.isEmpty(entry.kindAndType)) {
+                        entry.kindAndType = mContext.getString(R.string.chat).toLowerCase();
+                    }
+
+                    // Apply presence and status details when available
+                    final DataStatus status = mContactData.getStatuses().get(entry.id);
+                    if (status != null) {
+                        entry.applyStatus(status, false);
+                    }
+                    mImEntries.add(entry);
+                } else if (Organization.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                    // Organizations are not shown. The first one is shown in the header
+                    // and subsequent ones are not supported anymore
+                } else if (Nickname.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
+                    // Build nickname entries
+                    final boolean isNameRawContact =
+                        (mContactData.getNameRawContactId() == rawContactId);
+
+                    final boolean duplicatesTitle =
+                        isNameRawContact
+                        && mContactData.getDisplayNameSource() == DisplayNameSources.NICKNAME;
+
+                    if (!duplicatesTitle) {
+                        entry.uri = null;
+                        mNicknameEntries.add(entry);
+                    }
+                } else if (Note.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
+                    // Build note entries
+                    entry.uri = null;
+                    entry.maxLines = 100;
+                    mOtherEntries.add(entry);
+                } else if (Website.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
+                    // Build Website entries
+                    entry.uri = null;
+                    entry.maxLines = 10;
+                    try {
+                        WebAddress webAddress = new WebAddress(entry.data);
+                        entry.intent = new Intent(Intent.ACTION_VIEW,
+                                Uri.parse(webAddress.toString()));
+                    } catch (ParseException e) {
+                        Log.e(TAG, "Couldn't parse website: " + entry.data);
+                    }
+                    mOtherEntries.add(entry);
+                } else if (SipAddress.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
+                    // Build SipAddress entries
+                    entry.uri = null;
+                    entry.maxLines = 1;
+                    if (mHasSip) {
+                        entry.intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
+                                Uri.fromParts(Constants.SCHEME_SIP, entry.data, null));
+                    } else {
+                        entry.intent = null;
+                        entry.actionIcon = -1;
+                    }
+                    mOtherEntries.add(entry);
+                    // TODO: Consider moving the SipAddress into its own
+                    // section (rather than lumping it in with mOtherEntries)
+                    // so that we can reposition it right under the phone number.
+                    // (Then, we'd also update FallbackAccountType.java to set
+                    // secondary=false for this field, and tweak the weight
+                    // of its DataKind.)
+                } else if (Event.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
+                    entry.data = DateUtils.formatDate(mContext, entry.data);
+                    entry.uri = null;
+                    mOtherEntries.add(entry);
+                } else {
+                    // Handle showing custom rows
+                    entry.intent = new Intent(Intent.ACTION_VIEW, entry.uri);
+
+                    // Use social summary when requested by external source
+                    final DataStatus status = mContactData.getStatuses().get(entry.id);
+                    final boolean hasSocial = kind.actionBodySocial && status != null;
+                    if (hasSocial) {
+                        entry.applyStatus(status, true);
+                    }
+
+                    if (hasSocial || hasData) {
+                        mOtherEntries.add(entry);
+                    }
+                }
+            }
+        }
+
+        if (!groups.isEmpty()) {
+            ViewEntry entry = new ViewEntry();
+            Collections.sort(groups);
+            StringBuilder sb = new StringBuilder();
+            int size = groups.size();
+            for (int i = 0; i < size; i++) {
+                if (i != 0) {
+                    sb.append(", ");
+                }
+                sb.append(groups.get(i));
+            }
+            entry.mimetype = GroupMembership.MIMETYPE;
+            entry.kind = mContext.getString(R.string.groupsLabel);
+            entry.data = sb.toString();
+            mGroupEntries.add(entry);
+        }
+    }
+
+    /**
+     * Maps group ID to the corresponding group name, collapses all synonymous groups.
+     * Ignores default groups (e.g. My Contacts) and favorites groups.
+     */
+    private void handleGroupMembership(
+            ArrayList<String> groups, List<GroupMetaData> groupMetaData, long groupId) {
+        if (groupMetaData == null) {
+            return;
+        }
+
+        for (GroupMetaData group : groupMetaData) {
+            if (group.getGroupId() == groupId) {
+                if (!group.isDefaultGroup() && !group.isFavorites()) {
+                    String title = group.getTitle();
+                    if (!groups.contains(title)) {
+                        groups.add(title);
+                    }
+                }
+                break;
+            }
+        }
+    }
+
+    private static String buildActionString(DataKind kind, ContentValues values, Context context) {
+        if (kind.actionHeader == null) {
+            return null;
+        }
+        CharSequence actionHeader = kind.actionHeader.inflateUsing(context, values);
+        if (actionHeader == null) {
+            return null;
+        }
+        return actionHeader.toString();
+    }
+
+    private static String buildDataString(DataKind kind, ContentValues values,
+            Context context) {
+        if (kind.actionBody == null) {
+            return null;
+        }
+        CharSequence actionBody = kind.actionBody.inflateUsing(context, values);
+        return actionBody == null ? null : actionBody.toString();
+    }
+
+    /**
+     * A basic structure with the data for a contact entry in the list.
+     */
+    private static class ViewEntry implements Collapsible<ViewEntry> {
+        public int type = -1;
+        public String kindAndType;
+        public String kind;
+        public String typeString;
+        public String data;
+        public Uri uri;
+        public long id = 0;
+        public int maxLines = 1;
+        public String mimetype;
+
+        public Context context = null;
+        public String resPackageName = null;
+        public int actionIcon = -1;
+        public boolean isPrimary = false;
+        public int secondaryActionIcon = -1;
+        public Intent intent;
+        public Intent secondaryIntent = null;
+        public ArrayList<Long> ids = new ArrayList<Long>();
+        public int collapseCount = 0;
+
+        public int presence = -1;
+
+        public CharSequence footerLine = null;
+
+        private ViewEntry() {
+        }
+
+        /**
+         * Build new {@link ViewEntry} and populate from the given values.
+         */
+        public static ViewEntry fromValues(Context context, String mimeType, DataKind kind,
+                long dataId, ContentValues values) {
+            final ViewEntry entry = new ViewEntry();
+            entry.context = context;
+            entry.id = dataId;
+            entry.uri = ContentUris.withAppendedId(Data.CONTENT_URI, entry.id);
+            entry.mimetype = mimeType;
+            entry.kindAndType = buildActionString(kind, values, context);
+            entry.kind = (kind.titleRes == -1 || kind.titleRes == 0) ? ""
+                    : context.getString(kind.titleRes).toUpperCase();
+            entry.data = buildDataString(kind, values, context);
+
+            if (kind.typeColumn != null && values.containsKey(kind.typeColumn)) {
+                entry.type = values.getAsInteger(kind.typeColumn);
+
+                // get type string
+                entry.typeString = "";
+                for (EditType type : kind.typeList) {
+                    if (type.rawValue == entry.type) {
+                        if (type.customColumn == null) {
+                            // Non-custom type. Get its description from the resource
+                            entry.typeString = context.getString(type.labelRes);
+                        } else {
+                            // Custom type. Read it from the database
+                            entry.typeString = values.getAsString(type.customColumn);
+                        }
+                        break;
+                    }
+                }
+            } else {
+                entry.typeString = "";
+            }
+
+            if (kind.iconRes > 0) {
+                entry.resPackageName = kind.resPackageName;
+                entry.actionIcon = kind.iconRes;
+            }
+
+            return entry;
+        }
+
+        /**
+         * Apply given {@link DataStatus} values over this {@link ViewEntry}
+         *
+         * @param fillData When true, the given status replaces {@link #data}
+         *            and {@link #footerLine}. Otherwise only {@link #presence}
+         *            is updated.
+         */
+        public ViewEntry applyStatus(DataStatus status, boolean fillData) {
+            presence = status.getPresence();
+            if (fillData && status.isValid()) {
+                this.data = status.getStatus().toString();
+                this.footerLine = status.getTimestampLabel(context);
+            }
+
+            return this;
+        }
+
+        @Override
+        public boolean collapseWith(ViewEntry entry) {
+            // assert equal collapse keys
+            if (!shouldCollapseWith(entry)) {
+                return false;
+            }
+
+            // Choose the label associated with the highest type precedence.
+            if (TypePrecedence.getTypePrecedence(mimetype, type)
+                    > TypePrecedence.getTypePrecedence(entry.mimetype, entry.type)) {
+                type = entry.type;
+                kindAndType = entry.kindAndType;
+                kind = entry.kind;
+                typeString = entry.typeString;
+            }
+
+            // Choose the max of the maxLines and maxLabelLines values.
+            maxLines = Math.max(maxLines, entry.maxLines);
+
+            // Choose the presence with the highest precedence.
+            if (StatusUpdates.getPresencePrecedence(presence)
+                    < StatusUpdates.getPresencePrecedence(entry.presence)) {
+                presence = entry.presence;
+            }
+
+            // If any of the collapsed entries are primary make the whole thing primary.
+            isPrimary = entry.isPrimary ? true : isPrimary;
+
+            // uri, and contactdId, shouldn't make a difference. Just keep the original.
+
+            // Keep track of all the ids that have been collapsed with this one.
+            ids.add(entry.id);
+            collapseCount++;
+            return true;
+        }
+
+        @Override
+        public boolean shouldCollapseWith(ViewEntry entry) {
+            if (entry == null) {
+                return false;
+            }
+
+            if (!ContactsUtils.shouldCollapse(context, mimetype, data, entry.mimetype,
+                    entry.data)) {
+                return false;
+            }
+
+            if (!TextUtils.equals(mimetype, entry.mimetype)
+                    || !ContactsUtils.areIntentActionEqual(intent, entry.intent)
+                    || !ContactsUtils.areIntentActionEqual(secondaryIntent, entry.secondaryIntent)
+                    || actionIcon != entry.actionIcon) {
+                return false;
+            }
+
+            return true;
+        }
+    }
+
+    /** Cache of the children views of a row */
+    private static class ViewCache {
+        public TextView kindAndType;
+        public TextView kind;
+        public TextView type;
+        public TextView data;
+        public TextView footer;
+        public ImageView actionIcon;
+        public ImageView presenceIcon;
+        public ImageView primaryIcon;
+        public ImageView secondaryActionButton;
+        public View secondaryActionDivider;
+    }
+
+    private final class ViewAdapter extends BaseAdapter {
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            final ViewEntry entry = getEntry(position);
+            final View v;
+            final ViewCache viewCache;
+
+            // Check to see if we can reuse convertView
+            if (convertView != null) {
+                v = convertView;
+                viewCache = (ViewCache) v.getTag();
+            } else {
+                // Create a new view if needed
+                v = mInflater.inflate(R.layout.contact_detail_list_item, parent, false);
+
+                // Cache the children
+                viewCache = new ViewCache();
+                viewCache.kindAndType = (TextView) v.findViewById(R.id.kind_and_type);
+                viewCache.kind = (TextView) v.findViewById(R.id.kind);
+                viewCache.type = (TextView) v.findViewById(R.id.type);
+                viewCache.data = (TextView) v.findViewById(R.id.data);
+                viewCache.footer = (TextView) v.findViewById(R.id.footer);
+                viewCache.actionIcon = (ImageView) v.findViewById(R.id.action_icon);
+                viewCache.primaryIcon = (ImageView) v.findViewById(R.id.primary_icon);
+                viewCache.presenceIcon = (ImageView) v.findViewById(R.id.presence_icon);
+                viewCache.secondaryActionButton = (ImageView) v.findViewById(
+                        R.id.secondary_action_button);
+                viewCache.secondaryActionButton.setOnClickListener(mSecondaryActionClickListener);
+                viewCache.secondaryActionDivider = v.findViewById(R.id.divider);
+                v.setTag(viewCache);
+            }
+
+            final ViewEntry previousEntry = position == 0 ? null : getEntry(position - 1);
+            final boolean isFirstOfItsKind =
+                    previousEntry == null ? true : !previousEntry.kind.equals(entry.kind);
+
+            // Bind the data to the view
+            bindView(v, entry, isFirstOfItsKind);
+            return v;
+        }
+
+        protected void bindView(View view, ViewEntry entry, boolean isFirstOfItsKind) {
+            final Resources resources = mContext.getResources();
+            ViewCache views = (ViewCache) view.getTag();
+
+            // Set the label. This is either a combination field or separate fields for kind of type
+            if (views.kindAndType != null) views.kindAndType.setText(entry.kindAndType);
+            if (views.kind != null) views.kind.setText(isFirstOfItsKind ? entry.kind : "");
+            if (views.type != null) views.type.setText(entry.typeString);
+
+            // Set the content
+            final TextView content = views.data;
+            if (content != null) {
+                content.setText(entry.data);
+                setMaxLines(content, entry.maxLines);
+            }
+
+            // Set the footer
+            if (!TextUtils.isEmpty(entry.footerLine)) {
+                views.footer.setText(entry.footerLine);
+                views.footer.setVisibility(View.VISIBLE);
+            } else {
+                views.footer.setVisibility(View.GONE);
+            }
+
+            // Set the primary icon
+            views.primaryIcon.setVisibility(entry.isPrimary ? View.VISIBLE : View.GONE);
+
+            // Set the action icon
+            final ImageView action = views.actionIcon;
+            if (entry.actionIcon != -1) {
+                Drawable actionIcon;
+                if (entry.resPackageName != null) {
+                    // Load external resources through PackageManager
+                    actionIcon = mContext.getPackageManager().getDrawable(entry.resPackageName,
+                            entry.actionIcon, null);
+                } else {
+                    actionIcon = resources.getDrawable(entry.actionIcon);
+                }
+                action.setImageDrawable(actionIcon);
+                action.setVisibility(View.VISIBLE);
+            } else {
+                // Things should still line up as if there was an icon, so make it invisible
+                action.setVisibility(View.INVISIBLE);
+            }
+
+            // Set the presence icon
+            final Drawable presenceIcon = ContactPresenceIconUtil.getPresenceIcon(
+                    mContext, entry.presence);
+            final ImageView presenceIconView = views.presenceIcon;
+            if (presenceIcon != null) {
+                presenceIconView.setImageDrawable(presenceIcon);
+                presenceIconView.setVisibility(View.VISIBLE);
+            } else {
+                presenceIconView.setVisibility(View.GONE);
+            }
+
+            // Set the secondary action button
+            final ImageView secondaryActionView = views.secondaryActionButton;
+            Drawable secondaryActionIcon = null;
+            if (entry.secondaryActionIcon != -1) {
+                secondaryActionIcon = resources.getDrawable(entry.secondaryActionIcon);
+            }
+            if (entry.secondaryIntent != null && secondaryActionIcon != null) {
+                secondaryActionView.setImageDrawable(secondaryActionIcon);
+                secondaryActionView.setTag(entry);
+                secondaryActionView.setVisibility(View.VISIBLE);
+                views.secondaryActionDivider.setVisibility(View.VISIBLE);
+            } else {
+                secondaryActionView.setVisibility(View.GONE);
+                views.secondaryActionDivider.setVisibility(View.GONE);
+            }
+        }
+
+        private void setMaxLines(TextView textView, int maxLines) {
+            if (maxLines == 1) {
+                textView.setSingleLine(true);
+                textView.setEllipsize(TextUtils.TruncateAt.END);
+            } else {
+                textView.setSingleLine(false);
+                textView.setMaxLines(maxLines);
+                textView.setEllipsize(null);
+            }
+        }
+
+        private OnClickListener mSecondaryActionClickListener = new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (mListener == null) return;
+                if (v == null) return;
+                final ViewEntry entry = (ViewEntry) v.getTag();
+                if (entry == null) return;
+                final Intent intent = entry.secondaryIntent;
+                if (intent == null) return;
+                mListener.onItemClicked(intent);
+            }
+        };
+
+        @Override
+        public int getCount() {
+            int count = 0;
+            final int numSections = mSections.size();
+            for (int i = 0; i < numSections; i++) {
+                final ArrayList<ViewEntry> section = mSections.get(i);
+                count += section.size();
+            }
+            return count;
+        }
+
+        @Override
+        public Object getItem(int position) {
+            return getEntry(position);
+        }
+
+        @Override
+        public long getItemId(int position) {
+            final ViewEntry entry = getEntry(position);
+            if (entry != null) {
+                return entry.id;
+            }
+            return -1;
+        }
+
+        private ViewEntry getEntry(int position) {
+            final int numSections = mSections.size();
+            for (int i = 0; i < numSections; i++) {
+                final ArrayList<ViewEntry> section = mSections.get(i);
+                final int sectionSize = section.size();
+                if (position < sectionSize) {
+                    return section.get(position);
+                }
+                position -= sectionSize;
+            }
+            return null;
+        }
+    }
+
+    @Override
+    public void onCreateOptionsMenu(Menu menu, final MenuInflater inflater) {
+        inflater.inflate(R.menu.view, menu);
+    }
+
+    @Override
+    public void onPrepareOptionsMenu(Menu menu) {
+        boolean isDirectoryEntry = mContactData != null && mContactData.isDirectoryEntry();
+
+        // Options only shows telephony-related settings (ringtone, send to voicemail).
+        // ==> Hide if we don't have a telephone
+        final MenuItem optionsMenu = menu.findItem(R.id.menu_options);
+        final boolean deviceHasPhone = PhoneCapabilityTester.isPhone(mContext);
+        optionsMenu.setVisible(!isDirectoryEntry && deviceHasPhone);
+
+        final MenuItem editMenu = menu.findItem(R.id.menu_edit);
+        editMenu.setVisible(!isDirectoryEntry);
+
+        final MenuItem deleteMenu = menu.findItem(R.id.menu_delete);
+        deleteMenu.setVisible(!isDirectoryEntry);
+
+        final MenuItem shareMenu = menu.findItem(R.id.menu_share);
+        shareMenu.setVisible(!isDirectoryEntry && !mAllRestricted);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.menu_edit: {
+                if (mListener != null) mListener.onEditRequested(mLookupUri);
+                break;
+            }
+            case R.id.menu_delete: {
+                if (mListener != null) mListener.onDeleteRequested(mLookupUri);
+                return true;
+            }
+            case R.id.menu_options: {
+                if (mContactData == null) return false;
+                final Intent intent = new Intent(mContext, ContactOptionsActivity.class);
+                intent.setData(mContactData.getLookupUri());
+                mContext.startActivity(intent);
+                return true;
+            }
+            case R.id.menu_share: {
+                if (mAllRestricted) return false;
+                if (mContactData == null) return false;
+
+                final String lookupKey = mContactData.getLookupKey();
+                final Uri shareUri = Uri.withAppendedPath(Contacts.CONTENT_VCARD_URI, lookupKey);
+
+                final Intent intent = new Intent(Intent.ACTION_SEND);
+                intent.setType(Contacts.CONTENT_VCARD_TYPE);
+                intent.putExtra(Intent.EXTRA_STREAM, shareUri);
+
+                // Launch chooser to share contact via
+                final CharSequence chooseTitle = mContext.getText(R.string.share_via);
+                final Intent chooseIntent = Intent.createChooser(intent, chooseTitle);
+
+                try {
+                    mContext.startActivity(chooseIntent);
+                } catch (ActivityNotFoundException ex) {
+                    Toast.makeText(mContext, R.string.share_error, Toast.LENGTH_SHORT).show();
+                }
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private void makePersonalCopy() {
+        if (mListener == null) {
+            return;
+        }
+
+        int exportSupport = mContactData.getDirectoryExportSupport();
+        switch (exportSupport) {
+            case Directory.EXPORT_SUPPORT_SAME_ACCOUNT_ONLY: {
+                createCopy(new Account(mContactData.getDirectoryAccountName(),
+                                mContactData.getDirectoryAccountType()));
+                break;
+            }
+            case Directory.EXPORT_SUPPORT_ANY_ACCOUNT: {
+                final ArrayList<Account> accounts = AccountTypes.getInstance(mContext).getAccounts(true);
+                if (accounts.isEmpty()) {
+                    createCopy(null);
+                    return;  // Don't show a dialog.
+                }
+
+                // In the common case of a single writable account, auto-select
+                // it without showing a dialog.
+                if (accounts.size() == 1) {
+                    createCopy(accounts.get(0));
+                    return;  // Don't show a dialog.
+                }
+
+                final SelectAccountDialogFragment dialog = new SelectAccountDialogFragment(true);
+                dialog.setTargetFragment(this, 0);
+                dialog.show(getFragmentManager(), SelectAccountDialogFragment.TAG);
+                break;
+            }
+        }
+    }
+
+    @Override
+    public void onAccountSelectorCancelled() {
+    }
+
+    @Override
+    public void onAccountChosen(Account account, boolean isNewContact) {
+        createCopy(account);
+    }
+
+    private void createCopy(Account account) {
+        if (mListener != null) {
+            mListener.onCreateRawContactRequested(mContactData.getContentValues(), account);
+        }
+    }
+
+    @Override
+    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
+        AdapterView.AdapterContextMenuInfo info;
+        try {
+             info = (AdapterView.AdapterContextMenuInfo) menuInfo;
+        } catch (ClassCastException e) {
+            Log.e(TAG, "bad menuInfo", e);
+            return;
+        }
+
+        // This can be null sometimes, don't crash...
+        if (info == null) {
+            Log.e(TAG, "bad menuInfo");
+            return;
+        }
+
+        final ViewEntry entry = mAdapter.getEntry(info.position);
+        menu.setHeaderTitle(R.string.contactOptionsTitle);
+        if (entry.mimetype.equals(CommonDataKinds.Phone.CONTENT_ITEM_TYPE)) {
+            if (mHasPhone) {
+                menu.add(0, 0, 0, R.string.menu_call).setIntent(entry.intent);
+            }
+            if (mHasSms) {
+                // If there is no Phone, SMS is the primary intent
+                final Intent intent = mHasPhone ? entry.secondaryIntent : entry.intent;
+                menu.add(0, 0, 0, R.string.menu_sendSMS).setIntent(intent);
+            }
+            if (!entry.isPrimary && mHasPhone) {
+                menu.add(0, R.id.menu_detail_makeDefault, 0, R.string.menu_makeDefaultNumber);
+            }
+        } else if (entry.mimetype.equals(CommonDataKinds.Email.CONTENT_ITEM_TYPE)) {
+            menu.add(0, 0, 0, R.string.menu_sendEmail).setIntent(entry.intent);
+            if (!entry.isPrimary) {
+                menu.add(0, R.id.menu_detail_makeDefault, 0, R.string.menu_makeDefaultEmail);
+            }
+        } else if (entry.mimetype.equals(CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE)) {
+            menu.add(0, 0, 0, R.string.menu_viewAddress).setIntent(entry.intent);
+        }
+    }
+
+    @Override
+    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+        if (mListener == null) return;
+        final ViewEntry entry = mAdapter.getEntry(position);
+        if (entry == null) return;
+        final Intent intent = entry.intent;
+        if (intent == null) return;
+        mListener.onItemClicked(intent);
+    }
+
+    @Override
+    public boolean onContextItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.menu_detail_makeDefault: {
+                if (makeItemDefault(item)) {
+                    return true;
+                }
+                break;
+            }
+        }
+
+        return false;
+    }
+
+    private boolean makeItemDefault(MenuItem item) {
+        ViewEntry entry = getViewEntryForMenuItem(item);
+        if (entry == null) {
+            return false;
+        }
+
+        // Update the primary values in the data record.
+        ContentValues values = new ContentValues(1);
+        values.put(Data.IS_SUPER_PRIMARY, 1);
+
+        mContext.getContentResolver().update(ContentUris.withAppendedId(Data.CONTENT_URI, entry.id),
+                values, null, null);
+        return true;
+    }
+
+    private ViewEntry getViewEntryForMenuItem(MenuItem item) {
+        AdapterView.AdapterContextMenuInfo info;
+        try {
+             info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
+        } catch (ClassCastException e) {
+            Log.e(TAG, "bad menuInfo", e);
+            return null;
+        }
+
+        return mAdapter.getEntry(info.position);
+    }
+
+    public boolean handleKeyDown(int keyCode) {
+        switch (keyCode) {
+            case KeyEvent.KEYCODE_CALL: {
+                try {
+                    ITelephony phone = ITelephony.Stub.asInterface(
+                            ServiceManager.checkService("phone"));
+                    if (phone != null && !phone.isIdle()) {
+                        // Skip out and let the key be handled at a higher level
+                        break;
+                    }
+                } catch (RemoteException re) {
+                    // Fall through and try to call the contact
+                }
+
+                int index = mListView.getSelectedItemPosition();
+                if (index != -1) {
+                    final ViewEntry entry = mAdapter.getEntry(index);
+                    if (entry != null && entry.intent != null &&
+                            entry.intent.getAction() == Intent.ACTION_CALL_PRIVILEGED) {
+                        mContext.startActivity(entry.intent);
+                        return true;
+                    }
+                } else if (mPrimaryPhoneUri != null) {
+                    // There isn't anything selected, call the default number
+                    final Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
+                            mPrimaryPhoneUri);
+                    mContext.startActivity(intent);
+                    return true;
+                }
+                return false;
+            }
+
+            case KeyEvent.KEYCODE_DEL: {
+                if (mListener != null) mListener.onDeleteRequested(mLookupUri);
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * The listener for the detail loader
+     */
+    private final LoaderManager.LoaderCallbacks<ContactLoader.Result> mDetailLoaderListener =
+            new LoaderCallbacks<ContactLoader.Result>() {
+        @Override
+        public Loader<ContactLoader.Result> onCreateLoader(int id, Bundle args) {
+            return new ContactLoader(mContext, mLookupUri, true /* loadGroupMetaData */);
+        }
+
+        @Override
+        public void onLoadFinished(Loader<ContactLoader.Result> loader, ContactLoader.Result data) {
+            if (data == ContactLoader.Result.NOT_FOUND || data == ContactLoader.Result.ERROR) {
+                // Item has been deleted
+                Log.i(TAG, "No contact found. Closing activity");
+                if (mListener != null) mListener.onContactNotFound();
+                return;
+            }
+            mContactData = data;
+            bindData();
+        }
+    };
+
+    private ContactDetailHeaderView.Listener mHeaderViewListener =
+            new ContactDetailHeaderView.Listener() {
+        @Override
+        public void onDisplayNameClick(View view) {
+        }
+
+        @Override
+        public void onPhotoClick(View view) {
+        }
+    };
+
+
+    public static interface Listener {
+        /**
+         * Contact was not found, so somehow close this fragment. This is raised after a contact
+         * is removed via Menu/Delete
+         */
+        public void onContactNotFound();
+
+        /**
+         * User decided to go to Edit-Mode
+         */
+        public void onEditRequested(Uri lookupUri);
+
+        /**
+         * User clicked a single item (e.g. mail)
+         */
+        public void onItemClicked(Intent intent);
+
+        /**
+         * User decided to delete the contact
+         */
+        public void onDeleteRequested(Uri lookupUri);
+
+        /**
+         * User requested creation of a new contact with the specified values.
+         *
+         * @param values ContentValues containing data rows for the new contact.
+         * @param account Account where the new contact should be created
+         */
+        public void onCreateRawContactRequested(ArrayList<ContentValues> values, Account account);
+    }
+}
diff --git a/src/com/android/contacts/views/detail/ContactDetailHeaderView.java b/src/com/android/contacts/views/detail/ContactDetailHeaderView.java
new file mode 100644
index 0000000..7d1e9ec
--- /dev/null
+++ b/src/com/android/contacts/views/detail/ContactDetailHeaderView.java
@@ -0,0 +1,365 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.views.detail;
+
+import com.android.contacts.R;
+import com.android.contacts.util.ContactBadgeUtil;
+import com.android.contacts.views.ContactLoader;
+import com.android.contacts.views.ContactLoader.Result;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Entity;
+import android.content.Entity.NamedContentValues;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.provider.ContactsContract.CommonDataKinds.Organization;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.DisplayNameSources;
+import android.provider.ContactsContract.StatusUpdates;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Header for displaying a title bar with contact info. You
+ * can bind specific values by calling
+ * {@link ContactDetailHeaderView#loadData(com.android.contacts.views.ContactLoader.Result)}
+ */
+public class ContactDetailHeaderView extends FrameLayout implements View.OnClickListener {
+    private static final String TAG = "ContactDetailHeaderView";
+
+    private TextView mDisplayNameView;
+    private TextView mPhoneticNameView;
+    private TextView mOrganizationTextView;
+    private CheckBox mStarredView;
+    private ImageView mPhotoView;
+    private ImageView mPresenceView;
+    private View mStatusContainerView;
+    private TextView mStatusView;
+    private TextView mStatusDateView;
+    private TextView mDirectoryNameView;
+
+    private Uri mContactUri;
+    private Listener mListener;
+
+    /**
+     * Interface for callbacks invoked when the user interacts with a header.
+     */
+    public interface Listener {
+        public void onPhotoClick(View view);
+        public void onDisplayNameClick(View view);
+    }
+
+    public ContactDetailHeaderView(Context context) {
+        this(context, null);
+    }
+
+    public ContactDetailHeaderView(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public ContactDetailHeaderView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+
+        final LayoutInflater inflater =
+            (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        inflater.inflate(R.layout.contact_detail_header_view, this);
+
+        mDisplayNameView = (TextView) findViewById(R.id.name);
+
+        mPhoneticNameView = (TextView) findViewById(R.id.phonetic_name);
+
+        mOrganizationTextView = (TextView) findViewById(R.id.organization);
+
+        mStarredView = (CheckBox)findViewById(R.id.star);
+        mStarredView.setOnClickListener(this);
+
+        mPhotoView = (ImageView) findViewById(R.id.photo);
+
+        mPresenceView = (ImageView) findViewById(R.id.presence);
+        mStatusContainerView = findViewById(R.id.status_container);
+        mStatusView = (TextView)findViewById(R.id.status);
+        mStatusDateView = (TextView)findViewById(R.id.status_date);
+
+        mDirectoryNameView = (TextView) findViewById(R.id.directory_name);
+    }
+
+    /**
+     * Loads the data from the Loader-Result. This is the only function that has to be called
+     * from the outside to fully setup the View
+     */
+    public void loadData(ContactLoader.Result contactData) {
+        mContactUri = contactData.getLookupUri();
+
+        setDisplayName(contactData.getDisplayName(), contactData.getPhoneticName());
+        setCompany(contactData);
+        Bitmap photo = ContactBadgeUtil.getPhoto(contactData);
+        if (photo != null) {
+            setPhoto(photo);
+        } else if (contactData.getPhotoUri() != null) {
+            setPhoto(null);
+            new AsyncPhotoLoader().execute(contactData.getPhotoUri());
+        } else {
+            setPhoto(ContactBadgeUtil.loadPlaceholderPhoto(mContext));
+        }
+        setStared(contactData.getStarred());
+        setPresence(contactData.getPresence());
+        setSocialSnippet(contactData.getSocialSnippet());
+        setSocialDate(ContactBadgeUtil.getSocialDate(contactData, getContext()));
+        setDirectoryName(contactData.isDirectoryEntry(), contactData.getDirectoryDisplayName(),
+                contactData.getDirectoryType(), contactData.getDirectoryAccountName());
+    }
+
+    /**
+     * Set the given {@link Listener} to handle header events.
+     */
+    public void setListener(Listener listener) {
+        mListener = listener;
+    }
+
+    private void performPhotoClick() {
+        if (mListener != null) {
+            mListener.onPhotoClick(mPhotoView);
+        }
+    }
+
+    private void performDisplayNameClick() {
+        if (mListener != null) {
+            mListener.onDisplayNameClick(mDisplayNameView);
+        }
+    }
+
+    /**
+     * Set the starred state of this header widget.
+     */
+    private void setStared(boolean starred) {
+        mStarredView.setChecked(starred);
+    }
+
+    /**
+     * Set the presence. If presence is null, it is hidden.
+     */
+    private void setPresence(Integer presence) {
+        if (presence == null) {
+            mPresenceView.setVisibility(View.GONE);
+        } else {
+            mPresenceView.setVisibility(View.VISIBLE);
+            mPresenceView.setImageResource(StatusUpdates.getPresenceIconResourceId(
+                    presence.intValue()));
+        }
+    }
+
+    /**
+     * Set the photo to display in the header. If bitmap is null, the default placeholder
+     * image is shown
+     */
+    private void setPhoto(Bitmap bitmap) {
+        mPhotoView.setImageBitmap(
+                bitmap == null ? ContactBadgeUtil.loadPlaceholderPhoto(mContext) : bitmap);
+    }
+
+    /**
+     * Set the display name and phonetic name to show in the header.
+     */
+    private void setDisplayName(CharSequence displayName, CharSequence phoneticName) {
+        mDisplayNameView.setText(displayName);
+        if (TextUtils.isEmpty(phoneticName)) {
+            mPhoneticNameView.setVisibility(View.GONE);
+        } else {
+            mPhoneticNameView.setText(phoneticName);
+            mPhoneticNameView.setVisibility(View.VISIBLE);
+        }
+    }
+
+    /**
+     * Sets the organization info. If several organizations are given, the first one is used
+     */
+    private void setCompany(Result contactData) {
+        final boolean displayNameIsOrganization =
+            contactData.getDisplayNameSource() == DisplayNameSources.ORGANIZATION;
+        for (Entity entity : contactData.getEntities()) {
+            for (NamedContentValues subValue : entity.getSubValues()) {
+                final ContentValues entryValues = subValue.values;
+                final String mimeType = entryValues.getAsString(Data.MIMETYPE);
+
+                if (Organization.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                    final String company = entryValues.getAsString(Organization.COMPANY);
+                    final String title = entryValues.getAsString(Organization.TITLE);
+                    final String combined;
+                    // We need to show company and title in a combined string. However, if the
+                    // DisplayName is already the organization, it mirrors company or (if company
+                    // is empty title). Make sure we don't show what's already shown as DisplayName
+                    if (TextUtils.isEmpty(company)) {
+                        combined = displayNameIsOrganization ? null : title;
+                    } else {
+                        if (TextUtils.isEmpty(title)) {
+                            combined = displayNameIsOrganization ? null : company;
+                        } else {
+                            if (displayNameIsOrganization) {
+                                combined = title;
+                            } else {
+                                combined = getResources().getString(
+                                        R.string.organization_company_and_title,
+                                        company, title);
+                            }
+                        }
+                    }
+
+                    if (TextUtils.isEmpty(combined)) {
+                        mOrganizationTextView.setVisibility(GONE);
+                    } else {
+                        mOrganizationTextView.setVisibility(VISIBLE);
+                        mOrganizationTextView.setText(combined);
+                    }
+
+                    return;
+                }
+            }
+        }
+        mOrganizationTextView.setVisibility(GONE);
+    }
+
+    /**
+     * Set the social snippet text to display in the header.
+     */
+    private void setSocialSnippet(CharSequence snippet) {
+        if (TextUtils.isEmpty(snippet)) {
+            // No status info. Hide everything
+            if (mStatusContainerView != null) mStatusContainerView.setVisibility(View.GONE);
+            mStatusView.setVisibility(View.GONE);
+            mStatusDateView.setVisibility(View.GONE);
+        } else {
+            // We have status info. Show the bubble
+            if (mStatusContainerView != null) mStatusContainerView.setVisibility(View.VISIBLE);
+            mStatusView.setVisibility(View.VISIBLE);
+            mStatusView.setText(snippet);
+        }
+    }
+
+    /**
+     * Set the status attribution text to display in the header.
+     */
+
+    private void setSocialDate(CharSequence dateText) {
+        if (TextUtils.isEmpty(dateText)) {
+            mStatusDateView.setVisibility(View.GONE);
+        } else {
+            mStatusDateView.setText(dateText);
+            mStatusDateView.setVisibility(View.VISIBLE);
+        }
+    }
+
+    private void setDirectoryName(boolean isDirectoryEntry, String directoryDisplayName,
+            String directoryType, String directoryAccountName) {
+        if (isDirectoryEntry) {
+            String name = TextUtils.isEmpty(directoryDisplayName)
+                    ? directoryAccountName
+                    : directoryDisplayName;
+            String text;
+            if (TextUtils.isEmpty(name)) {
+                text = getContext().getString(
+                        R.string.contact_directory_description, directoryType);
+            } else {
+                text = getContext().getString(
+                        R.string.contact_directory_account_description, directoryType, name);
+            }
+            mDirectoryNameView.setText(text);
+            mDirectoryNameView.setVisibility(View.VISIBLE);
+        } else {
+            mDirectoryNameView.setVisibility(View.GONE);
+        }
+    }
+
+    @Override
+    public void onClick(View view) {
+        switch (view.getId()) {
+            case R.id.star: {
+                // Toggle "starred" state
+                // Make sure there is a contact
+                if (mContactUri != null) {
+                    // TODO: This should be done in the background
+                    final ContentValues values = new ContentValues(1);
+                    values.put(Contacts.STARRED, mStarredView.isChecked());
+                    mContext.getContentResolver().update(mContactUri, values, null, null);
+                }
+                break;
+            }
+            case R.id.photo: {
+                performPhotoClick();
+                break;
+            }
+            case R.id.name: {
+                performDisplayNameClick();
+                break;
+            }
+        }
+    }
+
+    private class AsyncPhotoLoader extends AsyncTask<String, Void, Bitmap> {
+
+        private static final int BUFFER_SIZE = 1024*16;
+
+        @Override
+        protected Bitmap doInBackground(String... params) {
+            Uri uri = Uri.parse(params[0]);
+            Bitmap bitmap = null;
+            try {
+                InputStream is = getContext().getContentResolver().openInputStream(uri);
+                if (is != null) {
+                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                    try {
+                        byte[] mBuffer = new byte[BUFFER_SIZE];
+
+                        int size;
+                        while ((size = is.read(mBuffer)) != -1) {
+                            baos.write(mBuffer, 0, size);
+                        }
+                        byte[] bytes = baos.toByteArray();
+                        bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, null);
+                    } finally {
+                        is.close();
+                    }
+                } else {
+                    Log.v(TAG, "Cannot load photo " + uri);
+                }
+            } catch (IOException e) {
+                Log.e(TAG, "Cannot load photo " + uri, e);
+            }
+
+            return bitmap;
+        }
+
+        @Override
+        protected void onPostExecute(Bitmap bitmap) {
+            setPhoto(bitmap);
+        }
+    }
+}
diff --git a/src/com/android/contacts/views/detail/ContactNoneFragment.java b/src/com/android/contacts/views/detail/ContactNoneFragment.java
new file mode 100644
index 0000000..8d5794e
--- /dev/null
+++ b/src/com/android/contacts/views/detail/ContactNoneFragment.java
@@ -0,0 +1,33 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.views.detail;
+
+import com.android.contacts.R;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class ContactNoneFragment extends Fragment {
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
+        return inflater.inflate(R.layout.contact_none_fragment, container, false);
+    }
+}
diff --git a/src/com/android/contacts/views/editor/AggregationSuggestionEngine.java b/src/com/android/contacts/views/editor/AggregationSuggestionEngine.java
new file mode 100644
index 0000000..79131d6
--- /dev/null
+++ b/src/com/android/contacts/views/editor/AggregationSuggestionEngine.java
@@ -0,0 +1,407 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.views.editor;
+
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.google.android.collect.Lists;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Message;
+import android.os.Process;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Nickname;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.provider.ContactsContract.CommonDataKinds.StructuredName;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Contacts.AggregationSuggestions;
+import android.provider.ContactsContract.Contacts.AggregationSuggestions.Builder;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.RawContacts;
+import android.text.TextUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Runs asynchronous queries to obtain aggregation suggestions in the as-you-type mode.
+ */
+public class AggregationSuggestionEngine extends HandlerThread {
+    public static final String TAG = "AggregationSuggestionEngine";
+
+    private static final int MESSAGE_RESET = 0;
+    private static final int MESSAGE_NAME_CHANGE = 1;
+    private static final int MESSAGE_DATA_CURSOR = 2;
+
+    private static final long SUGGESTION_LOOKUP_DELAY_MILLIS = 300;
+
+    private static final int MAX_SUGGESTION_COUNT = 3;
+
+    private final Context mContext;
+
+    private long[] mSuggestedContactIds = new long[0];
+
+    private Handler mMainHandler;
+    private Handler mHandler;
+    private long mContactId;
+    private Listener mListener;
+    private Cursor mDataCursor;
+
+    public interface Listener {
+        void onAggregationSuggestionChange();
+    }
+
+    public static final class RawContact {
+        public long rawContactId;
+        public String accountType;
+        public String accountName;
+
+        @Override
+        public String toString() {
+            return "ID: " + rawContactId + " account: " + accountType + "/" + accountName;
+        }
+    }
+
+    public static final class Suggestion {
+
+        public long contactId;
+        public String lookupKey;
+        public String name;
+        public String phoneNumber;
+        public String emailAddress;
+        public String nickname;
+        public byte[] photo;
+        public List<RawContact> rawContacts;
+
+        @Override
+        public String toString() {
+            return "ID: " + contactId + " rawContacts: " + rawContacts + " name: " + name
+                    + " phone: " + phoneNumber + " email: " + emailAddress + " nickname: "
+                    + nickname + (photo != null ? " [has photo]" : "");
+        }
+    }
+
+    public AggregationSuggestionEngine(Context context) {
+        super("AggregationSuggestions", Process.THREAD_PRIORITY_BACKGROUND);
+        mContext = context;
+        mMainHandler = new Handler() {
+            @Override
+            public void handleMessage(Message msg) {
+                AggregationSuggestionEngine.this.deliverNotification((Cursor) msg.obj);
+            }
+        };
+    }
+
+    protected Handler getHandler() {
+        if (mHandler == null) {
+            mHandler = new Handler(getLooper()) {
+                @Override
+                public void handleMessage(Message msg) {
+                    AggregationSuggestionEngine.this.handleMessage(msg);
+                }
+            };
+        }
+        return mHandler;
+    }
+
+    public void setContactId(long contactId) {
+        if (contactId != mContactId) {
+            mContactId = contactId;
+            reset();
+        }
+    }
+
+    public void setListener(Listener listener) {
+        mListener = listener;
+    }
+
+    @Override
+    public boolean quit() {
+        if (mDataCursor != null) {
+            mDataCursor.close();
+        }
+        mDataCursor = null;
+        return super.quit();
+    }
+
+    public void reset() {
+        Handler handler = getHandler();
+        handler.removeMessages(MESSAGE_NAME_CHANGE);
+        handler.sendEmptyMessage(MESSAGE_RESET);
+    }
+
+    public void onNameChange(ValuesDelta values) {
+        Handler handler = getHandler();
+        handler.removeMessages(MESSAGE_NAME_CHANGE);
+
+        Uri uri = buildAggregationSuggestionUri(values);
+        if (uri == null) {
+            return;
+        }
+
+        Message msg = handler.obtainMessage(MESSAGE_NAME_CHANGE, uri);
+        handler.sendMessageDelayed(msg, SUGGESTION_LOOKUP_DELAY_MILLIS);
+    }
+
+    private Uri buildAggregationSuggestionUri(ValuesDelta values) {
+        StringBuilder nameSb = new StringBuilder();
+        appendValue(nameSb, values, StructuredName.PREFIX);
+        appendValue(nameSb, values, StructuredName.GIVEN_NAME);
+        appendValue(nameSb, values, StructuredName.MIDDLE_NAME);
+        appendValue(nameSb, values, StructuredName.FAMILY_NAME);
+        appendValue(nameSb, values, StructuredName.SUFFIX);
+
+        if (nameSb.length() == 0) {
+            appendValue(nameSb, values, StructuredName.DISPLAY_NAME);
+        }
+
+        StringBuilder phoneticNameSb = new StringBuilder();
+        appendValue(phoneticNameSb, values, StructuredName.PHONETIC_FAMILY_NAME);
+        appendValue(phoneticNameSb, values, StructuredName.PHONETIC_MIDDLE_NAME);
+        appendValue(phoneticNameSb, values, StructuredName.PHONETIC_GIVEN_NAME);
+
+        if (nameSb.length() == 0 && phoneticNameSb.length() == 0) {
+            return null;
+        }
+
+        Builder builder = AggregationSuggestions.builder()
+                .setLimit(MAX_SUGGESTION_COUNT)
+                .setContactId(mContactId);
+
+        if (nameSb.length() != 0) {
+            builder.addParameter(AggregationSuggestions.PARAMETER_MATCH_NAME, nameSb.toString());
+        }
+
+        if (phoneticNameSb.length() != 0) {
+            builder.addParameter(
+                    AggregationSuggestions.PARAMETER_MATCH_NAME, phoneticNameSb.toString());
+        }
+
+        return builder.build();
+    }
+
+    private void appendValue(StringBuilder sb, ValuesDelta values, String column) {
+        String value = values.getAsString(column);
+        if (!TextUtils.isEmpty(value)) {
+            if (sb.length() > 0) {
+                sb.append(' ');
+            }
+            sb.append(value);
+        }
+    }
+
+    protected void handleMessage(Message msg) {
+        switch (msg.what) {
+            case MESSAGE_RESET:
+                mSuggestedContactIds = new long[0];
+                break;
+            case MESSAGE_NAME_CHANGE:
+                loadAggregationSuggestions((Uri) msg.obj);
+                break;
+        }
+    }
+
+    private static final class DataQuery {
+
+        public static final String SELECTION_PREFIX =
+                Data.MIMETYPE + " IN ('"
+                    + Phone.CONTENT_ITEM_TYPE + "','"
+                    + Email.CONTENT_ITEM_TYPE + "','"
+                    + StructuredName.CONTENT_ITEM_TYPE + "','"
+                    + Nickname.CONTENT_ITEM_TYPE + "','"
+                    + Photo.CONTENT_ITEM_TYPE + "')"
+                + " AND " + Data.CONTACT_ID + " IN (";
+
+        public static final String[] COLUMNS = {
+            Data._ID,
+            Data.CONTACT_ID,
+            Data.LOOKUP_KEY,
+            Data.PHOTO_ID,
+            Data.DISPLAY_NAME,
+            Data.RAW_CONTACT_ID,
+            Data.MIMETYPE,
+            Data.DATA1,
+            Data.IS_SUPER_PRIMARY,
+            Photo.PHOTO,
+            RawContacts.ACCOUNT_TYPE,
+            RawContacts.ACCOUNT_NAME,
+        };
+
+        public static final int ID = 0;
+        public static final int CONTACT_ID = 1;
+        public static final int LOOKUP_KEY = 2;
+        public static final int PHOTO_ID = 3;
+        public static final int DISPLAY_NAME = 4;
+        public static final int RAW_CONTACT_ID = 5;
+        public static final int MIMETYPE = 6;
+        public static final int DATA1 = 7;
+        public static final int IS_SUPERPRIMARY = 8;
+        public static final int PHOTO = 9;
+        public static final int ACCOUNT_TYPE = 10;
+        public static final int ACCOUNT_NAME = 11;
+    }
+
+    private void loadAggregationSuggestions(Uri uri) {
+        ContentResolver contentResolver = mContext.getContentResolver();
+        Cursor cursor = contentResolver.query(uri, new String[]{Contacts._ID}, null, null, null);
+        try {
+            // If a new request is pending, chuck the result of the previous request
+            if (getHandler().hasMessages(MESSAGE_NAME_CHANGE)) {
+                return;
+            }
+
+            boolean changed = updateSuggestedContactIds(cursor);
+            if (!changed) {
+                return;
+            }
+
+            StringBuilder sb = new StringBuilder(DataQuery.SELECTION_PREFIX);
+            int count = mSuggestedContactIds.length;
+            for (int i = 0; i < count; i++) {
+                if (i > 0) {
+                    sb.append(',');
+                }
+                sb.append(mSuggestedContactIds[i]);
+            }
+            sb.append(')');
+            sb.toString();
+
+            Cursor dataCursor = contentResolver.query(Data.CONTENT_URI,
+                    DataQuery.COLUMNS, sb.toString(), null, Data.CONTACT_ID);
+            mMainHandler.sendMessage(mMainHandler.obtainMessage(MESSAGE_DATA_CURSOR, dataCursor));
+        } finally {
+            cursor.close();
+        }
+    }
+
+    private boolean updateSuggestedContactIds(Cursor cursor) {
+        int count = cursor.getCount();
+        boolean changed = count != mSuggestedContactIds.length;
+        if (!changed) {
+            while (cursor.moveToNext()) {
+                long contactId = cursor.getLong(0);
+                if (Arrays.binarySearch(mSuggestedContactIds, contactId) < 0) {
+                    changed = true;
+                    break;
+                }
+            }
+        }
+
+        if (changed) {
+            mSuggestedContactIds = new long[count];
+            cursor.moveToPosition(-1);
+            for (int i = 0; i < count; i++) {
+                cursor.moveToNext();
+                mSuggestedContactIds[i] = cursor.getLong(0);
+            }
+            Arrays.sort(mSuggestedContactIds);
+        }
+
+        return changed;
+    }
+
+    protected void deliverNotification(Cursor dataCursor) {
+        if (mDataCursor != null) {
+            mDataCursor.close();
+        }
+        mDataCursor = dataCursor;
+        if (mListener != null) {
+            mListener.onAggregationSuggestionChange();
+        }
+    }
+
+    public int getSuggestedContactCount() {
+        return mDataCursor != null ? mDataCursor.getCount() : 0;
+    }
+
+    public List<Suggestion> getSuggestions() {
+        ArrayList<Suggestion> list = Lists.newArrayList();
+        if (mDataCursor != null) {
+            Suggestion suggestion = null;
+            long currentContactId = -1;
+            mDataCursor.moveToPosition(-1);
+            while (mDataCursor.moveToNext()) {
+                long contactId = mDataCursor.getLong(DataQuery.CONTACT_ID);
+                if (contactId != currentContactId) {
+                    suggestion = new Suggestion();
+                    suggestion.contactId = contactId;
+                    suggestion.name = mDataCursor.getString(DataQuery.DISPLAY_NAME);
+                    suggestion.lookupKey = mDataCursor.getString(DataQuery.LOOKUP_KEY);
+                    suggestion.rawContacts = Lists.newArrayList();
+                    list.add(suggestion);
+                    currentContactId = contactId;
+                }
+
+                long rawContactId = mDataCursor.getLong(DataQuery.RAW_CONTACT_ID);
+                if (!containsRawContact(suggestion, rawContactId)) {
+                    RawContact rawContact = new RawContact();
+                    rawContact.rawContactId = rawContactId;
+                    rawContact.accountName = mDataCursor.getString(DataQuery.ACCOUNT_NAME);
+                    rawContact.accountType = mDataCursor.getString(DataQuery.ACCOUNT_TYPE);
+                    suggestion.rawContacts.add(rawContact);
+                }
+
+                String mimetype = mDataCursor.getString(DataQuery.MIMETYPE);
+                if (Phone.CONTENT_ITEM_TYPE.equals(mimetype)) {
+                    String data = mDataCursor.getString(DataQuery.DATA1);
+                    int superprimary = mDataCursor.getInt(DataQuery.IS_SUPERPRIMARY);
+                    if (!TextUtils.isEmpty(data)
+                            && (superprimary != 0 || suggestion.phoneNumber == null)) {
+                        suggestion.phoneNumber = data;
+                    }
+                } else if (Email.CONTENT_ITEM_TYPE.equals(mimetype)) {
+                    String data = mDataCursor.getString(DataQuery.DATA1);
+                    int superprimary = mDataCursor.getInt(DataQuery.IS_SUPERPRIMARY);
+                    if (!TextUtils.isEmpty(data)
+                            && (superprimary != 0 || suggestion.emailAddress == null)) {
+                        suggestion.emailAddress = data;
+                    }
+                } else if (Nickname.CONTENT_ITEM_TYPE.equals(mimetype)) {
+                    String data = mDataCursor.getString(DataQuery.DATA1);
+                    if (!TextUtils.isEmpty(data)) {
+                        suggestion.nickname = data;
+                    }
+                } else if (Photo.CONTENT_ITEM_TYPE.equals(mimetype)) {
+                    long dataId = mDataCursor.getLong(DataQuery.ID);
+                    long photoId = mDataCursor.getLong(DataQuery.PHOTO_ID);
+                    if (dataId == photoId && !mDataCursor.isNull(DataQuery.PHOTO)) {
+                        suggestion.photo = mDataCursor.getBlob(DataQuery.PHOTO);
+                    }
+                }
+            }
+        }
+        return list;
+    }
+
+    public boolean containsRawContact(Suggestion suggestion, long rawContactId) {
+        if (suggestion.rawContacts != null) {
+            int count = suggestion.rawContacts.size();
+            for (int i = 0; i < count; i++) {
+                if (suggestion.rawContacts.get(i).rawContactId == rawContactId) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+}
diff --git a/src/com/android/contacts/views/editor/AggregationSuggestionView.java b/src/com/android/contacts/views/editor/AggregationSuggestionView.java
new file mode 100644
index 0000000..8c8adf7
--- /dev/null
+++ b/src/com/android/contacts/views/editor/AggregationSuggestionView.java
@@ -0,0 +1,162 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.views.editor;
+
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.views.editor.AggregationSuggestionEngine.RawContact;
+import com.android.contacts.views.editor.AggregationSuggestionEngine.Suggestion;
+import com.google.android.collect.Lists;
+
+import android.content.ContentUris;
+import android.content.Context;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.provider.ContactsContract.Contacts;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A view that contains a name, picture and other data for a contact aggregation suggestion.
+ */
+public class AggregationSuggestionView extends RelativeLayout implements OnClickListener {
+
+    public interface Listener {
+
+        /**
+         * Callback that passes the contact ID to join with and, for convenience,
+         * also the list of constituent raw contact IDs to avoid a separate query
+         * for those.
+         */
+        public void onJoinAction(long contactId, List<Long> rawContacIds);
+
+        /**
+         * Callback that passes the contact ID to edit instead of the current contact.
+         */
+        public void onEditAction(Uri contactLookupUri);
+    }
+
+    private Listener mListener;
+    private long mContactId;
+    private String mLookupKey;
+    private List<RawContact> mRawContacts = Lists.newArrayList();
+    private boolean mNewContact;
+
+    public AggregationSuggestionView(Context context) {
+        super(context);
+    }
+
+    public AggregationSuggestionView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public AggregationSuggestionView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    public void setNewContact(boolean flag) {
+        mNewContact = flag;
+    }
+
+    public void bindSuggestion(Suggestion suggestion) {
+        mContactId = suggestion.contactId;
+        mLookupKey = suggestion.lookupKey;
+        mRawContacts = suggestion.rawContacts;
+        ImageView photo = (ImageView) findViewById(R.id.aggregation_suggestion_photo);
+        if (suggestion.photo != null) {
+            photo.setImageBitmap(BitmapFactory.decodeByteArray(
+                    suggestion.photo, 0, suggestion.photo.length));
+        } else {
+            photo.setImageResource(R.drawable.ic_contact_picture_2);
+        }
+
+        TextView name = (TextView) findViewById(R.id.aggregation_suggestion_name);
+        name.setText(suggestion.name);
+
+        TextView data = (TextView) findViewById(R.id.aggregation_suggestion_data);
+        String dataText = null;
+        if (suggestion.nickname != null) {
+            dataText = suggestion.nickname;
+        } else if (suggestion.emailAddress != null) {
+            dataText = suggestion.emailAddress;
+        } else if (suggestion.phoneNumber != null) {
+            dataText = suggestion.phoneNumber;
+        }
+        data.setText(dataText);
+
+        boolean canEdit = canEditSuggestedContact();
+        Button join = (Button) findViewById(R.id.aggregation_suggestion_join_button);
+        join.setOnClickListener(this);
+        join.setVisibility(canEdit ? View.GONE : View.VISIBLE);
+
+        Button edit = (Button) findViewById(R.id.aggregation_suggestion_edit_button);
+        edit.setOnClickListener(this);
+        edit.setVisibility(canEdit ? View.VISIBLE : View.GONE);
+    }
+
+    /**
+     * Returns true if the suggested contact can be edited.
+     */
+    private boolean canEditSuggestedContact() {
+        if (!mNewContact) {
+            return false;
+        }
+
+        AccountTypes sources = AccountTypes.getInstance(getContext());
+        for (RawContact rawContact : mRawContacts) {
+            String accountType = rawContact.accountType;
+            if (accountType == null) {
+                return true;
+            }
+            BaseAccountType source = sources.getInflatedSource(
+                    accountType, BaseAccountType.LEVEL_SUMMARY);
+            if (!source.readOnly) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public void setListener(Listener listener) {
+        mListener = listener;
+    }
+
+    @Override
+    public void onClick(View v) {
+        if (mListener != null) {
+            if (v.getId() == R.id.aggregation_suggestion_join_button) {
+                ArrayList<Long> rawContactIds = Lists.newArrayList();
+                for (RawContact rawContact : mRawContacts) {
+                    rawContactIds.add(rawContact.rawContactId);
+                }
+                mListener.onJoinAction(mContactId, rawContactIds);
+            } else {
+                mListener.onEditAction(Contacts.getLookupUri(mContactId, mLookupKey));
+            }
+        }
+    }
+}
diff --git a/src/com/android/contacts/views/editor/BaseRawContactEditorView.java b/src/com/android/contacts/views/editor/BaseRawContactEditorView.java
new file mode 100644
index 0000000..76c37d7
--- /dev/null
+++ b/src/com/android/contacts/views/editor/BaseRawContactEditorView.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2009 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.contacts.views.editor;
+
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.android.contacts.model.EntityModifier;
+
+import android.content.Context;
+import android.content.Entity;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.RawContacts;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+
+/**
+ * Base view that provides common code for the editor interaction for a specific
+ * RawContact represented through an {@link EntityDelta}. Callers can
+ * reuse this view and quickly rebuild its contents through
+ * {@link #setState(EntityDelta, BaseAccountType)}.
+ * <p>
+ * Internal updates are performed against {@link ValuesDelta} so that the
+ * source {@link Entity} can be swapped out. Any state-based changes, such as
+ * adding {@link Data} rows or changing {@link EditType}, are performed through
+ * {@link EntityModifier} to ensure that {@link BaseAccountType} are enforced.
+ */
+public abstract class BaseRawContactEditorView extends LinearLayout {
+    protected LayoutInflater mInflater;
+
+    protected PhotoEditorView mPhoto;
+    protected boolean mHasPhotoEditor = false;
+
+    public BaseRawContactEditorView(Context context) {
+        super(context);
+    }
+
+    public BaseRawContactEditorView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public void setGroupMetaData(Cursor groupMetaData) {
+    }
+
+    /**
+     * Assign the given {@link Bitmap} to the internal {@link PhotoEditorView}
+     * for the {@link EntityDelta} currently being edited.
+     */
+    public void setPhotoBitmap(Bitmap bitmap) {
+        mPhoto.setPhotoBitmap(bitmap);
+    }
+
+    /**
+     * Return true if the current {@link RawContacts} supports {@link Photo},
+     * which means that {@link PhotoEditorView} is enabled.
+     */
+    public boolean hasPhotoEditor() {
+        return mHasPhotoEditor;
+    }
+
+    /**
+     * Return true if internal {@link PhotoEditorView} has a {@link Photo} set.
+     */
+    public boolean hasSetPhoto() {
+        return mPhoto.hasSetPhoto();
+    }
+
+    public PhotoEditorView getPhotoEditor() {
+        return mPhoto;
+    }
+
+    /**
+     * @return the RawContact ID that this editor is editing.
+     */
+    public abstract long getRawContactId();
+
+    /**
+     * Set the internal state for this view, given a current
+     * {@link EntityDelta} state and the {@link BaseAccountType} that
+     * apply to that state.
+     */
+    public abstract void setState(EntityDelta state, BaseAccountType source, ViewIdGenerator vig);
+}
diff --git a/src/com/android/contacts/views/editor/ContactEditorFragment.java b/src/com/android/contacts/views/editor/ContactEditorFragment.java
new file mode 100644
index 0000000..199c515
--- /dev/null
+++ b/src/com/android/contacts/views/editor/ContactEditorFragment.java
@@ -0,0 +1,1667 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.views.editor;
+
+import com.android.contacts.JoinContactActivity;
+import com.android.contacts.R;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.android.contacts.model.EntityDeltaList;
+import com.android.contacts.model.EntityModifier;
+import com.android.contacts.model.GoogleAccountType;
+import com.android.contacts.util.EmptyService;
+import com.android.contacts.util.WeakAsyncTask;
+import com.android.contacts.views.ContactLoader;
+import com.android.contacts.views.GroupMetaDataLoader;
+import com.android.contacts.views.editor.AggregationSuggestionEngine.Suggestion;
+import com.android.contacts.views.editor.Editor.EditorListener;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.LoaderManager;
+import android.app.LoaderManager.LoaderCallbacks;
+import android.app.ProgressDialog;
+import android.content.ActivityNotFoundException;
+import android.content.ContentProviderOperation;
+import android.content.ContentProviderOperation.Builder;
+import android.content.ContentProviderResult;
+import android.content.ContentResolver;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.CursorLoader;
+import android.content.Entity;
+import android.content.Intent;
+import android.content.Loader;
+import android.content.OperationApplicationException;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.Rect;
+import android.media.MediaScannerConnection;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.RemoteException;
+import android.os.SystemClock;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.AggregationExceptions;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.StructuredName;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Intents;
+import android.provider.ContactsContract.RawContacts;
+import android.provider.MediaStore;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
+import android.view.ViewStub;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.io.File;
+import java.lang.ref.WeakReference;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+public class ContactEditorFragment extends Fragment implements
+        SplitContactConfirmationDialogFragment.Listener, PickPhotoDialogFragment.Listener,
+        SelectAccountDialogFragment.Listener, ModifyPhotoDialogFragment.Listener,
+        AggregationSuggestionEngine.Listener {
+
+    private static final String TAG = "ContactEditorFragment";
+
+    private static final int LOADER_DATA = 1;
+    private static final int LOADER_GROUPS = 2;
+
+    private static final String KEY_URI = "uri";
+    private static final String KEY_ACTION = "action";
+    private static final String KEY_EDIT_STATE = "state";
+    private static final String KEY_RAW_CONTACT_ID_REQUESTING_PHOTO = "photorequester";
+    private static final String KEY_VIEW_ID_GENERATOR = "viewidgenerator";
+    private static final String KEY_CURRENT_PHOTO_FILE = "currentphotofile";
+    private static final String KEY_QUERY_SELECTION = "queryselection";
+    private static final String KEY_CONTACT_ID_FOR_JOIN = "contactidforjoin";
+    private static final String KEY_SHOW_JOIN_SUGGESTIONS = "showJoinSuggestions";
+
+    /**
+     * Modes that specify what the AsyncTask has to perform after saving
+     */
+    private interface SaveMode {
+        /**
+         * Close the editor after saving
+         */
+        public static final int CLOSE = 0;
+
+        /**
+         * Reload the data so that the user can continue editing
+         */
+        public static final int RELOAD = 1;
+
+        /**
+         * Split the contact after saving
+         */
+        public static final int SPLIT = 2;
+
+        /**
+         * Join another contact after saving
+         */
+        public static final int JOIN = 3;
+    }
+
+    private interface Status {
+        /**
+         * The loader is fetching data
+         */
+        public static final int LOADING = 0;
+
+        /**
+         * Not currently busy. We are waiting for the user to enter data
+         */
+        public static final int EDITING = 1;
+
+        /**
+         * The data is currently being saved. This is used to prevent more auto-saves (they shouldn't
+         * overlap)
+         */
+        public static final int SAVING = 2;
+
+        /**
+         * Prevents any more savings (this is used if Save/Close or Revert was executed by the user)
+         */
+        public static final int CLOSING = 3;
+    }
+
+    private static final int REQUEST_CODE_JOIN = 0;
+    private static final int REQUEST_CODE_CAMERA_WITH_DATA = 1;
+    private static final int REQUEST_CODE_PHOTO_PICKED_WITH_DATA = 2;
+
+    private Bitmap mPhoto = null;
+    private long mRawContactIdRequestingPhoto = -1;
+    private long mRawContactIdRequestingPhotoAfterLoad = -1;
+
+    private final EntityDeltaComparator mComparator = new EntityDeltaComparator();
+
+    private static final int ICON_SIZE = 96;
+
+    private static final File PHOTO_DIR = new File(
+            Environment.getExternalStorageDirectory() + "/DCIM/Camera");
+
+    private Cursor mGroupMetaData;
+
+    /**
+     * A delay in milliseconds used for bringing aggregation suggestions to
+     * the visible part of the screen. The reason this has to be done after
+     * a delay is a race condition with the soft keyboard.  The keyboard
+     * may expand to display its own autocomplete suggestions, which will
+     * reduce the visible area of the screen.  We will yield to the keyboard
+     * hoping that the delay is sufficient.  If not - part of the
+     * suggestion will be hidden, which is not fatal.
+     */
+    private static final int AGGREGATION_SUGGESTION_SCROLL_DELAY = 200;
+
+    private File mCurrentPhotoFile;
+
+    private Context mContext;
+    private String mAction;
+    private Uri mLookupUri;
+    private String mMimeType;
+    private Bundle mIntentExtras;
+    private Listener mListener;
+
+    private String mQuerySelection;
+
+    private long mContactIdForJoin;
+
+    private LinearLayout mContent;
+    private EntityDeltaList mState;
+
+    private ViewIdGenerator mViewIdGenerator;
+
+    private long mLoaderStartTime;
+
+    private int mStatus;
+
+    private AggregationSuggestionEngine mAggregationSuggestionEngine;
+    private long mAggregationSuggestionsRawContactId;
+    private View mAggregationSuggestionView;
+
+    public ContactEditorFragment() {
+    }
+
+    @Override
+    public void onAttach(Activity activity) {
+        super.onAttach(activity);
+        mContext = activity;
+    }
+
+    @Override
+    public void onStop() {
+        super.onStop();
+        if (mAggregationSuggestionEngine != null) {
+            mAggregationSuggestionEngine.quit();
+        }
+        // If anything was left unsaved, save it now but keep the editor open.
+        if (!getActivity().isChangingConfigurations() && mStatus == Status.EDITING) {
+            save(false);
+        }
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
+        final View view = inflater.inflate(R.layout.contact_editor_fragment, container, false);
+
+        mContent = (LinearLayout) view.findViewById(R.id.editors);
+
+        setHasOptionsMenu(true);
+
+        // If we are in an orientation change, we already have mState (it was loaded by onCreate)
+        if (mState != null) {
+            bindEditors();
+        }
+
+        return view;
+    }
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+
+        Log.d(TAG, "onActivityCreated(" + savedInstanceState + ")");
+
+        // Handle initial actions only when existing state missing
+        final boolean hasIncomingState = savedInstanceState != null;
+
+        if (!hasIncomingState) {
+            if (Intent.ACTION_EDIT.equals(mAction)) {
+                if (mListener != null) mListener.setTitleTo(R.string.editContact_title_edit);
+                getLoaderManager().initLoader(LOADER_DATA, null, mDataLoaderListener);
+            } else if (Intent.ACTION_INSERT.equals(mAction)) {
+                if (mListener != null) mListener.setTitleTo(R.string.editContact_title_insert);
+
+                final Account account = mIntentExtras == null ? null :
+                    (Account) mIntentExtras.getParcelable(Intents.Insert.ACCOUNT);
+
+                if (account != null) {
+                    // Account specified in Intent
+                    createContact(account, true);
+                } else {
+                    // No Account specified. Let the user choose
+                    doAddAction(true);
+                }
+            } else throw new IllegalArgumentException("Unknown Action String " + mAction +
+                    ". Only support " + Intent.ACTION_EDIT + " or " + Intent.ACTION_INSERT);
+        }
+    }
+
+    @Override
+    public void onStart() {
+        getLoaderManager().initLoader(LOADER_GROUPS, null, mGroupLoaderListener);
+        super.onStart();
+    }
+
+    public void load(String action, Uri lookupUri, String mimeType, Bundle intentExtras) {
+        mAction = action;
+        mLookupUri = lookupUri;
+        mMimeType = mimeType;
+        mIntentExtras = intentExtras;
+    }
+
+    public void setListener(Listener value) {
+        mListener = value;
+    }
+
+    @Override
+    public void onCreate(Bundle savedState) {
+        if (savedState != null) {
+            // Restore mUri before calling super.onCreate so that onInitializeLoaders
+            // would already have a uri and an action to work with
+            mLookupUri = savedState.getParcelable(KEY_URI);
+            mAction = savedState.getString(KEY_ACTION);
+        }
+
+        super.onCreate(savedState);
+
+        if (savedState == null) {
+            // If savedState is non-null, onRestoreInstanceState() will restore the generator.
+            mViewIdGenerator = new ViewIdGenerator();
+        } else {
+            // Read state from savedState. No loading involved here
+            mState = savedState.<EntityDeltaList> getParcelable(KEY_EDIT_STATE);
+            mRawContactIdRequestingPhoto = savedState.getLong(
+                    KEY_RAW_CONTACT_ID_REQUESTING_PHOTO);
+            mViewIdGenerator = savedState.getParcelable(KEY_VIEW_ID_GENERATOR);
+            String fileName = savedState.getString(KEY_CURRENT_PHOTO_FILE);
+            if (fileName != null) {
+                mCurrentPhotoFile = new File(fileName);
+            }
+            mQuerySelection = savedState.getString(KEY_QUERY_SELECTION);
+            mContactIdForJoin = savedState.getLong(KEY_CONTACT_ID_FOR_JOIN);
+            mAggregationSuggestionsRawContactId = savedState.getLong(KEY_SHOW_JOIN_SUGGESTIONS);
+            mStatus = Status.EDITING;
+        }
+    }
+
+    public void setData(ContactLoader.Result data) {
+        // If we have already loaded data, we do not want to change it here to not confuse the user
+        if (mState != null) {
+            Log.v(TAG, "Ignoring background change. This will have to be rebased later");
+            return;
+        }
+
+        // Build Filter mQuerySelection
+        final ArrayList<Entity> entities = data.getEntities();
+        final StringBuilder sb = new StringBuilder(RawContacts._ID + " IN(");
+        final int count = entities.size();
+        for (int i = 0; i < count; i++) {
+            if (i > 0) {
+                sb.append(',');
+            }
+            sb.append(entities.get(i).getEntityValues().get(RawContacts._ID));
+        }
+        sb.append(")");
+        mQuerySelection = sb.toString();
+        mState = EntityDeltaList.fromIterator(entities.iterator());
+
+        // Merge in Extras from Intent
+        if (mIntentExtras != null && mIntentExtras.size() > 0) {
+            final AccountTypes sources = AccountTypes.getInstance(mContext);
+            for (EntityDelta state : mState) {
+                final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
+                final BaseAccountType source = sources.getInflatedSource(accountType,
+                        BaseAccountType.LEVEL_CONSTRAINTS);
+                if (!source.readOnly) {
+                    // Apply extras to the first writable raw contact only
+                    EntityModifier.parseExtras(mContext, source, state, mIntentExtras);
+                    mIntentExtras = null;
+                    break;
+                }
+            }
+        }
+
+        bindEditors();
+    }
+
+    private void selectAccountAndCreateContact(boolean isNewContact) {
+        final ArrayList<Account> accounts = AccountTypes.getInstance(mContext).getAccounts(true);
+        // No Accounts available.  Create a phone-local contact.
+        if (accounts.isEmpty()) {
+            createContact(null, isNewContact);
+            return;  // Don't show a dialog.
+        }
+
+        // In the common case of a single account being writable, auto-select
+        // it without showing a dialog.
+        if (accounts.size() == 1) {
+            createContact(accounts.get(0), isNewContact);
+            return;  // Don't show a dialog.
+        }
+
+        final SelectAccountDialogFragment dialog = new SelectAccountDialogFragment(isNewContact);
+        dialog.setTargetFragment(this, 0);
+        dialog.show(getFragmentManager(), SelectAccountDialogFragment.TAG);
+    }
+
+    /**
+     * @param account may be null to signal a device-local contact should
+     *     be created.
+     * @param prefillFromIntent If this is set, the intent extras will be used to prefill the fields
+     */
+    private void createContact(Account account, boolean prefillFromIntent) {
+        final AccountTypes sources = AccountTypes.getInstance(mContext);
+        final ContentValues values = new ContentValues();
+        if (account != null) {
+            values.put(RawContacts.ACCOUNT_NAME, account.name);
+            values.put(RawContacts.ACCOUNT_TYPE, account.type);
+        } else {
+            values.putNull(RawContacts.ACCOUNT_NAME);
+            values.putNull(RawContacts.ACCOUNT_TYPE);
+        }
+
+        // Parse any values from incoming intent
+        EntityDelta insert = new EntityDelta(ValuesDelta.fromAfter(values));
+        final BaseAccountType source = sources.getInflatedSource(
+                account != null ? account.type : null,
+                BaseAccountType.LEVEL_CONSTRAINTS);
+        EntityModifier.parseExtras(mContext, source, insert,
+                prefillFromIntent ? mIntentExtras : null);
+
+        // Ensure we have some default fields
+        EntityModifier.ensureKindExists(insert, source, Phone.CONTENT_ITEM_TYPE);
+        EntityModifier.ensureKindExists(insert, source, Email.CONTENT_ITEM_TYPE);
+
+        if (mState == null) {
+            // Create state if none exists yet
+            mState = EntityDeltaList.fromSingle(insert);
+        } else {
+            // Add contact onto end of existing state
+            mState.add(insert);
+        }
+
+        bindEditors();
+    }
+
+    private void bindEditors() {
+        // Sort the editors
+        Collections.sort(mState, mComparator);
+
+        // Remove any existing editors and rebuild any visible
+        mContent.removeAllViews();
+
+        final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
+                Context.LAYOUT_INFLATER_SERVICE);
+        final AccountTypes sources = AccountTypes.getInstance(mContext);
+        int size = mState.size();
+        for (int i = 0; i < size; i++) {
+            // TODO ensure proper ordering of entities in the list
+            final EntityDelta entity = mState.get(i);
+            final ValuesDelta values = entity.getValues();
+            if (!values.isVisible()) continue;
+
+            final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
+            final BaseAccountType source = sources.getInflatedSource(accountType,
+                    BaseAccountType.LEVEL_CONSTRAINTS);
+            final long rawContactId = values.getAsLong(RawContacts._ID);
+
+            final BaseRawContactEditorView editor;
+            if (!source.readOnly) {
+                editor = (BaseRawContactEditorView) inflater.inflate(R.layout.item_contact_editor,
+                        mContent, false);
+            } else {
+                editor = (BaseRawContactEditorView) inflater.inflate(
+                        R.layout.item_read_only_contact_editor, mContent, false);
+            }
+            final PhotoEditorView photoEditor = editor.getPhotoEditor();
+            final boolean sourceReadOnly = source.readOnly;
+            photoEditor.setEditorListener(new EditorListener() {
+                @Override
+                public void onRequest(int request) {
+                    if (!hasValidState()) return;
+
+                    if (request == EditorListener.REQUEST_PICK_PHOTO) {
+                        if (editor.hasSetPhoto()) {
+                            // There is an existing photo, offer to remove, replace, or promote to
+                            // primary
+                            final ModifyPhotoDialogFragment fragment =
+                                    new ModifyPhotoDialogFragment(sourceReadOnly, rawContactId);
+                            fragment.setTargetFragment(ContactEditorFragment.this, 0);
+                            fragment.show(getFragmentManager(), ModifyPhotoDialogFragment.TAG);
+                        } else if (!sourceReadOnly) {
+                            // No photo set and not read-only, try to set the photo
+                            doPickPhotoAction(rawContactId);
+                        }
+                    }
+                }
+
+                @Override
+                public void onDeleted(Editor removedEditor) {
+                }
+            });
+
+            mContent.addView(editor);
+            editor.setState(entity, source, mViewIdGenerator);
+
+            if (editor instanceof RawContactEditorView) {
+                final RawContactEditorView rawContactEditor = (RawContactEditorView) editor;
+                final FieldEditorView nameEditor = rawContactEditor.getNameEditor();
+                nameEditor.setEditorListener(new EditorListener() {
+
+                    @Override
+                    public void onRequest(int request) {
+                        onContactNameChange(request, rawContactEditor, nameEditor);
+                    }
+
+                    @Override
+                    public void onDeleted(Editor removedEditor) {
+                    }
+                });
+
+                if (rawContactId == mAggregationSuggestionsRawContactId) {
+                    acquireAggregationSuggestions(rawContactEditor);
+                }
+            }
+        }
+
+        bindGroupMetaData();
+
+        // Show editor now that we've loaded state
+        mContent.setVisibility(View.VISIBLE);
+
+        // Refresh Action Bar as the visibility of the join command
+        // Activity can be null if we have been detached from the Activity
+        final Activity activity = getActivity();
+        if (activity != null) activity.invalidateOptionsMenu();
+    }
+
+    private void bindGroupMetaData() {
+        if (mGroupMetaData == null) {
+            return;
+        }
+
+        int editorCount = mContent.getChildCount();
+        for (int i = 0; i < editorCount; i++) {
+            BaseRawContactEditorView editor = (BaseRawContactEditorView) mContent.getChildAt(i);
+            editor.setGroupMetaData(mGroupMetaData);
+        }
+    }
+
+    @Override
+    public void onCreateOptionsMenu(Menu menu, final MenuInflater inflater) {
+        inflater.inflate(R.menu.edit, menu);
+    }
+
+    @Override
+    public void onPrepareOptionsMenu(Menu menu) {
+        menu.findItem(R.id.menu_split).setVisible(mState != null && mState.size() > 1);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.menu_done:
+                return doSaveAction(SaveMode.CLOSE);
+            case R.id.menu_discard:
+                return doRevertAction();
+            case R.id.menu_add_raw_contact:
+                return doAddAction(false);
+            case R.id.menu_delete:
+                return doDeleteAction();
+            case R.id.menu_split:
+                return doSplitContactAction();
+            case R.id.menu_join:
+                return doJoinContactAction();
+        }
+        return false;
+    }
+
+    private boolean doAddAction(boolean isNewContact) {
+        // Load Accounts async so that we can present them
+        selectAccountAndCreateContact(isNewContact);
+
+        return true;
+    }
+
+    /**
+     * Delete the entire contact currently being edited, which usually asks for
+     * user confirmation before continuing.
+     */
+    private boolean doDeleteAction() {
+        if (!hasValidState())
+            return false;
+
+        // TODO: Make sure Insert turns into Edit if/once it is autosaved
+        if (Intent.ACTION_INSERT.equals(mAction)) {
+            if (mListener != null) mListener.onReverted();
+        } else {
+            if (mListener != null) mListener.onDeleteRequested(mLookupUri);
+        }
+        return true;
+    }
+
+    /**
+     * Pick a specific photo to be added under the currently selected tab.
+     */
+    /* package */ boolean doPickPhotoAction(long rawContactId) {
+        if (!hasValidState()) return false;
+
+        mRawContactIdRequestingPhoto = rawContactId;
+        final PickPhotoDialogFragment dialogFragment = new PickPhotoDialogFragment();
+        dialogFragment.setTargetFragment(this, 0);
+        dialogFragment.show(getFragmentManager(), PickPhotoDialogFragment.TAG);
+
+        return true;
+    }
+
+    private boolean doSplitContactAction() {
+        if (!hasValidState()) return false;
+
+        final SplitContactConfirmationDialogFragment dialog =
+                new SplitContactConfirmationDialogFragment();
+        dialog.setTargetFragment(this, 0);
+        dialog.show(getFragmentManager(), SplitContactConfirmationDialogFragment.TAG);
+        return true;
+    }
+
+    private boolean doJoinContactAction() {
+        return doSaveAction(SaveMode.JOIN);
+    }
+
+    /**
+     * Constructs an intent for picking a photo from Gallery, cropping it and returning the bitmap.
+     */
+    public static Intent getPhotoPickIntent() {
+        Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
+        intent.setType("image/*");
+        intent.putExtra("crop", "true");
+        intent.putExtra("aspectX", 1);
+        intent.putExtra("aspectY", 1);
+        intent.putExtra("outputX", ICON_SIZE);
+        intent.putExtra("outputY", ICON_SIZE);
+        intent.putExtra("return-data", true);
+        return intent;
+    }
+
+    /**
+     * Check if our internal {@link #mState} is valid, usually checked before
+     * performing user actions.
+     */
+    private boolean hasValidState() {
+        return mState != null && mState.size() > 0;
+    }
+
+    /**
+     * Create a file name for the icon photo using current time.
+     */
+    private String getPhotoFileName() {
+        Date date = new Date(System.currentTimeMillis());
+        SimpleDateFormat dateFormat = new SimpleDateFormat("'IMG'_yyyyMMdd_HHmmss");
+        return dateFormat.format(date) + ".jpg";
+    }
+
+    /**
+     * Constructs an intent for capturing a photo and storing it in a temporary file.
+     */
+    public static Intent getTakePickIntent(File f) {
+        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);
+        intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
+        return intent;
+    }
+
+    /**
+     * Sends a newly acquired photo to Gallery for cropping
+     */
+    protected void doCropPhoto(File f) {
+        try {
+            // Add the image to the media store
+            MediaScannerConnection.scanFile(
+                    mContext,
+                    new String[] { f.getAbsolutePath() },
+                    new String[] { null },
+                    null);
+
+            // Launch gallery to crop the photo
+            final Intent intent = getCropImageIntent(Uri.fromFile(f));
+            startActivityForResult(intent, REQUEST_CODE_PHOTO_PICKED_WITH_DATA);
+        } catch (Exception e) {
+            Log.e(TAG, "Cannot crop image", e);
+            Toast.makeText(mContext, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
+        }
+    }
+
+    /**
+     * Constructs an intent for image cropping.
+     */
+    public static Intent getCropImageIntent(Uri photoUri) {
+        Intent intent = new Intent("com.android.camera.action.CROP");
+        intent.setDataAndType(photoUri, "image/*");
+        intent.putExtra("crop", "true");
+        intent.putExtra("aspectX", 1);
+        intent.putExtra("aspectY", 1);
+        intent.putExtra("outputX", ICON_SIZE);
+        intent.putExtra("outputY", ICON_SIZE);
+        intent.putExtra("return-data", true);
+        return intent;
+    }
+
+    /**
+     * Saves or creates the contact based on the mode, and if successful
+     * finishes the activity.
+     */
+    private boolean doSaveAction(int saveMode) {
+        if (!hasValidState()) {
+            return false;
+        }
+
+        // If we are about to close the editor - there is no need to refresh the data
+        if (saveMode == SaveMode.CLOSE) {
+            getLoaderManager().stopLoader(LOADER_DATA);
+        }
+
+        mStatus = Status.SAVING;
+
+        // Trim any empty fields, and RawContacts, before persisting
+        final AccountTypes sources = AccountTypes.getInstance(mContext);
+        EntityModifier.trimEmpty(mState, sources);
+
+        if (mState.buildDiff().isEmpty()) {
+            onSaveCompleted(true, saveMode, mLookupUri);
+            return true;
+        }
+
+        final PersistTask task = new PersistTask(this, saveMode);
+        task.execute(mState);
+
+        return true;
+    }
+
+    /**
+     * Asynchronously saves the changes made by the user. This can be called even if nothing
+     * has changed
+     */
+    public void save(boolean closeAfterSave) {
+        doSaveAction(closeAfterSave ? SaveMode.CLOSE : SaveMode.RELOAD);
+    }
+
+    private boolean doRevertAction() {
+        // When this Fragment is closed we don't want it to auto-save
+        mStatus = Status.CLOSING;
+        if (mListener != null) mListener.onReverted();
+
+        return true;
+    }
+
+    private void onSaveCompleted(boolean success, int saveMode, Uri contactLookupUri) {
+        Log.d(TAG, "onSaveCompleted(" + success + ", " + saveMode + ", " + contactLookupUri);
+        switch (saveMode) {
+            case SaveMode.CLOSE:
+                final Intent resultIntent;
+                final int resultCode;
+                if (success && contactLookupUri != null) {
+                    final String requestAuthority =
+                            mLookupUri == null ? null : mLookupUri.getAuthority();
+
+                    final String legacyAuthority = "contacts";
+
+                    resultIntent = new Intent();
+                    if (legacyAuthority.equals(requestAuthority)) {
+                        // Build legacy Uri when requested by caller
+                        final long contactId = ContentUris.parseId(Contacts.lookupContact(
+                                mContext.getContentResolver(), contactLookupUri));
+                        final Uri legacyContentUri = Uri.parse("content://contacts/people");
+                        final Uri legacyUri = ContentUris.withAppendedId(
+                                legacyContentUri, contactId);
+                        resultIntent.setData(legacyUri);
+                    } else {
+                        // Otherwise pass back a lookup-style Uri
+                        resultIntent.setData(contactLookupUri);
+                    }
+
+                    resultCode = Activity.RESULT_OK;
+                } else {
+                    resultCode = Activity.RESULT_CANCELED;
+                    resultIntent = null;
+                }
+                // It is already saved, so prevent that it is saved again
+                mStatus = Status.CLOSING;
+                if (mListener != null) mListener.onSaveFinished(resultCode, resultIntent);
+                break;
+            case SaveMode.RELOAD:
+                if (success && contactLookupUri != null) {
+                    // If this was in INSERT, we are changing into an EDIT now.
+                    // If it already was an EDIT, we are changing to the new Uri now
+                    mState = null;
+                    load(Intent.ACTION_EDIT, contactLookupUri, mMimeType, null);
+                    mStatus = Status.LOADING;
+                    getLoaderManager().restartLoader(LOADER_DATA, null, mDataLoaderListener);
+                }
+                break;
+            case SaveMode.SPLIT:
+                if (mListener != null) {
+                    mListener.onContactSplit(contactLookupUri);
+                } else {
+                    Log.d(TAG, "No listener registered, can not call onSplitFinished");
+                }
+                mStatus = Status.EDITING;
+                break;
+
+            case SaveMode.JOIN:
+                if (success) {
+                    showJoinAggregateActivity(contactLookupUri);
+                }
+                mStatus = Status.EDITING;
+                break;
+        }
+    }
+
+    /**
+     * Shows a list of aggregates that can be joined into the currently viewed aggregate.
+     *
+     * @param contactLookupUri the fresh URI for the currently edited contact (after saving it)
+     */
+    private void showJoinAggregateActivity(Uri contactLookupUri) {
+        if (contactLookupUri == null) {
+            return;
+        }
+
+        mContactIdForJoin = ContentUris.parseId(contactLookupUri);
+        final Intent intent = new Intent(JoinContactActivity.JOIN_CONTACT);
+        intent.putExtra(JoinContactActivity.EXTRA_TARGET_CONTACT_ID, mContactIdForJoin);
+        startActivityForResult(intent, REQUEST_CODE_JOIN);
+    }
+
+    private interface JoinContactQuery {
+        String[] PROJECTION = {
+                RawContacts._ID,
+                RawContacts.CONTACT_ID,
+                RawContacts.NAME_VERIFIED,
+        };
+
+        String SELECTION = RawContacts.CONTACT_ID + "=? OR " + RawContacts.CONTACT_ID + "=?";
+
+        int _ID = 0;
+        int CONTACT_ID = 1;
+        int NAME_VERIFIED = 2;
+    }
+
+    /**
+     * Performs aggregation with the contact selected by the user from suggestions or A-Z list.
+     */
+    private void joinAggregate(final long contactId) {
+        final ContentResolver resolver = mContext.getContentResolver();
+
+        // Load raw contact IDs for all raw contacts involved - currently edited and selected
+        // in the join UIs
+        Cursor c = resolver.query(RawContacts.CONTENT_URI,
+                JoinContactQuery.PROJECTION,
+                JoinContactQuery.SELECTION,
+                new String[]{String.valueOf(contactId), String.valueOf(mContactIdForJoin)}, null);
+
+        long rawContactIds[];
+        long verifiedNameRawContactId = -1;
+        try {
+            rawContactIds = new long[c.getCount()];
+            for (int i = 0; i < rawContactIds.length; i++) {
+                c.moveToNext();
+                long rawContactId = c.getLong(JoinContactQuery._ID);
+                rawContactIds[i] = rawContactId;
+                if (c.getLong(JoinContactQuery.CONTACT_ID) == mContactIdForJoin) {
+                    if (verifiedNameRawContactId == -1
+                            || c.getInt(JoinContactQuery.NAME_VERIFIED) != 0) {
+                        verifiedNameRawContactId = rawContactId;
+                    }
+                }
+            }
+        } finally {
+            c.close();
+        }
+
+        // For each pair of raw contacts, insert an aggregation exception
+        ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
+        for (int i = 0; i < rawContactIds.length; i++) {
+            for (int j = 0; j < rawContactIds.length; j++) {
+                if (i != j) {
+                    buildJoinContactDiff(operations, rawContactIds[i], rawContactIds[j]);
+                }
+            }
+        }
+
+        // Mark the original contact as "name verified" to make sure that the contact
+        // display name does not change as a result of the join
+        Builder builder = ContentProviderOperation.newUpdate(
+                    ContentUris.withAppendedId(RawContacts.CONTENT_URI, verifiedNameRawContactId));
+        builder.withValue(RawContacts.NAME_VERIFIED, 1);
+        operations.add(builder.build());
+
+        boolean success = false;
+        // Apply all aggregation exceptions as one batch
+        try {
+            resolver.applyBatch(ContactsContract.AUTHORITY, operations);
+            Toast.makeText(mContext, R.string.contactsJoinedMessage, Toast.LENGTH_LONG).show();
+            success = true;
+        } catch (RemoteException e) {
+            Log.e(TAG, "Failed to apply aggregation exception batch", e);
+            Toast.makeText(mContext, R.string.contactSavedErrorToast, Toast.LENGTH_LONG).show();
+        } catch (OperationApplicationException e) {
+            Log.e(TAG, "Failed to apply aggregation exception batch", e);
+            Toast.makeText(mContext, R.string.contactSavedErrorToast, Toast.LENGTH_LONG).show();
+        }
+
+        if (success) {
+            onSaveCompleted(true, SaveMode.RELOAD, mLookupUri);
+        }
+    }
+
+    /**
+     * Construct a {@link AggregationExceptions#TYPE_KEEP_TOGETHER} ContentProviderOperation.
+     */
+    private void buildJoinContactDiff(ArrayList<ContentProviderOperation> operations,
+            long rawContactId1, long rawContactId2) {
+        Builder builder =
+                ContentProviderOperation.newUpdate(AggregationExceptions.CONTENT_URI);
+        builder.withValue(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_TOGETHER);
+        builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, rawContactId1);
+        builder.withValue(AggregationExceptions.RAW_CONTACT_ID2, rawContactId2);
+        operations.add(builder.build());
+    }
+
+    public static interface Listener {
+        /**
+         * Contact was not found, so somehow close this fragment. This is raised after a contact
+         * is removed via Menu/Delete (unless it was a new contact)
+         */
+        void onContactNotFound();
+
+        /**
+         * Contact was split, so we can close now.
+         * @param newLookupUri The lookup uri of the new contact that should be shown to the user.
+         * The editor tries best to chose the most natural contact here.
+         */
+        void onContactSplit(Uri newLookupUri);
+
+        /**
+         * User was presented with an account selection and couldn't decide.
+         */
+        void onAccountSelectorAborted();
+
+        /**
+         * User has tapped Revert, close the fragment now.
+         */
+        void onReverted();
+
+        /**
+         * Set the Title (e.g. of the Activity)
+         */
+        void setTitleTo(int resourceId);
+
+        /**
+         * Contact was saved and the Fragment can now be closed safely.
+         */
+        void onSaveFinished(int resultCode, Intent resultIntent);
+
+        /**
+         * User decided to delete the contact.
+         */
+        void onDeleteRequested(Uri lookupUri);
+
+        /**
+         * User switched to editing a different contact (a suggestion from the
+         * aggregation engine).
+         */
+        void onEditOtherContactRequested(
+                Uri contactLookupUri, ArrayList<ContentValues> contentValues);
+    }
+
+    private class EntityDeltaComparator implements Comparator<EntityDelta> {
+        /**
+         * Compare EntityDeltas for sorting the stack of editors.
+         */
+        @Override
+        public int compare(EntityDelta one, EntityDelta two) {
+            // Check direct equality
+            if (one.equals(two)) {
+                return 0;
+            }
+
+            final AccountTypes sources = AccountTypes.getInstance(mContext);
+            String accountType = one.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
+            final BaseAccountType oneSource = sources.getInflatedSource(accountType,
+                    BaseAccountType.LEVEL_SUMMARY);
+            accountType = two.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
+            final BaseAccountType twoSource = sources.getInflatedSource(accountType,
+                    BaseAccountType.LEVEL_SUMMARY);
+
+            // Check read-only
+            if (oneSource.readOnly && !twoSource.readOnly) {
+                return 1;
+            } else if (twoSource.readOnly && !oneSource.readOnly) {
+                return -1;
+            }
+
+            // Check account type
+            boolean skipAccountTypeCheck = false;
+            boolean oneIsGoogle = oneSource instanceof GoogleAccountType;
+            boolean twoIsGoogle = twoSource instanceof GoogleAccountType;
+            if (oneIsGoogle && !twoIsGoogle) {
+                return -1;
+            } else if (twoIsGoogle && !oneIsGoogle) {
+                return 1;
+            } else if (oneIsGoogle && twoIsGoogle){
+                skipAccountTypeCheck = true;
+            }
+
+            int value;
+            if (!skipAccountTypeCheck) {
+                if (oneSource.accountType == null) {
+                    return 1;
+                }
+                value = oneSource.accountType.compareTo(twoSource.accountType);
+                if (value != 0) {
+                    return value;
+                }
+            }
+
+            // Check account name
+            ValuesDelta oneValues = one.getValues();
+            String oneAccount = oneValues.getAsString(RawContacts.ACCOUNT_NAME);
+            if (oneAccount == null) oneAccount = "";
+            ValuesDelta twoValues = two.getValues();
+            String twoAccount = twoValues.getAsString(RawContacts.ACCOUNT_NAME);
+            if (twoAccount == null) twoAccount = "";
+            value = oneAccount.compareTo(twoAccount);
+            if (value != 0) {
+                return value;
+            }
+
+            // Both are in the same account, fall back to contact ID
+            Long oneId = oneValues.getAsLong(RawContacts._ID);
+            Long twoId = twoValues.getAsLong(RawContacts._ID);
+            if (oneId == null) {
+                return -1;
+            } else if (twoId == null) {
+                return 1;
+            }
+
+            return (int)(oneId - twoId);
+        }
+    }
+
+    /**
+     * Returns the contact ID for the currently edited contact or 0 if the contact is new.
+     */
+    protected long getContactId() {
+        for (EntityDelta rawContact : mState) {
+            Long contactId = rawContact.getValues().getAsLong(RawContacts.CONTACT_ID);
+            if (contactId != null) {
+                return contactId;
+            }
+        }
+        return 0;
+    }
+
+
+    private void onContactNameChange(int request, final RawContactEditorView rawContactEditor,
+            FieldEditorView nameEditor) {
+
+        switch (request) {
+            case EditorListener.EDITOR_FORM_CHANGED:
+                if (nameEditor.hasShortAndLongForms()) {
+                    if (nameEditor.areOptionalFieldsVisible()) {
+                        switchFromFullNameToStructuredName(nameEditor);
+                    } else {
+                        switchFromStructuredNameToFullName(nameEditor);
+                    }
+                }
+                break;
+
+            case EditorListener.FIELD_CHANGED:
+                if (nameEditor.hasShortAndLongForms()) {
+                    if (nameEditor.areOptionalFieldsVisible()) {
+                        eraseFullName(nameEditor.getValues());
+                    } else {
+                        eraseStructuredName(nameEditor.getValues());
+                    }
+                }
+                acquireAggregationSuggestions(rawContactEditor);
+                break;
+        }
+    }
+
+    private void switchFromFullNameToStructuredName(FieldEditorView nameEditor) {
+        ValuesDelta values = nameEditor.getValues();
+
+        String displayName = values.getAsString(StructuredName.DISPLAY_NAME);
+        if (displayName == null) {
+            displayName = "";
+        }
+
+        Uri uri = ContactsContract.AUTHORITY_URI.buildUpon().appendPath("complete_name")
+                .appendQueryParameter(StructuredName.DISPLAY_NAME, displayName).build();
+        Cursor cursor = getActivity().getContentResolver().query(uri, new String[]{
+                StructuredName.PREFIX,
+                StructuredName.GIVEN_NAME,
+                StructuredName.MIDDLE_NAME,
+                StructuredName.FAMILY_NAME,
+                StructuredName.SUFFIX,
+        }, null, null, null);
+
+        try {
+            if (cursor.moveToFirst()) {
+                eraseFullName(values);
+                values.put(StructuredName.PREFIX, cursor.getString(0));
+                values.put(StructuredName.GIVEN_NAME, cursor.getString(1));
+                values.put(StructuredName.MIDDLE_NAME, cursor.getString(2));
+                values.put(StructuredName.FAMILY_NAME, cursor.getString(3));
+                values.put(StructuredName.SUFFIX, cursor.getString(4));
+            }
+        } finally {
+            cursor.close();
+        }
+    }
+
+    private void switchFromStructuredNameToFullName(FieldEditorView nameEditor) {
+        ValuesDelta values = nameEditor.getValues();
+
+        Uri.Builder builder = ContactsContract.AUTHORITY_URI.buildUpon().appendPath(
+                "complete_name");
+        appendQueryParameter(builder, values, StructuredName.PREFIX);
+        appendQueryParameter(builder, values, StructuredName.GIVEN_NAME);
+        appendQueryParameter(builder, values, StructuredName.MIDDLE_NAME);
+        appendQueryParameter(builder, values, StructuredName.FAMILY_NAME);
+        appendQueryParameter(builder, values, StructuredName.SUFFIX);
+        Uri uri = builder.build();
+        Cursor cursor = getActivity().getContentResolver().query(uri, new String[]{
+                StructuredName.DISPLAY_NAME,
+        }, null, null, null);
+
+        try {
+            if (cursor.moveToFirst()) {
+                eraseStructuredName(values);
+                values.put(StructuredName.DISPLAY_NAME, cursor.getString(0));
+            }
+        } finally {
+            cursor.close();
+        }
+    }
+
+    private void eraseFullName(ValuesDelta values) {
+        values.putNull(StructuredName.DISPLAY_NAME);
+    }
+
+    private void eraseStructuredName(ValuesDelta values) {
+        values.putNull(StructuredName.PREFIX);
+        values.putNull(StructuredName.GIVEN_NAME);
+        values.putNull(StructuredName.MIDDLE_NAME);
+        values.putNull(StructuredName.FAMILY_NAME);
+        values.putNull(StructuredName.SUFFIX);
+    }
+
+    private void appendQueryParameter(Uri.Builder builder, ValuesDelta values, String field) {
+        String value = values.getAsString(field);
+        if (!TextUtils.isEmpty(value)) {
+            builder.appendQueryParameter(field, value);
+        }
+    }
+
+    /**
+     * Triggers an asynchronous search for aggregation suggestions.
+     */
+    public void acquireAggregationSuggestions(RawContactEditorView rawContactEditor) {
+        long rawContactId = rawContactEditor.getRawContactId();
+        if (mAggregationSuggestionsRawContactId != rawContactId
+                && mAggregationSuggestionView != null) {
+            mAggregationSuggestionView.setVisibility(View.GONE);
+            mAggregationSuggestionView = null;
+            mAggregationSuggestionEngine.reset();
+        }
+
+        mAggregationSuggestionsRawContactId = rawContactId;
+
+        if (mAggregationSuggestionEngine == null) {
+            mAggregationSuggestionEngine = new AggregationSuggestionEngine(getActivity());
+            mAggregationSuggestionEngine.setListener(this);
+            mAggregationSuggestionEngine.start();
+        }
+
+        mAggregationSuggestionEngine.setContactId(getContactId());
+
+        FieldEditorView nameEditor = rawContactEditor.getNameEditor();
+        mAggregationSuggestionEngine.onNameChange(nameEditor.getValues());
+    }
+
+    @Override
+    public void onAggregationSuggestionChange() {
+        View rawContactView = getContactEditorView(mAggregationSuggestionsRawContactId);
+        if (rawContactView == null) {
+            return;
+        }
+
+        ViewStub stub = (ViewStub)rawContactView.findViewById(R.id.aggregation_suggestion_stub);
+        if (stub != null) {
+            stub.inflate();
+        }
+
+        // Only request the view on screen when it is first displayed
+        boolean requestOnScreen = mAggregationSuggestionView == null;
+        mAggregationSuggestionView = rawContactView.findViewById(R.id.aggregation_suggestion);
+
+        int count = mAggregationSuggestionEngine.getSuggestedContactCount();
+        if (count == 0) {
+            mAggregationSuggestionView.setVisibility(View.GONE);
+            return;
+        }
+
+        List<Suggestion> suggestions = mAggregationSuggestionEngine.getSuggestions();
+
+        TextView title = (TextView) mAggregationSuggestionView.findViewById(
+                R.id.aggregation_suggestion_title);
+        title.setText(getActivity().getResources().getQuantityString(
+                R.plurals.aggregation_suggestion_title, count));
+
+        LinearLayout itemList = (LinearLayout) mAggregationSuggestionView.findViewById(
+                R.id.aggregation_suggestions);
+        itemList.removeAllViews();
+
+        LayoutInflater inflater = getActivity().getLayoutInflater();
+
+        for (Suggestion suggestion : suggestions) {
+            AggregationSuggestionView suggestionView =
+                    (AggregationSuggestionView) inflater.inflate(
+                            R.layout.aggregation_suggestions_item, null);
+            suggestionView.setLayoutParams(
+                    new LinearLayout.LayoutParams(
+                            LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
+            suggestionView.setNewContact(mState.size() == 1 && mState.get(0).isContactInsert());
+            suggestionView.setListener(new AggregationSuggestionView.Listener() {
+
+                @Override
+                public void onJoinAction(long contactId, List<Long> rawContactIds) {
+                    mState.setJoinWithRawContacts(rawContactIds);
+                    // If we are in the edit mode (indicated by a non-zero contact ID),
+                    // join the suggested contact, save all changes, and stay in the editor.
+                    doSaveAction(SaveMode.RELOAD);
+                }
+
+                @Override
+                public void onEditAction(Uri contactLookupUri) {
+                    // Abandon the currently edited contact and switch to editing
+                    // the suggested one, transferring all the data there
+                    if (mListener != null) {
+                        mListener.onEditOtherContactRequested(
+                                contactLookupUri, mState.get(0).getContentValues());
+                    }
+                }
+            });
+            suggestionView.bindSuggestion(suggestion);
+            itemList.addView(suggestionView);
+        }
+
+        mAggregationSuggestionView.setVisibility(View.VISIBLE);
+
+        if (requestOnScreen) {
+            mContent.postDelayed(new Runnable() {
+
+                @Override
+                public void run() {
+                    requestAggregationSuggestionOnScreen(mAggregationSuggestionView);
+                }
+            }, AGGREGATION_SUGGESTION_SCROLL_DELAY);
+        }
+    }
+
+    /**
+     * Scrolls the editor if necessary to reveal the aggregation suggestion that is
+     * shown below the name editor. Makes sure that the currently focused field
+     * remains visible.
+     */
+    private void requestAggregationSuggestionOnScreen(final View view) {
+        Rect rect = getRelativeBounds(mContent, view);
+        View focused = mContent.findFocus();
+        if (focused != null) {
+            rect.union(getRelativeBounds(mContent, focused));
+        }
+        mContent.requestRectangleOnScreen(rect);
+    }
+
+    /**
+     * Computes bounds of the supplied view relative to its ascendant.
+     */
+    private Rect getRelativeBounds(View ascendant, View view) {
+        Rect rect = new Rect();
+        rect.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
+
+        View parent = (View) view.getParent();
+        while (parent != ascendant) {
+            rect.offset(parent.getLeft(), parent.getTop());
+            parent = (View) parent.getParent();
+        }
+        return rect;
+    }
+
+    // TODO: There has to be a nicer way than this WeakAsyncTask...? Maybe call a service?
+    /**
+     * Background task for persisting edited contact data, using the changes
+     * defined by a set of {@link EntityDelta}. This task starts
+     * {@link EmptyService} to make sure the background thread can finish
+     * persisting in cases where the system wants to reclaim our process.
+     */
+    public static class PersistTask extends
+            WeakAsyncTask<EntityDeltaList, Void, Integer, ContactEditorFragment> {
+        private static final int PERSIST_TRIES = 3;
+
+        private static final int RESULT_UNCHANGED = 0;
+        private static final int RESULT_SUCCESS = 1;
+        private static final int RESULT_FAILURE = 2;
+
+        private final Context mContext;
+
+        private WeakReference<ProgressDialog> mProgress;
+
+        private int mSaveMode;
+        private Uri mContactLookupUri = null;
+
+        public PersistTask(ContactEditorFragment target, int saveMode) {
+            super(target);
+            mSaveMode = saveMode;
+            mContext = target.mContext;
+        }
+
+        /** {@inheritDoc} */
+        @Override
+        protected void onPreExecute(ContactEditorFragment target) {
+            mProgress = new WeakReference<ProgressDialog>(ProgressDialog.show(target.getActivity(),
+                    null, target.getActivity().getText(R.string.savingContact)));
+
+            // Before starting this task, start an empty service to protect our
+            // process from being reclaimed by the system.
+            mContext.startService(new Intent(mContext, EmptyService.class));
+        }
+
+        /** {@inheritDoc} */
+        @Override
+        protected Integer doInBackground(ContactEditorFragment target, EntityDeltaList... params) {
+            final ContentResolver resolver = mContext.getContentResolver();
+
+            EntityDeltaList state = params[0];
+
+            // Attempt to persist changes
+            int tries = 0;
+            Integer result = RESULT_FAILURE;
+            while (tries++ < PERSIST_TRIES) {
+                try {
+                    // Build operations and try applying
+                    final ArrayList<ContentProviderOperation> diff = state.buildDiff();
+                    ContentProviderResult[] results = null;
+                    if (!diff.isEmpty()) {
+                        results = resolver.applyBatch(ContactsContract.AUTHORITY, diff);
+                    }
+
+                    final long rawContactId = getRawContactId(state, diff, results);
+                    if (rawContactId != -1) {
+                        final Uri rawContactUri = ContentUris.withAppendedId(
+                                RawContacts.CONTENT_URI, rawContactId);
+
+                        // convert the raw contact URI to a contact URI
+                        mContactLookupUri = RawContacts.getContactLookupUri(resolver,
+                                rawContactUri);
+                        Log.d(TAG, "Looked up RawContact Uri " + rawContactUri +
+                                " into ContactLookupUri " + mContactLookupUri);
+                    } else {
+                        Log.w(TAG, "Could not determine RawContact ID after save");
+                    }
+                    result = (diff.size() > 0) ? RESULT_SUCCESS : RESULT_UNCHANGED;
+                    break;
+
+                } catch (RemoteException e) {
+                    // Something went wrong, bail without success
+                    Log.e(TAG, "Problem persisting user edits", e);
+                    break;
+
+                } catch (OperationApplicationException e) {
+                    // Version consistency failed, re-parent change and try again
+                    Log.w(TAG, "Version consistency failed, re-parenting: " + e.toString());
+                    final EntityDeltaList newState = EntityDeltaList.fromQuery(resolver,
+                            target.mQuerySelection, null, null);
+                    state = EntityDeltaList.mergeAfter(newState, state);
+                }
+            }
+
+            return result;
+        }
+
+        private long getRawContactId(EntityDeltaList state,
+                final ArrayList<ContentProviderOperation> diff,
+                final ContentProviderResult[] results) {
+            long rawContactId = state.findRawContactId();
+            if (rawContactId != -1) {
+                return rawContactId;
+            }
+
+
+            // we gotta do some searching for the id
+            final int diffSize = diff.size();
+            for (int i = 0; i < diffSize; i++) {
+                ContentProviderOperation operation = diff.get(i);
+                if (operation.getType() == ContentProviderOperation.TYPE_INSERT
+                        && operation.getUri().getEncodedPath().contains(
+                                RawContacts.CONTENT_URI.getEncodedPath())) {
+                    return ContentUris.parseId(results[i].uri);
+                }
+            }
+            return -1;
+        }
+
+        /** {@inheritDoc} */
+        @Override
+        protected void onPostExecute(ContactEditorFragment target, Integer result) {
+            Log.d(TAG, "onPostExecute(something," + result + "). mSaveMode=" + mSaveMode);
+            if (result == RESULT_SUCCESS && mSaveMode != SaveMode.JOIN) {
+                Toast.makeText(mContext, R.string.contactSavedToast, Toast.LENGTH_SHORT).show();
+            } else if (result == RESULT_FAILURE) {
+                Toast.makeText(mContext, R.string.contactSavedErrorToast, Toast.LENGTH_LONG).show();
+            }
+
+            final ProgressDialog progress = mProgress.get();
+            if (progress != null && progress.isShowing()) {
+                try {
+                    progress.dismiss();
+                } catch (Exception e) {
+                    // this can happen if our view has already been closed. this can safely be
+                    // ignored
+                }
+            }
+
+            // Stop the service that was protecting us
+            mContext.stopService(new Intent(mContext, EmptyService.class));
+
+            target.onSaveCompleted(result != RESULT_FAILURE, mSaveMode, mContactLookupUri);
+        }
+    }
+
+    @Override
+    public void onSaveInstanceState(Bundle outState) {
+        outState.putParcelable(KEY_URI, mLookupUri);
+        outState.putString(KEY_ACTION, mAction);
+
+        if (hasValidState()) {
+            // Store entities with modifications
+            outState.putParcelable(KEY_EDIT_STATE, mState);
+        }
+
+        outState.putLong(KEY_RAW_CONTACT_ID_REQUESTING_PHOTO, mRawContactIdRequestingPhoto);
+        outState.putParcelable(KEY_VIEW_ID_GENERATOR, mViewIdGenerator);
+        if (mCurrentPhotoFile != null) {
+            outState.putString(KEY_CURRENT_PHOTO_FILE, mCurrentPhotoFile.toString());
+        }
+        outState.putString(KEY_QUERY_SELECTION, mQuerySelection);
+        outState.putLong(KEY_CONTACT_ID_FOR_JOIN, mContactIdForJoin);
+        outState.putLong(KEY_SHOW_JOIN_SUGGESTIONS, mAggregationSuggestionsRawContactId);
+        super.onSaveInstanceState(outState);
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        // Ignore failed requests
+        if (resultCode != Activity.RESULT_OK) return;
+        switch (requestCode) {
+            case REQUEST_CODE_PHOTO_PICKED_WITH_DATA: {
+                // As we are coming back to this view, the editor will be reloaded automatically,
+                // which will cause the photo that is set here to disappear. To prevent this,
+                // we remember to set a flag which is interpreted after loading.
+                // This photo is set here already to reduce flickering.
+                mPhoto = data.getParcelableExtra("data");
+                setPhoto(mRawContactIdRequestingPhoto, mPhoto);
+                mRawContactIdRequestingPhotoAfterLoad = mRawContactIdRequestingPhoto;
+                mRawContactIdRequestingPhoto = -1;
+
+                break;
+            }
+            case REQUEST_CODE_CAMERA_WITH_DATA: {
+                doCropPhoto(mCurrentPhotoFile);
+                break;
+            }
+            case REQUEST_CODE_JOIN: {
+                if (data != null) {
+                    final long contactId = ContentUris.parseId(data.getData());
+                    joinAggregate(contactId);
+                }
+                break;
+            }
+        }
+    }
+
+    /**
+     * Sets the photo stored in mPhoto and writes it to the RawContact with the given id
+     */
+    private void setPhoto(long rawContact, Bitmap photo) {
+        BaseRawContactEditorView requestingEditor = getContactEditorView(rawContact);
+        if (requestingEditor != null) {
+            requestingEditor.setPhotoBitmap(photo);
+        } else {
+            Log.w(TAG, "The contact that requested the photo is no longer present.");
+        }
+    }
+
+    /**
+     * Finds raw contact editor view for the given rawContactId.
+     */
+    public BaseRawContactEditorView getContactEditorView(long rawContactId) {
+        for (int i = 0; i < mContent.getChildCount(); i++) {
+            final View childView = mContent.getChildAt(i);
+            if (childView instanceof BaseRawContactEditorView) {
+                final BaseRawContactEditorView editor = (BaseRawContactEditorView) childView;
+                if (editor.getRawContactId() == rawContactId) {
+                    return editor;
+                }
+            }
+        }
+        return null;
+    }
+
+    public Uri getLookupUri() {
+        return mLookupUri;
+    }
+
+    /**
+     * The listener for the data loader
+     */
+    private final LoaderManager.LoaderCallbacks<ContactLoader.Result> mDataLoaderListener =
+            new LoaderCallbacks<ContactLoader.Result>() {
+        @Override
+        public Loader<ContactLoader.Result> onCreateLoader(int id, Bundle args) {
+            mLoaderStartTime = SystemClock.elapsedRealtime();
+            return new ContactLoader(mContext, mLookupUri);
+        }
+
+        @Override
+        public void onLoadFinished(Loader<ContactLoader.Result> loader, ContactLoader.Result data) {
+            final long loaderCurrentTime = SystemClock.elapsedRealtime();
+            Log.v(TAG, "Time needed for loading: " + (loaderCurrentTime-mLoaderStartTime));
+            if (data == ContactLoader.Result.NOT_FOUND || data == ContactLoader.Result.ERROR) {
+                // Item has been deleted
+                Log.i(TAG, "No contact found. Closing activity");
+                if (mListener != null) mListener.onContactNotFound();
+                return;
+            }
+
+            mStatus = Status.EDITING;
+            final long setDataStartTime = SystemClock.elapsedRealtime();
+            setData(data);
+            final long setDataEndTime = SystemClock.elapsedRealtime();
+
+            // If we are coming back from the photo trimmer, this will be set.
+            if (mRawContactIdRequestingPhotoAfterLoad != -1) {
+                setPhoto(mRawContactIdRequestingPhotoAfterLoad, mPhoto);
+                mRawContactIdRequestingPhotoAfterLoad = -1;
+                mPhoto = null;
+            }
+            Log.v(TAG, "Time needed for setting UI: " + (setDataEndTime-setDataStartTime));
+        }
+    };
+
+    /**
+     * The listener for the group meta data loader
+     */
+    private final LoaderManager.LoaderCallbacks<Cursor> mGroupLoaderListener =
+            new LoaderCallbacks<Cursor>() {
+
+        @Override
+        public CursorLoader onCreateLoader(int id, Bundle args) {
+            return new GroupMetaDataLoader(mContext);
+        }
+
+        @Override
+        public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+            mGroupMetaData = data;
+            bindGroupMetaData();
+        }
+    };
+
+    @Override
+    public void onSplitContactConfirmed() {
+        mState.markRawContactsForSplitting();
+        doSaveAction(SaveMode.SPLIT);
+    }
+
+    /**
+     * Launches Camera to take a picture and store it in a file.
+     */
+    @Override
+    public void onTakePhotoChosen() {
+        try {
+            // Launch camera to take photo for selected contact
+            PHOTO_DIR.mkdirs();
+            mCurrentPhotoFile = new File(PHOTO_DIR, getPhotoFileName());
+            final Intent intent = getTakePickIntent(mCurrentPhotoFile);
+
+            startActivityForResult(intent, REQUEST_CODE_CAMERA_WITH_DATA);
+        } catch (ActivityNotFoundException e) {
+            Toast.makeText(mContext, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
+        }
+    }
+
+    /**
+     * Launches Gallery to pick a photo.
+     */
+    @Override
+    public void onPickFromGalleryChosen() {
+        try {
+            // Launch picker to choose photo for selected contact
+            final Intent intent = getPhotoPickIntent();
+            startActivityForResult(intent, REQUEST_CODE_PHOTO_PICKED_WITH_DATA);
+        } catch (ActivityNotFoundException e) {
+            Toast.makeText(mContext, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
+        }
+    }
+
+    /**
+     * Account was chosen in the selector. Create a RawContact for this account now
+     */
+    @Override
+    public void onAccountChosen(Account account, boolean isNewContact) {
+        createContact(account, isNewContact);
+    }
+
+    /**
+     * The account selector has been aborted. If we are in "New" mode, we have to close now
+     */
+    @Override
+    public void onAccountSelectorCancelled() {
+        if (!hasValidState() && mListener != null) {
+            mListener.onAccountSelectorAborted();
+        }
+    }
+
+    /**
+     * User has chosen to set the selected photo as the (super) primary photo
+     */
+    @Override
+    public void onUseAsPrimaryChosen(long rawContactId) {
+        // Set the IsSuperPrimary for each editor
+        int count = mContent.getChildCount();
+        for (int i = 0; i < count; i++) {
+            final View childView = mContent.getChildAt(i);
+            if (childView instanceof BaseRawContactEditorView) {
+                final BaseRawContactEditorView editor = (BaseRawContactEditorView) childView;
+                final PhotoEditorView photoEditor = editor.getPhotoEditor();
+                photoEditor.setSuperPrimary(editor.getRawContactId() == rawContactId);
+            }
+        }
+    }
+
+    /**
+     * User has chosen to remove a picture
+     */
+    @Override
+    public void onRemovePictureChose(long rawContactId) {
+        // find the correct editor and remove it's photo
+        final int editorCount = mContent.getChildCount();
+        for (int i = 0; i < editorCount; i++) {
+            final View child = mContent.getChildAt(i);
+            if (child instanceof BaseRawContactEditorView) {
+                final BaseRawContactEditorView editor =
+                    (BaseRawContactEditorView) child;
+                if (editor.getRawContactId() == rawContactId) {
+                    editor.setPhotoBitmap(null);
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * User has chosen to change a picture
+     */
+    @Override
+    public void onChangePictureChosen(long rawContactId) {
+        // Pick a new photo for the contact
+        doPickPhotoAction(rawContactId);
+    }
+}
diff --git a/src/com/android/contacts/views/editor/Editor.java b/src/com/android/contacts/views/editor/Editor.java
new file mode 100644
index 0000000..00d1d62
--- /dev/null
+++ b/src/com/android/contacts/views/editor/Editor.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2009 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.contacts.views.editor;
+
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+
+import android.provider.ContactsContract.Data;
+
+/**
+ * Generic definition of something that edits a {@link Data} row through an
+ * {@link ValuesDelta} object.
+ */
+public interface Editor {
+    /**
+     * Listener for an {@link Editor}, usually to handle deleted items.
+     */
+    public interface EditorListener {
+        /**
+         * Called when the given {@link Editor} has been deleted.
+         */
+        public void onDeleted(Editor editor);
+
+        /**
+         * Called when the given {@link Editor} has a request, for example it
+         * wants to select a photo.
+         */
+        public void onRequest(int request);
+
+        public static final int REQUEST_PICK_PHOTO = 1;
+        public static final int FIELD_CHANGED = 2;
+
+        // The editor has switched between different representations of the same
+        // data, e.g. from full name to structured name
+        public static final int EDITOR_FORM_CHANGED = 3;
+    }
+
+    /**
+     * Prepare this editor for the given {@link ValuesDelta}, which
+     * builds any needed views. Any changes performed by the user will be
+     * written back to that same object.
+     */
+    public void setValues(DataKind kind, ValuesDelta values, EntityDelta state, boolean readOnly,
+            ViewIdGenerator vig);
+
+    public void setDeletable(boolean deletable);
+
+    /**
+     * Add a specific {@link EditorListener} to this {@link Editor}.
+     */
+    public void setEditorListener(EditorListener listener);
+
+    /**
+     * Called internally when the contents of a specific field have changed,
+     * allowing advanced editors to persist data in a specific way.
+     */
+    public void onFieldChanged(String column, String value);
+}
diff --git a/src/com/android/contacts/views/editor/FieldEditorView.java b/src/com/android/contacts/views/editor/FieldEditorView.java
new file mode 100644
index 0000000..926782d
--- /dev/null
+++ b/src/com/android/contacts/views/editor/FieldEditorView.java
@@ -0,0 +1,688 @@
+/*
+ * Copyright (C) 2009 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.contacts.views.editor;
+
+import com.android.contacts.ContactsUtils;
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.EditField;
+import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.android.contacts.model.EntityModifier;
+import com.android.contacts.util.DialogManager;
+import com.android.contacts.util.DialogManager.DialogShowingView;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Entity;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.telephony.PhoneNumberFormattingTextWatcher;
+import android.text.Editable;
+import android.text.InputType;
+import android.text.TextWatcher;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.inputmethod.EditorInfo;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.PopupMenu;
+
+import java.util.List;
+
+/**
+ * Simple editor that handles labels and any {@link EditField} defined for
+ * the entry. Uses {@link ValuesDelta} to read any existing
+ * {@link Entity} values, and to correctly write any changes values.
+ */
+public class FieldEditorView extends ViewGroup implements Editor, DialogShowingView {
+    private static final String DIALOG_ID_KEY = "dialog_id";
+    private static final int DIALOG_ID_CUSTOM = 1;
+
+    private static final int INPUT_TYPE_CUSTOM = EditorInfo.TYPE_CLASS_TEXT
+            | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS;
+
+    private Button mLabel;
+    private ImageButton mDelete;
+    private ImageButton mMoreOrLess;
+
+    private DataKind mKind;
+    private ValuesDelta mEntry;
+    private EntityDelta mState;
+    private boolean mReadOnly;
+    private EditText[] mFieldEditTexts = null;
+
+    private boolean mHasShortAndLongForms;
+    private boolean mHideOptional = true;
+
+    private EditType mType;
+    // Used only when a user tries to use custom label.
+    private EditType mPendingType;
+
+    private ViewIdGenerator mViewIdGenerator;
+    private DialogManager mDialogManager = null;
+    private EditorListener mListener;
+
+
+
+    public FieldEditorView(Context context) {
+        super(context);
+    }
+
+    public FieldEditorView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public FieldEditorView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+        // Subtract padding from the borders ==> x1 variables
+        int l1 = getPaddingLeft();
+        int t1 = getPaddingTop();
+        int r1 = getMeasuredWidth() - getPaddingRight();
+        int b1 = getMeasuredHeight() - getPaddingBottom();
+
+        // Label Button
+        final boolean hasLabel = mLabel != null;
+
+        if (hasLabel) {
+            mLabel.layout(
+                    l1, t1,
+                    l1 + mLabel.getMeasuredWidth(), t1 + mLabel.getMeasuredHeight());
+        }
+
+        // Delete Button
+        final boolean hasDelete = mDelete != null;
+        if (hasDelete) {
+            mDelete.layout(
+                    r1 - mDelete.getMeasuredWidth(), b1 - mDelete.getMeasuredHeight(),
+                    r1, b1);
+        }
+
+        // MoreOrLess Button
+        final boolean hasMoreOrLess = mMoreOrLess != null;
+        if (hasMoreOrLess) {
+            mMoreOrLess.layout(
+                    r1 - mMoreOrLess.getMeasuredWidth(), b1 - mMoreOrLess.getMeasuredHeight(),
+                    r1, b1);
+        }
+
+        // Fields
+        // Subtract buttons left and right if necessary
+        final int l2 = hasLabel ? l1 + mLabel.getMeasuredWidth() : l1;
+        final int r2 = r1 - Math.max(
+                hasDelete ? mDelete.getMeasuredWidth() : 0,
+                hasMoreOrLess ? mMoreOrLess.getMeasuredWidth() : 0);
+        int y = t1;
+        if (mFieldEditTexts != null) {
+            for (EditText editText : mFieldEditTexts) {
+                if (editText.getVisibility() != View.GONE) {
+                    int height = editText.getMeasuredHeight();
+                    editText.layout(
+                            l2, t1 + y,
+                            r2, t1 + y + height);
+                    y += height;
+                }
+            }
+        }
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        measureChildren(widthMeasureSpec, heightMeasureSpec);
+
+        // summarize the EditText heights
+        int totalHeight = 0;
+        int visibleFieldCount = 0;
+        EditText firstVisibleField = null;
+        if (mFieldEditTexts != null) {
+            for (EditText editText : mFieldEditTexts) {
+                if (editText.getVisibility() != View.GONE) {
+                    visibleFieldCount ++;
+                    if (firstVisibleField == null) {
+                        firstVisibleField = editText;
+                    }
+                    totalHeight += editText.getMeasuredHeight();
+                }
+            }
+        }
+
+        int padding = getPaddingTop() + getPaddingBottom();
+        int minHeight = padding;
+
+        if (mMoreOrLess != null) {
+            minHeight += mMoreOrLess.getMeasuredHeight();
+        }
+
+        if (mDelete != null) {
+            minHeight += mDelete.getMeasuredHeight();
+        }
+
+        totalHeight = Math.max(minHeight, totalHeight);
+
+        setMeasuredDimension(getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec),
+                resolveSize(totalHeight, heightMeasureSpec));
+    }
+
+    /**
+     * Creates or removes the type/label button. Doesn't do anything if already correctly configured
+     */
+    private void setupLabelButton(boolean shouldExist) {
+        if (shouldExist && mLabel == null) {
+            mLabel = new Button(mContext);
+            mLabel.setBackgroundResource(R.drawable.type_selector_background);
+            final int width =
+                    mContext.getResources().getDimensionPixelSize(R.dimen.editor_type_label_width);
+            mLabel.setLayoutParams(new LayoutParams(width, LayoutParams.WRAP_CONTENT));
+            mLabel.setOnClickListener(new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    showLabelPopupMenu();
+                }
+            });
+            addView(mLabel);
+        } else if (!shouldExist && mLabel != null) {
+            removeView(mLabel);
+            mLabel = null;
+        }
+    }
+
+    /**
+     * Creates or removes the remove button. Doesn't do anything if already correctly configured
+     */
+    private void setupDeleteButton(boolean shouldExist) {
+        if (shouldExist && mDelete == null) {
+            mDelete = new ImageButton(mContext);
+            mDelete.setBackgroundDrawable(null);
+            mDelete.setImageResource(R.drawable.btn_minus);
+            final Resources resources = mContext.getResources();
+            mDelete.setPadding(
+                    resources.getDimensionPixelOffset(R.dimen.editor_round_button_padding_left),
+                    resources.getDimensionPixelOffset(R.dimen.editor_round_button_padding_top),
+                    resources.getDimensionPixelOffset(R.dimen.editor_round_button_padding_right),
+                    resources.getDimensionPixelOffset(R.dimen.editor_round_button_padding_bottom));
+            mDelete.setContentDescription(
+                    getResources().getText(R.string.description_minus_button));
+            mDelete.setLayoutParams(
+                    new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
+            mDelete.setOnClickListener(new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    // Keep around in model, but mark as deleted
+                    mEntry.markDeleted();
+
+                    ((ViewGroup) getParent()).removeView(FieldEditorView.this);
+
+                    if (mListener != null) {
+                        // Notify listener when present
+                        mListener.onDeleted(FieldEditorView.this);
+                    }
+                }
+            });
+            addView(mDelete);
+        } else if (!shouldExist && mDelete != null) {
+            removeView(mDelete);
+            mDelete = null;
+        }
+    }
+
+    /**
+     * Creates or removes the type/label button. Doesn't do anything if already correctly configured
+     */
+    private void setupMoreOrLessButton(boolean shouldExist, boolean collapsed) {
+        if (shouldExist) {
+            if (mMoreOrLess == null) {
+                // Unfortunately, the style passed as constructor-parameter is mostly ignored,
+                // so we have to set the Background and Image seperately. However, if it is not
+                // given, the size of the control is wrong
+                mMoreOrLess = new ImageButton(mContext, null, R.style.EmptyButton);
+                mMoreOrLess.setLayoutParams(
+                        new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
+                mMoreOrLess.setBackgroundResource(R.drawable.btn_circle);
+                mMoreOrLess.setOnClickListener(new OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        // Save focus
+                        final View focusedChild = getFocusedChild();
+                        final int focusedViewId = focusedChild == null ? -1 : focusedChild.getId();
+
+                        // Reconfigure GUI
+                        mHideOptional = !mHideOptional;
+                        onOptionalFieldVisibilityChange();
+                        rebuildValues();
+
+                        // Restore focus
+                        View newFocusView = findViewById(focusedViewId);
+                        if (newFocusView == null || newFocusView.getVisibility() == GONE) {
+                            // find first visible child
+                            newFocusView = FieldEditorView.this;
+                        }
+                        if (newFocusView != null) {
+                            newFocusView.requestFocus();
+                        }
+                    }
+                });
+                addView(mMoreOrLess);
+            }
+            mMoreOrLess.setImageResource(
+                    collapsed ? R.drawable.ic_btn_round_more : R.drawable.ic_btn_round_less);
+        } else if (mMoreOrLess != null) {
+            removeView(mMoreOrLess);
+            mMoreOrLess = null;
+        }
+    }
+
+    protected void onOptionalFieldVisibilityChange() {
+        if (mListener != null) {
+            mListener.onRequest(EditorListener.EDITOR_FORM_CHANGED);
+        }
+    }
+
+    @Override
+    public void setEditorListener(EditorListener listener) {
+        mListener = listener;
+    }
+
+    @Override
+    public void setDeletable(boolean deletable) {
+        setupDeleteButton(deletable);
+    }
+
+    @Override
+    public void setEnabled(boolean enabled) {
+        if (mLabel != null) mLabel.setEnabled(enabled);
+
+        if (mFieldEditTexts != null) {
+            for (int index = 0; index < mFieldEditTexts.length; index++) {
+                mFieldEditTexts[index].setEnabled(enabled);
+            }
+        }
+        if (mDelete != null) mDelete.setEnabled(enabled);
+        if (mMoreOrLess != null) mMoreOrLess.setEnabled(enabled);
+    }
+
+    /**
+     * Returns true if the editor is currently configured to show optional fields.
+     */
+    public boolean areOptionalFieldsVisible() {
+        return !mHideOptional;
+    }
+
+    public boolean hasShortAndLongForms() {
+        return mHasShortAndLongForms;
+    }
+
+    /**
+     * Build the current label state based on selected {@link EditType} and
+     * possible custom label string.
+     */
+    private void rebuildLabel() {
+        if (mLabel == null) return;
+        // Handle undetected types
+        if (mType == null) {
+            mLabel.setText(R.string.unknown);
+            return;
+        }
+
+        if (mType.customColumn != null) {
+            // Use custom label string when present
+            final String customText = mEntry.getAsString(mType.customColumn);
+            if (customText != null) {
+                mLabel.setText(customText);
+                return;
+            }
+        }
+
+        // Otherwise fall back to using default label
+        mLabel.setText(mType.labelRes);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void onFieldChanged(String column, String value) {
+        // Field changes are saved directly
+        mEntry.put(column, value);
+        if (mListener != null) {
+            mListener.onRequest(EditorListener.FIELD_CHANGED);
+        }
+    }
+
+    private void rebuildValues() {
+        setValues(mKind, mEntry, mState, mReadOnly, mViewIdGenerator);
+    }
+
+    /**
+     * Prepare this editor using the given {@link DataKind} for defining
+     * structure and {@link ValuesDelta} describing the content to edit.
+     */
+    @Override
+    public void setValues(DataKind kind, ValuesDelta entry, EntityDelta state, boolean readOnly,
+            ViewIdGenerator vig) {
+        mKind = kind;
+        mEntry = entry;
+        mState = state;
+        mReadOnly = readOnly;
+        mViewIdGenerator = vig;
+        setId(vig.getId(state, kind, entry, ViewIdGenerator.NO_VIEW_INDEX));
+
+        final boolean enabled = !readOnly;
+
+        if (!entry.isVisible()) {
+            // Hide ourselves entirely if deleted
+            setVisibility(View.GONE);
+            return;
+        }
+        setVisibility(View.VISIBLE);
+
+        // Display label selector if multiple types available
+        final boolean hasTypes = EntityModifier.hasEditTypes(kind);
+        setupLabelButton(hasTypes);
+        if (mLabel != null) mLabel.setEnabled(enabled);
+        if (hasTypes) {
+            mType = EntityModifier.getCurrentType(entry, kind);
+            rebuildLabel();
+        }
+
+        // Remove edit texts that we currently have
+        if (mFieldEditTexts != null) {
+            for (EditText fieldEditText : mFieldEditTexts) {
+                removeView(fieldEditText);
+            }
+        }
+        boolean hidePossible = false;
+
+        int fieldCount = kind.fieldList.size();
+        mFieldEditTexts = new EditText[fieldCount];
+        for (int index = 0; index < fieldCount; index++) {
+            final EditField field = kind.fieldList.get(index);
+            final EditText fieldView = new EditText(mContext);
+            fieldView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
+                    LayoutParams.WRAP_CONTENT));
+            fieldView.setGravity(Gravity.TOP);
+            mFieldEditTexts[index] = fieldView;
+            fieldView.setId(vig.getId(state, kind, entry, index));
+            if (field.titleRes > 0) {
+                fieldView.setHint(field.titleRes);
+            }
+            int inputType = field.inputType;
+            fieldView.setInputType(inputType);
+            if (inputType == InputType.TYPE_CLASS_PHONE) {
+                fieldView.addTextChangedListener(new PhoneNumberFormattingTextWatcher(
+                        ContactsUtils.getCurrentCountryIso(mContext)));
+            }
+            fieldView.setMinLines(field.minLines);
+
+            // Read current value from state
+            final String column = field.column;
+            final String value = entry.getAsString(column);
+            fieldView.setText(value);
+
+            // Prepare listener for writing changes
+            fieldView.addTextChangedListener(new TextWatcher() {
+                @Override
+                public void afterTextChanged(Editable s) {
+                    // Trigger event for newly changed value
+                    onFieldChanged(column, s.toString());
+                }
+
+                @Override
+                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+                }
+
+                @Override
+                public void onTextChanged(CharSequence s, int start, int before, int count) {
+                }
+            });
+
+            fieldView.setEnabled(enabled);
+
+            if (field.shortForm) {
+                hidePossible = true;
+                mHasShortAndLongForms = true;
+                fieldView.setVisibility(mHideOptional ? View.VISIBLE : View.GONE);
+            } else if (field.longForm) {
+                hidePossible = true;
+                mHasShortAndLongForms = true;
+                fieldView.setVisibility(mHideOptional ? View.GONE : View.VISIBLE);
+            } else {
+                // Hide field when empty and optional value
+                final boolean couldHide = (!ContactsUtils.isGraphic(value) && field.optional);
+                final boolean willHide = (mHideOptional && couldHide);
+                fieldView.setVisibility(willHide ? View.GONE : View.VISIBLE);
+                hidePossible = hidePossible || couldHide;
+            }
+
+            addView(fieldView);
+        }
+
+        // When hiding fields, place expandable
+        setupMoreOrLessButton(hidePossible, mHideOptional);
+        if (mMoreOrLess != null) mMoreOrLess.setEnabled(enabled);
+    }
+
+    public ValuesDelta getValues() {
+        return mEntry;
+    }
+
+    /**
+     * Prepare dialog for entering a custom label. The input value is trimmed: white spaces before
+     * and after the input text is removed.
+     * <p>
+     * If the final value is empty, this change request is ignored;
+     * no empty text is allowed in any custom label.
+     */
+    private Dialog createCustomDialog() {
+        final EditText customType = new EditText(mContext);
+        customType.setInputType(INPUT_TYPE_CUSTOM);
+        customType.requestFocus();
+
+        final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
+        builder.setTitle(R.string.customLabelPickerTitle);
+        builder.setView(customType);
+
+        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                final String customText = customType.getText().toString().trim();
+                if (ContactsUtils.isGraphic(customText)) {
+                    // Now we're sure it's ok to actually change the type value.
+                    mType = mPendingType;
+                    mPendingType = null;
+                    mEntry.put(mKind.typeColumn, mType.rawValue);
+                    mEntry.put(mType.customColumn, customText);
+                    rebuildLabel();
+                    requestFocusForFirstEditField();
+                }
+            }
+        });
+
+        builder.setNegativeButton(android.R.string.cancel, null);
+
+        return builder.create();
+    }
+
+    /**
+     * Show PopupMenu for picking a new {@link EditType} or entering a
+     * custom label. This dialog is limited to the valid types as determined
+     * by {@link EntityModifier}.
+     */
+    public void showLabelPopupMenu() {
+        // Build list of valid types, including the current value
+        final List<EditType> validTypes = EntityModifier.getValidTypes(mState, mKind, mType);
+
+        final PopupMenu popupMenu = new PopupMenu(getContext(), mLabel);
+        final Menu menu = popupMenu.getMenu();
+
+        for (int i = 0; i < validTypes.size(); i++) {
+            final EditType type = validTypes.get(i);
+            menu.add(Menu.NONE, i, Menu.NONE, type.labelRes);
+        }
+
+        popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
+            @Override
+            public boolean onMenuItemClick(MenuItem item) {
+                final EditType selected = validTypes.get(item.getItemId());
+                if (selected.customColumn != null) {
+                    // Show custom label dialog if requested by type.
+                    //
+                    // Only when the custum value input in the next step is correct one.
+                    // this method also set the type value to what the user requested here.
+                    mPendingType = selected;
+                    showDialog(DIALOG_ID_CUSTOM);
+                } else {
+                    // User picked type, and we're sure it's ok to actually write the entry.
+                    mType = selected;
+                    mEntry.put(mKind.typeColumn, mType.rawValue);
+                    rebuildLabel();
+                    requestFocusForFirstEditField();
+                }
+                return true;
+            }
+        });
+
+        popupMenu.show();
+    }
+
+    /* package */
+    void showDialog(int bundleDialogId) {
+        Bundle bundle = new Bundle();
+        bundle.putInt(DIALOG_ID_KEY, bundleDialogId);
+        getDialogManager().showDialogInView(this, bundle);
+    }
+
+    private DialogManager getDialogManager() {
+        if (mDialogManager == null) {
+            Context context = getContext();
+            if (!(context instanceof DialogManager.DialogShowingViewActivity)) {
+                throw new IllegalStateException(
+                        "View must be hosted in an Activity that implements " +
+                        "DialogManager.DialogShowingViewActivity");
+            }
+            mDialogManager = ((DialogManager.DialogShowingViewActivity)context).getDialogManager();
+        }
+        return mDialogManager;
+    }
+
+    private static class SavedState extends BaseSavedState {
+        public boolean mHideOptional;
+        public int[] mVisibilities;
+
+        SavedState(Parcelable superState) {
+            super(superState);
+        }
+
+        private SavedState(Parcel in) {
+            super(in);
+            mVisibilities = new int[in.readInt()];
+            in.readIntArray(mVisibilities);
+        }
+
+        @Override
+        public void writeToParcel(Parcel out, int flags) {
+            super.writeToParcel(out, flags);
+            out.writeInt(mVisibilities.length);
+            out.writeIntArray(mVisibilities);
+        }
+
+        public static final Parcelable.Creator<SavedState> CREATOR
+                = new Parcelable.Creator<SavedState>() {
+            @Override
+            public SavedState createFromParcel(Parcel in) {
+                return new SavedState(in);
+            }
+
+            @Override
+            public SavedState[] newArray(int size) {
+                return new SavedState[size];
+            }
+        };
+    }
+
+    /**
+     * Saves the visibility of the child EditTexts, and mHideOptional.
+     */
+    @Override
+    protected Parcelable onSaveInstanceState() {
+        Parcelable superState = super.onSaveInstanceState();
+        SavedState ss = new SavedState(superState);
+
+        ss.mHideOptional = mHideOptional;
+
+        final int numChildren = mFieldEditTexts.length;
+        ss.mVisibilities = new int[numChildren];
+        for (int i = 0; i < numChildren; i++) {
+            ss.mVisibilities[i] = mFieldEditTexts[i].getVisibility();
+        }
+
+        return ss;
+    }
+
+    /**
+     * Restores the visibility of the child EditTexts, and mHideOptional.
+     */
+    @Override
+    protected void onRestoreInstanceState(Parcelable state) {
+        SavedState ss = (SavedState) state;
+        super.onRestoreInstanceState(ss.getSuperState());
+
+        mHideOptional = ss.mHideOptional;
+
+        int numChildren = Math.min(mFieldEditTexts.length, ss.mVisibilities.length);
+        for (int i = 0; i < numChildren; i++) {
+            mFieldEditTexts[i].setVisibility(ss.mVisibilities[i]);
+        }
+    }
+
+    @Override
+    public Dialog createDialog(Bundle bundle) {
+        if (bundle == null) throw new IllegalArgumentException("bundle must not be null");
+        int dialogId = bundle.getInt(DIALOG_ID_KEY);
+        switch (dialogId) {
+            case DIALOG_ID_CUSTOM:
+                return createCustomDialog();
+            default:
+                throw new IllegalArgumentException("Invalid dialogId: " + dialogId);
+        }
+    }
+
+    private void requestFocusForFirstEditField() {
+        if (mFieldEditTexts != null && mFieldEditTexts.length != 0) {
+            boolean anyFieldHasFocus = false;
+            for (EditText editText : mFieldEditTexts) {
+                if (editText.hasFocus()) {
+                    anyFieldHasFocus = true;
+                }
+            }
+            if (!anyFieldHasFocus)
+                mFieldEditTexts[0].requestFocus();
+        }
+    }
+}
diff --git a/src/com/android/contacts/views/editor/GroupMembershipView.java b/src/com/android/contacts/views/editor/GroupMembershipView.java
new file mode 100644
index 0000000..de505b6
--- /dev/null
+++ b/src/com/android/contacts/views/editor/GroupMembershipView.java
@@ -0,0 +1,294 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.views.editor;
+
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.android.contacts.model.EntityModifier;
+import com.android.contacts.views.GroupMetaDataLoader;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
+import android.provider.ContactsContract.RawContacts;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ArrayAdapter;
+import android.widget.LinearLayout;
+import android.widget.ListPopupWindow;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+
+/**
+ * An editor for group membership.  Displays the current group membership list and
+ * brings up a dialog to change it.
+ */
+public class GroupMembershipView extends LinearLayout
+        implements OnClickListener, OnItemClickListener {
+
+    public static final class GroupSelectionItem {
+        private final long mGroupId;
+        private final String mTitle;
+        private boolean mChecked;
+
+        public GroupSelectionItem(long groupId, String title, boolean checked) {
+            this.mGroupId = groupId;
+            this.mTitle = title;
+            mChecked = checked;
+        }
+
+        public long getGroupId() {
+            return mGroupId;
+        }
+
+        public boolean isChecked() {
+            return mChecked;
+        }
+
+        public void setChecked(boolean checked) {
+            mChecked = checked;
+        }
+
+        @Override
+        public String toString() {
+            return mTitle;
+        }
+    }
+
+    private EntityDelta mState;
+    private Cursor mGroupMetaData;
+    private String mAccountName;
+    private String mAccountType;
+    private TextView mGroupList;
+    private ArrayAdapter<GroupSelectionItem> mAdapter;
+    private long mDefaultGroupId;
+    private long mFavoritesGroupId;
+    private ListPopupWindow mPopup;
+    private DataKind mKind;
+    private boolean mDefaultGroupVisibilityKnown;
+    private boolean mDefaultGroupVisible;
+
+    public GroupMembershipView(Context context) {
+        super(context);
+    }
+
+    public GroupMembershipView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public void setKind(DataKind kind) {
+        mKind = kind;
+        TextView kindTitle = (TextView) findViewById(R.id.kind_title);
+        kindTitle.setText(kind.titleRes);
+    }
+
+    public void setGroupMetaData(Cursor groupMetaData) {
+        this.mGroupMetaData = groupMetaData;
+        updateView();
+    }
+
+    public void setState(EntityDelta state) {
+        mState = state;
+        ValuesDelta values = state.getValues();
+        mAccountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
+        mAccountName = values.getAsString(RawContacts.ACCOUNT_NAME);
+        mDefaultGroupVisibilityKnown = false;
+        updateView();
+    }
+
+    private void updateView() {
+        if (mGroupMetaData == null || mGroupMetaData.isClosed() || mAccountType == null
+                || mAccountName == null) {
+            setVisibility(GONE);
+            return;
+        }
+
+        boolean accountHasGroups = false;
+        mFavoritesGroupId = 0;
+        mDefaultGroupId = 0;
+
+        StringBuilder sb = new StringBuilder();
+        mGroupMetaData.moveToPosition(-1);
+        while (mGroupMetaData.moveToNext()) {
+            String accountName = mGroupMetaData.getString(GroupMetaDataLoader.ACCOUNT_NAME);
+            String accountType = mGroupMetaData.getString(GroupMetaDataLoader.ACCOUNT_TYPE);
+            if (accountName.equals(mAccountName) && accountType.equals(mAccountType)) {
+                long groupId = mGroupMetaData.getLong(GroupMetaDataLoader.GROUP_ID);
+                if (!mGroupMetaData.isNull(GroupMetaDataLoader.FAVORITES)
+                        && mGroupMetaData.getInt(GroupMetaDataLoader.FAVORITES) != 0) {
+                    mFavoritesGroupId = groupId;
+                } else if (!mGroupMetaData.isNull(GroupMetaDataLoader.AUTO_ADD)
+                            && mGroupMetaData.getInt(GroupMetaDataLoader.AUTO_ADD) != 0) {
+                    mDefaultGroupId = groupId;
+                } else {
+                    accountHasGroups = true;
+                }
+
+                // Exclude favorites from the list - they are handled with special UI (star)
+                // Also exclude the default group.
+                if (groupId != mFavoritesGroupId && groupId != mDefaultGroupId
+                        && hasMembership(groupId)) {
+                    String title = mGroupMetaData.getString(GroupMetaDataLoader.TITLE);
+                    if (sb.length() != 0) {
+                        sb.append(", ");
+                    }
+                    sb.append(title);
+                }
+            }
+        }
+
+        if (!accountHasGroups) {
+            setVisibility(GONE);
+            return;
+        }
+
+        if (mGroupList == null) {
+            mGroupList = (TextView) findViewById(R.id.group_list);
+            setOnClickListener(this);
+        }
+
+        mGroupList.setText(sb);
+        setVisibility(VISIBLE);
+
+        if (!mDefaultGroupVisibilityKnown) {
+            // Only show the default group (My Contacts) if the contact is NOT in it
+            mDefaultGroupVisible = mDefaultGroupId != 0 && !hasMembership(mDefaultGroupId);
+            mDefaultGroupVisibilityKnown = true;
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        if (mPopup != null && mPopup.isShowing()) {
+            mPopup.dismiss();
+            return;
+        }
+
+        mAdapter = new ArrayAdapter<GroupSelectionItem>(
+                getContext(), android.R.layout.simple_list_item_multiple_choice);
+
+        mGroupMetaData.moveToPosition(-1);
+        while (mGroupMetaData.moveToNext()) {
+            String accountName = mGroupMetaData.getString(GroupMetaDataLoader.ACCOUNT_NAME);
+            String accountType = mGroupMetaData.getString(GroupMetaDataLoader.ACCOUNT_TYPE);
+            if (accountName.equals(mAccountName) && accountType.equals(mAccountType)) {
+                long groupId = mGroupMetaData.getLong(GroupMetaDataLoader.GROUP_ID);
+                if (groupId != mFavoritesGroupId
+                        && (groupId != mDefaultGroupId || mDefaultGroupVisible)) {
+                    String title = mGroupMetaData.getString(GroupMetaDataLoader.TITLE);
+                    boolean checked = hasMembership(groupId);
+                    mAdapter.add(new GroupSelectionItem(groupId, title, checked));
+                }
+            }
+        }
+
+        mPopup = new ListPopupWindow(getContext(), null);
+        mPopup.setAnchorView(mGroupList);
+        mPopup.setAdapter(mAdapter);
+        mPopup.setModal(true);
+        mPopup.show();
+
+        ListView listView = mPopup.getListView();
+        listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
+        int count = mAdapter.getCount();
+        for (int i = 0; i < count; i++) {
+            listView.setItemChecked(i, mAdapter.getItem(i).isChecked());
+        }
+
+        listView.setOnItemClickListener(this);
+    }
+
+    @Override
+    protected void onDetachedFromWindow() {
+        super.onDetachedFromWindow();
+        if (mPopup != null) {
+            mPopup.dismiss();
+        }
+    }
+
+    @Override
+    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+        ListView list = (ListView) parent;
+        int count = mAdapter.getCount();
+        for (int i = 0; i < count; i++) {
+            mAdapter.getItem(i).setChecked(list.isItemChecked(i));
+        }
+
+        // First remove the memberships that have been unchecked
+        ArrayList<ValuesDelta> entries = mState.getMimeEntries(GroupMembership.CONTENT_ITEM_TYPE);
+        if (entries != null) {
+            for (ValuesDelta entry : entries) {
+                if (!entry.isDelete()) {
+                    Long groupId = entry.getAsLong(GroupMembership.GROUP_ROW_ID);
+                    if (groupId != null && groupId != mFavoritesGroupId
+                            && !isGroupChecked(groupId)) {
+                        entry.markDeleted();
+                    }
+                }
+            }
+        }
+
+        // Now add the newly selected items
+        for (int i = 0; i < count; i++) {
+            GroupSelectionItem item = mAdapter.getItem(i);
+            long groupId = item.getGroupId();
+            if (item.isChecked() && !hasMembership(groupId)) {
+                ValuesDelta entry = EntityModifier.insertChild(mState, mKind);
+                entry.put(GroupMembership.GROUP_ROW_ID, groupId);
+            }
+        }
+
+        updateView();
+    }
+
+    private boolean isGroupChecked(long groupId) {
+        int count = mAdapter.getCount();
+        for (int i = 0; i < count; i++) {
+            GroupSelectionItem item = mAdapter.getItem(i);
+            if (groupId == item.getGroupId()) {
+                return item.isChecked();
+            }
+        }
+        return false;
+    }
+
+    private boolean hasMembership(long groupId) {
+        if (groupId == mDefaultGroupId && mState.isContactInsert()) {
+            return true;
+        }
+
+        ArrayList<ValuesDelta> entries = mState.getMimeEntries(GroupMembership.CONTENT_ITEM_TYPE);
+        if (entries != null) {
+            for (ValuesDelta values : entries) {
+                if (!values.isDelete()) {
+                    Long id = values.getAsLong(GroupMembership.GROUP_ROW_ID);
+                    if (id != null && id == groupId) {
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+}
diff --git a/src/com/android/contacts/views/editor/KindSectionView.java b/src/com/android/contacts/views/editor/KindSectionView.java
new file mode 100644
index 0000000..de1919c
--- /dev/null
+++ b/src/com/android/contacts/views/editor/KindSectionView.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2009 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.contacts.views.editor;
+
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.android.contacts.model.EntityModifier;
+import com.android.contacts.views.editor.Editor.EditorListener;
+
+import android.content.Context;
+import android.provider.ContactsContract.Data;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+/**
+ * Custom view for an entire section of data as segmented by
+ * {@link DataKind} around a {@link Data#MIMETYPE}. This view shows a
+ * section header and a trigger for adding new {@link Data} rows.
+ */
+public class KindSectionView extends LinearLayout implements EditorListener {
+    private static final String TAG = "KindSectionView";
+
+    private ViewGroup mEditors;
+    private ImageButton mAddPlusButton;
+    private TextView mTitle;
+
+    private DataKind mKind;
+    private EntityDelta mState;
+    private boolean mReadOnly;
+
+    private ViewIdGenerator mViewIdGenerator;
+
+    public KindSectionView(Context context) {
+        super(context);
+    }
+
+    public KindSectionView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void onFinishInflate() {
+        setDrawingCacheEnabled(true);
+        setAlwaysDrawnWithCacheEnabled(true);
+
+        mEditors = (ViewGroup)findViewById(R.id.kind_editors);
+
+        mAddPlusButton = (ImageButton) findViewById(R.id.kind_plus);
+        mAddPlusButton.setOnClickListener(new OnClickListener() {
+            public void onClick(View v) {
+                addItem();
+            }
+        });
+
+        mTitle = (TextView)findViewById(R.id.kind_title);
+    }
+
+    /** {@inheritDoc} */
+    public void onDeleted(Editor editor) {
+        updateAddEnabled();
+        updateVisible();
+    }
+
+    /** {@inheritDoc} */
+    public void onRequest(int request) {
+        // Ignore requests
+    }
+
+    public void setState(DataKind kind, EntityDelta state, boolean readOnly, ViewIdGenerator vig) {
+        mKind = kind;
+        mState = state;
+        mReadOnly = readOnly;
+        mViewIdGenerator = vig;
+
+        setId(mViewIdGenerator.getId(state, kind, null, ViewIdGenerator.NO_VIEW_INDEX));
+
+        // TODO: handle resources from remote packages
+        mTitle.setText(kind.titleRes);
+
+        // Only show the add button if this is a list
+        mAddPlusButton.setVisibility(mKind.isList ? View.VISIBLE : View.INVISIBLE);
+
+        rebuildFromState();
+        updateAddEnabled();
+        updateVisible();
+    }
+
+    public CharSequence getTitle() {
+        return mTitle.getText();
+    }
+
+    /**
+     * Build editors for all current {@link #mState} rows.
+     */
+    public void rebuildFromState() {
+        // Remove any existing editors
+        mEditors.removeAllViews();
+
+        // Check if we are displaying anything here
+        boolean hasEntries = mState.hasMimeEntries(mKind.mimeType);
+
+        if (hasEntries) {
+            for (ValuesDelta entry : mState.getMimeEntries(mKind.mimeType)) {
+                // Skip entries that aren't visible
+                if (!entry.isVisible()) continue;
+                if (isEmptyNoop(entry)) continue;
+
+                createEditorView(entry);
+            }
+        }
+    }
+
+
+    /**
+     * Creates an EditorView for the given entry. This function must be used while constructing
+     * the views corresponding to the the object-model. The resulting EditorView is also added
+     * to the end of mEditors
+     */
+    private View createEditorView(ValuesDelta entry) {
+        final View view;
+        if (mKind.editorClass == null) {
+            view = new FieldEditorView(mContext);
+        } else {
+            try {
+                view = mKind.editorClass.getConstructor(Context.class).newInstance(
+                        mContext);
+            } catch (Exception e) {
+                throw new RuntimeException(
+                        "Cannot allocate editor for " + mKind.editorClass);
+            }
+        }
+
+        if (view instanceof Editor) {
+            Editor editor = (Editor) view;
+            editor.setValues(mKind, entry, mState, mReadOnly, mViewIdGenerator);
+            editor.setEditorListener(this);
+            editor.setDeletable(true);
+        }
+        mEditors.addView(view);
+        return view;
+    }
+
+    /**
+     * Tests whether the given item has no changes (so it exists in the database) but is empty
+     */
+    private boolean isEmptyNoop(ValuesDelta item) {
+        if (!item.isNoop()) return false;
+        final int fieldCount = mKind.fieldList.size();
+        for (int i = 0; i < fieldCount; i++) {
+            final String column = mKind.fieldList.get(i).column;
+            final String value = item.getAsString(column);
+            if (!TextUtils.isEmpty(value)) return false;
+        }
+        return true;
+    }
+
+    private void updateVisible() {
+        setVisibility(getEditorCount() != 0 ? VISIBLE : GONE);
+    }
+
+
+    protected void updateAddEnabled() {
+        // Set enabled state on the "add" view
+        final boolean canInsert = EntityModifier.canInsert(mState, mKind);
+        final boolean isEnabled = !mReadOnly && canInsert;
+        mAddPlusButton.setEnabled(isEnabled);
+    }
+
+    public void addItem() {
+        // if this is a list, we can freely add. if not, only allow adding the first
+        if (!mKind.isList && getEditorCount() == 1)
+            return;
+
+        // Insert a new child, create its view and set its focus
+        final ValuesDelta newValues = EntityModifier.insertChild(mState, mKind);
+        final View newField = createEditorView(newValues);
+        newField.requestFocus();
+
+        // For non-lists (e.g. Notes we can only have one field. in that case we need to disable
+        // the add button
+        updateAddEnabled();
+
+        // Ensure we are visible
+        updateVisible();
+    }
+
+    public int getEditorCount() {
+        return mEditors.getChildCount();
+    }
+
+    public DataKind getKind() {
+        return mKind;
+    }
+}
diff --git a/src/com/android/contacts/views/editor/ModifyPhotoDialogFragment.java b/src/com/android/contacts/views/editor/ModifyPhotoDialogFragment.java
new file mode 100644
index 0000000..7c1d713
--- /dev/null
+++ b/src/com/android/contacts/views/editor/ModifyPhotoDialogFragment.java
@@ -0,0 +1,120 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.views.editor;
+
+import com.android.contacts.R;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.app.Fragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.widget.ArrayAdapter;
+import android.widget.ListAdapter;
+
+/**
+ * Shows a dialog asking the user what to do with an existing photo.
+ * The result is passed back to the Fragment that is configured by
+ * {@link Fragment#setTargetFragment(Fragment, int)}, which
+ * has to implement {@link ModifyPhotoDialogFragment.Listener}.
+ * Does not perform any action by itself.
+ */
+public class ModifyPhotoDialogFragment extends DialogFragment {
+    public static final String TAG = "PhotoDialogFragment";
+    private static final String BUNDLE_IS_READ_ONLY = "IS_READ_ONLY";
+    private static final String BUNDLE_RAW_CONTACT_ID = "RAW_CONTACT_ID";
+
+    private boolean mIsReadOnly;
+    private long mRawContactId;
+
+    public ModifyPhotoDialogFragment() {
+    }
+
+    public ModifyPhotoDialogFragment(boolean isReadOnly, long rawContactId) {
+        mIsReadOnly = isReadOnly;
+        mRawContactId = rawContactId;
+    }
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        if (savedInstanceState != null) {
+            mIsReadOnly = savedInstanceState.getBoolean(BUNDLE_IS_READ_ONLY);
+            mRawContactId = savedInstanceState.getLong(BUNDLE_RAW_CONTACT_ID);
+        }
+    }
+
+    @Override
+    public void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        outState.putBoolean(BUNDLE_IS_READ_ONLY, mIsReadOnly);
+        outState.putLong(BUNDLE_RAW_CONTACT_ID, mRawContactId);
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        // Wrap our context to inflate list items using correct theme
+        final Activity context = getActivity();
+
+        final String[] choices;
+        if (mIsReadOnly) {
+            choices = new String[1];
+            choices[0] = context.getString(R.string.use_photo_as_primary);
+        } else {
+            choices = new String[3];
+            choices[0] = context.getString(R.string.use_photo_as_primary);
+            choices[1] = context.getString(R.string.removePicture);
+            choices[2] = context.getString(R.string.changePicture);
+        }
+        final ListAdapter adapter = new ArrayAdapter<String>(context,
+                android.R.layout.select_dialog_item, choices);
+
+        final DialogInterface.OnClickListener clickListener =
+            new DialogInterface.OnClickListener() {
+                @Override
+                public void onClick(DialogInterface dialog, int which) {
+                    dialog.dismiss();
+
+                    final Listener target = (Listener) getTargetFragment();
+                    switch (which) {
+                        case 0:
+                            target.onUseAsPrimaryChosen(mRawContactId);
+                            break;
+                        case 1:
+                            target.onRemovePictureChose(mRawContactId);
+                            break;
+                        case 2:
+                            target.onChangePictureChosen(mRawContactId);
+                            break;
+                    }
+                }
+            };
+
+        final AlertDialog.Builder builder = new AlertDialog.Builder(context);
+        builder.setTitle(R.string.attachToContact);
+        builder.setSingleChoiceItems(adapter, -1, clickListener);
+        return builder.create();
+    }
+
+    public interface Listener {
+        void onUseAsPrimaryChosen(long rawContactId);
+        void onRemovePictureChose(long rawContactId);
+        void onChangePictureChosen(long rawContactId);
+    }
+}
diff --git a/src/com/android/contacts/views/editor/PhotoEditorView.java b/src/com/android/contacts/views/editor/PhotoEditorView.java
new file mode 100644
index 0000000..ba3372c
--- /dev/null
+++ b/src/com/android/contacts/views/editor/PhotoEditorView.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2009 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.contacts.views.editor;
+
+import com.android.contacts.R;
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.ImageView;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+/**
+ * Simple editor for {@link Photo}.
+ */
+public class PhotoEditorView extends ImageView implements Editor, OnClickListener {
+    private static final String TAG = "PhotoEditorView";
+
+    private ValuesDelta mEntry;
+    private EditorListener mListener;
+
+    private boolean mHasSetPhoto = false;
+    private boolean mReadOnly;
+
+    public PhotoEditorView(Context context) {
+        super(context);
+    }
+
+    public PhotoEditorView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+        this.setOnClickListener(this);
+    }
+
+    /** {@inheritDoc} */
+    public void onClick(View v) {
+        if (mListener != null) {
+            mListener.onRequest(EditorListener.REQUEST_PICK_PHOTO);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void onFieldChanged(String column, String value) {
+        throw new UnsupportedOperationException("Photos don't support direct field changes");
+    }
+
+    /** {@inheritDoc} */
+    public void setValues(DataKind kind, ValuesDelta values, EntityDelta state, boolean readOnly,
+            ViewIdGenerator vig) {
+        mEntry = values;
+        mReadOnly = readOnly;
+
+        setId(vig.getId(state, kind, values, 0));
+
+        if (values != null) {
+            // Try decoding photo if actual entry
+            final byte[] photoBytes = values.getAsByteArray(Photo.PHOTO);
+            if (photoBytes != null) {
+                final Bitmap photo = BitmapFactory.decodeByteArray(photoBytes, 0,
+                        photoBytes.length);
+
+                setScaleType(ImageView.ScaleType.CENTER_CROP);
+                setImageBitmap(photo);
+                setEnabled(true);
+                mHasSetPhoto = true;
+                mEntry.setFromTemplate(false);
+            } else {
+                resetDefault();
+            }
+        } else {
+            resetDefault();
+        }
+    }
+
+    /**
+     * Return true if a valid {@link Photo} has been set.
+     */
+    public boolean hasSetPhoto() {
+        return mHasSetPhoto;
+    }
+
+    /**
+     * Assign the given {@link Bitmap} as the new value, updating UI and
+     * readying for persisting through {@link ValuesDelta}.
+     */
+    public void setPhotoBitmap(Bitmap photo) {
+        if (photo == null) {
+            // Clear any existing photo and return
+            mEntry.put(Photo.PHOTO, (byte[])null);
+            resetDefault();
+            return;
+        }
+
+        final int size = photo.getWidth() * photo.getHeight() * 4;
+        final ByteArrayOutputStream out = new ByteArrayOutputStream(size);
+
+        try {
+            photo.compress(Bitmap.CompressFormat.PNG, 100, out);
+            out.flush();
+            out.close();
+
+            mEntry.put(Photo.PHOTO, out.toByteArray());
+            setImageBitmap(photo);
+            setEnabled(true);
+            mHasSetPhoto = true;
+            mEntry.setFromTemplate(false);
+
+            // When the user chooses a new photo mark it as super primary
+            mEntry.put(Photo.IS_SUPER_PRIMARY, 1);
+        } catch (IOException e) {
+            Log.w(TAG, "Unable to serialize photo: " + e.toString());
+        }
+    }
+
+    /**
+     * Set the super primary bit on the photo.
+     */
+    public void setSuperPrimary(boolean superPrimary) {
+        mEntry.put(Photo.IS_SUPER_PRIMARY, superPrimary ? 1 : 0);
+    }
+
+    protected void resetDefault() {
+        // Invalid photo, show default "add photo" place-holder
+        setScaleType(ImageView.ScaleType.CENTER);
+        if (mReadOnly) {
+            setImageResource(R.drawable.ic_contact_picture);
+            setEnabled(false);
+        } else {
+            setImageResource(R.drawable.ic_menu_add_picture);
+            setEnabled(true);
+        }
+        mHasSetPhoto = false;
+        mEntry.setFromTemplate(true);
+    }
+
+    /** {@inheritDoc} */
+    public void setEditorListener(EditorListener listener) {
+        mListener = listener;
+    }
+
+    @Override
+    public void setDeletable(boolean deletable) {
+        // Photo is not deletable
+    }
+}
diff --git a/src/com/android/contacts/views/editor/PickPhotoDialogFragment.java b/src/com/android/contacts/views/editor/PickPhotoDialogFragment.java
new file mode 100644
index 0000000..5f3dfd1
--- /dev/null
+++ b/src/com/android/contacts/views/editor/PickPhotoDialogFragment.java
@@ -0,0 +1,75 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.views.editor;
+
+import com.android.contacts.R;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.app.Fragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.widget.ArrayAdapter;
+import android.widget.ListAdapter;
+
+/**
+ * Shows a dialog asking the user whether to take a photo or pick a photo from the gallery.
+ * The result is passed back to the Fragment that is configured by
+ * {@link Fragment#setTargetFragment(Fragment, int)}, which
+ * has to implement {@link PickPhotoDialogFragment.Listener}.
+ * Does not perform any action by itself.
+ */
+public class PickPhotoDialogFragment extends DialogFragment {
+    public static final String TAG = "PickPhotoDialogFragment";
+
+    public PickPhotoDialogFragment() {
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        String[] choices = new String[2];
+        choices[0] = getActivity().getString(R.string.take_photo);
+        choices[1] = getActivity().getString(R.string.pick_photo);
+        final ListAdapter adapter = new ArrayAdapter<String>(getActivity(),
+                android.R.layout.select_dialog_item, choices);
+
+        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+        builder.setTitle(R.string.attachToContact);
+        builder.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                dialog.dismiss();
+                final Listener targetListener = (Listener) getTargetFragment();
+                switch(which) {
+                    case 0:
+                        targetListener.onTakePhotoChosen();
+                        break;
+                    case 1:
+                        targetListener.onPickFromGalleryChosen();
+                        break;
+                }
+            }
+        });
+        return builder.create();
+    }
+
+    public interface Listener {
+        void onTakePhotoChosen();
+        void onPickFromGalleryChosen();
+    }
+}
diff --git a/src/com/android/contacts/views/editor/RawContactEditorView.java b/src/com/android/contacts/views/editor/RawContactEditorView.java
new file mode 100644
index 0000000..f9fe55d
--- /dev/null
+++ b/src/com/android/contacts/views/editor/RawContactEditorView.java
@@ -0,0 +1,271 @@
+/*
+ * Copyright (C) 2009 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.contacts.views.editor;
+
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.EntityModifier;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+
+import android.content.Context;
+import android.content.Entity;
+import android.database.Cursor;
+import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.RawContacts;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.provider.ContactsContract.CommonDataKinds.StructuredName;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.PopupMenu;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+
+/**
+ * Custom view that provides all the editor interaction for a specific
+ * {@link Contacts} represented through an {@link EntityDelta}. Callers can
+ * reuse this view and quickly rebuild its contents through
+ * {@link #setState(EntityDelta, BaseAccountType, ViewIdGenerator)}.
+ * <p>
+ * Internal updates are performed against {@link ValuesDelta} so that the
+ * source {@link Entity} can be swapped out. Any state-based changes, such as
+ * adding {@link Data} rows or changing {@link EditType}, are performed through
+ * {@link EntityModifier} to ensure that {@link BaseAccountType} are enforced.
+ */
+public class RawContactEditorView extends BaseRawContactEditorView {
+    private View mPhotoStub;
+    private FieldEditorView mName;
+    private GroupMembershipView mGroupMembershipView;
+
+    private ViewGroup mFields;
+
+    private View mHeader;
+    private View mBody;
+    private ImageView mHeaderIcon;
+    private TextView mHeaderAccountType;
+    private TextView mHeaderAccountName;
+
+    private Button mAddFieldButton;
+    private boolean mExpanded = true;
+
+    private long mRawContactId = -1;
+
+    public RawContactEditorView(Context context) {
+        super(context);
+    }
+
+    public RawContactEditorView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+
+        mInflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+        mPhoto = (PhotoEditorView)findViewById(R.id.edit_photo);
+        mPhotoStub = findViewById(R.id.stub_photo);
+
+        final int photoSize = getResources().getDimensionPixelSize(R.dimen.edit_photo_size);
+
+        mName = (FieldEditorView)findViewById(R.id.edit_name);
+        mName.setMinimumHeight(photoSize);
+        mName.setDeletable(false);
+
+        mFields = (ViewGroup)findViewById(R.id.sect_fields);
+
+        mHeader = findViewById(R.id.header);
+        mBody = findViewById(R.id.body);
+        mHeader.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                setExpanded(!mExpanded);
+            }
+        });
+        mHeaderIcon = (ImageView) findViewById(R.id.header_icon);
+        mHeaderAccountType = (TextView) findViewById(R.id.header_account_type);
+        mHeaderAccountName = (TextView) findViewById(R.id.header_account_name);
+
+        mAddFieldButton = (Button) findViewById(R.id.button_add_field);
+        mAddFieldButton.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                showAddInformationPopupWindow();
+            }
+        });
+    }
+
+    /**
+     * Set the internal state for this view, given a current
+     * {@link EntityDelta} state and the {@link BaseAccountType} that
+     * apply to that state.
+     */
+    @Override
+    public void setState(EntityDelta state, BaseAccountType source, ViewIdGenerator vig) {
+        // Remove any existing sections
+        mFields.removeAllViews();
+
+        // Bail if invalid state or source
+        if (state == null || source == null) return;
+
+        setId(vig.getId(state, null, null, ViewIdGenerator.NO_VIEW_INDEX));
+
+        // Make sure we have StructuredName
+        EntityModifier.ensureKindExists(state, source, StructuredName.CONTENT_ITEM_TYPE);
+
+        // Fill in the header info
+        ValuesDelta values = state.getValues();
+        String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
+        CharSequence accountType = source.getDisplayLabel(mContext);
+        if (TextUtils.isEmpty(accountType)) {
+            accountType = mContext.getString(R.string.account_phone);
+        }
+        if (!TextUtils.isEmpty(accountName)) {
+            mHeaderAccountName.setText(
+                    mContext.getString(R.string.from_account_format, accountName));
+        }
+        mHeaderAccountType.setText(mContext.getString(R.string.account_type_format, accountType));
+        mHeaderIcon.setImageDrawable(source.getDisplayIcon(mContext));
+
+        mRawContactId = values.getAsLong(RawContacts._ID);
+
+        // Show photo editor when supported
+        EntityModifier.ensureKindExists(state, source, Photo.CONTENT_ITEM_TYPE);
+        mHasPhotoEditor = (source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null);
+        mPhoto.setVisibility(mHasPhotoEditor ? View.VISIBLE : View.GONE);
+        mPhoto.setEnabled(true);
+        mName.setEnabled(true);
+
+        // Show and hide the appropriate views
+        mFields.setVisibility(View.VISIBLE);
+        mName.setVisibility(View.VISIBLE);
+
+        DataKind groupMembershipKind = source.getKindForMimetype(GroupMembership.CONTENT_ITEM_TYPE);
+        if (groupMembershipKind != null) {
+            mGroupMembershipView = (GroupMembershipView)mInflater.inflate(
+                    R.layout.item_group_membership, mFields, false);
+            mGroupMembershipView.setKind(groupMembershipKind);
+        }
+
+        // Create editor sections for each possible data kind
+        for (DataKind kind : source.getSortedDataKinds()) {
+            // Skip kind of not editable
+            if (!kind.editable) continue;
+
+            final String mimeType = kind.mimeType;
+            if (StructuredName.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                // Handle special case editor for structured name
+                final ValuesDelta primary = state.getPrimaryEntry(mimeType);
+                mName.setValues(kind, primary, state, false, vig);
+            } else if (Photo.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                // Handle special case editor for photos
+                final ValuesDelta primary = state.getPrimaryEntry(mimeType);
+                mPhoto.setValues(kind, primary, state, false, vig);
+                mPhotoStub.setVisibility(View.VISIBLE);
+            } else if (GroupMembership.CONTENT_ITEM_TYPE.equals(mimeType)) {
+                if (mGroupMembershipView != null) {
+                    mGroupMembershipView.setState(state);
+                }
+            } else {
+                // Otherwise use generic section-based editors
+                if (kind.fieldList == null) continue;
+                final KindSectionView section = (KindSectionView)mInflater.inflate(
+                        R.layout.item_kind_section, mFields, false);
+                section.setState(kind, state, false, vig);
+                mFields.addView(section);
+            }
+        }
+
+        if (mGroupMembershipView != null) {
+            mFields.addView(mGroupMembershipView);
+        }
+    }
+
+    @Override
+    public void setGroupMetaData(Cursor groupMetaData) {
+        if (mGroupMembershipView != null) {
+            mGroupMembershipView.setGroupMetaData(groupMetaData);
+        }
+    }
+
+    public FieldEditorView getNameEditor() {
+        return mName;
+    }
+
+    @Override
+    public long getRawContactId() {
+        return mRawContactId;
+    }
+
+    /* package */ void setExpanded(boolean value) {
+        // only allow collapsing if we are one of several children
+        final boolean newValue;
+        if (getParent() instanceof ViewGroup && ((ViewGroup) getParent()).getChildCount() == 1) {
+            newValue = true;
+        } else {
+            newValue = value;
+        }
+
+        if (newValue == mExpanded) return;
+        mExpanded = newValue;
+        mBody.setVisibility(newValue ? View.VISIBLE : View.GONE);
+    }
+
+    private void showAddInformationPopupWindow() {
+        final ArrayList<KindSectionView> fields =
+                new ArrayList<KindSectionView>(mFields.getChildCount());
+
+        final PopupMenu popupMenu = new PopupMenu(getContext(), mAddFieldButton);
+        final Menu menu = popupMenu.getMenu();
+        for (int i = 0; i < mFields.getChildCount(); i++) {
+            View child = mFields.getChildAt(i);
+            if (child instanceof KindSectionView) {
+                final KindSectionView sectionView = (KindSectionView) child;
+                // not a list and already exists? ignore
+                if (!sectionView.getKind().isList && sectionView.getEditorCount() != 0) {
+                    continue;
+                }
+                menu.add(Menu.NONE, fields.size(), Menu.NONE, sectionView.getTitle());
+                fields.add(sectionView);
+            }
+        }
+        popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
+            @Override
+            public boolean onMenuItemClick(MenuItem item) {
+                final KindSectionView view = fields.get(item.getItemId());
+                view.addItem();
+                return true;
+            }
+        });
+
+        popupMenu.show();
+    }
+}
diff --git a/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java b/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java
new file mode 100644
index 0000000..bf3d811
--- /dev/null
+++ b/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2009 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.contacts.views.editor;
+
+import com.android.contacts.ContactsUtils;
+import com.android.contacts.R;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.android.contacts.model.EntityModifier;
+
+import android.content.Context;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.provider.ContactsContract.CommonDataKinds.StructuredName;
+import android.provider.ContactsContract.RawContacts;
+import android.telephony.PhoneNumberUtils;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+
+/**
+ * Custom view that displays read-only contacts in the edit screen.
+ */
+class ReadOnlyRawContactEditorView extends BaseRawContactEditorView {
+
+    private View mPhotoStub;
+    private TextView mName;
+    private TextView mReadOnlyWarning;
+    private ViewGroup mGeneral;
+
+    private View mHeaderColorBar;
+    private View mSideBar;
+    private ImageView mHeaderIcon;
+    private TextView mHeaderAccountType;
+    private TextView mHeaderAccountName;
+
+    private long mRawContactId = -1;
+
+    public ReadOnlyRawContactEditorView(Context context) {
+        super(context);
+    }
+
+    public ReadOnlyRawContactEditorView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+
+        mInflater = (LayoutInflater)getContext().getSystemService(
+                Context.LAYOUT_INFLATER_SERVICE);
+
+        mPhoto = (PhotoEditorView)findViewById(R.id.edit_photo);
+        mPhotoStub = findViewById(R.id.stub_photo);
+
+        mName = (TextView) findViewById(R.id.read_only_name);
+        mReadOnlyWarning = (TextView) findViewById(R.id.read_only_warning);
+        mGeneral = (ViewGroup)findViewById(R.id.sect_general);
+
+        mHeaderColorBar = findViewById(R.id.header_color_bar);
+        mSideBar = findViewById(R.id.color_bar);
+        mHeaderIcon = (ImageView) findViewById(R.id.header_icon);
+        mHeaderAccountType = (TextView) findViewById(R.id.header_account_type);
+        mHeaderAccountName = (TextView) findViewById(R.id.header_account_name);
+    }
+
+    /**
+     * Set the internal state for this view, given a current
+     * {@link EntityDelta} state and the {@link BaseAccountType} that
+     * apply to that state.
+     *
+     * TODO: make this more generic using data from the source
+     */
+    @Override
+    public void setState(EntityDelta state, BaseAccountType source, ViewIdGenerator vig) {
+        // Remove any existing sections
+        mGeneral.removeAllViews();
+
+        // Bail if invalid state or source
+        if (state == null || source == null) return;
+
+        // Make sure we have StructuredName
+        EntityModifier.ensureKindExists(state, source, StructuredName.CONTENT_ITEM_TYPE);
+
+        // Fill in the header info
+        ValuesDelta values = state.getValues();
+        String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
+        CharSequence accountType = source.getDisplayLabel(mContext);
+        if (TextUtils.isEmpty(accountType)) {
+            accountType = mContext.getString(R.string.account_phone);
+        }
+        if (!TextUtils.isEmpty(accountName)) {
+            mHeaderAccountName.setText(
+                    mContext.getString(R.string.from_account_format, accountName));
+        }
+        mHeaderAccountType.setText(mContext.getString(R.string.account_type_format, accountType));
+        mHeaderIcon.setImageDrawable(source.getDisplayIcon(mContext));
+
+        mRawContactId = values.getAsLong(RawContacts._ID);
+
+        ValuesDelta primary;
+
+        // Photo
+        DataKind kind = source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE);
+        if (kind != null) {
+            EntityModifier.ensureKindExists(state, source, Photo.CONTENT_ITEM_TYPE);
+            mHasPhotoEditor = (source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null);
+            primary = state.getPrimaryEntry(Photo.CONTENT_ITEM_TYPE);
+            mPhoto.setValues(kind, primary, state, source.readOnly, vig);
+            if (!mHasPhotoEditor || !mPhoto.hasSetPhoto()) {
+                mPhotoStub.setVisibility(View.GONE);
+            } else {
+                mPhotoStub.setVisibility(View.VISIBLE);
+            }
+        } else {
+            mPhotoStub.setVisibility(View.VISIBLE);
+        }
+
+        // Name
+        primary = state.getPrimaryEntry(StructuredName.CONTENT_ITEM_TYPE);
+        mName.setText(primary.getAsString(StructuredName.DISPLAY_NAME));
+
+        // Read only warning
+        mReadOnlyWarning.setText(mContext.getString(R.string.contact_read_only, accountType));
+
+        // Phones
+        ArrayList<ValuesDelta> phones = state.getMimeEntries(Phone.CONTENT_ITEM_TYPE);
+        if (phones != null) {
+            for (ValuesDelta phone : phones) {
+                View field = mInflater.inflate(
+                        R.layout.item_read_only_field, mGeneral, false);
+                TextView v;
+                v = (TextView) field.findViewById(R.id.label);
+                v.setText(mContext.getText(R.string.phoneLabelsGroup));
+                v = (TextView) field.findViewById(R.id.data);
+                v.setText(PhoneNumberUtils.formatNumber(phone.getAsString(Phone.NUMBER),
+                        phone.getAsString(Phone.NORMALIZED_NUMBER),
+                        ContactsUtils.getCurrentCountryIso(getContext())));
+                mGeneral.addView(field);
+            }
+        }
+
+        // Emails
+        ArrayList<ValuesDelta> emails = state.getMimeEntries(Email.CONTENT_ITEM_TYPE);
+        if (emails != null) {
+            for (ValuesDelta email : emails) {
+                View field = mInflater.inflate(
+                        R.layout.item_read_only_field, mGeneral, false);
+                TextView v;
+                v = (TextView) field.findViewById(R.id.label);
+                v.setText(mContext.getText(R.string.emailLabelsGroup));
+                v = (TextView) field.findViewById(R.id.data);
+                v.setText(email.getAsString(Email.DATA));
+                mGeneral.addView(field);
+            }
+        }
+
+        // Hide mGeneral if it's empty
+        if (mGeneral.getChildCount() > 0) {
+            mGeneral.setVisibility(View.VISIBLE);
+        } else {
+            mGeneral.setVisibility(View.GONE);
+        }
+    }
+
+    @Override
+    public long getRawContactId() {
+        return mRawContactId;
+    }
+}
diff --git a/src/com/android/contacts/views/editor/SelectAccountDialogFragment.java b/src/com/android/contacts/views/editor/SelectAccountDialogFragment.java
new file mode 100644
index 0000000..32e88d8
--- /dev/null
+++ b/src/com/android/contacts/views/editor/SelectAccountDialogFragment.java
@@ -0,0 +1,99 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.views.editor;
+
+import com.android.contacts.R;
+import com.android.contacts.util.AccountsListAdapter;
+
+import android.accounts.Account;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.app.Fragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+
+/**
+ * Shows a dialog asking the user which account to chose.
+ * The result is passed back to the Fragment that is configured by
+ * {@link Fragment#setTargetFragment(Fragment, int)}, which has to implement
+ * {@link SelectAccountDialogFragment.Listener}.
+ * Does not perform any action by itself.
+ */
+public class SelectAccountDialogFragment extends DialogFragment {
+    public static final String TAG = "SelectAccountDialogFragment";
+    private static final String IS_NEW_CONTACT = "IS_NEW_CONTACT";
+
+    private boolean mIsNewContact;
+
+    public SelectAccountDialogFragment() {
+    }
+
+    public SelectAccountDialogFragment(boolean isNewContact) {
+        mIsNewContact = isNewContact;
+    }
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        if (savedInstanceState != null) {
+            mIsNewContact = savedInstanceState.getBoolean(IS_NEW_CONTACT);
+        }
+    }
+
+    @Override
+    public void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        outState.putBoolean(IS_NEW_CONTACT, mIsNewContact);
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+
+        final AccountsListAdapter accountAdapter = new AccountsListAdapter(builder.getContext(),
+                true);
+
+        final DialogInterface.OnClickListener clickListener =
+                new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                dialog.dismiss();
+
+                final Listener target = (Listener) getTargetFragment();
+                target.onAccountChosen(accountAdapter.getItem(which), mIsNewContact);
+            }
+        };
+
+        builder.setTitle(R.string.dialog_new_contact_account);
+        builder.setSingleChoiceItems(accountAdapter, 0, clickListener);
+        final AlertDialog result = builder.create();
+        return result;
+    }
+
+    @Override
+    public void onCancel(DialogInterface dialog) {
+        super.onCancel(dialog);
+        final Listener target = (Listener) getTargetFragment();
+        target.onAccountSelectorCancelled();
+    }
+
+    public interface Listener {
+        void onAccountChosen(Account account, boolean isNewContact);
+        void onAccountSelectorCancelled();
+    }
+}
diff --git a/src/com/android/contacts/views/editor/SplitContactConfirmationDialogFragment.java b/src/com/android/contacts/views/editor/SplitContactConfirmationDialogFragment.java
new file mode 100644
index 0000000..ee5dba3
--- /dev/null
+++ b/src/com/android/contacts/views/editor/SplitContactConfirmationDialogFragment.java
@@ -0,0 +1,61 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.views.editor;
+
+import com.android.contacts.R;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.app.Fragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+
+/**
+ * Shows a dialog asking the user whether to split the contact. The result is passed back
+ * to the Fragment that is configured by {@link Fragment#setTargetFragment(Fragment, int)}, which
+ * has to implement {@link SplitContactConfirmationDialogFragment.Listener}.
+ * Does not split the contact itself.
+ */
+public class SplitContactConfirmationDialogFragment extends DialogFragment {
+    public static final String TAG = "SplitContactConfirmationDialog";
+
+    public SplitContactConfirmationDialogFragment() {
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+        builder.setTitle(R.string.splitConfirmation_title);
+        builder.setIcon(android.R.drawable.ic_dialog_alert);
+        builder.setMessage(R.string.splitConfirmation);
+        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                final Listener targetListener = (Listener) getTargetFragment();
+                targetListener.onSplitContactConfirmed();
+            }
+        });
+        builder.setNegativeButton(android.R.string.cancel, null);
+        builder.setCancelable(false);
+        return builder.create();
+    }
+
+    public interface Listener {
+        void onSplitContactConfirmed();
+    }
+}
diff --git a/src/com/android/contacts/views/editor/ViewIdGenerator.java b/src/com/android/contacts/views/editor/ViewIdGenerator.java
new file mode 100644
index 0000000..6cef706
--- /dev/null
+++ b/src/com/android/contacts/views/editor/ViewIdGenerator.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2009 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.contacts.views.editor;
+
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * A class that provides unique view ids for {@link ContentEditorView}, {@link KindSectionView},
+ * {@link FieldEditorView} and {@link EditView} on {@link EditContactActivity}.
+ * It is used to assign a unique but consistent id to each view across {@link EditContactActivity}'s
+ * lifecycle, so that we can re-construct view state (e.g. focused view) when the screen rotates.
+ *
+ * <p>This class is not thread safe.
+ */
+public final class ViewIdGenerator implements Parcelable {
+    private static final int INVALID_VIEW_ID = 0;
+    private static final int INITIAL_VIEW_ID = 1;
+
+    public static final int NO_VIEW_INDEX = -1;
+
+    private int mNextId;
+
+    /**
+     * Used as a map from the "key" of the views to actual ids.  {@link #getId()} generates keys for
+     * the views.
+     */
+    private Bundle mIdMap = new Bundle();
+
+    private static final char KEY_SEPARATOR = '*';
+
+    private final static StringBuilder sWorkStringBuilder = new StringBuilder();
+
+    public ViewIdGenerator() {
+        mNextId = INITIAL_VIEW_ID;
+    }
+
+    /** {@inheritDoc} */
+    public int describeContents() {
+        return 0;
+    }
+
+    /**
+     * Returns an id for a view associated with specified contact field.
+     *
+     * @param entity {@link EntityDelta} associated with the view
+     * @param kind {@link DataKind} associated with the view, or null if none exists.
+     * @param values {@link ValuesDelta} associated with the view, or null if none exists.
+     * @param viewIndex index of the view in the parent {@link Editor}, if it's a leave view.
+     *     Otherwise, pass {@link #NO_VIEW_INDEX}.
+     */
+    public int getId(EntityDelta entity, DataKind kind, ValuesDelta values,
+            int viewIndex) {
+        final String k = getMapKey(entity, kind, values, viewIndex);
+
+        int id = mIdMap.getInt(k, INVALID_VIEW_ID);
+        if (id == INVALID_VIEW_ID) {
+            // Make sure the new id won't conflict with auto-generated ids by masking with 0xffff.
+            id = (mNextId++) & 0xFFFF;
+            mIdMap.putInt(k, id);
+        }
+        return id;
+    }
+
+    private static String getMapKey(EntityDelta entity, DataKind kind, ValuesDelta values,
+            int viewIndex) {
+        sWorkStringBuilder.setLength(0);
+        if (entity != null) {
+            sWorkStringBuilder.append(entity.getValues().getId());
+
+            if (kind != null) {
+                sWorkStringBuilder.append(KEY_SEPARATOR);
+                sWorkStringBuilder.append(kind.mimeType);
+
+                if (values != null) {
+                    sWorkStringBuilder.append(KEY_SEPARATOR);
+                    sWorkStringBuilder.append(values.getId());
+
+                    if (viewIndex != NO_VIEW_INDEX) {
+                        sWorkStringBuilder.append(KEY_SEPARATOR);
+                        sWorkStringBuilder.append(viewIndex);
+                    }
+                }
+            }
+        }
+        return sWorkStringBuilder.toString();
+    }
+
+    /** {@Override} */
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeInt(mNextId);
+        dest.writeBundle(mIdMap);
+    }
+
+    private void readFromParcel(Parcel src) {
+        mNextId = src.readInt();
+        mIdMap = src.readBundle();
+    }
+
+    public static final Parcelable.Creator<ViewIdGenerator> CREATOR =
+            new Parcelable.Creator<ViewIdGenerator>() {
+        public ViewIdGenerator createFromParcel(Parcel in) {
+            final ViewIdGenerator vig = new ViewIdGenerator();
+            vig.readFromParcel(in);
+            return vig;
+        }
+
+        public ViewIdGenerator[] newArray(int size) {
+            return new ViewIdGenerator[size];
+        }
+    };
+}
diff --git a/src/com/android/contacts/widget/CompositeListAdapter.java b/src/com/android/contacts/widget/CompositeListAdapter.java
new file mode 100644
index 0000000..bd0c8d6
--- /dev/null
+++ b/src/com/android/contacts/widget/CompositeListAdapter.java
@@ -0,0 +1,222 @@
+/*
+ * 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.
+ */
+package com.android.contacts.widget;
+
+import android.database.DataSetObserver;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ListAdapter;
+
+/**
+ * A general purpose adapter that is composed of multiple sub-adapters. It just
+ * appends them in the order they are added. It listens to changes from all
+ * sub-adapters and propagates them to its own listeners.
+ */
+public class CompositeListAdapter extends BaseAdapter {
+
+    private static final int INITIAL_CAPACITY = 2;
+
+    private ListAdapter[] mAdapters;
+    private int[] mCounts;
+    private int[] mViewTypeCounts;
+    private int mSize = 0;
+    private int mCount = 0;
+    private int mViewTypeCount = 0;
+    private boolean mAllItemsEnabled = true;
+    private boolean mCacheValid = true;
+
+    private DataSetObserver mDataSetObserver = new DataSetObserver() {
+
+        @Override
+        public void onChanged() {
+            invalidate();
+            notifyDataChanged();
+        }
+
+        @Override
+        public void onInvalidated() {
+            invalidate();
+            notifyDataChanged();
+        }
+    };
+
+    public CompositeListAdapter() {
+        this(INITIAL_CAPACITY);
+    }
+
+    public CompositeListAdapter(int initialCapacity) {
+        mAdapters = new ListAdapter[INITIAL_CAPACITY];
+        mCounts = new int[INITIAL_CAPACITY];
+        mViewTypeCounts = new int[INITIAL_CAPACITY];
+    }
+
+    public void addAdapter(ListAdapter adapter) {
+        if (mSize >= mAdapters.length) {
+            int newCapacity = mSize + 2;
+            ListAdapter[] newAdapters = new ListAdapter[newCapacity];
+            System.arraycopy(mAdapters, 0, newAdapters, 0, mSize);
+            mAdapters = newAdapters;
+
+            int[] newCounts = new int[newCapacity];
+            System.arraycopy(mCounts, 0, newCounts, 0, mSize);
+            mCounts = newCounts;
+
+            int[] newViewTypeCounts = new int[newCapacity];
+            System.arraycopy(mViewTypeCounts, 0, newViewTypeCounts, 0, mSize);
+            mViewTypeCounts = newViewTypeCounts;
+        }
+
+        adapter.registerDataSetObserver(mDataSetObserver);
+
+        int count = adapter.getCount();
+        int viewTypeCount = adapter.getViewTypeCount();
+
+        mAdapters[mSize] = adapter;
+        mCounts[mSize] = count;
+        mCount += count;
+        mAllItemsEnabled &= adapter.areAllItemsEnabled();
+        mViewTypeCounts[mSize] = viewTypeCount;
+        mViewTypeCount += viewTypeCount;
+        mSize++;
+
+        notifyDataChanged();
+    }
+
+    protected void notifyDataChanged() {
+        if (getCount() > 0) {
+            notifyDataSetChanged();
+        } else {
+            notifyDataSetInvalidated();
+        }
+    }
+
+    protected void invalidate() {
+        mCacheValid = false;
+    }
+
+    protected void ensureCacheValid() {
+        if (mCacheValid) {
+            return;
+        }
+
+        mCount = 0;
+        mAllItemsEnabled = true;
+        mViewTypeCount = 0;
+        for (int i = 0; i < mSize; i++) {
+            int count = mAdapters[i].getCount();
+            int viewTypeCount = mAdapters[i].getViewTypeCount();
+            mCounts[i] = count;
+            mCount += count;
+            mAllItemsEnabled &= mAdapters[i].areAllItemsEnabled();
+            mViewTypeCount += viewTypeCount;
+        }
+
+        mCacheValid = true;
+    }
+
+    public int getCount() {
+        ensureCacheValid();
+        return mCount;
+    }
+
+    public Object getItem(int position) {
+        ensureCacheValid();
+        int start = 0;
+        for (int i = 0; i < mCounts.length; i++) {
+            int end = start + mCounts[i];
+            if (position >= start && position < end) {
+                return mAdapters[i].getItem(position - start);
+            }
+            start = end;
+        }
+
+        throw new ArrayIndexOutOfBoundsException(position);
+    }
+
+    public long getItemId(int position) {
+        ensureCacheValid();
+        int start = 0;
+        for (int i = 0; i < mCounts.length; i++) {
+            int end = start + mCounts[i];
+            if (position >= start && position < end) {
+                return mAdapters[i].getItemId(position - start);
+            }
+            start = end;
+        }
+
+        throw new ArrayIndexOutOfBoundsException(position);
+    }
+
+    @Override
+    public int getViewTypeCount() {
+        ensureCacheValid();
+        return mViewTypeCount;
+    }
+
+    @Override
+    public int getItemViewType(int position) {
+        ensureCacheValid();
+        int start = 0;
+        int viewTypeOffset = 0;
+        for (int i = 0; i < mCounts.length; i++) {
+            int end = start + mCounts[i];
+            if (position >= start && position < end) {
+                return viewTypeOffset + mAdapters[i].getItemViewType(position - start);
+            }
+            viewTypeOffset += mViewTypeCounts[i];
+            start = end;
+        }
+
+        throw new ArrayIndexOutOfBoundsException(position);
+    }
+
+    public View getView(int position, View convertView, ViewGroup parent) {
+        ensureCacheValid();
+        int start = 0;
+        for (int i = 0; i < mCounts.length; i++) {
+            int end = start + mCounts[i];
+            if (position >= start && position < end) {
+                return mAdapters[i].getView(position - start, convertView, parent);
+            }
+            start = end;
+        }
+
+        throw new ArrayIndexOutOfBoundsException(position);
+    }
+
+    @Override
+    public boolean areAllItemsEnabled() {
+        ensureCacheValid();
+        return mAllItemsEnabled;
+    }
+
+    @Override
+    public boolean isEnabled(int position) {
+        ensureCacheValid();
+        int start = 0;
+        for (int i = 0; i < mCounts.length; i++) {
+            int end = start + mCounts[i];
+            if (position >= start && position < end) {
+                return mAdapters[i].areAllItemsEnabled()
+                        || mAdapters[i].isEnabled(position - start);
+            }
+            start = end;
+        }
+
+        throw new ArrayIndexOutOfBoundsException(position);
+    }
+}
diff --git a/src/com/android/contacts/widget/ContextMenuAdapter.java b/src/com/android/contacts/widget/ContextMenuAdapter.java
new file mode 100644
index 0000000..660274a
--- /dev/null
+++ b/src/com/android/contacts/widget/ContextMenuAdapter.java
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+package com.android.contacts.widget;
+
+import android.view.MenuItem;
+import android.view.View;
+
+/**
+ * An adapter for the contextual menu.
+ */
+public interface ContextMenuAdapter extends View.OnCreateContextMenuListener {
+
+    /**
+     * See {@link android.app.Activity#onContextItemSelected}.
+     */
+    boolean onContextItemSelected(MenuItem item);
+}
diff --git a/src/com/android/contacts/widget/IndexerListAdapter.java b/src/com/android/contacts/widget/IndexerListAdapter.java
new file mode 100644
index 0000000..b26c2dc
--- /dev/null
+++ b/src/com/android/contacts/widget/IndexerListAdapter.java
@@ -0,0 +1,226 @@
+/*
+ * 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.
+ */
+package com.android.contacts.widget;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ListView;
+import android.widget.SectionIndexer;
+import android.widget.TextView;
+
+/**
+ * A list adapter that supports section indexer and a pinned header.
+ */
+public abstract class IndexerListAdapter extends PinnedHeaderListAdapter implements SectionIndexer {
+
+    private final int mSectionHeaderTextViewId;
+    private final int mSectionHeaderLayoutResId;
+
+    protected Context mContext;
+    private SectionIndexer mIndexer;
+    private int mIndexedPartition = 0;
+    private boolean mSectionHeaderDisplayEnabled;
+    private View mHeader;
+    private TextView mTitleView;
+
+    /**
+     * An item view is displayed differently depending on whether it is placed
+     * at the beginning, middle or end of a section. It also needs to know the
+     * section header when it is at the beginning of a section. This object
+     * captures all this configuration.
+     */
+    public static final class Placement {
+        private int position = ListView.INVALID_POSITION;
+        public boolean firstInSection;
+        public boolean lastInSection;
+        public String sectionHeader;
+
+        public void invalidate() {
+            position = ListView.INVALID_POSITION;
+        }
+    }
+
+    private Placement mPlacementCache = new Placement();
+
+    /**
+     * Constructor.
+     *
+     * @param context
+     * @param sectionHeaderLayoutResourceId section header layout resource ID
+     * @param sectionHeaderTextViewId section header text view ID
+     */
+    public IndexerListAdapter(Context context, int sectionHeaderLayoutResourceId,
+            int sectionHeaderTextViewId) {
+        super(context);
+        mContext = context;
+        mSectionHeaderLayoutResId = sectionHeaderLayoutResourceId;
+        mSectionHeaderTextViewId = sectionHeaderTextViewId;
+    }
+
+    public boolean isSectionHeaderDisplayEnabled() {
+        return mSectionHeaderDisplayEnabled;
+    }
+
+    public void setSectionHeaderDisplayEnabled(boolean flag) {
+        this.mSectionHeaderDisplayEnabled = flag;
+    }
+
+    public int getIndexedPartition() {
+        return mIndexedPartition;
+    }
+
+    public void setIndexedPartition(int partition) {
+        this.mIndexedPartition = partition;
+    }
+
+    public SectionIndexer getIndexer() {
+        return mIndexer;
+    }
+
+    public void setIndexer(SectionIndexer indexer) {
+        mIndexer = indexer;
+        mPlacementCache.invalidate();
+    }
+
+    public Object[] getSections() {
+        if (mIndexer == null) {
+            return new String[] { " " };
+        } else {
+            return mIndexer.getSections();
+        }
+    }
+
+    /**
+     * @return relative position of the section in the indexed partition
+     */
+    public int getPositionForSection(int sectionIndex) {
+        if (mIndexer == null) {
+            return -1;
+        }
+
+        return mIndexer.getPositionForSection(sectionIndex);
+    }
+
+    /**
+     * @param position relative position in the indexed partition
+     */
+    public int getSectionForPosition(int position) {
+        if (mIndexer == null) {
+            return -1;
+        }
+
+        return mIndexer.getSectionForPosition(position);
+    }
+
+    @Override
+    public int getPinnedHeaderCount() {
+        if (isSectionHeaderDisplayEnabled()) {
+            return super.getPinnedHeaderCount() + 1;
+        } else {
+            return super.getPinnedHeaderCount();
+        }
+    }
+
+    @Override
+    public View getPinnedHeaderView(int viewIndex, View convertView, ViewGroup parent) {
+        if (isSectionHeaderDisplayEnabled() && viewIndex == getPinnedHeaderCount() - 1) {
+            if (mHeader == null) {
+                mHeader = LayoutInflater.from(mContext).
+                        inflate(mSectionHeaderLayoutResId, parent, false);
+                mTitleView = (TextView)mHeader.findViewById(mSectionHeaderTextViewId);
+            }
+            return mHeader;
+        } else {
+            return super.getPinnedHeaderView(viewIndex, convertView, parent);
+        }
+    }
+
+    @Override
+    public void configurePinnedHeaders(PinnedHeaderListView listView) {
+        super.configurePinnedHeaders(listView);
+
+        if (!isSectionHeaderDisplayEnabled()) {
+            return;
+        }
+
+        int index = getPinnedHeaderCount() - 1;
+        if (mIndexer == null || getCount() == 0) {
+            listView.setHeaderInvisible(index, false);
+        } else {
+            int listPosition = listView.getPositionAt(listView.getTotalTopPinnedHeaderHeight());
+            int position = listPosition - listView.getHeaderViewsCount();
+
+            int section = -1;
+            int partition = getPartitionForPosition(position);
+            if (partition == mIndexedPartition) {
+                int offset = getOffsetInPartition(position);
+                if (offset != -1) {
+                    section = getSectionForPosition(offset);
+                }
+            }
+
+            if (section == -1) {
+                listView.setHeaderInvisible(index, false);
+            } else {
+                String title = (String)mIndexer.getSections()[section];
+                mTitleView.setText(title);
+
+                // Compute the item position where the current partition begins
+                int partitionStart = getPositionForPartition(mIndexedPartition);
+                if (hasHeader(mIndexedPartition)) {
+                    partitionStart++;
+                }
+
+                // Compute the item position where the next section begins
+                int nextSectionPosition = partitionStart + getPositionForSection(section + 1);
+                boolean isLastInSection = position == nextSectionPosition - 1;
+                listView.setFadingHeader(index, listPosition, isLastInSection);
+            }
+        }
+    }
+
+    /**
+     * Computes the item's placement within its section and populates the {@code placement}
+     * object accordingly.  Please note that the returned object is volatile and should be
+     * copied if the result needs to be used later.
+     */
+    public Placement getItemPlacementInSection(int position) {
+        if (mPlacementCache.position == position) {
+            return mPlacementCache;
+        }
+
+        mPlacementCache.position = position;
+        if (isSectionHeaderDisplayEnabled()) {
+            int section = getSectionForPosition(position);
+            if (section != -1 && getPositionForSection(section) == position) {
+                mPlacementCache.firstInSection = true;
+                mPlacementCache.sectionHeader = (String)getSections()[section];
+            } else {
+                mPlacementCache.firstInSection = false;
+                mPlacementCache.sectionHeader = null;
+            }
+
+            mPlacementCache.lastInSection = (getPositionForSection(section + 1) - 1 == position);
+        } else {
+            mPlacementCache.firstInSection = false;
+            mPlacementCache.lastInSection = false;
+            mPlacementCache.sectionHeader = null;
+        }
+        return mPlacementCache;
+    }
+}
diff --git a/src/com/android/contacts/widget/InterpolatingLayout.java b/src/com/android/contacts/widget/InterpolatingLayout.java
new file mode 100644
index 0000000..012e5a2
--- /dev/null
+++ b/src/com/android/contacts/widget/InterpolatingLayout.java
@@ -0,0 +1,227 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.widget;
+
+import com.android.contacts.R;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * Layout similar to LinearLayout that allows a child to specify examples of
+ * desired size depending on the parent size. For example if the widget wants to
+ * be 100dip when parent is 200dip and 110dip when parent is 400dip, the layout
+ * will ensure these requirements and interpolate for other parent sizes.
+ * You can also specify minWidth for each child.  You can have at most one
+ * child with layout_width="match_parent" - it will take the entire remaining
+ * space.
+ */
+public class InterpolatingLayout extends ViewGroup {
+
+    public InterpolatingLayout(Context context) {
+        super(context);
+    }
+
+    public InterpolatingLayout(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public InterpolatingLayout(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    public final static class LayoutParams extends ViewGroup.MarginLayoutParams {
+
+        public int narrowParentWidth;
+        public int narrowWidth;
+        public int narrowLeftMargin;
+        public int narrowRightMargin;
+        public int wideParentWidth;
+        public int wideWidth;
+        public int wideLeftMargin;
+        public int wideRightMargin;
+        private float widthMultiplier;
+        private int widthConstant;
+        private float leftMarginMultiplier;
+        private int leftMarginConstant;
+        private float rightMarginMultiplier;
+        private int rightMarginConstant;
+
+        public LayoutParams(Context c, AttributeSet attrs) {
+            super(c, attrs);
+            TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.InterpolatingLayout_Layout);
+
+            narrowParentWidth = a.getDimensionPixelSize(
+                    R.styleable.InterpolatingLayout_Layout_layout_narrowParentWidth, -1);
+            narrowWidth = a.getDimensionPixelSize(
+                    R.styleable.InterpolatingLayout_Layout_layout_narrowWidth, -1);
+            narrowLeftMargin = a.getDimensionPixelSize(
+                    R.styleable.InterpolatingLayout_Layout_layout_narrowLeftMargin, -1);
+            narrowRightMargin = a.getDimensionPixelSize(
+                    R.styleable.InterpolatingLayout_Layout_layout_narrowRightMargin, -1);
+            wideParentWidth = a.getDimensionPixelSize(
+                    R.styleable.InterpolatingLayout_Layout_layout_wideParentWidth, -1);
+            wideWidth = a.getDimensionPixelSize(
+                    R.styleable.InterpolatingLayout_Layout_layout_wideWidth, -1);
+            wideLeftMargin = a.getDimensionPixelSize(
+                    R.styleable.InterpolatingLayout_Layout_layout_wideLeftMargin, -1);
+            wideRightMargin = a.getDimensionPixelSize(
+                    R.styleable.InterpolatingLayout_Layout_layout_wideRightMargin, -1);
+
+            a.recycle();
+
+            if (narrowWidth != -1) {
+                widthMultiplier = (float) (wideWidth - narrowWidth)
+                        / (wideParentWidth - narrowParentWidth);
+                widthConstant = (int) (narrowWidth - narrowParentWidth * widthMultiplier);
+            }
+
+            if (narrowLeftMargin != -1) {
+                leftMarginMultiplier = (float) (wideLeftMargin - narrowLeftMargin)
+                        / (wideParentWidth - narrowParentWidth);
+                leftMarginConstant = (int) (narrowLeftMargin - narrowParentWidth
+                        * leftMarginMultiplier);
+            }
+
+            if (narrowRightMargin != -1) {
+                rightMarginMultiplier = (float) (wideRightMargin - narrowRightMargin)
+                        / (wideParentWidth - narrowParentWidth);
+                rightMarginConstant = (int) (narrowRightMargin - narrowParentWidth
+                        * rightMarginMultiplier);
+            }
+        }
+
+        public LayoutParams(int width, int height) {
+            super(width, height);
+        }
+
+        public LayoutParams(MarginLayoutParams source) {
+            super(source);
+        }
+
+        public int resolveWidth(int parentSize) {
+            if (narrowWidth == -1) {
+                return width;
+            } else {
+                int w = (int) (parentSize * widthMultiplier) + widthConstant;
+                return w <= 0 ? WRAP_CONTENT : w;
+            }
+        }
+
+        public int resolveLeftMargin(int parentSize) {
+            if (narrowLeftMargin == -1) {
+                return leftMargin;
+            } else {
+                int w = (int) (parentSize * leftMarginMultiplier) + leftMarginConstant;
+                return w < 0 ? 0 : w;
+            }
+        }
+
+        public int resolveRightMargin(int parentSize) {
+            if (narrowRightMargin == -1) {
+                return rightMargin;
+            } else {
+                int w = (int) (parentSize * rightMarginMultiplier) + rightMarginConstant;
+                return w < 0 ? 0 : w;
+            }
+        }
+    }
+
+    @Override
+    public LayoutParams generateLayoutParams(AttributeSet attrs) {
+        return new LayoutParams(getContext(), attrs);
+    }
+
+    @Override
+    protected LayoutParams generateDefaultLayoutParams() {
+        return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        int mode = MeasureSpec.getMode(widthMeasureSpec);
+        int parentSize = MeasureSpec.getSize(widthMeasureSpec);
+
+        int width = 0;
+        int height = 0;
+
+        View fillChild = null;
+        int count = getChildCount();
+        for (int i = 0; i < count; i++) {
+            View child = getChildAt(i);
+            if (child.getVisibility() == View.GONE) {
+                continue;
+            }
+
+            LayoutParams params = (LayoutParams) child.getLayoutParams();
+
+            if (params.width == LayoutParams.MATCH_PARENT) {
+                if (fillChild != null) {
+                    throw new RuntimeException(
+                            "Interpolating layout allows at most one child"
+                            + " with layout_width='match_parent'");
+                }
+                fillChild = child;
+            } else {
+                int childWidth = params.resolveWidth(parentSize);
+                int childMeasureSpec = (childWidth == LayoutParams.WRAP_CONTENT)
+                        ? MeasureSpec.UNSPECIFIED
+                        : MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY);
+                child.measure(childMeasureSpec, heightMeasureSpec);
+                width += child.getMeasuredWidth();
+                height = Math.max(child.getMeasuredHeight(), height);
+            }
+
+            width += params.resolveLeftMargin(parentSize) + params.resolveRightMargin(parentSize);
+        }
+
+        if (fillChild != null) {
+            int remainder = parentSize - width;
+            int childMeasureSpec = remainder > 0
+                    ? MeasureSpec.makeMeasureSpec(remainder, MeasureSpec.EXACTLY)
+                    : MeasureSpec.UNSPECIFIED;
+            fillChild.measure(childMeasureSpec, heightMeasureSpec);
+            width += fillChild.getMeasuredWidth();
+            height = Math.max(fillChild.getMeasuredHeight(), height);
+        }
+
+        setMeasuredDimension(
+                resolveSize(width, widthMeasureSpec), resolveSize(height, heightMeasureSpec));
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+        int offset = 0;
+        int width = right - left;
+        int height = bottom - top;
+        int count = getChildCount();
+        for (int i = 0; i < count; i++) {
+            View child = getChildAt(i);
+
+            LayoutParams params = (LayoutParams) child.getLayoutParams();
+            offset += params.resolveLeftMargin(width);
+            int childWidth = child.getMeasuredWidth();
+            int childTop = params.topMargin;
+            child.layout(offset, params.topMargin, offset + childWidth,
+                    params.topMargin + child.getMeasuredHeight());
+            offset += childWidth + params.resolveRightMargin(width);
+        }
+    }
+}
diff --git a/src/com/android/contacts/widget/ListViewUtils.java b/src/com/android/contacts/widget/ListViewUtils.java
new file mode 100644
index 0000000..f5af63b
--- /dev/null
+++ b/src/com/android/contacts/widget/ListViewUtils.java
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.widget;
+
+import android.widget.ListView;
+
+/**
+ * Utility methods for working with ListView.
+ */
+public final class ListViewUtils {
+
+    /**
+     * Position the element at about 1/3 of the list height
+     */
+    private static final float PREFERRED_SELECTION_OFFSET_FROM_TOP = 0.33f;
+
+    /**
+     * Brings the specified position to view by optionally performing a jump-scroll maneuver:
+     * first it jumps to some position near the one requested and then does a smooth
+     * scroll to the requested position.  This creates an impression of full smooth
+     * scrolling without actually traversing the entire list.  If smooth scrolling is
+     * not requested, instantly positions the requested item at a preferred offset.
+     */
+    public static void requestPositionToScreen(
+            final ListView listView, final int position, boolean smoothScroll) {
+        if (!smoothScroll) {
+            final int offset = (int) (listView.getHeight() * PREFERRED_SELECTION_OFFSET_FROM_TOP);
+            listView.setSelectionFromTop(position, offset);
+            return;
+        }
+
+        listView.post(new Runnable() {
+
+            @Override
+            public void run() {
+                int firstPosition = listView.getFirstVisiblePosition() + 1;
+                int lastPosition = listView.getLastVisiblePosition();
+                if (position >= firstPosition && position <= lastPosition) {
+                    return; // Already on screen
+                }
+
+                // We will first position the list a couple of screens before or after
+                // the new selection and then scroll smoothly to it.
+                int twoScreens = (lastPosition - firstPosition) * 2;
+                int preliminaryPosition;
+                if (position < firstPosition) {
+                    preliminaryPosition = position + twoScreens;
+                    if (preliminaryPosition >= listView.getCount()) {
+                        preliminaryPosition = listView.getCount() - 1;
+                    }
+                    if (preliminaryPosition < firstPosition) {
+                        listView.setSelection(preliminaryPosition);
+                    }
+                } else {
+                    preliminaryPosition = position - twoScreens;
+                    if (preliminaryPosition < 0) {
+                        preliminaryPosition = 0;
+                    }
+                    if (preliminaryPosition > lastPosition) {
+                        listView.setSelection(preliminaryPosition);
+                    }
+                }
+
+                scrollToFinalPosition(listView, position);
+            }
+        });
+    }
+
+    private static void scrollToFinalPosition(final ListView listView, final int position) {
+        final int offset = (int) (listView.getHeight() * PREFERRED_SELECTION_OFFSET_FROM_TOP);
+        listView.post(new Runnable() {
+
+            @Override
+            public void run() {
+                listView.smoothScrollToPositionFromTop(position, offset);
+            }
+        });
+    }
+}
diff --git a/src/com/android/contacts/widget/NotifyingSpinner.java b/src/com/android/contacts/widget/NotifyingSpinner.java
new file mode 100644
index 0000000..972cb35
--- /dev/null
+++ b/src/com/android/contacts/widget/NotifyingSpinner.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.Spinner;
+
+/**
+ * Spinner that notifies a listener when the user taps on an item, whether or not this results
+ * in a change of selection.
+ */
+public class NotifyingSpinner extends Spinner {
+
+    public interface SelectionListener {
+        void onSetSelection(NotifyingSpinner view, int position);
+    }
+
+    private SelectionListener mListener;
+
+    public NotifyingSpinner(Context context) {
+        super(context);
+    }
+
+    public NotifyingSpinner(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public void setSetSelectionListener(SelectionListener listener) {
+        mListener = listener;
+    }
+
+    @Override
+    public void setSelection(int position) {
+        super.setSelection(position);
+
+        if (mListener != null) {
+            mListener.onSetSelection(this, position);
+        }
+    }
+}
diff --git a/src/com/android/contacts/widget/PinnedHeaderListAdapter.java b/src/com/android/contacts/widget/PinnedHeaderListAdapter.java
new file mode 100644
index 0000000..a4d375e
--- /dev/null
+++ b/src/com/android/contacts/widget/PinnedHeaderListAdapter.java
@@ -0,0 +1,167 @@
+/*
+ * 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.
+ */
+package com.android.contacts.widget;
+
+import com.android.common.widget.CompositeCursorAdapter;
+
+import android.content.Context;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * A subclass of {@link CompositeCursorAdapter} that manages pinned partition headers.
+ */
+public abstract class PinnedHeaderListAdapter extends CompositeCursorAdapter
+        implements PinnedHeaderListView.PinnedHeaderAdapter {
+
+    public static final int PARTITION_HEADER_TYPE = 0;
+
+    private boolean mPinnedPartitionHeadersEnabled;
+    private boolean mHeaderVisibility[];
+
+    public PinnedHeaderListAdapter(Context context) {
+        super(context);
+    }
+
+    public PinnedHeaderListAdapter(Context context, int initialCapacity) {
+        super(context, initialCapacity);
+    }
+
+    public boolean getPinnedPartitionHeadersEnabled() {
+        return mPinnedPartitionHeadersEnabled;
+    }
+
+    public void setPinnedPartitionHeadersEnabled(boolean flag) {
+        this.mPinnedPartitionHeadersEnabled = flag;
+    }
+
+    public int getPinnedHeaderCount() {
+        if (mPinnedPartitionHeadersEnabled) {
+            return getPartitionCount();
+        } else {
+            return 0;
+        }
+    }
+
+    protected boolean isPinnedPartitionHeaderVisible(int partition) {
+        return mPinnedPartitionHeadersEnabled && hasHeader(partition)
+                && !isPartitionEmpty(partition);
+    }
+
+    /**
+     * The default implementation creates the same type of view as a normal
+     * partition header.
+     */
+    public View getPinnedHeaderView(int partition, View convertView, ViewGroup parent) {
+        if (hasHeader(partition)) {
+            View view = null;
+            if (convertView != null) {
+                Integer headerType = (Integer)convertView.getTag();
+                if (headerType != null && headerType == PARTITION_HEADER_TYPE) {
+                    view = convertView;
+                }
+            }
+            if (view == null) {
+                view = newHeaderView(getContext(), partition, null, parent);
+                view.setTag(PARTITION_HEADER_TYPE);
+                view.setFocusable(false);
+                view.setEnabled(false);
+            }
+            bindHeaderView(view, partition, getCursor(partition));
+            return view;
+        } else {
+            return null;
+        }
+    }
+
+    public void configurePinnedHeaders(PinnedHeaderListView listView) {
+        if (!mPinnedPartitionHeadersEnabled) {
+            return;
+        }
+
+        int size = getPartitionCount();
+
+        // Cache visibility bits, because we will need them several times later on
+        if (mHeaderVisibility == null || mHeaderVisibility.length != size) {
+            mHeaderVisibility = new boolean[size];
+        }
+        for (int i = 0; i < size; i++) {
+            boolean visible = isPinnedPartitionHeaderVisible(i);
+            mHeaderVisibility[i] = visible;
+            if (!visible) {
+                listView.setHeaderInvisible(i, true);
+            }
+        }
+
+        int headerViewsCount = listView.getHeaderViewsCount();
+
+        // Starting at the top, find and pin headers for partitions preceding the visible one(s)
+        int maxTopHeader = -1;
+        int topHeaderHeight = 0;
+        for (int i = 0; i < size; i++) {
+            if (mHeaderVisibility[i]) {
+                int position = listView.getPositionAt(topHeaderHeight) - headerViewsCount;
+                int partition = getPartitionForPosition(position);
+                if (i > partition) {
+                    break;
+                }
+
+                listView.setHeaderPinnedAtTop(i, topHeaderHeight, false);
+                topHeaderHeight += listView.getPinnedHeaderHeight(i);
+                maxTopHeader = i;
+            }
+        }
+
+        // Starting at the bottom, find and pin headers for partitions following the visible one(s)
+        int maxBottomHeader = size;
+        int bottomHeaderHeight = 0;
+        int listHeight = listView.getHeight();
+        for (int i = size; --i > maxTopHeader;) {
+            if (mHeaderVisibility[i]) {
+                int position = listView.getPositionAt(listHeight - bottomHeaderHeight)
+                        - headerViewsCount;
+                if (position < 0) {
+                    break;
+                }
+
+                int partition = getPartitionForPosition(position - 1);
+                if (partition == -1 || i <= partition) {
+                    break;
+                }
+
+                int height = listView.getPinnedHeaderHeight(i);
+                bottomHeaderHeight += height;
+                // Animate the header only if the partition is completely invisible below
+                // the bottom of the view
+                int firstPositionForPartition = getPositionForPartition(i);
+                boolean animate = position < firstPositionForPartition;
+                listView.setHeaderPinnedAtBottom(i, listHeight - bottomHeaderHeight, animate);
+                maxBottomHeader = i;
+            }
+        }
+
+        // Headers in between the top-pinned and bottom-pinned should be hidden
+        for (int i = maxTopHeader + 1; i < maxBottomHeader; i++) {
+            if (mHeaderVisibility[i]) {
+                listView.setHeaderInvisible(i, isPartitionEmpty(i));
+            }
+        }
+    }
+
+    public int getScrollPositionForHeader(int viewIndex) {
+        return getPositionForPartition(viewIndex);
+    }
+}
diff --git a/src/com/android/contacts/widget/PinnedHeaderListDemoActivity.java b/src/com/android/contacts/widget/PinnedHeaderListDemoActivity.java
new file mode 100644
index 0000000..b553e3f
--- /dev/null
+++ b/src/com/android/contacts/widget/PinnedHeaderListDemoActivity.java
@@ -0,0 +1,142 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.widget;
+
+import com.android.contacts.R;
+
+import android.app.ListActivity;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.MatrixCursor;
+import android.os.Bundle;
+import android.os.Handler;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+/**
+ * An activity that demonstrates various use cases for the {@link PinnedHeaderListView}.
+ * If we decide to move PinnedHeaderListView to the framework, this class could go
+ * to API demos.
+ */
+public class PinnedHeaderListDemoActivity extends ListActivity {
+
+    public final static class TestPinnedHeaderListAdapter extends PinnedHeaderListAdapter {
+
+        public TestPinnedHeaderListAdapter(Context context) {
+            super(context);
+            setPinnedPartitionHeadersEnabled(true);
+        }
+
+        private String[] mHeaders;
+        private int mPinnedHeaderCount;
+
+        public void setHeaders(String[] headers) {
+            this.mHeaders = headers;
+        }
+
+        @Override
+        protected View newHeaderView(Context context, int partition, Cursor cursor,
+                ViewGroup parent) {
+            LayoutInflater inflater = LayoutInflater.from(context);
+            return inflater.inflate(R.layout.list_section, null);
+        }
+
+        @Override
+        protected void bindHeaderView(View view, int parition, Cursor cursor) {
+            TextView headerText = (TextView)view.findViewById(R.id.header_text);
+            headerText.setText(mHeaders[parition]);
+        }
+
+        @Override
+        protected View newView(Context context, int partition, Cursor cursor, int position,
+                ViewGroup parent) {
+            LayoutInflater inflater = LayoutInflater.from(context);
+            return inflater.inflate(android.R.layout.simple_list_item_1, null);
+        }
+
+        @Override
+        protected void bindView(View v, int partition, Cursor cursor, int position) {
+            TextView text = (TextView)v.findViewById(android.R.id.text1);
+            text.setText(cursor.getString(1));
+        }
+
+        @Override
+        public View getPinnedHeaderView(int viewIndex, View convertView, ViewGroup parent) {
+            LayoutInflater inflater = LayoutInflater.from(getContext());
+            View view = inflater.inflate(R.layout.list_section, parent, false);
+            view.setFocusable(false);
+            view.setEnabled(false);
+            bindHeaderView(view, viewIndex, null);
+            return view;
+        }
+
+        @Override
+        public int getPinnedHeaderCount() {
+            return mPinnedHeaderCount;
+        }
+    }
+
+    private Handler mHandler = new Handler();
+
+    @Override
+    protected void onCreate(Bundle bundle) {
+        super.onCreate(bundle);
+
+        setContentView(R.layout.pinned_header_list_demo);
+
+        final TestPinnedHeaderListAdapter adapter = new TestPinnedHeaderListAdapter(this);
+
+        Bundle extras = getIntent().getExtras();
+        int[] counts = extras.getIntArray("counts");
+        String[] names = extras.getStringArray("names");
+        boolean[] showIfEmpty = extras.getBooleanArray("showIfEmpty");
+        boolean[] hasHeader = extras.getBooleanArray("headers");
+        int[] delays = extras.getIntArray("delays");
+
+        if (counts == null || names == null || showIfEmpty == null || delays == null) {
+            throw new IllegalArgumentException("Missing required extras");
+        }
+
+        adapter.setHeaders(names);
+        for (int i = 0; i < counts.length; i++) {
+            adapter.addPartition(showIfEmpty[i], names[i] != null);
+            adapter.mPinnedHeaderCount = names.length;
+        }
+        setListAdapter(adapter);
+        for (int i = 0; i < counts.length; i++) {
+            final int sectionId = i;
+            final Cursor cursor = makeCursor(names[i], counts[i]);
+            mHandler.postDelayed(new Runnable() {
+
+                public void run() {
+                    adapter.changeCursor(sectionId, cursor);
+
+                }
+            }, delays[i]);
+        }
+    }
+
+    private Cursor makeCursor(String name, int count) {
+        MatrixCursor cursor = new MatrixCursor(new String[]{"_id", name});
+        for (int i = 0; i < count; i++) {
+            cursor.addRow(new Object[]{i, name + "[" + i + "]"});
+        }
+        return cursor;
+    }
+}
diff --git a/src/com/android/contacts/widget/PinnedHeaderListView.java b/src/com/android/contacts/widget/PinnedHeaderListView.java
new file mode 100644
index 0000000..5936002
--- /dev/null
+++ b/src/com/android/contacts/widget/PinnedHeaderListView.java
@@ -0,0 +1,512 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.widget;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AbsListView;
+import android.widget.AbsListView.OnScrollListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+
+/**
+ * A ListView that maintains a header pinned at the top of the list. The
+ * pinned header can be pushed up and dissolved as needed.
+ */
+public class PinnedHeaderListView extends ListView
+        implements OnScrollListener, OnItemSelectedListener {
+
+    /**
+     * Adapter interface.  The list adapter must implement this interface.
+     */
+    public interface PinnedHeaderAdapter {
+
+        /**
+         * Returns the overall number of pinned headers, visible or not.
+         */
+        int getPinnedHeaderCount();
+
+        /**
+         * Creates or updates the pinned header view.
+         */
+        View getPinnedHeaderView(int viewIndex, View convertView, ViewGroup parent);
+
+        /**
+         * Configures the pinned headers to match the visible list items. The
+         * adapter should call {@link PinnedHeaderListView#setHeaderPinnedAtTop},
+         * {@link PinnedHeaderListView#setHeaderPinnedAtBottom},
+         * {@link PinnedHeaderListView#setFadingHeader} or
+         * {@link PinnedHeaderListView#setHeaderInvisible}, for each header that
+         * needs to change its position or visibility.
+         */
+        void configurePinnedHeaders(PinnedHeaderListView listView);
+
+        /**
+         * Returns the list position to scroll to if the pinned header is touched.
+         * Return -1 if the list does not need to be scrolled.
+         */
+        int getScrollPositionForHeader(int viewIndex);
+    }
+
+    private static final int MAX_ALPHA = 255;
+    private static final int TOP = 0;
+    private static final int BOTTOM = 1;
+    private static final int FADING = 2;
+
+    private static final int DEFAULT_ANIMATION_DURATION = 100;
+
+    private static final class PinnedHeader {
+        View view;
+        boolean visible;
+        int y;
+        int height;
+        int alpha;
+        int state;
+
+        boolean animating;
+        boolean targetVisible;
+        int sourceY;
+        int targetY;
+        long targetTime;
+    }
+
+    private PinnedHeaderAdapter mAdapter;
+    private int mSize;
+    private PinnedHeader[] mHeaders;
+    private RectF mBounds = new RectF();
+    private Rect mClipRect = new Rect();
+    private OnScrollListener mOnScrollListener;
+    private OnItemSelectedListener mOnItemSelectedListener;
+    private int mScrollState;
+
+    private int mAnimationDuration = DEFAULT_ANIMATION_DURATION;
+    private boolean mAnimating;
+    private long mAnimationTargetTime;
+
+    public PinnedHeaderListView(Context context) {
+        this(context, null, com.android.internal.R.attr.listViewStyle);
+    }
+
+    public PinnedHeaderListView(Context context, AttributeSet attrs) {
+        this(context, attrs, com.android.internal.R.attr.listViewStyle);
+    }
+
+    public PinnedHeaderListView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+        super.setOnScrollListener(this);
+        super.setOnItemSelectedListener(this);
+    }
+
+    public void setPinnedHeaderAnimationDuration(int duration) {
+        mAnimationDuration = duration;
+    }
+
+    @Override
+    public void setAdapter(ListAdapter adapter) {
+        mAdapter = (PinnedHeaderAdapter)adapter;
+        super.setAdapter(adapter);
+    }
+
+    @Override
+    public void setOnScrollListener(OnScrollListener onScrollListener) {
+        mOnScrollListener = onScrollListener;
+        super.setOnScrollListener(this);
+    }
+
+    @Override
+    public void setOnItemSelectedListener(OnItemSelectedListener listener) {
+        mOnItemSelectedListener = listener;
+        super.setOnItemSelectedListener(this);
+    }
+
+    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
+            int totalItemCount) {
+        if (mAdapter != null) {
+            int count = mAdapter.getPinnedHeaderCount();
+            if (count != mSize) {
+                mSize = count;
+                if (mHeaders == null) {
+                    mHeaders = new PinnedHeader[mSize];
+                } else if (mHeaders.length < mSize) {
+                    PinnedHeader[] headers = mHeaders;
+                    mHeaders = new PinnedHeader[mSize];
+                    System.arraycopy(headers, 0, mHeaders, 0, headers.length);
+                }
+            }
+
+            for (int i = 0; i < mSize; i++) {
+                if (mHeaders[i] == null) {
+                    mHeaders[i] = new PinnedHeader();
+                }
+                mHeaders[i].view = mAdapter.getPinnedHeaderView(i, mHeaders[i].view, this);
+            }
+
+            // Disable vertical fading when the pinned header is present
+            // TODO change ListView to allow separate measures for top and bottom fading edge;
+            // in this particular case we would like to disable the top, but not the bottom edge.
+            if (mSize > 0) {
+                setFadingEdgeLength(0);
+            }
+
+            mAnimationTargetTime = System.currentTimeMillis() + mAnimationDuration;
+            mAdapter.configurePinnedHeaders(this);
+            invalidateIfAnimating();
+
+        }
+        if (mOnScrollListener != null) {
+            mOnScrollListener.onScroll(this, firstVisibleItem, visibleItemCount, totalItemCount);
+        }
+    }
+
+    public void onScrollStateChanged(AbsListView view, int scrollState) {
+        mScrollState = scrollState;
+        if (mOnScrollListener != null) {
+            mOnScrollListener.onScrollStateChanged(this, scrollState);
+        }
+    }
+
+    /**
+     * Ensures that the selected item is positioned below the top-pinned headers
+     * and above the bottom-pinned ones.
+     */
+    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+        int height = getHeight();
+
+        int windowTop = 0;
+        int windowBottom = height;
+
+        int prevHeaderBottom = 0;
+        for (int i = 0; i < mSize; i++) {
+            PinnedHeader header = mHeaders[i];
+            if (header.visible) {
+                if (header.state == TOP) {
+                    windowTop = header.y + header.height;
+                } else if (header.state == BOTTOM) {
+                    windowBottom = header.y;
+                    break;
+                }
+            }
+        }
+
+        View selectedView = getSelectedView();
+        if (selectedView != null) {
+            if (selectedView.getTop() < windowTop) {
+                setSelectionFromTop(position, windowTop);
+            } else if (selectedView.getBottom() > windowBottom) {
+                setSelectionFromTop(position, windowBottom - selectedView.getHeight());
+            }
+        }
+
+        if (mOnItemSelectedListener != null) {
+            mOnItemSelectedListener.onItemSelected(parent, view, position, id);
+        }
+    }
+
+    public void onNothingSelected(AdapterView<?> parent) {
+        if (mOnItemSelectedListener != null) {
+            mOnItemSelectedListener.onNothingSelected(parent);
+        }
+    }
+
+    public int getPinnedHeaderHeight(int viewIndex) {
+        ensurePinnedHeaderLayout(viewIndex);
+        return mHeaders[viewIndex].view.getHeight();
+    }
+
+    /**
+     * Set header to be pinned at the top.
+     *
+     * @param viewIndex index of the header view
+     * @param y is position of the header in pixels.
+     * @param animate true if the transition to the new coordinate should be animated
+     */
+    public void setHeaderPinnedAtTop(int viewIndex, int y, boolean animate) {
+        ensurePinnedHeaderLayout(viewIndex);
+        PinnedHeader header = mHeaders[viewIndex];
+        header.visible = true;
+        header.y = y;
+        header.state = TOP;
+
+        // TODO perhaps we should animate at the top as well
+        header.animating = false;
+    }
+
+    /**
+     * Set header to be pinned at the bottom.
+     *
+     * @param viewIndex index of the header view
+     * @param y is position of the header in pixels.
+     * @param animate true if the transition to the new coordinate should be animated
+     */
+    public void setHeaderPinnedAtBottom(int viewIndex, int y, boolean animate) {
+        ensurePinnedHeaderLayout(viewIndex);
+        PinnedHeader header = mHeaders[viewIndex];
+        header.state = BOTTOM;
+        if (header.animating) {
+            header.targetTime = mAnimationTargetTime;
+            header.sourceY = header.y;
+            header.targetY = y;
+        } else if (animate && (header.y != y || !header.visible)) {
+            if (header.visible) {
+                header.sourceY = header.y;
+            } else {
+                header.visible = true;
+                header.sourceY = y + header.height;
+            }
+            header.animating = true;
+            header.targetVisible = true;
+            header.targetTime = mAnimationTargetTime;
+            header.targetY = y;
+        } else {
+            header.visible = true;
+            header.y = y;
+        }
+    }
+
+    /**
+     * Set header to be pinned at the top of the first visible item.
+     *
+     * @param viewIndex index of the header view
+     * @param position is position of the header in pixels.
+     */
+    public void setFadingHeader(int viewIndex, int position, boolean fade) {
+        ensurePinnedHeaderLayout(viewIndex);
+
+        View child = getChildAt(position - getFirstVisiblePosition());
+
+        PinnedHeader header = mHeaders[viewIndex];
+        header.visible = true;
+        header.state = FADING;
+        header.alpha = MAX_ALPHA;
+        header.animating = false;
+
+        int top = getTotalTopPinnedHeaderHeight();
+        header.y = top;
+        if (fade) {
+            int bottom = child.getBottom() - top;
+            int headerHeight = header.height;
+            if (bottom < headerHeight) {
+                int portion = bottom - headerHeight;
+                header.alpha = MAX_ALPHA * (headerHeight + portion) / headerHeight;
+                header.y = top + portion;
+            }
+        }
+    }
+
+    /**
+     * Makes header invisible.
+     *
+     * @param viewIndex index of the header view
+     * @param animate true if the transition to the new coordinate should be animated
+     */
+    public void setHeaderInvisible(int viewIndex, boolean animate) {
+        PinnedHeader header = mHeaders[viewIndex];
+        if (header.visible && (animate || header.animating) && header.state == BOTTOM) {
+            header.sourceY = header.y;
+            if (!header.animating) {
+                header.visible = true;
+                header.targetY = getBottom() + header.height;
+            }
+            header.animating = true;
+            header.targetTime = mAnimationTargetTime;
+            header.targetVisible = false;
+        } else {
+            header.visible = false;
+        }
+    }
+
+    private void ensurePinnedHeaderLayout(int viewIndex) {
+        View view = mHeaders[viewIndex].view;
+        if (view.isLayoutRequested()) {
+            int widthSpec = MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY);
+            int heightSpec;
+            int lpHeight = view.getLayoutParams().height;
+            if (lpHeight > 0) {
+                heightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
+            } else {
+                heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+            }
+            view.measure(widthSpec, heightSpec);
+            int height = view.getMeasuredHeight();
+            mHeaders[viewIndex].height = height;
+            view.layout(0, 0, view.getMeasuredWidth(), height);
+        }
+    }
+
+    /**
+     * Returns the sum of heights of headers pinned to the top.
+     */
+    public int getTotalTopPinnedHeaderHeight() {
+        for (int i = mSize; --i >= 0;) {
+            PinnedHeader header = mHeaders[i];
+            if (header.visible && header.state == TOP) {
+                return header.y + header.height;
+            }
+        }
+        return 0;
+    }
+
+    /**
+     * Returns the list item position at the specified y coordinate.
+     */
+    public int getPositionAt(int y) {
+        do {
+            int position = pointToPosition(0, y);
+            if (position != -1) {
+                return position;
+            }
+            // If position == -1, we must have hit a separator. Let's examine
+            // a nearby pixel
+            y--;
+        } while (y > 0);
+        return 0;
+    }
+
+    @Override
+    public boolean onInterceptTouchEvent(MotionEvent ev) {
+        if (mScrollState == SCROLL_STATE_IDLE) {
+            final int y = (int)ev.getY();
+            for (int i = mSize; --i >= 0;) {
+                PinnedHeader header = mHeaders[i];
+                if (header.visible && header.y <= y && header.y + header.height > y) {
+                    if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+                        return smoothScrollToPartition(i);
+                    } else {
+                        return true;
+                    }
+                }
+            }
+        }
+
+        return super.onInterceptTouchEvent(ev);
+    }
+
+    private boolean smoothScrollToPartition(int partition) {
+        final int position = mAdapter.getScrollPositionForHeader(partition);
+        if (position == -1) {
+            return false;
+        }
+
+        int offset = 0;
+        for (int i = 0; i < partition; i++) {
+            PinnedHeader header = mHeaders[i];
+            if (header.visible) {
+                offset += header.height;
+            }
+        }
+
+        smoothScrollToPositionFromTop(position + getHeaderViewsCount(), offset);
+        return true;
+    }
+
+    private void invalidateIfAnimating() {
+        mAnimating = false;
+        for (int i = 0; i < mSize; i++) {
+            if (mHeaders[i].animating) {
+                mAnimating = true;
+                invalidate();
+                return;
+            }
+        }
+    }
+
+    @Override
+    protected void dispatchDraw(Canvas canvas) {
+        long currentTime = mAnimating ? System.currentTimeMillis() : 0;
+
+        int top = 0;
+        int bottom = getBottom();
+        boolean hasVisibleHeaders = false;
+        for (int i = 0; i < mSize; i++) {
+            PinnedHeader header = mHeaders[i];
+            if (header.visible) {
+                hasVisibleHeaders = true;
+                if (header.state == BOTTOM && header.y < bottom) {
+                    bottom = header.y;
+                } else if (header.state == TOP || header.state == FADING) {
+                    int newTop = header.y + header.height;
+                    if (newTop > top) {
+                        top = newTop;
+                    }
+                }
+            }
+        }
+
+        if (hasVisibleHeaders) {
+            canvas.save();
+            mClipRect.set(0, top, getWidth(), bottom);
+            canvas.clipRect(mClipRect);
+        }
+
+        super.dispatchDraw(canvas);
+
+        if (hasVisibleHeaders) {
+            canvas.restore();
+
+            // First draw top headers, then the bottom ones to handle the Z axis correctly
+            for (int i = mSize; --i >= 0;) {
+                PinnedHeader header = mHeaders[i];
+                if (header.visible && (header.state == TOP || header.state == FADING)) {
+                    drawHeader(canvas, header, currentTime);
+                }
+            }
+
+            for (int i = 0; i < mSize; i++) {
+                PinnedHeader header = mHeaders[i];
+                if (header.visible && header.state == BOTTOM) {
+                    drawHeader(canvas, header, currentTime);
+                }
+            }
+        }
+
+        invalidateIfAnimating();
+    }
+
+    private void drawHeader(Canvas canvas, PinnedHeader header, long currentTime) {
+        if (header.animating) {
+            int timeLeft = (int)(header.targetTime - currentTime);
+            if (timeLeft <= 0) {
+                header.y = header.targetY;
+                header.visible = header.targetVisible;
+                header.animating = false;
+            } else {
+                header.y = header.targetY + (header.sourceY - header.targetY) * timeLeft
+                        / mAnimationDuration;
+            }
+        }
+        if (header.visible) {
+            View view = header.view;
+            int saveCount = canvas.save();
+            canvas.translate(0, header.y);
+            if (header.state == FADING) {
+                mBounds.set(0, 0, view.getWidth(), view.getHeight());
+                canvas.saveLayerAlpha(mBounds, header.alpha, Canvas.ALL_SAVE_FLAG);
+            }
+            view.draw(canvas);
+            canvas.restoreToCount(saveCount);
+        }
+    }
+}
diff --git a/src/com/android/contacts/widget/SearchEditText.java b/src/com/android/contacts/widget/SearchEditText.java
new file mode 100644
index 0000000..d8ea2be
--- /dev/null
+++ b/src/com/android/contacts/widget/SearchEditText.java
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.widget;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.text.TextWatcher;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.TextView.OnEditorActionListener;
+
+/**
+ * A custom text editor that helps automatically dismiss the activity along with the soft
+ * keyboard.
+ */
+public class SearchEditText extends EditText implements OnEditorActionListener, TextWatcher {
+
+    private boolean mMaginfyingGlassEnabled = true;
+    private Drawable mMagnifyingGlass;
+    private OnFilterTextListener mListener;
+
+    private boolean mMagnifyingGlassShown;
+
+    public interface OnFilterTextListener {
+        void onFilterChange(String queryString);
+        void onCancelSearch();
+    }
+
+    public SearchEditText(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        addTextChangedListener(this);
+        setOnEditorActionListener(this);
+        mMagnifyingGlass = getCompoundDrawables()[2];
+        setCompoundDrawables(null, null, null, null);
+    }
+
+    public boolean isMaginfyingGlassEnabled() {
+        return mMaginfyingGlassEnabled;
+    }
+
+    public void setMaginfyingGlassEnabled(boolean flag) {
+        this.mMaginfyingGlassEnabled = flag;
+    }
+
+    public void setOnFilterTextListener(OnFilterTextListener listener) {
+        this.mListener = listener;
+    }
+
+    /**
+     * Conditionally shows a magnifying glass icon on the right side of the text field
+     * when the text it empty.
+     */
+    @Override
+    public boolean onPreDraw() {
+        boolean emptyText = TextUtils.isEmpty(getText());
+        if (mMagnifyingGlassShown != emptyText) {
+            mMagnifyingGlassShown = emptyText;
+            if (mMagnifyingGlassShown && mMaginfyingGlassEnabled) {
+                setCompoundDrawables(null, null, mMagnifyingGlass, null);
+            } else {
+                setCompoundDrawables(null, null, null, null);
+            }
+            return false;
+        }
+        return super.onPreDraw();
+    }
+
+    /**
+     * Dismisses the search UI along with the keyboard if the filter text is empty.
+     */
+    @Override
+    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
+        if (keyCode == KeyEvent.KEYCODE_BACK && TextUtils.isEmpty(getText()) && mListener != null) {
+            mListener.onCancelSearch();
+            return true;
+        }
+        return false;
+    }
+
+    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+    }
+
+    @Override
+    public void onTextChanged(CharSequence s, int start, int before, int count) {
+    }
+
+    /**
+     * Event handler for search UI.
+     */
+    public void afterTextChanged(Editable s) {
+        if (mListener != null) {
+            mListener.onFilterChange(trim(s));
+        }
+    }
+
+    private String trim(Editable s) {
+        return s.toString().trim();
+    }
+
+    /**
+     * Event handler for search UI.
+     */
+    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+        if (actionId == EditorInfo.IME_ACTION_DONE) {
+            hideSoftKeyboard();
+            if (TextUtils.isEmpty(trim(getText())) && mListener != null) {
+                mListener.onCancelSearch();
+            }
+            return true;
+        }
+        return false;
+    }
+
+    private void hideSoftKeyboard() {
+        // Hide soft keyboard, if visible
+        InputMethodManager inputMethodManager = (InputMethodManager)
+                getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+        inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
+    }
+
+}
diff --git a/src/com/android/contacts/widget/SingleItemAdapter.java b/src/com/android/contacts/widget/SingleItemAdapter.java
new file mode 100644
index 0000000..3532bfc
--- /dev/null
+++ b/src/com/android/contacts/widget/SingleItemAdapter.java
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+package com.android.contacts.widget;
+
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+
+/**
+ * A general purpose adapter that contains exactly one item.
+ */
+public abstract class SingleItemAdapter extends BaseAdapter {
+
+    public int getCount() {
+        return 1;
+    }
+
+    public Object getItem(int position) {
+        return null;
+    }
+
+    public long getItemId(int position) {
+        return 0;
+    }
+
+    public View getView(int position, View convertView, ViewGroup parent) {
+        return getView(convertView, parent);
+    }
+
+    /**
+     * Creates the view.
+     */
+    protected abstract View getView(View convertView, ViewGroup parent);
+}
diff --git a/src/com/android/contacts/widget/TextHighlightingAnimation.java b/src/com/android/contacts/widget/TextHighlightingAnimation.java
new file mode 100644
index 0000000..21bbc63
--- /dev/null
+++ b/src/com/android/contacts/widget/TextHighlightingAnimation.java
@@ -0,0 +1,300 @@
+/*
+ * 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.
+ */
+package com.android.contacts.widget;
+
+import com.android.internal.R;
+
+import android.database.CharArrayBuffer;
+import android.graphics.Color;
+import android.os.Handler;
+import android.text.TextPaint;
+import android.text.style.CharacterStyle;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.DecelerateInterpolator;
+
+/**
+ * An animation that alternately dims and brightens the non-highlighted portion of text.
+ */
+public abstract class TextHighlightingAnimation implements Runnable, TextWithHighlightingFactory {
+
+    private static final int MAX_ALPHA = 255;
+    private static final int MIN_ALPHA = 50;
+
+    private AccelerateInterpolator ACCELERATE_INTERPOLATOR = new AccelerateInterpolator();
+    private DecelerateInterpolator DECELERATE_INTERPOLATOR = new DecelerateInterpolator();
+
+    private final static DimmingSpan[] sEmptySpans = new DimmingSpan[0];
+
+    /**
+     * Frame rate expressed a number of millis between frames.
+     */
+    private static final long FRAME_RATE = 50;
+
+    private DimmingSpan mDimmingSpan;
+    private Handler mHandler;
+    private boolean mAnimating;
+    private boolean mDimming;
+    private long mTargetTime;
+    private final int mDuration;
+
+    /**
+     * A Spanned that highlights a part of text by dimming another part of that text.
+     */
+    public class TextWithHighlightingImpl implements TextWithHighlighting {
+
+        private final DimmingSpan[] mSpans;
+        private boolean mDimmingEnabled;
+        private CharArrayBuffer mText;
+        private int mDimmingSpanStart;
+        private int mDimmingSpanEnd;
+        private String mString;
+
+        public TextWithHighlightingImpl() {
+            mSpans = new DimmingSpan[] { mDimmingSpan };
+        }
+
+        public void setText(CharArrayBuffer baseText, CharArrayBuffer highlightedText) {
+            mText = baseText;
+
+            // TODO figure out a way to avoid string allocation
+            mString = new String(mText.data, 0, mText.sizeCopied);
+
+            int index = indexOf(baseText, highlightedText);
+
+            if (index == 0 || index == -1) {
+                mDimmingEnabled = false;
+            } else {
+                mDimmingEnabled = true;
+                mDimmingSpanStart = 0;
+                mDimmingSpanEnd = index;
+            }
+        }
+
+        /**
+         * An implementation of indexOf on CharArrayBuffers that finds the first match of
+         * the start of buffer2 in buffer1.  For example, indexOf("abcd", "cdef") == 2
+         */
+        private int indexOf(CharArrayBuffer buffer1, CharArrayBuffer buffer2) {
+            char[] string1 = buffer1.data;
+            char[] string2 = buffer2.data;
+            int count1 = buffer1.sizeCopied;
+            int count2 = buffer2.sizeCopied;
+
+            // Ignore matching tails of the two buffers
+            while (count1 > 0 && count2 > 0 && string1[count1 - 1] == string2[count2 - 1]) {
+                count1--;
+                count2--;
+            }
+
+            int size = count2;
+            for (int i = 0; i < count1; i++) {
+                if (i + size > count1) {
+                    size = count1 - i;
+                }
+                int j;
+                for (j = 0; j < size; j++) {
+                    if (string1[i+j] != string2[j]) {
+                        break;
+                    }
+                }
+                if (j == size) {
+                    return i;
+                }
+            }
+
+            return -1;
+        }
+
+
+        @SuppressWarnings("unchecked")
+        public <T> T[] getSpans(int start, int end, Class<T> type) {
+            if (mDimmingEnabled) {
+                return (T[])mSpans;
+            } else {
+                return (T[])sEmptySpans;
+            }
+        }
+
+        public int getSpanStart(Object tag) {
+            // We only have one span - no need to check the tag parameter
+            return mDimmingSpanStart;
+        }
+
+        public int getSpanEnd(Object tag) {
+            // We only have one span - no need to check the tag parameter
+            return mDimmingSpanEnd;
+        }
+
+        public int getSpanFlags(Object tag) {
+            // String is immutable - flags not needed
+            return 0;
+        }
+
+        public int nextSpanTransition(int start, int limit, Class type) {
+            // Never called since we only have one span
+            return 0;
+        }
+
+        public char charAt(int index) {
+            return mText.data[index];
+        }
+
+        public int length() {
+            return mText.sizeCopied;
+        }
+
+        public CharSequence subSequence(int start, int end) {
+            // Never called - implementing for completeness
+            return new String(mText.data, start, end);
+        }
+
+        @Override
+        public String toString() {
+            return mString;
+        }
+    }
+
+    /**
+     * A Span that modifies alpha of the default foreground color.
+     */
+    private static class DimmingSpan extends CharacterStyle {
+        private int mAlpha;
+
+        public void setAlpha(int alpha) {
+            mAlpha = alpha;
+        }
+
+        @Override
+        public void updateDrawState(TextPaint ds) {
+
+            // Only dim the text in the basic state; not selected, focused or pressed
+            int[] states = ds.drawableState;
+            if (states != null) {
+                int count = states.length;
+                for (int i = 0; i < count; i++) {
+                    switch (states[i]) {
+                        case R.attr.state_pressed:
+                        case R.attr.state_selected:
+                        case R.attr.state_focused:
+                            // We can simply return, because the supplied text
+                            // paint is already configured with defaults.
+                            return;
+                    }
+                }
+            }
+
+            int color = ds.getColor();
+            color = Color.argb(mAlpha, Color.red(color), Color.green(color), Color.blue(color));
+            ds.setColor(color);
+        }
+    }
+
+    /**
+     * Constructor.
+     */
+    public TextHighlightingAnimation(int duration) {
+        mDuration = duration;
+        mHandler = new Handler();
+        mDimmingSpan = new DimmingSpan();
+        mDimmingSpan.setAlpha(MAX_ALPHA);
+    }
+
+    /**
+     * Returns a Spanned that can be used by a text view to show text with highlighting.
+     */
+    public TextWithHighlightingImpl createTextWithHighlighting() {
+        return new TextWithHighlightingImpl();
+    }
+
+    /**
+     * Override and invalidate (redraw) TextViews showing {@link TextWithHighlightingImpl}.
+     */
+    protected abstract void invalidate();
+
+    /**
+     * Starts the highlighting animation, which will dim portions of text.
+     */
+    public void startHighlighting() {
+        startAnimation(true);
+    }
+
+    /**
+     * Starts un-highlighting animation, which will brighten the dimmed portions of text
+     * to the brightness level of the rest of text.
+     */
+    public void stopHighlighting() {
+        startAnimation(false);
+    }
+
+    /**
+     * Called when the animation starts.
+     */
+    protected void onAnimationStarted() {
+    }
+
+    /**
+     * Called when the animation has stopped.
+     */
+    protected void onAnimationEnded() {
+    }
+
+    private void startAnimation(boolean dim) {
+        if (mDimming != dim) {
+            mDimming = dim;
+            long now = System.currentTimeMillis();
+            if (!mAnimating) {
+                mAnimating = true;
+                mTargetTime = now + mDuration;
+                onAnimationStarted();
+                mHandler.post(this);
+            } else  {
+
+                // If we have started dimming, reverse the direction and adjust the target
+                // time accordingly.
+                mTargetTime = (now + mDuration) - (mTargetTime - now);
+            }
+        }
+    }
+
+    /**
+     * Animation step.
+     */
+    public void run() {
+        long now = System.currentTimeMillis();
+        long timeLeft = mTargetTime - now;
+        if (timeLeft < 0) {
+            mDimmingSpan.setAlpha(mDimming ? MIN_ALPHA : MAX_ALPHA);
+            mAnimating = false;
+            onAnimationEnded();
+            return;
+        }
+
+        // Start=1, end=0
+        float virtualTime = (float)timeLeft / mDuration;
+        if (mDimming) {
+            float interpolatedTime = DECELERATE_INTERPOLATOR.getInterpolation(virtualTime);
+            mDimmingSpan.setAlpha((int)(MIN_ALPHA + (MAX_ALPHA-MIN_ALPHA) * interpolatedTime));
+        } else {
+            float interpolatedTime = ACCELERATE_INTERPOLATOR.getInterpolation(virtualTime);
+            mDimmingSpan.setAlpha((int)(MIN_ALPHA + (MAX_ALPHA-MIN_ALPHA) * (1-interpolatedTime)));
+        }
+
+        invalidate();
+
+        // Repeat
+        mHandler.postDelayed(this, FRAME_RATE);
+    }
+}
diff --git a/src/com/android/contacts/widget/TextWithHighlighting.java b/src/com/android/contacts/widget/TextWithHighlighting.java
new file mode 100644
index 0000000..3a32b02
--- /dev/null
+++ b/src/com/android/contacts/widget/TextWithHighlighting.java
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package com.android.contacts.widget;
+
+import android.database.CharArrayBuffer;
+import android.text.Spanned;
+
+/**
+ * A Spanned that highlights a part of text by dimming another part of that text.
+ */
+public interface TextWithHighlighting extends Spanned {
+    void setText(CharArrayBuffer baseText, CharArrayBuffer highlightedText);
+}
diff --git a/src/com/android/contacts/widget/TextWithHighlightingFactory.java b/src/com/android/contacts/widget/TextWithHighlightingFactory.java
new file mode 100644
index 0000000..ee5744d
--- /dev/null
+++ b/src/com/android/contacts/widget/TextWithHighlightingFactory.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+package com.android.contacts.widget;
+
+/**
+ * A factory for text fields with animated highlighting.
+ */
+public interface TextWithHighlightingFactory {
+    TextWithHighlighting createTextWithHighlighting();
+}
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 7af1a54..54f7939 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -4,9 +4,9 @@
      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.
@@ -17,25 +17,59 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.contacts.tests">
 
+    <uses-permission android:name="android.permission.READ_CONTACTS" />
+    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+
     <application>
         <uses-library android:name="android.test.runner" />
         <meta-data android:name="com.android.contacts.iconset" android:resource="@xml/iconset" />
+        <uses-permission android:name="android.permission.READ_CONTACTS" />
+        <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+
+        <activity android:name=".allintents.AllIntentsActivity"
+            android:label="@string/contactsIntents"
+            >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".allintents.ResultActivity"
+            android:label="@string/result"
+            >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".widget.PinnedHeaderUseCaseActivity"
+            android:label="@string/pinnedHeaderList"
+            >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
     </application>
 
     <instrumentation android:name="android.test.InstrumentationTestRunner"
         android:targetPackage="com.android.contacts"
         android:label="Contacts app tests">
     </instrumentation>
-    
+
     <instrumentation android:name="com.android.contacts.ContactsLaunchPerformance"
         android:targetPackage="com.android.contacts"
         android:label="Contacts launch performance">
     </instrumentation>
 
-
     <instrumentation android:name="com.android.contacts.DialerLaunchPerformance"
         android:targetPackage="com.android.contacts"
         android:label="Dialer launch performance">
     </instrumentation>
 
-</manifest> 
+</manifest>
diff --git a/tests/assets/v21_simple.vcf b/tests/assets/v21_simple.vcf
new file mode 100644
index 0000000..86f4d33
--- /dev/null
+++ b/tests/assets/v21_simple.vcf
@@ -0,0 +1,3 @@
+BEGIN:VCARD
+N:test
+END:VCARD
\ No newline at end of file
diff --git a/tests/assets/v30_simple.vcf b/tests/assets/v30_simple.vcf
new file mode 100644
index 0000000..418661f
--- /dev/null
+++ b/tests/assets/v30_simple.vcf
@@ -0,0 +1,13 @@
+BEGIN:VCARD

+VERSION:3.0

+FN:And Roid

+N:And;Roid;;;

+ORG:Open;Handset; Alliance

+SORT-STRING:android

+TEL;TYPE=PREF;TYPE=VOICE:0300000000

+CLASS:PUBLIC

+X-GNO:0

+X-GN:group0

+X-REDUCTION:0

+REV:20081031T065854Z

+END:VCARD

diff --git a/tests/res/layout/intent_list_item.xml b/tests/res/layout/intent_list_item.xml
new file mode 100644
index 0000000..4749224
--- /dev/null
+++ b/tests/res/layout/intent_list_item.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2006 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:id="@android:id/text1"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:textAppearance="?android:attr/textAppearanceSmall"
+    android:gravity="center_vertical"
+    android:paddingLeft="6dip"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+/>
diff --git a/tests/res/layout/result.xml b/tests/res/layout/result.xml
new file mode 100644
index 0000000..0ab32c6
--- /dev/null
+++ b/tests/res/layout/result.xml
@@ -0,0 +1,32 @@
+<?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.
+-->
+
+<ScrollView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:fillViewport="true"
+>
+
+  <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+      android:id="@+id/table"
+      android:layout_width="match_parent"
+      android:layout_height="match_parent"
+      android:shrinkColumns="1"
+      android:stretchColumns="*">
+  </TableLayout>
+</ScrollView>
+
diff --git a/tests/res/values/donottranslate_strings.xml b/tests/res/values/donottranslate_strings.xml
new file mode 100644
index 0000000..419ae98
--- /dev/null
+++ b/tests/res/values/donottranslate_strings.xml
@@ -0,0 +1,94 @@
+<?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.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+    <string name="contactsIntents">Contacts Intents</string>
+    <string name="result">Result returned by activity</string>
+
+    <string-array name="allIntents">
+        <!-- List modes -->
+        <item>LIST_DEFAULT</item>
+        <item>LIST_ALL_CONTACTS_ACTION</item>
+        <item>LIST_CONTACTS_WITH_PHONES_ACTION</item>
+        <item>LIST_STARRED_ACTION</item>
+        <item>LIST_STARRED_ACTION (filter)</item>
+        <item>LIST_FREQUENT_ACTION</item>
+        <item>LIST_FREQUENT_ACTION (filter)</item>
+        <item>LIST_STREQUENT_ACTION</item>
+        <item>LIST_STREQUENT_ACTION (filter)</item>
+        <item>ACTION_PICK: contact</item>
+        <item>ACTION_PICK: contact (legacy)</item>
+        <item>ACTION_PICK: phone</item>
+        <item>ACTION_PICK: phone (legacy)</item>
+        <item>ACTION_PICK: postal</item>
+        <item>ACTION_PICK: postal (legacy)</item>
+        <item>ACTION_CREATE_SHORTCUT: contact</item>
+        <item>ACTION_CREATE_SHORTCUT: contact (filter)</item>
+        <item>ACTION_CREATE_SHORTCUT: dial</item>
+        <item>ACTION_CREATE_SHORTCUT: dial (filter)</item>
+        <item>ACTION_CREATE_SHORTCUT: message</item>
+        <item>ACTION_CREATE_SHORTCUT: message (filter)</item>
+        <item>ACTION_GET_CONTENT: contact</item>
+        <item>ACTION_GET_CONTENT: contact (filter)</item>
+        <item>ACTION_GET_CONTENT: contact (legacy)</item>
+        <item>ACTION_GET_CONTENT: contact (filter, legacy)</item>
+        <item>ACTION_GET_CONTENT: phone</item>
+        <item>ACTION_GET_CONTENT: phone (filter)</item>
+        <item>ACTION_GET_CONTENT: phone (legacy)</item>
+        <item>ACTION_GET_CONTENT: postal</item>
+        <item>ACTION_GET_CONTENT: postal (filter)</item>
+        <item>ACTION_GET_CONTENT: postal (legacy)</item>
+        <item>ACTION_INSERT_OR_EDIT</item>
+        <item>ACTION_SEARCH (call button)</item>
+        <item>ACTION_SEARCH: contact</item>
+        <item>ACTION_SEARCH: email</item>
+        <item>ACTION_SEARCH: phone</item>
+        <item>SEARCH_SUGGESTION_CLICKED (call button)</item>
+        <item>SEARCH_SUGGESTION_CLICKED: contact</item>
+        <item>SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED</item>
+        <item>SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED</item>
+        <item>TODO: JOIN_CONTACT</item>
+        <item>ACTION_GET_MULTIPLE_PHONES</item>
+
+        <!-- Edit Contact -->
+        <item>EDIT (content uri with only id)</item>
+        <item>EDIT (lookup uri without id)</item>
+        <item>EDIT (lookup uri)</item>
+        <item>EDIT (called for raw contact)</item>
+        <item>EDIT (legacy style uri)</item>
+        <item>EDIT (create new contact)</item>
+        <item>EDIT (create new contact with data)</item>
+        <item>EDIT (create new contact for account)</item>
+        <item>EDIT (create new contact for account with data)</item>
+        <item>EDIT (create new raw contact)</item>
+        <item>EDIT (create new legacy)</item>
+
+        <!-- View Contact -->
+        <item>VIEW (content uri with only id)</item>
+        <item>VIEW (lookup uri without id)</item>
+        <item>VIEW (lookup uri)</item>
+        <item>VIEW (called for raw contact)</item>
+        <item>VIEW (legacy style uri)</item>
+    </string-array>
+
+    <string name="pinnedHeaderList">Pinned Headers</string>
+
+    <string-array name="pinnedHeaderUseCases">
+        <item>One short section - no headers</item>
+        <item>Two short sections with headers</item>
+        <item>Five short sections with headers</item>
+    </string-array>
+</resources>
diff --git a/tests/src/com/android/contacts/ContactDetailTest.java b/tests/src/com/android/contacts/ContactDetailTest.java
new file mode 100644
index 0000000..0b850b7
--- /dev/null
+++ b/tests/src/com/android/contacts/ContactDetailTest.java
@@ -0,0 +1,41 @@
+package com.android.contacts;
+
+import com.android.contacts.activities.ContactDetailActivity;
+import com.android.contacts.tests.mocks.ContactsMockContext;
+import com.android.contacts.tests.mocks.MockContentProvider;
+
+import android.test.ActivityUnitTestCase;
+
+public class ContactDetailTest extends ActivityUnitTestCase<ContactDetailActivity> {
+    private ContactsMockContext mContext;
+    private MockContentProvider mContactsProvider;
+
+    public ContactDetailTest() {
+        super(ContactDetailActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mContext = new ContactsMockContext(getInstrumentation().getTargetContext());
+        mContactsProvider = mContext.getContactsProvider();
+        setActivityContext(mContext);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+//    public void testFoo() {
+//        // Use lookup-style Uris that also contain the Contact-ID
+//        //long rawContactId1 = mCreator.createRawContact("JohnDoe", "John", "Doe");
+//        //long contactId1 = mCreator.getContactIdByRawContactId(rawContactId1);
+//        //Uri contactUri1 = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId1);
+//        Intent intent = new Intent(Intent.ACTION_VIEW,
+//                ContentUris.withAppendedId(Contacts.CONTENT_URI, 123));
+//        startActivity(intent, null, null);
+//        ContactDetailActivity activity = getActivity();
+//        mContactsProvider.verify();
+//    }
+}
diff --git a/tests/src/com/android/contacts/ContactLoaderTest.java b/tests/src/com/android/contacts/ContactLoaderTest.java
new file mode 100644
index 0000000..3ef109d
--- /dev/null
+++ b/tests/src/com/android/contacts/ContactLoaderTest.java
@@ -0,0 +1,350 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts;
+
+import com.android.contacts.tests.mocks.ContactsMockContext;
+import com.android.contacts.tests.mocks.MockContentProvider;
+import com.android.contacts.views.ContactLoader;
+
+import android.content.ContentUris;
+import android.net.Uri;
+import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
+import android.provider.ContactsContract.CommonDataKinds.StructuredName;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.DisplayNameSources;
+import android.provider.ContactsContract.RawContacts;
+import android.provider.ContactsContract.StatusUpdates;
+import android.test.LoaderTestCase;
+
+/**
+ * Runs ContactLoader tests for the the contact-detail and editor view.
+ */
+public class ContactLoaderTest extends LoaderTestCase {
+    ContactsMockContext mMockContext;
+    MockContentProvider mContactsProvider;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mMockContext = new ContactsMockContext(getContext());
+        mContactsProvider = mMockContext.getContactsProvider();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    private ContactLoader.Result assertLoadContact(Uri uri) {
+        final ContactLoader loader = new ContactLoader(mMockContext, uri);
+        return getLoaderResultSynchronously(loader);
+    }
+
+    public void testNullUri() {
+        ContactLoader.Result result = assertLoadContact(null);
+        assertEquals(ContactLoader.Result.ERROR, result);
+    }
+
+    public void testEmptyUri() {
+        ContactLoader.Result result = assertLoadContact(Uri.EMPTY);
+        assertEquals(ContactLoader.Result.ERROR, result);
+    }
+
+    public void testInvalidUri() {
+        ContactLoader.Result result = assertLoadContact(Uri.parse("content://wtf"));
+        assertEquals(ContactLoader.Result.ERROR, result);
+    }
+
+    public void testLoadContactWithContactIdUri() {
+        // Use content Uris that only contain the ID
+        final long contactId = 1;
+        final long rawContactId = 11;
+        final long dataId = 21;
+
+        final String lookupKey = "aa%12%@!";
+        final Uri baseUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+        final Uri entityUri = Uri.withAppendedPath(baseUri, Contacts.Entity.CONTENT_DIRECTORY);
+        final Uri lookupUri = ContentUris.withAppendedId(
+                Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey),
+                contactId);
+
+        ContactQueries queries = new ContactQueries();
+        mContactsProvider.expectTypeQuery(baseUri, Contacts.CONTENT_ITEM_TYPE);
+        queries.fetchAllData(entityUri, contactId, rawContactId, dataId, lookupKey);
+
+        ContactLoader.Result contact = assertLoadContact(baseUri);
+
+        assertEquals(contactId, contact.getId());
+        assertEquals(rawContactId, contact.getNameRawContactId());
+        assertEquals(DisplayNameSources.STRUCTURED_NAME, contact.getDisplayNameSource());
+        assertEquals(lookupKey, contact.getLookupKey());
+        assertEquals(lookupUri, contact.getLookupUri());
+        assertEquals(1, contact.getEntities().size());
+        assertEquals(1, contact.getStatuses().size());
+        mContactsProvider.verify();
+    }
+
+    public void testLoadContactWithOldStyleUri() {
+        // Use content Uris that only contain the ID but use the format used in Donut
+        final long contactId = 1;
+        final long rawContactId = 11;
+        final long dataId = 21;
+
+        final String lookupKey = "aa%12%@!";
+        final Uri legacyUri = ContentUris.withAppendedId(
+                Uri.parse("content://contacts"), rawContactId);
+        final Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
+        final Uri baseUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+        final Uri lookupUri = ContentUris.withAppendedId(
+                Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey),
+                contactId);
+        final Uri entityUri = Uri.withAppendedPath(lookupUri, Contacts.Entity.CONTENT_DIRECTORY);
+
+        ContactQueries queries = new ContactQueries();
+        queries.fetchContactIdAndLookupFromRawContactUri(rawContactUri, contactId, lookupKey);
+        queries.fetchAllData(entityUri, contactId, rawContactId, dataId, lookupKey);
+
+        ContactLoader.Result contact = assertLoadContact(legacyUri);
+
+        assertEquals(contactId, contact.getId());
+        assertEquals(rawContactId, contact.getNameRawContactId());
+        assertEquals(DisplayNameSources.STRUCTURED_NAME, contact.getDisplayNameSource());
+        assertEquals(lookupKey, contact.getLookupKey());
+        assertEquals(lookupUri, contact.getLookupUri());
+        assertEquals(1, contact.getEntities().size());
+        assertEquals(1, contact.getStatuses().size());
+        mContactsProvider.verify();
+    }
+
+    public void testLoadContactWithRawContactIdUri() {
+        // Use content Uris that only contain the ID but use the format used in Donut
+        final long contactId = 1;
+        final long rawContactId = 11;
+        final long dataId = 21;
+
+        final String lookupKey = "aa%12%@!";
+        final Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
+        final Uri baseUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+        final Uri lookupUri = ContentUris.withAppendedId(
+                Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey),
+                contactId);
+        final Uri entityUri = Uri.withAppendedPath(lookupUri, Contacts.Entity.CONTENT_DIRECTORY);
+
+        ContactQueries queries = new ContactQueries();
+        mContactsProvider.expectTypeQuery(rawContactUri, RawContacts.CONTENT_ITEM_TYPE);
+        queries.fetchContactIdAndLookupFromRawContactUri(rawContactUri, contactId, lookupKey);
+        queries.fetchAllData(entityUri, contactId, rawContactId, dataId, lookupKey);
+
+        ContactLoader.Result contact = assertLoadContact(rawContactUri);
+
+        assertEquals(contactId, contact.getId());
+        assertEquals(rawContactId, contact.getNameRawContactId());
+        assertEquals(DisplayNameSources.STRUCTURED_NAME, contact.getDisplayNameSource());
+        assertEquals(lookupKey, contact.getLookupKey());
+        assertEquals(lookupUri, contact.getLookupUri());
+        assertEquals(1, contact.getEntities().size());
+        assertEquals(1, contact.getStatuses().size());
+        mContactsProvider.verify();
+    }
+
+    public void testLoadContactWithContactLookupUri() {
+        // Use lookup-style Uris that do not contain the Contact-ID
+
+        final long contactId = 1;
+        final long rawContactId = 11;
+        final long dataId = 21;
+
+        final String lookupKey = "aa%12%@!";
+        final Uri baseUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+        final Uri lookupNoIdUri = Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey);
+        final Uri lookupUri = ContentUris.withAppendedId(lookupNoIdUri, contactId);
+        final Uri entityUri = Uri.withAppendedPath(lookupNoIdUri, Contacts.Entity.CONTENT_DIRECTORY);
+
+        ContactQueries queries = new ContactQueries();
+        mContactsProvider.expectTypeQuery(lookupNoIdUri, Contacts.CONTENT_ITEM_TYPE);
+        queries.fetchAllData(entityUri, contactId, rawContactId, dataId, lookupKey);
+
+        ContactLoader.Result contact = assertLoadContact(lookupNoIdUri);
+
+        assertEquals(contactId, contact.getId());
+        assertEquals(rawContactId, contact.getNameRawContactId());
+        assertEquals(DisplayNameSources.STRUCTURED_NAME, contact.getDisplayNameSource());
+        assertEquals(lookupKey, contact.getLookupKey());
+        assertEquals(lookupUri, contact.getLookupUri());
+        assertEquals(1, contact.getEntities().size());
+        assertEquals(1, contact.getStatuses().size());
+        mContactsProvider.verify();
+    }
+
+    public void testLoadContactWithContactLookupAndIdUri() {
+        // Use lookup-style Uris that also contain the Contact-ID
+        final long contactId = 1;
+        final long rawContactId = 11;
+        final long dataId = 21;
+
+        final String lookupKey = "aa%12%@!";
+        final Uri baseUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+        final Uri lookupUri = ContentUris.withAppendedId(
+                Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey),
+                contactId);
+        final Uri entityUri = Uri.withAppendedPath(lookupUri, Contacts.Entity.CONTENT_DIRECTORY);
+
+        ContactQueries queries = new ContactQueries();
+        mContactsProvider.expectTypeQuery(lookupUri, Contacts.CONTENT_ITEM_TYPE);
+        queries.fetchAllData(entityUri, contactId, rawContactId, dataId, lookupKey);
+
+        ContactLoader.Result contact = assertLoadContact(lookupUri);
+
+        assertEquals(contactId, contact.getId());
+        assertEquals(rawContactId, contact.getNameRawContactId());
+        assertEquals(DisplayNameSources.STRUCTURED_NAME, contact.getDisplayNameSource());
+        assertEquals(lookupKey, contact.getLookupKey());
+        assertEquals(lookupUri, contact.getLookupUri());
+        assertEquals(1, contact.getEntities().size());
+        assertEquals(1, contact.getStatuses().size());
+        mContactsProvider.verify();
+    }
+
+    public void testLoadContactWithContactLookupWithIncorrectIdUri() {
+        // Use lookup-style Uris that contain incorrect Contact-ID
+        // (we want to ensure that still the correct contact is chosen)
+
+        final long contactId = 1;
+        final long wrongContactId = 2;
+        final long rawContactId = 11;
+        final long wrongRawContactId = 12;
+        final long dataId = 21;
+
+        final String lookupKey = "aa%12%@!";
+        final String wrongLookupKey = "ab%12%@!";
+        final Uri baseUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+        final Uri wrongBaseUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, wrongContactId);
+        final Uri lookupUri = ContentUris.withAppendedId(
+                Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey),
+                contactId);
+        final Uri lookupWithWrongIdUri = ContentUris.withAppendedId(
+                Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey),
+                wrongContactId);
+        final Uri entityUri = Uri.withAppendedPath(lookupWithWrongIdUri,
+                Contacts.Entity.CONTENT_DIRECTORY);
+
+        ContactQueries queries = new ContactQueries();
+        mContactsProvider.expectTypeQuery(lookupWithWrongIdUri, Contacts.CONTENT_ITEM_TYPE);
+        queries.fetchAllData(entityUri, contactId, rawContactId, dataId, lookupKey);
+
+        ContactLoader.Result contact = assertLoadContact(lookupWithWrongIdUri);
+
+        assertEquals(contactId, contact.getId());
+        assertEquals(rawContactId, contact.getNameRawContactId());
+        assertEquals(DisplayNameSources.STRUCTURED_NAME, contact.getDisplayNameSource());
+        assertEquals(lookupKey, contact.getLookupKey());
+        assertEquals(lookupUri, contact.getLookupUri());
+        assertEquals(1, contact.getEntities().size());
+        assertEquals(1, contact.getStatuses().size());
+
+        mContactsProvider.verify();
+    }
+
+    class ContactQueries {
+        public void fetchAllData(
+                Uri baseUri, long contactId, long rawContactId, long dataId, String encodedLookup) {
+            mContactsProvider.expectQuery(baseUri)
+                    .withProjection(new String[] {
+                        Contacts.NAME_RAW_CONTACT_ID, Contacts.DISPLAY_NAME_SOURCE,
+                        Contacts.LOOKUP_KEY, Contacts.DISPLAY_NAME, Contacts.PHONETIC_NAME,
+                        Contacts.PHOTO_ID, Contacts.STARRED, Contacts.CONTACT_PRESENCE,
+                        Contacts.CONTACT_STATUS, Contacts.CONTACT_STATUS_TIMESTAMP,
+                        Contacts.CONTACT_STATUS_RES_PACKAGE, Contacts.CONTACT_STATUS_LABEL,
+
+                        Contacts.Entity.CONTACT_ID,
+                        Contacts.Entity.RAW_CONTACT_ID,
+
+                        RawContacts.ACCOUNT_NAME, RawContacts.ACCOUNT_TYPE, RawContacts.DIRTY,
+                        RawContacts.VERSION, RawContacts.SOURCE_ID, RawContacts.SYNC1,
+                        RawContacts.SYNC2, RawContacts.SYNC3, RawContacts.SYNC4,
+                        RawContacts.DELETED, RawContacts.IS_RESTRICTED,
+                        RawContacts.NAME_VERIFIED,
+
+                        Contacts.Entity.DATA_ID,
+
+                        Data.DATA1, Data.DATA2, Data.DATA3, Data.DATA4, Data.DATA5,
+                        Data.DATA6, Data.DATA7, Data.DATA8, Data.DATA9, Data.DATA10,
+                        Data.DATA11, Data.DATA12, Data.DATA13, Data.DATA14, Data.DATA15,
+                        Data.SYNC1, Data.SYNC2, Data.SYNC3, Data.SYNC4,
+                        Data.DATA_VERSION, Data.IS_PRIMARY,
+                        Data.IS_SUPER_PRIMARY, Data.MIMETYPE, Data.RES_PACKAGE,
+
+                        GroupMembership.GROUP_SOURCE_ID,
+
+                        Data.PRESENCE, Data.CHAT_CAPABILITY,
+                        Data.STATUS, Data.STATUS_RES_PACKAGE, Data.STATUS_ICON,
+                        Data.STATUS_LABEL, Data.STATUS_TIMESTAMP,
+                    })
+                    .withSortOrder(Contacts.Entity.RAW_CONTACT_ID)
+                    .returnRow(
+                        rawContactId, 40,
+                        "aa%12%@!", "John Doe", "jdo",
+                        0, 0, StatusUpdates.AVAILABLE,
+                        "Having lunch", 0,
+                        "mockPkg1", 10,
+
+                        contactId,
+                        rawContactId,
+
+                        "mockAccountName", "mockAccountType", 0,
+                        1, 0, "sync1",
+                        "sync2", "sync3", "sync4",
+                        0, 0, 0,
+
+                        dataId,
+
+                        "dat1", "dat2", "dat3", "dat4", "dat5",
+                        "dat6", "dat7", "dat8", "dat9", "dat10",
+                        "dat11", "dat12", "dat13", "dat14", "dat15",
+                        "syn1", "syn2", "syn3", "syn4",
+
+                        0, 0,
+                        0, StructuredName.CONTENT_ITEM_TYPE, "mockPkg2",
+
+                        "groupId",
+
+                        StatusUpdates.INVISIBLE, null,
+                        "Having dinner", "mockPkg3", 0,
+                        20, 0
+                    );
+        }
+
+        void fetchLookupAndId(final Uri sourceUri, final long expectedContactId,
+                final String expectedEncodedLookup) {
+            mContactsProvider.expectQuery(sourceUri)
+                    .withProjection(Contacts.LOOKUP_KEY, Contacts._ID)
+                    .returnRow(expectedEncodedLookup, expectedContactId);
+        }
+
+        void fetchContactIdAndLookupFromRawContactUri(final Uri rawContactUri,
+                final long expectedContactId, final String expectedEncodedLookup) {
+            // TODO: use a lighter query by joining rawcontacts with contacts in provider
+            // (See ContactContracts.java)
+            final Uri dataUri = Uri.withAppendedPath(rawContactUri,
+                    RawContacts.Data.CONTENT_DIRECTORY);
+            mContactsProvider.expectQuery(dataUri)
+                    .withProjection(RawContacts.CONTACT_ID, Contacts.LOOKUP_KEY)
+                    .returnRow(expectedContactId, expectedEncodedLookup);
+        }
+    }
+}
diff --git a/tests/src/com/android/contacts/ContactsUtilsTests.java b/tests/src/com/android/contacts/ContactsUtilsTests.java
index 8e18044..7e85c32 100644
--- a/tests/src/com/android/contacts/ContactsUtilsTests.java
+++ b/tests/src/com/android/contacts/ContactsUtilsTests.java
@@ -16,6 +16,8 @@
 
 package com.android.contacts;
 
+import com.android.contacts.ContactsUtils.ImActions;
+
 import android.content.ContentValues;
 import android.content.Intent;
 import android.net.Uri;
@@ -34,24 +36,63 @@
     private static final String TEST_PROTOCOL = "prot%col";
 
     public void testImIntent() throws Exception {
-        // Normal IM is appended as path
+        // Test GTalk XMPP URI. No chat capabilities provided
         final ContentValues values = new ContentValues();
         values.put(Im.MIMETYPE, Im.CONTENT_ITEM_TYPE);
         values.put(Im.TYPE, Im.TYPE_HOME);
         values.put(Im.PROTOCOL, Im.PROTOCOL_GOOGLE_TALK);
         values.put(Im.DATA, TEST_ADDRESS);
 
-        final Intent intent = ContactsUtils.buildImIntent(values);
+        final ImActions imActions = ContactsUtils.buildImActions(values);
+        final Intent intent = imActions.getPrimaryIntent();
         assertEquals(Intent.ACTION_SENDTO, intent.getAction());
+        assertEquals("xmpp:" + TEST_ADDRESS + "?message", intent.getData().toString());
 
-        final Uri data = intent.getData();
-        assertEquals("imto", data.getScheme());
-        assertEquals("gtalk", data.getAuthority());
-        assertEquals(TEST_ADDRESS, data.getPathSegments().get(0));
+        assertNull(imActions.getSecondaryIntent());
+    }
+
+    public void testImIntentWithAudio() throws Exception {
+        // Test GTalk XMPP URI. Audio chat capabilities provided
+        final ContentValues values = new ContentValues();
+        values.put(Im.MIMETYPE, Im.CONTENT_ITEM_TYPE);
+        values.put(Im.TYPE, Im.TYPE_HOME);
+        values.put(Im.PROTOCOL, Im.PROTOCOL_GOOGLE_TALK);
+        values.put(Im.DATA, TEST_ADDRESS);
+        values.put(Im.CHAT_CAPABILITY, Im.CAPABILITY_HAS_VOICE | Im.CAPABILITY_HAS_VIDEO);
+
+        final ImActions imActions = ContactsUtils.buildImActions(values);
+        final Intent primaryIntent = imActions.getPrimaryIntent();
+        assertEquals(Intent.ACTION_SENDTO, primaryIntent.getAction());
+        assertEquals("xmpp:" + TEST_ADDRESS + "?message", primaryIntent.getData().toString());
+
+        final Intent secondaryIntent = imActions.getSecondaryIntent();
+        assertEquals(Intent.ACTION_SENDTO, secondaryIntent.getAction());
+        assertEquals("xmpp:" + TEST_ADDRESS + "?call", secondaryIntent.getData().toString());
+    }
+
+    public void testImIntentWithVideo() throws Exception {
+        // Test GTalk XMPP URI. Video chat capabilities provided
+        final ContentValues values = new ContentValues();
+        values.put(Im.MIMETYPE, Im.CONTENT_ITEM_TYPE);
+        values.put(Im.TYPE, Im.TYPE_HOME);
+        values.put(Im.PROTOCOL, Im.PROTOCOL_GOOGLE_TALK);
+        values.put(Im.DATA, TEST_ADDRESS);
+        values.put(Im.CHAT_CAPABILITY, Im.CAPABILITY_HAS_VOICE | Im.CAPABILITY_HAS_VIDEO |
+                Im.CAPABILITY_HAS_VOICE);
+
+        final ImActions imActions = ContactsUtils.buildImActions(values);
+        final Intent primaryIntent = imActions.getPrimaryIntent();
+        assertEquals(Intent.ACTION_SENDTO, primaryIntent.getAction());
+        assertEquals("xmpp:" + TEST_ADDRESS + "?message", primaryIntent.getData().toString());
+
+        final Intent secondaryIntent = imActions.getSecondaryIntent();
+        assertEquals(Intent.ACTION_SENDTO, secondaryIntent.getAction());
+        assertEquals("xmpp:" + TEST_ADDRESS + "?call", secondaryIntent.getData().toString());
     }
 
     public void testImIntentCustom() throws Exception {
-        // Custom IM types have encoded authority
+        // Custom IM types have encoded authority. We send the imto Intent here, because
+        // legacy third party apps might not accept xmpp yet
         final ContentValues values = new ContentValues();
         values.put(Im.MIMETYPE, Im.CONTENT_ITEM_TYPE);
         values.put(Im.TYPE, Im.TYPE_HOME);
@@ -59,29 +100,37 @@
         values.put(Im.CUSTOM_PROTOCOL, TEST_PROTOCOL);
         values.put(Im.DATA, TEST_ADDRESS);
 
-        final Intent intent = ContactsUtils.buildImIntent(values);
+        final ImActions actions = ContactsUtils.buildImActions(values);
+        final Intent intent = actions.getPrimaryIntent();
         assertEquals(Intent.ACTION_SENDTO, intent.getAction());
 
         final Uri data = intent.getData();
         assertEquals("imto", data.getScheme());
         assertEquals(TEST_PROTOCOL, data.getAuthority());
         assertEquals(TEST_ADDRESS, data.getPathSegments().get(0));
+
+        assertNull(actions.getSecondaryIntent());
     }
 
     public void testImEmailIntent() throws Exception {
         // Email addresses are treated as Google Talk entries
+        // This test only tests the VIDEO+CAMERA case. The other cases have been addressed by the
+        // Im tests
         final ContentValues values = new ContentValues();
         values.put(Email.MIMETYPE, Email.CONTENT_ITEM_TYPE);
         values.put(Email.TYPE, Email.TYPE_HOME);
         values.put(Email.DATA, TEST_ADDRESS);
+        values.put(Email.CHAT_CAPABILITY, Im.CAPABILITY_HAS_VOICE | Im.CAPABILITY_HAS_VIDEO |
+                Im.CAPABILITY_HAS_VOICE);
 
-        final Intent intent = ContactsUtils.buildImIntent(values);
-        assertEquals(Intent.ACTION_SENDTO, intent.getAction());
+        final ImActions imActions = ContactsUtils.buildImActions(values);
+        final Intent primaryIntent = imActions.getPrimaryIntent();
+        assertEquals(Intent.ACTION_SENDTO, primaryIntent.getAction());
+        assertEquals("xmpp:" + TEST_ADDRESS + "?message", primaryIntent.getData().toString());
 
-        final Uri data = intent.getData();
-        assertEquals("imto", data.getScheme());
-        assertEquals("gtalk", data.getAuthority());
-        assertEquals(TEST_ADDRESS, data.getPathSegments().get(0));
+        final Intent secondaryIntent = imActions.getSecondaryIntent();
+        assertEquals(Intent.ACTION_SENDTO, secondaryIntent.getAction());
+        assertEquals("xmpp:" + TEST_ADDRESS + "?call", secondaryIntent.getData().toString());
     }
 
     public void testIsGraphicNull() throws Exception {
diff --git a/tests/src/com/android/contacts/DefaultContactBrowseListFragmentTest.java b/tests/src/com/android/contacts/DefaultContactBrowseListFragmentTest.java
new file mode 100644
index 0000000..8ad3cb9
--- /dev/null
+++ b/tests/src/com/android/contacts/DefaultContactBrowseListFragmentTest.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2009 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.contacts;
+
+import com.android.contacts.list.DefaultContactBrowseListFragment;
+import com.android.contacts.tests.mocks.ContactsMockContext;
+import com.android.contacts.tests.mocks.MockContentProvider;
+import com.android.contacts.widget.TestLoaderManager;
+
+import android.database.Cursor;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.ContactCounts;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.ProviderStatus;
+import android.provider.ContactsContract.StatusUpdates;
+import android.provider.Settings;
+import android.test.InstrumentationTestCase;
+import android.test.suitebuilder.annotation.Smoke;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+
+
+/**
+ * Tests for {@link DefaultContactBrowseListFragment}.
+ *
+ * Running all tests:
+ *
+ *   runtest contacts
+ * or
+ *   adb shell am instrument \
+ *     -w com.android.contacts.tests/android.test.InstrumentationTestRunner
+ */
+@Smoke
+public class DefaultContactBrowseListFragmentTest
+        extends InstrumentationTestCase {
+
+    private ContactsMockContext mContext;
+    private MockContentProvider mContactsProvider;
+    private MockContentProvider mSettingsProvider;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mContext = new ContactsMockContext(getInstrumentation().getTargetContext());
+        mContactsProvider = mContext.getContactsProvider();
+        mSettingsProvider = mContext.getSettingsProvider();
+    }
+
+    public void testDefaultMode() throws Exception {
+
+        mSettingsProvider.expectQuery(Settings.System.CONTENT_URI)
+                .withProjection(Settings.System.VALUE)
+                .withSelection(Settings.System.NAME + "=?",
+                        ContactsContract.Preferences.DISPLAY_ORDER);
+
+        mSettingsProvider.expectQuery(Settings.System.CONTENT_URI)
+                .withProjection(Settings.System.VALUE)
+                .withSelection(Settings.System.NAME + "=?",
+                        ContactsContract.Preferences.SORT_ORDER);
+
+        mContactsProvider.expectQuery(
+                Contacts.CONTENT_URI.buildUpon()
+                        .appendQueryParameter(ContactCounts.ADDRESS_BOOK_INDEX_EXTRAS, "true")
+                        .build())
+                .withProjection(
+                        Contacts._ID,
+                        Contacts.DISPLAY_NAME,
+                        Contacts.DISPLAY_NAME_ALTERNATIVE,
+                        Contacts.SORT_KEY_PRIMARY,
+                        Contacts.STARRED,
+                        Contacts.CONTACT_PRESENCE,
+                        Contacts.PHOTO_ID,
+                        Contacts.LOOKUP_KEY,
+                        Contacts.PHONETIC_NAME,
+                        Contacts.HAS_PHONE_NUMBER)
+                .withSelection(Contacts.IN_VISIBLE_GROUP + "=1")
+                .withSortOrder(Contacts.SORT_KEY_PRIMARY)
+                .returnRow(1, "John", "John", "john", 1,
+                        StatusUpdates.AVAILABLE, 23, "lk1", "john", 1)
+                .returnRow(2, "Jim", "Jim", "jim", 1,
+                        StatusUpdates.AWAY, 24, "lk2", "jim", 0);
+
+        mContactsProvider.expectQuery(ProviderStatus.CONTENT_URI)
+                .withProjection(ProviderStatus.STATUS, ProviderStatus.DATA1);
+
+        DefaultContactBrowseListFragment fragment = new DefaultContactBrowseListFragment();
+
+        TestLoaderManager loaderManager = new TestLoaderManager();
+
+        // Divert loader registration the TestLoaderManager to ensure that loading is
+        // done synchronously
+        fragment.setLoaderManager(loaderManager);
+
+        // Fragment life cycle
+        fragment.onCreate(null);
+
+        // Instead of attaching the fragment to an activity, "attach" it to the target context
+        // of the instrumentation
+        fragment.setContext(mContext);
+
+        // Fragment life cycle
+        View view = fragment.onCreateView(LayoutInflater.from(mContext), null, null);
+
+        // Fragment life cycle
+        fragment.onStart();
+
+        // All loaders have been registered. Now perform the loading synchronously.
+        loaderManager.executeLoaders();
+
+        // Now we can assert that the data got loaded into the list.
+        ListView listView = (ListView)view.findViewById(android.R.id.list);
+        ListAdapter adapter = listView.getAdapter();
+        assertEquals(3, adapter.getCount());        // It has two items + header view
+
+        // Assert that all queries have been called
+        mSettingsProvider.verify();
+        mContactsProvider.verify();
+    }
+}
diff --git a/tests/src/com/android/contacts/EntityDeltaListTests.java b/tests/src/com/android/contacts/EntityDeltaListTests.java
new file mode 100644
index 0000000..4904fa8
--- /dev/null
+++ b/tests/src/com/android/contacts/EntityDeltaListTests.java
@@ -0,0 +1,594 @@
+/*
+ * Copyright (C) 2009 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.contacts;
+
+import static android.content.ContentProviderOperation.TYPE_ASSERT;
+import static android.content.ContentProviderOperation.TYPE_DELETE;
+import static android.content.ContentProviderOperation.TYPE_INSERT;
+import static android.content.ContentProviderOperation.TYPE_UPDATE;
+
+import com.android.contacts.EntityModifierTests.MockContactsSource;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.EntityDelta;
+import com.android.contacts.model.EntityModifier;
+import com.android.contacts.model.EntityDeltaList;
+import com.android.contacts.model.EntityDelta.ValuesDelta;
+import com.google.android.collect.Lists;
+
+import android.content.ContentProviderOperation;
+import android.content.ContentValues;
+import android.content.Entity;
+import android.net.Uri;
+import android.provider.BaseColumns;
+import android.provider.ContactsContract.AggregationExceptions;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.RawContacts;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.LargeTest;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+
+/**
+ * Tests for {@link EntityDeltaList} which focus on "diff" operations that should
+ * create {@link AggregationExceptions} in certain cases.
+ */
+@LargeTest
+public class EntityDeltaListTests extends AndroidTestCase {
+    public static final String TAG = "EntityDeltaListTests";
+
+    private static final long CONTACT_FIRST = 1;
+    private static final long CONTACT_SECOND = 2;
+
+    public static final long CONTACT_BOB = 10;
+    public static final long CONTACT_MARY = 11;
+
+    public static final long PHONE_RED = 20;
+    public static final long PHONE_GREEN = 21;
+    public static final long PHONE_BLUE = 22;
+
+    public static final long EMAIL_YELLOW = 25;
+
+    public static final long VER_FIRST = 100;
+    public static final long VER_SECOND = 200;
+
+    public static final String TEST_PHONE = "555-1212";
+    public static final String TEST_ACCOUNT = "org.example.test";
+
+    public EntityDeltaListTests() {
+        super();
+    }
+
+    @Override
+    public void setUp() {
+        mContext = getContext();
+    }
+
+    /**
+     * Build a {@link BaseAccountType} that has various odd constraints for
+     * testing purposes.
+     */
+    protected BaseAccountType getSource() {
+        final BaseAccountType source = new MockContactsSource();
+        source.ensureInflated(getContext(), BaseAccountType.LEVEL_CONSTRAINTS);
+        return source;
+    }
+
+    static ContentValues getValues(ContentProviderOperation operation)
+            throws NoSuchFieldException, IllegalAccessException {
+        final Field field = ContentProviderOperation.class.getDeclaredField("mValues");
+        field.setAccessible(true);
+        return (ContentValues) field.get(operation);
+    }
+
+    static EntityDelta getUpdate(long rawContactId) {
+        final Entity before = EntityDeltaTests.getEntity(rawContactId,
+                EntityDeltaTests.TEST_PHONE_ID);
+        return EntityDelta.fromBefore(before);
+    }
+
+    static EntityDelta getInsert() {
+        final ContentValues after = new ContentValues();
+        after.put(RawContacts.ACCOUNT_NAME, EntityDeltaTests.TEST_ACCOUNT_NAME);
+        after.put(RawContacts.SEND_TO_VOICEMAIL, 1);
+
+        final ValuesDelta values = ValuesDelta.fromAfter(after);
+        return new EntityDelta(values);
+    }
+
+    static EntityDeltaList buildSet(EntityDelta... deltas) {
+        final EntityDeltaList set = EntityDeltaList.fromSingle(deltas[0]);
+        for (int i = 1; i < deltas.length; i++) {
+            set.add(deltas[i]);
+        }
+        return set;
+    }
+
+    static EntityDelta buildBeforeEntity(long rawContactId, long version,
+            ContentValues... entries) {
+        // Build an existing contact read from database
+        final ContentValues contact = new ContentValues();
+        contact.put(RawContacts.VERSION, version);
+        contact.put(RawContacts._ID, rawContactId);
+        final Entity before = new Entity(contact);
+        for (ContentValues entry : entries) {
+            before.addSubValue(Data.CONTENT_URI, entry);
+        }
+        return EntityDelta.fromBefore(before);
+    }
+
+    static EntityDelta buildAfterEntity(ContentValues... entries) {
+        // Build an existing contact read from database
+        final ContentValues contact = new ContentValues();
+        contact.put(RawContacts.ACCOUNT_TYPE, TEST_ACCOUNT);
+        final EntityDelta after = new EntityDelta(ValuesDelta.fromAfter(contact));
+        for (ContentValues entry : entries) {
+            after.addEntry(ValuesDelta.fromAfter(entry));
+        }
+        return after;
+    }
+
+    static ContentValues buildPhone(long phoneId) {
+        return buildPhone(phoneId, Long.toString(phoneId));
+    }
+
+    static ContentValues buildPhone(long phoneId, String value) {
+        final ContentValues values = new ContentValues();
+        values.put(Data._ID, phoneId);
+        values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
+        values.put(Phone.NUMBER, value);
+        values.put(Phone.TYPE, Phone.TYPE_HOME);
+        return values;
+    }
+
+    static ContentValues buildEmail(long emailId) {
+        final ContentValues values = new ContentValues();
+        values.put(Data._ID, emailId);
+        values.put(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE);
+        values.put(Email.DATA, Long.toString(emailId));
+        values.put(Email.TYPE, Email.TYPE_HOME);
+        return values;
+    }
+
+    static void insertPhone(EntityDeltaList set, long rawContactId, ContentValues values) {
+        final EntityDelta match = set.getByRawContactId(rawContactId);
+        match.addEntry(ValuesDelta.fromAfter(values));
+    }
+
+    static ValuesDelta getPhone(EntityDeltaList set, long rawContactId, long dataId) {
+        final EntityDelta match = set.getByRawContactId(rawContactId);
+        return match.getEntry(dataId);
+    }
+
+    static void assertDiffPattern(EntityDelta delta, ContentProviderOperation... pattern) {
+        final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
+        delta.buildAssert(diff);
+        delta.buildDiff(diff);
+        assertDiffPattern(diff, pattern);
+    }
+
+    static void assertDiffPattern(EntityDeltaList set, ContentProviderOperation... pattern) {
+        assertDiffPattern(set.buildDiff(), pattern);
+    }
+
+    static void assertDiffPattern(ArrayList<ContentProviderOperation> diff,
+            ContentProviderOperation... pattern) {
+        assertEquals("Unexpected operations", pattern.length, diff.size());
+        for (int i = 0; i < pattern.length; i++) {
+            final ContentProviderOperation expected = pattern[i];
+            final ContentProviderOperation found = diff.get(i);
+
+            assertEquals("Unexpected uri", expected.getUri(), found.getUri());
+
+            final String expectedType = getStringForType(expected.getType());
+            final String foundType = getStringForType(found.getType());
+            assertEquals("Unexpected type", expectedType, foundType);
+
+            if (expected.getType() == TYPE_DELETE) continue;
+
+            try {
+                final ContentValues expectedValues = getValues(expected);
+                final ContentValues foundValues = getValues(found);
+
+                expectedValues.remove(BaseColumns._ID);
+                foundValues.remove(BaseColumns._ID);
+
+                assertEquals("Unexpected values", expectedValues, foundValues);
+            } catch (NoSuchFieldException e) {
+                fail(e.toString());
+            } catch (IllegalAccessException e) {
+                fail(e.toString());
+            }
+        }
+    }
+
+    static String getStringForType(int type) {
+        switch (type) {
+            case TYPE_ASSERT: return "TYPE_ASSERT";
+            case TYPE_INSERT: return "TYPE_INSERT";
+            case TYPE_UPDATE: return "TYPE_UPDATE";
+            case TYPE_DELETE: return "TYPE_DELETE";
+            default: return Integer.toString(type);
+        }
+    }
+
+    static ContentProviderOperation buildAssertVersion(long version) {
+        final ContentValues values = new ContentValues();
+        values.put(RawContacts.VERSION, version);
+        return buildOper(RawContacts.CONTENT_URI, TYPE_ASSERT, values);
+    }
+
+    static ContentProviderOperation buildAggregationModeUpdate(int mode) {
+        final ContentValues values = new ContentValues();
+        values.put(RawContacts.AGGREGATION_MODE, mode);
+        return buildOper(RawContacts.CONTENT_URI, TYPE_UPDATE, values);
+    }
+
+    static ContentProviderOperation buildUpdateAggregationSuspended() {
+        return buildAggregationModeUpdate(RawContacts.AGGREGATION_MODE_SUSPENDED);
+    }
+
+    static ContentProviderOperation buildUpdateAggregationDefault() {
+        return buildAggregationModeUpdate(RawContacts.AGGREGATION_MODE_DEFAULT);
+    }
+
+    static ContentProviderOperation buildUpdateAggregationKeepTogether(long rawContactId) {
+        final ContentValues values = new ContentValues();
+        values.put(AggregationExceptions.RAW_CONTACT_ID1, rawContactId);
+        values.put(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_TOGETHER);
+        return buildOper(AggregationExceptions.CONTENT_URI, TYPE_UPDATE, values);
+    }
+
+    static ContentValues buildDataInsert(ValuesDelta values, long rawContactId) {
+        final ContentValues insertValues = values.getCompleteValues();
+        insertValues.put(Data.RAW_CONTACT_ID, rawContactId);
+        return insertValues;
+    }
+
+    static ContentProviderOperation buildDelete(Uri uri) {
+        return buildOper(uri, TYPE_DELETE, (ContentValues)null);
+    }
+
+    static ContentProviderOperation buildOper(Uri uri, int type, ValuesDelta values) {
+        return buildOper(uri, type, values.getCompleteValues());
+    }
+
+    static ContentProviderOperation buildOper(Uri uri, int type, ContentValues values) {
+        switch (type) {
+            case TYPE_ASSERT:
+                return ContentProviderOperation.newAssertQuery(uri).withValues(values).build();
+            case TYPE_INSERT:
+                return ContentProviderOperation.newInsert(uri).withValues(values).build();
+            case TYPE_UPDATE:
+                return ContentProviderOperation.newUpdate(uri).withValues(values).build();
+            case TYPE_DELETE:
+                return ContentProviderOperation.newDelete(uri).build();
+        }
+        return null;
+    }
+
+    static Long getVersion(EntityDeltaList set, Long rawContactId) {
+        return set.getByRawContactId(rawContactId).getValues().getAsLong(RawContacts.VERSION);
+    }
+
+    /**
+     * Count number of {@link AggregationExceptions} updates contained in the
+     * given list of {@link ContentProviderOperation}.
+     */
+    static int countExceptionUpdates(ArrayList<ContentProviderOperation> diff) {
+        int updateCount = 0;
+        for (ContentProviderOperation oper : diff) {
+            if (AggregationExceptions.CONTENT_URI.equals(oper.getUri())
+                    && oper.getType() == ContentProviderOperation.TYPE_UPDATE) {
+                updateCount++;
+            }
+        }
+        return updateCount;
+    }
+
+    public void testInsert() {
+        final EntityDelta insert = getInsert();
+        final EntityDeltaList set = buildSet(insert);
+
+        // Inserting single shouldn't create rules
+        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
+        final int exceptionCount = countExceptionUpdates(diff);
+        assertEquals("Unexpected exception updates", 0, exceptionCount);
+    }
+
+    public void testUpdateUpdate() {
+        final EntityDelta updateFirst = getUpdate(CONTACT_FIRST);
+        final EntityDelta updateSecond = getUpdate(CONTACT_SECOND);
+        final EntityDeltaList set = buildSet(updateFirst, updateSecond);
+
+        // Updating two existing shouldn't create rules
+        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
+        final int exceptionCount = countExceptionUpdates(diff);
+        assertEquals("Unexpected exception updates", 0, exceptionCount);
+    }
+
+    public void testUpdateInsert() {
+        final EntityDelta update = getUpdate(CONTACT_FIRST);
+        final EntityDelta insert = getInsert();
+        final EntityDeltaList set = buildSet(update, insert);
+
+        // New insert should only create one rule
+        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
+        final int exceptionCount = countExceptionUpdates(diff);
+        assertEquals("Unexpected exception updates", 1, exceptionCount);
+    }
+
+    public void testInsertUpdateInsert() {
+        final EntityDelta insertFirst = getInsert();
+        final EntityDelta update = getUpdate(CONTACT_FIRST);
+        final EntityDelta insertSecond = getInsert();
+        final EntityDeltaList set = buildSet(insertFirst, update, insertSecond);
+
+        // Two inserts should create two rules to bind against single existing
+        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
+        final int exceptionCount = countExceptionUpdates(diff);
+        assertEquals("Unexpected exception updates", 2, exceptionCount);
+    }
+
+    public void testInsertInsertInsert() {
+        final EntityDelta insertFirst = getInsert();
+        final EntityDelta insertSecond = getInsert();
+        final EntityDelta insertThird = getInsert();
+        final EntityDeltaList set = buildSet(insertFirst, insertSecond, insertThird);
+
+        // Three new inserts should create only two binding rules
+        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
+        final int exceptionCount = countExceptionUpdates(diff);
+        assertEquals("Unexpected exception updates", 2, exceptionCount);
+    }
+
+    public void testMergeDataRemoteInsert() {
+        final EntityDeltaList first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
+                buildPhone(PHONE_RED)));
+        final EntityDeltaList second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
+                buildPhone(PHONE_RED), buildPhone(PHONE_GREEN)));
+
+        // Merge in second version, verify they match
+        final EntityDeltaList merged = EntityDeltaList.mergeAfter(second, first);
+        assertEquals("Unexpected change when merging", second, merged);
+    }
+
+    public void testMergeDataLocalUpdateRemoteInsert() {
+        final EntityDeltaList first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
+                buildPhone(PHONE_RED)));
+        final EntityDeltaList second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
+                buildPhone(PHONE_RED), buildPhone(PHONE_GREEN)));
+
+        // Change the local number to trigger update
+        final ValuesDelta phone = getPhone(first, CONTACT_BOB, PHONE_RED);
+        phone.put(Phone.NUMBER, TEST_PHONE);
+
+        assertDiffPattern(first,
+                buildAssertVersion(VER_FIRST),
+                buildUpdateAggregationSuspended(),
+                buildOper(Data.CONTENT_URI, TYPE_UPDATE, phone.getAfter()),
+                buildUpdateAggregationDefault());
+
+        // Merge in the second version, verify diff matches
+        final EntityDeltaList merged = EntityDeltaList.mergeAfter(second, first);
+        assertDiffPattern(merged,
+                buildAssertVersion(VER_SECOND),
+                buildUpdateAggregationSuspended(),
+                buildOper(Data.CONTENT_URI, TYPE_UPDATE, phone.getAfter()),
+                buildUpdateAggregationDefault());
+    }
+
+    public void testMergeDataLocalUpdateRemoteDelete() {
+        final EntityDeltaList first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
+                buildPhone(PHONE_RED)));
+        final EntityDeltaList second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
+                buildPhone(PHONE_GREEN)));
+
+        // Change the local number to trigger update
+        final ValuesDelta phone = getPhone(first, CONTACT_BOB, PHONE_RED);
+        phone.put(Phone.NUMBER, TEST_PHONE);
+
+        assertDiffPattern(first,
+                buildAssertVersion(VER_FIRST),
+                buildUpdateAggregationSuspended(),
+                buildOper(Data.CONTENT_URI, TYPE_UPDATE, phone.getAfter()),
+                buildUpdateAggregationDefault());
+
+        // Merge in the second version, verify that our update changed to
+        // insert, since RED was deleted on remote side
+        final EntityDeltaList merged = EntityDeltaList.mergeAfter(second, first);
+        assertDiffPattern(merged,
+                buildAssertVersion(VER_SECOND),
+                buildUpdateAggregationSuspended(),
+                buildOper(Data.CONTENT_URI, TYPE_INSERT, buildDataInsert(phone, CONTACT_BOB)),
+                buildUpdateAggregationDefault());
+    }
+
+    public void testMergeDataLocalDeleteRemoteUpdate() {
+        final EntityDeltaList first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
+                buildPhone(PHONE_RED)));
+        final EntityDeltaList second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
+                buildPhone(PHONE_RED, TEST_PHONE)));
+
+        // Delete phone locally
+        final ValuesDelta phone = getPhone(first, CONTACT_BOB, PHONE_RED);
+        phone.markDeleted();
+
+        assertDiffPattern(first,
+                buildAssertVersion(VER_FIRST),
+                buildUpdateAggregationSuspended(),
+                buildDelete(Data.CONTENT_URI),
+                buildUpdateAggregationDefault());
+
+        // Merge in the second version, verify that our delete remains
+        final EntityDeltaList merged = EntityDeltaList.mergeAfter(second, first);
+        assertDiffPattern(merged,
+                buildAssertVersion(VER_SECOND),
+                buildUpdateAggregationSuspended(),
+                buildDelete(Data.CONTENT_URI),
+                buildUpdateAggregationDefault());
+    }
+
+    public void testMergeDataLocalInsertRemoteInsert() {
+        final EntityDeltaList first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
+                buildPhone(PHONE_RED)));
+        final EntityDeltaList second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
+                buildPhone(PHONE_RED), buildPhone(PHONE_GREEN)));
+
+        // Insert new phone locally
+        final ValuesDelta bluePhone = ValuesDelta.fromAfter(buildPhone(PHONE_BLUE));
+        first.getByRawContactId(CONTACT_BOB).addEntry(bluePhone);
+        assertDiffPattern(first,
+                buildAssertVersion(VER_FIRST),
+                buildUpdateAggregationSuspended(),
+                buildOper(Data.CONTENT_URI, TYPE_INSERT, buildDataInsert(bluePhone, CONTACT_BOB)),
+                buildUpdateAggregationDefault());
+
+        // Merge in the second version, verify that our insert remains
+        final EntityDeltaList merged = EntityDeltaList.mergeAfter(second, first);
+        assertDiffPattern(merged,
+                buildAssertVersion(VER_SECOND),
+                buildUpdateAggregationSuspended(),
+                buildOper(Data.CONTENT_URI, TYPE_INSERT, buildDataInsert(bluePhone, CONTACT_BOB)),
+                buildUpdateAggregationDefault());
+    }
+
+    public void testMergeRawContactLocalInsertRemoteInsert() {
+        final EntityDeltaList first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
+                buildPhone(PHONE_RED)));
+        final EntityDeltaList second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
+                buildPhone(PHONE_RED)), buildBeforeEntity(CONTACT_MARY, VER_SECOND,
+                buildPhone(PHONE_RED)));
+
+        // Add new contact locally, should remain insert
+        final ContentValues joePhoneInsert = buildPhone(PHONE_BLUE);
+        final EntityDelta joeContact = buildAfterEntity(joePhoneInsert);
+        final ContentValues joeContactInsert = joeContact.getValues().getCompleteValues();
+        joeContactInsert.put(RawContacts.AGGREGATION_MODE, RawContacts.AGGREGATION_MODE_SUSPENDED);
+        first.add(joeContact);
+        assertDiffPattern(first,
+                buildAssertVersion(VER_FIRST),
+                buildOper(RawContacts.CONTENT_URI, TYPE_INSERT, joeContactInsert),
+                buildOper(Data.CONTENT_URI, TYPE_INSERT, joePhoneInsert),
+                buildAggregationModeUpdate(RawContacts.AGGREGATION_MODE_DEFAULT),
+                buildUpdateAggregationKeepTogether(CONTACT_BOB));
+
+        // Merge in the second version, verify that our insert remains
+        final EntityDeltaList merged = EntityDeltaList.mergeAfter(second, first);
+        assertDiffPattern(merged,
+                buildAssertVersion(VER_SECOND),
+                buildAssertVersion(VER_SECOND),
+                buildOper(RawContacts.CONTENT_URI, TYPE_INSERT, joeContactInsert),
+                buildOper(Data.CONTENT_URI, TYPE_INSERT, joePhoneInsert),
+                buildAggregationModeUpdate(RawContacts.AGGREGATION_MODE_DEFAULT),
+                buildUpdateAggregationKeepTogether(CONTACT_BOB));
+    }
+
+    public void testMergeRawContactLocalDeleteRemoteDelete() {
+        final EntityDeltaList first = buildSet(
+                buildBeforeEntity(CONTACT_BOB, VER_FIRST, buildPhone(PHONE_RED)),
+                buildBeforeEntity(CONTACT_MARY, VER_FIRST, buildPhone(PHONE_RED)));
+        final EntityDeltaList second = buildSet(
+                buildBeforeEntity(CONTACT_BOB, VER_SECOND, buildPhone(PHONE_RED)));
+
+        // Remove contact locally
+        first.getByRawContactId(CONTACT_MARY).markDeleted();
+        assertDiffPattern(first,
+                buildAssertVersion(VER_FIRST),
+                buildAssertVersion(VER_FIRST),
+                buildDelete(RawContacts.CONTENT_URI));
+
+        // Merge in the second version, verify that our delete isn't needed
+        final EntityDeltaList merged = EntityDeltaList.mergeAfter(second, first);
+        assertDiffPattern(merged);
+    }
+
+    public void testMergeRawContactLocalUpdateRemoteDelete() {
+        final EntityDeltaList first = buildSet(
+                buildBeforeEntity(CONTACT_BOB, VER_FIRST, buildPhone(PHONE_RED)),
+                buildBeforeEntity(CONTACT_MARY, VER_FIRST, buildPhone(PHONE_RED)));
+        final EntityDeltaList second = buildSet(
+                buildBeforeEntity(CONTACT_BOB, VER_SECOND, buildPhone(PHONE_RED)));
+
+        // Perform local update
+        final ValuesDelta phone = getPhone(first, CONTACT_MARY, PHONE_RED);
+        phone.put(Phone.NUMBER, TEST_PHONE);
+        assertDiffPattern(first,
+                buildAssertVersion(VER_FIRST),
+                buildAssertVersion(VER_FIRST),
+                buildUpdateAggregationSuspended(),
+                buildOper(Data.CONTENT_URI, TYPE_UPDATE, phone.getAfter()),
+                buildUpdateAggregationDefault());
+
+        final ContentValues phoneInsert = phone.getCompleteValues();
+        final ContentValues contactInsert = first.getByRawContactId(CONTACT_MARY).getValues()
+                .getCompleteValues();
+        contactInsert.put(RawContacts.AGGREGATION_MODE, RawContacts.AGGREGATION_MODE_SUSPENDED);
+
+        // Merge and verify that update turned into insert
+        final EntityDeltaList merged = EntityDeltaList.mergeAfter(second, first);
+        assertDiffPattern(merged,
+                buildAssertVersion(VER_SECOND),
+                buildOper(RawContacts.CONTENT_URI, TYPE_INSERT, contactInsert),
+                buildOper(Data.CONTENT_URI, TYPE_INSERT, phoneInsert),
+                buildAggregationModeUpdate(RawContacts.AGGREGATION_MODE_DEFAULT),
+                buildUpdateAggregationKeepTogether(CONTACT_BOB));
+    }
+
+    public void testMergeUsesNewVersion() {
+        final EntityDeltaList first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
+                buildPhone(PHONE_RED)));
+        final EntityDeltaList second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
+                buildPhone(PHONE_RED)));
+
+        assertEquals((Long)VER_FIRST, getVersion(first, CONTACT_BOB));
+        assertEquals((Long)VER_SECOND, getVersion(second, CONTACT_BOB));
+
+        final EntityDeltaList merged = EntityDeltaList.mergeAfter(second, first);
+        assertEquals((Long)VER_SECOND, getVersion(merged, CONTACT_BOB));
+    }
+
+    public void testMergeAfterEnsureAndTrim() {
+        final EntityDeltaList first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
+                buildEmail(EMAIL_YELLOW)));
+        final EntityDeltaList second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
+                buildEmail(EMAIL_YELLOW)));
+
+        // Ensure we have at least one phone
+        final BaseAccountType source = getSource();
+        final EntityDelta bobContact = first.getByRawContactId(CONTACT_BOB);
+        EntityModifier.ensureKindExists(bobContact, source, Phone.CONTENT_ITEM_TYPE);
+        final ValuesDelta bobPhone = bobContact.getSuperPrimaryEntry(Phone.CONTENT_ITEM_TYPE, true);
+
+        // Make sure the update would insert a row
+        assertDiffPattern(first,
+                buildAssertVersion(VER_FIRST),
+                buildUpdateAggregationSuspended(),
+                buildOper(Data.CONTENT_URI, TYPE_INSERT, buildDataInsert(bobPhone, CONTACT_BOB)),
+                buildUpdateAggregationDefault());
+
+        // Trim values and ensure that we don't insert things
+        EntityModifier.trimEmpty(bobContact, source);
+        assertDiffPattern(first);
+
+        // Now re-parent the change, which should remain no-op
+        final EntityDeltaList merged = EntityDeltaList.mergeAfter(second, first);
+        assertDiffPattern(merged);
+    }
+}
diff --git a/tests/src/com/android/contacts/EntityModifierTests.java b/tests/src/com/android/contacts/EntityModifierTests.java
index 18877a3..1a0fc07 100644
--- a/tests/src/com/android/contacts/EntityModifierTests.java
+++ b/tests/src/com/android/contacts/EntityModifierTests.java
@@ -20,13 +20,13 @@
 import static android.content.ContentProviderOperation.TYPE_INSERT;
 import static android.content.ContentProviderOperation.TYPE_UPDATE;
 
-import com.android.contacts.model.ContactsSource;
+import com.android.contacts.model.BaseAccountType;
 import com.android.contacts.model.EntityDelta;
 import com.android.contacts.model.EntityModifier;
-import com.android.contacts.model.EntitySet;
-import com.android.contacts.model.Sources;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.EditType;
+import com.android.contacts.model.EntityDeltaList;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.EditType;
 import com.android.contacts.model.EntityDelta.ValuesDelta;
 import com.google.android.collect.Lists;
 
@@ -51,7 +51,7 @@
 import java.util.List;
 
 /**
- * Tests for {@link EntityModifier} to verify that {@link ContactsSource}
+ * Tests for {@link EntityModifier} to verify that {@link BaseAccountType}
  * constraints are being enforced correctly.
  */
 @LargeTest
@@ -79,11 +79,11 @@
         mContext = getContext();
     }
 
-    public static class MockContactsSource extends ContactsSource {
+    public static class MockContactsSource extends BaseAccountType {
         @Override
         protected void inflate(Context context, int inflateLevel) {
             this.accountType = TEST_ACCOUNT_TYPE;
-            this.setInflatedLevel(ContactsSource.LEVEL_CONSTRAINTS);
+            this.setInflatedLevel(BaseAccountType.LEVEL_CONSTRAINTS);
 
             // Phone allows maximum 2 home, 1 work, and unlimited other, with
             // constraint of 5 numbers maximum.
@@ -138,20 +138,20 @@
     }
 
     /**
-     * Build a {@link ContactsSource} that has various odd constraints for
+     * Build a {@link BaseAccountType} that has various odd constraints for
      * testing purposes.
      */
-    protected ContactsSource getSource() {
-        final ContactsSource source = new MockContactsSource();
-        source.ensureInflated(getContext(), ContactsSource.LEVEL_CONSTRAINTS);
+    protected BaseAccountType getSource() {
+        final BaseAccountType source = new MockContactsSource();
+        source.ensureInflated(getContext(), BaseAccountType.LEVEL_CONSTRAINTS);
         return source;
     }
 
     /**
-     * Build {@link Sources} instance.
+     * Build {@link AccountTypes} instance.
      */
-    protected Sources getSources(ContactsSource... sources) {
-        return new Sources(sources);
+    protected AccountTypes getSources(BaseAccountType... sources) {
+        return new AccountTypes(sources);
     }
 
     /**
@@ -192,7 +192,7 @@
      */
     public void testValidTypes() {
         // Build a source and pull specific types
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
         final EditType typeWork = EntityModifier.getType(kindPhone, Phone.TYPE_WORK);
@@ -237,7 +237,7 @@
      */
     public void testCanInsert() {
         // Build a source and pull specific types
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
         final EditType typeWork = EntityModifier.getType(kindPhone, Phone.TYPE_WORK);
@@ -266,7 +266,7 @@
      */
     public void testBestValidType() {
         // Build a source and pull specific types
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
         final EditType typeWork = EntityModifier.getType(kindPhone, Phone.TYPE_WORK);
@@ -302,7 +302,7 @@
     }
 
     public void testIsEmptyEmpty() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
 
         // Test entirely empty row
@@ -313,7 +313,7 @@
     }
 
     public void testIsEmptyDirectFields() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
 
@@ -330,7 +330,7 @@
     }
 
     public void testTrimEmptySingle() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
 
@@ -371,60 +371,60 @@
     }
 
     public void testTrimEmptySpaces() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
 
         // Test row that has type values, but values are spaces
-        final EntityDelta state = EntitySetTests.buildBeforeEntity(TEST_ID, VER_FIRST);
+        final EntityDelta state = EntityDeltaListTests.buildBeforeEntity(TEST_ID, VER_FIRST);
         final ValuesDelta values = EntityModifier.insertChild(state, kindPhone, typeHome);
         values.put(Phone.NUMBER, "   ");
 
         // Build diff, expecting insert for data row and update enforcement
-        EntitySetTests.assertDiffPattern(state,
-                EntitySetTests.buildAssertVersion(VER_FIRST),
-                EntitySetTests.buildUpdateAggregationSuspended(),
-                EntitySetTests.buildOper(Data.CONTENT_URI, TYPE_INSERT,
-                        EntitySetTests.buildDataInsert(values, TEST_ID)),
-                EntitySetTests.buildUpdateAggregationDefault());
+        EntityDeltaListTests.assertDiffPattern(state,
+                EntityDeltaListTests.buildAssertVersion(VER_FIRST),
+                EntityDeltaListTests.buildUpdateAggregationSuspended(),
+                EntityDeltaListTests.buildOper(Data.CONTENT_URI, TYPE_INSERT,
+                        EntityDeltaListTests.buildDataInsert(values, TEST_ID)),
+                EntityDeltaListTests.buildUpdateAggregationDefault());
 
         // Trim empty rows and try again, expecting delete of overall contact
         EntityModifier.trimEmpty(state, source);
-        EntitySetTests.assertDiffPattern(state,
-                EntitySetTests.buildAssertVersion(VER_FIRST),
-                EntitySetTests.buildDelete(RawContacts.CONTENT_URI));
+        EntityDeltaListTests.assertDiffPattern(state,
+                EntityDeltaListTests.buildAssertVersion(VER_FIRST),
+                EntityDeltaListTests.buildDelete(RawContacts.CONTENT_URI));
     }
 
     public void testTrimLeaveValid() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
 
         // Test row that has type values with valid number
-        final EntityDelta state = EntitySetTests.buildBeforeEntity(TEST_ID, VER_FIRST);
+        final EntityDelta state = EntityDeltaListTests.buildBeforeEntity(TEST_ID, VER_FIRST);
         final ValuesDelta values = EntityModifier.insertChild(state, kindPhone, typeHome);
         values.put(Phone.NUMBER, TEST_PHONE);
 
         // Build diff, expecting insert for data row and update enforcement
-        EntitySetTests.assertDiffPattern(state,
-                EntitySetTests.buildAssertVersion(VER_FIRST),
-                EntitySetTests.buildUpdateAggregationSuspended(),
-                EntitySetTests.buildOper(Data.CONTENT_URI, TYPE_INSERT,
-                        EntitySetTests.buildDataInsert(values, TEST_ID)),
-                EntitySetTests.buildUpdateAggregationDefault());
+        EntityDeltaListTests.assertDiffPattern(state,
+                EntityDeltaListTests.buildAssertVersion(VER_FIRST),
+                EntityDeltaListTests.buildUpdateAggregationSuspended(),
+                EntityDeltaListTests.buildOper(Data.CONTENT_URI, TYPE_INSERT,
+                        EntityDeltaListTests.buildDataInsert(values, TEST_ID)),
+                EntityDeltaListTests.buildUpdateAggregationDefault());
 
         // Trim empty rows and try again, expecting no differences
         EntityModifier.trimEmpty(state, source);
-        EntitySetTests.assertDiffPattern(state,
-                EntitySetTests.buildAssertVersion(VER_FIRST),
-                EntitySetTests.buildUpdateAggregationSuspended(),
-                EntitySetTests.buildOper(Data.CONTENT_URI, TYPE_INSERT,
-                        EntitySetTests.buildDataInsert(values, TEST_ID)),
-                EntitySetTests.buildUpdateAggregationDefault());
+        EntityDeltaListTests.assertDiffPattern(state,
+                EntityDeltaListTests.buildAssertVersion(VER_FIRST),
+                EntityDeltaListTests.buildUpdateAggregationSuspended(),
+                EntityDeltaListTests.buildOper(Data.CONTENT_URI, TYPE_INSERT,
+                        EntityDeltaListTests.buildDataInsert(values, TEST_ID)),
+                EntityDeltaListTests.buildUpdateAggregationDefault());
     }
 
     public void testTrimEmptyUntouched() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
 
@@ -448,7 +448,7 @@
     }
 
     public void testTrimEmptyAfterUpdate() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
 
@@ -500,14 +500,14 @@
     }
 
     public void testTrimInsertEmpty() {
-        final ContactsSource source = getSource();
-        final Sources sources = getSources(source);
+        final BaseAccountType source = getSource();
+        final AccountTypes sources = getSources(source);
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
 
         // Try creating a contact without any child entries
         final EntityDelta state = getEntity(null);
-        final EntitySet set = EntitySet.fromSingle(state);
+        final EntityDeltaList set = EntityDeltaList.fromSingle(state);
 
         // Build diff, expecting single insert
         final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
@@ -527,15 +527,15 @@
     }
 
     public void testTrimInsertInsert() {
-        final ContactsSource source = getSource();
-        final Sources sources = getSources(source);
+        final BaseAccountType source = getSource();
+        final AccountTypes sources = getSources(source);
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
 
         // Try creating a contact with single empty entry
         final EntityDelta state = getEntity(null);
         final ValuesDelta values = EntityModifier.insertChild(state, kindPhone, typeHome);
-        final EntitySet set = EntitySet.fromSingle(state);
+        final EntityDeltaList set = EntityDeltaList.fromSingle(state);
 
         // Build diff, expecting two insert operations
         final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
@@ -560,8 +560,8 @@
     }
 
     public void testTrimUpdateRemain() {
-        final ContactsSource source = getSource();
-        final Sources sources = getSources(source);
+        final BaseAccountType source = getSource();
+        final AccountTypes sources = getSources(source);
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
 
@@ -579,7 +579,7 @@
         second.put(Phone.NUMBER, TEST_PHONE);
 
         final EntityDelta state = getEntity(TEST_ID, first, second);
-        final EntitySet set = EntitySet.fromSingle(state);
+        final EntityDeltaList set = EntityDeltaList.fromSingle(state);
 
         // Build diff, expecting no changes
         final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
@@ -631,8 +631,8 @@
     }
 
     public void testTrimUpdateUpdate() {
-        final ContactsSource source = getSource();
-        final Sources sources = getSources(source);
+        final BaseAccountType source = getSource();
+        final AccountTypes sources = getSources(source);
         final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
         final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
 
@@ -644,7 +644,7 @@
         first.put(Phone.NUMBER, TEST_PHONE);
 
         final EntityDelta state = getEntity(TEST_ID, first);
-        final EntitySet set = EntitySet.fromSingle(state);
+        final EntityDeltaList set = EntityDeltaList.fromSingle(state);
 
         // Build diff, expecting no changes
         final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
@@ -686,7 +686,7 @@
     }
 
     public void testParseExtrasExistingName() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindName = source.getKindForMimetype(StructuredName.CONTENT_ITEM_TYPE);
 
         // Build "before" name
@@ -706,7 +706,7 @@
     }
 
     public void testParseExtrasIgnoreLimit() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final DataKind kindIm = source.getKindForMimetype(Im.CONTENT_ITEM_TYPE);
 
         // Build "before" IM
@@ -730,7 +730,7 @@
     }
 
     public void testParseExtrasIgnoreUnhandled() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final EntityDelta state = getEntity(TEST_ID);
 
         // We should silently ignore types unsupported by source
@@ -742,7 +742,7 @@
     }
 
     public void testParseExtrasJobTitle() {
-        final ContactsSource source = getSource();
+        final BaseAccountType source = getSource();
         final EntityDelta state = getEntity(TEST_ID);
 
         // Make sure that we create partial Organizations
diff --git a/tests/src/com/android/contacts/EntitySetTests.java b/tests/src/com/android/contacts/EntitySetTests.java
deleted file mode 100644
index 037c927..0000000
--- a/tests/src/com/android/contacts/EntitySetTests.java
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
- * Copyright (C) 2009 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.contacts;
-
-import static android.content.ContentProviderOperation.TYPE_ASSERT;
-import static android.content.ContentProviderOperation.TYPE_DELETE;
-import static android.content.ContentProviderOperation.TYPE_INSERT;
-import static android.content.ContentProviderOperation.TYPE_UPDATE;
-
-import com.android.contacts.EntityModifierTests.MockContactsSource;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.EntityModifier;
-import com.android.contacts.model.EntitySet;
-import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.google.android.collect.Lists;
-
-import android.content.ContentProviderOperation;
-import android.content.ContentValues;
-import android.content.Entity;
-import android.net.Uri;
-import android.provider.BaseColumns;
-import android.provider.ContactsContract.AggregationExceptions;
-import android.provider.ContactsContract.Data;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Email;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-
-/**
- * Tests for {@link EntitySet} which focus on "diff" operations that should
- * create {@link AggregationExceptions} in certain cases.
- */
-@LargeTest
-public class EntitySetTests extends AndroidTestCase {
-    public static final String TAG = "EntitySetTests";
-
-    private static final long CONTACT_FIRST = 1;
-    private static final long CONTACT_SECOND = 2;
-
-    public static final long CONTACT_BOB = 10;
-    public static final long CONTACT_MARY = 11;
-
-    public static final long PHONE_RED = 20;
-    public static final long PHONE_GREEN = 21;
-    public static final long PHONE_BLUE = 22;
-
-    public static final long EMAIL_YELLOW = 25;
-
-    public static final long VER_FIRST = 100;
-    public static final long VER_SECOND = 200;
-
-    public static final String TEST_PHONE = "555-1212";
-    public static final String TEST_ACCOUNT = "org.example.test";
-
-    public EntitySetTests() {
-        super();
-    }
-
-    @Override
-    public void setUp() {
-        mContext = getContext();
-    }
-
-    /**
-     * Build a {@link ContactsSource} that has various odd constraints for
-     * testing purposes.
-     */
-    protected ContactsSource getSource() {
-        final ContactsSource source = new MockContactsSource();
-        source.ensureInflated(getContext(), ContactsSource.LEVEL_CONSTRAINTS);
-        return source;
-    }
-
-    static ContentValues getValues(ContentProviderOperation operation)
-            throws NoSuchFieldException, IllegalAccessException {
-        final Field field = ContentProviderOperation.class.getDeclaredField("mValues");
-        field.setAccessible(true);
-        return (ContentValues) field.get(operation);
-    }
-
-    static EntityDelta getUpdate(long rawContactId) {
-        final Entity before = EntityDeltaTests.getEntity(rawContactId,
-                EntityDeltaTests.TEST_PHONE_ID);
-        return EntityDelta.fromBefore(before);
-    }
-
-    static EntityDelta getInsert() {
-        final ContentValues after = new ContentValues();
-        after.put(RawContacts.ACCOUNT_NAME, EntityDeltaTests.TEST_ACCOUNT_NAME);
-        after.put(RawContacts.SEND_TO_VOICEMAIL, 1);
-
-        final ValuesDelta values = ValuesDelta.fromAfter(after);
-        return new EntityDelta(values);
-    }
-
-    static EntitySet buildSet(EntityDelta... deltas) {
-        final EntitySet set = EntitySet.fromSingle(deltas[0]);
-        for (int i = 1; i < deltas.length; i++) {
-            set.add(deltas[i]);
-        }
-        return set;
-    }
-
-    static EntityDelta buildBeforeEntity(long rawContactId, long version,
-            ContentValues... entries) {
-        // Build an existing contact read from database
-        final ContentValues contact = new ContentValues();
-        contact.put(RawContacts.VERSION, version);
-        contact.put(RawContacts._ID, rawContactId);
-        final Entity before = new Entity(contact);
-        for (ContentValues entry : entries) {
-            before.addSubValue(Data.CONTENT_URI, entry);
-        }
-        return EntityDelta.fromBefore(before);
-    }
-
-    static EntityDelta buildAfterEntity(ContentValues... entries) {
-        // Build an existing contact read from database
-        final ContentValues contact = new ContentValues();
-        contact.put(RawContacts.ACCOUNT_TYPE, TEST_ACCOUNT);
-        final EntityDelta after = new EntityDelta(ValuesDelta.fromAfter(contact));
-        for (ContentValues entry : entries) {
-            after.addEntry(ValuesDelta.fromAfter(entry));
-        }
-        return after;
-    }
-
-    static ContentValues buildPhone(long phoneId) {
-        return buildPhone(phoneId, Long.toString(phoneId));
-    }
-
-    static ContentValues buildPhone(long phoneId, String value) {
-        final ContentValues values = new ContentValues();
-        values.put(Data._ID, phoneId);
-        values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
-        values.put(Phone.NUMBER, value);
-        values.put(Phone.TYPE, Phone.TYPE_HOME);
-        return values;
-    }
-
-    static ContentValues buildEmail(long emailId) {
-        final ContentValues values = new ContentValues();
-        values.put(Data._ID, emailId);
-        values.put(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE);
-        values.put(Email.DATA, Long.toString(emailId));
-        values.put(Email.TYPE, Email.TYPE_HOME);
-        return values;
-    }
-
-    static void insertPhone(EntitySet set, long rawContactId, ContentValues values) {
-        final EntityDelta match = set.getByRawContactId(rawContactId);
-        match.addEntry(ValuesDelta.fromAfter(values));
-    }
-
-    static ValuesDelta getPhone(EntitySet set, long rawContactId, long dataId) {
-        final EntityDelta match = set.getByRawContactId(rawContactId);
-        return match.getEntry(dataId);
-    }
-
-    static void assertDiffPattern(EntityDelta delta, ContentProviderOperation... pattern) {
-        final ArrayList<ContentProviderOperation> diff = Lists.newArrayList();
-        delta.buildAssert(diff);
-        delta.buildDiff(diff);
-        assertDiffPattern(diff, pattern);
-    }
-
-    static void assertDiffPattern(EntitySet set, ContentProviderOperation... pattern) {
-        assertDiffPattern(set.buildDiff(), pattern);
-    }
-
-    static void assertDiffPattern(ArrayList<ContentProviderOperation> diff,
-            ContentProviderOperation... pattern) {
-        assertEquals("Unexpected operations", pattern.length, diff.size());
-        for (int i = 0; i < pattern.length; i++) {
-            final ContentProviderOperation expected = pattern[i];
-            final ContentProviderOperation found = diff.get(i);
-
-            assertEquals("Unexpected uri", expected.getUri(), found.getUri());
-
-            final String expectedType = getStringForType(expected.getType());
-            final String foundType = getStringForType(found.getType());
-            assertEquals("Unexpected type", expectedType, foundType);
-
-            if (expected.getType() == TYPE_DELETE) continue;
-
-            try {
-                final ContentValues expectedValues = getValues(expected);
-                final ContentValues foundValues = getValues(found);
-
-                expectedValues.remove(BaseColumns._ID);
-                foundValues.remove(BaseColumns._ID);
-
-                assertEquals("Unexpected values", expectedValues, foundValues);
-            } catch (NoSuchFieldException e) {
-                fail(e.toString());
-            } catch (IllegalAccessException e) {
-                fail(e.toString());
-            }
-        }
-    }
-
-    static String getStringForType(int type) {
-        switch (type) {
-            case TYPE_ASSERT: return "TYPE_ASSERT";
-            case TYPE_INSERT: return "TYPE_INSERT";
-            case TYPE_UPDATE: return "TYPE_UPDATE";
-            case TYPE_DELETE: return "TYPE_DELETE";
-            default: return Integer.toString(type);
-        }
-    }
-
-    static ContentProviderOperation buildAssertVersion(long version) {
-        final ContentValues values = new ContentValues();
-        values.put(RawContacts.VERSION, version);
-        return buildOper(RawContacts.CONTENT_URI, TYPE_ASSERT, values);
-    }
-
-    static ContentProviderOperation buildAggregationModeUpdate(int mode) {
-        final ContentValues values = new ContentValues();
-        values.put(RawContacts.AGGREGATION_MODE, mode);
-        return buildOper(RawContacts.CONTENT_URI, TYPE_UPDATE, values);
-    }
-
-    static ContentProviderOperation buildUpdateAggregationSuspended() {
-        return buildAggregationModeUpdate(RawContacts.AGGREGATION_MODE_SUSPENDED);
-    }
-
-    static ContentProviderOperation buildUpdateAggregationDefault() {
-        return buildAggregationModeUpdate(RawContacts.AGGREGATION_MODE_DEFAULT);
-    }
-
-    static ContentProviderOperation buildUpdateAggregationKeepTogether(long rawContactId) {
-        final ContentValues values = new ContentValues();
-        values.put(AggregationExceptions.RAW_CONTACT_ID1, rawContactId);
-        values.put(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_TOGETHER);
-        return buildOper(AggregationExceptions.CONTENT_URI, TYPE_UPDATE, values);
-    }
-
-    static ContentValues buildDataInsert(ValuesDelta values, long rawContactId) {
-        final ContentValues insertValues = values.getCompleteValues();
-        insertValues.put(Data.RAW_CONTACT_ID, rawContactId);
-        return insertValues;
-    }
-
-    static ContentProviderOperation buildDelete(Uri uri) {
-        return buildOper(uri, TYPE_DELETE, (ContentValues)null);
-    }
-
-    static ContentProviderOperation buildOper(Uri uri, int type, ValuesDelta values) {
-        return buildOper(uri, type, values.getCompleteValues());
-    }
-
-    static ContentProviderOperation buildOper(Uri uri, int type, ContentValues values) {
-        switch (type) {
-            case TYPE_ASSERT:
-                return ContentProviderOperation.newAssertQuery(uri).withValues(values).build();
-            case TYPE_INSERT:
-                return ContentProviderOperation.newInsert(uri).withValues(values).build();
-            case TYPE_UPDATE:
-                return ContentProviderOperation.newUpdate(uri).withValues(values).build();
-            case TYPE_DELETE:
-                return ContentProviderOperation.newDelete(uri).build();
-        }
-        return null;
-    }
-
-    static Long getVersion(EntitySet set, Long rawContactId) {
-        return set.getByRawContactId(rawContactId).getValues().getAsLong(RawContacts.VERSION);
-    }
-
-    /**
-     * Count number of {@link AggregationExceptions} updates contained in the
-     * given list of {@link ContentProviderOperation}.
-     */
-    static int countExceptionUpdates(ArrayList<ContentProviderOperation> diff) {
-        int updateCount = 0;
-        for (ContentProviderOperation oper : diff) {
-            if (AggregationExceptions.CONTENT_URI.equals(oper.getUri())
-                    && oper.getType() == ContentProviderOperation.TYPE_UPDATE) {
-                updateCount++;
-            }
-        }
-        return updateCount;
-    }
-
-    public void testInsert() {
-        final EntityDelta insert = getInsert();
-        final EntitySet set = buildSet(insert);
-
-        // Inserting single shouldn't create rules
-        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
-        final int exceptionCount = countExceptionUpdates(diff);
-        assertEquals("Unexpected exception updates", 0, exceptionCount);
-    }
-
-    public void testUpdateUpdate() {
-        final EntityDelta updateFirst = getUpdate(CONTACT_FIRST);
-        final EntityDelta updateSecond = getUpdate(CONTACT_SECOND);
-        final EntitySet set = buildSet(updateFirst, updateSecond);
-
-        // Updating two existing shouldn't create rules
-        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
-        final int exceptionCount = countExceptionUpdates(diff);
-        assertEquals("Unexpected exception updates", 0, exceptionCount);
-    }
-
-    public void testUpdateInsert() {
-        final EntityDelta update = getUpdate(CONTACT_FIRST);
-        final EntityDelta insert = getInsert();
-        final EntitySet set = buildSet(update, insert);
-
-        // New insert should only create one rule
-        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
-        final int exceptionCount = countExceptionUpdates(diff);
-        assertEquals("Unexpected exception updates", 1, exceptionCount);
-    }
-
-    public void testInsertUpdateInsert() {
-        final EntityDelta insertFirst = getInsert();
-        final EntityDelta update = getUpdate(CONTACT_FIRST);
-        final EntityDelta insertSecond = getInsert();
-        final EntitySet set = buildSet(insertFirst, update, insertSecond);
-
-        // Two inserts should create two rules to bind against single existing
-        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
-        final int exceptionCount = countExceptionUpdates(diff);
-        assertEquals("Unexpected exception updates", 2, exceptionCount);
-    }
-
-    public void testInsertInsertInsert() {
-        final EntityDelta insertFirst = getInsert();
-        final EntityDelta insertSecond = getInsert();
-        final EntityDelta insertThird = getInsert();
-        final EntitySet set = buildSet(insertFirst, insertSecond, insertThird);
-
-        // Three new inserts should create only two binding rules
-        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
-        final int exceptionCount = countExceptionUpdates(diff);
-        assertEquals("Unexpected exception updates", 2, exceptionCount);
-    }
-
-    public void testInsertInsertSeparate() {
-        // This assumes getInsert() will return back an "empty" raw
-        // contact meaning it will contain no actual information
-        final EntityDelta insertFirst = getInsert();
-        final EntityDelta insertSecond = getInsert();
-        final EntitySet set = buildSet(insertFirst, insertSecond);
-
-        // This would normally build a TYPE_KEEP_SEPARATE aggregation exception,
-        // but since the raw contacts won't be added because they are empty,
-        // we should get 0 exceptions back
-        set.splitRawContacts();
-
-        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
-        final int exceptionCount = countExceptionUpdates(diff);
-        assertEquals("Unexpected exception updates", 0, exceptionCount);
-    }
-
-    public void testUpdateInsertSeparate() {
-        // This assumes getInsert() will return back an "empty" raw
-        // contact meaning it will contain no actual information
-        final EntityDelta update = getUpdate(CONTACT_FIRST);
-        final EntityDelta insert = getInsert();
-        final EntitySet set = buildSet(update, insert);
-
-        // This would normally build a KEEP_SEPARATE aggregation exception,
-        // but since the insert won't be added because it is empty,
-        // we should get 0 exceptions back
-        set.splitRawContacts();
-
-        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
-        final int exceptionCount = countExceptionUpdates(diff);
-        assertEquals("Unexpected exception updates", 0, exceptionCount);
-    }
-
-    public void testUpdateInsertInsertSeparate() {
-        // This assumes getInsert() will return back an "empty" raw
-        // contact meaning it will contain no actual information
-        final EntityDelta update = getUpdate(CONTACT_FIRST);
-        final EntityDelta insertFirst = getInsert();
-        final EntityDelta insertSecond = getInsert();
-        final EntitySet set = buildSet(update, insertFirst, insertSecond);
-
-        // This would normally build a KEEP_SEPARATE aggregation exception,
-        // but since the inserts won't be added because they are empty,
-        // we should get 0 exceptions back
-        set.splitRawContacts();
-
-        final ArrayList<ContentProviderOperation> diff = set.buildDiff();
-        final int exceptionCount = countExceptionUpdates(diff);
-        assertEquals("Unexpected exception updates", 0, exceptionCount);
-    }
-
-    public void testMergeDataRemoteInsert() {
-        final EntitySet first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
-                buildPhone(PHONE_RED)));
-        final EntitySet second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
-                buildPhone(PHONE_RED), buildPhone(PHONE_GREEN)));
-
-        // Merge in second version, verify they match
-        final EntitySet merged = EntitySet.mergeAfter(second, first);
-        assertEquals("Unexpected change when merging", second, merged);
-    }
-
-    public void testMergeDataLocalUpdateRemoteInsert() {
-        final EntitySet first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
-                buildPhone(PHONE_RED)));
-        final EntitySet second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
-                buildPhone(PHONE_RED), buildPhone(PHONE_GREEN)));
-
-        // Change the local number to trigger update
-        final ValuesDelta phone = getPhone(first, CONTACT_BOB, PHONE_RED);
-        phone.put(Phone.NUMBER, TEST_PHONE);
-
-        assertDiffPattern(first,
-                buildAssertVersion(VER_FIRST),
-                buildUpdateAggregationSuspended(),
-                buildOper(Data.CONTENT_URI, TYPE_UPDATE, phone.getAfter()),
-                buildUpdateAggregationDefault());
-
-        // Merge in the second version, verify diff matches
-        final EntitySet merged = EntitySet.mergeAfter(second, first);
-        assertDiffPattern(merged,
-                buildAssertVersion(VER_SECOND),
-                buildUpdateAggregationSuspended(),
-                buildOper(Data.CONTENT_URI, TYPE_UPDATE, phone.getAfter()),
-                buildUpdateAggregationDefault());
-    }
-
-    public void testMergeDataLocalUpdateRemoteDelete() {
-        final EntitySet first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
-                buildPhone(PHONE_RED)));
-        final EntitySet second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
-                buildPhone(PHONE_GREEN)));
-
-        // Change the local number to trigger update
-        final ValuesDelta phone = getPhone(first, CONTACT_BOB, PHONE_RED);
-        phone.put(Phone.NUMBER, TEST_PHONE);
-
-        assertDiffPattern(first,
-                buildAssertVersion(VER_FIRST),
-                buildUpdateAggregationSuspended(),
-                buildOper(Data.CONTENT_URI, TYPE_UPDATE, phone.getAfter()),
-                buildUpdateAggregationDefault());
-
-        // Merge in the second version, verify that our update changed to
-        // insert, since RED was deleted on remote side
-        final EntitySet merged = EntitySet.mergeAfter(second, first);
-        assertDiffPattern(merged,
-                buildAssertVersion(VER_SECOND),
-                buildUpdateAggregationSuspended(),
-                buildOper(Data.CONTENT_URI, TYPE_INSERT, buildDataInsert(phone, CONTACT_BOB)),
-                buildUpdateAggregationDefault());
-    }
-
-    public void testMergeDataLocalDeleteRemoteUpdate() {
-        final EntitySet first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
-                buildPhone(PHONE_RED)));
-        final EntitySet second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
-                buildPhone(PHONE_RED, TEST_PHONE)));
-
-        // Delete phone locally
-        final ValuesDelta phone = getPhone(first, CONTACT_BOB, PHONE_RED);
-        phone.markDeleted();
-
-        assertDiffPattern(first,
-                buildAssertVersion(VER_FIRST),
-                buildUpdateAggregationSuspended(),
-                buildDelete(Data.CONTENT_URI),
-                buildUpdateAggregationDefault());
-
-        // Merge in the second version, verify that our delete remains
-        final EntitySet merged = EntitySet.mergeAfter(second, first);
-        assertDiffPattern(merged,
-                buildAssertVersion(VER_SECOND),
-                buildUpdateAggregationSuspended(),
-                buildDelete(Data.CONTENT_URI),
-                buildUpdateAggregationDefault());
-    }
-
-    public void testMergeDataLocalInsertRemoteInsert() {
-        final EntitySet first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
-                buildPhone(PHONE_RED)));
-        final EntitySet second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
-                buildPhone(PHONE_RED), buildPhone(PHONE_GREEN)));
-
-        // Insert new phone locally
-        final ValuesDelta bluePhone = ValuesDelta.fromAfter(buildPhone(PHONE_BLUE));
-        first.getByRawContactId(CONTACT_BOB).addEntry(bluePhone);
-        assertDiffPattern(first,
-                buildAssertVersion(VER_FIRST),
-                buildUpdateAggregationSuspended(),
-                buildOper(Data.CONTENT_URI, TYPE_INSERT, buildDataInsert(bluePhone, CONTACT_BOB)),
-                buildUpdateAggregationDefault());
-
-        // Merge in the second version, verify that our insert remains
-        final EntitySet merged = EntitySet.mergeAfter(second, first);
-        assertDiffPattern(merged,
-                buildAssertVersion(VER_SECOND),
-                buildUpdateAggregationSuspended(),
-                buildOper(Data.CONTENT_URI, TYPE_INSERT, buildDataInsert(bluePhone, CONTACT_BOB)),
-                buildUpdateAggregationDefault());
-    }
-
-    public void testMergeRawContactLocalInsertRemoteInsert() {
-        final EntitySet first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
-                buildPhone(PHONE_RED)));
-        final EntitySet second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
-                buildPhone(PHONE_RED)), buildBeforeEntity(CONTACT_MARY, VER_SECOND,
-                buildPhone(PHONE_RED)));
-
-        // Add new contact locally, should remain insert
-        final ContentValues joePhoneInsert = buildPhone(PHONE_BLUE);
-        final EntityDelta joeContact = buildAfterEntity(joePhoneInsert);
-        final ContentValues joeContactInsert = joeContact.getValues().getCompleteValues();
-        joeContactInsert.put(RawContacts.AGGREGATION_MODE, RawContacts.AGGREGATION_MODE_SUSPENDED);
-        first.add(joeContact);
-        assertDiffPattern(first,
-                buildAssertVersion(VER_FIRST),
-                buildOper(RawContacts.CONTENT_URI, TYPE_INSERT, joeContactInsert),
-                buildOper(Data.CONTENT_URI, TYPE_INSERT, joePhoneInsert),
-                buildAggregationModeUpdate(RawContacts.AGGREGATION_MODE_DEFAULT),
-                buildUpdateAggregationKeepTogether(CONTACT_BOB));
-
-        // Merge in the second version, verify that our insert remains
-        final EntitySet merged = EntitySet.mergeAfter(second, first);
-        assertDiffPattern(merged,
-                buildAssertVersion(VER_SECOND),
-                buildAssertVersion(VER_SECOND),
-                buildOper(RawContacts.CONTENT_URI, TYPE_INSERT, joeContactInsert),
-                buildOper(Data.CONTENT_URI, TYPE_INSERT, joePhoneInsert),
-                buildAggregationModeUpdate(RawContacts.AGGREGATION_MODE_DEFAULT),
-                buildUpdateAggregationKeepTogether(CONTACT_BOB));
-    }
-
-    public void testMergeRawContactLocalDeleteRemoteDelete() {
-        final EntitySet first = buildSet(
-                buildBeforeEntity(CONTACT_BOB, VER_FIRST, buildPhone(PHONE_RED)),
-                buildBeforeEntity(CONTACT_MARY, VER_FIRST, buildPhone(PHONE_RED)));
-        final EntitySet second = buildSet(
-                buildBeforeEntity(CONTACT_BOB, VER_SECOND, buildPhone(PHONE_RED)));
-
-        // Remove contact locally
-        first.getByRawContactId(CONTACT_MARY).markDeleted();
-        assertDiffPattern(first,
-                buildAssertVersion(VER_FIRST),
-                buildAssertVersion(VER_FIRST),
-                buildDelete(RawContacts.CONTENT_URI));
-
-        // Merge in the second version, verify that our delete isn't needed
-        final EntitySet merged = EntitySet.mergeAfter(second, first);
-        assertDiffPattern(merged);
-    }
-
-    public void testMergeRawContactLocalUpdateRemoteDelete() {
-        final EntitySet first = buildSet(
-                buildBeforeEntity(CONTACT_BOB, VER_FIRST, buildPhone(PHONE_RED)),
-                buildBeforeEntity(CONTACT_MARY, VER_FIRST, buildPhone(PHONE_RED)));
-        final EntitySet second = buildSet(
-                buildBeforeEntity(CONTACT_BOB, VER_SECOND, buildPhone(PHONE_RED)));
-
-        // Perform local update
-        final ValuesDelta phone = getPhone(first, CONTACT_MARY, PHONE_RED);
-        phone.put(Phone.NUMBER, TEST_PHONE);
-        assertDiffPattern(first,
-                buildAssertVersion(VER_FIRST),
-                buildAssertVersion(VER_FIRST),
-                buildUpdateAggregationSuspended(),
-                buildOper(Data.CONTENT_URI, TYPE_UPDATE, phone.getAfter()),
-                buildUpdateAggregationDefault());
-
-        final ContentValues phoneInsert = phone.getCompleteValues();
-        final ContentValues contactInsert = first.getByRawContactId(CONTACT_MARY).getValues()
-                .getCompleteValues();
-        contactInsert.put(RawContacts.AGGREGATION_MODE, RawContacts.AGGREGATION_MODE_SUSPENDED);
-
-        // Merge and verify that update turned into insert
-        final EntitySet merged = EntitySet.mergeAfter(second, first);
-        assertDiffPattern(merged,
-                buildAssertVersion(VER_SECOND),
-                buildOper(RawContacts.CONTENT_URI, TYPE_INSERT, contactInsert),
-                buildOper(Data.CONTENT_URI, TYPE_INSERT, phoneInsert),
-                buildAggregationModeUpdate(RawContacts.AGGREGATION_MODE_DEFAULT),
-                buildUpdateAggregationKeepTogether(CONTACT_BOB));
-    }
-
-    public void testMergeUsesNewVersion() {
-        final EntitySet first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
-                buildPhone(PHONE_RED)));
-        final EntitySet second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
-                buildPhone(PHONE_RED)));
-
-        assertEquals((Long)VER_FIRST, getVersion(first, CONTACT_BOB));
-        assertEquals((Long)VER_SECOND, getVersion(second, CONTACT_BOB));
-
-        final EntitySet merged = EntitySet.mergeAfter(second, first);
-        assertEquals((Long)VER_SECOND, getVersion(merged, CONTACT_BOB));
-    }
-
-    public void testMergeAfterEnsureAndTrim() {
-        final EntitySet first = buildSet(buildBeforeEntity(CONTACT_BOB, VER_FIRST,
-                buildEmail(EMAIL_YELLOW)));
-        final EntitySet second = buildSet(buildBeforeEntity(CONTACT_BOB, VER_SECOND,
-                buildEmail(EMAIL_YELLOW)));
-
-        // Ensure we have at least one phone
-        final ContactsSource source = getSource();
-        final EntityDelta bobContact = first.getByRawContactId(CONTACT_BOB);
-        EntityModifier.ensureKindExists(bobContact, source, Phone.CONTENT_ITEM_TYPE);
-        final ValuesDelta bobPhone = bobContact.getSuperPrimaryEntry(Phone.CONTENT_ITEM_TYPE, true);
-
-        // Make sure the update would insert a row
-        assertDiffPattern(first,
-                buildAssertVersion(VER_FIRST),
-                buildUpdateAggregationSuspended(),
-                buildOper(Data.CONTENT_URI, TYPE_INSERT, buildDataInsert(bobPhone, CONTACT_BOB)),
-                buildUpdateAggregationDefault());
-
-        // Trim values and ensure that we don't insert things
-        EntityModifier.trimEmpty(bobContact, source);
-        assertDiffPattern(first);
-
-        // Now re-parent the change, which should remain no-op
-        final EntitySet merged = EntitySet.mergeAfter(second, first);
-        assertDiffPattern(merged);
-    }
-}
diff --git a/tests/src/com/android/contacts/GroupingListAdapterTests.java b/tests/src/com/android/contacts/GroupingListAdapterTests.java
deleted file mode 100644
index 1877fac..0000000
--- a/tests/src/com/android/contacts/GroupingListAdapterTests.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.contacts;
-
-import android.content.Context;
-import android.database.CharArrayBuffer;
-import android.database.Cursor;
-import android.database.MatrixCursor;
-import android.provider.CallLog.Calls;
-import android.test.AndroidTestCase;
-import android.text.TextUtils;
-import android.view.View;
-import android.view.ViewGroup;
-
-import static com.android.contacts.GroupingListAdapter.ITEM_TYPE_STANDALONE;
-import static com.android.contacts.GroupingListAdapter.ITEM_TYPE_IN_GROUP;
-import static com.android.contacts.GroupingListAdapter.ITEM_TYPE_GROUP_HEADER;
-
-/**
- * Tests for the contact call list adapter.
- *
- * Running all tests:
- *
- *   runtest contacts
- * or
- *   adb shell am instrument \
- *     -w com.android.contacts.tests/android.test.InstrumentationTestRunner
- */
-public class GroupingListAdapterTests extends AndroidTestCase {
-
-    static private final String[] CALL_LOG_PROJECTION = new String[] {
-        Calls._ID,
-        Calls.NUMBER,
-        Calls.DATE,
-    };
-
-    private static final int CALLS_NUMBER_COLUMN_INDEX = 1;
-
-    private MatrixCursor mCursor;
-    private long mNextCall;
-
-    private GroupingListAdapter mAdapter = new GroupingListAdapter(null) {
-
-        @Override
-        protected void addGroups(Cursor cursor) {
-            int count = cursor.getCount();
-            int groupItemCount = 1;
-            cursor.moveToFirst();
-            String currentValue = cursor.getString(CALLS_NUMBER_COLUMN_INDEX);
-            for (int i = 1; i < count; i++) {
-                cursor.moveToNext();
-                String value = cursor.getString(CALLS_NUMBER_COLUMN_INDEX);
-                if (TextUtils.equals(value, currentValue)) {
-                    groupItemCount++;
-                } else {
-                    if (groupItemCount > 1) {
-                        addGroup(i - groupItemCount, groupItemCount, false);
-                    }
-
-                    groupItemCount = 1;
-                    currentValue = value;
-                }
-            }
-            if (groupItemCount > 1) {
-                addGroup(count - groupItemCount, groupItemCount, false);
-            }
-        }
-
-        @Override
-        protected void bindChildView(View view, Context context, Cursor cursor) {
-        }
-
-        @Override
-        protected void bindGroupView(View view, Context context, Cursor cursor, int groupSize,
-                boolean expanded) {
-        }
-
-        @Override
-        protected void bindStandAloneView(View view, Context context, Cursor cursor) {
-        }
-
-        @Override
-        protected View newChildView(Context context, ViewGroup parent) {
-            return null;
-        }
-
-        @Override
-        protected View newGroupView(Context context, ViewGroup parent) {
-            return null;
-        }
-
-        @Override
-        protected View newStandAloneView(Context context, ViewGroup parent) {
-            return null;
-        }
-    };
-
-    private void buildCursor(String... numbers) {
-        mCursor = new MatrixCursor(CALL_LOG_PROJECTION);
-        mNextCall = 1;
-        for (String number : numbers) {
-            mCursor.addRow(new Object[]{mNextCall, number, 1000 - mNextCall});
-            mNextCall++;
-        }
-    }
-
-    public void testGroupingWithoutGroups() {
-        buildCursor("1", "2", "3");
-        mAdapter.changeCursor(mCursor);
-
-        assertEquals(3, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_STANDALONE, false, 1);
-        assertPositionMetadata(2, ITEM_TYPE_STANDALONE, false, 2);
-    }
-
-    public void testGroupingWithCollapsedGroupAtTheBeginning() {
-        buildCursor("1", "1", "2");
-        mAdapter.changeCursor(mCursor);
-
-        assertEquals(2, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_GROUP_HEADER, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_STANDALONE, false, 2);
-    }
-
-    public void testGroupingWithExpandedGroupAtTheBeginning() {
-        buildCursor("1", "1", "2");
-        mAdapter.changeCursor(mCursor);
-        mAdapter.toggleGroup(0);
-
-        assertEquals(4, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_GROUP_HEADER, true, 0);
-        assertPositionMetadata(1, ITEM_TYPE_IN_GROUP, false, 0);
-        assertPositionMetadata(2, ITEM_TYPE_IN_GROUP, false, 1);
-        assertPositionMetadata(3, ITEM_TYPE_STANDALONE, false, 2);
-    }
-
-    public void testGroupingWithExpandCollapseCycleAtTheBeginning() {
-        buildCursor("1", "1", "2");
-        mAdapter.changeCursor(mCursor);
-        mAdapter.toggleGroup(0);
-        mAdapter.toggleGroup(0);
-
-        assertEquals(2, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_GROUP_HEADER, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_STANDALONE, false, 2);
-    }
-
-    public void testGroupingWithCollapsedGroupInTheMiddle() {
-        buildCursor("1", "2", "2", "2", "3");
-        mAdapter.changeCursor(mCursor);
-
-        assertEquals(3, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, false, 1);
-        assertPositionMetadata(2, ITEM_TYPE_STANDALONE, false, 4);
-    }
-
-    public void testGroupingWithExpandedGroupInTheMiddle() {
-        buildCursor("1", "2", "2", "2", "3");
-        mAdapter.changeCursor(mCursor);
-        mAdapter.toggleGroup(1);
-
-        assertEquals(6, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, true, 1);
-        assertPositionMetadata(2, ITEM_TYPE_IN_GROUP, false, 1);
-        assertPositionMetadata(3, ITEM_TYPE_IN_GROUP, false, 2);
-        assertPositionMetadata(4, ITEM_TYPE_IN_GROUP, false, 3);
-        assertPositionMetadata(5, ITEM_TYPE_STANDALONE, false, 4);
-    }
-
-    public void testGroupingWithCollapsedGroupAtTheEnd() {
-        buildCursor("1", "2", "3", "3", "3");
-        mAdapter.changeCursor(mCursor);
-
-        assertEquals(3, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_STANDALONE, false, 1);
-        assertPositionMetadata(2, ITEM_TYPE_GROUP_HEADER, false, 2);
-    }
-
-    public void testGroupingWithExpandedGroupAtTheEnd() {
-        buildCursor("1", "2", "3", "3", "3");
-        mAdapter.changeCursor(mCursor);
-        mAdapter.toggleGroup(2);
-
-        assertEquals(6, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_STANDALONE, false, 1);
-        assertPositionMetadata(2, ITEM_TYPE_GROUP_HEADER, true, 2);
-        assertPositionMetadata(3, ITEM_TYPE_IN_GROUP, false, 2);
-        assertPositionMetadata(4, ITEM_TYPE_IN_GROUP, false, 3);
-        assertPositionMetadata(5, ITEM_TYPE_IN_GROUP, false, 4);
-    }
-
-    public void testGroupingWithMultipleCollapsedGroups() {
-        buildCursor("1", "2", "2", "3", "4", "4", "5", "5", "6");
-        mAdapter.changeCursor(mCursor);
-
-        assertEquals(6, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, false, 1);
-        assertPositionMetadata(2, ITEM_TYPE_STANDALONE, false, 3);
-        assertPositionMetadata(3, ITEM_TYPE_GROUP_HEADER, false, 4);
-        assertPositionMetadata(4, ITEM_TYPE_GROUP_HEADER, false, 6);
-        assertPositionMetadata(5, ITEM_TYPE_STANDALONE, false, 8);
-    }
-
-    public void testGroupingWithMultipleExpandedGroups() {
-        buildCursor("1", "2", "2", "3", "4", "4", "5", "5", "6");
-        mAdapter.changeCursor(mCursor);
-        mAdapter.toggleGroup(1);
-
-        // Note that expanding the group of 2's shifted the group of 5's down from the
-        // 4th to the 6th position
-        mAdapter.toggleGroup(6);
-
-        assertEquals(10, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, true, 1);
-        assertPositionMetadata(2, ITEM_TYPE_IN_GROUP, false, 1);
-        assertPositionMetadata(3, ITEM_TYPE_IN_GROUP, false, 2);
-        assertPositionMetadata(4, ITEM_TYPE_STANDALONE, false, 3);
-        assertPositionMetadata(5, ITEM_TYPE_GROUP_HEADER, false, 4);
-        assertPositionMetadata(6, ITEM_TYPE_GROUP_HEADER, true, 6);
-        assertPositionMetadata(7, ITEM_TYPE_IN_GROUP, false, 6);
-        assertPositionMetadata(8, ITEM_TYPE_IN_GROUP, false, 7);
-        assertPositionMetadata(9, ITEM_TYPE_STANDALONE, false, 8);
-    }
-
-    public void testPositionCache() {
-        buildCursor("1", "2", "2", "3", "4", "4", "5", "5", "6");
-        mAdapter.changeCursor(mCursor);
-
-        // First pass - building up cache
-        assertEquals(6, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, false, 1);
-        assertPositionMetadata(2, ITEM_TYPE_STANDALONE, false, 3);
-        assertPositionMetadata(3, ITEM_TYPE_GROUP_HEADER, false, 4);
-        assertPositionMetadata(4, ITEM_TYPE_GROUP_HEADER, false, 6);
-        assertPositionMetadata(5, ITEM_TYPE_STANDALONE, false, 8);
-
-        // Second pass - using cache
-        assertEquals(6, mAdapter.getCount());
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, false, 1);
-        assertPositionMetadata(2, ITEM_TYPE_STANDALONE, false, 3);
-        assertPositionMetadata(3, ITEM_TYPE_GROUP_HEADER, false, 4);
-        assertPositionMetadata(4, ITEM_TYPE_GROUP_HEADER, false, 6);
-        assertPositionMetadata(5, ITEM_TYPE_STANDALONE, false, 8);
-
-        // Invalidate cache by expanding a group
-        mAdapter.toggleGroup(1);
-
-        // First pass - building up cache
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, true, 1);
-        assertPositionMetadata(2, ITEM_TYPE_IN_GROUP, false, 1);
-        assertPositionMetadata(3, ITEM_TYPE_IN_GROUP, false, 2);
-        assertPositionMetadata(4, ITEM_TYPE_STANDALONE, false, 3);
-        assertPositionMetadata(5, ITEM_TYPE_GROUP_HEADER, false, 4);
-        assertPositionMetadata(6, ITEM_TYPE_GROUP_HEADER, false, 6);
-        assertPositionMetadata(7, ITEM_TYPE_STANDALONE, false, 8);
-
-        // Second pass - using cache
-        assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0);
-        assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, true, 1);
-        assertPositionMetadata(2, ITEM_TYPE_IN_GROUP, false, 1);
-        assertPositionMetadata(3, ITEM_TYPE_IN_GROUP, false, 2);
-        assertPositionMetadata(4, ITEM_TYPE_STANDALONE, false, 3);
-        assertPositionMetadata(5, ITEM_TYPE_GROUP_HEADER, false, 4);
-        assertPositionMetadata(6, ITEM_TYPE_GROUP_HEADER, false, 6);
-        assertPositionMetadata(7, ITEM_TYPE_STANDALONE, false, 8);
-    }
-
-    public void testGroupDescriptorArrayGrowth() {
-        String[] numbers = new String[500];
-        for (int i = 0; i < numbers.length; i++) {
-
-            // Make groups of 2
-            numbers[i] = String.valueOf((i / 2) * 2);
-        }
-
-        buildCursor(numbers);
-        mAdapter.changeCursor(mCursor);
-
-        assertEquals(250, mAdapter.getCount());
-    }
-
-    private void assertPositionMetadata(int position, int itemType, boolean isExpanded,
-            int cursorPosition) {
-        GroupingListAdapter.PositionMetadata metadata = new GroupingListAdapter.PositionMetadata();
-        mAdapter.obtainPositionMetadata(metadata, position);
-        assertEquals(itemType, metadata.itemType);
-        if (metadata.itemType == ITEM_TYPE_GROUP_HEADER) {
-            assertEquals(isExpanded, metadata.isExpanded);
-        }
-        assertEquals(cursorPosition, metadata.cursorPosition);
-    }
-}
diff --git a/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java b/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
new file mode 100644
index 0000000..377fb1b
--- /dev/null
+++ b/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.interactions;
+
+import com.android.contacts.R;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.tests.mocks.ContactsMockContext;
+import com.android.contacts.tests.mocks.MockContentProvider;
+import com.android.contacts.tests.mocks.MockContentProvider.Query;
+import com.android.contacts.tests.mocks.MockSources;
+
+import android.content.AsyncTaskLoader;
+import android.content.ContentUris;
+import android.content.Loader;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.RawContacts;
+import android.test.InstrumentationTestCase;
+import android.test.suitebuilder.annotation.Smoke;
+
+/**
+ * Tests for {@link ContactDeletionInteraction}.
+ *
+ * Running all tests:
+ *
+ *   runtest contacts
+ * or
+ *   adb shell am instrument \
+ *     -w com.android.contacts.tests/android.test.InstrumentationTestRunner
+ */
+@Smoke
+public class ContactDeletionInteractionTest extends InstrumentationTestCase {
+
+    private final static class TestContactDeletionInteraction extends ContactDeletionInteraction {
+        public Uri contactUri;
+        public int messageId;
+
+        @Override
+        void startLoading(Loader<Cursor> loader) {
+            // Execute the loader synchronously
+            AsyncTaskLoader<Cursor> atLoader = (AsyncTaskLoader<Cursor>)loader;
+            Cursor data = atLoader.loadInBackground();
+            atLoader.deliverResult(data);
+        }
+
+        @Override
+        void showDialog(Bundle bundle) {
+            contactUri = bundle.getParcelable(EXTRA_KEY_CONTACT_URI);
+            messageId = bundle.getInt(EXTRA_KEY_MESSAGE_ID);
+        }
+
+        @Override
+        AccountTypes getSources() {
+            return new MockSources();
+        }
+    }
+
+    private ContactsMockContext mContext;
+    private MockContentProvider mContactsProvider;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mContext = new ContactsMockContext(getInstrumentation().getTargetContext());
+        mContactsProvider = mContext.getContactsProvider();
+    }
+
+    public void testSingleWritableRawContact() {
+        expectQuery().returnRow(1, MockSources.WRITABLE_ACCOUNT_TYPE);
+        assertWithMessageId(R.string.deleteConfirmation);
+    }
+
+    public void testReadOnlyRawContacts() {
+        expectQuery().returnRow(1, MockSources.READONLY_ACCOUNT_TYPE);
+        assertWithMessageId(R.string.readOnlyContactWarning);
+    }
+
+    public void testMixOfWritableAndReadOnlyRawContacts() {
+        expectQuery()
+                .returnRow(1, MockSources.WRITABLE_ACCOUNT_TYPE)
+                .returnRow(2, MockSources.READONLY_ACCOUNT_TYPE);
+        assertWithMessageId(R.string.readOnlyContactDeleteConfirmation);
+    }
+
+    public void testMultipleWritableRawContacts() {
+        expectQuery()
+                .returnRow(1, MockSources.WRITABLE_ACCOUNT_TYPE)
+                .returnRow(2, MockSources.WRITABLE_ACCOUNT_TYPE);
+        assertWithMessageId(R.string.multipleContactDeleteConfirmation);
+    }
+
+    private Query expectQuery() {
+        return mContactsProvider.expectQuery(RawContacts.CONTENT_URI)
+                .withProjection(RawContacts._ID, RawContacts.ACCOUNT_TYPE)
+                .withSelection("contact_id=?", "13");
+    }
+
+    private void assertWithMessageId(int messageId) {
+        TestContactDeletionInteraction interaction = new TestContactDeletionInteraction();
+        interaction.setContext(mContext);
+        interaction.deleteContact(ContentUris.withAppendedId(Contacts.CONTENT_URI, 13));
+        assertEquals("content://com.android.contacts/contacts/13",
+                interaction.contactUri.toString());
+        assertEquals(messageId, interaction.messageId);
+        mContactsProvider.verify();
+    }
+}
diff --git a/tests/src/com/android/contacts/interactions/PhoneNumberInteractionTest.java b/tests/src/com/android/contacts/interactions/PhoneNumberInteractionTest.java
new file mode 100644
index 0000000..8c6a1ac
--- /dev/null
+++ b/tests/src/com/android/contacts/interactions/PhoneNumberInteractionTest.java
@@ -0,0 +1,184 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.interactions;
+
+import com.android.contacts.R;
+import com.android.contacts.interactions.PhoneNumberInteraction.PhoneItem;
+import com.android.contacts.tests.mocks.ContactsMockContext;
+import com.android.contacts.tests.mocks.MockContentProvider;
+import com.android.contacts.tests.mocks.MockContentProvider.Query;
+
+import android.content.AsyncTaskLoader;
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.DialogInterface.OnDismissListener;
+import android.content.Intent;
+import android.content.Loader;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.RawContacts;
+import android.test.InstrumentationTestCase;
+import android.test.suitebuilder.annotation.Smoke;
+
+import java.util.ArrayList;
+
+/**
+ * Tests for {@link PhoneNumberInteraction}.
+ *
+ * Running all tests:
+ *
+ *   runtest contacts
+ * or
+ *   adb shell am instrument \
+ *     -w com.android.contacts.tests/android.test.InstrumentationTestRunner
+ */
+@Smoke
+public class PhoneNumberInteractionTest extends InstrumentationTestCase {
+
+    private final static class TestPhoneNumberInteraction extends PhoneNumberInteraction {
+        Intent startedIntent;
+        int dialogId;
+        Bundle dialogArgs;
+
+        public TestPhoneNumberInteraction(
+                Context context, boolean sendTextMessage, OnDismissListener dismissListener) {
+            super(context, sendTextMessage, dismissListener);
+        }
+
+        @Override
+        void startLoading(Loader<Cursor> loader) {
+            // Execute the loader synchronously
+            AsyncTaskLoader<Cursor> atLoader = (AsyncTaskLoader<Cursor>)loader;
+            Cursor data = atLoader.loadInBackground();
+            atLoader.deliverResult(data);
+        }
+
+        @Override
+        void startActivity(Intent intent) {
+            this.startedIntent = intent;
+        }
+
+        @Override
+        void showDialog(int dialogId, Bundle bundle) {
+            this.dialogId = dialogId;
+            this.dialogArgs = bundle;
+        }
+    }
+
+    private ContactsMockContext mContext;
+    private MockContentProvider mContactsProvider;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mContext = new ContactsMockContext(getInstrumentation().getTargetContext());
+        mContactsProvider = mContext.getContactsProvider();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        mContactsProvider.verify();
+        super.tearDown();
+    }
+
+    public void testSendSmsWhenOnlyOneNumberAvailable() {
+        Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, 13);
+        expectQuery(contactUri)
+                .returnRow(1, "123", 0, null, Phone.TYPE_HOME, null);
+
+        TestPhoneNumberInteraction interaction = new TestPhoneNumberInteraction(
+                mContext, true, null);
+
+        interaction.startInteraction(contactUri);
+
+        assertEquals(Intent.ACTION_SENDTO, interaction.startedIntent.getAction());
+        assertEquals("sms:123", interaction.startedIntent.getDataString());
+    }
+
+    public void testSendSmsWhenThereIsPrimaryNumber() {
+        Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, 13);
+        expectQuery(contactUri)
+                .returnRow(1, "123", 0, null, Phone.TYPE_HOME, null)
+                .returnRow(2, "456", 1, null, Phone.TYPE_HOME, null);
+
+        TestPhoneNumberInteraction interaction = new TestPhoneNumberInteraction(
+                mContext, true, null);
+
+        interaction.startInteraction(contactUri);
+
+        assertEquals(Intent.ACTION_SENDTO, interaction.startedIntent.getAction());
+        assertEquals("sms:456", interaction.startedIntent.getDataString());
+    }
+
+    public void testCallNumberWhenThereAreDuplicates() {
+        Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, 13);
+        expectQuery(contactUri)
+                .returnRow(1, "123", 0, null, Phone.TYPE_HOME, null)
+                .returnRow(2, "123", 0, null, Phone.TYPE_WORK, null);
+
+        TestPhoneNumberInteraction interaction = new TestPhoneNumberInteraction(
+                mContext, false, null);
+
+        interaction.startInteraction(contactUri);
+
+        assertEquals(Intent.ACTION_CALL_PRIVILEGED, interaction.startedIntent.getAction());
+        assertEquals("tel:123", interaction.startedIntent.getDataString());
+    }
+
+    public void testShowDisambigDialogForCalling() {
+        Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, 13);
+        expectQuery(contactUri)
+                .returnRow(1, "123", 0, "account", Phone.TYPE_HOME, "label")
+                .returnRow(2, "456", 0, null, Phone.TYPE_WORK, null);
+
+        TestPhoneNumberInteraction interaction = new TestPhoneNumberInteraction(
+                mContext, false, null);
+
+        interaction.startInteraction(contactUri);
+
+        assertEquals(R.id.dialog_phone_number_call_disambiguation, interaction.dialogId);
+
+        ArrayList<PhoneItem> items = interaction.dialogArgs.getParcelableArrayList(
+                PhoneNumberInteraction.EXTRA_KEY_ITEMS);
+        assertEquals(2, items.size());
+
+        PhoneItem item = items.get(0);
+        assertEquals(1, item.id);
+        assertEquals("123", item.phoneNumber);
+        assertEquals("account", item.accountType);
+        assertEquals(Phone.TYPE_HOME, item.type);
+        assertEquals("label", item.label);
+    }
+
+    private Query expectQuery(Uri contactUri) {
+        Uri dataUri = Uri.withAppendedPath(contactUri, Contacts.Data.CONTENT_DIRECTORY);
+        return mContactsProvider
+                .expectQuery(dataUri)
+                .withProjection(
+                        Phone._ID,
+                        Phone.NUMBER,
+                        Phone.IS_SUPER_PRIMARY,
+                        RawContacts.ACCOUNT_TYPE,
+                        Phone.TYPE,
+                        Phone.LABEL)
+                .withSelection("mimetype='vnd.android.cursor.item/phone_v2' AND data1 NOT NULL");
+    }
+}
diff --git a/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java b/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
new file mode 100644
index 0000000..bf75ed1
--- /dev/null
+++ b/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java
@@ -0,0 +1,621 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.tests.allintents;
+
+import com.android.contacts.ContactsSearchManager;
+import com.android.contacts.list.ContactsRequest;
+import com.android.contacts.tests.R;
+import com.google.android.collect.Lists;
+
+import android.accounts.Account;
+import android.app.ListActivity;
+import android.app.SearchManager;
+import android.content.ComponentName;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.Contacts.ContactMethods;
+import android.provider.Contacts.People;
+import android.provider.Contacts.Phones;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Organization;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.Intents;
+import android.provider.ContactsContract.Intents.Insert;
+import android.provider.ContactsContract.Intents.UI;
+import android.provider.ContactsContract.RawContacts;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.Toast;
+
+/**
+ * An activity that provides access to various modes of the contacts application.
+ * Useful for manual and scripted tests.
+ */
+@SuppressWarnings("deprecation")
+public class AllIntentsActivity extends ListActivity
+        implements SelectAccountDialogFragment.Listener {
+
+    private static final String ANDROID_CONTACTS_PACKAGE = "com.android.contacts";
+
+    private static final String CONTACT_LIST_ACTIVITY_CLASS_NAME =
+            "com.android.contacts.activities.ContactBrowserActivity";
+    private static final String SEARCH_RESULTS_ACTIVITY_CLASS_NAME =
+            "com.android.contacts.SearchResultsActivity";
+    private static final String MULTIPLE_PHONE_PICKER_ACTIVITY_CLASS_NAME =
+            "com.android.contacts.MultiplePhonePickerActivity";
+
+    private static final int LIST_DEFAULT = 0;
+    private static final int LIST_ALL_CONTACTS_ACTION = 1;
+    private static final int LIST_CONTACTS_WITH_PHONES_ACTION = 2;
+    private static final int LIST_STARRED_ACTION = 3;
+    private static final int LIST_STARRED_ACTION_WITH_FILTER = 4;
+    private static final int LIST_FREQUENT_ACTION = 5;
+    private static final int LIST_FREQUENT_ACTION_WITH_FILTER = 6;
+    private static final int LIST_STREQUENT_ACTION = 7;
+    private static final int LIST_STREQUENT_ACTION_WITH_FILTER = 8;
+    private static final int ACTION_PICK_CONTACT = 9;
+    private static final int ACTION_PICK_CONTACT_LEGACY = 10;
+    private static final int ACTION_PICK_PHONE = 11;
+    private static final int ACTION_PICK_PHONE_LEGACY = 12;
+    private static final int ACTION_PICK_POSTAL = 13;
+    private static final int ACTION_PICK_POSTAL_LEGACY = 14;
+    private static final int ACTION_CREATE_SHORTCUT_CONTACT = 15;
+    private static final int ACTION_CREATE_SHORTCUT_CONTACT_FILTER = 16;
+    private static final int ACTION_CREATE_SHORTCUT_DIAL = 17;
+    private static final int ACTION_CREATE_SHORTCUT_DIAL_FILTER = 18;
+    private static final int ACTION_CREATE_SHORTCUT_MESSAGE = 19;
+    private static final int ACTION_CREATE_SHORTCUT_MESSAGE_FILTER = 20;
+    private static final int ACTION_GET_CONTENT_CONTACT = 21;
+    private static final int ACTION_GET_CONTENT_CONTACT_FILTER = 22;
+    private static final int ACTION_GET_CONTENT_CONTACT_LEGACY = 23;
+    private static final int ACTION_GET_CONTENT_CONTACT_FILTER_LEGACY = 24;
+    private static final int ACTION_GET_CONTENT_PHONE = 25;
+    private static final int ACTION_GET_CONTENT_PHONE_FILTER = 26;
+    private static final int ACTION_GET_CONTENT_PHONE_LEGACY = 27;
+    private static final int ACTION_GET_CONTENT_POSTAL = 28;
+    private static final int ACTION_GET_CONTENT_POSTAL_FILTER = 29;
+    private static final int ACTION_GET_CONTENT_POSTAL_LEGACY = 30;
+    private static final int ACTION_INSERT_OR_EDIT = 31;
+    private static final int ACTION_SEARCH_CALL = 32;
+    private static final int ACTION_SEARCH_CONTACT = 33;
+    private static final int ACTION_SEARCH_EMAIL = 34;
+    private static final int ACTION_SEARCH_PHONE = 35;
+    private static final int SEARCH_SUGGESTION_CLICKED_CALL_BUTTON = 36;
+    private static final int SEARCH_SUGGESTION_CLICKED_CONTACT = 37;
+    private static final int SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = 38;
+    private static final int SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = 39;
+    private static final int JOIN_CONTACT = 40;
+    private static final int ACTION_GET_MULTIPLE_PHONES = 41;
+
+    private static final int EDIT_CONTACT = 42;
+    private static final int EDIT_CONTACT_LOOKUP = 43;
+    private static final int EDIT_CONTACT_LOOKUP_ID = 44;
+    private static final int EDIT_RAW_CONTACT = 45;
+    private static final int EDIT_LEGACY = 46;
+    private static final int EDIT_NEW_CONTACT = 47;
+    private static final int EDIT_NEW_CONTACT_WITH_DATA = 48;
+    private static final int EDIT_NEW_CONTACT_FOR_ACCOUNT = 49;
+    private static final int EDIT_NEW_CONTACT_FOR_ACCOUNT_WITH_DATA = 50;
+    private static final int EDIT_NEW_RAW_CONTACT = 51;
+    private static final int EDIT_NEW_LEGACY = 52;
+
+    private static final int VIEW_CONTACT = 53;
+    private static final int VIEW_CONTACT_LOOKUP = 54;
+    private static final int VIEW_CONTACT_LOOKUP_ID = 55;
+    private static final int VIEW_RAW_CONTACT = 56;
+    private static final int VIEW_LEGACY = 57;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setListAdapter(new ArrayAdapter<String>(this, R.layout.intent_list_item,
+                getResources().getStringArray(R.array.allIntents)));
+    }
+
+    @Override
+    protected void onListItemClick(ListView l, View v, int position, long id) {
+        super.onListItemClick(l, v, position, id);
+
+        switch (position) {
+            case LIST_DEFAULT: {
+                startContactListActivity(
+                        new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI));
+                break;
+            }
+            case LIST_ALL_CONTACTS_ACTION: {
+                startContactListActivity(
+                        new Intent(UI.LIST_ALL_CONTACTS_ACTION, Contacts.CONTENT_URI));
+                break;
+            }
+            case LIST_CONTACTS_WITH_PHONES_ACTION: {
+                startContactListActivity(
+                        new Intent(UI.LIST_CONTACTS_WITH_PHONES_ACTION, Contacts.CONTENT_URI));
+                break;
+            }
+            case LIST_STARRED_ACTION: {
+                startContactListActivity(
+                        new Intent(UI.LIST_STARRED_ACTION, Contacts.CONTENT_URI));
+                break;
+            }
+            case LIST_STARRED_ACTION_WITH_FILTER: {
+                startContactListActivity(buildFilterIntent(ContactsRequest.ACTION_STARRED, false));
+                break;
+            }
+            case LIST_FREQUENT_ACTION: {
+                startContactListActivity(
+                        new Intent(UI.LIST_FREQUENT_ACTION, Contacts.CONTENT_URI));
+                break;
+            }
+            case LIST_FREQUENT_ACTION_WITH_FILTER: {
+                startContactListActivity(
+                        buildFilterIntent(ContactsRequest.ACTION_FREQUENT, false));
+                break;
+            }
+            case LIST_STREQUENT_ACTION: {
+                startContactListActivity(
+                        new Intent(UI.LIST_STREQUENT_ACTION, Contacts.CONTENT_URI));
+                break;
+            }
+            case LIST_STREQUENT_ACTION_WITH_FILTER: {
+                startContactListActivity(
+                        buildFilterIntent(ContactsRequest.ACTION_STREQUENT, false));
+                break;
+            }
+            case ACTION_PICK_CONTACT: {
+                startContactSelectionActivityForResult(
+                        new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI));
+                break;
+            }
+            case ACTION_PICK_CONTACT_LEGACY: {
+                startContactSelectionActivityForResult(
+                        new Intent(Intent.ACTION_PICK, People.CONTENT_URI));
+                break;
+            }
+            case ACTION_PICK_PHONE: {
+                startContactSelectionActivityForResult(
+                        new Intent(Intent.ACTION_PICK, Phone.CONTENT_URI));
+                break;
+            }
+            case ACTION_PICK_PHONE_LEGACY: {
+                startContactSelectionActivityForResult(
+                        new Intent(Intent.ACTION_PICK, Phones.CONTENT_URI));
+                break;
+            }
+            case ACTION_PICK_POSTAL: {
+                startContactSelectionActivityForResult(
+                        new Intent(Intent.ACTION_PICK, StructuredPostal.CONTENT_URI));
+                break;
+            }
+            case ACTION_PICK_POSTAL_LEGACY: {
+                Intent intent = new Intent(Intent.ACTION_PICK);
+                intent.setType(ContactMethods.CONTENT_POSTAL_TYPE);
+                startContactSelectionActivityForResult(intent);
+                break;
+            }
+            case ACTION_CREATE_SHORTCUT_CONTACT: {
+                Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
+                startContactSelectionActivityForResult(intent);
+                break;
+            }
+            case ACTION_CREATE_SHORTCUT_CONTACT_FILTER: {
+                startContactSelectionActivityForResult(
+                        buildFilterIntent(ContactsRequest.ACTION_CREATE_SHORTCUT_CONTACT,
+                                false));
+                break;
+            }
+            case ACTION_CREATE_SHORTCUT_DIAL: {
+                Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
+                intent.setComponent(
+                        new ComponentName(ANDROID_CONTACTS_PACKAGE, "alias.DialShortcut"));
+                startActivityForResult(intent, 0);
+                break;
+            }
+            case ACTION_CREATE_SHORTCUT_DIAL_FILTER: {
+                startContactSelectionActivityForResult(
+                        buildFilterIntent(ContactsRequest.ACTION_CREATE_SHORTCUT_CALL,
+                                false));
+                break;
+            }
+            case ACTION_CREATE_SHORTCUT_MESSAGE: {
+                Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
+                intent.setComponent(
+                        new ComponentName(ANDROID_CONTACTS_PACKAGE, "alias.MessageShortcut"));
+                startActivityForResult(intent, 0);
+                break;
+            }
+            case ACTION_CREATE_SHORTCUT_MESSAGE_FILTER: {
+                startContactSelectionActivityForResult(
+                        buildFilterIntent(ContactsRequest.ACTION_CREATE_SHORTCUT_CALL, false));
+                break;
+            }
+            case ACTION_GET_CONTENT_CONTACT: {
+                Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+                intent.setType(Contacts.CONTENT_ITEM_TYPE);
+                startContactSelectionActivityForResult(intent);
+                break;
+            }
+            case ACTION_GET_CONTENT_CONTACT_LEGACY: {
+                Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+                intent.setType(People.CONTENT_ITEM_TYPE);
+                startContactSelectionActivityForResult(intent);
+                break;
+            }
+            case ACTION_GET_CONTENT_CONTACT_FILTER: {
+                startContactSelectionActivityForResult(
+                        buildFilterIntent(ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT, false));
+                break;
+            }
+            case ACTION_GET_CONTENT_CONTACT_FILTER_LEGACY: {
+                startContactSelectionActivityForResult(
+                        buildFilterIntent(ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT,
+                                true));
+                break;
+            }
+            case ACTION_GET_CONTENT_PHONE: {
+                Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+                intent.setType(Phone.CONTENT_ITEM_TYPE);
+                startContactSelectionActivityForResult(intent);
+                break;
+            }
+            case ACTION_GET_CONTENT_PHONE_FILTER: {
+                startContactSelectionActivityForResult(
+                        buildFilterIntent(ContactsRequest.ACTION_PICK_PHONE, true));
+                break;
+            }
+            case ACTION_GET_CONTENT_PHONE_LEGACY: {
+                Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+                intent.setType(Phones.CONTENT_ITEM_TYPE);
+                startContactSelectionActivityForResult(intent);
+                break;
+            }
+            case ACTION_GET_CONTENT_POSTAL: {
+                Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+                intent.setType(StructuredPostal.CONTENT_ITEM_TYPE);
+                startContactSelectionActivityForResult(intent);
+                break;
+            }
+            case ACTION_GET_CONTENT_POSTAL_FILTER: {
+                startContactSelectionActivityForResult(
+                        buildFilterIntent(ContactsRequest.ACTION_PICK_POSTAL, false));
+                break;
+            }
+            case ACTION_GET_CONTENT_POSTAL_LEGACY: {
+                Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+                intent.setType(ContactMethods.CONTENT_POSTAL_ITEM_TYPE);
+                startContactSelectionActivityForResult(intent);
+                break;
+            }
+            case ACTION_INSERT_OR_EDIT: {
+                Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
+                startContactListActivity(intent);
+                break;
+            }
+            case ACTION_SEARCH_CALL: {
+                Intent intent = new Intent(Intent.ACTION_SEARCH);
+                intent.putExtra(SearchManager.ACTION_MSG, "call");
+                intent.putExtra(SearchManager.QUERY, "800-4664-411");
+                startSearchResultActivity(intent);
+                break;
+            }
+            case ACTION_SEARCH_CONTACT: {
+                Intent intent = new Intent(Intent.ACTION_SEARCH);
+                intent.putExtra(SearchManager.QUERY, "a");
+                startSearchResultActivity(intent);
+                break;
+            }
+            case ACTION_SEARCH_EMAIL: {
+                Intent intent = new Intent(Intent.ACTION_SEARCH);
+                intent.putExtra(Insert.EMAIL, "a");
+                startSearchResultActivity(intent);
+                break;
+            }
+            case ACTION_SEARCH_PHONE: {
+                Intent intent = new Intent(Intent.ACTION_SEARCH);
+                intent.putExtra(Insert.PHONE, "800");
+                startSearchResultActivity(intent);
+                break;
+            }
+            case SEARCH_SUGGESTION_CLICKED_CALL_BUTTON: {
+                long contactId = findArbitraryContactWithPhoneNumber();
+                if (contactId != -1) {
+                    Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+                    Intent intent = new Intent(Intents.SEARCH_SUGGESTION_CLICKED);
+                    intent.setData(contactUri);
+                    intent.putExtra(SearchManager.ACTION_MSG, "call");
+                    startContactListActivity(intent);
+                }
+                break;
+            }
+            case SEARCH_SUGGESTION_CLICKED_CONTACT: {
+                long contactId = findArbitraryContactWithPhoneNumber();
+                if (contactId != -1) {
+                    Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+                    Intent intent = new Intent(Intents.SEARCH_SUGGESTION_CLICKED);
+                    intent.setData(contactUri);
+                    startContactListActivity(intent);
+                }
+                break;
+            }
+            case SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED: {
+                Intent intent = new Intent(Intents.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED);
+                intent.setData(Uri.parse("tel:800-4664411"));
+                startContactListActivity(intent);
+                break;
+            }
+            case SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED: {
+                Intent intent = new Intent(Intents.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED);
+                intent.setData(Uri.parse("tel:800-4664411"));
+                startContactListActivity(intent);
+                break;
+            }
+            case JOIN_CONTACT: {
+                // TODO
+                break;
+            }
+            case ACTION_GET_MULTIPLE_PHONES: {
+                Intent intent = new Intent(Intents.ACTION_GET_MULTIPLE_PHONES);
+                intent.setType(Phone.CONTENT_TYPE);
+                intent.putExtra(Intents.EXTRA_PHONE_URIS, new Uri[] {
+                        Uri.parse("tel:555-1212"), Uri.parse("tel:555-2121")
+                });
+                startMultiplePhoneSelectionActivityForResult(intent);
+                break;
+            }
+            case EDIT_CONTACT: {
+                final long contactId = findArbitraryContactWithPhoneNumber();
+                final Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+                final Intent intent = new Intent(Intent.ACTION_EDIT, uri);
+                startActivity(intent);
+                break;
+            }
+            case EDIT_CONTACT_LOOKUP: {
+                final long contactId = findArbitraryContactWithPhoneNumber();
+                final Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+                final Uri lookupUri = Contacts.getLookupUri(getContentResolver(), uri);
+                final String lookupKey = lookupUri.getPathSegments().get(2);
+                final Uri lookupWithoutIdUri = Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI,
+                        lookupKey);
+                final Intent intent = new Intent(Intent.ACTION_EDIT, lookupWithoutIdUri);
+                startActivity(intent);
+                break;
+            }
+            case EDIT_CONTACT_LOOKUP_ID: {
+                final long contactId = findArbitraryContactWithPhoneNumber();
+                final Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+                final Uri lookupUri = Contacts.getLookupUri(getContentResolver(), uri);
+                final Intent intent = new Intent(Intent.ACTION_EDIT, lookupUri);
+                startActivity(intent);
+                break;
+            }
+            case EDIT_RAW_CONTACT: {
+                final long contactId = findArbitraryContactWithPhoneNumber();
+                final long rawContactId = findArbitraryRawContactOfContact(contactId);
+                final Uri uri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
+                final Intent intent = new Intent(Intent.ACTION_EDIT, uri);
+                startActivity(intent);
+                break;
+            }
+            case EDIT_LEGACY: {
+                final Uri legacyContentUri = Uri.parse("content://contacts/people");
+                final long contactId = findArbitraryContactWithPhoneNumber();
+                final long rawContactId = findArbitraryRawContactOfContact(contactId);
+                final Uri uri = ContentUris.withAppendedId(legacyContentUri, rawContactId);
+                final Intent intent = new Intent(Intent.ACTION_EDIT, uri);
+                startActivity(intent);
+                break;
+            }
+            case EDIT_NEW_CONTACT: {
+                startActivity(new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI));
+                break;
+            }
+            case EDIT_NEW_CONTACT_WITH_DATA: {
+                Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+
+                ContentValues row1 = new ContentValues();
+                row1.put(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE);
+                row1.put(Organization.COMPANY, "Android");
+
+                ContentValues row2 = new ContentValues();
+                row2.put(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE);
+                row2.put(Email.TYPE, Email.TYPE_CUSTOM);
+                row2.put(Email.LABEL, "Green Bot");
+                row2.put(Email.ADDRESS, "android@android.com");
+
+                intent.putParcelableArrayListExtra(Insert.DATA, Lists.newArrayList(row1, row2));
+
+                startActivity(intent);
+                break;
+            }
+            case EDIT_NEW_CONTACT_FOR_ACCOUNT:
+            case EDIT_NEW_CONTACT_FOR_ACCOUNT_WITH_DATA: {
+                final SelectAccountDialogFragment dialog = new SelectAccountDialogFragment();
+                dialog.setArguments(SelectAccountDialogFragment.createBundle(position));
+                dialog.show(getFragmentManager(), SelectAccountDialogFragment.TAG);
+                break;
+            }
+            case EDIT_NEW_RAW_CONTACT: {
+                startActivity(new Intent(Intent.ACTION_INSERT, RawContacts.CONTENT_URI));
+                break;
+            }
+            case EDIT_NEW_LEGACY: {
+                final Uri legacyContentUri = Uri.parse("content://contacts/people");
+                startActivity(new Intent(Intent.ACTION_INSERT, legacyContentUri));
+                break;
+            }
+            case VIEW_CONTACT: {
+                final long contactId = findArbitraryContactWithPhoneNumber();
+                final Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+                final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+                startActivity(intent);
+                break;
+            }
+            case VIEW_CONTACT_LOOKUP: {
+                final long contactId = findArbitraryContactWithPhoneNumber();
+                final Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+                final Uri lookupUri = Contacts.getLookupUri(getContentResolver(), uri);
+                final String lookupKey = lookupUri.getPathSegments().get(2);
+                final Uri lookupWithoutIdUri = Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI,
+                        lookupKey);
+                final Intent intent = new Intent(Intent.ACTION_VIEW, lookupWithoutIdUri);
+                startActivity(intent);
+                break;
+            }
+            case VIEW_CONTACT_LOOKUP_ID: {
+                final long contactId = findArbitraryContactWithPhoneNumber();
+                final Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
+                final Uri lookupUri = Contacts.getLookupUri(getContentResolver(), uri);
+                final Intent intent = new Intent(Intent.ACTION_VIEW, lookupUri);
+                startActivity(intent);
+                break;
+            }
+            case VIEW_RAW_CONTACT: {
+                final long contactId = findArbitraryContactWithPhoneNumber();
+                final long rawContactId = findArbitraryRawContactOfContact(contactId);
+                final Uri uri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
+                final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+                startActivity(intent);
+                break;
+            }
+            case VIEW_LEGACY: {
+                final Uri legacyContentUri = Uri.parse("content://contacts/people");
+                final long contactId = findArbitraryContactWithPhoneNumber();
+                final long rawContactId = findArbitraryRawContactOfContact(contactId);
+                final Uri uri = ContentUris.withAppendedId(legacyContentUri, rawContactId);
+                final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+                startActivity(intent);
+                break;
+            }
+            default: {
+                Toast.makeText(this, "Sorry, we forgot to write this...", Toast.LENGTH_LONG).show();
+            }
+        }
+    }
+
+    private Intent buildFilterIntent(int actionCode, boolean legacy) {
+        Intent intent = new Intent(UI.FILTER_CONTACTS_ACTION);
+        intent.putExtra(UI.FILTER_TEXT_EXTRA_KEY, "A");
+        ContactsRequest request = new ContactsRequest();
+        request.setActionCode(actionCode);
+        intent.putExtra(ContactsSearchManager.ORIGINAL_REQUEST_KEY, request);
+        return intent;
+    }
+
+    private void startContactListActivity(Intent intent) {
+        intent.setComponent(
+                new ComponentName(ANDROID_CONTACTS_PACKAGE, CONTACT_LIST_ACTIVITY_CLASS_NAME));
+        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        startActivity(intent);
+    }
+
+    private void startContactSelectionActivityForResult(Intent intent) {
+        startActivityForResult(intent, 12);
+    }
+
+    private void startSearchResultActivity(Intent intent) {
+        intent.setComponent(
+                new ComponentName(ANDROID_CONTACTS_PACKAGE, SEARCH_RESULTS_ACTIVITY_CLASS_NAME));
+        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        startActivity(intent);
+    }
+
+    private void startMultiplePhoneSelectionActivityForResult(Intent intent) {
+        intent.setComponent(
+                new ComponentName(ANDROID_CONTACTS_PACKAGE,
+                        MULTIPLE_PHONE_PICKER_ACTIVITY_CLASS_NAME));
+        startActivityForResult(intent, 13);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        Intent intent = new Intent(this, ResultActivity.class);
+        intent.putExtra("resultCode", resultCode);
+        intent.putExtra("data", data);
+        startActivity(intent);
+    }
+
+    private long findArbitraryContactWithPhoneNumber() {
+        final Cursor cursor = getContentResolver().query(Contacts.CONTENT_URI,
+                new String[] { Contacts._ID },
+                Contacts.HAS_PHONE_NUMBER + "!=0 AND " + Contacts.STARRED + "!=0" ,
+                null, "RANDOM() LIMIT 1");
+        try {
+            if (cursor.moveToFirst()) {
+                return cursor.getLong(0);
+            }
+        } finally {
+            cursor.close();
+        }
+
+        return -1;
+    }
+
+    private long findArbitraryRawContactOfContact(long contactId) {
+        final Cursor cursor = getContentResolver().query(RawContacts.CONTENT_URI,
+                new String[] { RawContacts._ID },
+                RawContacts.CONTACT_ID + "=?",
+                new String[] { String.valueOf(contactId) },
+                RawContacts._ID + " LIMIT 1");
+        try {
+            if (cursor.moveToFirst()) {
+                return cursor.getLong(0);
+            }
+        } finally {
+            cursor.close();
+        }
+
+        return -1;
+    }
+
+    @Override
+    public void onAccountChosen(Account account, int tag) {
+        switch (tag) {
+            case EDIT_NEW_CONTACT_FOR_ACCOUNT: {
+                final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+                intent.putExtra(Insert.ACCOUNT, account);
+                startActivity(intent);
+                break;
+            }
+            case EDIT_NEW_CONTACT_FOR_ACCOUNT_WITH_DATA: {
+                final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+
+                intent.putExtra(Insert.ACCOUNT, account);
+                ContentValues row1 = new ContentValues();
+                row1.put(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE);
+                row1.put(Organization.COMPANY, "Android");
+
+                ContentValues row2 = new ContentValues();
+                row2.put(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE);
+                row2.put(Email.TYPE, Email.TYPE_CUSTOM);
+                row2.put(Email.LABEL, "Green Bot");
+                row2.put(Email.ADDRESS, "android@android.com");
+
+                intent.putParcelableArrayListExtra(Insert.DATA, Lists.newArrayList(row1, row2));
+
+                startActivity(intent);
+                break;
+            }
+        }
+    }
+}
diff --git a/tests/src/com/android/contacts/tests/allintents/ResultActivity.java b/tests/src/com/android/contacts/tests/allintents/ResultActivity.java
new file mode 100644
index 0000000..562f2ba
--- /dev/null
+++ b/tests/src/com/android/contacts/tests/allintents/ResultActivity.java
@@ -0,0 +1,196 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.tests.allintents;
+
+import com.android.contacts.tests.R;
+
+import android.app.Activity;
+import android.content.ContentUris;
+import android.content.Intent;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TableLayout;
+import android.widget.TableRow;
+import android.widget.TextView;
+import android.widget.ImageView.ScaleType;
+
+import java.util.Arrays;
+
+/**
+ * An activity that shows the result of a contacts activity invocation.
+ */
+public class ResultActivity extends Activity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.result);
+
+        Intent intent = getIntent();
+        addRowsForIntent((Intent)intent.getExtras().get("data"));
+    }
+
+    private void addRowsForIntent(Intent intent) {
+        if (intent == null) {
+            addRow("", "No data intent returned");
+        } else {
+            addRow("INTENT", intent.toString());
+            addSeparator(3);
+
+            Bundle extras = intent.getExtras();
+            if (extras != null && !extras.isEmpty()) {
+                for (String key : extras.keySet()) {
+                    Object value = extras.get(key);
+                    addRow("EXTRA", key);
+                    addRowForValue("", value);
+                }
+
+                addSeparator(3);
+            }
+
+            String dataUri = intent.getDataString();
+            if (dataUri != null) {
+                addRowsForQuery(Uri.parse(dataUri));
+            }
+        }
+    }
+
+    private void addRowForValue(String label, Object value) {
+        if (value == null) {
+            addRow(label, "null");
+        } else if (value instanceof Bitmap) {
+            addRowWithBitmap(label, (Bitmap)value);
+        } else if (value instanceof Intent) {
+            addRow(label, "INTENT");
+            addRowsForIntent((Intent)value);
+        } else if (value instanceof Uri) {
+            addRow(label, "DATA");
+            addRowsForQuery((Uri)value);
+        } else if (value.getClass().isArray()) {
+            addRow(label, "ARRAY");
+            Parcelable[] array = (Parcelable[])value;
+            for (int i = 0; i < array.length; i++) {
+                addRowForValue("[" + i + "]", String.valueOf(array[i]));
+            }
+        } else {
+            addRow(label, String.valueOf(value));
+        }
+    }
+
+    private void addRowsForQuery(Uri dataUri) {
+        Cursor cursor = getContentResolver().query(dataUri, null, null, null, null);
+        if (cursor == null) {
+            addRow("", "No data for this URI");
+        } else {
+            try {
+                while (cursor.moveToNext()) {
+                    addRow("", "DATA");
+                    String[] columnNames = cursor.getColumnNames();
+                    String[] names = new String[columnNames.length];
+                    System.arraycopy(columnNames, 0, names, 0, columnNames.length);
+                    Arrays.sort(names);
+                    for (int i = 0; i < names.length; i++) {
+                        int index = cursor.getColumnIndex(names[i]);
+                        String value = cursor.getString(index);
+                        addRow(names[i], value);
+
+                        if (names[i].equals(Contacts.PHOTO_ID) && !TextUtils.isEmpty(value)) {
+                            addRowWithPhoto(Long.parseLong(value));
+                        }
+                    }
+                }
+            } finally {
+                cursor.close();
+            }
+        }
+    }
+
+    private void addRow(String column0, String column1) {
+        TextView label = new TextView(this);
+        label.setPadding(4, 4, 4, 4);
+        label.setText(column0);
+        TextView value = new TextView(this);
+        value.setPadding(4, 4, 4, 4);
+        value.setText(column1);
+        addRow(label, value);
+    }
+
+    private void addRowWithPhoto(long photoId) {
+        byte[] data = null;
+        Cursor cursor = getContentResolver().query(
+                ContentUris.withAppendedId(Data.CONTENT_URI, photoId),
+                new String[]{Photo.PHOTO}, null, null, null);
+        try {
+            if (cursor.moveToNext()) {
+                data = cursor.getBlob(0);
+            }
+        } finally {
+            if (cursor != null) {
+                cursor.close();
+            }
+        }
+
+        if (data == null) {
+            return;
+        }
+
+        addRowWithBitmap("Photo", BitmapFactory.decodeByteArray(data, 0, data.length));
+    }
+
+    private void addRowWithBitmap(String label, Bitmap bitmap) {
+        TextView labelView = new TextView(this);
+        labelView.setPadding(4, 4, 4, 4);
+        labelView.setText(label);
+
+        ImageView imageView = new ImageView(this);
+        imageView.setImageBitmap(bitmap);
+        imageView.setPadding(4, 4, 4, 4);
+        imageView.setScaleType(ScaleType.FIT_START);
+        addRow(labelView, imageView);
+    }
+
+    private void addRow(View column0, View column1) {
+        TableLayout table = (TableLayout)findViewById(R.id.table);
+        TableRow row = new TableRow(this);
+        row.addView(column0);
+        row.addView(column1);
+        table.addView(row);
+
+        addSeparator(1);
+    }
+
+    private void addSeparator(int height) {
+        TableLayout table = (TableLayout)findViewById(R.id.table);
+        View separator = new View(this);
+        TableLayout.LayoutParams params = new TableLayout.LayoutParams();
+        params.height = height;
+        separator.setLayoutParams(params);
+        separator.setBackgroundColor(Color.rgb(33, 66, 33));
+        table.addView(separator);
+    }
+}
diff --git a/tests/src/com/android/contacts/tests/allintents/SelectAccountDialogFragment.java b/tests/src/com/android/contacts/tests/allintents/SelectAccountDialogFragment.java
new file mode 100644
index 0000000..e074a0b
--- /dev/null
+++ b/tests/src/com/android/contacts/tests/allintents/SelectAccountDialogFragment.java
@@ -0,0 +1,97 @@
+/*
+ * 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
+ */
+
+package com.android.contacts.tests.allintents;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+
+/**
+ * Shows a dialog asking the user which account to chose.
+ * The result is passed back to the owning Activity
+ * Does not perform any action by itself.
+ */
+public class SelectAccountDialogFragment extends DialogFragment {
+    public static final String TAG = "SelectAccountDialogFragment";
+
+    private static final String EXTRA_TAG = "tag";
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        final Bundle parameters = getArguments();
+
+        final Account[] accounts = AccountManager.get(getActivity()).getAccounts();
+
+        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+        final LayoutInflater inflater = LayoutInflater.from(builder.getContext());
+
+        final ArrayAdapter<Account> accountAdapter = new ArrayAdapter<Account>(builder.getContext(),
+                android.R.layout.simple_list_item_2, accounts) {
+            @Override
+            public View getView(int position, View convertView, ViewGroup parent) {
+                final View resultView = convertView == null
+                        ? inflater.inflate(android.R.layout.simple_list_item_2, parent, false)
+                        : convertView;
+
+                final TextView text1 = (TextView)resultView.findViewById(android.R.id.text1);
+                final TextView text2 = (TextView)resultView.findViewById(android.R.id.text2);
+
+                final Account account = getItem(position);
+
+                text1.setText("Name: " + account.name);
+                text2.setText("Type: " + account.type);
+
+                return resultView;
+            }
+        };
+
+        final DialogInterface.OnClickListener clickListener =
+                new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                dialog.dismiss();
+
+                ((Listener) getActivity()).onAccountChosen(accountAdapter.getItem(which),
+                        parameters.getInt(EXTRA_TAG));
+            }
+        };
+
+        builder.setTitle("Choose account to send to editor");
+        builder.setSingleChoiceItems(accountAdapter, 0, clickListener);
+        final AlertDialog result = builder.create();
+        return result;
+    }
+
+    public static Bundle createBundle(int tag) {
+        final Bundle result = new Bundle();
+        result.putInt(EXTRA_TAG, tag);
+        return result;
+    }
+
+    public interface Listener {
+        void onAccountChosen(Account account, int tag);
+    }
+}
diff --git a/tests/src/com/android/contacts/tests/mocks/ContactsMockContext.java b/tests/src/com/android/contacts/tests/mocks/ContactsMockContext.java
new file mode 100644
index 0000000..4697b83
--- /dev/null
+++ b/tests/src/com/android/contacts/tests/mocks/ContactsMockContext.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.tests.mocks;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.ContextWrapper;
+import android.provider.ContactsContract;
+import android.provider.Settings;
+import android.test.mock.MockContentResolver;
+
+/**
+ * A mock context for contact activity unit tests. Forwards everything to
+ * a supplied context, except content resolver operations, which are sent
+ * to mock content providers.
+ */
+public class ContactsMockContext extends ContextWrapper {
+
+    private MockContentResolver mContentResolver;
+    private MockContentProvider mContactsProvider;
+    private MockContentProvider mSettingsProvider;
+
+    public ContactsMockContext(Context base) {
+        super(base);
+        mContentResolver = new MockContentResolver();
+        mContactsProvider = new MockContentProvider();
+        mContentResolver.addProvider(ContactsContract.AUTHORITY, mContactsProvider);
+        mSettingsProvider = new MockContentProvider();
+        mContentResolver.addProvider(Settings.AUTHORITY, mSettingsProvider);
+    }
+
+    @Override
+    public ContentResolver getContentResolver() {
+        return mContentResolver;
+    }
+
+    public MockContentProvider getContactsProvider() {
+        return mContactsProvider;
+    }
+
+    public MockContentProvider getSettingsProvider() {
+        return mSettingsProvider;
+    }
+
+    @Override
+    public Context getApplicationContext() {
+        return this;
+    }
+}
diff --git a/tests/src/com/android/contacts/tests/mocks/MockContentProvider.java b/tests/src/com/android/contacts/tests/mocks/MockContentProvider.java
new file mode 100644
index 0000000..14d563c
--- /dev/null
+++ b/tests/src/com/android/contacts/tests/mocks/MockContentProvider.java
@@ -0,0 +1,259 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.tests.mocks;
+
+import android.content.ContentProvider;
+import android.content.ContentValues;
+import android.database.Cursor;
+import android.database.MatrixCursor;
+import android.net.Uri;
+import android.text.TextUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+
+import junit.framework.Assert;
+
+/**
+ * A programmable mock content provider.
+ */
+public class MockContentProvider extends ContentProvider {
+    private static final String TAG = "MockContentProvider";
+
+    public static class Query {
+
+        private final Uri mUri;
+        private String[] mProjection;
+        private String[] mDefaultProjection;
+        private String mSelection;
+        private String[] mSelectionArgs;
+        private String mSortOrder;
+        private ArrayList<Object[]> mRows = new ArrayList<Object[]>();
+
+        public Query(Uri uri) {
+            mUri = uri;
+        }
+
+        @Override
+        public String toString() {
+            return queryToString(mUri, mProjection, mSelection, mSelectionArgs, mSortOrder);
+        }
+
+        public Query withProjection(String... projection) {
+            mProjection = projection;
+            return this;
+        }
+
+        public Query withDefaultProjection(String... projection) {
+            mDefaultProjection = projection;
+            return this;
+        }
+
+        public Query withSelection(String selection, String... selectionArgs) {
+            mSelection = selection;
+            mSelectionArgs = selectionArgs;
+            return this;
+        }
+
+        public Query withSortOrder(String sortOrder) {
+            mSortOrder = sortOrder;
+            return this;
+        }
+
+        public Query returnRow(Object... row) {
+            mRows.add(row);
+            return this;
+        }
+
+        public boolean equals(Uri uri, String[] projection, String selection,
+                String[] selectionArgs, String sortOrder) {
+            if (!uri.equals(mUri)) {
+                return false;
+            }
+
+            if (!equals(projection, mProjection)) {
+                return false;
+            }
+
+            if (!TextUtils.equals(selection, mSelection)) {
+                return false;
+            }
+
+            if (!equals(selectionArgs, mSelectionArgs)) {
+                return false;
+            }
+
+            if (!TextUtils.equals(sortOrder, mSortOrder)) {
+                return false;
+            }
+
+            return true;
+        }
+
+        private static boolean equals(String[] array1, String[] array2) {
+            boolean empty1 = array1 == null || array1.length == 0;
+            boolean empty2 = array2 == null || array2.length == 0;
+            if (empty1 && empty2) {
+                return true;
+            }
+            if (empty1 != empty2 && (empty1 || empty2)) {
+                return false;
+            }
+
+            if (array1.length != array2.length) return false;
+
+            for (int i = 0; i < array1.length; i++) {
+                if (!array1[i].equals(array2[i])) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        public Cursor getResult() {
+            String[] columnNames = mProjection != null ? mProjection : mDefaultProjection;
+            MatrixCursor cursor = new MatrixCursor(columnNames);
+            for (Object[] row : mRows) {
+                cursor.addRow(row);
+            }
+            return cursor;
+        }
+    }
+
+    public static class TypeQuery {
+        private final Uri mUri;
+        private final String mType;
+
+        public TypeQuery(Uri uri, String type) {
+            mUri = uri;
+            mType = type;
+        }
+
+        public Uri getUri() {
+            return mUri;
+        }
+
+        public String getType() {
+            return mType;
+        }
+
+        @Override
+        public String toString() {
+            return mUri + " --> " + mType;
+        }
+
+        public boolean equals(Uri uri) {
+            return getUri().equals(uri);
+        }
+    }
+
+    private LinkedList<Query> mExpectedQueries = new LinkedList<Query>();
+    private LinkedList<TypeQuery> mExpectedTypeQueries = new LinkedList<TypeQuery>();
+
+    @Override
+    public boolean onCreate() {
+        return true;
+    }
+
+    public Query expectQuery(Uri contentUri) {
+        Query query = new Query(contentUri);
+        mExpectedQueries.offer(query);
+        return query;
+    }
+
+    public void expectTypeQuery(Uri uri, String type) {
+        TypeQuery result = new TypeQuery(uri, type);
+        mExpectedTypeQueries.offer(result);
+    }
+
+    @Override
+    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
+            String sortOrder) {
+        if (mExpectedQueries.isEmpty()) {
+            Assert.fail("Unexpected query: "
+                    + queryToString(uri, projection, selection, selectionArgs, sortOrder));
+        }
+
+        Query query = mExpectedQueries.remove();
+        if (!query.equals(uri, projection, selection, selectionArgs, sortOrder)) {
+            Assert.fail("Incorrect query.\n    Expected: " + query + "\n      Actual: " +
+                    queryToString(uri, projection, selection, selectionArgs, sortOrder));
+        }
+
+        return query.getResult();
+    }
+
+    @Override
+    public int delete(Uri uri, String selection, String[] selectionArgs) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public String getType(Uri uri) {
+        if (mExpectedTypeQueries.isEmpty()) {
+            Assert.fail("Unexpected getType query: " + uri);
+        }
+
+        TypeQuery query = mExpectedTypeQueries.remove();
+        if (!query.equals(uri)) {
+            Assert.fail("Incorrect query.\n    Expected: " + query + "\n      Actual: " + uri);
+        }
+
+        return query.getType();
+    }
+
+    @Override
+    public Uri insert(Uri uri, ContentValues values) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+        throw new UnsupportedOperationException();
+    }
+
+    private static String queryToString(Uri uri, String[] projection, String selection,
+            String[] selectionArgs, String sortOrder) {
+        StringBuilder sb = new StringBuilder();
+        sb.append(uri).append(" ");
+        if (projection != null) {
+            sb.append(Arrays.toString(projection));
+        } else {
+            sb.append("[]");
+        }
+        if (selection != null) {
+            sb.append(" selection: '").append(selection).append("'");
+            if (selectionArgs != null) {
+                sb.append(Arrays.toString(selectionArgs));
+            } else {
+                sb.append("[]");
+            }
+        }
+        if (sortOrder != null) {
+            sb.append(" sort: '").append(sortOrder).append("'");
+        }
+        return sb.toString();
+    }
+
+    public void verify() {
+        Assert.assertTrue("Not all expected queries have been called: " +
+                mExpectedQueries, mExpectedQueries.isEmpty());
+        Assert.assertTrue("Not all expected getType-queries have been called: " +
+                mExpectedQueries, mExpectedTypeQueries.isEmpty());
+    }
+}
diff --git a/tests/src/com/android/contacts/tests/mocks/MockSources.java b/tests/src/com/android/contacts/tests/mocks/MockSources.java
new file mode 100644
index 0000000..4c3007a
--- /dev/null
+++ b/tests/src/com/android/contacts/tests/mocks/MockSources.java
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+package com.android.contacts.tests.mocks;
+
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.FallbackAccountType;
+import com.android.contacts.model.AccountTypes;
+
+/**
+ * A mock {@link AccountTypes} class.
+ */
+public class MockSources extends AccountTypes {
+
+    public static final String WRITABLE_ACCOUNT_TYPE = "writable";
+    public static final String READONLY_ACCOUNT_TYPE = "readonly";
+
+    @Override
+    public BaseAccountType getInflatedSource(String accountType, int inflateLevel) {
+        if (accountType.equals(WRITABLE_ACCOUNT_TYPE)) {
+            BaseAccountType source = new FallbackAccountType();
+            source.readOnly = false;
+            return source;
+        }
+
+        if (accountType.equals(READONLY_ACCOUNT_TYPE)) {
+            BaseAccountType source = new FallbackAccountType();
+            source.readOnly = true;
+            return source;
+        }
+
+        return null;
+    }
+}
diff --git a/tests/src/com/android/contacts/tests/widget/PinnedHeaderUseCaseActivity.java b/tests/src/com/android/contacts/tests/widget/PinnedHeaderUseCaseActivity.java
new file mode 100644
index 0000000..b01963f
--- /dev/null
+++ b/tests/src/com/android/contacts/tests/widget/PinnedHeaderUseCaseActivity.java
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.tests.widget;
+
+import com.android.contacts.tests.R;
+import com.android.contacts.widget.PinnedHeaderListView;
+
+import android.app.ListActivity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+/**
+ * An activity that demonstrates various use cases for the {@link PinnedHeaderListView}.
+ */
+public class PinnedHeaderUseCaseActivity extends ListActivity {
+
+    private static final int SINGLE_SHORT_SECTION_NO_HEADERS = 0;
+    private static final int TWO_SHORT_SECTIONS_WITH_HEADERS = 1;
+    private static final int FIVE_SHORT_SECTIONS_WITH_HEADERS = 2;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setListAdapter(new ArrayAdapter<String>(this, R.layout.intent_list_item,
+                getResources().getStringArray(R.array.pinnedHeaderUseCases)));
+    }
+
+    @Override
+    protected void onListItemClick(ListView l, View v, int position, long id) {
+        switch (position) {
+            case SINGLE_SHORT_SECTION_NO_HEADERS:
+                startActivity(
+                        new int[]{5},
+                        new String[]{"Line"},
+                        new boolean[]{false},
+                        new boolean[]{false},
+                        new int[]{0});
+                break;
+            case TWO_SHORT_SECTIONS_WITH_HEADERS:
+                startActivity(
+                        new int[]{2, 30},
+                        new String[]{"First", "Second"},
+                        new boolean[]{true, true},
+                        new boolean[]{false, false},
+                        new int[]{0, 2000});
+                break;
+            case FIVE_SHORT_SECTIONS_WITH_HEADERS:
+                startActivity(
+                        new int[]{1, 5, 5, 5, 5},
+                        new String[]{"First", "Second", "Third", "Fourth", "Fifth"},
+                        new boolean[]{true, true, true, true, true},
+                        new boolean[]{false, false, false, false, false},
+                        new int[]{0, 2000, 3000, 4000, 5000});
+                break;
+        }
+    }
+
+    private void startActivity(int[] counts, String[] names, boolean[] headers,
+            boolean[] showIfEmpty, int[] delays) {
+        Intent intent = new Intent();
+        intent.setComponent(new ComponentName("com.android.contacts",
+                "com.android.contacts.widget.PinnedHeaderListDemoActivity"));
+        intent.putExtra("counts", counts);
+        intent.putExtra("names", names);
+        intent.putExtra("headers", headers);
+        intent.putExtra("showIfEmpty", showIfEmpty);
+        intent.putExtra("delays", delays);
+
+        startActivity(intent);
+    }
+}
diff --git a/tests/src/com/android/contacts/vcard/ImportProcessorTest.java b/tests/src/com/android/contacts/vcard/ImportProcessorTest.java
new file mode 100644
index 0000000..72245ba
--- /dev/null
+++ b/tests/src/com/android/contacts/vcard/ImportProcessorTest.java
@@ -0,0 +1,180 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.net.Uri;
+import android.test.AndroidTestCase;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.android.contacts.vcard.ImportProcessor.CommitterGenerator;
+import com.android.vcard.VCardEntryCommitter;
+import com.android.vcard.VCardInterpreter;
+import com.android.vcard.VCardSourceDetector;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+import java.util.List;
+
+public class ImportProcessorTest extends AndroidTestCase {
+    private static final String LOG_TAG = "ImportProcessorTest";
+    private ImportProcessor mImportProcessor;
+
+    private String mCopiedFileName;
+
+    // XXX: better way to copy stream?
+    private Uri copyToLocal(final String fileName) throws IOException {
+        final Context context = getContext();
+        // We need to use Context of this unit test runner (not of test to be tested),
+        // as only the former knows assets to be copied.
+        final Context testContext = getTestContext();
+        final ContentResolver resolver = testContext.getContentResolver();
+        mCopiedFileName = fileName;
+        ReadableByteChannel inputChannel = null;
+        WritableByteChannel outputChannel = null;
+        Uri destUri;
+        try {
+            inputChannel = Channels.newChannel(testContext.getAssets().open(fileName));
+            destUri = Uri.parse(context.getFileStreamPath(fileName).toURI().toString());
+            outputChannel =
+                    getContext().openFileOutput(fileName,
+                            Context.MODE_WORLD_WRITEABLE).getChannel();
+            final ByteBuffer buffer = ByteBuffer.allocateDirect(8192);
+            while (inputChannel.read(buffer) != -1) {
+                buffer.flip();
+                outputChannel.write(buffer);
+                buffer.compact();
+            }
+            buffer.flip();
+            while (buffer.hasRemaining()) {
+                outputChannel.write(buffer);
+            }
+        } finally {
+            if (inputChannel != null) {
+                try {
+                    inputChannel.close();
+                } catch (IOException e) {
+                    Log.w(LOG_TAG, "Failed to close inputChannel.");
+                }
+            }
+            if (outputChannel != null) {
+                try {
+                    outputChannel.close();
+                } catch(IOException e) {
+                    Log.w(LOG_TAG, "Failed to close outputChannel");
+                }
+            }
+        }
+        return destUri;
+    }
+
+    @Override
+    public void setUp() {
+        mImportProcessor = new ImportProcessor(getContext());
+        mImportProcessor.ensureInit();
+        mCopiedFileName = null;
+    }
+
+    @Override
+    public void tearDown() {
+        if (!TextUtils.isEmpty(mCopiedFileName)) {
+            getContext().deleteFile(mCopiedFileName);
+            mCopiedFileName = null;
+        }
+    }
+
+    /**
+     * Confirms {@link ImportProcessor#readOneVCard(android.net.Uri, int, String,
+     * com.android.vcard.VCardInterpreter, int[])} successfully handles correct input.
+     */
+    public void testProcessSimple() throws IOException {
+        final Uri uri = copyToLocal("v21_simple.vcf");
+        final int vcardType = VCardSourceDetector.PARSE_TYPE_UNKNOWN;
+        final String charset = null;
+        final VCardInterpreter interpreter = new EmptyVCardInterpreter();
+        final int[] versions = new int[] {
+                ImportVCardActivity.VCARD_VERSION_V21
+        };
+
+        assertTrue(mImportProcessor.readOneVCard(
+                uri, vcardType, charset, interpreter, versions));
+    }
+
+    /**
+     * Confirms {@link ImportProcessor#handleOneRequest(ImportRequest)} accepts
+     * one request and import it.
+     */
+    public void testHandleOneRequestSimple() throws IOException {
+        CommitterGenerator generator = new CommitterGenerator() {
+            public VCardEntryCommitter generate(ContentResolver resolver) {
+                return new MockVCardEntryCommitter();
+            }
+        };
+        mImportProcessor.injectCommitterGeneratorForTest(generator);
+        mImportProcessor.initNotifierForTest();
+
+        final ImportRequest request = new ImportRequest(
+                null,  // account
+                copyToLocal("v30_simple.vcf"),
+                VCardSourceDetector.PARSE_TYPE_UNKNOWN,
+                null,  // estimatedCharset
+                ImportVCardActivity.VCARD_VERSION_AUTO_DETECT,
+                1);
+        assertTrue(mImportProcessor.handleOneRequest(request));
+        assertEquals(1, mImportProcessor.getCreatedUrisForTest().size());
+    }
+}
+
+/* package */ class EmptyVCardInterpreter implements VCardInterpreter {
+    @Override
+    public void end() {
+    }
+    @Override
+    public void endEntry() {
+    }
+    @Override
+    public void endProperty() {
+    }
+    @Override
+    public void propertyGroup(String group) {
+    }
+    @Override
+    public void propertyName(String name) {
+    }
+    @Override
+    public void propertyParamType(String type) {
+    }
+    @Override
+    public void propertyParamValue(String value) {
+    }
+    @Override
+    public void propertyValues(List<String> values) {
+    }
+    @Override
+    public void start() {
+    }
+    @Override
+    public void startEntry() {
+    }
+    @Override
+    public void startProperty() {
+    }
+}
diff --git a/tests/src/com/android/contacts/vcard/MockVCardEntryCommitter.java b/tests/src/com/android/contacts/vcard/MockVCardEntryCommitter.java
new file mode 100644
index 0000000..4765b38
--- /dev/null
+++ b/tests/src/com/android/contacts/vcard/MockVCardEntryCommitter.java
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+package com.android.contacts.vcard;
+
+import android.net.Uri;
+
+import com.android.vcard.VCardEntry;
+import com.android.vcard.VCardEntryCommitter;
+
+import java.util.ArrayList;
+
+public class MockVCardEntryCommitter extends VCardEntryCommitter {
+
+    private final ArrayList<Uri> mUris = new ArrayList<Uri>(); 
+
+    public MockVCardEntryCommitter() {
+        super(null);
+    }
+
+    /**
+     * Exists for forcing super class to do nothing.
+     */
+    @Override
+    public void onStart() {
+    }
+
+    /**
+     * Exists for forcing super class to do nothing.
+     */
+    @Override
+    public void onEnd() {
+    }
+
+    @Override
+    public void onEntryCreated(final VCardEntry vcardEntry) {
+        mUris.add(null);
+    }
+
+    @Override
+    public ArrayList<Uri> getCreatedUris() {
+        return mUris;
+    }
+}
\ No newline at end of file
diff --git a/tests/src/com/android/contacts/widget/CompositeListAdapterTest.java b/tests/src/com/android/contacts/widget/CompositeListAdapterTest.java
new file mode 100644
index 0000000..87d268b
--- /dev/null
+++ b/tests/src/com/android/contacts/widget/CompositeListAdapterTest.java
@@ -0,0 +1,324 @@
+/*
+ * 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.
+ */
+package com.android.contacts.widget;
+
+import com.google.android.collect.Lists;
+
+import android.content.Context;
+import android.database.DataSetObserver;
+import android.test.AndroidTestCase;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ * Tests for {@link CompositeListAdapter}.
+ */
+public class CompositeListAdapterTest extends AndroidTestCase {
+
+    private final class MockAdapter extends ArrayAdapter<String> {
+        boolean allItemsEnabled = true;
+        HashSet<Integer> enabledItems = new HashSet<Integer>();
+        int viewTypeCount = 1;
+        HashMap<Integer, Integer> viewTypes = new HashMap<Integer, Integer>();
+
+        private MockAdapter(Context context, List<String> objects) {
+            super(context, android.R.layout.simple_list_item_1, objects);
+            for (int i = 0; i < objects.size(); i++) {
+                viewTypes.put(i, 0);
+            }
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            return new MockView(getContext(), position);
+        }
+
+        @Override
+        public boolean areAllItemsEnabled() {
+            return allItemsEnabled;
+        }
+
+        @Override
+        public boolean isEnabled(int position) {
+            return enabledItems.contains(position);
+        }
+
+        @Override
+        public int getViewTypeCount() {
+            return viewTypeCount;
+        }
+
+        @Override
+        public int getItemViewType(int position) {
+            return viewTypes.get(position);
+        }
+    }
+
+    private final class MockView extends View {
+        public MockView(Context context, int position) {
+            super(context);
+            setTag(position);
+        }
+    }
+
+    private final class TestDataSetObserver extends DataSetObserver {
+
+        public int changeCount;
+        public int invalidationCount;
+
+        @Override
+        public void onChanged() {
+            changeCount++;
+        }
+
+        @Override
+        public void onInvalidated() {
+            invalidationCount++;
+        }
+    }
+
+    private MockAdapter mAdapter1;
+    private MockAdapter mAdapter2;
+    private MockAdapter mAdapter3;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mAdapter1 = new MockAdapter(getContext(), Lists.newArrayList("A", "B"));
+        mAdapter2 = new MockAdapter(getContext(), new ArrayList<String>());
+        mAdapter3 = new MockAdapter(getContext(), Lists.newArrayList("C", "D", "E"));
+    }
+
+    public void testGetCount() {
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        adapter.addAdapter(mAdapter2);
+        adapter.addAdapter(mAdapter3);
+
+        assertEquals(5, adapter.getCount());
+    }
+
+    public void testGetCountWithInvalidation() {
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        assertEquals(0, adapter.getCount());
+
+        adapter.addAdapter(mAdapter1);
+        assertEquals(2, adapter.getCount());
+
+        adapter.addAdapter(mAdapter2);
+        assertEquals(2, adapter.getCount());
+
+        adapter.addAdapter(mAdapter3);
+        assertEquals(5, adapter.getCount());
+    }
+
+    public void testGetItem() {
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        adapter.addAdapter(mAdapter2);
+        adapter.addAdapter(mAdapter3);
+
+        assertEquals("A", adapter.getItem(0));
+        assertEquals("B", adapter.getItem(1));
+        assertEquals("C", adapter.getItem(2));
+        assertEquals("D", adapter.getItem(3));
+        assertEquals("E", adapter.getItem(4));
+    }
+
+    public void testGetItemId() {
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        adapter.addAdapter(mAdapter2);
+        adapter.addAdapter(mAdapter3);
+
+        assertEquals(0, adapter.getItemId(0));
+        assertEquals(1, adapter.getItemId(1));
+        assertEquals(0, adapter.getItemId(2));
+        assertEquals(1, adapter.getItemId(3));
+        assertEquals(2, adapter.getItemId(4));
+    }
+
+    public void testGetView() {
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        adapter.addAdapter(mAdapter2);
+        adapter.addAdapter(mAdapter3);
+
+        assertEquals(0, adapter.getView(0, null, null).getTag());
+        assertEquals(1, adapter.getView(1, null, null).getTag());
+        assertEquals(0, adapter.getView(2, null, null).getTag());
+        assertEquals(1, adapter.getView(3, null, null).getTag());
+        assertEquals(2, adapter.getView(4, null, null).getTag());
+    }
+
+    public void testGetViewTypeCount() {
+        mAdapter1.viewTypeCount = 2;
+        mAdapter2.viewTypeCount = 3;
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        adapter.addAdapter(mAdapter2);
+        adapter.addAdapter(mAdapter3);
+
+        // Note that mAdapter2 adds an implicit +1
+        assertEquals(6, adapter.getViewTypeCount());
+    }
+
+    public void testGetItemViewType() {
+        mAdapter1.viewTypeCount = 2;
+        mAdapter1.viewTypes.put(0, 1);
+        mAdapter1.viewTypes.put(1, 0);
+
+        mAdapter3.viewTypeCount = 3;
+        mAdapter3.viewTypes.put(0, 1);
+        mAdapter3.viewTypes.put(1, 2);
+        mAdapter3.viewTypes.put(2, 0);
+
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        adapter.addAdapter(mAdapter2);
+        adapter.addAdapter(mAdapter3);
+
+        assertEquals(1, adapter.getItemViewType(0));
+        assertEquals(0, adapter.getItemViewType(1));
+
+        // Note: mAdapter2 throws in a +1
+
+        assertEquals(4, adapter.getItemViewType(2));
+        assertEquals(5, adapter.getItemViewType(3));
+        assertEquals(3, adapter.getItemViewType(4));
+    }
+
+    public void testNotifyDataSetChangedPropagated() {
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        adapter.addAdapter(mAdapter2);
+
+        TestDataSetObserver observer = new TestDataSetObserver();
+        adapter.registerDataSetObserver(observer);
+        mAdapter1.add("X");
+
+        assertEquals(1, observer.changeCount);
+        assertEquals(0, observer.invalidationCount);
+        assertEquals(3, adapter.getCount());
+        assertEquals("A", adapter.getItem(0));
+        assertEquals("B", adapter.getItem(1));
+        assertEquals("X", adapter.getItem(2));
+
+        mAdapter2.add("Y");
+        assertEquals(2, observer.changeCount);
+        assertEquals(0, observer.invalidationCount);
+        assertEquals(4, adapter.getCount());
+        assertEquals("A", adapter.getItem(0));
+        assertEquals("B", adapter.getItem(1));
+        assertEquals("X", adapter.getItem(2));
+        assertEquals("Y", adapter.getItem(3));
+
+    }
+
+    public void testNotifyDataSetChangedOnAddingAdapter() {
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+
+        TestDataSetObserver observer = new TestDataSetObserver();
+        adapter.registerDataSetObserver(observer);
+        adapter.addAdapter(mAdapter3);
+
+        assertEquals(1, observer.changeCount);
+        assertEquals(0, observer.invalidationCount);
+        assertEquals(5, adapter.getCount());
+        assertEquals("A", adapter.getItem(0));
+        assertEquals("B", adapter.getItem(1));
+        assertEquals("C", adapter.getItem(2));
+        assertEquals("D", adapter.getItem(3));
+        assertEquals("E", adapter.getItem(4));
+    }
+
+    public void testNotifyDataSetInvalidated() {
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+
+        TestDataSetObserver observer = new TestDataSetObserver();
+        adapter.registerDataSetObserver(observer);
+
+        mAdapter1.remove("A");
+        assertEquals(1, observer.changeCount);
+        assertEquals(0, observer.invalidationCount);
+        assertEquals(1, adapter.getCount());
+
+        mAdapter1.remove("B");
+        assertEquals(1, observer.changeCount);
+        assertEquals(1, observer.invalidationCount);
+        assertEquals(0, adapter.getCount());
+    }
+
+    public void testAreAllItemsEnabled() {
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        adapter.addAdapter(mAdapter3);
+
+        assertTrue(adapter.areAllItemsEnabled());
+    }
+
+    public void testAreAllItemsEnabledWithInvalidation() {
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        assertTrue(adapter.areAllItemsEnabled());
+
+        mAdapter3.allItemsEnabled = false;
+        adapter.addAdapter(mAdapter3);
+
+        assertFalse(adapter.areAllItemsEnabled());
+    }
+
+    public void testIsEnabled() {
+        mAdapter1.allItemsEnabled = false;
+        mAdapter1.enabledItems.add(1);
+
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        adapter.addAdapter(mAdapter2);
+        adapter.addAdapter(mAdapter3);
+
+        assertFalse(adapter.isEnabled(0));
+        assertTrue(adapter.isEnabled(1));
+        assertTrue(adapter.isEnabled(2));
+        assertTrue(adapter.isEnabled(3));
+        assertTrue(adapter.isEnabled(4));
+    }
+
+    public void testIsEnabledWhenAllEnabledAtLeastOneAdapter() {
+        mAdapter1.allItemsEnabled = false;
+        mAdapter1.enabledItems.add(1);
+        mAdapter3.allItemsEnabled = false;
+        mAdapter3.enabledItems.add(1);
+
+        CompositeListAdapter adapter = new CompositeListAdapter();
+        adapter.addAdapter(mAdapter1);
+        adapter.addAdapter(mAdapter3);
+
+        assertFalse(adapter.isEnabled(0));
+        assertTrue(adapter.isEnabled(1));
+        assertFalse(adapter.isEnabled(2));
+        assertTrue(adapter.isEnabled(3));
+        assertFalse(adapter.isEnabled(4));
+    }
+}
diff --git a/tests/src/com/android/contacts/widget/TestLoaderManager.java b/tests/src/com/android/contacts/widget/TestLoaderManager.java
new file mode 100644
index 0000000..e964024
--- /dev/null
+++ b/tests/src/com/android/contacts/widget/TestLoaderManager.java
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+package com.android.contacts.widget;
+
+import android.app.LoaderManager;
+import android.content.AsyncTaskLoader;
+import android.content.Loader;
+import android.content.Loader.OnLoadCompleteListener;
+import android.os.Bundle;
+
+import java.util.LinkedHashMap;
+
+import junit.framework.Assert;
+
+/**
+ * A {@link LoaderManager} that performs synchronous loading on demand for unit
+ * testing.
+ */
+public class TestLoaderManager implements LoaderManager {
+
+    // Using a linked hash map to get all loading done in a predictable order.
+    private LinkedHashMap<Integer, Loader<?>> mStartedLoaders = new LinkedHashMap<
+            Integer, Loader<?>>();
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <D> Loader<D> getLoader(int id) {
+        return (Loader<D>)mStartedLoaders.get(id);
+    }
+
+    @Override
+    public <D> Loader<D> initLoader(int id, Bundle args, final LoaderCallbacks<D> callbacks) {
+        Loader<D> loader = callbacks.onCreateLoader(id, args);
+        loader.registerListener(id, new OnLoadCompleteListener<D>() {
+            @Override
+            public void onLoadComplete(Loader<D> loader, D data) {
+                callbacks.onLoadFinished(loader, data);
+            }
+        });
+
+        mStartedLoaders.put(id, loader);
+        return loader;
+    }
+
+    @Override
+    public <D> Loader<D> restartLoader(int id, Bundle args, LoaderCallbacks<D> callbacks) {
+        return initLoader(id, args, callbacks);
+    }
+
+    @Override
+    public void stopLoader(int id) {
+        mStartedLoaders.get(id).stopLoading();
+    }
+
+    /**
+     * Synchronously runs all started loaders.
+     */
+    public void executeLoaders() {
+        for (Loader<?> loader : mStartedLoaders.values()) {
+            executeLoader(loader);
+        }
+    }
+
+    /**
+     * Synchronously runs the specified loader.
+     */
+    public void executeLoader(int id) {
+        Loader<?> loader = mStartedLoaders.get(id);
+        if (loader == null) {
+            Assert.fail("Loader not started: " + id);
+        }
+        executeLoader(loader);
+    }
+
+    @SuppressWarnings("unchecked")
+    private <D> void executeLoader(final Loader<D> loader) {
+        if (loader instanceof AsyncTaskLoader) {
+            AsyncTaskLoader<D> atLoader = (AsyncTaskLoader<D>)loader;
+            D data = atLoader.loadInBackground();
+            loader.deliverResult(data);
+        } else {
+            loader.forceLoad();
+        }
+    }
+}