blob: 9a1d2a05423e2c67756bd24f7a174d5cc88b47fd [file] [log] [blame]
Evan Millar088b2912009-05-28 15:24:37 -07001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package android.provider;
18
Jeff Sharkey7b6771a2009-08-17 01:59:54 -070019import android.accounts.Account;
Fred Quintana0f4e1ab2009-07-09 17:20:59 -070020import android.content.ContentProviderClient;
21import android.content.ContentProviderOperation;
Jeff Sharkey7b6771a2009-08-17 01:59:54 -070022import android.content.Intent;
Jeff Sharkey8a0193e2009-07-20 23:28:23 -070023import android.content.res.Resources;
Evan Millar088b2912009-05-28 15:24:37 -070024import android.graphics.BitmapFactory;
25import android.net.Uri;
Fred Quintana0f4e1ab2009-07-09 17:20:59 -070026import android.os.RemoteException;
Jeff Sharkey7b6771a2009-08-17 01:59:54 -070027import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
Evan Millar088b2912009-05-28 15:24:37 -070028
29/**
30 * The contract between the contacts provider and applications. Contains definitions
31 * for the supported URIs and columns.
32 *
Dmitri Plotnikov5f123bd2009-05-28 18:06:31 -070033 * @hide
Evan Millar088b2912009-05-28 15:24:37 -070034 */
35public final class ContactsContract {
36 /** The authority for the contacts provider */
37 public static final String AUTHORITY = "com.android.contacts";
38 /** A content:// style uri to the authority for the contacts provider */
39 public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
40
Fred Quintana0f4e1ab2009-07-09 17:20:59 -070041 public interface SyncStateColumns extends SyncStateContract.Columns {
42 }
43
44 public static final class SyncState {
45 /**
46 * This utility class cannot be instantiated
47 */
48 private SyncState() {}
49
50 public static final String CONTENT_DIRECTORY =
51 SyncStateContract.Constants.CONTENT_DIRECTORY;
52
53 /**
54 * The content:// style URI for this table
55 */
56 public static final Uri CONTENT_URI =
57 Uri.withAppendedPath(AUTHORITY_URI, CONTENT_DIRECTORY);
58
59 /**
60 * @see android.provider.SyncStateContract.Helpers#get
61 */
62 public static byte[] get(ContentProviderClient provider, Account account)
63 throws RemoteException {
64 return SyncStateContract.Helpers.get(provider, CONTENT_URI, account);
65 }
66
67 /**
68 * @see android.provider.SyncStateContract.Helpers#set
69 */
70 public static void set(ContentProviderClient provider, Account account, byte[] data)
71 throws RemoteException {
72 SyncStateContract.Helpers.set(provider, CONTENT_URI, account, data);
73 }
74
75 /**
76 * @see android.provider.SyncStateContract.Helpers#newSetOperation
77 */
78 public static ContentProviderOperation newSetOperation(Account account, byte[] data) {
79 return SyncStateContract.Helpers.newSetOperation(CONTENT_URI, account, data);
80 }
81 }
82
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -070083 /**
84 * Generic columns for use by sync adapters. The specific functions of
85 * these columns are private to the sync adapter. Other clients of the API
86 * should not attempt to either read or write this column.
87 */
88 private interface BaseSyncColumns {
89
90 /** Generic column for use by sync adapters. */
91 public static final String SYNC1 = "sync1";
92 /** Generic column for use by sync adapters. */
93 public static final String SYNC2 = "sync2";
94 /** Generic column for use by sync adapters. */
95 public static final String SYNC3 = "sync3";
96 /** Generic column for use by sync adapters. */
97 public static final String SYNC4 = "sync4";
98 }
99
100 /**
101 * Columns that appear when each row of a table belongs to a specific
102 * account, including sync information that an account may need.
103 */
104 private interface SyncColumns extends BaseSyncColumns {
105 /**
106 * The name of the account instance to which this row belongs.
107 * <P>Type: TEXT</P>
108 */
109 public static final String ACCOUNT_NAME = "account_name";
110
111 /**
112 * The type of account to which this row belongs, which when paired with
113 * {@link #ACCOUNT_NAME} identifies a specific account.
114 * <P>Type: TEXT</P>
115 */
116 public static final String ACCOUNT_TYPE = "account_type";
117
118 /**
119 * String that uniquely identifies this row to its source account.
120 * <P>Type: TEXT</P>
121 */
122 public static final String SOURCE_ID = "sourceid";
123
124 /**
125 * Version number that is updated whenever this row or its related data
126 * changes.
127 * <P>Type: INTEGER</P>
128 */
129 public static final String VERSION = "version";
130
131 /**
132 * Flag indicating that {@link #VERSION} has changed, and this row needs
133 * to be synchronized by its owning account.
134 * <P>Type: INTEGER (boolean)</P>
135 */
136 public static final String DIRTY = "dirty";
137 }
138
Dmitri Plotnikovc991bfc2009-07-14 17:27:31 -0700139 public interface ContactOptionsColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700140 /**
141 * The number of times a person has been contacted
142 * <P>Type: INTEGER</P>
143 */
144 public static final String TIMES_CONTACTED = "times_contacted";
145
146 /**
147 * The last time a person was contacted.
148 * <P>Type: INTEGER</P>
149 */
150 public static final String LAST_TIME_CONTACTED = "last_time_contacted";
151
152 /**
153 * Is the contact starred?
154 * <P>Type: INTEGER (boolean)</P>
155 */
156 public static final String STARRED = "starred";
157
158 /**
Dmitri Plotnikov693d50e2009-06-22 14:57:31 -0700159 * A custom ringtone associated with a person. Not always present.
160 * <P>Type: TEXT (URI to the ringtone)</P>
161 */
162 public static final String CUSTOM_RINGTONE = "custom_ringtone";
163
164 /**
165 * Whether the person should always be sent to voicemail. Not always
166 * present.
167 * <P>Type: INTEGER (0 for false, 1 for true)</P>
168 */
169 public static final String SEND_TO_VOICEMAIL = "send_to_voicemail";
Dmitri Plotnikovc991bfc2009-07-14 17:27:31 -0700170 }
171
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700172 private interface ContactsColumns {
Dmitri Plotnikovc991bfc2009-07-14 17:27:31 -0700173 /**
174 * The display name for the contact.
175 * <P>Type: TEXT</P>
176 */
177 public static final String DISPLAY_NAME = "display_name";
Dmitri Plotnikov693d50e2009-06-22 14:57:31 -0700178
179 /**
Evan Millar088b2912009-05-28 15:24:37 -0700180 * Reference to the row in the data table holding the photo.
181 * <P>Type: INTEGER REFERENCES data(_id)</P>
182 */
183 public static final String PHOTO_ID = "photo_id";
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -0700184
185 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700186 * Lookup value that reflects the {@link Groups#GROUP_VISIBLE} state of
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700187 * any {@link GroupMembership} for this contact.
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -0700188 */
189 public static final String IN_VISIBLE_GROUP = "in_visible_group";
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700190
191 /**
192 * Contact presence status. See {@link android.provider.Im.CommonPresenceColumns}
193 * for individual status definitions.
194 */
195 public static final String PRESENCE_STATUS = Presence.PRESENCE_STATUS;
196
197 /**
Dmitri Plotnikov074fbfe2009-08-11 13:50:21 -0700198 * An indicator of whether this contact has at least one phone number. "1" if there is
199 * at least one phone number, "0" otherwise.
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700200 * <P>Type: INTEGER</P>
201 */
Dmitri Plotnikov074fbfe2009-08-11 13:50:21 -0700202 public static final String HAS_PHONE_NUMBER = "has_phone_number";
Evan Millar088b2912009-05-28 15:24:37 -0700203 }
204
205 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700206 * Constants for the contacts table, which contains a record per group
207 * of raw contact representing the same person.
Evan Millar088b2912009-05-28 15:24:37 -0700208 */
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700209 public static class Contacts implements BaseColumns, ContactsColumns,
Dmitri Plotnikovc9ec66b2009-08-05 12:11:22 -0700210 ContactOptionsColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700211 /**
212 * This utility class cannot be instantiated
213 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700214 private Contacts() {}
Evan Millar088b2912009-05-28 15:24:37 -0700215
216 /**
217 * The content:// style URI for this table
218 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700219 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "contacts");
Evan Millar088b2912009-05-28 15:24:37 -0700220
221 /**
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700222 * The content:// style URI for this table joined with useful data from
Dmitri Plotnikov02c5b452009-07-22 15:13:08 -0700223 * {@link Data}.
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700224 */
225 public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI,
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700226 "contacts_summary");
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700227
Evan Millar161dd862009-06-12 16:02:43 -0700228 /**
229 * The content:// style URI used for "type-to-filter" functionality on the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700230 * {@link #CONTENT_SUMMARY_URI} URI. The filter string will be used to match
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700231 * various parts of the contact name. The filter argument should be passed
Evan Millar161dd862009-06-12 16:02:43 -0700232 * as an additional path segment after this URI.
233 */
234 public static final Uri CONTENT_SUMMARY_FILTER_URI = Uri.withAppendedPath(
235 CONTENT_SUMMARY_URI, "filter");
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700236
Evan Millardc2da5f2009-06-18 16:07:13 -0700237 /**
238 * The content:// style URI for this table joined with useful data from
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700239 * {@link Data}, filtered to include only starred contacts
240 * and the most frequently contacted contacts.
Evan Millardc2da5f2009-06-18 16:07:13 -0700241 */
242 public static final Uri CONTENT_SUMMARY_STREQUENT_URI = Uri.withAppendedPath(
243 CONTENT_SUMMARY_URI, "strequent");
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700244
Evan Millardc2da5f2009-06-18 16:07:13 -0700245 /**
246 * The content:// style URI used for "type-to-filter" functionality on the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700247 * {@link #CONTENT_SUMMARY_STREQUENT_URI} URI. The filter string will be used to match
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700248 * various parts of the contact name. The filter argument should be passed
Evan Millardc2da5f2009-06-18 16:07:13 -0700249 * as an additional path segment after this URI.
250 */
251 public static final Uri CONTENT_SUMMARY_STREQUENT_FILTER_URI = Uri.withAppendedPath(
252 CONTENT_SUMMARY_STREQUENT_URI, "filter");
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700253
Evan Millarb9263752009-07-15 11:32:19 -0700254 public static final Uri CONTENT_SUMMARY_GROUP_URI = Uri.withAppendedPath(
255 CONTENT_SUMMARY_URI, "group");
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700256 /**
Evan Millar088b2912009-05-28 15:24:37 -0700257 * The MIME type of {@link #CONTENT_URI} providing a directory of
258 * people.
259 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700260 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact";
Evan Millar088b2912009-05-28 15:24:37 -0700261
262 /**
263 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
264 * person.
265 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700266 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact";
Evan Millar088b2912009-05-28 15:24:37 -0700267
268 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700269 * A sub-directory of a single contact that contains all of the constituent raw contact
Evan Millar088b2912009-05-28 15:24:37 -0700270 * {@link Data} rows.
271 */
Fred Quintana8851e162009-08-05 21:06:45 -0700272 public static final class Data implements BaseColumns, DataColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700273 /**
274 * no public constructor since this is a utility class
275 */
276 private Data() {}
277
278 /**
279 * The directory twig for this sub-table
280 */
281 public static final String CONTENT_DIRECTORY = "data";
282 }
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -0700283
284 /**
285 * A sub-directory of a single contact aggregate that contains all aggregation suggestions
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700286 * (other contacts). The aggregation suggestions are computed based on approximate
287 * data matches with this contact.
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -0700288 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700289 public static final class AggregationSuggestions implements BaseColumns, ContactsColumns {
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -0700290 /**
291 * No public constructor since this is a utility class
292 */
293 private AggregationSuggestions() {}
294
295 /**
296 * The directory twig for this sub-table
297 */
298 public static final String CONTENT_DIRECTORY = "suggestions";
299
300 /**
301 * An optional query parameter that can be supplied to limit the number of returned
302 * suggestions.
303 * <p>
304 * Type: INTEGER
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700305 *
306 * @deprecated Please use the "limit" parameter
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -0700307 */
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700308 @Deprecated
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -0700309 public static final String MAX_SUGGESTIONS = "max_suggestions";
310 }
Evan Millar088b2912009-05-28 15:24:37 -0700311 }
312
Dmitri Plotnikov2365ded2009-07-27 09:36:09 -0700313 private interface RawContactsColumns {
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700314 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700315 * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} that this
316 * data belongs to.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700317 * <P>Type: INTEGER</P>
Evan Millar088b2912009-05-28 15:24:37 -0700318 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700319 public static final String CONTACT_ID = "contact_id";
Evan Millar088b2912009-05-28 15:24:37 -0700320
321 /**
Dmitri Plotnikov2365ded2009-07-27 09:36:09 -0700322 * Flag indicating that this {@link RawContacts} entry and its children has
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700323 * been restricted to specific platform apps.
324 * <P>Type: INTEGER (boolean)</P>
325 *
326 * @hide until finalized in future platform release
327 */
328 public static final String IS_RESTRICTED = "is_restricted";
329
330 /**
331 * The aggregation mode for this contact.
332 * <P>Type: INTEGER</P>
333 */
334 public static final String AGGREGATION_MODE = "aggregation_mode";
Dmitri Plotnikovd5f56d12009-07-27 09:26:05 -0700335
336 /**
337 * The "deleted" flag: "0" by default, "1" if the row has been marked
338 * for deletion. When {@link android.content.ContentResolver#delete} is
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700339 * called on a raw contact, it is marked for deletion and removed from its
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700340 * aggregate contact. The sync adaptor deletes the raw contact on the server and
Dmitri Plotnikovd5f56d12009-07-27 09:26:05 -0700341 * then calls ContactResolver.delete once more, this time passing the
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700342 * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal.
Dmitri Plotnikovd5f56d12009-07-27 09:26:05 -0700343 * <P>Type: INTEGER</P>
344 */
345 public static final String DELETED = "deleted";
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700346 }
347
348 /**
Dmitri Plotnikov2365ded2009-07-27 09:36:09 -0700349 * Constants for the raw_contacts table, which contains the base contact
350 * information per sync source. Sync adapters and contact management apps
351 * are the primary consumers of this API.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700352 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700353 public static final class RawContacts implements BaseColumns, RawContactsColumns,
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700354 ContactOptionsColumns, SyncColumns {
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700355 /**
356 * This utility class cannot be instantiated
357 */
Dmitri Plotnikov2365ded2009-07-27 09:36:09 -0700358 private RawContacts() {
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700359 }
360
361 /**
Evan Millar088b2912009-05-28 15:24:37 -0700362 * The content:// style URI for this table
363 */
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700364 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "raw_contacts");
Evan Millar088b2912009-05-28 15:24:37 -0700365
366 /**
367 * The content:// style URL for filtering people by email address. The
368 * filter argument should be passed as an additional path segment after
369 * this URI.
Dmitri Plotnikov56927772009-05-28 17:23:39 -0700370 *
Evan Millar088b2912009-05-28 15:24:37 -0700371 * @hide
372 */
Dmitri Plotnikovd4e0b572009-08-06 20:19:29 -0700373 @Deprecated
Evan Millardc2da5f2009-06-18 16:07:13 -0700374 public static final Uri CONTENT_FILTER_EMAIL_URI =
375 Uri.withAppendedPath(CONTENT_URI, "filter_email");
Evan Millar088b2912009-05-28 15:24:37 -0700376
377 /**
378 * The MIME type of {@link #CONTENT_URI} providing a directory of
379 * people.
380 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700381 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact";
Evan Millar088b2912009-05-28 15:24:37 -0700382
383 /**
384 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
385 * person.
386 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700387 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/raw_contact";
Evan Millar088b2912009-05-28 15:24:37 -0700388
389 /**
Dmitri Plotnikovd5f56d12009-07-27 09:26:05 -0700390 * Query parameter that can be passed with the {@link #CONTENT_URI} URI
391 * to the {@link android.content.ContentResolver#delete} method to
392 * indicate that the raw contact can be deleted physically, rather than
393 * merely marked as deleted.
394 */
395 public static final String DELETE_PERMANENTLY = "delete_permanently";
396
397 /**
Dmitri Plotnikovc991bfc2009-07-14 17:27:31 -0700398 * Aggregation mode: aggregate asynchronously.
399 */
400 public static final int AGGREGATION_MODE_DEFAULT = 0;
401
402 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700403 * Aggregation mode: aggregate at the time the raw contact is inserted/updated.
Dmitri Plotnikovc991bfc2009-07-14 17:27:31 -0700404 */
405 public static final int AGGREGATION_MODE_IMMEDITATE = 1;
406
407 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700408 * Aggregation mode: never aggregate this raw contact (note that the raw contact will not
Dmitri Plotnikovc991bfc2009-07-14 17:27:31 -0700409 * have a corresponding Aggregate and therefore will not be included in Aggregates
410 * query results.)
411 */
412 public static final int AGGREGATION_MODE_DISABLED = 2;
413
414 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700415 * A sub-directory of a single raw contact that contains all of their {@link Data} rows.
Evan Millar088b2912009-05-28 15:24:37 -0700416 * To access this directory append
417 */
418 public static final class Data implements BaseColumns, DataColumns {
419 /**
420 * no public constructor since this is a utility class
421 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700422 private Data() {
423 }
Evan Millar088b2912009-05-28 15:24:37 -0700424
425 /**
426 * The directory twig for this sub-table
427 */
428 public static final String CONTENT_DIRECTORY = "data";
429 }
430 }
431
432 private interface DataColumns {
433 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700434 * The package name to use when creating {@link Resources} objects for
435 * this data row. This value is only designed for use when building user
436 * interfaces, and should not be used to infer the owner.
437 */
438 public static final String RES_PACKAGE = "res_package";
439
440 /**
441 * The MIME type of the item represented by this row.
Evan Millar088b2912009-05-28 15:24:37 -0700442 */
443 public static final String MIMETYPE = "mimetype";
444
445 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700446 * A reference to the {@link RawContacts#_ID}
Dmitri Plotnikov56927772009-05-28 17:23:39 -0700447 * that this data belongs to.
Evan Millar088b2912009-05-28 15:24:37 -0700448 */
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700449 public static final String RAW_CONTACT_ID = "raw_contact_id";
450
Evan Millarab5742d2009-06-02 16:21:45 -0700451 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700452 * Whether this is the primary entry of its kind for the raw contact it belongs to
Evan Millarab5742d2009-06-02 16:21:45 -0700453 * <P>Type: INTEGER (if set, non-0 means true)</P>
454 */
455 public static final String IS_PRIMARY = "is_primary";
456
457 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700458 * Whether this is the primary entry of its kind for the aggregate
459 * contact it belongs to. Any data record that is "super primary" must
460 * also be "primary".
Evan Millarab5742d2009-06-02 16:21:45 -0700461 * <P>Type: INTEGER (if set, non-0 means true)</P>
462 */
463 public static final String IS_SUPER_PRIMARY = "is_super_primary";
464
Jeff Sharkey28b68e52009-06-10 15:26:58 -0700465 /**
Fred Quintanac933fb62009-06-11 12:14:40 -0700466 * The version of this data record. This is a read-only value. The data column is
467 * guaranteed to not change without the version going up. This value is monotonically
468 * increasing.
469 * <P>Type: INTEGER</P>
470 */
471 public static final String DATA_VERSION = "data_version";
472
Evan Millar088b2912009-05-28 15:24:37 -0700473 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
474 public static final String DATA1 = "data1";
475 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
476 public static final String DATA2 = "data2";
477 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
478 public static final String DATA3 = "data3";
479 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
480 public static final String DATA4 = "data4";
481 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
482 public static final String DATA5 = "data5";
483 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
484 public static final String DATA6 = "data6";
485 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
486 public static final String DATA7 = "data7";
487 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
488 public static final String DATA8 = "data8";
489 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
490 public static final String DATA9 = "data9";
491 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
492 public static final String DATA10 = "data10";
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700493 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
494 public static final String DATA11 = "data11";
495 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
496 public static final String DATA12 = "data12";
497 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
498 public static final String DATA13 = "data13";
499 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
500 public static final String DATA14 = "data14";
501 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
502 public static final String DATA15 = "data15";
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700503
Fred Quintana8851e162009-08-05 21:06:45 -0700504 /** Generic column for use by sync adapters. */
505 public static final String SYNC1 = "data_sync1";
506 /** Generic column for use by sync adapters. */
507 public static final String SYNC2 = "data_sync2";
508 /** Generic column for use by sync adapters. */
509 public static final String SYNC3 = "data_sync3";
510 /** Generic column for use by sync adapters. */
511 public static final String SYNC4 = "data_sync4";
512
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700513 /**
Dmitri Plotnikov507f1602009-08-10 17:37:36 -0700514 * An optional insert, update or delete URI parameter that determines if
515 * the corresponding raw contact should be marked as dirty. The default
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700516 * value is true.
517 */
518 public static final String MARK_AS_DIRTY = "mark_as_dirty";
Evan Millar088b2912009-05-28 15:24:37 -0700519 }
520
521 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700522 * Constants for the data table, which contains data points tied to a raw contact.
Evan Millar088b2912009-05-28 15:24:37 -0700523 * For example, a phone number or email address. Each row in this table contains a type
524 * definition and some generic columns. Each data type can define the meaning for each of
525 * the generic columns.
526 */
Fred Quintana8851e162009-08-05 21:06:45 -0700527 public static final class Data implements BaseColumns, DataColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700528 /**
529 * This utility class cannot be instantiated
530 */
531 private Data() {}
532
533 /**
534 * The content:// style URI for this table
535 */
536 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data");
537
538 /**
539 * The MIME type of {@link #CONTENT_URI} providing a directory of data.
540 */
541 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/data";
542 }
543
544 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700545 * A table that represents the result of looking up a phone number, for
546 * example for caller ID. The table joins that data row for the phone number
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700547 * with the raw contact that owns the number. To perform a lookup you must
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700548 * append the number you want to find to {@link #CONTENT_FILTER_URI}.
Evan Millar088b2912009-05-28 15:24:37 -0700549 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700550 public static final class PhoneLookup implements BaseColumns, DataColumns, ContactsColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700551 /**
552 * This utility class cannot be instantiated
553 */
554 private PhoneLookup() {}
555
556 /**
557 * The content:// style URI for this table. Append the phone number you want to lookup
558 * to this URI and query it to perform a lookup. For example:
559 *
560 * {@code
561 * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber);
562 * }
563 */
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700564 public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI,
565 "phone_lookup");
566 }
567
568 /**
569 * Additional data mixed in with {@link Im.CommonPresenceColumns} to link
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700570 * back to specific {@link ContactsContract.Contacts#_ID} entries.
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700571 */
572 private interface PresenceColumns {
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700573
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700574 /**
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700575 * The unique ID for a row.
576 * <P>Type: INTEGER (long)</P>
577 */
578 public static final String _ID = "presence_id";
579
580 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700581 * Reference to the {@link RawContacts#_ID} this presence references.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700582 * <P>Type: INTEGER</P>
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700583 */
Dmitri Plotnikovd4e0b572009-08-06 20:19:29 -0700584 public static final String RAW_CONTACT_ID = "presence_raw_contact_id";
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700585
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700586 /**
587 * Reference to the {@link Data#_ID} entry that owns this presence.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700588 * <P>Type: INTEGER</P>
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700589 */
Dmitri Plotnikovd4e0b572009-08-06 20:19:29 -0700590 public static final String DATA_ID = "presence_data_id";
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700591
592 /**
593 * The IM service the presence is coming from. Formatted using either
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700594 * {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)} or
595 * {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.
596 * <P>Type: TEXT</P>
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700597 */
598 public static final String IM_PROTOCOL = "im_protocol";
599
600 /**
601 * The IM handle the presence item is for. The handle is scoped to the
602 * {@link #IM_PROTOCOL}.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700603 * <P>Type: TEXT</P>
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700604 */
605 public static final String IM_HANDLE = "im_handle";
606
607 /**
608 * The IM account for the local user that the presence data came from.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700609 * <P>Type: TEXT</P>
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700610 */
611 public static final String IM_ACCOUNT = "im_account";
612 }
613
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700614 public static final class Presence implements PresenceColumns, Im.CommonPresenceColumns {
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700615 /**
616 * This utility class cannot be instantiated
617 */
618 private Presence() {
619 }
620
621 /**
622 * The content:// style URI for this table
623 */
624 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence");
625
626 /**
627 * Gets the resource ID for the proper presence icon.
628 *
629 * @param status the status to get the icon for
630 * @return the resource ID for the proper presence icon
631 */
632 public static final int getPresenceIconResourceId(int status) {
633 switch (status) {
634 case AVAILABLE:
635 return android.R.drawable.presence_online;
636 case IDLE:
637 case AWAY:
638 return android.R.drawable.presence_away;
639 case DO_NOT_DISTURB:
640 return android.R.drawable.presence_busy;
641 case INVISIBLE:
642 return android.R.drawable.presence_invisible;
643 case OFFLINE:
644 default:
645 return android.R.drawable.presence_offline;
646 }
647 }
648
649 /**
Evan Millarc0437522009-06-23 17:31:05 -0700650 * Returns the precedence of the status code the higher number being the higher precedence.
651 *
652 * @param status The status code.
653 * @return An integer representing the precedence, 0 being the lowest.
654 */
655 public static final int getPresencePrecedence(int status) {
656 // Keep this function here incase we want to enforce a different precedence than the
657 // natural order of the status constants.
658 return status;
659 }
660
661 /**
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700662 * The MIME type of {@link #CONTENT_URI} providing a directory of
663 * presence details.
664 */
665 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/im-presence";
666
667 /**
668 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
669 * presence detail.
670 */
671 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im-presence";
Evan Millar088b2912009-05-28 15:24:37 -0700672 }
673
674 /**
675 * Container for definitions of common data types stored in the {@link Data} table.
676 */
677 public static final class CommonDataKinds {
678 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700679 * The {@link Data#RES_PACKAGE} value for common data that should be
680 * shown using a default style.
Evan Millar088b2912009-05-28 15:24:37 -0700681 */
682 public static final String PACKAGE_COMMON = "common";
683
684 /**
685 * Columns common across the specific types.
686 */
687 private interface BaseCommonColumns {
688 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700689 * The package name to use when creating {@link Resources} objects for
690 * this data row. This value is only designed for use when building user
691 * interfaces, and should not be used to infer the owner.
Evan Millar088b2912009-05-28 15:24:37 -0700692 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700693 public static final String RES_PACKAGE = "res_package";
Evan Millar088b2912009-05-28 15:24:37 -0700694
695 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700696 * The MIME type of the item represented by this row.
Evan Millar088b2912009-05-28 15:24:37 -0700697 */
698 public static final String MIMETYPE = "mimetype";
699
700 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700701 * The {@link RawContacts#_ID} that this data belongs to.
Evan Millar088b2912009-05-28 15:24:37 -0700702 */
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700703 public static final String RAW_CONTACT_ID = "raw_contact_id";
Evan Millar088b2912009-05-28 15:24:37 -0700704 }
705
706 /**
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700707 * The base types that all "Typed" data kinds support.
708 */
709 public interface BaseTypes {
710
711 /**
712 * A custom type. The custom label should be supplied by user.
713 */
714 public static int TYPE_CUSTOM = 0;
715 }
716
717 /**
Evan Millar088b2912009-05-28 15:24:37 -0700718 * Columns common across the specific types.
719 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700720 private interface CommonColumns extends BaseTypes{
Evan Millar088b2912009-05-28 15:24:37 -0700721 /**
722 * The type of data, for example Home or Work.
723 * <P>Type: INTEGER</P>
724 */
725 public static final String TYPE = "data1";
726
727 /**
Evan Millar088b2912009-05-28 15:24:37 -0700728 * The data for the contact method.
729 * <P>Type: TEXT</P>
730 */
Dmitri Plotnikovc9260542009-05-28 17:55:12 -0700731 public static final String DATA = "data2";
732
733 /**
734 * The user defined label for the the contact method.
735 * <P>Type: TEXT</P>
736 */
737 public static final String LABEL = "data3";
Evan Millar088b2912009-05-28 15:24:37 -0700738 }
739
740 /**
741 * Parts of the name.
742 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700743 public static final class StructuredName implements BaseCommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700744 private StructuredName() {}
745
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700746 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -0700747 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name";
748
749 /**
Evan Millar088b2912009-05-28 15:24:37 -0700750 * The given name for the contact.
751 * <P>Type: TEXT</P>
752 */
Dmitri Plotnikovc9260542009-05-28 17:55:12 -0700753 public static final String GIVEN_NAME = "data1";
Evan Millar088b2912009-05-28 15:24:37 -0700754
755 /**
756 * The family name for the contact.
757 * <P>Type: TEXT</P>
758 */
Dmitri Plotnikovc9260542009-05-28 17:55:12 -0700759 public static final String FAMILY_NAME = "data2";
760
761 /**
762 * The contact's honorific prefix, e.g. "Sir"
763 * <P>Type: TEXT</P>
764 */
765 public static final String PREFIX = "data3";
766
767 /**
768 * The contact's middle name
769 * <P>Type: TEXT</P>
770 */
771 public static final String MIDDLE_NAME = "data4";
Evan Millar088b2912009-05-28 15:24:37 -0700772
773 /**
774 * The contact's honorific suffix, e.g. "Jr"
775 */
776 public static final String SUFFIX = "data5";
777
778 /**
779 * The phonetic version of the given name for the contact.
780 * <P>Type: TEXT</P>
781 */
782 public static final String PHONETIC_GIVEN_NAME = "data6";
783
784 /**
785 * The phonetic version of the additional name for the contact.
786 * <P>Type: TEXT</P>
787 */
788 public static final String PHONETIC_MIDDLE_NAME = "data7";
789
790 /**
791 * The phonetic version of the family name for the contact.
792 * <P>Type: TEXT</P>
793 */
794 public static final String PHONETIC_FAMILY_NAME = "data8";
795
796 /**
797 * The name that should be used to display the contact.
Jeff Sharkey62b83b72009-08-11 17:33:48 -0700798 * <i>Unstructured component of the name should be consistent with
799 * its structured representation.</i>
800 * <p>
801 * Type: TEXT
Evan Millar088b2912009-05-28 15:24:37 -0700802 */
803 public static final String DISPLAY_NAME = "data9";
804 }
805
806 /**
807 * A nickname.
808 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700809 public static final class Nickname implements CommonColumns, BaseCommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700810 private Nickname() {}
811
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700812 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -0700813 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname";
814
Evan Millar78e79ad2009-06-08 10:24:44 -0700815 public static final int TYPE_DEFAULT = 1;
816 public static final int TYPE_OTHER_NAME = 2;
817 public static final int TYPE_MAINDEN_NAME = 3;
818 public static final int TYPE_SHORT_NAME = 4;
819 public static final int TYPE_INITIALS = 5;
Evan Millar088b2912009-05-28 15:24:37 -0700820
821 /**
Dmitri Plotnikovc9260542009-05-28 17:55:12 -0700822 * The name itself
823 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700824 public static final String NAME = DATA;
Evan Millar088b2912009-05-28 15:24:37 -0700825 }
826
827 /**
828 * Common data definition for telephone numbers.
829 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700830 public static final class Phone implements BaseCommonColumns, CommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700831 private Phone() {}
832
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700833 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -0700834 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone";
835
Evan Millar161dd862009-06-12 16:02:43 -0700836 /**
837 * The MIME type of {@link #CONTENT_URI} providing a directory of
838 * phones.
839 */
840 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone";
841
842 /**
843 * The content:// style URI for all data records of the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700844 * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700845 * associated raw contact and aggregate contact data.
Evan Millar161dd862009-06-12 16:02:43 -0700846 */
847 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
848 "phones");
849
850 /**
851 * The content:// style URI for filtering data records of the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700852 * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700853 * associated raw contact and aggregate contact data. The filter argument should
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700854 * be passed as an additional path segment after this URI.
Evan Millar161dd862009-06-12 16:02:43 -0700855 */
856 public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI,
857 "filter");
858
Evan Millar088b2912009-05-28 15:24:37 -0700859 public static final int TYPE_HOME = 1;
860 public static final int TYPE_MOBILE = 2;
861 public static final int TYPE_WORK = 3;
862 public static final int TYPE_FAX_WORK = 4;
863 public static final int TYPE_FAX_HOME = 5;
864 public static final int TYPE_PAGER = 6;
865 public static final int TYPE_OTHER = 7;
Fred Quintana3f867152009-08-03 11:43:16 -0700866 public static final int TYPE_CALLBACK = 8;
867 public static final int TYPE_CAR = 9;
868 public static final int TYPE_COMPANY_MAIN = 10;
869 public static final int TYPE_ISDN = 11;
870 public static final int TYPE_MAIN = 12;
871 public static final int TYPE_OTHER_FAX = 13;
872 public static final int TYPE_RADIO = 14;
873 public static final int TYPE_TELEX = 15;
874 public static final int TYPE_TTY_TDD = 16;
875 public static final int TYPE_WORK_MOBILE = 17;
876 public static final int TYPE_WORK_PAGER = 18;
877 public static final int TYPE_ASSISTANT = 19;
Evan Millar088b2912009-05-28 15:24:37 -0700878
879 /**
880 * The phone number as the user entered it.
881 * <P>Type: TEXT</P>
882 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700883 public static final String NUMBER = DATA;
Evan Millar088b2912009-05-28 15:24:37 -0700884 }
885
886 /**
887 * Common data definition for email addresses.
888 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700889 public static final class Email implements BaseCommonColumns, CommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700890 private Email() {}
891
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700892 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -0700893 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email";
894
Dmitri Plotnikovd4e0b572009-08-06 20:19:29 -0700895 /**
896 * The content:// style URI for all data records of the
897 * {@link Email#CONTENT_ITEM_TYPE} MIME type, combined with the
898 * associated raw contact and aggregate contact data.
899 */
900 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
901 "emails");
902
903 /**
904 * The content:// style URL for filtering data rows by email address. The
905 * filter argument should be passed as an additional path segment after
906 * this URI.
907 */
908 public static final Uri CONTENT_FILTER_EMAIL_URI = Uri.withAppendedPath(CONTENT_URI,
909 "filter");
910
Evan Millar088b2912009-05-28 15:24:37 -0700911 public static final int TYPE_HOME = 1;
912 public static final int TYPE_WORK = 2;
913 public static final int TYPE_OTHER = 3;
Fred Quintana8851e162009-08-05 21:06:45 -0700914
915 /**
916 * The display name for the email address
917 * <P>Type: TEXT</P>
918 */
919 public static final String DISPLAY_NAME = "data4";
Evan Millar088b2912009-05-28 15:24:37 -0700920 }
921
922 /**
923 * Common data definition for postal addresses.
924 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700925 public static final class StructuredPostal implements BaseCommonColumns, CommonColumns {
926 private StructuredPostal() {
927 }
Evan Millar088b2912009-05-28 15:24:37 -0700928
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700929 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -0700930 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/postal-address";
931
Evan Millar161dd862009-06-12 16:02:43 -0700932 /**
933 * The MIME type of {@link #CONTENT_URI} providing a directory of
934 * postal addresses.
935 */
936 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address";
937
938 /**
939 * The content:// style URI for all data records of the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700940 * {@link StructuredPostal#CONTENT_ITEM_TYPE} MIME type.
Evan Millar161dd862009-06-12 16:02:43 -0700941 */
942 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
943 "postals");
944
Evan Millar088b2912009-05-28 15:24:37 -0700945 public static final int TYPE_HOME = 1;
946 public static final int TYPE_WORK = 2;
947 public static final int TYPE_OTHER = 3;
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700948
949 /**
Jeff Sharkey62b83b72009-08-11 17:33:48 -0700950 * The full, unstructured postal address. <i>This field must be
951 * consistent with any structured data.</i>
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700952 * <p>
953 * Type: TEXT
954 */
955 public static final String FORMATTED_ADDRESS = DATA;
956
957 /**
958 * The agent who actually receives the mail. Used in work addresses.
959 * Also for 'in care of' or 'c/o'.
960 * <p>
961 * Type: TEXT
Jeff Sharkey62b83b72009-08-11 17:33:48 -0700962 * @deprecated since this isn't supported by gd:structuredPostalAddress
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700963 */
Jeff Sharkey62b83b72009-08-11 17:33:48 -0700964 @Deprecated
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700965 public static final String AGENT = "data4";
966
967 /**
968 * Used in places where houses or buildings have names (and not
969 * necessarily numbers), eg. "The Pillars".
970 * <p>
971 * Type: TEXT
Jeff Sharkey62b83b72009-08-11 17:33:48 -0700972 * @deprecated since this isn't supported by gd:structuredPostalAddress
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700973 */
Jeff Sharkey62b83b72009-08-11 17:33:48 -0700974 @Deprecated
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700975 public static final String HOUSENAME = "data5";
976
977 /**
978 * Can be street, avenue, road, etc. This element also includes the
979 * house number and room/apartment/flat/floor number.
980 * <p>
981 * Type: TEXT
982 */
983 public static final String STREET = "data6";
984
985 /**
986 * Covers actual P.O. boxes, drawers, locked bags, etc. This is
987 * usually but not always mutually exclusive with street.
988 * <p>
989 * Type: TEXT
990 */
991 public static final String POBOX = "data7";
992
993 /**
994 * This is used to disambiguate a street address when a city
995 * contains more than one street with the same name, or to specify a
996 * small place whose mail is routed through a larger postal town. In
997 * China it could be a county or a minor city.
998 * <p>
999 * Type: TEXT
1000 */
Jeff Sharkeyef348c72009-07-26 14:14:34 -07001001 public static final String NEIGHBORHOOD = "data8";
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001002
1003 /**
1004 * Can be city, village, town, borough, etc. This is the postal town
1005 * and not necessarily the place of residence or place of business.
1006 * <p>
1007 * Type: TEXT
1008 */
1009 public static final String CITY = "data9";
1010
1011 /**
1012 * Handles administrative districts such as U.S. or U.K. counties
1013 * that are not used for mail addressing purposes. Subregion is not
1014 * intended for delivery addresses.
1015 * <p>
1016 * Type: TEXT
Jeff Sharkey62b83b72009-08-11 17:33:48 -07001017 * @deprecated since this isn't supported by gd:structuredPostalAddress
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001018 */
Jeff Sharkey62b83b72009-08-11 17:33:48 -07001019 @Deprecated
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001020 public static final String SUBREGION = "data10";
1021
1022 /**
1023 * A state, province, county (in Ireland), Land (in Germany),
1024 * departement (in France), etc.
1025 * <p>
1026 * Type: TEXT
1027 */
1028 public static final String REGION = "data11";
1029
1030 /**
Jeff Sharkeyef348c72009-07-26 14:14:34 -07001031 * Postal code. Usually country-wide, but sometimes specific to the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001032 * city (e.g. "2" in "Dublin 2, Ireland" addresses).
1033 * <p>
1034 * Type: TEXT
1035 */
1036 public static final String POSTCODE = "data12";
1037
1038 /**
1039 * The name or code of the country.
1040 * <p>
1041 * Type: TEXT
1042 */
1043 public static final String COUNTRY = "data13";
Evan Millar088b2912009-05-28 15:24:37 -07001044 }
1045
Fred Quintana8851e162009-08-05 21:06:45 -07001046 /**
1047 * Common data definition for IM addresses.
1048 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -07001049 public static final class Im implements BaseCommonColumns, CommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -07001050 private Im() {}
1051
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001052 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -07001053 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im";
1054
Evan Millar088b2912009-05-28 15:24:37 -07001055 public static final int TYPE_HOME = 1;
1056 public static final int TYPE_WORK = 2;
1057 public static final int TYPE_OTHER = 3;
Dmitri Plotnikov56927772009-05-28 17:23:39 -07001058
Evan Millar088b2912009-05-28 15:24:37 -07001059 public static final String PROTOCOL = "data5";
Dmitri Plotnikov56927772009-05-28 17:23:39 -07001060
Jeff Sharkey732da922009-07-30 09:59:31 -07001061 public static final String CUSTOM_PROTOCOL = "data6";
1062
Evan Millar088b2912009-05-28 15:24:37 -07001063 /**
1064 * The predefined IM protocol types. The protocol can either be non-present, one
1065 * of these types, or a free-form string. These cases are encoded in the PROTOCOL
1066 * column as:
Dmitri Plotnikovc9260542009-05-28 17:55:12 -07001067 * <ul>
1068 * <li>null</li>
1069 * <li>pre:&lt;an integer, one of the protocols below&gt;</li>
1070 * <li>custom:&lt;a string&gt;</li>
1071 * </ul>
Evan Millar088b2912009-05-28 15:24:37 -07001072 */
Jeff Sharkey732da922009-07-30 09:59:31 -07001073 public static final int PROTOCOL_CUSTOM = -1;
Evan Millar088b2912009-05-28 15:24:37 -07001074 public static final int PROTOCOL_AIM = 0;
1075 public static final int PROTOCOL_MSN = 1;
1076 public static final int PROTOCOL_YAHOO = 2;
1077 public static final int PROTOCOL_SKYPE = 3;
1078 public static final int PROTOCOL_QQ = 4;
1079 public static final int PROTOCOL_GOOGLE_TALK = 5;
1080 public static final int PROTOCOL_ICQ = 6;
1081 public static final int PROTOCOL_JABBER = 7;
Fred Quintana8851e162009-08-05 21:06:45 -07001082 public static final int PROTOCOL_NETMEETING = 8;
Evan Millar088b2912009-05-28 15:24:37 -07001083 }
1084
1085 /**
1086 * Common data definition for organizations.
1087 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -07001088 public static final class Organization implements BaseCommonColumns, CommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -07001089 private Organization() {}
1090
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001091 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -07001092 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization";
1093
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -07001094 public static final int TYPE_WORK = 1;
1095 public static final int TYPE_OTHER = 2;
Evan Millar088b2912009-05-28 15:24:37 -07001096
1097 /**
1098 * The company as the user entered it.
1099 * <P>Type: TEXT</P>
1100 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -07001101 public static final String COMPANY = DATA;
Evan Millar088b2912009-05-28 15:24:37 -07001102
1103 /**
1104 * The position title at this company as the user entered it.
1105 * <P>Type: TEXT</P>
1106 */
1107 public static final String TITLE = "data4";
Fred Quintana8851e162009-08-05 21:06:45 -07001108
1109 /**
1110 * The department at this company as the user entered it.
1111 * <P>Type: TEXT</P>
1112 */
1113 public static final String DEPARTMENT = "data5";
1114
1115 /**
1116 * The job description at this company as the user entered it.
1117 * <P>Type: TEXT</P>
1118 */
1119 public static final String JOB_DESCRIPTION = "data6";
1120
1121 /**
1122 * The symbol of this company as the user entered it.
1123 * <P>Type: TEXT</P>
1124 */
1125 public static final String SYMBOL = "data7";
1126
1127 /**
1128 * The phonetic name of this company as the user entered it.
1129 * <P>Type: TEXT</P>
1130 */
1131 public static final String PHONETIC_NAME = "data8";
1132 }
1133
1134 /**
1135 * Common data definition for miscellaneous information.
1136 */
1137 public static final class Miscellaneous implements BaseCommonColumns {
1138 private Miscellaneous() {}
1139
1140 /** MIME type used when storing this in data table. */
1141 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/misc";
1142
1143 /**
1144 * The birthday as the user entered it.
1145 * <P>Type: TEXT</P>
1146 */
1147 public static final String BIRTHDAY = "data1";
1148
1149 /**
1150 * The nickname as the user entered it.
1151 * <P>Type: TEXT</P>
1152 */
1153 public static final String NICKNAME = "data2";
1154 }
1155
1156 /**
1157 * Common data definition for relations.
1158 */
1159 public static final class Relation implements BaseCommonColumns, CommonColumns {
1160 private Relation() {}
1161
1162 /** MIME type used when storing this in data table. */
1163 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/relation";
1164
1165 public static final int TYPE_ASSISTANT = 1;
1166 public static final int TYPE_BROTHER = 2;
1167 public static final int TYPE_CHILD = 3;
1168 public static final int TYPE_DOMESTIC_PARTNER = 4;
1169 public static final int TYPE_FATHER = 5;
1170 public static final int TYPE_FRIEND = 6;
1171 public static final int TYPE_MANAGER = 7;
1172 public static final int TYPE_MOTHER = 8;
1173 public static final int TYPE_PARENT = 9;
1174 public static final int TYPE_PARTNER = 10;
1175 public static final int TYPE_REFERRED_BY = 11;
1176 public static final int TYPE_RELATIVE = 12;
1177 public static final int TYPE_SISTER = 13;
1178 public static final int TYPE_SPOUSE = 14;
1179
1180 /**
1181 * The name of the relative as the user entered it.
1182 * <P>Type: TEXT</P>
1183 */
1184 public static final String NAME = DATA;
1185 }
1186
1187 /**
1188 * Common data definition for events.
1189 */
1190 public static final class Event implements BaseCommonColumns, CommonColumns {
1191 private Event() {}
1192
1193 /** MIME type used when storing this in data table. */
1194 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/event";
1195
1196 public static final int TYPE_ANNIVERSARY = 1;
1197 public static final int TYPE_OTHER = 2;
Dmitri Plotnikovd4e0b572009-08-06 20:19:29 -07001198
Fred Quintana8851e162009-08-05 21:06:45 -07001199 /**
1200 * The event start date as the user entered it.
1201 * <P>Type: TEXT</P>
1202 */
1203 public static final String START_DATE = DATA;
Evan Millar088b2912009-05-28 15:24:37 -07001204 }
1205
1206 /**
1207 * Photo of the contact.
1208 */
1209 public static final class Photo implements BaseCommonColumns {
1210 private Photo() {}
1211
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001212 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -07001213 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo";
1214
1215 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -07001216 * Thumbnail photo of the raw contact. This is the raw bytes of an image
Evan Millar088b2912009-05-28 15:24:37 -07001217 * that could be inflated using {@link BitmapFactory}.
1218 * <p>
1219 * Type: BLOB
1220 */
1221 public static final String PHOTO = "data1";
1222 }
1223
1224 /**
1225 * Notes about the contact.
1226 */
1227 public static final class Note implements BaseCommonColumns {
1228 private Note() {}
1229
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001230 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -07001231 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note";
1232
1233 /**
1234 * The note text.
1235 * <P>Type: TEXT</P>
1236 */
1237 public static final String NOTE = "data1";
1238 }
Dmitri Plotnikov56927772009-05-28 17:23:39 -07001239
Dmitri Plotnikovc9260542009-05-28 17:55:12 -07001240 /**
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001241 * Group Membership.
Dmitri Plotnikovceaafa52009-06-03 10:46:44 -07001242 */
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001243 public static final class GroupMembership implements BaseCommonColumns {
1244 private GroupMembership() {}
Dmitri Plotnikovceaafa52009-06-03 10:46:44 -07001245
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001246 /** MIME type used when storing this in data table. */
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001247 public static final String CONTENT_ITEM_TYPE =
1248 "vnd.android.cursor.item/group_membership";
Dmitri Plotnikovceaafa52009-06-03 10:46:44 -07001249
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001250 /**
Fred Quintanaffc34c12009-07-14 16:02:58 -07001251 * The row id of the group that this group membership refers to. Exactly one of
1252 * this or {@link #GROUP_SOURCE_ID} must be set when inserting a row.
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001253 * <P>Type: INTEGER</P>
1254 */
1255 public static final String GROUP_ROW_ID = "data1";
Dmitri Plotnikovceaafa52009-06-03 10:46:44 -07001256
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001257 /**
Fred Quintanaffc34c12009-07-14 16:02:58 -07001258 * The sourceid of the group that this group membership refers to. Exactly one of
1259 * this or {@link #GROUP_ROW_ID} must be set when inserting a row.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001260 * <P>Type: TEXT</P>
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001261 */
Fred Quintanaffc34c12009-07-14 16:02:58 -07001262 public static final String GROUP_SOURCE_ID = "group_sourceid";
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001263 }
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001264
1265 /**
1266 * Website related to the contact.
1267 */
Fred Quintana8851e162009-08-05 21:06:45 -07001268 public static final class Website implements BaseCommonColumns, CommonColumns {
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001269 private Website() {}
1270
1271 /** MIME type used when storing this in data table. */
1272 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website";
1273
Fred Quintana8851e162009-08-05 21:06:45 -07001274 public static final int TYPE_HOMEPAGE = 1;
1275 public static final int TYPE_BLOG = 2;
1276 public static final int TYPE_PROFILE = 3;
1277 public static final int TYPE_HOME = 4;
1278 public static final int TYPE_WORK = 5;
1279 public static final int TYPE_FTP = 6;
1280 public static final int TYPE_OTHER = 7;
1281
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001282 /**
1283 * The website URL string.
1284 * <P>Type: TEXT</P>
1285 */
1286 public static final String URL = "data1";
1287 }
Dmitri Plotnikovceaafa52009-06-03 10:46:44 -07001288 }
Fred Quintana435e4272009-06-04 17:30:28 -07001289
Jeff Sharkey7b6771a2009-08-17 01:59:54 -07001290 // TODO: make this private before unhiding
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001291 public interface GroupsColumns {
1292 /**
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001293 * The display title of this group.
1294 * <p>
1295 * Type: TEXT
1296 */
1297 public static final String TITLE = "title";
1298
1299 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001300 * The package name to use when creating {@link Resources} objects for
1301 * this group. This value is only designed for use when building user
1302 * interfaces, and should not be used to infer the owner.
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001303 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001304 public static final String RES_PACKAGE = "res_package";
1305
1306 /**
1307 * The display title of this group to load as a resource from
1308 * {@link #RES_PACKAGE}, which may be localized.
1309 * <P>Type: TEXT</P>
1310 */
1311 public static final String TITLE_RES = "title_res";
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001312
1313 /**
Dmitri Plotnikov02c5b452009-07-22 15:13:08 -07001314 * Notes about the group.
1315 * <p>
1316 * Type: TEXT
1317 */
1318 public static final String NOTES = "notes";
1319
1320 /**
1321 * The ID of this group if it is a System Group, i.e. a group that has a special meaning
1322 * to the sync adapter, null otherwise.
1323 * <P>Type: TEXT</P>
1324 */
1325 public static final String SYSTEM_ID = "system_id";
1326
1327 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001328 * The total number of {@link Contacts} that have
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001329 * {@link GroupMembership} in this group. Read-only value that is only
1330 * present when querying {@link Groups#CONTENT_SUMMARY_URI}.
1331 * <p>
1332 * Type: INTEGER
1333 */
1334 public static final String SUMMARY_COUNT = "summ_count";
1335
1336 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001337 * The total number of {@link Contacts} that have both
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001338 * {@link GroupMembership} in this group, and also have phone numbers.
1339 * Read-only value that is only present when querying
1340 * {@link Groups#CONTENT_SUMMARY_URI}.
1341 * <p>
1342 * Type: INTEGER
1343 */
1344 public static final String SUMMARY_WITH_PHONES = "summ_phones";
1345
1346 /**
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001347 * Flag indicating if the contacts belonging to this group should be
1348 * visible in any user interface.
1349 * <p>
Jeff Sharkey7b6771a2009-08-17 01:59:54 -07001350 * Type: INTEGER (boolean)
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001351 */
1352 public static final String GROUP_VISIBLE = "group_visible";
Fred Quintana00c89f62009-08-10 14:43:24 -07001353
1354 /**
1355 * The "deleted" flag: "0" by default, "1" if the row has been marked
1356 * for deletion. When {@link android.content.ContentResolver#delete} is
1357 * called on a raw contact, it is marked for deletion and removed from its
1358 * aggregate contact. The sync adaptor deletes the raw contact on the server and
1359 * then calls ContactResolver.delete once more, this time passing the
1360 * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal.
1361 * <P>Type: INTEGER</P>
1362 */
1363 public static final String DELETED = "deleted";
Jeff Sharkey403d7ac2009-08-16 16:34:35 -07001364
1365 /**
1366 * Whether this group should be synced if the SYNC_EVERYTHING settings
1367 * is false for this group's account.
1368 * <p>
1369 * Type: INTEGER (boolean)
1370 */
1371 public static final String SHOULD_SYNC = "should_sync";
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001372 }
1373
1374 /**
1375 * Constants for the groups table.
1376 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001377 public static final class Groups implements BaseColumns, GroupsColumns, SyncColumns {
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001378 /**
1379 * This utility class cannot be instantiated
1380 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001381 private Groups() {
1382 }
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001383
1384 /**
1385 * The content:// style URI for this table
1386 */
1387 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "groups");
1388
1389 /**
1390 * The content:// style URI for this table joined with details data from
Dmitri Plotnikov02c5b452009-07-22 15:13:08 -07001391 * {@link Data}.
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001392 */
1393 public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI,
1394 "groups_summary");
1395
1396 /**
1397 * The MIME type of a directory of groups.
1398 */
1399 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/group";
1400
1401 /**
1402 * The MIME type of a single group.
1403 */
1404 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group";
Fred Quintana00c89f62009-08-10 14:43:24 -07001405
1406 /**
1407 * Query parameter that can be passed with the {@link #CONTENT_URI} URI
1408 * to the {@link android.content.ContentResolver#delete} method to
1409 * indicate that the raw contact can be deleted physically, rather than
1410 * merely marked as deleted.
1411 */
1412 public static final String DELETE_PERMANENTLY = "delete_permanently";
Dmitri Plotnikov507f1602009-08-10 17:37:36 -07001413
1414 /**
1415 * An optional update or insert URI parameter that determines if the
1416 * group should be marked as dirty. The default value is true.
1417 */
1418 public static final String MARK_AS_DIRTY = "mark_as_dirty";
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001419 }
1420
Fred Quintana435e4272009-06-04 17:30:28 -07001421 /**
1422 * Constants for the contact aggregation exceptions table, which contains
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001423 * aggregation rules overriding those used by automatic aggregation. This type only
1424 * supports query and update. Neither insert nor delete are supported.
Fred Quintana435e4272009-06-04 17:30:28 -07001425 */
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -07001426 public static final class AggregationExceptions implements BaseColumns {
Fred Quintana435e4272009-06-04 17:30:28 -07001427 /**
1428 * This utility class cannot be instantiated
1429 */
1430 private AggregationExceptions() {}
1431
1432 /**
1433 * The content:// style URI for this table
1434 */
1435 public static final Uri CONTENT_URI =
1436 Uri.withAppendedPath(AUTHORITY_URI, "aggregation_exceptions");
1437
1438 /**
1439 * The MIME type of {@link #CONTENT_URI} providing a directory of data.
1440 */
1441 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception";
1442
1443 /**
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -07001444 * The MIME type of a {@link #CONTENT_URI} subdirectory of an aggregation exception
1445 */
1446 public static final String CONTENT_ITEM_TYPE =
1447 "vnd.android.cursor.item/aggregation_exception";
1448
1449 /**
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001450 * The type of exception: {@link #TYPE_KEEP_IN}, {@link #TYPE_KEEP_OUT} or
1451 * {@link #TYPE_AUTOMATIC}.
Fred Quintana435e4272009-06-04 17:30:28 -07001452 *
1453 * <P>Type: INTEGER</P>
1454 */
1455 public static final String TYPE = "type";
1456
Fred Quintana435e4272009-06-04 17:30:28 -07001457 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001458 * Allows the provider to automatically decide whether the aggregate
1459 * contact should include a particular raw contact or not.
Fred Quintana435e4272009-06-04 17:30:28 -07001460 */
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001461 public static final int TYPE_AUTOMATIC = 0;
Fred Quintana435e4272009-06-04 17:30:28 -07001462
1463 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001464 * Makes sure that the specified raw contact is included in the
1465 * specified aggregate contact.
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001466 */
1467 public static final int TYPE_KEEP_IN = 1;
1468
1469 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001470 * Makes sure that the specified raw contact is NOT included in the
1471 * specified aggregate contact.
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001472 */
1473 public static final int TYPE_KEEP_OUT = 2;
1474
1475 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001476 * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} of the
1477 * aggregate contact that the rule applies to.
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001478 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001479 public static final String CONTACT_ID = "contact_id";
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001480
1481 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001482 * A reference to the {@link RawContacts#_ID} of the raw contact that the rule applies to.
Fred Quintana435e4272009-06-04 17:30:28 -07001483 */
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -07001484 public static final String RAW_CONTACT_ID = "raw_contact_id";
Fred Quintana435e4272009-06-04 17:30:28 -07001485 }
Jeff Sharkey28b68e52009-06-10 15:26:58 -07001486
Jeff Sharkey7b6771a2009-08-17 01:59:54 -07001487 private interface SettingsColumns {
1488 /**
1489 * The name of the account instance to which this row belongs.
1490 * <P>Type: TEXT</P>
1491 */
1492 public static final String ACCOUNT_NAME = "account_name";
1493
1494 /**
1495 * The type of account to which this row belongs, which when paired with
1496 * {@link #ACCOUNT_NAME} identifies a specific account.
1497 * <P>Type: TEXT</P>
1498 */
1499 public static final String ACCOUNT_TYPE = "account_type";
1500
1501 /**
1502 * Setting to indicate how this source handles {@link #SHOULD_SYNC} and
1503 * {@link Groups#SHOULD_SYNC} flags. This mode should be one of
1504 * {@link Settings#SYNC_MODE_EVERYTHING},
1505 * {@link Settings#SYNC_MODE_UNGROUPED}, or
1506 * {@link Settings#SYNC_MODE_UNSUPPORTED}.
1507 * <p>
1508 * Type: INTEGER
1509 */
1510 public static final String SHOULD_SYNC_MODE = "should_sync_mode";
1511
1512 /**
1513 * When modes is {@link Settings#SYNC_MODE_EVERYTHING}, this flag
1514 * overrides any children {@link Groups#SHOULD_SYNC} when set. When mode
1515 * is {@link Settings#SYNC_MODE_UNGROUPED}, this flag indicates the
1516 * syncing behavior for contacts not belonging to any group.
1517 * <p>
1518 * Type: INTEGER (boolean)
1519 */
1520 public static final String SHOULD_SYNC = "should_sync";
1521
1522 /**
Jeff Sharkeya6597442009-08-19 09:23:33 -07001523 * Overriding flag indicating if contacts from this source should be
1524 * visible in any user interface.
1525 * <p>
1526 * Type: INTEGER (boolean)
1527 */
1528 public static final String SOURCE_VISIBLE = "source_visible";
1529
1530 /**
1531 * Flag indicating if contacts without any {@link GroupMembership}
1532 * entries should be visible in any user interface.
Jeff Sharkey7b6771a2009-08-17 01:59:54 -07001533 * <p>
1534 * Type: INTEGER (boolean)
1535 */
1536 public static final String UNGROUPED_VISIBLE = "ungrouped_visible";
1537 }
1538
1539 /**
1540 * Contacts-specific settings for various {@link Account}.
1541 */
1542 public static final class Settings implements BaseColumns, SettingsColumns {
1543 /**
1544 * This utility class cannot be instantiated
1545 */
1546 private Settings() {
1547 }
1548
1549 /**
1550 * The content:// style URI for this table
1551 */
1552 public static final Uri CONTENT_URI =
1553 Uri.withAppendedPath(AUTHORITY_URI, "settings");
1554
1555 /**
1556 * The MIME-type of {@link #CONTENT_URI} providing a directory of
1557 * settings.
1558 */
1559 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/setting";
1560
1561 /**
1562 * The MIME-type of {@link #CONTENT_URI} providing a single setting.
1563 */
1564 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/setting";
1565
1566 /**
1567 * Mode for {@link #SHOULD_SYNC_MODE} that indicates this data source
1568 * doesn't support per-group {@link Groups#SHOULD_SYNC} flags.
1569 */
1570 public static final int SYNC_MODE_UNSUPPORTED = 0;
1571
1572 /**
1573 * Mode for {@link #SHOULD_SYNC_MODE} that indicates this data source
1574 * fully supports per-group {@link Groups#SHOULD_SYNC} flags and assumes
1575 * that {@link #SHOULD_SYNC} refers to contacts without any
1576 * {@link GroupMembership}.
1577 */
1578 public static final int SYNC_MODE_UNGROUPED = 1;
1579
1580 /**
1581 * Mode for {@link #SHOULD_SYNC_MODE} that indicates this data source
1582 * fully supports per-group {@link Groups#SHOULD_SYNC} flags but assumes
1583 * that {@link #SHOULD_SYNC} overrides per-group flags when set.
1584 */
1585 public static final int SYNC_MODE_EVERYTHING = 2;
1586 }
1587
Evan Millardc2da5f2009-06-18 16:07:13 -07001588 /**
1589 * Contains helper classes used to create or manage {@link android.content.Intent Intents}
1590 * that involve contacts.
1591 */
1592 public static final class Intents {
1593 /**
1594 * This is the intent that is fired when a search suggestion is clicked on.
1595 */
1596 public static final String SEARCH_SUGGESTION_CLICKED =
1597 "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED";
1598
1599 /**
1600 * This is the intent that is fired when a search suggestion for dialing a number
1601 * is clicked on.
1602 */
1603 public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED =
1604 "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED";
1605
1606 /**
1607 * This is the intent that is fired when a search suggestion for creating a contact
1608 * is clicked on.
1609 */
1610 public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED =
1611 "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED";
1612
1613 /**
1614 * Starts an Activity that lets the user pick a contact to attach an image to.
1615 * After picking the contact it launches the image cropper in face detection mode.
1616 */
1617 public static final String ATTACH_IMAGE =
1618 "com.android.contacts.action.ATTACH_IMAGE";
1619
1620 /**
1621 * Takes as input a data URI with a mailto: or tel: scheme. If a single
1622 * contact exists with the given data it will be shown. If no contact
1623 * exists, a dialog will ask the user if they want to create a new
1624 * contact with the provided details filled in. If multiple contacts
1625 * share the data the user will be prompted to pick which contact they
1626 * want to view.
1627 * <p>
1628 * For <code>mailto:</code> URIs, the scheme specific portion must be a
1629 * raw email address, such as one built using
1630 * {@link Uri#fromParts(String, String, String)}.
1631 * <p>
1632 * For <code>tel:</code> URIs, the scheme specific portion is compared
1633 * to existing numbers using the standard caller ID lookup algorithm.
1634 * The number must be properly encoded, for example using
1635 * {@link Uri#fromParts(String, String, String)}.
1636 * <p>
1637 * Any extras from the {@link Insert} class will be passed along to the
1638 * create activity if there are no contacts to show.
1639 * <p>
1640 * Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip
1641 * prompting the user when the contact doesn't exist.
1642 */
1643 public static final String SHOW_OR_CREATE_CONTACT =
1644 "com.android.contacts.action.SHOW_OR_CREATE_CONTACT";
1645
1646 /**
1647 * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new
1648 * contact if no matching contact found. Otherwise, default behavior is
1649 * to prompt user with dialog before creating.
1650 * <p>
1651 * Type: BOOLEAN
1652 */
1653 public static final String EXTRA_FORCE_CREATE =
1654 "com.android.contacts.action.FORCE_CREATE";
1655
1656 /**
1657 * Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact
1658 * description to be shown when prompting user about creating a new
1659 * contact.
1660 * <p>
1661 * Type: STRING
1662 */
1663 public static final String EXTRA_CREATE_DESCRIPTION =
1664 "com.android.contacts.action.CREATE_DESCRIPTION";
1665
1666 /**
Jeff Sharkey11322002009-06-04 17:25:51 -07001667 * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a
1668 * dialog location using screen coordinates. When not specified, the
1669 * dialog will be centered.
1670 */
1671 public static final String EXTRA_TARGET_RECT = "target_rect";
1672
1673 /**
Jeff Sharkey6bfe14d2009-08-05 15:49:48 -07001674 * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a
1675 * desired dialog style, usually a variation on size. One of
1676 * {@link #MODE_SMALL}, {@link #MODE_MEDIUM}, or {@link #MODE_LARGE}.
1677 */
1678 public static final String EXTRA_MODE = "mode";
1679
1680 /**
1681 * Value for {@link #EXTRA_MODE} to show a small-sized dialog.
1682 */
1683 public static final int MODE_SMALL = 1;
1684
1685 /**
1686 * Value for {@link #EXTRA_MODE} to show a medium-sized dialog.
1687 */
1688 public static final int MODE_MEDIUM = 2;
1689
1690 /**
1691 * Value for {@link #EXTRA_MODE} to show a large-sized dialog.
1692 */
1693 public static final int MODE_LARGE = 3;
1694
1695 /**
Evan Millardc2da5f2009-06-18 16:07:13 -07001696 * Intents related to the Contacts app UI.
1697 */
1698 public static final class UI {
1699 /**
1700 * The action for the default contacts list tab.
1701 */
1702 public static final String LIST_DEFAULT =
1703 "com.android.contacts.action.LIST_DEFAULT";
1704
1705 /**
1706 * The action for the contacts list tab.
1707 */
1708 public static final String LIST_GROUP_ACTION =
1709 "com.android.contacts.action.LIST_GROUP";
1710
1711 /**
1712 * When in LIST_GROUP_ACTION mode, this is the group to display.
1713 */
1714 public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP";
1715
1716 /**
1717 * The action for the all contacts list tab.
1718 */
1719 public static final String LIST_ALL_CONTACTS_ACTION =
1720 "com.android.contacts.action.LIST_ALL_CONTACTS";
1721
1722 /**
1723 * The action for the contacts with phone numbers list tab.
1724 */
1725 public static final String LIST_CONTACTS_WITH_PHONES_ACTION =
1726 "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES";
1727
1728 /**
1729 * The action for the starred contacts list tab.
1730 */
1731 public static final String LIST_STARRED_ACTION =
1732 "com.android.contacts.action.LIST_STARRED";
1733
1734 /**
1735 * The action for the frequent contacts list tab.
1736 */
1737 public static final String LIST_FREQUENT_ACTION =
1738 "com.android.contacts.action.LIST_FREQUENT";
1739
1740 /**
1741 * The action for the "strequent" contacts list tab. It first lists the starred
1742 * contacts in alphabetical order and then the frequent contacts in descending
1743 * order of the number of times they have been contacted.
1744 */
1745 public static final String LIST_STREQUENT_ACTION =
1746 "com.android.contacts.action.LIST_STREQUENT";
1747
1748 /**
1749 * A key for to be used as an intent extra to set the activity
1750 * title to a custom String value.
1751 */
1752 public static final String TITLE_EXTRA_KEY =
1753 "com.android.contacts.extra.TITLE_EXTRA";
1754
1755 /**
1756 * Activity Action: Display a filtered list of contacts
1757 * <p>
1758 * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for
1759 * filtering
1760 * <p>
1761 * Output: Nothing.
1762 */
1763 public static final String FILTER_CONTACTS_ACTION =
1764 "com.android.contacts.action.FILTER_CONTACTS";
1765
1766 /**
1767 * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION}
1768 * intents to supply the text on which to filter.
1769 */
1770 public static final String FILTER_TEXT_EXTRA_KEY =
1771 "com.android.contacts.extra.FILTER_TEXT";
1772 }
1773
1774 /**
1775 * Convenience class that contains string constants used
1776 * to create contact {@link android.content.Intent Intents}.
1777 */
1778 public static final class Insert {
1779 /** The action code to use when adding a contact */
1780 public static final String ACTION = Intent.ACTION_INSERT;
1781
1782 /**
1783 * If present, forces a bypass of quick insert mode.
1784 */
1785 public static final String FULL_MODE = "full_mode";
1786
1787 /**
1788 * The extra field for the contact name.
1789 * <P>Type: String</P>
1790 */
1791 public static final String NAME = "name";
1792
1793 // TODO add structured name values here.
1794
1795 /**
1796 * The extra field for the contact phonetic name.
1797 * <P>Type: String</P>
1798 */
1799 public static final String PHONETIC_NAME = "phonetic_name";
1800
1801 /**
1802 * The extra field for the contact company.
1803 * <P>Type: String</P>
1804 */
1805 public static final String COMPANY = "company";
1806
1807 /**
1808 * The extra field for the contact job title.
1809 * <P>Type: String</P>
1810 */
1811 public static final String JOB_TITLE = "job_title";
1812
1813 /**
1814 * The extra field for the contact notes.
1815 * <P>Type: String</P>
1816 */
1817 public static final String NOTES = "notes";
1818
1819 /**
1820 * The extra field for the contact phone number.
1821 * <P>Type: String</P>
1822 */
1823 public static final String PHONE = "phone";
1824
1825 /**
1826 * The extra field for the contact phone number type.
1827 * <P>Type: Either an integer value from
1828 * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1829 * or a string specifying a custom label.</P>
1830 */
1831 public static final String PHONE_TYPE = "phone_type";
1832
1833 /**
1834 * The extra field for the phone isprimary flag.
1835 * <P>Type: boolean</P>
1836 */
1837 public static final String PHONE_ISPRIMARY = "phone_isprimary";
1838
1839 /**
1840 * The extra field for an optional second contact phone number.
1841 * <P>Type: String</P>
1842 */
1843 public static final String SECONDARY_PHONE = "secondary_phone";
1844
1845 /**
1846 * The extra field for an optional second contact phone number type.
1847 * <P>Type: Either an integer value from
1848 * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1849 * or a string specifying a custom label.</P>
1850 */
1851 public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type";
1852
1853 /**
1854 * The extra field for an optional third contact phone number.
1855 * <P>Type: String</P>
1856 */
1857 public static final String TERTIARY_PHONE = "tertiary_phone";
1858
1859 /**
1860 * The extra field for an optional third contact phone number type.
1861 * <P>Type: Either an integer value from
1862 * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1863 * or a string specifying a custom label.</P>
1864 */
1865 public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type";
1866
1867 /**
1868 * The extra field for the contact email address.
1869 * <P>Type: String</P>
1870 */
1871 public static final String EMAIL = "email";
1872
1873 /**
1874 * The extra field for the contact email type.
1875 * <P>Type: Either an integer value from
1876 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1877 * or a string specifying a custom label.</P>
1878 */
1879 public static final String EMAIL_TYPE = "email_type";
1880
1881 /**
1882 * The extra field for the email isprimary flag.
1883 * <P>Type: boolean</P>
1884 */
1885 public static final String EMAIL_ISPRIMARY = "email_isprimary";
1886
1887 /**
1888 * The extra field for an optional second contact email address.
1889 * <P>Type: String</P>
1890 */
1891 public static final String SECONDARY_EMAIL = "secondary_email";
1892
1893 /**
1894 * The extra field for an optional second contact email type.
1895 * <P>Type: Either an integer value from
1896 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1897 * or a string specifying a custom label.</P>
1898 */
1899 public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type";
1900
1901 /**
1902 * The extra field for an optional third contact email address.
1903 * <P>Type: String</P>
1904 */
1905 public static final String TERTIARY_EMAIL = "tertiary_email";
1906
1907 /**
1908 * The extra field for an optional third contact email type.
1909 * <P>Type: Either an integer value from
1910 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1911 * or a string specifying a custom label.</P>
1912 */
1913 public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type";
1914
1915 /**
1916 * The extra field for the contact postal address.
1917 * <P>Type: String</P>
1918 */
1919 public static final String POSTAL = "postal";
1920
1921 /**
1922 * The extra field for the contact postal address type.
1923 * <P>Type: Either an integer value from
1924 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1925 * or a string specifying a custom label.</P>
1926 */
1927 public static final String POSTAL_TYPE = "postal_type";
1928
1929 /**
1930 * The extra field for the postal isprimary flag.
1931 * <P>Type: boolean</P>
1932 */
1933 public static final String POSTAL_ISPRIMARY = "postal_isprimary";
1934
1935 /**
1936 * The extra field for an IM handle.
1937 * <P>Type: String</P>
1938 */
1939 public static final String IM_HANDLE = "im_handle";
1940
1941 /**
1942 * The extra field for the IM protocol
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001943 * <P>Type: the result of {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)}
1944 * or {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.</P>
Evan Millardc2da5f2009-06-18 16:07:13 -07001945 */
1946 public static final String IM_PROTOCOL = "im_protocol";
1947
1948 /**
1949 * The extra field for the IM isprimary flag.
1950 * <P>Type: boolean</P>
1951 */
1952 public static final String IM_ISPRIMARY = "im_isprimary";
1953 }
1954 }
1955
Evan Millar088b2912009-05-28 15:24:37 -07001956}