Copy display name from the correct raw contact

Save a copy of the loaded Contact.
If editing multiple read-only contacts, get the name from the
one that contributes it to the contact's display name.

Test:
Manually verified the correct behavior

Bug: 32477129
Change-Id: I6308d645b1030ed0f317aafc907db8ba762750c2
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 54465fd..dc2171b 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -331,6 +331,7 @@
     //
     // Used to store existing contact data so it can be re-applied during a rebind call,
     // i.e. account switch.
+    protected Contact mContact;
     protected ImmutableList<RawContact> mRawContacts;
     protected Cursor mGroupMetaData;
 
@@ -1038,6 +1039,7 @@
             Log.v(TAG, "Ignoring background change. This will have to be rebased later");
             return;
         }
+        mContact = contact;
         mRawContacts = contact.getRawContacts();
 
         // Check for writable raw contacts.  If there are none, then we need to create one so user
@@ -1214,7 +1216,7 @@
         }
         final int writableIndex = mState.indexOfFirstWritableRawContact(getContext());
         final RawContactDelta writable = mState.get(writableIndex);
-        final RawContactDelta readOnly = mState.get(writableIndex == 0 ? 1 : 0);
+        final RawContactDelta readOnly = mState.getByRawContactId(mContact.getNameRawContactId());
         final ValuesDelta writeNameDelta = writable
                 .getSuperPrimaryEntry(StructuredName.CONTENT_ITEM_TYPE);
         final ValuesDelta readNameDelta = readOnly