Skip auto add groups

pull/210/head
M66B 3 years ago
parent 42921571b9
commit 5182b28548

@ -705,28 +705,36 @@ public class EntityRule {
}, },
null)) { null)) {
Log.i(this.name + " membership=" + membership.getCount()); Log.i(this.name + " membership=" + membership.getCount());
if (membership.getCount() != 1)
return false;
if (!membership.moveToNext())
return false;
int count = 0;
String groupName = null;
while (membership.moveToNext()) {
long groupId = membership.getLong(0); long groupId = membership.getLong(0);
Log.i(this.name + " groupId=" + groupId);
try (Cursor groups = resolver.query(ContactsContract.Groups.CONTENT_URI, try (Cursor groups = resolver.query(ContactsContract.Groups.CONTENT_URI,
new String[]{ContactsContract.Groups.TITLE}, new String[]{
ContactsContract.Groups.TITLE,
ContactsContract.Groups.AUTO_ADD,
ContactsContract.Groups.GROUP_VISIBLE,
},
ContactsContract.Groups._ID + " = ?", ContactsContract.Groups._ID + " = ?",
new String[]{Long.toString(groupId)}, new String[]{Long.toString(groupId)},
ContactsContract.Groups.TITLE)) { ContactsContract.Groups.TITLE)) {
Log.i(this.name + " groups=" + groups.getCount()); while (groups.moveToNext()) {
if (!groups.moveToNext()) groupName = groups.getString(0);
return false; int auto_add = groups.getInt(1);
int visible = groups.getInt(2);
String groupName = groups.getString(0); if (auto_add == 0)
Log.i(this.name + " groupName=" + groupName); count++;
Log.i(this.name + " membership groupId=" + groupId +
create = create.replace("$group$", groupName); " name=" + groupName + " auto_add=" + auto_add + " visible=" + visible);
}
}
} }
Log.i(this.name + " name=" + groupName + " count=" + count);
if (count == 1)
create = create.replace("$group$", groupName);
else
return false;
} }
} }
} }

Loading…
Cancel
Save