Modify the contact split logic to avoid over-split issue.

Details

If the best matching contact doesn't contain any raw contacts from the same
account as the given raw contact, join them together if no identity mismatch
between them on the same namespace, otherwise, keep them separate.

If the best matching contact contains raw contacts from the same account as
the given raw contact, join them together if they share at least one email
address, phone number, or identity; otherwise, re-aggregate raw contact and all
the raw contacts of best matching contact.

When re-aggregation is needed, re-aggregate all the raw contacts (given raw
contacts plus all the raw contacts of the best matching contact) based on the
pair-wise connectivity. Two raw contacts are considered connected if they share
at least one email address, phone number or identity.

Bug:18304324
Change-Id: Ic5a27a23c2f64f534f7a7eaf5f3fb474e877c207
4 files changed