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