ContactsContract.java revision d530b3ce850cfa3d61b79eba1aee6f67b04dba15
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.graphics.BitmapFactory;
20import android.net.Uri;
21
22/**
23 * The contract between the contacts provider and applications. Contains definitions
24 * for the supported URIs and columns.
25 *
26 * @hide
27 */
28public final class ContactsContract {
29    /** The authority for the contacts provider */
30    public static final String AUTHORITY = "com.android.contacts";
31    /** A content:// style uri to the authority for the contacts provider */
32    public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
33
34    public interface AccountsColumns {
35        /**
36         * The name of this account data
37         * <P>Type: TEXT</P>
38         */
39        public static final String NAME = "name";
40        /**
41         * The name of this account data
42         * <P>Type: TEXT</P>
43         */
44        public static final String TYPE = "type";
45        /**
46         * The name of this account data
47         * <P>Type: TEXT</P>
48         */
49        public static final String DATA1 = "data1";
50
51        /**
52         * The value for this account data
53         * <P>Type: INTEGER</P>
54         */
55        public static final String DATA2 = "data2";
56
57        /**
58         * The value for this account data
59         * <P>Type: INTEGER</P>
60         */
61        public static final String DATA3 = "data3";
62
63        /**
64         * The value for this account data
65         * <P>Type: INTEGER</P>
66         */
67        public static final String DATA4 = "data4";
68
69        /**
70         * The value for this account data
71         * <P>Type: INTEGER</P>
72         */
73        public static final String DATA5 = "data5";
74    }
75
76    /**
77     * Constants for the aggregates table, which contains a record per group
78     * of contact representing the same person.
79     */
80    public static final class Accounts implements BaseColumns, AccountsColumns {
81        /**
82         * This utility class cannot be instantiated
83         */
84        private Accounts()  {}
85
86        /**
87         * The content:// style URI for this table
88         */
89        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "accounts");
90
91        /**
92         * The MIME type of {@link #CONTENT_URI} providing a directory of
93         * account data.
94         */
95        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contacts_account";
96
97        /**
98         * The MIME type of a {@link #CONTENT_URI} subdirectory of a account
99         */
100        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contacts_account";
101    }
102
103    public interface AggregatesColumns {
104        /**
105         * The display name for the contact.
106         * <P>Type: TEXT</P>
107         */
108        public static final String DISPLAY_NAME = "display_name";
109
110        /**
111         * The number of times a person has been contacted
112         * <P>Type: INTEGER</P>
113         */
114        public static final String TIMES_CONTACTED = "times_contacted";
115
116        /**
117         * The last time a person was contacted.
118         * <P>Type: INTEGER</P>
119         */
120        public static final String LAST_TIME_CONTACTED = "last_time_contacted";
121
122        /**
123         * Is the contact starred?
124         * <P>Type: INTEGER (boolean)</P>
125         */
126        public static final String STARRED = "starred";
127
128        /**
129         * Reference to the row in the data table holding the primary phone number.
130         * <P>Type: INTEGER REFERENCES data(_id)</P>
131         */
132        public static final String PRIMARY_PHONE_ID = "primary_phone_id";
133
134        /**
135         * Reference to the row in the data table holding the primary email address.
136         * <P>Type: INTEGER REFERENCES data(_id)</P>
137         */
138        public static final String PRIMARY_EMAIL_ID = "primary_email_id";
139
140        /**
141         * Reference to the row in the data table holding the photo.
142         * <P>Type: INTEGER REFERENCES data(_id)</P>
143         */
144        public static final String PHOTO_ID = "photo_id";
145
146        /**
147         * Reference to a row containing custom ringtone and send to voicemail information.
148         * <P>Type: INTEGER REFERENCES data(_id)</P>
149         */
150        public static final String CUSTOM_RINGTONE_ID = "custom_ringtone_id";
151    }
152
153    /**
154     * Constants for the aggregates table, which contains a record per group
155     * of contact representing the same person.
156     */
157    public static final class Aggregates implements BaseColumns, AggregatesColumns {
158        /**
159         * This utility class cannot be instantiated
160         */
161        private Aggregates()  {}
162
163        /**
164         * The content:// style URI for this table
165         */
166        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "aggregates");
167
168        /**
169         * The content:// style URI for this table joined with useful data from
170         * {@link Data} and {@link Presence}.
171         */
172        public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI,
173                "aggregates_summary");
174
175        /**
176         * The MIME type of {@link #CONTENT_URI} providing a directory of
177         * people.
178         */
179        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/person_aggregate";
180
181        /**
182         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
183         * person.
184         */
185        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/person_aggregate";
186
187        /**
188         * A sub-directory of a single contact aggregate that contains all of their
189         * {@link Data} rows.
190         */
191        public static final class Data implements BaseColumns, DataColumns {
192            /**
193             * no public constructor since this is a utility class
194             */
195            private Data() {}
196
197            /**
198             * The directory twig for this sub-table
199             */
200            public static final String CONTENT_DIRECTORY = "data";
201        }
202    }
203
204
205    /**
206     * Constants for the contacts table, which contains the base contact information.
207     */
208    public static final class Contacts implements BaseColumns {
209        /**
210         * This utility class cannot be instantiated
211         */
212        private Contacts()  {}
213
214        /**
215         * A reference to the {@link Accounts#_ID} that this data belongs to.
216         */
217        public static final String ACCOUNTS_ID = "accounts_id";
218
219        /**
220         * A reference to the {@link Aggregates#_ID} that this data belongs to.
221         */
222        public static final String AGGREGATE_ID = "aggregate_id";
223
224        /**
225         * The content:// style URI for this table
226         */
227        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "contacts");
228
229        /**
230         * The content:// style URL for filtering people by email address. The
231         * filter argument should be passed as an additional path segment after
232         * this URI.
233         *
234         * @hide
235         */
236        public static final Uri CONTENT_FILTER_EMAIL_URI = Uri.withAppendedPath(CONTENT_URI, "filter_email");
237
238        /**
239         * The MIME type of {@link #CONTENT_URI} providing a directory of
240         * people.
241         */
242        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/person";
243
244        /**
245         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
246         * person.
247         */
248        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/person";
249
250        /**
251         * A string that uniquely identifies this contact to its source, which is referred to
252         * by the {@link #ACCOUNTS_ID}
253         */
254        public static final String SOURCE_ID = "sourceid";
255
256        /**
257         * An integer that is updated whenever this contact or its data changes.
258         */
259        public static final String VERSION = "version";
260
261        /**
262         * Set to 1 whenever the version changes
263         */
264        public static final String DIRTY = "dirty";
265
266        /**
267         * A sub-directory of a single contact that contains all of their {@link Data} rows.
268         * To access this directory append
269         */
270        public static final class Data implements BaseColumns, DataColumns {
271            /**
272             * no public constructor since this is a utility class
273             */
274            private Data() {}
275
276            /**
277             * The directory twig for this sub-table
278             */
279            public static final String CONTENT_DIRECTORY = "data";
280        }
281    }
282
283    private interface DataColumns {
284        /**
285         * The package name that defines this type of data.
286         */
287        public static final String PACKAGE = "package";
288
289        /**
290         * The mime-type of the item represented by this row.
291         */
292        public static final String MIMETYPE = "mimetype";
293
294        /**
295         * A reference to the {@link android.provider.ContactsContract.Contacts#_ID}
296         * that this data belongs to.
297         */
298        public static final String CONTACT_ID = "contact_id";
299
300        /**
301         * Whether this is the primary entry of its kind for the contact it belongs to
302         * <P>Type: INTEGER (if set, non-0 means true)</P>
303         */
304        public static final String IS_PRIMARY = "is_primary";
305
306        /**
307         * Whether this is the primary entry of its kind for the aggregate it belongs to. Any data
308         * record that is "super primary" must also be "primary".
309         * <P>Type: INTEGER (if set, non-0 means true)</P>
310         */
311        public static final String IS_SUPER_PRIMARY = "is_super_primary";
312
313        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
314        public static final String DATA1 = "data1";
315        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
316        public static final String DATA2 = "data2";
317        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
318        public static final String DATA3 = "data3";
319        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
320        public static final String DATA4 = "data4";
321        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
322        public static final String DATA5 = "data5";
323        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
324        public static final String DATA6 = "data6";
325        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
326        public static final String DATA7 = "data7";
327        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
328        public static final String DATA8 = "data8";
329        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
330        public static final String DATA9 = "data9";
331        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
332        public static final String DATA10 = "data10";
333    }
334
335    /**
336     * Constants for the data table, which contains data points tied to a contact.
337     * For example, a phone number or email address. Each row in this table contains a type
338     * definition and some generic columns. Each data type can define the meaning for each of
339     * the generic columns.
340     */
341    public static final class Data implements BaseColumns, DataColumns {
342        /**
343         * This utility class cannot be instantiated
344         */
345        private Data() {}
346
347        /**
348         * The content:// style URI for this table
349         */
350        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data");
351
352        /**
353         * The MIME type of {@link #CONTENT_URI} providing a directory of data.
354         */
355        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/data";
356    }
357
358    /**
359     * A table that represents the result of looking up a phone number, for example for caller ID.
360     * The table joins that data row for the phone number with the contact that owns the number.
361     * To perform a lookup you must append the number you want to find to {@link #CONTENT_URI}.
362     */
363    public static final class PhoneLookup implements BaseColumns, DataColumns, AggregatesColumns {
364        /**
365         * This utility class cannot be instantiated
366         */
367        private PhoneLookup() {}
368
369        /**
370         * The content:// style URI for this table. Append the phone number you want to lookup
371         * to this URI and query it to perform a lookup. For example:
372         *
373         * {@code
374         * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber);
375         * }
376         */
377        public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI,
378                "phone_lookup");
379    }
380
381    /**
382     * Additional data mixed in with {@link Im.CommonPresenceColumns} to link
383     * back to specific {@link ContactsContract.Aggregates#_ID} entries.
384     */
385    private interface PresenceColumns {
386        /**
387         * Reference to the {@link Aggregates#_ID} this presence references.
388         */
389        public static final String AGGREGATE_ID = "aggregate_id";
390
391        /**
392         * Reference to the {@link Data#_ID} entry that owns this presence.
393         */
394        public static final String DATA_ID = "data_id";
395
396        /**
397         * The IM service the presence is coming from. Formatted using either
398         * {@link Contacts.ContactMethods#encodePredefinedImProtocol} or
399         * {@link Contacts.ContactMethods#encodeCustomImProtocol}.
400         * <p>
401         * Type: STRING
402         */
403        public static final String IM_PROTOCOL = "im_protocol";
404
405        /**
406         * The IM handle the presence item is for. The handle is scoped to the
407         * {@link #IM_PROTOCOL}.
408         * <p>
409         * Type: STRING
410         */
411        public static final String IM_HANDLE = "im_handle";
412
413        /**
414         * The IM account for the local user that the presence data came from.
415         * <p>
416         * Type: STRING
417         */
418        public static final String IM_ACCOUNT = "im_account";
419    }
420
421    public static final class Presence implements BaseColumns, PresenceColumns,
422            Im.CommonPresenceColumns {
423        /**
424         * This utility class cannot be instantiated
425         */
426        private Presence() {
427        }
428
429        /**
430         * The content:// style URI for this table
431         */
432        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence");
433
434        /**
435         * Gets the resource ID for the proper presence icon.
436         *
437         * @param status the status to get the icon for
438         * @return the resource ID for the proper presence icon
439         */
440        public static final int getPresenceIconResourceId(int status) {
441            switch (status) {
442                case AVAILABLE:
443                    return android.R.drawable.presence_online;
444                case IDLE:
445                case AWAY:
446                    return android.R.drawable.presence_away;
447                case DO_NOT_DISTURB:
448                    return android.R.drawable.presence_busy;
449                case INVISIBLE:
450                    return android.R.drawable.presence_invisible;
451                case OFFLINE:
452                default:
453                    return android.R.drawable.presence_offline;
454            }
455        }
456
457        /**
458         * The MIME type of {@link #CONTENT_URI} providing a directory of
459         * presence details.
460         */
461        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/im-presence";
462
463        /**
464         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
465         * presence detail.
466         */
467        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im-presence";
468    }
469
470    /**
471     * Container for definitions of common data types stored in the {@link Data} table.
472     */
473    public static final class CommonDataKinds {
474        /**
475         * The {@link Data#PACKAGE} value for common data that should be shown
476         * using a default style.
477         */
478        public static final String PACKAGE_COMMON = "common";
479
480        /**
481         * Columns common across the specific types.
482         */
483        private interface BaseCommonColumns {
484            /**
485             * The package name that defines this type of data.
486             */
487            public static final String PACKAGE = "package";
488
489            /**
490             * The mime-type of the item represented by this row.
491             */
492            public static final String MIMETYPE = "mimetype";
493
494            /**
495             * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} that this
496             * data belongs to.
497             */
498            public static final String CONTACT_ID = "contact_id";
499        }
500
501        /**
502         * Columns common across the specific types.
503         */
504        private interface CommonColumns {
505            /**
506             * The type of data, for example Home or Work.
507             * <P>Type: INTEGER</P>
508             */
509            public static final String TYPE = "data1";
510
511            /**
512             * The data for the contact method.
513             * <P>Type: TEXT</P>
514             */
515            public static final String DATA = "data2";
516
517            /**
518             * The user defined label for the the contact method.
519             * <P>Type: TEXT</P>
520             */
521            public static final String LABEL = "data3";
522        }
523
524        /**
525         * The base types that all "Typed" data kinds support.
526         */
527        public interface BaseTypes {
528
529            /**
530             * A custom type. The custom label should be supplied by user.
531             */
532            public static int TYPE_CUSTOM = 0;
533        }
534
535        /**
536         * Parts of the name.
537         */
538        public static final class StructuredName {
539            private StructuredName() {}
540
541            /** Mime-type used when storing this in data table. */
542            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name";
543
544            /**
545             * The given name for the contact.
546             * <P>Type: TEXT</P>
547             */
548            public static final String GIVEN_NAME = "data1";
549
550            /**
551             * The family name for the contact.
552             * <P>Type: TEXT</P>
553             */
554            public static final String FAMILY_NAME = "data2";
555
556            /**
557             * The contact's honorific prefix, e.g. "Sir"
558             * <P>Type: TEXT</P>
559             */
560            public static final String PREFIX = "data3";
561
562            /**
563             * The contact's middle name
564             * <P>Type: TEXT</P>
565             */
566            public static final String MIDDLE_NAME = "data4";
567
568            /**
569             * The contact's honorific suffix, e.g. "Jr"
570             */
571            public static final String SUFFIX = "data5";
572
573            /**
574             * The phonetic version of the given name for the contact.
575             * <P>Type: TEXT</P>
576             */
577            public static final String PHONETIC_GIVEN_NAME = "data6";
578
579            /**
580             * The phonetic version of the additional name for the contact.
581             * <P>Type: TEXT</P>
582             */
583            public static final String PHONETIC_MIDDLE_NAME = "data7";
584
585            /**
586             * The phonetic version of the family name for the contact.
587             * <P>Type: TEXT</P>
588             */
589            public static final String PHONETIC_FAMILY_NAME = "data8";
590
591            /**
592             * The name that should be used to display the contact.
593             * <P>Type: TEXT</P>
594             */
595            public static final String DISPLAY_NAME = "data9";
596        }
597
598        /**
599         * A nickname.
600         */
601        public static final class Nickname implements BaseTypes {
602            private Nickname() {}
603
604            /** Mime-type used when storing this in data table. */
605            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname";
606
607            /**
608             * The type of data, for example Home or Work.
609             * <P>Type: INTEGER</P>
610             */
611            public static final String TYPE = "data1";
612
613            public static final int TYPE_DEFAULT = 1;
614            public static final int TYPE_OTHER_NAME = 2;
615            public static final int TYPE_MAINDEN_NAME = 3;
616            public static final int TYPE_SHORT_NAME = 4;
617            public static final int TYPE_INITIALS = 5;
618
619            /**
620             * The name itself
621             */
622            public static final String NAME = "data2";
623
624            /**
625             * The user provided label, only used if TYPE is {@link #TYPE_CUSTOM}.
626             * <P>Type: TEXT</P>
627             */
628            public static final String LABEL = "data3";
629        }
630
631        /**
632         * Common data definition for telephone numbers.
633         */
634        public static final class Phone implements BaseCommonColumns, CommonColumns, BaseTypes {
635            private Phone() {}
636
637            /** Mime-type used when storing this in data table. */
638            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone";
639
640            public static final int TYPE_HOME = 1;
641            public static final int TYPE_MOBILE = 2;
642            public static final int TYPE_WORK = 3;
643            public static final int TYPE_FAX_WORK = 4;
644            public static final int TYPE_FAX_HOME = 5;
645            public static final int TYPE_PAGER = 6;
646            public static final int TYPE_OTHER = 7;
647
648            /**
649             * The phone number as the user entered it.
650             * <P>Type: TEXT</P>
651             */
652            public static final String NUMBER = "data2";
653        }
654
655        /**
656         * Common data definition for email addresses.
657         */
658        public static final class Email implements BaseCommonColumns, CommonColumns, BaseTypes {
659            private Email() {}
660
661            /** Mime-type used when storing this in data table. */
662            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email";
663
664            public static final int TYPE_HOME = 1;
665            public static final int TYPE_WORK = 2;
666            public static final int TYPE_OTHER = 3;
667        }
668
669        /**
670         * Common data definition for postal addresses.
671         */
672        public static final class Postal implements BaseCommonColumns, CommonColumns, BaseTypes {
673            private Postal() {}
674
675            /** Mime-type used when storing this in data table. */
676            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/postal-address";
677
678            public static final int TYPE_HOME = 1;
679            public static final int TYPE_WORK = 2;
680            public static final int TYPE_OTHER = 3;
681        }
682
683       /**
684        * Common data definition for IM addresses.
685        */
686        public static final class Im implements BaseCommonColumns, CommonColumns, BaseTypes {
687            private Im() {}
688
689            /** Mime-type used when storing this in data table. */
690            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im";
691
692            public static final int TYPE_HOME = 1;
693            public static final int TYPE_WORK = 2;
694            public static final int TYPE_OTHER = 3;
695
696            public static final String PROTOCOL = "data5";
697
698            /**
699             * The predefined IM protocol types. The protocol can either be non-present, one
700             * of these types, or a free-form string. These cases are encoded in the PROTOCOL
701             * column as:
702             * <ul>
703             * <li>null</li>
704             * <li>pre:&lt;an integer, one of the protocols below&gt;</li>
705             * <li>custom:&lt;a string&gt;</li>
706             * </ul>
707             */
708            public static final int PROTOCOL_AIM = 0;
709            public static final int PROTOCOL_MSN = 1;
710            public static final int PROTOCOL_YAHOO = 2;
711            public static final int PROTOCOL_SKYPE = 3;
712            public static final int PROTOCOL_QQ = 4;
713            public static final int PROTOCOL_GOOGLE_TALK = 5;
714            public static final int PROTOCOL_ICQ = 6;
715            public static final int PROTOCOL_JABBER = 7;
716
717            public static String encodePredefinedImProtocol(int protocol) {
718               return "pre:" + protocol;
719            }
720
721            public static String encodeCustomImProtocol(String protocolString) {
722               return "custom:" + protocolString;
723            }
724
725            public static Object decodeImProtocol(String encodedString) {
726               if (encodedString == null) {
727                   return null;
728               }
729
730               if (encodedString.startsWith("pre:")) {
731                   return Integer.parseInt(encodedString.substring(4));
732               }
733
734               if (encodedString.startsWith("custom:")) {
735                   return encodedString.substring(7);
736               }
737
738               throw new IllegalArgumentException(
739                       "the value is not a valid encoded protocol, " + encodedString);
740            }
741        }
742
743        /**
744         * Common data definition for organizations.
745         */
746        public static final class Organization implements BaseCommonColumns, BaseTypes {
747            private Organization() {}
748
749            /** Mime-type used when storing this in data table. */
750            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization";
751
752            /**
753             * The type of data, for example Home or Work.
754             * <P>Type: INTEGER</P>
755             */
756            public static final String TYPE = "data1";
757
758            public static final int TYPE_HOME = 1;
759            public static final int TYPE_WORK = 2;
760            public static final int TYPE_OTHER = 3;
761
762            /**
763             * The user provided label, only used if TYPE is {@link #TYPE_CUSTOM}.
764             * <P>Type: TEXT</P>
765             */
766            public static final String LABEL = "data2";
767
768            /**
769             * The company as the user entered it.
770             * <P>Type: TEXT</P>
771             */
772            public static final String COMPANY = "data3";
773
774            /**
775             * The position title at this company as the user entered it.
776             * <P>Type: TEXT</P>
777             */
778            public static final String TITLE = "data4";
779        }
780
781        /**
782         * Photo of the contact.
783         */
784        public static final class Photo implements BaseCommonColumns {
785            private Photo() {}
786
787            /** Mime-type used when storing this in data table. */
788            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo";
789
790            /**
791             * Thumbnail photo of the contact. This is the raw bytes of an image
792             * that could be inflated using {@link BitmapFactory}.
793             * <p>
794             * Type: BLOB
795             */
796            public static final String PHOTO = "data1";
797        }
798
799        /**
800         * Notes about the contact.
801         */
802        public static final class Note implements BaseCommonColumns {
803            private Note() {}
804
805            /** Mime-type used when storing this in data table. */
806            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note";
807
808            /**
809             * The note text.
810             * <P>Type: TEXT</P>
811             */
812            public static final String NOTE = "data1";
813        }
814
815        /**
816         * Custom ringtone associated with the contact.
817         */
818        public static final class CustomRingtone implements BaseCommonColumns {
819            private CustomRingtone() {}
820
821            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/custom_ringtone";
822
823            /**
824             * Whether to send the number to voicemail.
825             * <P>Type: INTEGER (if set, non-0 means true)</P>
826             */
827            public static final String SEND_TO_VOICEMAIL = "data1";
828
829            /**
830             * The ringtone uri.
831             * <P>Type: TEXT</P>
832             */
833            public static final String RINGTONE_URI = "data2";
834        }
835
836        /**
837         * Group Membership.
838         */
839        public static final class GroupMembership implements BaseCommonColumns {
840            private GroupMembership() {}
841
842            /** Mime-type used when storing this in data table. */
843            public static final String CONTENT_ITEM_TYPE =
844                    "vnd.android.cursor.item/group_membership";
845
846            /**
847             * The row id of the group that this group membership refers to. Either this or the
848             * GROUP_SOURCE_ID must be set. If they are both set then they must refer to the same
849             * group.
850             * <P>Type: INTEGER</P>
851             */
852            public static final String GROUP_ROW_ID = "data1";
853
854            /**
855             * The source id of the group that this membership refers to. Either this or the
856             * GROUP_ROW_ID must be set. If they are both set then they must refer to the same
857             * group.
858             * <P>Type: STRING</P>
859             */
860            public static final String GROUP_SOURCE_ID = "data2";
861        }
862    }
863
864    /**
865     * Constants for the contact aggregation exceptions table, which contains
866     * aggregation rules overriding those used by automatic aggregation.
867     */
868    public static final class AggregationExceptions {
869        /**
870         * This utility class cannot be instantiated
871         */
872        private AggregationExceptions() {}
873
874        /**
875         * The content:// style URI for this table
876         */
877        public static final Uri CONTENT_URI =
878                Uri.withAppendedPath(AUTHORITY_URI, "aggregation_exceptions");
879
880        /**
881         * The MIME type of {@link #CONTENT_URI} providing a directory of data.
882         */
883        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception";
884
885        /**
886         * The type of exception: {@link #TYPE_NEVER_MATCH} or {@link #TYPE_ALWAYS_MATCH}.
887         *
888         * <P>Type: INTEGER</P>
889         */
890        public static final String TYPE = "type";
891
892        public static final int TYPE_NEVER_MATCH = 0;
893        public static final int TYPE_ALWAYS_MATCH = 1;
894
895        /**
896         * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} of one of
897         * the contacts that the rule applies to.
898         */
899        public static final String CONTACT_ID1 = "contact_id1";
900
901        /**
902         * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} of the other
903         * contact that the rule applies to.
904         */
905        public static final String CONTACT_ID2 = "contact_id2";
906    }
907}
908