Merge "Fix blank screen on VIEW raw contact URIs or legacy URIs on phone"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 40d5c26..01a6f95 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -597,7 +597,7 @@
         <!-- vCard related -->
         <activity android:name=".vcard.ImportVCardActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
-            android:theme="@style/BackgroundOnly">
+            android:theme="@style/BackgroundOnlyTheme">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
                 <data android:mimeType="text/directory" />
@@ -610,7 +610,7 @@
 
         <activity android:name=".vcard.NfcImportVCardActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
-            android:theme="@style/BackgroundOnly">
+            android:theme="@style/BackgroundOnlyTheme">
             <intent-filter>
                 <action android:name="android.nfc.action.NDEF_DISCOVERED" />
                 <data android:mimeType="text/vcard" />
@@ -621,13 +621,13 @@
         </activity>
 
         <activity android:name=".vcard.CancelActivity"
-            android:theme="@style/BackgroundOnly" />
+            android:theme="@style/BackgroundOnlyTheme" />
 
         <activity android:name=".vcard.SelectAccountActivity"
-            android:theme="@style/BackgroundOnly" />
+            android:theme="@style/BackgroundOnlyTheme" />
 
         <activity android:name=".vcard.ExportVCardActivity"
-            android:theme="@style/BackgroundOnly" />
+            android:theme="@style/BackgroundOnlyTheme" />
 
         <service
             android:name=".vcard.VCardService"
diff --git a/res/layout-sw580dp/contact_detail_container.xml b/res/layout-sw580dp/contact_detail_container.xml
index 62c4081..58a6eb3 100644
--- a/res/layout-sw580dp/contact_detail_container.xml
+++ b/res/layout-sw580dp/contact_detail_container.xml
@@ -18,8 +18,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical"
-    android:background="@color/background_primary"
-    android:padding="16dip">
+    android:background="@color/background_primary">
 
     <android.support.v4.view.ViewPager
         android:id="@+id/pager"
diff --git a/res/layout-sw580dp/contact_detail_updates_fragment.xml b/res/layout-sw580dp/contact_detail_updates_fragment.xml
index 513254e..3bcb01c 100644
--- a/res/layout-sw580dp/contact_detail_updates_fragment.xml
+++ b/res/layout-sw580dp/contact_detail_updates_fragment.xml
@@ -25,8 +25,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:fadingEdge="none"
-        android:divider="@null"
-        android:paddingTop="32dip"/>
+        android:divider="@null"/>
 
     <View
         android:id="@+id/alpha_overlay"
diff --git a/res/layout/stream_item_container.xml b/res/layout/stream_item_container.xml
index 6a65357..308c5f5 100644
--- a/res/layout/stream_item_container.xml
+++ b/res/layout/stream_item_container.xml
@@ -25,17 +25,19 @@
         android:id="@+id/stream_item_content"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:paddingTop="@dimen/detail_update_section_item_vertical_padding"
-        android:paddingBottom="@dimen/detail_update_section_item_vertical_padding"
         android:paddingLeft="@dimen/detail_update_section_item_horizontal_padding"
         android:paddingRight="@dimen/detail_update_section_item_horizontal_padding"
+        android:paddingTop="@dimen/detail_update_section_item_vertical_padding"
+        android:paddingBottom="@dimen/detail_update_section_item_vertical_padding"
         android:background="?android:attr/selectableItemBackground"
+        android:layout_gravity="center_vertical"
         />
 
     <View
         android:id="@+id/horizontal_divider"
         android:layout_width="match_parent"
         android:layout_height="1px"
-        android:background="?android:attr/dividerHorizontal" />
+        android:background="?android:attr/dividerHorizontal"
+        android:layout_gravity="bottom" />
 
 </LinearLayout>
diff --git a/res/layout/stream_item_row_image_and_text.xml b/res/layout/stream_item_row_image_and_text.xml
index ea87ff0..3642592 100644
--- a/res/layout/stream_item_row_image_and_text.xml
+++ b/res/layout/stream_item_row_image_and_text.xml
@@ -16,9 +16,7 @@
 
 <TableRow
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
-    android:paddingBottom="@dimen/detail_update_section_between_items_vertical_padding"
-    android:paddingTop="@dimen/detail_update_section_between_items_vertical_padding">
+    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts">
 
     <view
         class="com.android.contacts.widget.ProportionalLayout"
diff --git a/res/layout/stream_item_row_text_only.xml b/res/layout/stream_item_row_text_only.xml
index d1d0efd..7b1f255 100644
--- a/res/layout/stream_item_row_text_only.xml
+++ b/res/layout/stream_item_row_text_only.xml
@@ -17,8 +17,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="vertical"
-    android:paddingBottom="@dimen/detail_update_section_between_items_vertical_padding">
+    android:orientation="vertical">
 
     <TextView android:id="@+id/stream_item_html"
         android:layout_width="match_parent"
