Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b75145e authored by Gary Mai's avatar Gary Mai
Browse files

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
parent c0ab1383
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -331,6 +331,7 @@ public class ContactEditorFragment extends Fragment implements
    //
    // 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 @@ public class ContactEditorFragment extends Fragment implements
            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 @@ public class ContactEditorFragment extends Fragment implements
        }
        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