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