diff --git a/res/layout/stream_item_row_two_images.xml b/res/layout/stream_item_row_two_images.xml
index f127129..f10b7d8 100644
--- a/res/layout/stream_item_row_two_images.xml
+++ b/res/layout/stream_item_row_two_images.xml
@@ -16,8 +16,7 @@
 
 <TableRow
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
-    android:paddingBottom="@dimen/detail_update_section_between_items_vertical_padding">
+    xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts">
 
     <view
         class="com.android.contacts.widget.ProportionalLayout"
diff --git a/res/values-sw580dp-w1000dp-port/dimens.xml b/res/values-sw580dp-w1000dp-port/dimens.xml
new file mode 100644
index 0000000..767fda4
--- /dev/null
+++ b/res/values-sw580dp-w1000dp-port/dimens.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT 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>
+    <dimen name="contact_detail_list_top_padding">8dip</dimen>
+</resources>
diff --git a/res/values-sw580dp/styles.xml b/res/values-sw580dp/styles.xml
index 8e56bac..52eab18 100644
--- a/res/values-sw580dp/styles.xml
+++ b/res/values-sw580dp/styles.xml
@@ -123,7 +123,7 @@
         <item name="android:layout_height">200dip</item>
     </style>
 
-    <style name="BackgroundOnly" parent="@android:Theme.Holo.Light">
+    <style name="BackgroundOnlyTheme" parent="@android:Theme.Holo.Light">
         <item name="android:windowBackground">@null</item>
         <item name="android:windowContentOverlay">@null</item>
         <item name="android:windowAnimationStyle">@null</item>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 51b2c0c..9bdf669 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -92,7 +92,7 @@
         <item name="android:textColorSecondary">@color/secondary_text_color</item>
     </style>
 
-    <style name="BackgroundOnly">
+    <style name="BackgroundOnlyTheme" parent="@android:style/Theme.Holo.Light">
         <item name="android:windowBackground">@null</item>
         <item name="android:windowContentOverlay">@null</item>
         <item name="android:windowAnimationStyle">@null</item>
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 87fcfe0..21ac3bb 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -1658,6 +1658,15 @@
 
     @Override
     public void onSplitContactConfirmed() {
+        if (mState == null) {
+            // This may happen when this Fragment is recreated by the system during users
+            // confirming the split action (and thus this method is called just before onCreate()),
+            // for example.
+            Log.e(TAG, "mState became null during the user's confirming split action. " +
+                    "Cannot perform the save action.");
+            return;
+        }
+
         mState.markRawContactsForSplitting();
         save(SaveMode.SPLIT);
     }
diff --git a/src/com/android/contacts/model/BaseAccountType.java b/src/com/android/contacts/model/BaseAccountType.java
index aafa3ea..517f487 100644
--- a/src/com/android/contacts/model/BaseAccountType.java
+++ b/src/com/android/contacts/model/BaseAccountType.java
@@ -65,7 +65,7 @@
     public BaseAccountType() {
         this.accountType = null;
         this.dataSet = null;
-        this.titleRes = R.string.account_phone;
+        this.titleRes = R.string.local_profile_title;
         this.iconRes = R.mipmap.ic_launcher_contacts;
     }
 
diff --git a/src/com/android/contacts/model/FallbackAccountType.java b/src/com/android/contacts/model/FallbackAccountType.java
index 8bb3992..a40828e 100644
--- a/src/com/android/contacts/model/FallbackAccountType.java
+++ b/src/com/android/contacts/model/FallbackAccountType.java
@@ -25,7 +25,7 @@
     public FallbackAccountType(Context context) {
         this.accountType = null;
         this.dataSet = null;
-        this.titleRes = R.string.account_phone;
+        this.titleRes = R.string.local_profile_title;
         this.iconRes = R.mipmap.ic_launcher_contacts;
 
         this.resPackageName = null;
diff --git a/src/com/android/contacts/quickcontact/DataAction.java b/src/com/android/contacts/quickcontact/DataAction.java
index f7bf6ed..2066997 100644
--- a/src/com/android/contacts/quickcontact/DataAction.java
+++ b/src/com/android/contacts/quickcontact/DataAction.java
@@ -293,16 +293,13 @@
             Log.e(TAG, "t must be DataAction");
             return false;
         }
-        DataAction other = (DataAction)t;
-        if (!ContactsUtils.areObjectsEqual(mKind, other.mKind)) {
+        DataAction that = (DataAction)t;
+        if (!ContactsUtils.shouldCollapse(mContext, mMimeType, mBody, that.mMimeType,
+                that.mBody)) {
             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)) {
+        if (!TextUtils.equals(mMimeType, that.mMimeType)
+                || !ContactsUtils.areIntentActionEqual(mIntent, that.mIntent)) {
             return false;
         }
         return true;