Contacts.java revision ba176d6c8ad581e65b46bd6835c0737e74ef453d
1/*
2 * Copyright (C) 2006 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 com.android.internal.R;
20
21import android.content.ContentResolver;
22import android.content.ContentUris;
23import android.content.ContentValues;
24import android.content.Context;
25import android.database.Cursor;
26import android.graphics.Bitmap;
27import android.graphics.BitmapFactory;
28import android.net.Uri;
29import android.os.Build;
30import android.text.TextUtils;
31import android.util.Log;
32import android.widget.ImageView;
33
34import java.io.ByteArrayInputStream;
35import java.io.InputStream;
36
37/**
38 * The Contacts provider stores all information about contacts.
39 */
40@Deprecated
41public class Contacts {
42    private static final String TAG = "Contacts";
43
44    @Deprecated
45    public static final String AUTHORITY = "contacts";
46
47    /**
48     * The content:// style URL for this provider
49     */
50    @Deprecated
51    public static final Uri CONTENT_URI =
52        Uri.parse("content://" + AUTHORITY);
53
54    /** Signifies an email address row that is stored in the ContactMethods table */
55    @Deprecated
56    public static final int KIND_EMAIL = 1;
57    /** Signifies a postal address row that is stored in the ContactMethods table */
58    @Deprecated
59    public static final int KIND_POSTAL = 2;
60    /** Signifies an IM address row that is stored in the ContactMethods table */
61    @Deprecated
62    public static final int KIND_IM = 3;
63    /** Signifies an Organization row that is stored in the Organizations table */
64    @Deprecated
65    public static final int KIND_ORGANIZATION = 4;
66    /** Signifies an Phone row that is stored in the Phones table */
67    @Deprecated
68    public static final int KIND_PHONE = 5;
69
70    /**
71     * no public constructor since this is a utility class
72     */
73    private Contacts() {}
74
75    /**
76     * Columns from the Settings table that other columns join into themselves.
77     */
78    @Deprecated
79    public interface SettingsColumns {
80        /**
81         * The _SYNC_ACCOUNT to which this setting corresponds. This may be null.
82         * <P>Type: TEXT</P>
83         */
84        @Deprecated
85        public static final String _SYNC_ACCOUNT = "_sync_account";
86
87        /**
88         * The _SYNC_ACCOUNT_TYPE to which this setting corresponds. This may be null.
89         * <P>Type: TEXT</P>
90         */
91        @Deprecated
92        public static final String _SYNC_ACCOUNT_TYPE = "_sync_account_type";
93
94        /**
95         * The key of this setting.
96         * <P>Type: TEXT</P>
97         */
98        @Deprecated
99        public static final String KEY = "key";
100
101        /**
102         * The value of this setting.
103         * <P>Type: TEXT</P>
104         */
105        @Deprecated
106        public static final String VALUE = "value";
107    }
108
109    /**
110     * The settings over all of the people
111     */
112    @Deprecated
113    public static final class Settings implements BaseColumns, SettingsColumns {
114        /**
115         * no public constructor since this is a utility class
116         */
117        private Settings() {}
118
119        /**
120         * The content:// style URL for this table
121         */
122        @Deprecated
123        public static final Uri CONTENT_URI =
124            Uri.parse("content://contacts/settings");
125
126        /**
127         * The directory twig for this sub-table
128         */
129        @Deprecated
130        public static final String CONTENT_DIRECTORY = "settings";
131
132        /**
133         * The default sort order for this table
134         */
135        @Deprecated
136        public static final String DEFAULT_SORT_ORDER = "key ASC";
137
138        /**
139         * A setting that is used to indicate if we should sync down all groups for the
140         * specified account. For this setting the _SYNC_ACCOUNT column must be set.
141         * If this isn't set then we will only sync the groups whose SHOULD_SYNC column
142         * is set to true.
143         * <p>
144         * This is a boolean setting. It is true if it is set and it is anything other than the
145         * emptry string or "0".
146         */
147        @Deprecated
148        public static final String SYNC_EVERYTHING = "syncEverything";
149
150        @Deprecated
151        public static String getSetting(ContentResolver cr, String account, String key) {
152            // For now we only support a single account and the UI doesn't know what
153            // the account name is, so we're using a global setting for SYNC_EVERYTHING.
154            // Some day when we add multiple accounts to the UI this should honor the account
155            // that was asked for.
156            String selectString;
157            String[] selectArgs;
158            if (false) {
159                selectString = (account == null)
160                        ? "_sync_account is null AND key=?"
161                        : "_sync_account=? AND key=?";
162//                : "_sync_account=? AND _sync_account_type=? AND key=?";
163                selectArgs = (account == null)
164                ? new String[]{key}
165                : new String[]{account, key};
166            } else {
167                selectString = "key=?";
168                selectArgs = new String[] {key};
169            }
170            Cursor cursor = cr.query(Settings.CONTENT_URI, new String[]{VALUE},
171                    selectString, selectArgs, null);
172            try {
173                if (!cursor.moveToNext()) return null;
174                return cursor.getString(0);
175            } finally {
176                cursor.close();
177            }
178        }
179
180        @Deprecated
181        public static void setSetting(ContentResolver cr, String account, String key,
182                String value) {
183            ContentValues values = new ContentValues();
184            // For now we only support a single account and the UI doesn't know what
185            // the account name is, so we're using a global setting for SYNC_EVERYTHING.
186            // Some day when we add multiple accounts to the UI this should honor the account
187            // that was asked for.
188            //values.put(_SYNC_ACCOUNT, account.mName);
189            //values.put(_SYNC_ACCOUNT_TYPE, account.mType);
190            values.put(KEY, key);
191            values.put(VALUE, value);
192            cr.update(Settings.CONTENT_URI, values, null, null);
193        }
194    }
195
196    /**
197     * Columns from the People table that other tables join into themselves.
198     */
199    @Deprecated
200    public interface PeopleColumns {
201        /**
202         * The person's name.
203         * <P>Type: TEXT</P>
204         */
205        @Deprecated
206        public static final String NAME = "name";
207
208        /**
209         * Phonetic equivalent of the person's name, in a locale-dependent
210         * character set (e.g. hiragana for Japanese).
211         * Used for pronunciation and/or collation in some languages.
212         * <p>Type: TEXT</P>
213         */
214        @Deprecated
215        public static final String PHONETIC_NAME = "phonetic_name";
216
217        /**
218         * The display name. If name is not null name, else if number is not null number,
219         * else if email is not null email.
220         * <P>Type: TEXT</P>
221         */
222        @Deprecated
223        public static final String DISPLAY_NAME = "display_name";
224
225        /**
226         * The field for sorting list phonetically. The content of this field
227         * may not be human readable but phonetically sortable.
228         * <P>Type: TEXT</p>
229         * @hide Used only in Contacts application for now.
230         */
231        @Deprecated
232        public static final String SORT_STRING = "sort_string";
233
234        /**
235         * Notes about the person.
236         * <P>Type: TEXT</P>
237         */
238        @Deprecated
239        public static final String NOTES = "notes";
240
241        /**
242         * The number of times a person has been contacted
243         * <P>Type: INTEGER</P>
244         */
245        @Deprecated
246        public static final String TIMES_CONTACTED = "times_contacted";
247
248        /**
249         * The last time a person was contacted.
250         * <P>Type: INTEGER</P>
251         */
252        @Deprecated
253        public static final String LAST_TIME_CONTACTED = "last_time_contacted";
254
255        /**
256         * A custom ringtone associated with a person. Not always present.
257         * <P>Type: TEXT (URI to the ringtone)</P>
258         */
259        @Deprecated
260        public static final String CUSTOM_RINGTONE = "custom_ringtone";
261
262        /**
263         * Whether the person should always be sent to voicemail. Not always
264         * present.
265         * <P>Type: INTEGER (0 for false, 1 for true)</P>
266         */
267        @Deprecated
268        public static final String SEND_TO_VOICEMAIL = "send_to_voicemail";
269
270        /**
271         * Is the contact starred?
272         * <P>Type: INTEGER (boolean)</P>
273         */
274        @Deprecated
275        public static final String STARRED = "starred";
276
277        /**
278         * The server version of the photo
279         * <P>Type: TEXT (the version number portion of the photo URI)</P>
280         */
281        @Deprecated
282        public static final String PHOTO_VERSION = "photo_version";
283    }
284
285    /**
286     * This table contains people.
287     */
288    @Deprecated
289    public static final class People implements BaseColumns, SyncConstValue, PeopleColumns,
290            PhonesColumns, PresenceColumns {
291        /**
292         * no public constructor since this is a utility class
293         */
294        private People() {}
295
296        /**
297         * The content:// style URL for this table
298         */
299        @Deprecated
300        public static final Uri CONTENT_URI =
301            Uri.parse("content://contacts/people");
302
303        /**
304         * The content:// style URL for filtering people by name. The filter
305         * argument should be passed as an additional path segment after this URI.
306         */
307        @Deprecated
308        public static final Uri CONTENT_FILTER_URI =
309            Uri.parse("content://contacts/people/filter");
310
311        /**
312         * The content:// style URL for the table that holds the deleted
313         * contacts.
314         */
315        @Deprecated
316        public static final Uri DELETED_CONTENT_URI =
317            Uri.parse("content://contacts/deleted_people");
318
319        /**
320         * The content:// style URL for filtering people that have a specific
321         * E-mail or IM address. The filter argument should be passed as an
322         * additional path segment after this URI. This matches any people with
323         * at least one E-mail or IM {@link ContactMethods} that match the
324         * filter.
325         *
326         * Not exposed because we expect significant changes in the contacts
327         * schema and do not want to have to support this.
328         * @hide
329         */
330        @Deprecated
331        public static final Uri WITH_EMAIL_OR_IM_FILTER_URI =
332            Uri.parse("content://contacts/people/with_email_or_im_filter");
333
334        /**
335         * The MIME type of {@link #CONTENT_URI} providing a directory of
336         * people.
337         */
338        @Deprecated
339        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/person";
340
341        /**
342         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
343         * person.
344         */
345        @Deprecated
346        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/person";
347
348        /**
349         * The default sort order for this table
350         */
351        @Deprecated
352        public static final String DEFAULT_SORT_ORDER = People.NAME + " ASC";
353
354        /**
355         * The ID of the persons preferred phone number.
356         * <P>Type: INTEGER (foreign key to phones table on the _ID field)</P>
357         */
358        @Deprecated
359        public static final String PRIMARY_PHONE_ID = "primary_phone";
360
361        /**
362         * The ID of the persons preferred email.
363         * <P>Type: INTEGER (foreign key to contact_methods table on the
364         * _ID field)</P>
365         */
366        @Deprecated
367        public static final String PRIMARY_EMAIL_ID = "primary_email";
368
369        /**
370         * The ID of the persons preferred organization.
371         * <P>Type: INTEGER (foreign key to organizations table on the
372         * _ID field)</P>
373         */
374        @Deprecated
375        public static final String PRIMARY_ORGANIZATION_ID = "primary_organization";
376
377        /**
378         * Mark a person as having been contacted.
379         *
380         * @param resolver the ContentResolver to use
381         * @param personId the person who was contacted
382         */
383        @Deprecated
384        public static void markAsContacted(ContentResolver resolver, long personId) {
385            Uri uri = ContentUris.withAppendedId(CONTENT_URI, personId);
386            uri = Uri.withAppendedPath(uri, "update_contact_time");
387            ContentValues values = new ContentValues();
388            // There is a trigger in place that will update TIMES_CONTACTED when
389            // LAST_TIME_CONTACTED is modified.
390            values.put(LAST_TIME_CONTACTED, System.currentTimeMillis());
391            resolver.update(uri, values, null, null);
392        }
393
394        /**
395         * @hide Used in vCard parser code.
396         */
397        @Deprecated
398        public static long tryGetMyContactsGroupId(ContentResolver resolver) {
399            Cursor groupsCursor = resolver.query(Groups.CONTENT_URI, GROUPS_PROJECTION,
400                    Groups.SYSTEM_ID + "='" + Groups.GROUP_MY_CONTACTS + "'", null, null);
401            if (groupsCursor != null) {
402                try {
403                    if (groupsCursor.moveToFirst()) {
404                        return groupsCursor.getLong(0);
405                    }
406                } finally {
407                    groupsCursor.close();
408                }
409            }
410            return 0;
411        }
412
413        /**
414         * Adds a person to the My Contacts group.
415         *
416         * @param resolver the resolver to use
417         * @param personId the person to add to the group
418         * @return the URI of the group membership row
419         * @throws IllegalStateException if the My Contacts group can't be found
420         */
421        @Deprecated
422        public static Uri addToMyContactsGroup(ContentResolver resolver, long personId) {
423            long groupId = tryGetMyContactsGroupId(resolver);
424            if (groupId == 0) {
425                throw new IllegalStateException("Failed to find the My Contacts group");
426            }
427
428            return addToGroup(resolver, personId, groupId);
429        }
430
431        /**
432         * Adds a person to a group referred to by name.
433         *
434         * @param resolver the resolver to use
435         * @param personId the person to add to the group
436         * @param groupName the name of the group to add the contact to
437         * @return the URI of the group membership row
438         * @throws IllegalStateException if the group can't be found
439         */
440        @Deprecated
441        public static Uri addToGroup(ContentResolver resolver, long personId, String groupName) {
442            long groupId = 0;
443            Cursor groupsCursor = resolver.query(Groups.CONTENT_URI, GROUPS_PROJECTION,
444                    Groups.NAME + "=?", new String[] { groupName }, null);
445            if (groupsCursor != null) {
446                try {
447                    if (groupsCursor.moveToFirst()) {
448                        groupId = groupsCursor.getLong(0);
449                    }
450                } finally {
451                    groupsCursor.close();
452                }
453            }
454
455            if (groupId == 0) {
456                throw new IllegalStateException("Failed to find the My Contacts group");
457            }
458
459            return addToGroup(resolver, personId, groupId);
460        }
461
462        /**
463         * Adds a person to a group.
464         *
465         * @param resolver the resolver to use
466         * @param personId the person to add to the group
467         * @param groupId the group to add the person to
468         * @return the URI of the group membership row
469         */
470        @Deprecated
471        public static Uri addToGroup(ContentResolver resolver, long personId, long groupId) {
472            ContentValues values = new ContentValues();
473            values.put(GroupMembership.PERSON_ID, personId);
474            values.put(GroupMembership.GROUP_ID, groupId);
475            return resolver.insert(GroupMembership.CONTENT_URI, values);
476        }
477
478        private static final String[] GROUPS_PROJECTION = new String[] {
479            Groups._ID,
480        };
481
482        /**
483         * Creates a new contacts and adds it to the "My Contacts" group.
484         *
485         * @param resolver the ContentResolver to use
486         * @param values the values to use when creating the contact
487         * @return the URI of the contact, or null if the operation fails
488         */
489        @Deprecated
490        public static Uri createPersonInMyContactsGroup(ContentResolver resolver,
491                ContentValues values) {
492
493            Uri contactUri = resolver.insert(People.CONTENT_URI, values);
494            if (contactUri == null) {
495                Log.e(TAG, "Failed to create the contact");
496                return null;
497            }
498
499            if (addToMyContactsGroup(resolver, ContentUris.parseId(contactUri)) == null) {
500                resolver.delete(contactUri, null, null);
501                return null;
502            }
503            return contactUri;
504        }
505
506        @Deprecated
507        public static Cursor queryGroups(ContentResolver resolver, long person) {
508            return resolver.query(GroupMembership.CONTENT_URI, null, "person=?",
509                    new String[]{String.valueOf(person)}, Groups.DEFAULT_SORT_ORDER);
510        }
511
512        /**
513         * Set the photo for this person. data may be null
514         * @param cr the ContentResolver to use
515         * @param person the Uri of the person whose photo is to be updated
516         * @param data the byte[] that represents the photo
517         */
518        @Deprecated
519        public static void setPhotoData(ContentResolver cr, Uri person, byte[] data) {
520            Uri photoUri = Uri.withAppendedPath(person, Contacts.Photos.CONTENT_DIRECTORY);
521            ContentValues values = new ContentValues();
522            values.put(Photos.DATA, data);
523            cr.update(photoUri, values, null, null);
524        }
525
526        /**
527         * Opens an InputStream for the person's photo and returns the photo as a Bitmap.
528         * If the person's photo isn't present returns the placeholderImageResource instead.
529         * @param person the person whose photo should be used
530         */
531        @Deprecated
532        public static InputStream openContactPhotoInputStream(ContentResolver cr, Uri person) {
533            Uri photoUri = Uri.withAppendedPath(person, Contacts.Photos.CONTENT_DIRECTORY);
534            Cursor cursor = cr.query(photoUri, new String[]{Photos.DATA}, null, null, null);
535            try {
536                if (!cursor.moveToNext()) {
537                    return null;
538                }
539                byte[] data = cursor.getBlob(0);
540                if (data == null) {
541                    return null;
542                }
543                return new ByteArrayInputStream(data);
544            } finally {
545                cursor.close();
546            }
547        }
548
549        /**
550         * Opens an InputStream for the person's photo and returns the photo as a Bitmap.
551         * If the person's photo isn't present returns the placeholderImageResource instead.
552         * @param context the Context
553         * @param person the person whose photo should be used
554         * @param placeholderImageResource the image resource to use if the person doesn't
555         *   have a photo
556         * @param options the decoding options, can be set to null
557         */
558        @Deprecated
559        public static Bitmap loadContactPhoto(Context context, Uri person,
560                int placeholderImageResource, BitmapFactory.Options options) {
561            if (person == null) {
562                return loadPlaceholderPhoto(placeholderImageResource, context, options);
563            }
564
565            InputStream stream = openContactPhotoInputStream(context.getContentResolver(), person);
566            Bitmap bm = stream != null ? BitmapFactory.decodeStream(stream, null, options) : null;
567            if (bm == null) {
568                bm = loadPlaceholderPhoto(placeholderImageResource, context, options);
569            }
570            return bm;
571        }
572
573        private static Bitmap loadPlaceholderPhoto(int placeholderImageResource, Context context,
574                BitmapFactory.Options options) {
575            if (placeholderImageResource == 0) {
576                return null;
577            }
578            return BitmapFactory.decodeResource(context.getResources(),
579                    placeholderImageResource, options);
580        }
581
582        /**
583         * A sub directory of a single person that contains all of their Phones.
584         */
585        @Deprecated
586        public static final class Phones implements BaseColumns, PhonesColumns,
587                PeopleColumns {
588            /**
589             * no public constructor since this is a utility class
590             */
591            private Phones() {}
592
593            /**
594             * The directory twig for this sub-table
595             */
596            @Deprecated
597            public static final String CONTENT_DIRECTORY = "phones";
598
599            /**
600             * The default sort order for this table
601             */
602            @Deprecated
603            public static final String DEFAULT_SORT_ORDER = "number ASC";
604        }
605
606        /**
607         * A subdirectory of a single person that contains all of their
608         * ContactMethods.
609         */
610        @Deprecated
611        public static final class ContactMethods
612                implements BaseColumns, ContactMethodsColumns, PeopleColumns {
613            /**
614             * no public constructor since this is a utility class
615             */
616            private ContactMethods() {}
617
618            /**
619             * The directory twig for this sub-table
620             */
621            @Deprecated
622            public static final String CONTENT_DIRECTORY = "contact_methods";
623
624            /**
625             * The default sort order for this table
626             */
627            @Deprecated
628            public static final String DEFAULT_SORT_ORDER = "data ASC";
629        }
630
631        /**
632         * The extensions for a person
633         */
634        @Deprecated
635        public static class Extensions implements BaseColumns, ExtensionsColumns {
636            /**
637             * no public constructor since this is a utility class
638             */
639            private Extensions() {}
640
641            /**
642             * The directory twig for this sub-table
643             */
644            @Deprecated
645            public static final String CONTENT_DIRECTORY = "extensions";
646
647            /**
648             * The default sort order for this table
649             */
650            @Deprecated
651            public static final String DEFAULT_SORT_ORDER = "name ASC";
652
653            /**
654             * The ID of the person this phone number is assigned to.
655             * <P>Type: INTEGER (long)</P>
656             */
657            @Deprecated
658            public static final String PERSON_ID = "person";
659        }
660    }
661
662    /**
663     * Columns from the groups table.
664     */
665    @Deprecated
666    public interface GroupsColumns {
667        /**
668         * The group name.
669         * <P>Type: TEXT</P>
670         */
671        @Deprecated
672        public static final String NAME = "name";
673
674        /**
675         * Notes about the group.
676         * <P>Type: TEXT</P>
677         */
678        @Deprecated
679        public static final String NOTES = "notes";
680
681        /**
682         * Whether this group should be synced if the SYNC_EVERYTHING settings is false
683         * for this group's account.
684         * <P>Type: INTEGER (boolean)</P>
685         */
686        @Deprecated
687        public static final String SHOULD_SYNC = "should_sync";
688
689        /**
690         * The ID of this group if it is a System Group, null otherwise.
691         * <P>Type: TEXT</P>
692         */
693        @Deprecated
694        public static final String SYSTEM_ID = "system_id";
695    }
696
697    /**
698     * This table contains the groups for an account.
699     */
700    @Deprecated
701    public static final class Groups
702            implements BaseColumns, SyncConstValue, GroupsColumns {
703        /**
704         * no public constructor since this is a utility class
705         */
706        private Groups() {}
707
708        /**
709         * The content:// style URL for this table
710         */
711        @Deprecated
712        public static final Uri CONTENT_URI =
713            Uri.parse("content://contacts/groups");
714
715        /**
716         * The content:// style URL for the table that holds the deleted
717         * groups.
718         */
719        @Deprecated
720        public static final Uri DELETED_CONTENT_URI =
721            Uri.parse("content://contacts/deleted_groups");
722
723        /**
724         * The MIME type of {@link #CONTENT_URI} providing a directory of
725         * groups.
726         */
727        @Deprecated
728        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contactsgroup";
729
730        /**
731         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
732         * group.
733         */
734        @Deprecated
735        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contactsgroup";
736
737        /**
738         * The default sort order for this table
739         */
740        @Deprecated
741        public static final String DEFAULT_SORT_ORDER = NAME + " ASC";
742
743        /**
744         *
745         */
746        @Deprecated
747        public static final String GROUP_ANDROID_STARRED = "Starred in Android";
748
749        /**
750         * The "My Contacts" system group.
751         */
752        @Deprecated
753        public static final String GROUP_MY_CONTACTS = "Contacts";
754    }
755
756    /**
757     * Columns from the Phones table that other columns join into themselves.
758     */
759    @Deprecated
760    public interface PhonesColumns {
761        /**
762         * The type of the the phone number.
763         * <P>Type: INTEGER (one of the constants below)</P>
764         */
765        @Deprecated
766        public static final String TYPE = "type";
767
768        @Deprecated
769        public static final int TYPE_CUSTOM = 0;
770        @Deprecated
771        public static final int TYPE_HOME = 1;
772        @Deprecated
773        public static final int TYPE_MOBILE = 2;
774        @Deprecated
775        public static final int TYPE_WORK = 3;
776        @Deprecated
777        public static final int TYPE_FAX_WORK = 4;
778        @Deprecated
779        public static final int TYPE_FAX_HOME = 5;
780        @Deprecated
781        public static final int TYPE_PAGER = 6;
782        @Deprecated
783        public static final int TYPE_OTHER = 7;
784
785        /**
786         * The user provided label for the phone number, only used if TYPE is TYPE_CUSTOM.
787         * <P>Type: TEXT</P>
788         */
789        @Deprecated
790        public static final String LABEL = "label";
791
792        /**
793         * The phone number as the user entered it.
794         * <P>Type: TEXT</P>
795         */
796        @Deprecated
797        public static final String NUMBER = "number";
798
799        /**
800         * The normalized phone number
801         * <P>Type: TEXT</P>
802         */
803        @Deprecated
804        public static final String NUMBER_KEY = "number_key";
805
806        /**
807         * Whether this is the primary phone number
808         * <P>Type: INTEGER (if set, non-0 means true)</P>
809         */
810        @Deprecated
811        public static final String ISPRIMARY = "isprimary";
812    }
813
814    /**
815     * This table stores phone numbers and a reference to the person that the
816     * contact method belongs to. Phone numbers are stored separately from
817     * other contact methods to make caller ID lookup more efficient.
818     */
819    @Deprecated
820    public static final class Phones
821            implements BaseColumns, PhonesColumns, PeopleColumns {
822        /**
823         * no public constructor since this is a utility class
824         */
825        private Phones() {}
826
827        @Deprecated
828        public static final CharSequence getDisplayLabel(Context context, int type,
829                CharSequence label, CharSequence[] labelArray) {
830            CharSequence display = "";
831
832            if (type != People.Phones.TYPE_CUSTOM) {
833                CharSequence[] labels = labelArray != null? labelArray
834                        : context.getResources().getTextArray(
835                                com.android.internal.R.array.phoneTypes);
836                try {
837                    display = labels[type - 1];
838                } catch (ArrayIndexOutOfBoundsException e) {
839                    display = labels[People.Phones.TYPE_HOME - 1];
840                }
841            } else {
842                if (!TextUtils.isEmpty(label)) {
843                    display = label;
844                }
845            }
846            return display;
847        }
848
849        @Deprecated
850        public static final CharSequence getDisplayLabel(Context context, int type,
851                CharSequence label) {
852            return getDisplayLabel(context, type, label, null);
853        }
854
855        /**
856         * The content:// style URL for this table
857         */
858        @Deprecated
859        public static final Uri CONTENT_URI =
860            Uri.parse("content://contacts/phones");
861
862        /**
863         * The content:// style URL for filtering phone numbers
864         */
865        @Deprecated
866        public static final Uri CONTENT_FILTER_URL =
867            Uri.parse("content://contacts/phones/filter");
868
869        /**
870         * The MIME type of {@link #CONTENT_URI} providing a directory of
871         * phones.
872         */
873        @Deprecated
874        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone";
875
876        /**
877         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
878         * phone.
879         */
880        @Deprecated
881        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone";
882
883        /**
884         * The default sort order for this table
885         */
886        @Deprecated
887        public static final String DEFAULT_SORT_ORDER = "name ASC";
888
889        /**
890         * The ID of the person this phone number is assigned to.
891         * <P>Type: INTEGER (long)</P>
892         */
893        @Deprecated
894        public static final String PERSON_ID = "person";
895    }
896
897    @Deprecated
898    public static final class GroupMembership implements BaseColumns, GroupsColumns {
899        /**
900         * no public constructor since this is a utility class
901         */
902        private GroupMembership() {}
903
904        /**
905         * The content:// style URL for this table
906         */
907        @Deprecated
908        public static final Uri CONTENT_URI =
909            Uri.parse("content://contacts/groupmembership");
910
911        /**
912         * The content:// style URL for this table
913         */
914        @Deprecated
915        public static final Uri RAW_CONTENT_URI =
916            Uri.parse("content://contacts/groupmembershipraw");
917
918        /**
919         * The directory twig for this sub-table
920         */
921        @Deprecated
922        public static final String CONTENT_DIRECTORY = "groupmembership";
923
924        /**
925         * The MIME type of {@link #CONTENT_URI} providing a directory of all
926         * person groups.
927         */
928        @Deprecated
929        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contactsgroupmembership";
930
931        /**
932         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
933         * person group.
934         */
935        @Deprecated
936        public static final String CONTENT_ITEM_TYPE =
937                "vnd.android.cursor.item/contactsgroupmembership";
938
939        /**
940         * The default sort order for this table
941         */
942        @Deprecated
943        public static final String DEFAULT_SORT_ORDER = "group_id ASC";
944
945        /**
946         * The row id of the accounts group.
947         * <P>Type: TEXT</P>
948         */
949        @Deprecated
950        public static final String GROUP_ID = "group_id";
951
952        /**
953         * The sync id of the group.
954         * <P>Type: TEXT</P>
955         */
956        @Deprecated
957        public static final String GROUP_SYNC_ID = "group_sync_id";
958
959        /**
960         * The account of the group.
961         * <P>Type: TEXT</P>
962         */
963        @Deprecated
964        public static final String GROUP_SYNC_ACCOUNT = "group_sync_account";
965
966        /**
967         * The account type of the group.
968         * <P>Type: TEXT</P>
969         */
970        @Deprecated
971        public static final String GROUP_SYNC_ACCOUNT_TYPE = "group_sync_account_type";
972
973        /**
974         * The row id of the person.
975         * <P>Type: TEXT</P>
976         */
977        @Deprecated
978        public static final String PERSON_ID = "person";
979    }
980
981    /**
982     * Columns from the ContactMethods table that other tables join into
983     * themseleves.
984     */
985    @Deprecated
986    public interface ContactMethodsColumns {
987        /**
988         * The kind of the the contact method. For example, email address,
989         * postal address, etc.
990         * <P>Type: INTEGER (one of the values below)</P>
991         */
992        @Deprecated
993        public static final String KIND = "kind";
994
995        /**
996         * The type of the contact method, must be one of the types below.
997         * <P>Type: INTEGER (one of the values below)</P>
998         */
999        @Deprecated
1000        public static final String TYPE = "type";
1001        @Deprecated
1002        public static final int TYPE_CUSTOM = 0;
1003        @Deprecated
1004        public static final int TYPE_HOME = 1;
1005        @Deprecated
1006        public static final int TYPE_WORK = 2;
1007        @Deprecated
1008        public static final int TYPE_OTHER = 3;
1009
1010        /**
1011         * @hide This is temporal. TYPE_MOBILE should be added to TYPE in the future.
1012         */
1013        @Deprecated
1014        public static final int MOBILE_EMAIL_TYPE_INDEX = 2;
1015
1016        /**
1017         * @hide This is temporal. TYPE_MOBILE should be added to TYPE in the future.
1018         * This is not "mobile" but "CELL" since vCard uses it for identifying mobile phone.
1019         */
1020        @Deprecated
1021        public static final String MOBILE_EMAIL_TYPE_NAME = "_AUTO_CELL";
1022
1023        /**
1024         * The user defined label for the the contact method.
1025         * <P>Type: TEXT</P>
1026         */
1027        @Deprecated
1028        public static final String LABEL = "label";
1029
1030        /**
1031         * The data for the contact method.
1032         * <P>Type: TEXT</P>
1033         */
1034        @Deprecated
1035        public static final String DATA = "data";
1036
1037        /**
1038         * Auxiliary data for the contact method.
1039         * <P>Type: TEXT</P>
1040         */
1041        @Deprecated
1042        public static final String AUX_DATA = "aux_data";
1043
1044        /**
1045         * Whether this is the primary organization
1046         * <P>Type: INTEGER (if set, non-0 means true)</P>
1047         */
1048        @Deprecated
1049        public static final String ISPRIMARY = "isprimary";
1050    }
1051
1052    /**
1053     * This table stores all non-phone contact methods and a reference to the
1054     * person that the contact method belongs to.
1055     */
1056    @Deprecated
1057    public static final class ContactMethods
1058            implements BaseColumns, ContactMethodsColumns, PeopleColumns {
1059        /**
1060         * The column with latitude data for postal locations
1061         * <P>Type: REAL</P>
1062         */
1063        @Deprecated
1064        public static final String POSTAL_LOCATION_LATITUDE = DATA;
1065
1066        /**
1067         * The column with longitude data for postal locations
1068         * <P>Type: REAL</P>
1069         */
1070        @Deprecated
1071        public static final String POSTAL_LOCATION_LONGITUDE = AUX_DATA;
1072
1073        /**
1074         * The predefined IM protocol types. The protocol can either be non-present, one
1075         * of these types, or a free-form string. These cases are encoded in the AUX_DATA
1076         * column as:
1077         *  - null
1078         *  - pre:<an integer, one of the protocols below>
1079         *  - custom:<a string>
1080         */
1081        @Deprecated
1082        public static final int PROTOCOL_AIM = 0;
1083        @Deprecated
1084        public static final int PROTOCOL_MSN = 1;
1085        @Deprecated
1086        public static final int PROTOCOL_YAHOO = 2;
1087        @Deprecated
1088        public static final int PROTOCOL_SKYPE = 3;
1089        @Deprecated
1090        public static final int PROTOCOL_QQ = 4;
1091        @Deprecated
1092        public static final int PROTOCOL_GOOGLE_TALK = 5;
1093        @Deprecated
1094        public static final int PROTOCOL_ICQ = 6;
1095        @Deprecated
1096        public static final int PROTOCOL_JABBER = 7;
1097
1098        @Deprecated
1099        public static String encodePredefinedImProtocol(int protocol) {
1100            return "pre:" + protocol;
1101        }
1102
1103        @Deprecated
1104        public static String encodeCustomImProtocol(String protocolString) {
1105            return "custom:" + protocolString;
1106        }
1107
1108        @Deprecated
1109        public static Object decodeImProtocol(String encodedString) {
1110            if (encodedString == null) {
1111                return null;
1112            }
1113
1114            if (encodedString.startsWith("pre:")) {
1115                return Integer.parseInt(encodedString.substring(4));
1116            }
1117
1118            if (encodedString.startsWith("custom:")) {
1119                return encodedString.substring(7);
1120            }
1121
1122            throw new IllegalArgumentException(
1123                    "the value is not a valid encoded protocol, " + encodedString);
1124        }
1125
1126        /**
1127         * This looks up the provider name defined in
1128         * {@link android.provider.Im.ProviderNames} from the predefined IM protocol id.
1129         * This is used for interacting with the IM application.
1130         *
1131         * @param protocol the protocol ID
1132         * @return the provider name the IM app uses for the given protocol, or null if no
1133         * provider is defined for the given protocol
1134         * @hide
1135         */
1136        @Deprecated
1137        public static String lookupProviderNameFromId(int protocol) {
1138            switch (protocol) {
1139                case PROTOCOL_GOOGLE_TALK:
1140                    return Im.ProviderNames.GTALK;
1141                case PROTOCOL_AIM:
1142                    return Im.ProviderNames.AIM;
1143                case PROTOCOL_MSN:
1144                    return Im.ProviderNames.MSN;
1145                case PROTOCOL_YAHOO:
1146                    return Im.ProviderNames.YAHOO;
1147                case PROTOCOL_ICQ:
1148                    return Im.ProviderNames.ICQ;
1149                case PROTOCOL_JABBER:
1150                    return Im.ProviderNames.JABBER;
1151                case PROTOCOL_SKYPE:
1152                    return Im.ProviderNames.SKYPE;
1153                case PROTOCOL_QQ:
1154                    return Im.ProviderNames.QQ;
1155            }
1156            return null;
1157        }
1158
1159        /**
1160         * no public constructor since this is a utility class
1161         */
1162        private ContactMethods() {}
1163
1164        @Deprecated
1165        public static final CharSequence getDisplayLabel(Context context, int kind,
1166                int type, CharSequence label) {
1167            CharSequence display = "";
1168            switch (kind) {
1169                case KIND_EMAIL: {
1170                    if (type != People.ContactMethods.TYPE_CUSTOM) {
1171                        CharSequence[] labels = context.getResources().getTextArray(
1172                                com.android.internal.R.array.emailAddressTypes);
1173                        try {
1174                            display = labels[type - 1];
1175                        } catch (ArrayIndexOutOfBoundsException e) {
1176                            display = labels[ContactMethods.TYPE_HOME - 1];
1177                        }
1178                    } else {
1179                        if (!TextUtils.isEmpty(label)) {
1180                            display = label;
1181                        }
1182                    }
1183                    break;
1184                }
1185
1186                case KIND_POSTAL: {
1187                    if (type != People.ContactMethods.TYPE_CUSTOM) {
1188                        CharSequence[] labels = context.getResources().getTextArray(
1189                                com.android.internal.R.array.postalAddressTypes);
1190                        try {
1191                            display = labels[type - 1];
1192                        } catch (ArrayIndexOutOfBoundsException e) {
1193                            display = labels[ContactMethods.TYPE_HOME - 1];
1194                        }
1195                    } else {
1196                        if (!TextUtils.isEmpty(label)) {
1197                            display = label;
1198                        }
1199                    }
1200                    break;
1201                }
1202
1203                default:
1204                    display = context.getString(R.string.untitled);
1205            }
1206            return display;
1207        }
1208
1209        /**
1210         * Add a longitude and latitude location to a postal address.
1211         *
1212         * @param context the context to use when updating the database
1213         * @param postalId the address to update
1214         * @param latitude the latitude for the address
1215         * @param longitude the longitude for the address
1216         */
1217        @Deprecated
1218        public void addPostalLocation(Context context, long postalId,
1219                double latitude, double longitude) {
1220            final ContentResolver resolver = context.getContentResolver();
1221            // Insert the location
1222            ContentValues values = new ContentValues(2);
1223            values.put(POSTAL_LOCATION_LATITUDE, latitude);
1224            values.put(POSTAL_LOCATION_LONGITUDE, longitude);
1225            Uri loc = resolver.insert(CONTENT_URI, values);
1226            long locId = ContentUris.parseId(loc);
1227
1228            // Update the postal address
1229            values.clear();
1230            values.put(AUX_DATA, locId);
1231            resolver.update(ContentUris.withAppendedId(CONTENT_URI, postalId), values, null, null);
1232        }
1233
1234        /**
1235         * The content:// style URL for this table
1236         */
1237        @Deprecated
1238        public static final Uri CONTENT_URI =
1239            Uri.parse("content://contacts/contact_methods");
1240
1241        /**
1242         * The content:// style URL for sub-directory of e-mail addresses.
1243         */
1244        @Deprecated
1245        public static final Uri CONTENT_EMAIL_URI =
1246            Uri.parse("content://contacts/contact_methods/email");
1247
1248        /**
1249         * The MIME type of {@link #CONTENT_URI} providing a directory of
1250         * phones.
1251         */
1252        @Deprecated
1253        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact-methods";
1254
1255        /**
1256         * The MIME type of a {@link #CONTENT_EMAIL_URI} sub-directory of\
1257         * multiple {@link Contacts#KIND_EMAIL} entries.
1258         */
1259        @Deprecated
1260        public static final String CONTENT_EMAIL_TYPE = "vnd.android.cursor.dir/email";
1261
1262        /**
1263         * The MIME type of a {@link #CONTENT_EMAIL_URI} sub-directory of\
1264         * multiple {@link Contacts#KIND_POSTAL} entries.
1265         */
1266        @Deprecated
1267        public static final String CONTENT_POSTAL_TYPE = "vnd.android.cursor.dir/postal-address";
1268
1269        /**
1270         * The MIME type of a {@link #CONTENT_URI} sub-directory of a single
1271         * {@link Contacts#KIND_EMAIL} entry.
1272         */
1273        @Deprecated
1274        public static final String CONTENT_EMAIL_ITEM_TYPE = "vnd.android.cursor.item/email";
1275
1276        /**
1277         * The MIME type of a {@link #CONTENT_URI} sub-directory of a single
1278         * {@link Contacts#KIND_POSTAL} entry.
1279         */
1280        @Deprecated
1281        public static final String CONTENT_POSTAL_ITEM_TYPE
1282                = "vnd.android.cursor.item/postal-address";
1283
1284        /**
1285         * The MIME type of a {@link #CONTENT_URI} sub-directory of a single
1286         * {@link Contacts#KIND_IM} entry.
1287         */
1288        @Deprecated
1289        public static final String CONTENT_IM_ITEM_TYPE = "vnd.android.cursor.item/jabber-im";
1290
1291        /**
1292         * The default sort order for this table
1293         */
1294        @Deprecated
1295        public static final String DEFAULT_SORT_ORDER = "name ASC";
1296
1297        /**
1298         * The ID of the person this contact method is assigned to.
1299         * <P>Type: INTEGER (long)</P>
1300         */
1301        @Deprecated
1302        public static final String PERSON_ID = "person";
1303    }
1304
1305    /**
1306     * The IM presence columns with some contacts specific columns mixed in.
1307     */
1308    @Deprecated
1309    public interface PresenceColumns extends Im.CommonPresenceColumns {
1310        /**
1311         * The IM service the presence is coming from. Formatted using either
1312         * {@link Contacts.ContactMethods#encodePredefinedImProtocol} or
1313         * {@link Contacts.ContactMethods#encodeCustomImProtocol}.
1314         * <P>Type: STRING</P>
1315         */
1316        @Deprecated
1317        public static final String IM_PROTOCOL = "im_protocol";
1318
1319        /**
1320         * The IM handle the presence item is for. The handle is scoped to
1321         * the {@link #IM_PROTOCOL}.
1322         * <P>Type: STRING</P>
1323         */
1324        @Deprecated
1325        public static final String IM_HANDLE = "im_handle";
1326
1327        /**
1328         * The IM account for the local user that the presence data came from.
1329         * <P>Type: STRING</P>
1330         */
1331        @Deprecated
1332        public static final String IM_ACCOUNT = "im_account";
1333    }
1334
1335    /**
1336     * Contains presence information about contacts.
1337     * @hide
1338     */
1339    @Deprecated
1340    public static final class Presence
1341            implements BaseColumns, PresenceColumns, PeopleColumns {
1342        /**
1343         * The content:// style URL for this table
1344         */
1345        @Deprecated
1346        public static final Uri CONTENT_URI =
1347            Uri.parse("content://contacts/presence");
1348
1349        /**
1350         * The ID of the person this presence item is assigned to.
1351         * <P>Type: INTEGER (long)</P>
1352         */
1353        @Deprecated
1354        public static final String PERSON_ID = "person";
1355
1356        /**
1357         * Gets the resource ID for the proper presence icon.
1358         *
1359         * @param status the status to get the icon for
1360         * @return the resource ID for the proper presence icon
1361         */
1362        @Deprecated
1363        public static final int getPresenceIconResourceId(int status) {
1364            switch (status) {
1365                case Contacts.People.AVAILABLE:
1366                    return com.android.internal.R.drawable.presence_online;
1367
1368                case Contacts.People.IDLE:
1369                case Contacts.People.AWAY:
1370                    return com.android.internal.R.drawable.presence_away;
1371
1372                case Contacts.People.DO_NOT_DISTURB:
1373                    return com.android.internal.R.drawable.presence_busy;
1374
1375                case Contacts.People.INVISIBLE:
1376                    return com.android.internal.R.drawable.presence_invisible;
1377
1378                case Contacts.People.OFFLINE:
1379                default:
1380                    return com.android.internal.R.drawable.presence_offline;
1381            }
1382        }
1383
1384        /**
1385         * Sets a presence icon to the proper graphic
1386         *
1387         * @param icon the icon to to set
1388         * @param serverStatus that status
1389         */
1390        @Deprecated
1391        public static final void setPresenceIcon(ImageView icon, int serverStatus) {
1392            icon.setImageResource(getPresenceIconResourceId(serverStatus));
1393        }
1394    }
1395
1396    /**
1397     * Columns from the Organizations table that other columns join into themselves.
1398     */
1399    @Deprecated
1400    public interface OrganizationColumns {
1401        /**
1402         * The type of the organizations.
1403         * <P>Type: INTEGER (one of the constants below)</P>
1404         */
1405        @Deprecated
1406        public static final String TYPE = "type";
1407
1408        @Deprecated
1409        public static final int TYPE_CUSTOM = 0;
1410        @Deprecated
1411        public static final int TYPE_WORK = 1;
1412        @Deprecated
1413        public static final int TYPE_OTHER = 2;
1414
1415        /**
1416         * The user provided label, only used if TYPE is TYPE_CUSTOM.
1417         * <P>Type: TEXT</P>
1418         */
1419        @Deprecated
1420        public static final String LABEL = "label";
1421
1422        /**
1423         * The name of the company for this organization.
1424         * <P>Type: TEXT</P>
1425         */
1426        @Deprecated
1427        public static final String COMPANY = "company";
1428
1429        /**
1430         * The title within this organization.
1431         * <P>Type: TEXT</P>
1432         */
1433        @Deprecated
1434        public static final String TITLE = "title";
1435
1436        /**
1437         * The person this organization is tied to.
1438         * <P>Type: TEXT</P>
1439         */
1440        @Deprecated
1441        public static final String PERSON_ID = "person";
1442
1443        /**
1444         * Whether this is the primary organization
1445         * <P>Type: INTEGER (if set, non-0 means true)</P>
1446         */
1447        @Deprecated
1448        public static final String ISPRIMARY = "isprimary";
1449    }
1450
1451    /**
1452     * A sub directory of a single person that contains all of their Phones.
1453     */
1454    @Deprecated
1455    public static final class Organizations implements BaseColumns, OrganizationColumns {
1456        /**
1457         * no public constructor since this is a utility class
1458         */
1459        private Organizations() {}
1460
1461        @Deprecated
1462        public static final CharSequence getDisplayLabel(Context context, int type,
1463                CharSequence label) {
1464            CharSequence display = "";
1465
1466            if (type != TYPE_CUSTOM) {
1467                CharSequence[] labels = context.getResources().getTextArray(
1468                        com.android.internal.R.array.organizationTypes);
1469                try {
1470                    display = labels[type - 1];
1471                } catch (ArrayIndexOutOfBoundsException e) {
1472                    display = labels[Organizations.TYPE_WORK - 1];
1473                }
1474            } else {
1475                if (!TextUtils.isEmpty(label)) {
1476                    display = label;
1477                }
1478            }
1479            return display;
1480        }
1481
1482        /**
1483         * The content:// style URL for this table
1484         */
1485        @Deprecated
1486        public static final Uri CONTENT_URI =
1487            Uri.parse("content://contacts/organizations");
1488
1489        /**
1490         * The directory twig for this sub-table
1491         */
1492        @Deprecated
1493        public static final String CONTENT_DIRECTORY = "organizations";
1494
1495        /**
1496         * The default sort order for this table
1497         */
1498        @Deprecated
1499        public static final String DEFAULT_SORT_ORDER = "company, title, isprimary ASC";
1500    }
1501
1502    /**
1503     * Columns from the Photos table that other columns join into themselves.
1504     */
1505    @Deprecated
1506    public interface PhotosColumns {
1507        /**
1508         * The _SYNC_VERSION of the photo that was last downloaded
1509         * <P>Type: TEXT</P>
1510         */
1511        @Deprecated
1512        public static final String LOCAL_VERSION = "local_version";
1513
1514        /**
1515         * The person this photo is associated with.
1516         * <P>Type: TEXT</P>
1517         */
1518        @Deprecated
1519        public static final String PERSON_ID = "person";
1520
1521        /**
1522         * non-zero if a download is required and the photo isn't marked as a bad resource.
1523         * You must specify this in the columns in order to use it in the where clause.
1524         * <P>Type: INTEGER(boolean)</P>
1525         */
1526        @Deprecated
1527        public static final String DOWNLOAD_REQUIRED = "download_required";
1528
1529        /**
1530         * non-zero if this photo is known to exist on the server
1531         * <P>Type: INTEGER(boolean)</P>
1532         */
1533        @Deprecated
1534        public static final String EXISTS_ON_SERVER = "exists_on_server";
1535
1536        /**
1537         * Contains the description of the upload or download error from
1538         * the previous attempt. If null then the previous attempt succeeded.
1539         * <P>Type: TEXT</P>
1540         */
1541        @Deprecated
1542        public static final String SYNC_ERROR = "sync_error";
1543
1544        /**
1545         * The image data, or null if there is no image.
1546         * <P>Type: BLOB</P>
1547         */
1548        @Deprecated
1549        public static final String DATA = "data";
1550
1551    }
1552
1553    /**
1554     * The photos over all of the people
1555     */
1556    @Deprecated
1557    public static final class Photos implements BaseColumns, PhotosColumns, SyncConstValue {
1558        /**
1559         * no public constructor since this is a utility class
1560         */
1561        private Photos() {}
1562
1563        /**
1564         * The content:// style URL for this table
1565         */
1566        @Deprecated
1567        public static final Uri CONTENT_URI =
1568            Uri.parse("content://contacts/photos");
1569
1570        /**
1571         * The directory twig for this sub-table
1572         */
1573        @Deprecated
1574        public static final String CONTENT_DIRECTORY = "photo";
1575
1576        /**
1577         * The default sort order for this table
1578         */
1579        @Deprecated
1580        public static final String DEFAULT_SORT_ORDER = "person ASC";
1581    }
1582
1583    @Deprecated
1584    public interface ExtensionsColumns {
1585        /**
1586         * The name of this extension. May not be null. There may be at most one row for each name.
1587         * <P>Type: TEXT</P>
1588         */
1589        @Deprecated
1590        public static final String NAME = "name";
1591
1592        /**
1593         * The value of this extension. May not be null.
1594         * <P>Type: TEXT</P>
1595         */
1596        @Deprecated
1597        public static final String VALUE = "value";
1598    }
1599
1600    /**
1601     * The extensions for a person
1602     */
1603    @Deprecated
1604    public static final class Extensions implements BaseColumns, ExtensionsColumns {
1605        /**
1606         * no public constructor since this is a utility class
1607         */
1608        private Extensions() {}
1609
1610        /**
1611         * The content:// style URL for this table
1612         */
1613        @Deprecated
1614        public static final Uri CONTENT_URI =
1615            Uri.parse("content://contacts/extensions");
1616
1617        /**
1618         * The MIME type of {@link #CONTENT_URI} providing a directory of
1619         * phones.
1620         */
1621        @Deprecated
1622        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact_extensions";
1623
1624        /**
1625         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
1626         * phone.
1627         */
1628        @Deprecated
1629        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_extensions";
1630
1631        /**
1632         * The default sort order for this table
1633         */
1634        @Deprecated
1635        public static final String DEFAULT_SORT_ORDER = "person, name ASC";
1636
1637        /**
1638         * The ID of the person this phone number is assigned to.
1639         * <P>Type: INTEGER (long)</P>
1640         */
1641        @Deprecated
1642        public static final String PERSON_ID = "person";
1643    }
1644
1645    /**
1646     * Contains helper classes used to create or manage {@link android.content.Intent Intents}
1647     * that involve contacts.
1648     */
1649    @Deprecated
1650    public static final class Intents {
1651        @Deprecated
1652        public Intents() {
1653        }
1654
1655        /**
1656         * This is the intent that is fired when a search suggestion is clicked on.
1657         */
1658        @Deprecated
1659        public static final String SEARCH_SUGGESTION_CLICKED =
1660                ContactsContract.Intents.SEARCH_SUGGESTION_CLICKED;
1661
1662        /**
1663         * This is the intent that is fired when a search suggestion for dialing a number
1664         * is clicked on.
1665         */
1666        @Deprecated
1667        public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED =
1668                ContactsContract.Intents.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED;
1669
1670        /**
1671         * This is the intent that is fired when a search suggestion for creating a contact
1672         * is clicked on.
1673         */
1674        @Deprecated
1675        public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED =
1676                ContactsContract.Intents.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED;
1677
1678        /**
1679         * Starts an Activity that lets the user pick a contact to attach an image to.
1680         * After picking the contact it launches the image cropper in face detection mode.
1681         */
1682        @Deprecated
1683        public static final String ATTACH_IMAGE = ContactsContract.Intents.ATTACH_IMAGE;
1684
1685        /**
1686         * Takes as input a data URI with a mailto: or tel: scheme. If a single
1687         * contact exists with the given data it will be shown. If no contact
1688         * exists, a dialog will ask the user if they want to create a new
1689         * contact with the provided details filled in. If multiple contacts
1690         * share the data the user will be prompted to pick which contact they
1691         * want to view.
1692         * <p>
1693         * For <code>mailto:</code> URIs, the scheme specific portion must be a
1694         * raw email address, such as one built using
1695         * {@link Uri#fromParts(String, String, String)}.
1696         * <p>
1697         * For <code>tel:</code> URIs, the scheme specific portion is compared
1698         * to existing numbers using the standard caller ID lookup algorithm.
1699         * The number must be properly encoded, for example using
1700         * {@link Uri#fromParts(String, String, String)}.
1701         * <p>
1702         * Any extras from the {@link Insert} class will be passed along to the
1703         * create activity if there are no contacts to show.
1704         * <p>
1705         * Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip
1706         * prompting the user when the contact doesn't exist.
1707         */
1708        @Deprecated
1709        public static final String SHOW_OR_CREATE_CONTACT =
1710                ContactsContract.Intents.SHOW_OR_CREATE_CONTACT;
1711
1712        /**
1713         * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new
1714         * contact if no matching contact found. Otherwise, default behavior is
1715         * to prompt user with dialog before creating.
1716         * <p>
1717         * Type: BOOLEAN
1718         */
1719        @Deprecated
1720        public static final String EXTRA_FORCE_CREATE = ContactsContract.Intents.EXTRA_FORCE_CREATE;
1721
1722        /**
1723         * Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact
1724         * description to be shown when prompting user about creating a new
1725         * contact.
1726         * <p>
1727         * Type: STRING
1728         */
1729        @Deprecated
1730        public static final String EXTRA_CREATE_DESCRIPTION =
1731                ContactsContract.Intents.EXTRA_CREATE_DESCRIPTION;
1732
1733        /**
1734         * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a
1735         * dialog location using screen coordinates. When not specified, the
1736         * dialog will be centered.
1737         *
1738         * @hide pending API council review
1739         */
1740        @Deprecated
1741        public static final String EXTRA_TARGET_RECT = ContactsContract.Intents.EXTRA_TARGET_RECT;
1742
1743        /**
1744         * Intents related to the Contacts app UI.
1745         */
1746        @Deprecated
1747        public static final class UI {
1748            @Deprecated
1749            public UI() {
1750            }
1751
1752            /**
1753             * The action for the default contacts list tab.
1754             */
1755            @Deprecated
1756            public static final String LIST_DEFAULT = ContactsContract.Intents.UI.LIST_DEFAULT;
1757
1758            /**
1759             * The action for the contacts list tab.
1760             */
1761            @Deprecated
1762            public static final String LIST_GROUP_ACTION =
1763                    ContactsContract.Intents.UI.LIST_GROUP_ACTION;
1764
1765            /**
1766             * When in LIST_GROUP_ACTION mode, this is the group to display.
1767             */
1768            @Deprecated
1769            public static final String GROUP_NAME_EXTRA_KEY =
1770                    ContactsContract.Intents.UI.GROUP_NAME_EXTRA_KEY;
1771            /**
1772             * The action for the all contacts list tab.
1773             */
1774            @Deprecated
1775            public static final String LIST_ALL_CONTACTS_ACTION =
1776                    ContactsContract.Intents.UI.LIST_ALL_CONTACTS_ACTION;
1777
1778            /**
1779             * The action for the contacts with phone numbers list tab.
1780             */
1781            @Deprecated
1782            public static final String LIST_CONTACTS_WITH_PHONES_ACTION =
1783                    ContactsContract.Intents.UI.LIST_CONTACTS_WITH_PHONES_ACTION;
1784
1785            /**
1786             * The action for the starred contacts list tab.
1787             */
1788            @Deprecated
1789            public static final String LIST_STARRED_ACTION =
1790                    ContactsContract.Intents.UI.LIST_STARRED_ACTION;
1791
1792            /**
1793             * The action for the frequent contacts list tab.
1794             */
1795            @Deprecated
1796            public static final String LIST_FREQUENT_ACTION =
1797                    ContactsContract.Intents.UI.LIST_FREQUENT_ACTION;
1798
1799            /**
1800             * The action for the "strequent" contacts list tab. It first lists the starred
1801             * contacts in alphabetical order and then the frequent contacts in descending
1802             * order of the number of times they have been contacted.
1803             */
1804            @Deprecated
1805            public static final String LIST_STREQUENT_ACTION =
1806                    ContactsContract.Intents.UI.LIST_STREQUENT_ACTION;
1807
1808            /**
1809             * A key for to be used as an intent extra to set the activity
1810             * title to a custom String value.
1811             */
1812            @Deprecated
1813            public static final String TITLE_EXTRA_KEY =
1814                    ContactsContract.Intents.UI.TITLE_EXTRA_KEY;
1815
1816            /**
1817             * Activity Action: Display a filtered list of contacts
1818             * <p>
1819             * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for
1820             * filtering
1821             * <p>
1822             * Output: Nothing.
1823             */
1824            @Deprecated
1825            public static final String FILTER_CONTACTS_ACTION =
1826                    ContactsContract.Intents.UI.FILTER_CONTACTS_ACTION;
1827
1828            /**
1829             * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION}
1830             * intents to supply the text on which to filter.
1831             */
1832            @Deprecated
1833            public static final String FILTER_TEXT_EXTRA_KEY =
1834                    ContactsContract.Intents.UI.FILTER_TEXT_EXTRA_KEY;
1835        }
1836
1837        /**
1838         * Convenience class that contains string constants used
1839         * to create contact {@link android.content.Intent Intents}.
1840         */
1841        @Deprecated
1842        public static final class Insert {
1843            @Deprecated
1844            public Insert() {
1845            }
1846
1847            /** The action code to use when adding a contact */
1848            @Deprecated
1849            public static final String ACTION = ContactsContract.Intents.Insert.ACTION;
1850
1851            /**
1852             * If present, forces a bypass of quick insert mode.
1853             */
1854            @Deprecated
1855            public static final String FULL_MODE = ContactsContract.Intents.Insert.FULL_MODE;
1856
1857            /**
1858             * The extra field for the contact name.
1859             * <P>Type: String</P>
1860             */
1861            @Deprecated
1862            public static final String NAME = ContactsContract.Intents.Insert.NAME;
1863
1864            /**
1865             * The extra field for the contact phonetic name.
1866             * <P>Type: String</P>
1867             */
1868            @Deprecated
1869            public static final String PHONETIC_NAME =
1870                    ContactsContract.Intents.Insert.PHONETIC_NAME;
1871
1872            /**
1873             * The extra field for the contact company.
1874             * <P>Type: String</P>
1875             */
1876            @Deprecated
1877            public static final String COMPANY = ContactsContract.Intents.Insert.COMPANY;
1878
1879            /**
1880             * The extra field for the contact job title.
1881             * <P>Type: String</P>
1882             */
1883            @Deprecated
1884            public static final String JOB_TITLE = ContactsContract.Intents.Insert.JOB_TITLE;
1885
1886            /**
1887             * The extra field for the contact notes.
1888             * <P>Type: String</P>
1889             */
1890            @Deprecated
1891            public static final String NOTES = ContactsContract.Intents.Insert.NOTES;
1892
1893            /**
1894             * The extra field for the contact phone number.
1895             * <P>Type: String</P>
1896             */
1897            @Deprecated
1898            public static final String PHONE = ContactsContract.Intents.Insert.PHONE;
1899
1900            /**
1901             * The extra field for the contact phone number type.
1902             * <P>Type: Either an integer value from {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1903             *  or a string specifying a custom label.</P>
1904             */
1905            @Deprecated
1906            public static final String PHONE_TYPE = ContactsContract.Intents.Insert.PHONE_TYPE;
1907
1908            /**
1909             * The extra field for the phone isprimary flag.
1910             * <P>Type: boolean</P>
1911             */
1912            @Deprecated
1913            public static final String PHONE_ISPRIMARY =
1914                    ContactsContract.Intents.Insert.PHONE_ISPRIMARY;
1915
1916            /**
1917             * The extra field for an optional second contact phone number.
1918             * <P>Type: String</P>
1919             */
1920            @Deprecated
1921            public static final String SECONDARY_PHONE =
1922                    ContactsContract.Intents.Insert.SECONDARY_PHONE;
1923
1924            /**
1925             * The extra field for an optional second contact phone number type.
1926             * <P>Type: Either an integer value from {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1927             *  or a string specifying a custom label.</P>
1928             */
1929            @Deprecated
1930            public static final String SECONDARY_PHONE_TYPE =
1931                    ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE;
1932
1933            /**
1934             * The extra field for an optional third contact phone number.
1935             * <P>Type: String</P>
1936             */
1937            @Deprecated
1938            public static final String TERTIARY_PHONE =
1939                    ContactsContract.Intents.Insert.TERTIARY_PHONE;
1940
1941            /**
1942             * The extra field for an optional third contact phone number type.
1943             * <P>Type: Either an integer value from {@link android.provider.Contacts.PhonesColumns PhonesColumns},
1944             *  or a string specifying a custom label.</P>
1945             */
1946            @Deprecated
1947            public static final String TERTIARY_PHONE_TYPE =
1948                    ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE;
1949
1950            /**
1951             * The extra field for the contact email address.
1952             * <P>Type: String</P>
1953             */
1954            @Deprecated
1955            public static final String EMAIL = ContactsContract.Intents.Insert.EMAIL;
1956
1957            /**
1958             * The extra field for the contact email type.
1959             * <P>Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1960             *  or a string specifying a custom label.</P>
1961             */
1962            @Deprecated
1963            public static final String EMAIL_TYPE = ContactsContract.Intents.Insert.EMAIL_TYPE;
1964
1965            /**
1966             * The extra field for the email isprimary flag.
1967             * <P>Type: boolean</P>
1968             */
1969            @Deprecated
1970            public static final String EMAIL_ISPRIMARY =
1971                    ContactsContract.Intents.Insert.EMAIL_ISPRIMARY;
1972
1973            /**
1974             * The extra field for an optional second contact email address.
1975             * <P>Type: String</P>
1976             */
1977            @Deprecated
1978            public static final String SECONDARY_EMAIL =
1979                    ContactsContract.Intents.Insert.SECONDARY_EMAIL;
1980
1981            /**
1982             * The extra field for an optional second contact email type.
1983             * <P>Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
1984             *  or a string specifying a custom label.</P>
1985             */
1986            @Deprecated
1987            public static final String SECONDARY_EMAIL_TYPE =
1988                    ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE;
1989
1990            /**
1991             * The extra field for an optional third contact email address.
1992             * <P>Type: String</P>
1993             */
1994            @Deprecated
1995            public static final String TERTIARY_EMAIL =
1996                    ContactsContract.Intents.Insert.TERTIARY_EMAIL;
1997
1998            /**
1999             * The extra field for an optional third contact email type.
2000             * <P>Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
2001             *  or a string specifying a custom label.</P>
2002             */
2003            @Deprecated
2004            public static final String TERTIARY_EMAIL_TYPE =
2005                    ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE;
2006
2007            /**
2008             * The extra field for the contact postal address.
2009             * <P>Type: String</P>
2010             */
2011            @Deprecated
2012            public static final String POSTAL = ContactsContract.Intents.Insert.POSTAL;
2013
2014            /**
2015             * The extra field for the contact postal address type.
2016             * <P>Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
2017             *  or a string specifying a custom label.</P>
2018             */
2019            @Deprecated
2020            public static final String POSTAL_TYPE = ContactsContract.Intents.Insert.POSTAL_TYPE;
2021
2022            /**
2023             * The extra field for the postal isprimary flag.
2024             * <P>Type: boolean</P>
2025             */
2026            @Deprecated
2027            public static final String POSTAL_ISPRIMARY = ContactsContract.Intents.Insert.POSTAL_ISPRIMARY;
2028
2029            /**
2030             * The extra field for an IM handle.
2031             * <P>Type: String</P>
2032             */
2033            @Deprecated
2034            public static final String IM_HANDLE = ContactsContract.Intents.Insert.IM_HANDLE;
2035
2036            /**
2037             * The extra field for the IM protocol
2038             * <P>Type: the result of {@link Contacts.ContactMethods#encodePredefinedImProtocol}
2039             * or {@link Contacts.ContactMethods#encodeCustomImProtocol}.</P>
2040             */
2041            @Deprecated
2042            public static final String IM_PROTOCOL = ContactsContract.Intents.Insert.IM_PROTOCOL;
2043
2044            /**
2045             * The extra field for the IM isprimary flag.
2046             * <P>Type: boolean</P>
2047             */
2048            @Deprecated
2049            public static final String IM_ISPRIMARY = ContactsContract.Intents.Insert.IM_ISPRIMARY;
2050        }
2051    }
2052}
2053