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

Commit a31a945b authored by Fred Quintana's avatar Fred Quintana
Browse files

move favorites and my contacts group handling to the

provider and sync adapter

Change-Id: I768d7407a42a72b24ece8abb1891d050c8b6760e
parent ff121670
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -134352,6 +134352,17 @@
 deprecated="not deprecated"
 visibility="protected"
>
<field name="AUTO_ADD"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;auto_add&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="DELETED"
 type="java.lang.String"
 transient="false"
@@ -134363,6 +134374,17 @@
 visibility="public"
>
</field>
<field name="FAVORITES"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;favorites&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="GROUP_VISIBLE"
 type="java.lang.String"
 transient="false"
+0 −20
Original line number Diff line number Diff line
@@ -61,9 +61,6 @@ public class VCardEntry {

    private final static int DEFAULT_ORGANIZATION_TYPE = Organization.TYPE_WORK;

    private static final String ACCOUNT_TYPE_GOOGLE = "com.google";
    private static final String GOOGLE_MY_CONTACTS_GROUP = "System Group: My Contacts";

    private static final Map<String, Integer> sImMap = new HashMap<String, Integer>();

    static {
@@ -1060,23 +1057,6 @@ public class VCardEntry {
        if (mAccount != null) {
            builder.withValue(RawContacts.ACCOUNT_NAME, mAccount.name);
            builder.withValue(RawContacts.ACCOUNT_TYPE, mAccount.type);

            // Assume that caller side creates this group if it does not exist.
            if (ACCOUNT_TYPE_GOOGLE.equals(mAccount.type)) {
                final Cursor cursor = resolver.query(Groups.CONTENT_URI, new String[] {
                        Groups.SOURCE_ID },
                        Groups.TITLE + "=?", new String[] {
                        GOOGLE_MY_CONTACTS_GROUP }, null);
                try {
                    if (cursor != null && cursor.moveToFirst()) {
                        myGroupsId = cursor.getString(0);
                    }
                } finally {
                    if (cursor != null) {
                        cursor.close();
                    }
                }
            }
        } else {
            builder.withValue(RawContacts.ACCOUNT_NAME, null);
            builder.withValue(RawContacts.ACCOUNT_TYPE, null);
+21 −2
Original line number Diff line number Diff line
@@ -4902,6 +4902,23 @@ public final class ContactsContract {
         * Type: INTEGER (boolean)
         */
        public static final String SHOULD_SYNC = "should_sync";

        /**
         * Any newly created contacts will automatically be added to groups that have this
         * flag set to true.
         * <p>
         * Type: INTEGER (boolean)
         */
        public static final String AUTO_ADD = "auto_add";

        /**
         * When a contacts is marked as a favorites it will be automatically added
         * to the groups that have this flag set, and when it is removed from favorites
         * it will be removed from these groups.
         * <p>
         * Type: INTEGER (boolean)
         */
        public static final String FAVORITES = "favorites";
    }

    /**
@@ -5042,6 +5059,8 @@ public final class ContactsContract {
                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, values, DELETED);
                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, NOTES);
                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, SHOULD_SYNC);
                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, FAVORITES);
                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, AUTO_ADD);
                cursor.moveToNext();
                return new Entity(values);
            }