From d7bdc18f875c4fdd1848aa9b941109acc0f99635 Mon Sep 17 00:00:00 2001 From: Dave Santoro Date: Fri, 24 Jun 2011 15:39:39 -0700 Subject: [PATCH] Add data_set column for raw contacts and groups. This provides a way for multiple sync adapters to exist for a single account type. Internally, for example, we can use these new columns to support separate sync adapters (and sourced data) for Focus, Emerald Sea, and Latitude. Change-Id: I1b8dfd79e9fb2dfcee6ac6d4adb947093f5c2324 --- api/current.txt | 2 + .../android/provider/ContactsContract.java | 86 +++++++++++++++++-- 2 files changed, 80 insertions(+), 8 deletions(-) diff --git a/api/current.txt b/api/current.txt index 46cf2afc1f992..f3dda785fa675 100644 --- a/api/current.txt +++ b/api/current.txt @@ -16007,6 +16007,7 @@ package android.provider { protected static abstract interface ContactsContract.GroupsColumns { field public static final java.lang.String AUTO_ADD = "auto_add"; + field public static final java.lang.String DATA_SET = "data_set"; field public static final java.lang.String DELETED = "deleted"; field public static final java.lang.String FAVORITES = "favorites"; field public static final java.lang.String GROUP_IS_READ_ONLY = "group_is_read_only"; @@ -16134,6 +16135,7 @@ package android.provider { protected static abstract interface ContactsContract.RawContactsColumns { field public static final java.lang.String AGGREGATION_MODE = "aggregation_mode"; field public static final java.lang.String CONTACT_ID = "contact_id"; + field public static final java.lang.String DATA_SET = "data_set"; field public static final java.lang.String DELETED = "deleted"; field public static final java.lang.String RAW_CONTACT_IS_READ_ONLY = "raw_contact_is_read_only"; field public static final java.lang.String RAW_CONTACT_IS_USER_PROFILE = "raw_contact_is_user_profile"; diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 9c12a44c81f35..ec67683cde8d0 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -1870,6 +1870,18 @@ public final class ContactsContract { */ public static final String CONTACT_ID = "contact_id"; + /** + * The data set within the account that this row belongs to. This allows + * multiple sync adapters for the same account type to distinguish between + * each others' data. + * + * This is empty by default, and is completely optional. It only needs to + * be populated if multiple sync adapters are entering distinct data for + * the same account type and account name. + *

Type: TEXT

+ */ + public static final String DATA_SET = "data_set"; + /** * The aggregation mode for this contact. *

Type: INTEGER

@@ -2192,8 +2204,8 @@ public final class ContactsContract { * The name of the account instance to which this row belongs, which when paired with * {@link #ACCOUNT_TYPE} identifies a specific account. * For example, this will be the Gmail address if it is a Google account. - * It should be set at the time - * the raw contact is inserted and never changed afterwards. + * It should be set at the time the raw contact is inserted and never + * changed afterwards. * * * String @@ -2203,8 +2215,8 @@ public final class ContactsContract { *

* The type of account to which this row belongs, which when paired with * {@link #ACCOUNT_NAME} identifies a specific account. - * It should be set at the time - * the raw contact is inserted and never changed afterwards. + * It should be set at the time the raw contact is inserted and never + * changed afterwards. *

*

* To ensure uniqueness, new account types should be chosen according to the @@ -2214,15 +2226,38 @@ public final class ContactsContract { * * * String + * {@link #DATA_SET} + * read/write-once + * + *

+ * The data set within the account that this row belongs to. This allows + * multiple sync adapters for the same account type to distinguish between + * each others' data. The combination of {@link #ACCOUNT_TYPE}, + * {@link #ACCOUNT_NAME}, and {@link #DATA_SET} identifies a set of data + * that is associated with a single sync adapter. + *

+ *

+ * This is empty by default, and is completely optional. It only needs to + * be populated if multiple sync adapters are entering distinct data for + * the same account type and account name. + *

+ *

+ * It should be set at the time the raw contact is inserted and never + * changed afterwards. + *

+ * + * + * + * String * {@link #SOURCE_ID} * read/write * String that uniquely identifies this row to its source account. * Typically it is set at the time the raw contact is inserted and never * changed afterwards. The one notable exception is a new raw contact: it - * will have an account name and type, but no source id. This - * indicates to the sync adapter that a new contact needs to be created - * server-side and its ID stored in the corresponding SOURCE_ID field on - * the phone. + * will have an account name and type (and possibly a data set), but no + * source id. This indicates to the sync adapter that a new contact needs + * to be created server-side and its ID stored in the corresponding + * SOURCE_ID field on the phone. * * * @@ -6171,6 +6206,18 @@ public final class ContactsContract { * @see Groups */ protected interface GroupsColumns { + /** + * The data set within the account that this group belongs to. This allows + * multiple sync adapters for the same account type to distinguish between + * each others' group data. + * + * This is empty by default, and is completely optional. It only needs to + * be populated if multiple sync adapters are entering distinct group data + * for the same account type and account name. + *

Type: TEXT

+ */ + public static final String DATA_SET = "data_set"; + /** * The display title of this group. *

@@ -6297,6 +6344,29 @@ public final class ContactsContract { * In other words, it would be a really bad idea to delete and reinsert a * group. A sync adapter should always do an update instead. * + # + * String + * {@link #DATA_SET} + * read/write-once + * + *

+ * The data set within the account that this group belongs to. This allows + * multiple sync adapters for the same account type to distinguish between + * each others' group data. The combination of {@link #ACCOUNT_TYPE}, + * {@link #ACCOUNT_NAME}, and {@link #DATA_SET} identifies a set of data + * that is associated with a single sync adapter. + *

+ *

+ * This is empty by default, and is completely optional. It only needs to + * be populated if multiple sync adapters are entering distinct data for + * the same account type and account name. + *

+ *

+ * It should be set at the time the group is inserted and never changed + * afterwards. + *

+ * + * * * String * {@link #TITLE}