Skip to content
This repository was archived by the owner on May 26, 2026. It is now read-only.
This repository was archived by the owner on May 26, 2026. It is now read-only.

GroupMembershipBuilder always registered, causing group memberships to be deleted on contact update in GROUP_VCARDS mode #439

@rfc2822

Description

@rfc2822

Warning

This report is AI-generated and may be nonsense. However it came up during refactoring and I don't want to forget it so it's tracked here.

Bug

RawContactBuilder always adds GroupMembershipBuilder.Factory to its default list, regardless of the address book's groupMethod.

AndroidContact.update() uses RawContactBuilder.builderMimeTypes() to build a delete-selection that removes all existing data rows of the managed MIME types before re-inserting them. Because GroupMembership.CONTENT_ITEM_TYPE is always included in that set, all group membership rows are deleted on every contact update.

In GROUP_VCARDS mode, GroupMembershipBuilder.build() returns no rows (memberships are managed exclusively via AndroidContact.addToGroup() / removeGroupMemberships()), so deleted memberships are never restored. This leads to contacts losing all their group memberships whenever they are updated from the server.

Expected behavior

Group membership rows should only be deleted and re-inserted by RawContactBuilder in CATEGORIES mode, where categories are mapped to/from group memberships. In GROUP_VCARDS mode, GroupMembership.CONTENT_ITEM_TYPE must not appear in builderMimeTypes().

Possible fix

Only register GroupMembershipBuilder.Factory when groupMethod == GroupMethod.CATEGORIES.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions