Split display name into first and last

Remove all support for directly entering the display
name.
Minor fix for getting focus after text editor expands.

Test:
Tested the following editor scenarios:
  1) new contact
  2) edit writable raw contact
  3) edit read-only raw contact (joins a new writable raw contact to it)
     a) Not editing the name and saving doesn't save the new writable
        raw contact
     b) making edits to the name and swapping accounts saves those edits
     c) swapping around a lot doesn't create multiple writable raws
  4) edit aggregate w/ 1 writable and 1 read-only raw contact
  5) edit aggregate w/ 2 writable raw contacts
  6) swapping accounts doesn't lose entered data

Bug: 21758689
Change-Id: I8d97083ae1e0db1031ee8e4d860f65d77022a1a1
diff --git a/src/com/android/contacts/editor/CompactRawContactsEditorView.java b/src/com/android/contacts/editor/CompactRawContactsEditorView.java
index 97d2f67..f41b33e 100644
--- a/src/com/android/contacts/editor/CompactRawContactsEditorView.java
+++ b/src/com/android/contacts/editor/CompactRawContactsEditorView.java
@@ -453,10 +453,11 @@
         return mCurrentRawContactDelta.getRawContactId();
     }
 
-    public StructuredNameEditorView getPrimaryNameEditorView() {
-        final CompactKindSectionView primaryNameKindSectionView = getPrimaryNameKindSectionView();
-        return primaryNameKindSectionView == null
-                ? null : primaryNameKindSectionView.getPrimaryNameEditorView();
+    public StructuredNameEditorView getNameEditorView() {
+        final CompactKindSectionView nameKindSectionView = mKindSectionViewMap
+                .get(StructuredName.CONTENT_ITEM_TYPE);
+        return nameKindSectionView == null
+                ? null : nameKindSectionView.getNameEditorView();
     }
 
     public RawContactDelta getCurrentRawContactDelta() {
@@ -481,7 +482,7 @@
     }
 
     public View getAggregationAnchorView() {
-        final StructuredNameEditorView nameEditorView = getPrimaryNameEditorView();
+        final StructuredNameEditorView nameEditorView = getNameEditorView();
         return nameEditorView != null ? nameEditorView.findViewById(R.id.anchor_view) : null;
     }
 
@@ -967,9 +968,7 @@
             }
             final CompactKindSectionView kindSectionView;
             final KindSectionData kindSectionData = mKindSectionDataMap.get(mimeType);
-            final ValuesDelta primaryDelta = mCurrentRawContactDelta.getPrimaryEntry(mimeType);
-            kindSectionView = inflateKindSectionView(mKindSectionViews, kindSectionData, mimeType,
-                    primaryDelta);
+            kindSectionView = inflateKindSectionView(mKindSectionViews, kindSectionData, mimeType);
             mKindSectionViews.addView(kindSectionView);
 
             // Keep a pointer to the KindSectionView for each mimeType
@@ -978,8 +977,7 @@
     }
 
     private CompactKindSectionView inflateKindSectionView(ViewGroup viewGroup,
-            KindSectionData kindSectionData, String mimeType,
-            ValuesDelta primaryValuesDelta) {
+            KindSectionData kindSectionData, String mimeType) {
         final CompactKindSectionView kindSectionView = (CompactKindSectionView)
                 mLayoutInflater.inflate(R.layout.compact_item_kind_section, viewGroup,
                         /* attachToRoot =*/ false);
@@ -996,25 +994,11 @@
         // they will be the only types you add new values to initially for new contacts
         kindSectionView.setShowOneEmptyEditor(true);
 
-        kindSectionView.setState(kindSectionData, mViewIdGenerator, mListener,
-                primaryValuesDelta);
+        kindSectionView.setState(kindSectionData, mViewIdGenerator, mListener);
 
         return kindSectionView;
     }
 
-    void maybeSetReadOnlyDisplayNameAsPrimary(String readOnlyDisplayName) {
-        if (TextUtils.isEmpty(readOnlyDisplayName)) return;
-        final CompactKindSectionView primaryNameKindSectionView = getPrimaryNameKindSectionView();
-        if (primaryNameKindSectionView != null && primaryNameKindSectionView.isEmptyName()) {
-            vlog("name: using read only display name as primary name");
-            primaryNameKindSectionView.setName(readOnlyDisplayName);
-        }
-    }
-
-    private CompactKindSectionView getPrimaryNameKindSectionView() {
-        return mKindSectionViewMap.get(StructuredName.CONTENT_ITEM_TYPE);
-    }
-
     private void showAllFields() {
         // Stop hiding empty editors and allow the user to enter values for all kinds now
         for (int i = 0; i < mKindSectionViews.getChildCount(); i++) {