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