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