blob: 066401f456d080898d956438a0fdd5c2ea60b41f [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
Evan Millardc2da5f2009-06-18 16:07:13 -070019import android.content.Intent;
Fred Quintana0f4e1ab2009-07-09 17:20:59 -070020import android.content.ContentProviderClient;
21import android.content.ContentProviderOperation;
Jeff Sharkey8a0193e2009-07-20 23:28:23 -070022import android.content.res.Resources;
Evan Millar088b2912009-05-28 15:24:37 -070023import android.graphics.BitmapFactory;
24import android.net.Uri;
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -070025import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
Fred Quintana0f4e1ab2009-07-09 17:20:59 -070026import android.accounts.Account;
27import android.os.RemoteException;
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 primary phone number.
181 * <P>Type: INTEGER REFERENCES data(_id)</P>
182 */
Dmitri Plotnikov8dcd1402009-08-06 18:01:10 -0700183 @Deprecated
Evan Millar088b2912009-05-28 15:24:37 -0700184 public static final String PRIMARY_PHONE_ID = "primary_phone_id";
Dmitri Plotnikov56927772009-05-28 17:23:39 -0700185
Evan Millar088b2912009-05-28 15:24:37 -0700186 /**
Dmitri Plotnikov8dcd1402009-08-06 18:01:10 -0700187 * Reference to the row in the data table holding the default phone number.
188 * If the contact has only one phone number, that number is the default one.
189 * Otherwise it is the one explicitly selected by the user as primary.
190 * <P>Type: INTEGER REFERENCES data(_id)</P>
191 */
192 public static final String DEFAULT_PHONE_ID = "default_phone_id";
193
194 /**
Evan Millar088b2912009-05-28 15:24:37 -0700195 * Reference to the row in the data table holding the primary email address.
196 * <P>Type: INTEGER REFERENCES data(_id)</P>
197 */
Dmitri Plotnikov8dcd1402009-08-06 18:01:10 -0700198 @Deprecated
Evan Millar088b2912009-05-28 15:24:37 -0700199 public static final String PRIMARY_EMAIL_ID = "primary_email_id";
Dmitri Plotnikov56927772009-05-28 17:23:39 -0700200
Evan Millar088b2912009-05-28 15:24:37 -0700201 /**
Dmitri Plotnikov8dcd1402009-08-06 18:01:10 -0700202 * Reference to the row in the data table holding the default email address.
203 * If the contact has only one email address, that address is the default one.
204 * Otherwise it is the one explicitly selected by the user as primary.
205 * <P>Type: INTEGER REFERENCES data(_id)</P>
206 */
207 public static final String DEFAULT_EMAIL_ID = "default_email_id";
208
209 /**
Evan Millar088b2912009-05-28 15:24:37 -0700210 * Reference to the row in the data table holding the photo.
211 * <P>Type: INTEGER REFERENCES data(_id)</P>
212 */
213 public static final String PHOTO_ID = "photo_id";
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -0700214
215 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700216 * Lookup value that reflects the {@link Groups#GROUP_VISIBLE} state of
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700217 * any {@link GroupMembership} for this contact.
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -0700218 */
219 public static final String IN_VISIBLE_GROUP = "in_visible_group";
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700220
221 /**
222 * Contact presence status. See {@link android.provider.Im.CommonPresenceColumns}
223 * for individual status definitions.
224 */
225 public static final String PRESENCE_STATUS = Presence.PRESENCE_STATUS;
226
227 /**
228 * The type of data, for example Home or Work.
229 * <P>Type: INTEGER</P>
230 */
Dmitri Plotnikov8dcd1402009-08-06 18:01:10 -0700231 @Deprecated
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700232 public static final String PRIMARY_PHONE_TYPE = CommonDataKinds.Phone.TYPE;
233
234 /**
Dmitri Plotnikov8dcd1402009-08-06 18:01:10 -0700235 * The type of data, for example Home or Work.
236 * <P>Type: INTEGER</P>
237 */
238 public static final String DEFAULT_PHONE_TYPE = "default_phone_type";
239
240 /**
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700241 * The user defined label for the primary phone.
242 * <P>Type: TEXT</P>
243 */
Dmitri Plotnikov8dcd1402009-08-06 18:01:10 -0700244 @Deprecated
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700245 public static final String PRIMARY_PHONE_LABEL = CommonDataKinds.Phone.LABEL;
246
247 /**
Dmitri Plotnikov8dcd1402009-08-06 18:01:10 -0700248 * The user defined label for the default phone.
249 * <P>Type: TEXT</P>
250 */
251 public static final String DEFAULT_PHONE_LABEL = "default_phone_label";
252
253 /**
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700254 * The primary phone number.
255 * <P>Type: TEXT</P>
256 */
Dmitri Plotnikov8dcd1402009-08-06 18:01:10 -0700257 @Deprecated
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700258 public static final String PRIMARY_PHONE_NUMBER = CommonDataKinds.Phone.NUMBER;
Dmitri Plotnikov8dcd1402009-08-06 18:01:10 -0700259
260 /**
261 * The default phone number.
262 * <P>Type: TEXT</P>
263 */
264 public static final String DEFAULT_PHONE_NUMBER = "default_phone_number";
Evan Millar088b2912009-05-28 15:24:37 -0700265 }
266
267 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700268 * Constants for the contacts table, which contains a record per group
269 * of raw contact representing the same person.
Evan Millar088b2912009-05-28 15:24:37 -0700270 */
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700271 public static class Contacts implements BaseColumns, ContactsColumns,
Dmitri Plotnikovc9ec66b2009-08-05 12:11:22 -0700272 ContactOptionsColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700273 /**
274 * This utility class cannot be instantiated
275 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700276 private Contacts() {}
Evan Millar088b2912009-05-28 15:24:37 -0700277
278 /**
279 * The content:// style URI for this table
280 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700281 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "contacts");
Evan Millar088b2912009-05-28 15:24:37 -0700282
283 /**
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700284 * The content:// style URI for this table joined with useful data from
Dmitri Plotnikov02c5b452009-07-22 15:13:08 -0700285 * {@link Data}.
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700286 */
287 public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI,
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700288 "contacts_summary");
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700289
Evan Millar161dd862009-06-12 16:02:43 -0700290 /**
291 * The content:// style URI used for "type-to-filter" functionality on the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700292 * {@link #CONTENT_SUMMARY_URI} URI. The filter string will be used to match
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700293 * various parts of the contact name. The filter argument should be passed
Evan Millar161dd862009-06-12 16:02:43 -0700294 * as an additional path segment after this URI.
295 */
296 public static final Uri CONTENT_SUMMARY_FILTER_URI = Uri.withAppendedPath(
297 CONTENT_SUMMARY_URI, "filter");
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700298
Evan Millardc2da5f2009-06-18 16:07:13 -0700299 /**
300 * The content:// style URI for this table joined with useful data from
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700301 * {@link Data}, filtered to include only starred contacts
302 * and the most frequently contacted contacts.
Evan Millardc2da5f2009-06-18 16:07:13 -0700303 */
304 public static final Uri CONTENT_SUMMARY_STREQUENT_URI = Uri.withAppendedPath(
305 CONTENT_SUMMARY_URI, "strequent");
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700306
Evan Millardc2da5f2009-06-18 16:07:13 -0700307 /**
308 * The content:// style URI used for "type-to-filter" functionality on the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700309 * {@link #CONTENT_SUMMARY_STREQUENT_URI} URI. The filter string will be used to match
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700310 * various parts of the contact name. The filter argument should be passed
Evan Millardc2da5f2009-06-18 16:07:13 -0700311 * as an additional path segment after this URI.
312 */
313 public static final Uri CONTENT_SUMMARY_STREQUENT_FILTER_URI = Uri.withAppendedPath(
314 CONTENT_SUMMARY_STREQUENT_URI, "filter");
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700315
Evan Millarb9263752009-07-15 11:32:19 -0700316 public static final Uri CONTENT_SUMMARY_GROUP_URI = Uri.withAppendedPath(
317 CONTENT_SUMMARY_URI, "group");
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700318 /**
Evan Millar088b2912009-05-28 15:24:37 -0700319 * The MIME type of {@link #CONTENT_URI} providing a directory of
320 * people.
321 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700322 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact";
Evan Millar088b2912009-05-28 15:24:37 -0700323
324 /**
325 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
326 * person.
327 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700328 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact";
Evan Millar088b2912009-05-28 15:24:37 -0700329
330 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700331 * A sub-directory of a single contact that contains all of the constituent raw contact
Evan Millar088b2912009-05-28 15:24:37 -0700332 * {@link Data} rows.
333 */
Fred Quintana8851e162009-08-05 21:06:45 -0700334 public static final class Data implements BaseColumns, DataColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700335 /**
336 * no public constructor since this is a utility class
337 */
338 private Data() {}
339
340 /**
341 * The directory twig for this sub-table
342 */
343 public static final String CONTENT_DIRECTORY = "data";
344 }
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -0700345
346 /**
347 * A sub-directory of a single contact aggregate that contains all aggregation suggestions
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700348 * (other contacts). The aggregation suggestions are computed based on approximate
349 * data matches with this contact.
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -0700350 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700351 public static final class AggregationSuggestions implements BaseColumns, ContactsColumns {
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -0700352 /**
353 * No public constructor since this is a utility class
354 */
355 private AggregationSuggestions() {}
356
357 /**
358 * The directory twig for this sub-table
359 */
360 public static final String CONTENT_DIRECTORY = "suggestions";
361
362 /**
363 * An optional query parameter that can be supplied to limit the number of returned
364 * suggestions.
365 * <p>
366 * Type: INTEGER
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700367 *
368 * @deprecated Please use the "limit" parameter
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -0700369 */
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700370 @Deprecated
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -0700371 public static final String MAX_SUGGESTIONS = "max_suggestions";
372 }
Evan Millar088b2912009-05-28 15:24:37 -0700373 }
374
Dmitri Plotnikov2365ded2009-07-27 09:36:09 -0700375 private interface RawContactsColumns {
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700376 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700377 * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} that this
378 * data belongs to.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700379 * <P>Type: INTEGER</P>
Evan Millar088b2912009-05-28 15:24:37 -0700380 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700381 public static final String CONTACT_ID = "contact_id";
Evan Millar088b2912009-05-28 15:24:37 -0700382
383 /**
Dmitri Plotnikov2365ded2009-07-27 09:36:09 -0700384 * Flag indicating that this {@link RawContacts} entry and its children has
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700385 * been restricted to specific platform apps.
386 * <P>Type: INTEGER (boolean)</P>
387 *
388 * @hide until finalized in future platform release
389 */
390 public static final String IS_RESTRICTED = "is_restricted";
391
392 /**
393 * The aggregation mode for this contact.
394 * <P>Type: INTEGER</P>
395 */
396 public static final String AGGREGATION_MODE = "aggregation_mode";
Dmitri Plotnikovd5f56d12009-07-27 09:26:05 -0700397
398 /**
399 * The "deleted" flag: "0" by default, "1" if the row has been marked
400 * for deletion. When {@link android.content.ContentResolver#delete} is
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700401 * called on a raw contact, it is marked for deletion and removed from its
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700402 * aggregate contact. The sync adaptor deletes the raw contact on the server and
Dmitri Plotnikovd5f56d12009-07-27 09:26:05 -0700403 * then calls ContactResolver.delete once more, this time passing the
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700404 * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal.
Dmitri Plotnikovd5f56d12009-07-27 09:26:05 -0700405 * <P>Type: INTEGER</P>
406 */
407 public static final String DELETED = "deleted";
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700408 }
409
410 /**
Dmitri Plotnikov2365ded2009-07-27 09:36:09 -0700411 * Constants for the raw_contacts table, which contains the base contact
412 * information per sync source. Sync adapters and contact management apps
413 * are the primary consumers of this API.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700414 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700415 public static final class RawContacts implements BaseColumns, RawContactsColumns,
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700416 ContactOptionsColumns, SyncColumns {
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700417 /**
418 * This utility class cannot be instantiated
419 */
Dmitri Plotnikov2365ded2009-07-27 09:36:09 -0700420 private RawContacts() {
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700421 }
422
423 /**
Evan Millar088b2912009-05-28 15:24:37 -0700424 * The content:// style URI for this table
425 */
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700426 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "raw_contacts");
Evan Millar088b2912009-05-28 15:24:37 -0700427
428 /**
429 * The content:// style URL for filtering people by email address. The
430 * filter argument should be passed as an additional path segment after
431 * this URI.
Dmitri Plotnikov56927772009-05-28 17:23:39 -0700432 *
Evan Millar088b2912009-05-28 15:24:37 -0700433 * @hide
434 */
Dmitri Plotnikovd4e0b572009-08-06 20:19:29 -0700435 @Deprecated
Evan Millardc2da5f2009-06-18 16:07:13 -0700436 public static final Uri CONTENT_FILTER_EMAIL_URI =
437 Uri.withAppendedPath(CONTENT_URI, "filter_email");
Evan Millar088b2912009-05-28 15:24:37 -0700438
439 /**
440 * The MIME type of {@link #CONTENT_URI} providing a directory of
441 * people.
442 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700443 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact";
Evan Millar088b2912009-05-28 15:24:37 -0700444
445 /**
446 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
447 * person.
448 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700449 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/raw_contact";
Evan Millar088b2912009-05-28 15:24:37 -0700450
451 /**
Dmitri Plotnikovd5f56d12009-07-27 09:26:05 -0700452 * Query parameter that can be passed with the {@link #CONTENT_URI} URI
453 * to the {@link android.content.ContentResolver#delete} method to
454 * indicate that the raw contact can be deleted physically, rather than
455 * merely marked as deleted.
456 */
457 public static final String DELETE_PERMANENTLY = "delete_permanently";
458
459 /**
Dmitri Plotnikovc991bfc2009-07-14 17:27:31 -0700460 * Aggregation mode: aggregate asynchronously.
461 */
462 public static final int AGGREGATION_MODE_DEFAULT = 0;
463
464 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700465 * Aggregation mode: aggregate at the time the raw contact is inserted/updated.
Dmitri Plotnikovc991bfc2009-07-14 17:27:31 -0700466 */
467 public static final int AGGREGATION_MODE_IMMEDITATE = 1;
468
469 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700470 * Aggregation mode: never aggregate this raw contact (note that the raw contact will not
Dmitri Plotnikovc991bfc2009-07-14 17:27:31 -0700471 * have a corresponding Aggregate and therefore will not be included in Aggregates
472 * query results.)
473 */
474 public static final int AGGREGATION_MODE_DISABLED = 2;
475
476 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700477 * A sub-directory of a single raw contact that contains all of their {@link Data} rows.
Evan Millar088b2912009-05-28 15:24:37 -0700478 * To access this directory append
479 */
480 public static final class Data implements BaseColumns, DataColumns {
481 /**
482 * no public constructor since this is a utility class
483 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700484 private Data() {
485 }
Evan Millar088b2912009-05-28 15:24:37 -0700486
487 /**
488 * The directory twig for this sub-table
489 */
490 public static final String CONTENT_DIRECTORY = "data";
491 }
492 }
493
494 private interface DataColumns {
495 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700496 * The package name to use when creating {@link Resources} objects for
497 * this data row. This value is only designed for use when building user
498 * interfaces, and should not be used to infer the owner.
499 */
500 public static final String RES_PACKAGE = "res_package";
501
502 /**
503 * The MIME type of the item represented by this row.
Evan Millar088b2912009-05-28 15:24:37 -0700504 */
505 public static final String MIMETYPE = "mimetype";
506
507 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700508 * A reference to the {@link RawContacts#_ID}
Dmitri Plotnikov56927772009-05-28 17:23:39 -0700509 * that this data belongs to.
Evan Millar088b2912009-05-28 15:24:37 -0700510 */
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700511 public static final String RAW_CONTACT_ID = "raw_contact_id";
512
Evan Millarab5742d2009-06-02 16:21:45 -0700513 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700514 * Whether this is the primary entry of its kind for the raw contact it belongs to
Evan Millarab5742d2009-06-02 16:21:45 -0700515 * <P>Type: INTEGER (if set, non-0 means true)</P>
516 */
517 public static final String IS_PRIMARY = "is_primary";
518
519 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700520 * Whether this is the primary entry of its kind for the aggregate
521 * contact it belongs to. Any data record that is "super primary" must
522 * also be "primary".
Evan Millarab5742d2009-06-02 16:21:45 -0700523 * <P>Type: INTEGER (if set, non-0 means true)</P>
524 */
525 public static final String IS_SUPER_PRIMARY = "is_super_primary";
526
Jeff Sharkey28b68e52009-06-10 15:26:58 -0700527 /**
Fred Quintanac933fb62009-06-11 12:14:40 -0700528 * The version of this data record. This is a read-only value. The data column is
529 * guaranteed to not change without the version going up. This value is monotonically
530 * increasing.
531 * <P>Type: INTEGER</P>
532 */
533 public static final String DATA_VERSION = "data_version";
534
Evan Millar088b2912009-05-28 15:24:37 -0700535 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
536 public static final String DATA1 = "data1";
537 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
538 public static final String DATA2 = "data2";
539 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
540 public static final String DATA3 = "data3";
541 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
542 public static final String DATA4 = "data4";
543 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
544 public static final String DATA5 = "data5";
545 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
546 public static final String DATA6 = "data6";
547 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
548 public static final String DATA7 = "data7";
549 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
550 public static final String DATA8 = "data8";
551 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
552 public static final String DATA9 = "data9";
553 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
554 public static final String DATA10 = "data10";
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700555 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
556 public static final String DATA11 = "data11";
557 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
558 public static final String DATA12 = "data12";
559 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
560 public static final String DATA13 = "data13";
561 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
562 public static final String DATA14 = "data14";
563 /** Generic data column, the meaning is {@link #MIMETYPE} specific */
564 public static final String DATA15 = "data15";
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700565
Fred Quintana8851e162009-08-05 21:06:45 -0700566 /** Generic column for use by sync adapters. */
567 public static final String SYNC1 = "data_sync1";
568 /** Generic column for use by sync adapters. */
569 public static final String SYNC2 = "data_sync2";
570 /** Generic column for use by sync adapters. */
571 public static final String SYNC3 = "data_sync3";
572 /** Generic column for use by sync adapters. */
573 public static final String SYNC4 = "data_sync4";
574
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700575 /**
Dmitri Plotnikov507f1602009-08-10 17:37:36 -0700576 * An optional insert, update or delete URI parameter that determines if
577 * the corresponding raw contact should be marked as dirty. The default
Dmitri Plotnikov91e4e852009-08-03 18:06:29 -0700578 * value is true.
579 */
580 public static final String MARK_AS_DIRTY = "mark_as_dirty";
Evan Millar088b2912009-05-28 15:24:37 -0700581 }
582
583 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700584 * Constants for the data table, which contains data points tied to a raw contact.
Evan Millar088b2912009-05-28 15:24:37 -0700585 * For example, a phone number or email address. Each row in this table contains a type
586 * definition and some generic columns. Each data type can define the meaning for each of
587 * the generic columns.
588 */
Fred Quintana8851e162009-08-05 21:06:45 -0700589 public static final class Data implements BaseColumns, DataColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700590 /**
591 * This utility class cannot be instantiated
592 */
593 private Data() {}
594
595 /**
596 * The content:// style URI for this table
597 */
598 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data");
599
600 /**
601 * The MIME type of {@link #CONTENT_URI} providing a directory of data.
602 */
603 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/data";
604 }
605
606 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700607 * A table that represents the result of looking up a phone number, for
608 * example for caller ID. The table joins that data row for the phone number
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700609 * with the raw contact that owns the number. To perform a lookup you must
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700610 * append the number you want to find to {@link #CONTENT_FILTER_URI}.
Evan Millar088b2912009-05-28 15:24:37 -0700611 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700612 public static final class PhoneLookup implements BaseColumns, DataColumns, ContactsColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700613 /**
614 * This utility class cannot be instantiated
615 */
616 private PhoneLookup() {}
617
618 /**
619 * The content:// style URI for this table. Append the phone number you want to lookup
620 * to this URI and query it to perform a lookup. For example:
621 *
622 * {@code
623 * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber);
624 * }
625 */
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700626 public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI,
627 "phone_lookup");
628 }
629
630 /**
631 * Additional data mixed in with {@link Im.CommonPresenceColumns} to link
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700632 * back to specific {@link ContactsContract.Contacts#_ID} entries.
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700633 */
634 private interface PresenceColumns {
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700635
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700636 /**
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700637 * The unique ID for a row.
638 * <P>Type: INTEGER (long)</P>
639 */
640 public static final String _ID = "presence_id";
641
642 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700643 * Reference to the {@link RawContacts#_ID} this presence references.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700644 * <P>Type: INTEGER</P>
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700645 */
Dmitri Plotnikovd4e0b572009-08-06 20:19:29 -0700646 public static final String RAW_CONTACT_ID = "presence_raw_contact_id";
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700647
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700648 /**
649 * Reference to the {@link Data#_ID} entry that owns this presence.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700650 * <P>Type: INTEGER</P>
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700651 */
Dmitri Plotnikovd4e0b572009-08-06 20:19:29 -0700652 public static final String DATA_ID = "presence_data_id";
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700653
654 /**
655 * The IM service the presence is coming from. Formatted using either
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700656 * {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)} or
657 * {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.
658 * <P>Type: TEXT</P>
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700659 */
660 public static final String IM_PROTOCOL = "im_protocol";
661
662 /**
663 * The IM handle the presence item is for. The handle is scoped to the
664 * {@link #IM_PROTOCOL}.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700665 * <P>Type: TEXT</P>
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700666 */
667 public static final String IM_HANDLE = "im_handle";
668
669 /**
670 * The IM account for the local user that the presence data came from.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700671 * <P>Type: TEXT</P>
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700672 */
673 public static final String IM_ACCOUNT = "im_account";
674 }
675
Dmitri Plotnikov55048a92009-07-24 10:25:34 -0700676 public static final class Presence implements PresenceColumns, Im.CommonPresenceColumns {
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700677 /**
678 * This utility class cannot be instantiated
679 */
680 private Presence() {
681 }
682
683 /**
684 * The content:// style URI for this table
685 */
686 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence");
687
688 /**
689 * Gets the resource ID for the proper presence icon.
690 *
691 * @param status the status to get the icon for
692 * @return the resource ID for the proper presence icon
693 */
694 public static final int getPresenceIconResourceId(int status) {
695 switch (status) {
696 case AVAILABLE:
697 return android.R.drawable.presence_online;
698 case IDLE:
699 case AWAY:
700 return android.R.drawable.presence_away;
701 case DO_NOT_DISTURB:
702 return android.R.drawable.presence_busy;
703 case INVISIBLE:
704 return android.R.drawable.presence_invisible;
705 case OFFLINE:
706 default:
707 return android.R.drawable.presence_offline;
708 }
709 }
710
711 /**
Evan Millarc0437522009-06-23 17:31:05 -0700712 * Returns the precedence of the status code the higher number being the higher precedence.
713 *
714 * @param status The status code.
715 * @return An integer representing the precedence, 0 being the lowest.
716 */
717 public static final int getPresencePrecedence(int status) {
718 // Keep this function here incase we want to enforce a different precedence than the
719 // natural order of the status constants.
720 return status;
721 }
722
723 /**
Jeff Sharkeyd530b3c2009-06-01 20:23:57 -0700724 * The MIME type of {@link #CONTENT_URI} providing a directory of
725 * presence details.
726 */
727 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/im-presence";
728
729 /**
730 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
731 * presence detail.
732 */
733 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im-presence";
Evan Millar088b2912009-05-28 15:24:37 -0700734 }
735
736 /**
737 * Container for definitions of common data types stored in the {@link Data} table.
738 */
739 public static final class CommonDataKinds {
740 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700741 * The {@link Data#RES_PACKAGE} value for common data that should be
742 * shown using a default style.
Evan Millar088b2912009-05-28 15:24:37 -0700743 */
744 public static final String PACKAGE_COMMON = "common";
745
746 /**
747 * Columns common across the specific types.
748 */
749 private interface BaseCommonColumns {
750 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700751 * The package name to use when creating {@link Resources} objects for
752 * this data row. This value is only designed for use when building user
753 * interfaces, and should not be used to infer the owner.
Evan Millar088b2912009-05-28 15:24:37 -0700754 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700755 public static final String RES_PACKAGE = "res_package";
Evan Millar088b2912009-05-28 15:24:37 -0700756
757 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700758 * The MIME type of the item represented by this row.
Evan Millar088b2912009-05-28 15:24:37 -0700759 */
760 public static final String MIMETYPE = "mimetype";
761
762 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700763 * The {@link RawContacts#_ID} that this data belongs to.
Evan Millar088b2912009-05-28 15:24:37 -0700764 */
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -0700765 public static final String RAW_CONTACT_ID = "raw_contact_id";
Evan Millar088b2912009-05-28 15:24:37 -0700766 }
767
768 /**
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700769 * The base types that all "Typed" data kinds support.
770 */
771 public interface BaseTypes {
772
773 /**
774 * A custom type. The custom label should be supplied by user.
775 */
776 public static int TYPE_CUSTOM = 0;
777 }
778
779 /**
Evan Millar088b2912009-05-28 15:24:37 -0700780 * Columns common across the specific types.
781 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700782 private interface CommonColumns extends BaseTypes{
Evan Millar088b2912009-05-28 15:24:37 -0700783 /**
784 * The type of data, for example Home or Work.
785 * <P>Type: INTEGER</P>
786 */
787 public static final String TYPE = "data1";
788
789 /**
Evan Millar088b2912009-05-28 15:24:37 -0700790 * The data for the contact method.
791 * <P>Type: TEXT</P>
792 */
Dmitri Plotnikovc9260542009-05-28 17:55:12 -0700793 public static final String DATA = "data2";
794
795 /**
796 * The user defined label for the the contact method.
797 * <P>Type: TEXT</P>
798 */
799 public static final String LABEL = "data3";
Evan Millar088b2912009-05-28 15:24:37 -0700800 }
801
802 /**
803 * Parts of the name.
804 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700805 public static final class StructuredName implements BaseCommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700806 private StructuredName() {}
807
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700808 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -0700809 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name";
810
811 /**
Evan Millar088b2912009-05-28 15:24:37 -0700812 * The given name for the contact.
813 * <P>Type: TEXT</P>
814 */
Dmitri Plotnikovc9260542009-05-28 17:55:12 -0700815 public static final String GIVEN_NAME = "data1";
Evan Millar088b2912009-05-28 15:24:37 -0700816
817 /**
818 * The family name for the contact.
819 * <P>Type: TEXT</P>
820 */
Dmitri Plotnikovc9260542009-05-28 17:55:12 -0700821 public static final String FAMILY_NAME = "data2";
822
823 /**
824 * The contact's honorific prefix, e.g. "Sir"
825 * <P>Type: TEXT</P>
826 */
827 public static final String PREFIX = "data3";
828
829 /**
830 * The contact's middle name
831 * <P>Type: TEXT</P>
832 */
833 public static final String MIDDLE_NAME = "data4";
Evan Millar088b2912009-05-28 15:24:37 -0700834
835 /**
836 * The contact's honorific suffix, e.g. "Jr"
837 */
838 public static final String SUFFIX = "data5";
839
840 /**
841 * The phonetic version of the given name for the contact.
842 * <P>Type: TEXT</P>
843 */
844 public static final String PHONETIC_GIVEN_NAME = "data6";
845
846 /**
847 * The phonetic version of the additional name for the contact.
848 * <P>Type: TEXT</P>
849 */
850 public static final String PHONETIC_MIDDLE_NAME = "data7";
851
852 /**
853 * The phonetic version of the family name for the contact.
854 * <P>Type: TEXT</P>
855 */
856 public static final String PHONETIC_FAMILY_NAME = "data8";
857
858 /**
859 * The name that should be used to display the contact.
860 * <P>Type: TEXT</P>
861 */
862 public static final String DISPLAY_NAME = "data9";
863 }
864
865 /**
866 * A nickname.
867 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700868 public static final class Nickname implements CommonColumns, BaseCommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700869 private Nickname() {}
870
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700871 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -0700872 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname";
873
Evan Millar78e79ad2009-06-08 10:24:44 -0700874 public static final int TYPE_DEFAULT = 1;
875 public static final int TYPE_OTHER_NAME = 2;
876 public static final int TYPE_MAINDEN_NAME = 3;
877 public static final int TYPE_SHORT_NAME = 4;
878 public static final int TYPE_INITIALS = 5;
Evan Millar088b2912009-05-28 15:24:37 -0700879
880 /**
Dmitri Plotnikovc9260542009-05-28 17:55:12 -0700881 * The name itself
882 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700883 public static final String NAME = DATA;
Evan Millar088b2912009-05-28 15:24:37 -0700884 }
885
886 /**
887 * Common data definition for telephone numbers.
888 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700889 public static final class Phone implements BaseCommonColumns, CommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700890 private Phone() {}
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/phone";
894
Evan Millar161dd862009-06-12 16:02:43 -0700895 /**
896 * The MIME type of {@link #CONTENT_URI} providing a directory of
897 * phones.
898 */
899 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone";
900
901 /**
902 * The content:// style URI for all data records of the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700903 * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700904 * associated raw contact and aggregate contact data.
Evan Millar161dd862009-06-12 16:02:43 -0700905 */
906 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
907 "phones");
908
909 /**
910 * The content:// style URI for filtering data records of the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700911 * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -0700912 * associated raw contact and aggregate contact data. The filter argument should
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700913 * be passed as an additional path segment after this URI.
Evan Millar161dd862009-06-12 16:02:43 -0700914 */
915 public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI,
916 "filter");
917
Evan Millar088b2912009-05-28 15:24:37 -0700918 public static final int TYPE_HOME = 1;
919 public static final int TYPE_MOBILE = 2;
920 public static final int TYPE_WORK = 3;
921 public static final int TYPE_FAX_WORK = 4;
922 public static final int TYPE_FAX_HOME = 5;
923 public static final int TYPE_PAGER = 6;
924 public static final int TYPE_OTHER = 7;
Fred Quintana3f867152009-08-03 11:43:16 -0700925 public static final int TYPE_CALLBACK = 8;
926 public static final int TYPE_CAR = 9;
927 public static final int TYPE_COMPANY_MAIN = 10;
928 public static final int TYPE_ISDN = 11;
929 public static final int TYPE_MAIN = 12;
930 public static final int TYPE_OTHER_FAX = 13;
931 public static final int TYPE_RADIO = 14;
932 public static final int TYPE_TELEX = 15;
933 public static final int TYPE_TTY_TDD = 16;
934 public static final int TYPE_WORK_MOBILE = 17;
935 public static final int TYPE_WORK_PAGER = 18;
936 public static final int TYPE_ASSISTANT = 19;
Evan Millar088b2912009-05-28 15:24:37 -0700937
938 /**
939 * The phone number as the user entered it.
940 * <P>Type: TEXT</P>
941 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700942 public static final String NUMBER = DATA;
Evan Millar088b2912009-05-28 15:24:37 -0700943 }
944
945 /**
946 * Common data definition for email addresses.
947 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -0700948 public static final class Email implements BaseCommonColumns, CommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -0700949 private Email() {}
950
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700951 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -0700952 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email";
953
Dmitri Plotnikovd4e0b572009-08-06 20:19:29 -0700954 /**
955 * The content:// style URI for all data records of the
956 * {@link Email#CONTENT_ITEM_TYPE} MIME type, combined with the
957 * associated raw contact and aggregate contact data.
958 */
959 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
960 "emails");
961
962 /**
963 * The content:// style URL for filtering data rows by email address. The
964 * filter argument should be passed as an additional path segment after
965 * this URI.
966 */
967 public static final Uri CONTENT_FILTER_EMAIL_URI = Uri.withAppendedPath(CONTENT_URI,
968 "filter");
969
Evan Millar088b2912009-05-28 15:24:37 -0700970 public static final int TYPE_HOME = 1;
971 public static final int TYPE_WORK = 2;
972 public static final int TYPE_OTHER = 3;
Fred Quintana8851e162009-08-05 21:06:45 -0700973
974 /**
975 * The display name for the email address
976 * <P>Type: TEXT</P>
977 */
978 public static final String DISPLAY_NAME = "data4";
Evan Millar088b2912009-05-28 15:24:37 -0700979 }
980
981 /**
982 * Common data definition for postal addresses.
983 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700984 public static final class StructuredPostal implements BaseCommonColumns, CommonColumns {
985 private StructuredPostal() {
986 }
Evan Millar088b2912009-05-28 15:24:37 -0700987
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700988 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -0700989 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/postal-address";
990
Evan Millar161dd862009-06-12 16:02:43 -0700991 /**
992 * The MIME type of {@link #CONTENT_URI} providing a directory of
993 * postal addresses.
994 */
995 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address";
996
997 /**
998 * The content:// style URI for all data records of the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -0700999 * {@link StructuredPostal#CONTENT_ITEM_TYPE} MIME type.
Evan Millar161dd862009-06-12 16:02:43 -07001000 */
1001 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
1002 "postals");
1003
Evan Millar088b2912009-05-28 15:24:37 -07001004 public static final int TYPE_HOME = 1;
1005 public static final int TYPE_WORK = 2;
1006 public static final int TYPE_OTHER = 3;
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001007
1008 /**
1009 * The full, unstructured postal address.
1010 * <p>
1011 * Type: TEXT
1012 */
1013 public static final String FORMATTED_ADDRESS = DATA;
1014
1015 /**
1016 * The agent who actually receives the mail. Used in work addresses.
1017 * Also for 'in care of' or 'c/o'.
1018 * <p>
1019 * Type: TEXT
1020 */
1021 public static final String AGENT = "data4";
1022
1023 /**
1024 * Used in places where houses or buildings have names (and not
1025 * necessarily numbers), eg. "The Pillars".
1026 * <p>
1027 * Type: TEXT
1028 */
1029 public static final String HOUSENAME = "data5";
1030
1031 /**
1032 * Can be street, avenue, road, etc. This element also includes the
1033 * house number and room/apartment/flat/floor number.
1034 * <p>
1035 * Type: TEXT
1036 */
1037 public static final String STREET = "data6";
1038
1039 /**
1040 * Covers actual P.O. boxes, drawers, locked bags, etc. This is
1041 * usually but not always mutually exclusive with street.
1042 * <p>
1043 * Type: TEXT
1044 */
1045 public static final String POBOX = "data7";
1046
1047 /**
1048 * This is used to disambiguate a street address when a city
1049 * contains more than one street with the same name, or to specify a
1050 * small place whose mail is routed through a larger postal town. In
1051 * China it could be a county or a minor city.
1052 * <p>
1053 * Type: TEXT
1054 */
Jeff Sharkeyef348c72009-07-26 14:14:34 -07001055 public static final String NEIGHBORHOOD = "data8";
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001056
1057 /**
1058 * Can be city, village, town, borough, etc. This is the postal town
1059 * and not necessarily the place of residence or place of business.
1060 * <p>
1061 * Type: TEXT
1062 */
1063 public static final String CITY = "data9";
1064
1065 /**
1066 * Handles administrative districts such as U.S. or U.K. counties
1067 * that are not used for mail addressing purposes. Subregion is not
1068 * intended for delivery addresses.
1069 * <p>
1070 * Type: TEXT
1071 */
1072 public static final String SUBREGION = "data10";
1073
1074 /**
1075 * A state, province, county (in Ireland), Land (in Germany),
1076 * departement (in France), etc.
1077 * <p>
1078 * Type: TEXT
1079 */
1080 public static final String REGION = "data11";
1081
1082 /**
Jeff Sharkeyef348c72009-07-26 14:14:34 -07001083 * Postal code. Usually country-wide, but sometimes specific to the
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001084 * city (e.g. "2" in "Dublin 2, Ireland" addresses).
1085 * <p>
1086 * Type: TEXT
1087 */
1088 public static final String POSTCODE = "data12";
1089
1090 /**
1091 * The name or code of the country.
1092 * <p>
1093 * Type: TEXT
1094 */
1095 public static final String COUNTRY = "data13";
Evan Millar088b2912009-05-28 15:24:37 -07001096 }
1097
Fred Quintana8851e162009-08-05 21:06:45 -07001098 /**
1099 * Common data definition for IM addresses.
1100 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -07001101 public static final class Im implements BaseCommonColumns, CommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -07001102 private Im() {}
1103
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001104 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -07001105 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im";
1106
Evan Millar088b2912009-05-28 15:24:37 -07001107 public static final int TYPE_HOME = 1;
1108 public static final int TYPE_WORK = 2;
1109 public static final int TYPE_OTHER = 3;
Dmitri Plotnikov56927772009-05-28 17:23:39 -07001110
Evan Millar088b2912009-05-28 15:24:37 -07001111 public static final String PROTOCOL = "data5";
Dmitri Plotnikov56927772009-05-28 17:23:39 -07001112
Jeff Sharkey732da922009-07-30 09:59:31 -07001113 public static final String CUSTOM_PROTOCOL = "data6";
1114
Evan Millar088b2912009-05-28 15:24:37 -07001115 /**
1116 * The predefined IM protocol types. The protocol can either be non-present, one
1117 * of these types, or a free-form string. These cases are encoded in the PROTOCOL
1118 * column as:
Dmitri Plotnikovc9260542009-05-28 17:55:12 -07001119 * <ul>
1120 * <li>null</li>
1121 * <li>pre:&lt;an integer, one of the protocols below&gt;</li>
1122 * <li>custom:&lt;a string&gt;</li>
1123 * </ul>
Evan Millar088b2912009-05-28 15:24:37 -07001124 */
Jeff Sharkey732da922009-07-30 09:59:31 -07001125 public static final int PROTOCOL_CUSTOM = -1;
Evan Millar088b2912009-05-28 15:24:37 -07001126 public static final int PROTOCOL_AIM = 0;
1127 public static final int PROTOCOL_MSN = 1;
1128 public static final int PROTOCOL_YAHOO = 2;
1129 public static final int PROTOCOL_SKYPE = 3;
1130 public static final int PROTOCOL_QQ = 4;
1131 public static final int PROTOCOL_GOOGLE_TALK = 5;
1132 public static final int PROTOCOL_ICQ = 6;
1133 public static final int PROTOCOL_JABBER = 7;
Fred Quintana8851e162009-08-05 21:06:45 -07001134 public static final int PROTOCOL_NETMEETING = 8;
Evan Millar088b2912009-05-28 15:24:37 -07001135 }
1136
1137 /**
1138 * Common data definition for organizations.
1139 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -07001140 public static final class Organization implements BaseCommonColumns, CommonColumns {
Evan Millar088b2912009-05-28 15:24:37 -07001141 private Organization() {}
1142
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001143 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -07001144 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization";
1145
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -07001146 public static final int TYPE_WORK = 1;
1147 public static final int TYPE_OTHER = 2;
Evan Millar088b2912009-05-28 15:24:37 -07001148
1149 /**
1150 * The company as the user entered it.
1151 * <P>Type: TEXT</P>
1152 */
Dmitri Plotnikov761ef2a2009-07-17 10:51:06 -07001153 public static final String COMPANY = DATA;
Evan Millar088b2912009-05-28 15:24:37 -07001154
1155 /**
1156 * The position title at this company as the user entered it.
1157 * <P>Type: TEXT</P>
1158 */
1159 public static final String TITLE = "data4";
Fred Quintana8851e162009-08-05 21:06:45 -07001160
1161 /**
1162 * The department at this company as the user entered it.
1163 * <P>Type: TEXT</P>
1164 */
1165 public static final String DEPARTMENT = "data5";
1166
1167 /**
1168 * The job description at this company as the user entered it.
1169 * <P>Type: TEXT</P>
1170 */
1171 public static final String JOB_DESCRIPTION = "data6";
1172
1173 /**
1174 * The symbol of this company as the user entered it.
1175 * <P>Type: TEXT</P>
1176 */
1177 public static final String SYMBOL = "data7";
1178
1179 /**
1180 * The phonetic name of this company as the user entered it.
1181 * <P>Type: TEXT</P>
1182 */
1183 public static final String PHONETIC_NAME = "data8";
1184 }
1185
1186 /**
1187 * Common data definition for miscellaneous information.
1188 */
1189 public static final class Miscellaneous implements BaseCommonColumns {
1190 private Miscellaneous() {}
1191
1192 /** MIME type used when storing this in data table. */
1193 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/misc";
1194
1195 /**
1196 * The birthday as the user entered it.
1197 * <P>Type: TEXT</P>
1198 */
1199 public static final String BIRTHDAY = "data1";
1200
1201 /**
1202 * The nickname as the user entered it.
1203 * <P>Type: TEXT</P>
1204 */
1205 public static final String NICKNAME = "data2";
1206 }
1207
1208 /**
1209 * Common data definition for relations.
1210 */
1211 public static final class Relation implements BaseCommonColumns, CommonColumns {
1212 private Relation() {}
1213
1214 /** MIME type used when storing this in data table. */
1215 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/relation";
1216
1217 public static final int TYPE_ASSISTANT = 1;
1218 public static final int TYPE_BROTHER = 2;
1219 public static final int TYPE_CHILD = 3;
1220 public static final int TYPE_DOMESTIC_PARTNER = 4;
1221 public static final int TYPE_FATHER = 5;
1222 public static final int TYPE_FRIEND = 6;
1223 public static final int TYPE_MANAGER = 7;
1224 public static final int TYPE_MOTHER = 8;
1225 public static final int TYPE_PARENT = 9;
1226 public static final int TYPE_PARTNER = 10;
1227 public static final int TYPE_REFERRED_BY = 11;
1228 public static final int TYPE_RELATIVE = 12;
1229 public static final int TYPE_SISTER = 13;
1230 public static final int TYPE_SPOUSE = 14;
1231
1232 /**
1233 * The name of the relative as the user entered it.
1234 * <P>Type: TEXT</P>
1235 */
1236 public static final String NAME = DATA;
1237 }
1238
1239 /**
1240 * Common data definition for events.
1241 */
1242 public static final class Event implements BaseCommonColumns, CommonColumns {
1243 private Event() {}
1244
1245 /** MIME type used when storing this in data table. */
1246 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/event";
1247
1248 public static final int TYPE_ANNIVERSARY = 1;
1249 public static final int TYPE_OTHER = 2;
Dmitri Plotnikovd4e0b572009-08-06 20:19:29 -07001250
Fred Quintana8851e162009-08-05 21:06:45 -07001251 /**
1252 * The event start date as the user entered it.
1253 * <P>Type: TEXT</P>
1254 */
1255 public static final String START_DATE = DATA;
Evan Millar088b2912009-05-28 15:24:37 -07001256 }
1257
1258 /**
1259 * Photo of the contact.
1260 */
1261 public static final class Photo implements BaseCommonColumns {
1262 private Photo() {}
1263
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001264 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -07001265 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo";
1266
1267 /**
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -07001268 * Thumbnail photo of the raw contact. This is the raw bytes of an image
Evan Millar088b2912009-05-28 15:24:37 -07001269 * that could be inflated using {@link BitmapFactory}.
1270 * <p>
1271 * Type: BLOB
1272 */
1273 public static final String PHOTO = "data1";
1274 }
1275
1276 /**
1277 * Notes about the contact.
1278 */
1279 public static final class Note implements BaseCommonColumns {
1280 private Note() {}
1281
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001282 /** MIME type used when storing this in data table. */
Evan Millar088b2912009-05-28 15:24:37 -07001283 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note";
1284
1285 /**
1286 * The note text.
1287 * <P>Type: TEXT</P>
1288 */
1289 public static final String NOTE = "data1";
1290 }
Dmitri Plotnikov56927772009-05-28 17:23:39 -07001291
Dmitri Plotnikovc9260542009-05-28 17:55:12 -07001292 /**
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001293 * Group Membership.
Dmitri Plotnikovceaafa52009-06-03 10:46:44 -07001294 */
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001295 public static final class GroupMembership implements BaseCommonColumns {
1296 private GroupMembership() {}
Dmitri Plotnikovceaafa52009-06-03 10:46:44 -07001297
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001298 /** MIME type used when storing this in data table. */
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001299 public static final String CONTENT_ITEM_TYPE =
1300 "vnd.android.cursor.item/group_membership";
Dmitri Plotnikovceaafa52009-06-03 10:46:44 -07001301
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001302 /**
Fred Quintanaffc34c12009-07-14 16:02:58 -07001303 * The row id of the group that this group membership refers to. Exactly one of
1304 * this or {@link #GROUP_SOURCE_ID} must be set when inserting a row.
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001305 * <P>Type: INTEGER</P>
1306 */
1307 public static final String GROUP_ROW_ID = "data1";
Dmitri Plotnikovceaafa52009-06-03 10:46:44 -07001308
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001309 /**
Fred Quintanaffc34c12009-07-14 16:02:58 -07001310 * The sourceid of the group that this group membership refers to. Exactly one of
1311 * this or {@link #GROUP_ROW_ID} must be set when inserting a row.
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001312 * <P>Type: TEXT</P>
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001313 */
Fred Quintanaffc34c12009-07-14 16:02:58 -07001314 public static final String GROUP_SOURCE_ID = "group_sourceid";
Fred Quintanad8dfeb52009-06-04 10:28:49 -07001315 }
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001316
1317 /**
1318 * Website related to the contact.
1319 */
Fred Quintana8851e162009-08-05 21:06:45 -07001320 public static final class Website implements BaseCommonColumns, CommonColumns {
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001321 private Website() {}
1322
1323 /** MIME type used when storing this in data table. */
1324 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website";
1325
Fred Quintana8851e162009-08-05 21:06:45 -07001326 public static final int TYPE_HOMEPAGE = 1;
1327 public static final int TYPE_BLOG = 2;
1328 public static final int TYPE_PROFILE = 3;
1329 public static final int TYPE_HOME = 4;
1330 public static final int TYPE_WORK = 5;
1331 public static final int TYPE_FTP = 6;
1332 public static final int TYPE_OTHER = 7;
1333
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001334 /**
1335 * The website URL string.
1336 * <P>Type: TEXT</P>
1337 */
1338 public static final String URL = "data1";
1339 }
Dmitri Plotnikovceaafa52009-06-03 10:46:44 -07001340 }
Fred Quintana435e4272009-06-04 17:30:28 -07001341
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001342 public interface GroupsColumns {
1343 /**
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001344 * The display title of this group.
1345 * <p>
1346 * Type: TEXT
1347 */
1348 public static final String TITLE = "title";
1349
1350 /**
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001351 * The package name to use when creating {@link Resources} objects for
1352 * this group. This value is only designed for use when building user
1353 * interfaces, and should not be used to infer the owner.
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001354 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001355 public static final String RES_PACKAGE = "res_package";
1356
1357 /**
1358 * The display title of this group to load as a resource from
1359 * {@link #RES_PACKAGE}, which may be localized.
1360 * <P>Type: TEXT</P>
1361 */
1362 public static final String TITLE_RES = "title_res";
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001363
1364 /**
Dmitri Plotnikov02c5b452009-07-22 15:13:08 -07001365 * Notes about the group.
1366 * <p>
1367 * Type: TEXT
1368 */
1369 public static final String NOTES = "notes";
1370
1371 /**
1372 * The ID of this group if it is a System Group, i.e. a group that has a special meaning
1373 * to the sync adapter, null otherwise.
1374 * <P>Type: TEXT</P>
1375 */
1376 public static final String SYSTEM_ID = "system_id";
1377
1378 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001379 * The total number of {@link Contacts} that have
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001380 * {@link GroupMembership} in this group. Read-only value that is only
1381 * present when querying {@link Groups#CONTENT_SUMMARY_URI}.
1382 * <p>
1383 * Type: INTEGER
1384 */
1385 public static final String SUMMARY_COUNT = "summ_count";
1386
1387 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001388 * The total number of {@link Contacts} that have both
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001389 * {@link GroupMembership} in this group, and also have phone numbers.
1390 * Read-only value that is only present when querying
1391 * {@link Groups#CONTENT_SUMMARY_URI}.
1392 * <p>
1393 * Type: INTEGER
1394 */
1395 public static final String SUMMARY_WITH_PHONES = "summ_phones";
1396
1397 /**
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001398 * Flag indicating if the contacts belonging to this group should be
1399 * visible in any user interface.
1400 * <p>
1401 * Type: INTEGER
1402 */
1403 public static final String GROUP_VISIBLE = "group_visible";
Fred Quintana00c89f62009-08-10 14:43:24 -07001404
1405 /**
1406 * The "deleted" flag: "0" by default, "1" if the row has been marked
1407 * for deletion. When {@link android.content.ContentResolver#delete} is
1408 * called on a raw contact, it is marked for deletion and removed from its
1409 * aggregate contact. The sync adaptor deletes the raw contact on the server and
1410 * then calls ContactResolver.delete once more, this time passing the
1411 * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal.
1412 * <P>Type: INTEGER</P>
1413 */
1414 public static final String DELETED = "deleted";
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001415 }
1416
1417 /**
1418 * Constants for the groups table.
1419 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001420 public static final class Groups implements BaseColumns, GroupsColumns, SyncColumns {
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001421 /**
1422 * This utility class cannot be instantiated
1423 */
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001424 private Groups() {
1425 }
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001426
1427 /**
1428 * The content:// style URI for this table
1429 */
1430 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "groups");
1431
1432 /**
1433 * The content:// style URI for this table joined with details data from
Dmitri Plotnikov02c5b452009-07-22 15:13:08 -07001434 * {@link Data}.
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001435 */
1436 public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI,
1437 "groups_summary");
1438
1439 /**
1440 * The MIME type of a directory of groups.
1441 */
1442 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/group";
1443
1444 /**
1445 * The MIME type of a single group.
1446 */
1447 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group";
Fred Quintana00c89f62009-08-10 14:43:24 -07001448
1449 /**
1450 * Query parameter that can be passed with the {@link #CONTENT_URI} URI
1451 * to the {@link android.content.ContentResolver#delete} method to
1452 * indicate that the raw contact can be deleted physically, rather than
1453 * merely marked as deleted.
1454 */
1455 public static final String DELETE_PERMANENTLY = "delete_permanently";
Dmitri Plotnikov507f1602009-08-10 17:37:36 -07001456
1457 /**
1458 * An optional update or insert URI parameter that determines if the
1459 * group should be marked as dirty. The default value is true.
1460 */
1461 public static final String MARK_AS_DIRTY = "mark_as_dirty";
Jeff Sharkeyb2909eb2009-06-16 16:55:31 -07001462 }
1463
Fred Quintana435e4272009-06-04 17:30:28 -07001464 /**
1465 * Constants for the contact aggregation exceptions table, which contains
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001466 * aggregation rules overriding those used by automatic aggregation. This type only
1467 * supports query and update. Neither insert nor delete are supported.
Fred Quintana435e4272009-06-04 17:30:28 -07001468 */
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -07001469 public static final class AggregationExceptions implements BaseColumns {
Fred Quintana435e4272009-06-04 17:30:28 -07001470 /**
1471 * This utility class cannot be instantiated
1472 */
1473 private AggregationExceptions() {}
1474
1475 /**
1476 * The content:// style URI for this table
1477 */
1478 public static final Uri CONTENT_URI =
1479 Uri.withAppendedPath(AUTHORITY_URI, "aggregation_exceptions");
1480
1481 /**
1482 * The MIME type of {@link #CONTENT_URI} providing a directory of data.
1483 */
1484 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception";
1485
1486 /**
Dmitri Plotnikov0918bf02009-06-10 16:13:08 -07001487 * The MIME type of a {@link #CONTENT_URI} subdirectory of an aggregation exception
1488 */
1489 public static final String CONTENT_ITEM_TYPE =
1490 "vnd.android.cursor.item/aggregation_exception";
1491
1492 /**
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001493 * The type of exception: {@link #TYPE_KEEP_IN}, {@link #TYPE_KEEP_OUT} or
1494 * {@link #TYPE_AUTOMATIC}.
Fred Quintana435e4272009-06-04 17:30:28 -07001495 *
1496 * <P>Type: INTEGER</P>
1497 */
1498 public static final String TYPE = "type";
1499
Fred Quintana435e4272009-06-04 17:30:28 -07001500 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001501 * Allows the provider to automatically decide whether the aggregate
1502 * contact should include a particular raw contact or not.
Fred Quintana435e4272009-06-04 17:30:28 -07001503 */
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001504 public static final int TYPE_AUTOMATIC = 0;
Fred Quintana435e4272009-06-04 17:30:28 -07001505
1506 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001507 * Makes sure that the specified raw contact is included in the
1508 * specified aggregate contact.
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001509 */
1510 public static final int TYPE_KEEP_IN = 1;
1511
1512 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001513 * Makes sure that the specified raw contact is NOT included in the
1514 * specified aggregate contact.
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001515 */
1516 public static final int TYPE_KEEP_OUT = 2;
1517
1518 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001519 * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} of the
1520 * aggregate contact that the rule applies to.
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001521 */
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001522 public static final String CONTACT_ID = "contact_id";
Dmitri Plotnikov9d044512009-06-16 13:21:23 -07001523
1524 /**
Dmitri Plotnikov7cca5f82009-07-27 20:25:59 -07001525 * A reference to the {@link RawContacts#_ID} of the raw contact that the rule applies to.
Fred Quintana435e4272009-06-04 17:30:28 -07001526 */
Dmitri Plotnikovfacbbb32009-07-27 15:18:19 -07001527 public static final String RAW_CONTACT_ID = "raw_contact_id";
Fred Quintana435e4272009-06-04 17:30:28 -07001528 }
Jeff Sharkey28b68e52009-06-10 15:26:58 -07001529
Evan Millardc2da5f2009-06-18 16:07:13 -07001530 /**
1531 * Contains helper classes used to create or manage {@link android.content.Intent Intents}
1532 * that involve contacts.
1533 */
1534 public static final class Intents {
1535 /**
1536 * This is the intent that is fired when a search suggestion is clicked on.
1537 */
1538 public static final String SEARCH_SUGGESTION_CLICKED =
1539 "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED";
1540
1541 /**
1542 * This is the intent that is fired when a search suggestion for dialing a number
1543 * is clicked on.
1544 */
1545 public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED =
1546 "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED";
1547
1548 /**
1549 * This is the intent that is fired when a search suggestion for creating a contact
1550 * is clicked on.
1551 */
1552 public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED =
1553 "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED";
1554
1555 /**
1556 * Starts an Activity that lets the user pick a contact to attach an image to.
1557 * After picking the contact it launches the image cropper in face detection mode.
1558 */
1559 public static final String ATTACH_IMAGE =
1560 "com.android.contacts.action.ATTACH_IMAGE";
1561
1562 /**
1563 * Takes as input a data URI with a mailto: or tel: scheme. If a single
1564 * contact exists with the given data it will be shown. If no contact
1565 * exists, a dialog will ask the user if they want to create a new
1566 * contact with the provided details filled in. If multiple contacts
1567 * share the data the user will be prompted to pick which contact they
1568 * want to view.
1569 * <p>
1570 * For <code>mailto:</code> URIs, the scheme specific portion must be a
1571 * raw email address, such as one built using
1572 * {@link Uri#fromParts(String, String, String)}.
1573 * <p>
1574 * For <code>tel:</code> URIs, the scheme specific portion is compared
1575 * to existing numbers using the standard caller ID lookup algorithm.
1576 * The number must be properly encoded, for example using
1577 * {@link Uri#fromParts(String, String, String)}.
1578 * <p>
1579 * Any extras from the {@link Insert} class will be passed along to the
1580 * create activity if there are no contacts to show.
1581 * <p>
1582 * Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip
1583 * prompting the user when the contact doesn't exist.
1584 */
1585 public static final String SHOW_OR_CREATE_CONTACT =
1586 "com.android.contacts.action.SHOW_OR_CREATE_CONTACT";
1587
1588 /**
1589 * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new
1590 * contact if no matching contact found. Otherwise, default behavior is
1591 * to prompt user with dialog before creating.
1592 * <p>
1593 * Type: BOOLEAN
1594 */
1595 public static final String EXTRA_FORCE_CREATE =
1596 "com.android.contacts.action.FORCE_CREATE";
1597
1598 /**
1599 * Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact
1600 * description to be shown when prompting user about creating a new
1601 * contact.
1602 * <p>
1603 * Type: STRING
1604 */
1605 public static final String EXTRA_CREATE_DESCRIPTION =
1606 "com.android.contacts.action.CREATE_DESCRIPTION";
1607
1608 /**
Jeff Sharkey11322002009-06-04 17:25:51 -07001609 * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a
1610 * dialog location using screen coordinates. When not specified, the
1611 * dialog will be centered.
1612 */
1613 public static final String EXTRA_TARGET_RECT = "target_rect";
1614
1615 /**
Jeff Sharkey6bfe14d2009-08-05 15:49:48 -07001616 * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a
1617 * desired dialog style, usually a variation on size. One of
1618 * {@link #MODE_SMALL}, {@link #MODE_MEDIUM}, or {@link #MODE_LARGE}.
1619 */
1620 public static final String EXTRA_MODE = "mode";
1621
1622 /**
1623 * Value for {@link #EXTRA_MODE} to show a small-sized dialog.
1624 */
1625 public static final int MODE_SMALL = 1;
1626
1627 /**
1628 * Value for {@link #EXTRA_MODE} to show a medium-sized dialog.
1629 */
1630 public static final int MODE_MEDIUM = 2;
1631
1632 /**
1633 * Value for {@link #EXTRA_MODE} to show a large-sized dialog.
1634 */
1635 public static final int MODE_LARGE = 3;
1636
1637 /**
Evan Millardc2da5f2009-06-18 16:07:13 -07001638 * Intents related to the Contacts app UI.
1639 */
1640 public static final class UI {
1641 /**
1642 * The action for the default contacts list tab.
1643 */
1644 public static final String LIST_DEFAULT =
1645 "com.android.contacts.action.LIST_DEFAULT";
1646
1647 /**
1648 * The action for the contacts list tab.
1649 */
1650 public static final String LIST_GROUP_ACTION =
1651 "com.android.contacts.action.LIST_GROUP";
1652
1653 /**
1654 * When in LIST_GROUP_ACTION mode, this is the group to display.
1655 */
1656 public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP";
1657
1658 /**
1659 * The action for the all contacts list tab.
1660 */
1661 public static final String LIST_ALL_CONTACTS_ACTION =
1662 "com.android.contacts.action.LIST_ALL_CONTACTS";
1663
1664 /**
1665 * The action for the contacts with phone numbers list tab.
1666 */
1667 public static final String LIST_CONTACTS_WITH_PHONES_ACTION =
1668 "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES";
1669
1670 /**
1671 * The action for the starred contacts list tab.
1672 */
1673 public static final String LIST_STARRED_ACTION =
1674 "com.android.contacts.action.LIST_STARRED";
1675
1676 /**
1677 * The action for the frequent contacts list tab.
1678 */
1679 public static final String LIST_FREQUENT_ACTION =
1680 "com.android.contacts.action.LIST_FREQUENT";
1681
1682 /**
1683 * The action for the "strequent" contacts list tab. It first lists the starred
1684 * contacts in alphabetical order and then the frequent contacts in descending
1685 * order of the number of times they have been contacted.
1686 */
1687 public static final String LIST_STREQUENT_ACTION =
1688 "com.android.contacts.action.LIST_STREQUENT";
1689
1690 /**
1691 * A key for to be used as an intent extra to set the activity
1692 * title to a custom String value.
1693 */
1694 public static final String TITLE_EXTRA_KEY =
1695 "com.android.contacts.extra.TITLE_EXTRA";
1696
1697 /**
1698 * Activity Action: Display a filtered list of contacts
1699 * <p>
1700 * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for
1701 * filtering
1702 * <p>
1703 * Output: Nothing.
1704 */
1705 public static final String FILTER_CONTACTS_ACTION =
1706 "com.android.contacts.action.FILTER_CONTACTS";
1707
1708 /**
1709 * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION}
1710 * intents to supply the text on which to filter.
1711 */
1712 public static final String FILTER_TEXT_EXTRA_KEY =
1713 "com.android.contacts.extra.FILTER_TEXT";
1714 }
1715
1716 /**
1717 * Convenience class that contains string constants used
1718 * to create contact {@link android.content.Intent Intents}.
1719 */
1720 public static final class Insert {
1721 /** The action code to use when adding a contact */
1722 public static final String ACTION = Intent.ACTION_INSERT;
1723
1724 /**
1725 * If present, forces a bypass of quick insert mode.
1726 */
1727 public static final String FULL_MODE = "full_mode";
1728
1729 /**
1730 * The extra field for the contact name.
1731 * <P>Type: String</P>
1732 */
1733 public static final String NAME = "name";
1734
1735 // TODO add structured name values here.
1736
1737 /**
1738 * The extra field for the contact phonetic name.
1739 * <P>Type: String</P>
1740 */
1741 public static final String PHONETIC_NAME = "phonetic_name";
1742
1743 /**
1744 * The extra field for the contact company.
1745 * <P>Type: String</P>
1746 */
1747 public static final String COMPANY = "company";
1748
1749 /**
1750 * The extra field for the contact job title.
1751 * <P>Type: String</P>
1752 */
1753 public static final String JOB_TITLE = "job_title";
1754
1755 /**
1756 * The extra field for the contact notes.
1757 * <P>Type: String</P>
1758 */
1759 public static final String NOTES = "notes";
1760
1761 /**
1762 * The extra field for the contact phone number.
1763 * <P>Type: String</P>
1764 */
1765 public static final String PHONE = "phone";
1766
1767 /**
1768 * The extra field for the contact phone number type.
1769 * <P>Type: Either an integer value from
1770 * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1771 * or a string specifying a custom label.</P>
1772 */
1773 public static final String PHONE_TYPE = "phone_type";
1774
1775 /**
1776 * The extra field for the phone isprimary flag.
1777 * <P>Type: boolean</P>
1778 */
1779 public static final String PHONE_ISPRIMARY = "phone_isprimary";
1780
1781 /**
1782 * The extra field for an optional second contact phone number.
1783 * <P>Type: String</P>
1784 */
1785 public static final String SECONDARY_PHONE = "secondary_phone";
1786
1787 /**
1788 * The extra field for an optional second contact phone number type.
1789 * <P>Type: Either an integer value from
1790 * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1791 * or a string specifying a custom label.</P>
1792 */
1793 public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type";
1794
1795 /**
1796 * The extra field for an optional third contact phone number.
1797 * <P>Type: String</P>
1798 */
1799 public static final String TERTIARY_PHONE = "tertiary_phone";
1800
1801 /**
1802 * The extra field for an optional third contact phone number type.
1803 * <P>Type: Either an integer value from
1804 * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1805 * or a string specifying a custom label.</P>
1806 */
1807 public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type";
1808
1809 /**
1810 * The extra field for the contact email address.
1811 * <P>Type: String</P>
1812 */
1813 public static final String EMAIL = "email";
1814
1815 /**
1816 * The extra field for the contact email type.
1817 * <P>Type: Either an integer value from
1818 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1819 * or a string specifying a custom label.</P>
1820 */
1821 public static final String EMAIL_TYPE = "email_type";
1822
1823 /**
1824 * The extra field for the email isprimary flag.
1825 * <P>Type: boolean</P>
1826 */
1827 public static final String EMAIL_ISPRIMARY = "email_isprimary";
1828
1829 /**
1830 * The extra field for an optional second contact email address.
1831 * <P>Type: String</P>
1832 */
1833 public static final String SECONDARY_EMAIL = "secondary_email";
1834
1835 /**
1836 * The extra field for an optional second contact email type.
1837 * <P>Type: Either an integer value from
1838 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1839 * or a string specifying a custom label.</P>
1840 */
1841 public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type";
1842
1843 /**
1844 * The extra field for an optional third contact email address.
1845 * <P>Type: String</P>
1846 */
1847 public static final String TERTIARY_EMAIL = "tertiary_email";
1848
1849 /**
1850 * The extra field for an optional third contact email type.
1851 * <P>Type: Either an integer value from
1852 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1853 * or a string specifying a custom label.</P>
1854 */
1855 public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type";
1856
1857 /**
1858 * The extra field for the contact postal address.
1859 * <P>Type: String</P>
1860 */
1861 public static final String POSTAL = "postal";
1862
1863 /**
1864 * The extra field for the contact postal address type.
1865 * <P>Type: Either an integer value from
1866 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1867 * or a string specifying a custom label.</P>
1868 */
1869 public static final String POSTAL_TYPE = "postal_type";
1870
1871 /**
1872 * The extra field for the postal isprimary flag.
1873 * <P>Type: boolean</P>
1874 */
1875 public static final String POSTAL_ISPRIMARY = "postal_isprimary";
1876
1877 /**
1878 * The extra field for an IM handle.
1879 * <P>Type: String</P>
1880 */
1881 public static final String IM_HANDLE = "im_handle";
1882
1883 /**
1884 * The extra field for the IM protocol
Jeff Sharkey8a0193e2009-07-20 23:28:23 -07001885 * <P>Type: the result of {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)}
1886 * or {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.</P>
Evan Millardc2da5f2009-06-18 16:07:13 -07001887 */
1888 public static final String IM_PROTOCOL = "im_protocol";
1889
1890 /**
1891 * The extra field for the IM isprimary flag.
1892 * <P>Type: boolean</P>
1893 */
1894 public static final String IM_ISPRIMARY = "im_isprimary";
1895 }
1896 }
1897
Evan Millar088b2912009-05-28 15:24:37 -07001898}