Merge "Detect empty device accounts." into ub-contactsdialer-g-dev
diff --git a/src/com/android/contacts/common/list/CustomContactListFilterActivity.java b/src/com/android/contacts/common/list/CustomContactListFilterActivity.java
index 4de57bb..b961b67 100644
--- a/src/com/android/contacts/common/list/CustomContactListFilterActivity.java
+++ b/src/com/android/contacts/common/list/CustomContactListFilterActivity.java
@@ -366,12 +366,13 @@
                 }
             } else {
                 final Integer titleRes = getAsInteger(Groups.TITLE_RES);
-                if (titleRes != null) {
+                if (titleRes != null && titleRes != 0) {
                     final String packageName = getAsString(Groups.RES_PACKAGE);
-                    return context.getPackageManager().getText(packageName, titleRes, null);
-                } else {
-                    return getAsString(Groups.TITLE);
+                    if (packageName != null) {
+                        return context.getPackageManager().getText(packageName, titleRes, null);
+                    }
                 }
+                return getAsString(Groups.TITLE);
             }
         }
 
diff --git a/src/com/android/contacts/editor/CompactRawContactsEditorView.java b/src/com/android/contacts/editor/CompactRawContactsEditorView.java
index f465167..5c3c565 100644
--- a/src/com/android/contacts/editor/CompactRawContactsEditorView.java
+++ b/src/com/android/contacts/editor/CompactRawContactsEditorView.java
@@ -16,22 +16,6 @@
 
 package com.android.contacts.editor;
 
-import com.android.contacts.common.model.account.AccountDisplayInfo;
-import com.android.contacts.common.model.account.AccountDisplayInfoFactory;
-import com.android.contacts.R;
-import com.android.contacts.common.model.AccountTypeManager;
-import com.android.contacts.common.model.RawContactDelta;
-import com.android.contacts.common.model.RawContactDeltaList;
-import com.android.contacts.common.model.RawContactModifier;
-import com.android.contacts.common.model.ValuesDelta;
-import com.android.contacts.common.model.account.AccountType;
-import com.android.contacts.common.model.account.AccountWithDataSet;
-import com.android.contacts.common.model.dataitem.DataKind;
-import com.android.contacts.common.util.AccountsListAdapter;
-import com.android.contacts.common.util.MaterialColorMapUtils;
-import com.android.contacts.util.UiClosables;
-
-import android.animation.LayoutTransition;
 import android.content.ContentUris;
 import android.content.Context;
 import android.database.Cursor;
@@ -69,6 +53,21 @@
 import android.widget.ListPopupWindow;
 import android.widget.TextView;
 
+import com.android.contacts.R;
+import com.android.contacts.common.model.AccountTypeManager;
+import com.android.contacts.common.model.RawContactDelta;
+import com.android.contacts.common.model.RawContactDeltaList;
+import com.android.contacts.common.model.RawContactModifier;
+import com.android.contacts.common.model.ValuesDelta;
+import com.android.contacts.common.model.account.AccountDisplayInfo;
+import com.android.contacts.common.model.account.AccountDisplayInfoFactory;
+import com.android.contacts.common.model.account.AccountType;
+import com.android.contacts.common.model.account.AccountWithDataSet;
+import com.android.contacts.common.model.dataitem.DataKind;
+import com.android.contacts.common.util.AccountsListAdapter;
+import com.android.contacts.common.util.MaterialColorMapUtils;
+import com.android.contacts.util.UiClosables;
+
 import java.io.FileNotFoundException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -617,11 +616,6 @@
             MaterialColorMapUtils.MaterialPalette materialPalette, ViewIdGenerator viewIdGenerator,
             long photoId, boolean hasNewContact, boolean isUserProfile,
             AccountWithDataSet primaryAccount) {
-        // Enable layout animations for new contacts. This looks nicer when switching to and from
-        // an account that doesn't support profile photos (e.g. SIM accounts).
-        if (hasNewContact && getLayoutTransition() == null) {
-            setLayoutTransition(new LayoutTransition());
-        }
         mKindSectionDataMap.clear();
         mKindSectionViewsMap.clear();
         mKindSectionViews.removeAllViews();
diff --git a/src/com/android/contacts/editor/GroupMembershipView.java b/src/com/android/contacts/editor/GroupMembershipView.java
index ba0c2c6..a76e408 100644
--- a/src/com/android/contacts/editor/GroupMembershipView.java
+++ b/src/com/android/contacts/editor/GroupMembershipView.java
@@ -181,6 +181,8 @@
         mPrimaryTextColor = resources.getColor(R.color.primary_text_color);
         mHintTextColor = resources.getColor(R.color.editor_disabled_text_color);
         mNoGroupString = getContext().getString(R.string.group_edit_field_hint_text);
+        setFocusable(true);
+        setFocusableInTouchMode(true);
     }
 
     @Override
@@ -318,6 +320,7 @@
             return;
         }
 
+        requestFocus();
         mAdapter = new GroupMembershipAdapter<GroupSelectionItem>(
                 getContext(), R.layout.group_membership_list_item);