ContactsContract.java revision d5f56d1467cb877aa216effd605745f5f22b1917
1/*
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
19import android.content.Intent;
20import android.content.ContentProviderClient;
21import android.content.ContentProviderOperation;
22import android.content.res.Resources;
23import android.graphics.BitmapFactory;
24import android.net.Uri;
25import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
26import android.accounts.Account;
27import android.os.RemoteException;
28
29/**
30 * The contract between the contacts provider and applications. Contains definitions
31 * for the supported URIs and columns.
32 *
33 * @hide
34 */
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
41    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
83    public interface ContactOptionsColumns {
84        /**
85         * The number of times a person has been contacted
86         * <P>Type: INTEGER</P>
87         */
88        public static final String TIMES_CONTACTED = "times_contacted";
89
90        /**
91         * The last time a person was contacted.
92         * <P>Type: INTEGER</P>
93         */
94        public static final String LAST_TIME_CONTACTED = "last_time_contacted";
95
96        /**
97         * Is the contact starred?
98         * <P>Type: INTEGER (boolean)</P>
99         */
100        public static final String STARRED = "starred";
101
102        /**
103         * A custom ringtone associated with a person. Not always present.
104         * <P>Type: TEXT (URI to the ringtone)</P>
105         */
106        public static final String CUSTOM_RINGTONE = "custom_ringtone";
107
108        /**
109         * Whether the person should always be sent to voicemail. Not always
110         * present.
111         * <P>Type: INTEGER (0 for false, 1 for true)</P>
112         */
113        public static final String SEND_TO_VOICEMAIL = "send_to_voicemail";
114    }
115
116    private interface AggregatesColumns {
117        /**
118         * The display name for the contact.
119         * <P>Type: TEXT</P>
120         */
121        public static final String DISPLAY_NAME = "display_name";
122
123        /**
124         * Reference to the row in the data table holding the primary phone number.
125         * <P>Type: INTEGER REFERENCES data(_id)</P>
126         */
127        public static final String PRIMARY_PHONE_ID = "primary_phone_id";
128
129        /**
130         * Reference to the row in the data table holding the primary email address.
131         * <P>Type: INTEGER REFERENCES data(_id)</P>
132         */
133        public static final String PRIMARY_EMAIL_ID = "primary_email_id";
134
135        /**
136         * Reference to the row in the data table holding the photo.
137         * <P>Type: INTEGER REFERENCES data(_id)</P>
138         */
139        public static final String PHOTO_ID = "photo_id";
140
141        /**
142         * Lookup value that reflects the {@link Groups#GROUP_VISIBLE} state of
143         * any {@link GroupMembership} for this aggregate.
144         */
145        public static final String IN_VISIBLE_GROUP = "in_visible_group";
146
147        /**
148         * Contact presence status.  See {@link android.provider.Im.CommonPresenceColumns}
149         * for individual status definitions.
150         */
151        public static final String PRESENCE_STATUS = Presence.PRESENCE_STATUS;
152
153        /**
154         * The type of data, for example Home or Work.
155         * <P>Type: INTEGER</P>
156         */
157        public static final String PRIMARY_PHONE_TYPE = CommonDataKinds.Phone.TYPE;
158
159        /**
160         * The user defined label for the primary phone.
161         * <P>Type: TEXT</P>
162         */
163        public static final String PRIMARY_PHONE_LABEL = CommonDataKinds.Phone.LABEL;
164
165        /**
166         * The primary phone number.
167         * <P>Type: TEXT</P>
168         */
169        public static final String PRIMARY_PHONE_NUMBER = CommonDataKinds.Phone.NUMBER;
170    }
171
172
173    /**
174     * Constants for the aggregates table, which contains a record per group
175     * of contact representing the same person.
176     */
177    public static final class Aggregates implements BaseColumns, AggregatesColumns,
178            ContactOptionsColumns {
179        /**
180         * This utility class cannot be instantiated
181         */
182        private Aggregates()  {}
183
184        /**
185         * The content:// style URI for this table
186         */
187        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "aggregates");
188
189        /**
190         * The content:// style URI for this table joined with useful data from
191         * {@link Data}.
192         */
193        public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI,
194                "aggregates_summary");
195
196        /**
197         * The content:// style URI used for "type-to-filter" functionality on the
198         * {@link #CONTENT_SUMMARY_URI} URI. The filter string will be used to match
199         * various parts of the aggregate name. The filter argument should be passed
200         * as an additional path segment after this URI.
201         */
202        public static final Uri CONTENT_SUMMARY_FILTER_URI = Uri.withAppendedPath(
203                CONTENT_SUMMARY_URI, "filter");
204
205        /**
206         * The content:// style URI for this table joined with useful data from
207         * {@link Data}, filtered to include only starred aggregates
208         * and the most frequently contacted aggregates.
209         */
210        public static final Uri CONTENT_SUMMARY_STREQUENT_URI = Uri.withAppendedPath(
211                CONTENT_SUMMARY_URI, "strequent");
212
213        /**
214         * The content:// style URI used for "type-to-filter" functionality on the
215         * {@link #CONTENT_SUMMARY_STREQUENT_URI} URI. The filter string will be used to match
216         * various parts of the aggregate name. The filter argument should be passed
217         * as an additional path segment after this URI.
218         */
219        public static final Uri CONTENT_SUMMARY_STREQUENT_FILTER_URI = Uri.withAppendedPath(
220                CONTENT_SUMMARY_STREQUENT_URI, "filter");
221
222        public static final Uri CONTENT_SUMMARY_GROUP_URI = Uri.withAppendedPath(
223                CONTENT_SUMMARY_URI, "group");
224        /**
225         * The MIME type of {@link #CONTENT_URI} providing a directory of
226         * people.
227         */
228        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/person_aggregate";
229
230        /**
231         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
232         * person.
233         */
234        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/person_aggregate";
235
236        /**
237         * A sub-directory of a single contact aggregate that contains all of their
238         * {@link Data} rows.
239         */
240        public static final class Data implements BaseColumns, DataColumns {
241            /**
242             * no public constructor since this is a utility class
243             */
244            private Data() {}
245
246            /**
247             * The directory twig for this sub-table
248             */
249            public static final String CONTENT_DIRECTORY = "data";
250        }
251
252        /**
253         * A sub-directory of a single contact aggregate that contains all aggregation suggestions
254         * (other aggregates).  The aggregation suggestions are computed based on approximate
255         * data matches with this aggregate.
256         */
257        public static final class AggregationSuggestions implements BaseColumns, AggregatesColumns {
258            /**
259             * No public constructor since this is a utility class
260             */
261            private AggregationSuggestions() {}
262
263            /**
264             * The directory twig for this sub-table
265             */
266            public static final String CONTENT_DIRECTORY = "suggestions";
267
268            /**
269             * An optional query parameter that can be supplied to limit the number of returned
270             * suggestions.
271             * <p>
272             * Type: INTEGER
273             */
274            public static final String MAX_SUGGESTIONS = "max_suggestions";
275        }
276    }
277
278    /**
279     * Columns that appear when each row of a table belongs to a specific
280     * account, including sync information that an account may need.
281     */
282    private interface SyncColumns {
283        /**
284         * The name of the account instance to which this row belongs.
285         * <P>Type: TEXT</P>
286         */
287        public static final String ACCOUNT_NAME = "account_name";
288
289        /**
290         * The type of account to which this row belongs, which when paired with
291         * {@link #ACCOUNT_NAME} identifies a specific account.
292         * <P>Type: TEXT</P>
293         */
294        public static final String ACCOUNT_TYPE = "account_type";
295
296        /**
297         * String that uniquely identifies this row to its source account.
298         * <P>Type: TEXT</P>
299         */
300        public static final String SOURCE_ID = "sourceid";
301
302        /**
303         * Version number that is updated whenever this row or its related data
304         * changes.
305         * <P>Type: INTEGER</P>
306         */
307        public static final String VERSION = "version";
308
309        /**
310         * Flag indicating that {@link #VERSION} has changed, and this row needs
311         * to be synchronized by its owning account.
312         * <P>Type: INTEGER (boolean)</P>
313         */
314        public static final String DIRTY = "dirty";
315
316    }
317
318    private interface RawContactsColumns {
319        /**
320         * A reference to the {@link Aggregates#_ID} that this data belongs to.
321         * <P>Type: INTEGER</P>
322         */
323        public static final String AGGREGATE_ID = "aggregate_id";
324
325        /**
326         * Flag indicating that this {@link RawContacts} entry and its children has
327         * been restricted to specific platform apps.
328         * <P>Type: INTEGER (boolean)</P>
329         *
330         * @hide until finalized in future platform release
331         */
332        public static final String IS_RESTRICTED = "is_restricted";
333
334        /**
335         * The aggregation mode for this contact.
336         * <P>Type: INTEGER</P>
337         */
338        public static final String AGGREGATION_MODE = "aggregation_mode";
339
340        /**
341         * The "deleted" flag: "0" by default, "1" if the row has been marked
342         * for deletion. When {@link android.content.ContentResolver#delete} is
343         * called on a contact, it is marked for deletion and removed from its
344         * aggregate. The sync adaptor deletes the contact on the server and
345         * then calls ContactResolver.delete once more, this time passing the
346         * {@link android.provider.ContactsContract.Contacts#DELETE_PERMANENTLY}
347         * query parameter to finalize the data removal.
348         * <P>Type: INTEGER</P>
349         */
350        public static final String DELETED = "deleted";
351    }
352
353    /**
354     * Constants for the raw_contacts table, which contains the base contact
355     * information per sync source. Sync adapters and contact management apps
356     * are the primary consumers of this API.
357     */
358    // TODO make final as soon as renaming is complete
359    public static /*final*/ class RawContacts implements BaseColumns, RawContactsColumns,
360            SyncColumns, ContactOptionsColumns {
361        /**
362         * This utility class cannot be instantiated
363         */
364        private RawContacts() {
365        }
366
367        /**
368         * The content:// style URI for this table
369         */
370        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "contacts");
371
372        /**
373         * The content:// style URL for filtering people by email address. The
374         * filter argument should be passed as an additional path segment after
375         * this URI.
376         *
377         * @hide
378         */
379        public static final Uri CONTENT_FILTER_EMAIL_URI =
380                Uri.withAppendedPath(CONTENT_URI, "filter_email");
381
382        /**
383         * The MIME type of {@link #CONTENT_URI} providing a directory of
384         * people.
385         */
386        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/person";
387
388        /**
389         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
390         * person.
391         */
392        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/person";
393
394        /**
395         * Query parameter that can be passed with the {@link #CONTENT_URI} URI
396         * to the {@link android.content.ContentResolver#delete} method to
397         * indicate that the raw contact can be deleted physically, rather than
398         * merely marked as deleted.
399         */
400        public static final String DELETE_PERMANENTLY = "delete_permanently";
401
402        /**
403         * Aggregation mode: aggregate asynchronously.
404         */
405        public static final int AGGREGATION_MODE_DEFAULT = 0;
406
407        /**
408         * Aggregation mode: aggregate at the time the contact is inserted/updated.
409         */
410        public static final int AGGREGATION_MODE_IMMEDITATE = 1;
411
412        /**
413         * Aggregation mode: never aggregate this contact (note that the contact will not
414         * have a corresponding Aggregate and therefore will not be included in Aggregates
415         * query results.)
416         */
417        public static final int AGGREGATION_MODE_DISABLED = 2;
418
419        /**
420         * A sub-directory of a single contact that contains all of their {@link Data} rows.
421         * To access this directory append
422         */
423        public static final class Data implements BaseColumns, DataColumns {
424            /**
425             * no public constructor since this is a utility class
426             */
427            private Data() {
428            }
429
430            /**
431             * The directory twig for this sub-table
432             */
433            public static final String CONTENT_DIRECTORY = "data";
434        }
435    }
436
437    /**
438     * TODO remove as soon as full renaming is complete.
439     */
440    @Deprecated
441    public static final class Contacts extends RawContacts {
442    }
443
444    private interface DataColumns {
445        /**
446         * The package name to use when creating {@link Resources} objects for
447         * this data row. This value is only designed for use when building user
448         * interfaces, and should not be used to infer the owner.
449         */
450        public static final String RES_PACKAGE = "res_package";
451
452        /**
453         * The MIME type of the item represented by this row.
454         */
455        public static final String MIMETYPE = "mimetype";
456
457        /**
458         * A reference to the {@link android.provider.ContactsContract.Contacts#_ID}
459         * that this data belongs to.
460         */
461        public static final String CONTACT_ID = "contact_id";
462
463        /**
464         * Whether this is the primary entry of its kind for the contact it belongs to
465         * <P>Type: INTEGER (if set, non-0 means true)</P>
466         */
467        public static final String IS_PRIMARY = "is_primary";
468
469        /**
470         * Whether this is the primary entry of its kind for the aggregate it belongs to. Any data
471         * record that is "super primary" must also be "primary".
472         * <P>Type: INTEGER (if set, non-0 means true)</P>
473         */
474        public static final String IS_SUPER_PRIMARY = "is_super_primary";
475
476        /**
477         * The version of this data record. This is a read-only value. The data column is
478         * guaranteed to not change without the version going up. This value is monotonically
479         * increasing.
480         * <P>Type: INTEGER</P>
481         */
482        public static final String DATA_VERSION = "data_version";
483
484        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
485        public static final String DATA1 = "data1";
486        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
487        public static final String DATA2 = "data2";
488        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
489        public static final String DATA3 = "data3";
490        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
491        public static final String DATA4 = "data4";
492        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
493        public static final String DATA5 = "data5";
494        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
495        public static final String DATA6 = "data6";
496        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
497        public static final String DATA7 = "data7";
498        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
499        public static final String DATA8 = "data8";
500        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
501        public static final String DATA9 = "data9";
502        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
503        public static final String DATA10 = "data10";
504        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
505        public static final String DATA11 = "data11";
506        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
507        public static final String DATA12 = "data12";
508        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
509        public static final String DATA13 = "data13";
510        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
511        public static final String DATA14 = "data14";
512        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
513        public static final String DATA15 = "data15";
514    }
515
516    /**
517     * Constants for the data table, which contains data points tied to a contact.
518     * For example, a phone number or email address. Each row in this table contains a type
519     * definition and some generic columns. Each data type can define the meaning for each of
520     * the generic columns.
521     */
522    public static final class Data implements BaseColumns, DataColumns {
523        /**
524         * This utility class cannot be instantiated
525         */
526        private Data() {}
527
528        /**
529         * The content:// style URI for this table
530         */
531        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data");
532
533        /**
534         * The MIME type of {@link #CONTENT_URI} providing a directory of data.
535         */
536        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/data";
537    }
538
539    /**
540     * A table that represents the result of looking up a phone number, for
541     * example for caller ID. The table joins that data row for the phone number
542     * with the contact that owns the number. To perform a lookup you must
543     * append the number you want to find to {@link #CONTENT_FILTER_URI}.
544     */
545    public static final class PhoneLookup implements BaseColumns, DataColumns, AggregatesColumns {
546        /**
547         * This utility class cannot be instantiated
548         */
549        private PhoneLookup() {}
550
551        /**
552         * The content:// style URI for this table. Append the phone number you want to lookup
553         * to this URI and query it to perform a lookup. For example:
554         *
555         * {@code
556         * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber);
557         * }
558         */
559        public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI,
560                "phone_lookup");
561    }
562
563    /**
564     * Additional data mixed in with {@link Im.CommonPresenceColumns} to link
565     * back to specific {@link ContactsContract.Aggregates#_ID} entries.
566     */
567    private interface PresenceColumns {
568
569        /**
570         * The unique ID for a row.
571         * <P>Type: INTEGER (long)</P>
572         */
573        public static final String _ID = "presence_id";
574
575        /**
576         * Reference to the {@link android.provider.ContactsContract.Contacts#_ID} this presence
577         * references.
578         * <P>Type: INTEGER</P>
579         */
580        public static final String CONTACT_ID = "contact_id";
581
582        /**
583         * Reference to the {@link Data#_ID} entry that owns this presence.
584         * <P>Type: INTEGER</P>
585         */
586        public static final String DATA_ID = "data_id";
587
588        /**
589         * The IM service the presence is coming from. Formatted using either
590         * {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)} or
591         * {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.
592         * <P>Type: TEXT</P>
593         */
594        public static final String IM_PROTOCOL = "im_protocol";
595
596        /**
597         * The IM handle the presence item is for. The handle is scoped to the
598         * {@link #IM_PROTOCOL}.
599         * <P>Type: TEXT</P>
600         */
601        public static final String IM_HANDLE = "im_handle";
602
603        /**
604         * The IM account for the local user that the presence data came from.
605         * <P>Type: TEXT</P>
606         */
607        public static final String IM_ACCOUNT = "im_account";
608    }
609
610    public static final class Presence implements PresenceColumns, Im.CommonPresenceColumns {
611        /**
612         * This utility class cannot be instantiated
613         */
614        private Presence() {
615        }
616
617        /**
618         * The content:// style URI for this table
619         */
620        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence");
621
622        /**
623         * Gets the resource ID for the proper presence icon.
624         *
625         * @param status the status to get the icon for
626         * @return the resource ID for the proper presence icon
627         */
628        public static final int getPresenceIconResourceId(int status) {
629            switch (status) {
630                case AVAILABLE:
631                    return android.R.drawable.presence_online;
632                case IDLE:
633                case AWAY:
634                    return android.R.drawable.presence_away;
635                case DO_NOT_DISTURB:
636                    return android.R.drawable.presence_busy;
637                case INVISIBLE:
638                    return android.R.drawable.presence_invisible;
639                case OFFLINE:
640                default:
641                    return android.R.drawable.presence_offline;
642            }
643        }
644
645        /**
646         * Returns the precedence of the status code the higher number being the higher precedence.
647         *
648         * @param status The status code.
649         * @return An integer representing the precedence, 0 being the lowest.
650         */
651        public static final int getPresencePrecedence(int status) {
652            // Keep this function here incase we want to enforce a different precedence than the
653            // natural order of the status constants.
654            return status;
655        }
656
657        /**
658         * The MIME type of {@link #CONTENT_URI} providing a directory of
659         * presence details.
660         */
661        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/im-presence";
662
663        /**
664         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
665         * presence detail.
666         */
667        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im-presence";
668    }
669
670    /**
671     * Container for definitions of common data types stored in the {@link Data} table.
672     */
673    public static final class CommonDataKinds {
674        /**
675         * The {@link Data#RES_PACKAGE} value for common data that should be
676         * shown using a default style.
677         */
678        public static final String PACKAGE_COMMON = "common";
679
680        /**
681         * Columns common across the specific types.
682         */
683        private interface BaseCommonColumns {
684            /**
685             * The package name to use when creating {@link Resources} objects for
686             * this data row. This value is only designed for use when building user
687             * interfaces, and should not be used to infer the owner.
688             */
689            public static final String RES_PACKAGE = "res_package";
690
691            /**
692             * The MIME type of the item represented by this row.
693             */
694            public static final String MIMETYPE = "mimetype";
695
696            /**
697             * The {@link Contacts#_ID} that this data belongs to.
698             */
699            public static final String CONTACT_ID = "contact_id";
700        }
701
702        /**
703         * The base types that all "Typed" data kinds support.
704         */
705        public interface BaseTypes {
706
707            /**
708             * A custom type. The custom label should be supplied by user.
709             */
710            public static int TYPE_CUSTOM = 0;
711        }
712
713        /**
714         * Columns common across the specific types.
715         */
716        private interface CommonColumns extends BaseTypes{
717            /**
718             * The type of data, for example Home or Work.
719             * <P>Type: INTEGER</P>
720             */
721            public static final String TYPE = "data1";
722
723            /**
724             * The data for the contact method.
725             * <P>Type: TEXT</P>
726             */
727            public static final String DATA = "data2";
728
729            /**
730             * The user defined label for the the contact method.
731             * <P>Type: TEXT</P>
732             */
733            public static final String LABEL = "data3";
734        }
735
736        /**
737         * Parts of the name.
738         */
739        public static final class StructuredName implements BaseCommonColumns {
740            private StructuredName() {}
741
742            /** MIME type used when storing this in data table. */
743            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name";
744
745            /**
746             * The given name for the contact.
747             * <P>Type: TEXT</P>
748             */
749            public static final String GIVEN_NAME = "data1";
750
751            /**
752             * The family name for the contact.
753             * <P>Type: TEXT</P>
754             */
755            public static final String FAMILY_NAME = "data2";
756
757            /**
758             * The contact's honorific prefix, e.g. "Sir"
759             * <P>Type: TEXT</P>
760             */
761            public static final String PREFIX = "data3";
762
763            /**
764             * The contact's middle name
765             * <P>Type: TEXT</P>
766             */
767            public static final String MIDDLE_NAME = "data4";
768
769            /**
770             * The contact's honorific suffix, e.g. "Jr"
771             */
772            public static final String SUFFIX = "data5";
773
774            /**
775             * The phonetic version of the given name for the contact.
776             * <P>Type: TEXT</P>
777             */
778            public static final String PHONETIC_GIVEN_NAME = "data6";
779
780            /**
781             * The phonetic version of the additional name for the contact.
782             * <P>Type: TEXT</P>
783             */
784            public static final String PHONETIC_MIDDLE_NAME = "data7";
785
786            /**
787             * The phonetic version of the family name for the contact.
788             * <P>Type: TEXT</P>
789             */
790            public static final String PHONETIC_FAMILY_NAME = "data8";
791
792            /**
793             * The name that should be used to display the contact.
794             * <P>Type: TEXT</P>
795             */
796            public static final String DISPLAY_NAME = "data9";
797        }
798
799        /**
800         * A nickname.
801         */
802        public static final class Nickname implements CommonColumns, BaseCommonColumns {
803            private Nickname() {}
804
805            /** MIME type used when storing this in data table. */
806            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname";
807
808            public static final int TYPE_DEFAULT = 1;
809            public static final int TYPE_OTHER_NAME = 2;
810            public static final int TYPE_MAINDEN_NAME = 3;
811            public static final int TYPE_SHORT_NAME = 4;
812            public static final int TYPE_INITIALS = 5;
813
814            /**
815             * The name itself
816             */
817            public static final String NAME = DATA;
818        }
819
820        /**
821         * Common data definition for telephone numbers.
822         */
823        public static final class Phone implements BaseCommonColumns, CommonColumns {
824            private Phone() {}
825
826            /** MIME type used when storing this in data table. */
827            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone";
828
829            /**
830             * The MIME type of {@link #CONTENT_URI} providing a directory of
831             * phones.
832             */
833            public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone";
834
835            /**
836             * The content:// style URI for all data records of the
837             * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the
838             * associated contact and aggregate data.
839             */
840            public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
841                    "phones");
842
843            /**
844             * The content:// style URI for filtering data records of the
845             * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the
846             * associated contact and aggregate data. The filter argument should
847             * be passed as an additional path segment after this URI.
848             */
849            public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI,
850                    "filter");
851
852            public static final int TYPE_HOME = 1;
853            public static final int TYPE_MOBILE = 2;
854            public static final int TYPE_WORK = 3;
855            public static final int TYPE_FAX_WORK = 4;
856            public static final int TYPE_FAX_HOME = 5;
857            public static final int TYPE_PAGER = 6;
858            public static final int TYPE_OTHER = 7;
859
860            /**
861             * The phone number as the user entered it.
862             * <P>Type: TEXT</P>
863             */
864            public static final String NUMBER = DATA;
865        }
866
867        /**
868         * Common data definition for email addresses.
869         */
870        public static final class Email implements BaseCommonColumns, CommonColumns {
871            private Email() {}
872
873            /** MIME type used when storing this in data table. */
874            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email";
875
876            public static final int TYPE_HOME = 1;
877            public static final int TYPE_WORK = 2;
878            public static final int TYPE_OTHER = 3;
879        }
880
881        /**
882         * Common data definition for postal addresses.
883         */
884        public static final class StructuredPostal implements BaseCommonColumns, CommonColumns {
885            private StructuredPostal() {
886            }
887
888            /** MIME type used when storing this in data table. */
889            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/postal-address";
890
891            /**
892             * The MIME type of {@link #CONTENT_URI} providing a directory of
893             * postal addresses.
894             */
895            public static final String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address";
896
897            /**
898             * The content:// style URI for all data records of the
899             * {@link StructuredPostal#CONTENT_ITEM_TYPE} MIME type.
900             */
901            public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
902                    "postals");
903
904            public static final int TYPE_HOME = 1;
905            public static final int TYPE_WORK = 2;
906            public static final int TYPE_OTHER = 3;
907
908            /**
909             * The full, unstructured postal address.
910             * <p>
911             * Type: TEXT
912             */
913            public static final String FORMATTED_ADDRESS = DATA;
914
915            /**
916             * The agent who actually receives the mail. Used in work addresses.
917             * Also for 'in care of' or 'c/o'.
918             * <p>
919             * Type: TEXT
920             */
921            public static final String AGENT = "data4";
922
923            /**
924             * Used in places where houses or buildings have names (and not
925             * necessarily numbers), eg. "The Pillars".
926             * <p>
927             * Type: TEXT
928             */
929            public static final String HOUSENAME = "data5";
930
931            /**
932             * Can be street, avenue, road, etc. This element also includes the
933             * house number and room/apartment/flat/floor number.
934             * <p>
935             * Type: TEXT
936             */
937            public static final String STREET = "data6";
938
939            /**
940             * Covers actual P.O. boxes, drawers, locked bags, etc. This is
941             * usually but not always mutually exclusive with street.
942             * <p>
943             * Type: TEXT
944             */
945            public static final String POBOX = "data7";
946
947            /**
948             * This is used to disambiguate a street address when a city
949             * contains more than one street with the same name, or to specify a
950             * small place whose mail is routed through a larger postal town. In
951             * China it could be a county or a minor city.
952             * <p>
953             * Type: TEXT
954             */
955            public static final String NEIGHBORHOOD = "data8";
956
957            /**
958             * Can be city, village, town, borough, etc. This is the postal town
959             * and not necessarily the place of residence or place of business.
960             * <p>
961             * Type: TEXT
962             */
963            public static final String CITY = "data9";
964
965            /**
966             * Handles administrative districts such as U.S. or U.K. counties
967             * that are not used for mail addressing purposes. Subregion is not
968             * intended for delivery addresses.
969             * <p>
970             * Type: TEXT
971             */
972            public static final String SUBREGION = "data10";
973
974            /**
975             * A state, province, county (in Ireland), Land (in Germany),
976             * departement (in France), etc.
977             * <p>
978             * Type: TEXT
979             */
980            public static final String REGION = "data11";
981
982            /**
983             * Postal code. Usually country-wide, but sometimes specific to the
984             * city (e.g. "2" in "Dublin 2, Ireland" addresses).
985             * <p>
986             * Type: TEXT
987             */
988            public static final String POSTCODE = "data12";
989
990            /**
991             * The name or code of the country.
992             * <p>
993             * Type: TEXT
994             */
995            public static final String COUNTRY = "data13";
996        }
997
998       /**
999        * Common data definition for IM addresses.
1000        */
1001        public static final class Im implements BaseCommonColumns, CommonColumns {
1002            private Im() {}
1003
1004            /** MIME type used when storing this in data table. */
1005            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im";
1006
1007            public static final int TYPE_HOME = 1;
1008            public static final int TYPE_WORK = 2;
1009            public static final int TYPE_OTHER = 3;
1010
1011            public static final String PROTOCOL = "data5";
1012
1013            /**
1014             * The predefined IM protocol types. The protocol can either be non-present, one
1015             * of these types, or a free-form string. These cases are encoded in the PROTOCOL
1016             * column as:
1017             * <ul>
1018             * <li>null</li>
1019             * <li>pre:&lt;an integer, one of the protocols below&gt;</li>
1020             * <li>custom:&lt;a string&gt;</li>
1021             * </ul>
1022             */
1023            public static final int PROTOCOL_AIM = 0;
1024            public static final int PROTOCOL_MSN = 1;
1025            public static final int PROTOCOL_YAHOO = 2;
1026            public static final int PROTOCOL_SKYPE = 3;
1027            public static final int PROTOCOL_QQ = 4;
1028            public static final int PROTOCOL_GOOGLE_TALK = 5;
1029            public static final int PROTOCOL_ICQ = 6;
1030            public static final int PROTOCOL_JABBER = 7;
1031
1032            public static String encodePredefinedImProtocol(int protocol) {
1033               return "pre:" + protocol;
1034            }
1035
1036            public static String encodeCustomImProtocol(String protocolString) {
1037               return "custom:" + protocolString;
1038            }
1039
1040            public static Object decodeImProtocol(String encodedString) {
1041               if (encodedString == null) {
1042                   return null;
1043               }
1044
1045               if (encodedString.startsWith("pre:")) {
1046                   return Integer.parseInt(encodedString.substring(4));
1047               }
1048
1049               if (encodedString.startsWith("custom:")) {
1050                   return encodedString.substring(7);
1051               }
1052
1053               throw new IllegalArgumentException(
1054                       "the value is not a valid encoded protocol, " + encodedString);
1055            }
1056        }
1057
1058        /**
1059         * Common data definition for organizations.
1060         */
1061        public static final class Organization implements BaseCommonColumns, CommonColumns {
1062            private Organization() {}
1063
1064            /** MIME type used when storing this in data table. */
1065            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization";
1066
1067            public static final int TYPE_WORK = 1;
1068            public static final int TYPE_OTHER = 2;
1069
1070            /**
1071             * The company as the user entered it.
1072             * <P>Type: TEXT</P>
1073             */
1074            public static final String COMPANY = DATA;
1075
1076            /**
1077             * The position title at this company as the user entered it.
1078             * <P>Type: TEXT</P>
1079             */
1080            public static final String TITLE = "data4";
1081        }
1082
1083        /**
1084         * Photo of the contact.
1085         */
1086        public static final class Photo implements BaseCommonColumns {
1087            private Photo() {}
1088
1089            /** MIME type used when storing this in data table. */
1090            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo";
1091
1092            /**
1093             * Thumbnail photo of the contact. This is the raw bytes of an image
1094             * that could be inflated using {@link BitmapFactory}.
1095             * <p>
1096             * Type: BLOB
1097             */
1098            public static final String PHOTO = "data1";
1099        }
1100
1101        /**
1102         * Notes about the contact.
1103         */
1104        public static final class Note implements BaseCommonColumns {
1105            private Note() {}
1106
1107            /** MIME type used when storing this in data table. */
1108            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note";
1109
1110            /**
1111             * The note text.
1112             * <P>Type: TEXT</P>
1113             */
1114            public static final String NOTE = "data1";
1115        }
1116
1117        /**
1118         * Group Membership.
1119         */
1120        public static final class GroupMembership implements BaseCommonColumns {
1121            private GroupMembership() {}
1122
1123            /** MIME type used when storing this in data table. */
1124            public static final String CONTENT_ITEM_TYPE =
1125                    "vnd.android.cursor.item/group_membership";
1126
1127            /**
1128             * The row id of the group that this group membership refers to. Exactly one of
1129             * this or {@link #GROUP_SOURCE_ID} must be set when inserting a row.
1130             * <P>Type: INTEGER</P>
1131             */
1132            public static final String GROUP_ROW_ID = "data1";
1133
1134            /**
1135             * The sourceid of the group that this group membership refers to.  Exactly one of
1136             * this or {@link #GROUP_ROW_ID} must be set when inserting a row.
1137             * <P>Type: TEXT</P>
1138             */
1139            public static final String GROUP_SOURCE_ID = "group_sourceid";
1140        }
1141
1142        /**
1143         * Website related to the contact.
1144         */
1145        public static final class Website implements BaseCommonColumns {
1146            private Website() {}
1147
1148            /** MIME type used when storing this in data table. */
1149            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website";
1150
1151            /**
1152             * The website URL string.
1153             * <P>Type: TEXT</P>
1154             */
1155            public static final String URL = "data1";
1156        }
1157    }
1158
1159    public interface GroupsColumns {
1160        /**
1161         * The display title of this group.
1162         * <p>
1163         * Type: TEXT
1164         */
1165        public static final String TITLE = "title";
1166
1167        /**
1168         * The package name to use when creating {@link Resources} objects for
1169         * this group. This value is only designed for use when building user
1170         * interfaces, and should not be used to infer the owner.
1171         */
1172        public static final String RES_PACKAGE = "res_package";
1173
1174        /**
1175         * The display title of this group to load as a resource from
1176         * {@link #RES_PACKAGE}, which may be localized.
1177         * <P>Type: TEXT</P>
1178         */
1179        public static final String TITLE_RES = "title_res";
1180
1181        /**
1182         * Notes about the group.
1183         * <p>
1184         * Type: TEXT
1185         */
1186        public static final String NOTES = "notes";
1187
1188        /**
1189         * The ID of this group if it is a System Group, i.e. a group that has a special meaning
1190         * to the sync adapter, null otherwise.
1191         * <P>Type: TEXT</P>
1192         */
1193        public static final String SYSTEM_ID = "system_id";
1194
1195        /**
1196         * The total number of {@link Aggregates} that have
1197         * {@link GroupMembership} in this group. Read-only value that is only
1198         * present when querying {@link Groups#CONTENT_SUMMARY_URI}.
1199         * <p>
1200         * Type: INTEGER
1201         */
1202        public static final String SUMMARY_COUNT = "summ_count";
1203
1204        /**
1205         * The total number of {@link Aggregates} that have both
1206         * {@link GroupMembership} in this group, and also have phone numbers.
1207         * Read-only value that is only present when querying
1208         * {@link Groups#CONTENT_SUMMARY_URI}.
1209         * <p>
1210         * Type: INTEGER
1211         */
1212        public static final String SUMMARY_WITH_PHONES = "summ_phones";
1213
1214        /**
1215         * Flag indicating if the contacts belonging to this group should be
1216         * visible in any user interface.
1217         * <p>
1218         * Type: INTEGER
1219         */
1220        public static final String GROUP_VISIBLE = "group_visible";
1221    }
1222
1223    /**
1224     * Constants for the groups table.
1225     */
1226    public static final class Groups implements BaseColumns, GroupsColumns, SyncColumns {
1227        /**
1228         * This utility class cannot be instantiated
1229         */
1230        private Groups() {
1231        }
1232
1233        /**
1234         * The content:// style URI for this table
1235         */
1236        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "groups");
1237
1238        /**
1239         * The content:// style URI for this table joined with details data from
1240         * {@link Data}.
1241         */
1242        public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI,
1243                "groups_summary");
1244
1245        /**
1246         * The MIME type of a directory of groups.
1247         */
1248        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/group";
1249
1250        /**
1251         * The MIME type of a single group.
1252         */
1253        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group";
1254    }
1255
1256    /**
1257     * Constants for the contact aggregation exceptions table, which contains
1258     * aggregation rules overriding those used by automatic aggregation.  This type only
1259     * supports query and update. Neither insert nor delete are supported.
1260     */
1261    public static final class AggregationExceptions implements BaseColumns {
1262        /**
1263         * This utility class cannot be instantiated
1264         */
1265        private AggregationExceptions() {}
1266
1267        /**
1268         * The content:// style URI for this table
1269         */
1270        public static final Uri CONTENT_URI =
1271                Uri.withAppendedPath(AUTHORITY_URI, "aggregation_exceptions");
1272
1273        /**
1274         * The MIME type of {@link #CONTENT_URI} providing a directory of data.
1275         */
1276        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception";
1277
1278        /**
1279         * The MIME type of a {@link #CONTENT_URI} subdirectory of an aggregation exception
1280         */
1281        public static final String CONTENT_ITEM_TYPE =
1282                "vnd.android.cursor.item/aggregation_exception";
1283
1284        /**
1285         * The type of exception: {@link #TYPE_KEEP_IN}, {@link #TYPE_KEEP_OUT} or
1286         * {@link #TYPE_AUTOMATIC}.
1287         *
1288         * <P>Type: INTEGER</P>
1289         */
1290        public static final String TYPE = "type";
1291
1292        /**
1293         * Allows the provider to automatically decide whether the aggregate should include
1294         * a particular contact or not.
1295         */
1296        public static final int TYPE_AUTOMATIC = 0;
1297
1298        /**
1299         * Makes sure that the specified contact is included in the specified aggregate.
1300         */
1301        public static final int TYPE_KEEP_IN = 1;
1302
1303        /**
1304         * Makes sure that the specified contact is NOT included in the specified aggregate.
1305         */
1306        public static final int TYPE_KEEP_OUT = 2;
1307
1308        /**
1309         * A reference to the {@link Aggregates#_ID} of the aggregate that the rule applies to.
1310         */
1311        public static final String AGGREGATE_ID = "aggregate_id";
1312
1313        /**
1314         * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} of the
1315         * contact that the rule applies to.
1316         */
1317        public static final String CONTACT_ID = "contact_id";
1318    }
1319
1320    /**
1321     * Contains helper classes used to create or manage {@link android.content.Intent Intents}
1322     * that involve contacts.
1323     */
1324    public static final class Intents {
1325        /**
1326         * This is the intent that is fired when a search suggestion is clicked on.
1327         */
1328        public static final String SEARCH_SUGGESTION_CLICKED =
1329                "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED";
1330
1331        /**
1332         * This is the intent that is fired when a search suggestion for dialing a number
1333         * is clicked on.
1334         */
1335        public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED =
1336                "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED";
1337
1338        /**
1339         * This is the intent that is fired when a search suggestion for creating a contact
1340         * is clicked on.
1341         */
1342        public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED =
1343                "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED";
1344
1345        /**
1346         * Starts an Activity that lets the user pick a contact to attach an image to.
1347         * After picking the contact it launches the image cropper in face detection mode.
1348         */
1349        public static final String ATTACH_IMAGE =
1350                "com.android.contacts.action.ATTACH_IMAGE";
1351
1352        /**
1353         * Takes as input a data URI with a mailto: or tel: scheme. If a single
1354         * contact exists with the given data it will be shown. If no contact
1355         * exists, a dialog will ask the user if they want to create a new
1356         * contact with the provided details filled in. If multiple contacts
1357         * share the data the user will be prompted to pick which contact they
1358         * want to view.
1359         * <p>
1360         * For <code>mailto:</code> URIs, the scheme specific portion must be a
1361         * raw email address, such as one built using
1362         * {@link Uri#fromParts(String, String, String)}.
1363         * <p>
1364         * For <code>tel:</code> URIs, the scheme specific portion is compared
1365         * to existing numbers using the standard caller ID lookup algorithm.
1366         * The number must be properly encoded, for example using
1367         * {@link Uri#fromParts(String, String, String)}.
1368         * <p>
1369         * Any extras from the {@link Insert} class will be passed along to the
1370         * create activity if there are no contacts to show.
1371         * <p>
1372         * Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip
1373         * prompting the user when the contact doesn't exist.
1374         */
1375        public static final String SHOW_OR_CREATE_CONTACT =
1376                "com.android.contacts.action.SHOW_OR_CREATE_CONTACT";
1377
1378        /**
1379         * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new
1380         * contact if no matching contact found. Otherwise, default behavior is
1381         * to prompt user with dialog before creating.
1382         * <p>
1383         * Type: BOOLEAN
1384         */
1385        public static final String EXTRA_FORCE_CREATE =
1386                "com.android.contacts.action.FORCE_CREATE";
1387
1388        /**
1389         * Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact
1390         * description to be shown when prompting user about creating a new
1391         * contact.
1392         * <p>
1393         * Type: STRING
1394         */
1395        public static final String EXTRA_CREATE_DESCRIPTION =
1396            "com.android.contacts.action.CREATE_DESCRIPTION";
1397
1398        /**
1399         * Intents related to the Contacts app UI.
1400         */
1401        public static final class UI {
1402            /**
1403             * The action for the default contacts list tab.
1404             */
1405            public static final String LIST_DEFAULT =
1406                    "com.android.contacts.action.LIST_DEFAULT";
1407
1408            /**
1409             * The action for the contacts list tab.
1410             */
1411            public static final String LIST_GROUP_ACTION =
1412                    "com.android.contacts.action.LIST_GROUP";
1413
1414            /**
1415             * When in LIST_GROUP_ACTION mode, this is the group to display.
1416             */
1417            public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP";
1418
1419            /**
1420             * The action for the all contacts list tab.
1421             */
1422            public static final String LIST_ALL_CONTACTS_ACTION =
1423                    "com.android.contacts.action.LIST_ALL_CONTACTS";
1424
1425            /**
1426             * The action for the contacts with phone numbers list tab.
1427             */
1428            public static final String LIST_CONTACTS_WITH_PHONES_ACTION =
1429                    "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES";
1430
1431            /**
1432             * The action for the starred contacts list tab.
1433             */
1434            public static final String LIST_STARRED_ACTION =
1435                    "com.android.contacts.action.LIST_STARRED";
1436
1437            /**
1438             * The action for the frequent contacts list tab.
1439             */
1440            public static final String LIST_FREQUENT_ACTION =
1441                    "com.android.contacts.action.LIST_FREQUENT";
1442
1443            /**
1444             * The action for the "strequent" contacts list tab. It first lists the starred
1445             * contacts in alphabetical order and then the frequent contacts in descending
1446             * order of the number of times they have been contacted.
1447             */
1448            public static final String LIST_STREQUENT_ACTION =
1449                    "com.android.contacts.action.LIST_STREQUENT";
1450
1451            /**
1452             * A key for to be used as an intent extra to set the activity
1453             * title to a custom String value.
1454             */
1455            public static final String TITLE_EXTRA_KEY =
1456                "com.android.contacts.extra.TITLE_EXTRA";
1457
1458            /**
1459             * Activity Action: Display a filtered list of contacts
1460             * <p>
1461             * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for
1462             * filtering
1463             * <p>
1464             * Output: Nothing.
1465             */
1466            public static final String FILTER_CONTACTS_ACTION =
1467                "com.android.contacts.action.FILTER_CONTACTS";
1468
1469            /**
1470             * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION}
1471             * intents to supply the text on which to filter.
1472             */
1473            public static final String FILTER_TEXT_EXTRA_KEY =
1474                "com.android.contacts.extra.FILTER_TEXT";
1475        }
1476
1477        /**
1478         * Convenience class that contains string constants used
1479         * to create contact {@link android.content.Intent Intents}.
1480         */
1481        public static final class Insert {
1482            /** The action code to use when adding a contact */
1483            public static final String ACTION = Intent.ACTION_INSERT;
1484
1485            /**
1486             * If present, forces a bypass of quick insert mode.
1487             */
1488            public static final String FULL_MODE = "full_mode";
1489
1490            /**
1491             * The extra field for the contact name.
1492             * <P>Type: String</P>
1493             */
1494            public static final String NAME = "name";
1495
1496            // TODO add structured name values here.
1497
1498            /**
1499             * The extra field for the contact phonetic name.
1500             * <P>Type: String</P>
1501             */
1502            public static final String PHONETIC_NAME = "phonetic_name";
1503
1504            /**
1505             * The extra field for the contact company.
1506             * <P>Type: String</P>
1507             */
1508            public static final String COMPANY = "company";
1509
1510            /**
1511             * The extra field for the contact job title.
1512             * <P>Type: String</P>
1513             */
1514            public static final String JOB_TITLE = "job_title";
1515
1516            /**
1517             * The extra field for the contact notes.
1518             * <P>Type: String</P>
1519             */
1520            public static final String NOTES = "notes";
1521
1522            /**
1523             * The extra field for the contact phone number.
1524             * <P>Type: String</P>
1525             */
1526            public static final String PHONE = "phone";
1527
1528            /**
1529             * The extra field for the contact phone number type.
1530             * <P>Type: Either an integer value from
1531             * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1532             *  or a string specifying a custom label.</P>
1533             */
1534            public static final String PHONE_TYPE = "phone_type";
1535
1536            /**
1537             * The extra field for the phone isprimary flag.
1538             * <P>Type: boolean</P>
1539             */
1540            public static final String PHONE_ISPRIMARY = "phone_isprimary";
1541
1542            /**
1543             * The extra field for an optional second contact phone number.
1544             * <P>Type: String</P>
1545             */
1546            public static final String SECONDARY_PHONE = "secondary_phone";
1547
1548            /**
1549             * The extra field for an optional second contact phone number type.
1550             * <P>Type: Either an integer value from
1551             * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1552             *  or a string specifying a custom label.</P>
1553             */
1554            public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type";
1555
1556            /**
1557             * The extra field for an optional third contact phone number.
1558             * <P>Type: String</P>
1559             */
1560            public static final String TERTIARY_PHONE = "tertiary_phone";
1561
1562            /**
1563             * The extra field for an optional third contact phone number type.
1564             * <P>Type: Either an integer value from
1565             * {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1566             *  or a string specifying a custom label.</P>
1567             */
1568            public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type";
1569
1570            /**
1571             * The extra field for the contact email address.
1572             * <P>Type: String</P>
1573             */
1574            public static final String EMAIL = "email";
1575
1576            /**
1577             * The extra field for the contact email type.
1578             * <P>Type: Either an integer value from
1579             * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1580             *  or a string specifying a custom label.</P>
1581             */
1582            public static final String EMAIL_TYPE = "email_type";
1583
1584            /**
1585             * The extra field for the email isprimary flag.
1586             * <P>Type: boolean</P>
1587             */
1588            public static final String EMAIL_ISPRIMARY = "email_isprimary";
1589
1590            /**
1591             * The extra field for an optional second contact email address.
1592             * <P>Type: String</P>
1593             */
1594            public static final String SECONDARY_EMAIL = "secondary_email";
1595
1596            /**
1597             * The extra field for an optional second contact email type.
1598             * <P>Type: Either an integer value from
1599             * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1600             *  or a string specifying a custom label.</P>
1601             */
1602            public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type";
1603
1604            /**
1605             * The extra field for an optional third contact email address.
1606             * <P>Type: String</P>
1607             */
1608            public static final String TERTIARY_EMAIL = "tertiary_email";
1609
1610            /**
1611             * The extra field for an optional third contact email type.
1612             * <P>Type: Either an integer value from
1613             * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1614             *  or a string specifying a custom label.</P>
1615             */
1616            public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type";
1617
1618            /**
1619             * The extra field for the contact postal address.
1620             * <P>Type: String</P>
1621             */
1622            public static final String POSTAL = "postal";
1623
1624            /**
1625             * The extra field for the contact postal address type.
1626             * <P>Type: Either an integer value from
1627             * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1628             *  or a string specifying a custom label.</P>
1629             */
1630            public static final String POSTAL_TYPE = "postal_type";
1631
1632            /**
1633             * The extra field for the postal isprimary flag.
1634             * <P>Type: boolean</P>
1635             */
1636            public static final String POSTAL_ISPRIMARY = "postal_isprimary";
1637
1638            /**
1639             * The extra field for an IM handle.
1640             * <P>Type: String</P>
1641             */
1642            public static final String IM_HANDLE = "im_handle";
1643
1644            /**
1645             * The extra field for the IM protocol
1646             * <P>Type: the result of {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)}
1647             * or {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.</P>
1648             */
1649            public static final String IM_PROTOCOL = "im_protocol";
1650
1651            /**
1652             * The extra field for the IM isprimary flag.
1653             * <P>Type: boolean</P>
1654             */
1655            public static final String IM_ISPRIMARY = "im_isprimary";
1656        }
1657    }
1658
1659}
1660