Home | History | Annotate | Download | only in provider
      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      */
     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          */
    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
    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
    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          */
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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 
    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              */
    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              */
    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              */
    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          */
    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          */
    954         private Phones() {}
    955 
    956         /**
    957          * @deprecated see {@link android.provider.ContactsContract}
    958          */
    959         @Deprecated
    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
    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          */
   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
   1303         public static String encodePredefinedImProtocol(int protocol) {
   1304             return "pre:" + protocol;
   1305         }
   1306 
   1307         /**
   1308          * @deprecated see {@link android.provider.ContactsContract}
   1309          */
   1310         @Deprecated
   1311         public static String encodeCustomImProtocol(String protocolString) {
   1312             return "custom:" + protocolString;
   1313         }
   1314 
   1315         /**
   1316          * @deprecated see {@link android.provider.ContactsContract}
   1317          */
   1318         @Deprecated
   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          * TODO find a place to put the canonical version of these.
   1338          */
   1339         interface ProviderNames {
   1340             //
   1341             //NOTE: update Contacts.java with new providers when they're added.
   1342             //
   1343             String YAHOO = "Yahoo";
   1344             String GTALK = "GTalk";
   1345             String MSN = "MSN";
   1346             String ICQ = "ICQ";
   1347             String AIM = "AIM";
   1348             String XMPP = "XMPP";
   1349             String JABBER = "JABBER";
   1350             String SKYPE = "SKYPE";
   1351             String QQ = "QQ";
   1352         }
   1353 
   1354         /**
   1355          * This looks up the provider name defined in
   1356          * from the predefined IM protocol id.
   1357          * This is used for interacting with the IM application.
   1358          *
   1359          * @param protocol the protocol ID
   1360          * @return the provider name the IM app uses for the given protocol, or null if no
   1361          * provider is defined for the given protocol
   1362          * @deprecated see {@link android.provider.ContactsContract}
   1363          * @hide
   1364          */
   1365         @Deprecated
   1366         public static String lookupProviderNameFromId(int protocol) {
   1367             switch (protocol) {
   1368                 case PROTOCOL_GOOGLE_TALK:
   1369                     return ProviderNames.GTALK;
   1370                 case PROTOCOL_AIM:
   1371                     return ProviderNames.AIM;
   1372                 case PROTOCOL_MSN:
   1373                     return ProviderNames.MSN;
   1374                 case PROTOCOL_YAHOO:
   1375                     return ProviderNames.YAHOO;
   1376                 case PROTOCOL_ICQ:
   1377                     return ProviderNames.ICQ;
   1378                 case PROTOCOL_JABBER:
   1379                     return ProviderNames.JABBER;
   1380                 case PROTOCOL_SKYPE:
   1381                     return ProviderNames.SKYPE;
   1382                 case PROTOCOL_QQ:
   1383                     return ProviderNames.QQ;
   1384             }
   1385             return null;
   1386         }
   1387 
   1388         /**
   1389          * no public constructor since this is a utility class
   1390          */
   1391         private ContactMethods() {}
   1392 
   1393         /**
   1394          * @deprecated see {@link android.provider.ContactsContract}
   1395          */
   1396         @Deprecated
   1397         public static final CharSequence getDisplayLabel(Context context, int kind,
   1398                 int type, CharSequence label) {
   1399             CharSequence display = "";
   1400             switch (kind) {
   1401                 case KIND_EMAIL: {
   1402                     if (type != People.ContactMethods.TYPE_CUSTOM) {
   1403                         CharSequence[] labels = context.getResources().getTextArray(
   1404                                 com.android.internal.R.array.emailAddressTypes);
   1405                         try {
   1406                             display = labels[type - 1];
   1407                         } catch (ArrayIndexOutOfBoundsException e) {
   1408                             display = labels[ContactMethods.TYPE_HOME - 1];
   1409                         }
   1410                     } else {
   1411                         if (!TextUtils.isEmpty(label)) {
   1412                             display = label;
   1413                         }
   1414                     }
   1415                     break;
   1416                 }
   1417 
   1418                 case KIND_POSTAL: {
   1419                     if (type != People.ContactMethods.TYPE_CUSTOM) {
   1420                         CharSequence[] labels = context.getResources().getTextArray(
   1421                                 com.android.internal.R.array.postalAddressTypes);
   1422                         try {
   1423                             display = labels[type - 1];
   1424                         } catch (ArrayIndexOutOfBoundsException e) {
   1425                             display = labels[ContactMethods.TYPE_HOME - 1];
   1426                         }
   1427                     } else {
   1428                         if (!TextUtils.isEmpty(label)) {
   1429                             display = label;
   1430                         }
   1431                     }
   1432                     break;
   1433                 }
   1434 
   1435                 default:
   1436                     display = context.getString(R.string.untitled);
   1437             }
   1438             return display;
   1439         }
   1440 
   1441         /**
   1442          * Add a longitude and latitude location to a postal address.
   1443          *
   1444          * @param context the context to use when updating the database
   1445          * @param postalId the address to update
   1446          * @param latitude the latitude for the address
   1447          * @param longitude the longitude for the address
   1448          * @deprecated see {@link android.provider.ContactsContract}
   1449          */
   1450         @Deprecated
   1451         public void addPostalLocation(Context context, long postalId,
   1452                 double latitude, double longitude) {
   1453             final ContentResolver resolver = context.getContentResolver();
   1454             // Insert the location
   1455             ContentValues values = new ContentValues(2);
   1456             values.put(POSTAL_LOCATION_LATITUDE, latitude);
   1457             values.put(POSTAL_LOCATION_LONGITUDE, longitude);
   1458             Uri loc = resolver.insert(CONTENT_URI, values);
   1459             long locId = ContentUris.parseId(loc);
   1460 
   1461             // Update the postal address
   1462             values.clear();
   1463             values.put(AUX_DATA, locId);
   1464             resolver.update(ContentUris.withAppendedId(CONTENT_URI, postalId), values, null, null);
   1465         }
   1466 
   1467         /**
   1468          * The content:// style URL for this table
   1469          * @deprecated see {@link android.provider.ContactsContract}
   1470          */
   1471         @Deprecated
   1472         public static final Uri CONTENT_URI =
   1473             Uri.parse("content://contacts/contact_methods");
   1474 
   1475         /**
   1476          * The content:// style URL for sub-directory of e-mail addresses.
   1477          * @deprecated see {@link android.provider.ContactsContract}
   1478          */
   1479         @Deprecated
   1480         public static final Uri CONTENT_EMAIL_URI =
   1481             Uri.parse("content://contacts/contact_methods/email");
   1482 
   1483         /**
   1484          * The MIME type of {@link #CONTENT_URI} providing a directory of
   1485          * @deprecated see {@link android.provider.ContactsContract}
   1486          * phones.
   1487          */
   1488         @Deprecated
   1489         public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact-methods";
   1490 
   1491         /**
   1492          * The MIME type of a {@link #CONTENT_EMAIL_URI} sub-directory of
   1493          * multiple {@link Contacts#KIND_EMAIL} entries.
   1494          * @deprecated see {@link android.provider.ContactsContract}
   1495          */
   1496         @Deprecated
   1497         public static final String CONTENT_EMAIL_TYPE = "vnd.android.cursor.dir/email";
   1498 
   1499         /**
   1500          * The MIME type of a {@link #CONTENT_EMAIL_URI} sub-directory of
   1501          * multiple {@link Contacts#KIND_POSTAL} entries.
   1502          * @deprecated see {@link android.provider.ContactsContract}
   1503          */
   1504         @Deprecated
   1505         public static final String CONTENT_POSTAL_TYPE = "vnd.android.cursor.dir/postal-address";
   1506 
   1507         /**
   1508          * The MIME type of a {@link #CONTENT_URI} sub-directory of a single
   1509          * {@link Contacts#KIND_EMAIL} entry.
   1510          * @deprecated see {@link android.provider.ContactsContract}
   1511          */
   1512         @Deprecated
   1513         public static final String CONTENT_EMAIL_ITEM_TYPE = "vnd.android.cursor.item/email";
   1514 
   1515         /**
   1516          * The MIME type of a {@link #CONTENT_URI} sub-directory of a single
   1517          * {@link Contacts#KIND_POSTAL} entry.
   1518          * @deprecated see {@link android.provider.ContactsContract}
   1519          */
   1520         @Deprecated
   1521         public static final String CONTENT_POSTAL_ITEM_TYPE
   1522                 = "vnd.android.cursor.item/postal-address";
   1523 
   1524         /**
   1525          * The MIME type of a {@link #CONTENT_URI} sub-directory of a single
   1526          * {@link Contacts#KIND_IM} entry.
   1527          * @deprecated see {@link android.provider.ContactsContract}
   1528          */
   1529         @Deprecated
   1530         public static final String CONTENT_IM_ITEM_TYPE = "vnd.android.cursor.item/jabber-im";
   1531 
   1532         /**
   1533          * The default sort order for this table
   1534          * @deprecated see {@link android.provider.ContactsContract}
   1535          */
   1536         @Deprecated
   1537         public static final String DEFAULT_SORT_ORDER = "name ASC";
   1538 
   1539         /**
   1540          * The ID of the person this contact method is assigned to.
   1541          * <P>Type: INTEGER (long)</P>
   1542          * @deprecated see {@link android.provider.ContactsContract}
   1543          */
   1544         @Deprecated
   1545         public static final String PERSON_ID = "person";
   1546     }
   1547 
   1548     /**
   1549      * The IM presence columns with some contacts specific columns mixed in.
   1550      * @deprecated see {@link android.provider.ContactsContract}
   1551      */
   1552     @Deprecated
   1553     public interface PresenceColumns {
   1554         /**
   1555          * The priority, an integer, used by XMPP presence
   1556          * <P>Type: INTEGER</P>
   1557          */
   1558         String PRIORITY = "priority";
   1559 
   1560         /**
   1561          * The server defined status.
   1562          * <P>Type: INTEGER (one of the values below)</P>
   1563          */
   1564         String PRESENCE_STATUS = ContactsContract.StatusUpdates.PRESENCE;
   1565 
   1566         /**
   1567          * Presence Status definition
   1568          */
   1569         int OFFLINE = ContactsContract.StatusUpdates.OFFLINE;
   1570         int INVISIBLE = ContactsContract.StatusUpdates.INVISIBLE;
   1571         int AWAY = ContactsContract.StatusUpdates.AWAY;
   1572         int IDLE = ContactsContract.StatusUpdates.IDLE;
   1573         int DO_NOT_DISTURB = ContactsContract.StatusUpdates.DO_NOT_DISTURB;
   1574         int AVAILABLE = ContactsContract.StatusUpdates.AVAILABLE;
   1575 
   1576         /**
   1577          * The user defined status line.
   1578          * <P>Type: TEXT</P>
   1579          */
   1580         String PRESENCE_CUSTOM_STATUS = ContactsContract.StatusUpdates.STATUS;
   1581 
   1582         /**
   1583          * The IM service the presence is coming from. Formatted using either
   1584          * {@link Contacts.ContactMethods#encodePredefinedImProtocol} or
   1585          * {@link Contacts.ContactMethods#encodeCustomImProtocol}.
   1586          * <P>Type: STRING</P>
   1587          * @deprecated see {@link android.provider.ContactsContract}
   1588          */
   1589         @Deprecated
   1590         public static final String IM_PROTOCOL = "im_protocol";
   1591 
   1592         /**
   1593          * The IM handle the presence item is for. The handle is scoped to
   1594          * the {@link #IM_PROTOCOL}.
   1595          * <P>Type: STRING</P>
   1596          * @deprecated see {@link android.provider.ContactsContract}
   1597          */
   1598         @Deprecated
   1599         public static final String IM_HANDLE = "im_handle";
   1600 
   1601         /**
   1602          * The IM account for the local user that the presence data came from.
   1603          * <P>Type: STRING</P>
   1604          * @deprecated see {@link android.provider.ContactsContract}
   1605          */
   1606         @Deprecated
   1607         public static final String IM_ACCOUNT = "im_account";
   1608     }
   1609 
   1610     /**
   1611      * Contains presence information about contacts.
   1612      * @hide
   1613      * @deprecated see {@link android.provider.ContactsContract}
   1614      */
   1615     @Deprecated
   1616     public static final class Presence
   1617             implements BaseColumns, PresenceColumns, PeopleColumns {
   1618         /**
   1619          * The content:// style URL for this table
   1620          * @deprecated see {@link android.provider.ContactsContract}
   1621          */
   1622         @Deprecated
   1623         public static final Uri CONTENT_URI =
   1624             Uri.parse("content://contacts/presence");
   1625 
   1626         /**
   1627          * The ID of the person this presence item is assigned to.
   1628          * <P>Type: INTEGER (long)</P>
   1629          * @deprecated see {@link android.provider.ContactsContract}
   1630          */
   1631         @Deprecated
   1632         public static final String PERSON_ID = "person";
   1633 
   1634         /**
   1635          * Gets the resource ID for the proper presence icon.
   1636          *
   1637          * @param status the status to get the icon for
   1638          * @return the resource ID for the proper presence icon
   1639          * @deprecated see {@link android.provider.ContactsContract}
   1640          */
   1641         @Deprecated
   1642         public static final int getPresenceIconResourceId(int status) {
   1643             switch (status) {
   1644                 case Contacts.People.AVAILABLE:
   1645                     return com.android.internal.R.drawable.presence_online;
   1646 
   1647                 case Contacts.People.IDLE:
   1648                 case Contacts.People.AWAY:
   1649                     return com.android.internal.R.drawable.presence_away;
   1650 
   1651                 case Contacts.People.DO_NOT_DISTURB:
   1652                     return com.android.internal.R.drawable.presence_busy;
   1653 
   1654                 case Contacts.People.INVISIBLE:
   1655                     return com.android.internal.R.drawable.presence_invisible;
   1656 
   1657                 case Contacts.People.OFFLINE:
   1658                 default:
   1659                     return com.android.internal.R.drawable.presence_offline;
   1660             }
   1661         }
   1662 
   1663         /**
   1664          * Sets a presence icon to the proper graphic
   1665          *
   1666          * @param icon the icon to to set
   1667          * @param serverStatus that status
   1668          * @deprecated see {@link android.provider.ContactsContract}
   1669          */
   1670         @Deprecated
   1671         public static final void setPresenceIcon(ImageView icon, int serverStatus) {
   1672             icon.setImageResource(getPresenceIconResourceId(serverStatus));
   1673         }
   1674     }
   1675 
   1676     /**
   1677      * Columns from the Organizations table that other columns join into themselves.
   1678      * @deprecated see {@link android.provider.ContactsContract}
   1679      */
   1680     @Deprecated
   1681     public interface OrganizationColumns {
   1682         /**
   1683          * The type of the organizations.
   1684          * <P>Type: INTEGER (one of the constants below)</P>
   1685          * @deprecated see {@link android.provider.ContactsContract}
   1686          */
   1687         @Deprecated
   1688         public static final String TYPE = "type";
   1689 
   1690         /**
   1691          * @deprecated see {@link android.provider.ContactsContract}
   1692          */
   1693         @Deprecated
   1694         public static final int TYPE_CUSTOM = 0;
   1695         /**
   1696          * @deprecated see {@link android.provider.ContactsContract}
   1697          */
   1698         @Deprecated
   1699         public static final int TYPE_WORK = 1;
   1700         /**
   1701          * @deprecated see {@link android.provider.ContactsContract}
   1702          */
   1703         @Deprecated
   1704         public static final int TYPE_OTHER = 2;
   1705 
   1706         /**
   1707          * The user provided label, only used if TYPE is TYPE_CUSTOM.
   1708          * <P>Type: TEXT</P>
   1709          * @deprecated see {@link android.provider.ContactsContract}
   1710          */
   1711         @Deprecated
   1712         public static final String LABEL = "label";
   1713 
   1714         /**
   1715          * The name of the company for this organization.
   1716          * <P>Type: TEXT</P>
   1717          * @deprecated see {@link android.provider.ContactsContract}
   1718          */
   1719         @Deprecated
   1720         public static final String COMPANY = "company";
   1721 
   1722         /**
   1723          * The title within this organization.
   1724          * <P>Type: TEXT</P>
   1725          * @deprecated see {@link android.provider.ContactsContract}
   1726          */
   1727         @Deprecated
   1728         public static final String TITLE = "title";
   1729 
   1730         /**
   1731          * The person this organization is tied to.
   1732          * <P>Type: TEXT</P>
   1733          * @deprecated see {@link android.provider.ContactsContract}
   1734          */
   1735         @Deprecated
   1736         public static final String PERSON_ID = "person";
   1737 
   1738         /**
   1739          * Whether this is the primary organization
   1740          * <P>Type: INTEGER (if set, non-0 means true)</P>
   1741          * @deprecated see {@link android.provider.ContactsContract}
   1742          */
   1743         @Deprecated
   1744         public static final String ISPRIMARY = "isprimary";
   1745     }
   1746 
   1747     /**
   1748      * A sub directory of a single person that contains all of their Phones.
   1749      * @deprecated see {@link android.provider.ContactsContract}
   1750      */
   1751     @Deprecated
   1752     public static final class Organizations implements BaseColumns, OrganizationColumns {
   1753         /**
   1754          * no public constructor since this is a utility class
   1755          */
   1756         private Organizations() {}
   1757 
   1758         /**
   1759          * @deprecated see {@link android.provider.ContactsContract}
   1760          */
   1761         @Deprecated
   1762         public static final CharSequence getDisplayLabel(Context context, int type,
   1763                 CharSequence label) {
   1764             CharSequence display = "";
   1765 
   1766             if (type != TYPE_CUSTOM) {
   1767                 CharSequence[] labels = context.getResources().getTextArray(
   1768                         com.android.internal.R.array.organizationTypes);
   1769                 try {
   1770                     display = labels[type - 1];
   1771                 } catch (ArrayIndexOutOfBoundsException e) {
   1772                     display = labels[Organizations.TYPE_WORK - 1];
   1773                 }
   1774             } else {
   1775                 if (!TextUtils.isEmpty(label)) {
   1776                     display = label;
   1777                 }
   1778             }
   1779             return display;
   1780         }
   1781 
   1782         /**
   1783          * The content:// style URL for this table
   1784          * @deprecated see {@link android.provider.ContactsContract}
   1785          */
   1786         @Deprecated
   1787         public static final Uri CONTENT_URI =
   1788             Uri.parse("content://contacts/organizations");
   1789 
   1790         /**
   1791          * The directory twig for this sub-table
   1792          * @deprecated see {@link android.provider.ContactsContract}
   1793          */
   1794         @Deprecated
   1795         public static final String CONTENT_DIRECTORY = "organizations";
   1796 
   1797         /**
   1798          * The default sort order for this table
   1799          * @deprecated see {@link android.provider.ContactsContract}
   1800          */
   1801         @Deprecated
   1802         public static final String DEFAULT_SORT_ORDER = "company, title, isprimary ASC";
   1803     }
   1804 
   1805     /**
   1806      * Columns from the Photos table that other columns join into themselves.
   1807      * @deprecated see {@link android.provider.ContactsContract}
   1808      */
   1809     @Deprecated
   1810     public interface PhotosColumns {
   1811         /**
   1812          * The _SYNC_VERSION of the photo that was last downloaded
   1813          * <P>Type: TEXT</P>
   1814          * @deprecated see {@link android.provider.ContactsContract}
   1815          */
   1816         @Deprecated
   1817         public static final String LOCAL_VERSION = "local_version";
   1818 
   1819         /**
   1820          * The person this photo is associated with.
   1821          * <P>Type: TEXT</P>
   1822          * @deprecated see {@link android.provider.ContactsContract}
   1823          */
   1824         @Deprecated
   1825         public static final String PERSON_ID = "person";
   1826 
   1827         /**
   1828          * non-zero if a download is required and the photo isn't marked as a bad resource.
   1829          * You must specify this in the columns in order to use it in the where clause.
   1830          * <P>Type: INTEGER(boolean)</P>
   1831          * @deprecated see {@link android.provider.ContactsContract}
   1832          */
   1833         @Deprecated
   1834         public static final String DOWNLOAD_REQUIRED = "download_required";
   1835 
   1836         /**
   1837          * non-zero if this photo is known to exist on the server
   1838          * <P>Type: INTEGER(boolean)</P>
   1839          * @deprecated see {@link android.provider.ContactsContract}
   1840          */
   1841         @Deprecated
   1842         public static final String EXISTS_ON_SERVER = "exists_on_server";
   1843 
   1844         /**
   1845          * Contains the description of the upload or download error from
   1846          * the previous attempt. If null then the previous attempt succeeded.
   1847          * <P>Type: TEXT</P>
   1848          * @deprecated see {@link android.provider.ContactsContract}
   1849          */
   1850         @Deprecated
   1851         public static final String SYNC_ERROR = "sync_error";
   1852 
   1853         /**
   1854          * The image data, or null if there is no image.
   1855          * <P>Type: BLOB</P>
   1856          * @deprecated see {@link android.provider.ContactsContract}
   1857          */
   1858         @Deprecated
   1859         public static final String DATA = "data";
   1860 
   1861     }
   1862 
   1863     /**
   1864      * The photos over all of the people
   1865      * @deprecated see {@link android.provider.ContactsContract}
   1866      */
   1867     @Deprecated
   1868     public static final class Photos implements BaseColumns, PhotosColumns, SyncConstValue {
   1869         /**
   1870          * no public constructor since this is a utility class
   1871          */
   1872         private Photos() {}
   1873 
   1874         /**
   1875          * The content:// style URL for this table
   1876          * @deprecated see {@link android.provider.ContactsContract}
   1877          */
   1878         @Deprecated
   1879         public static final Uri CONTENT_URI = Uri.parse("content://contacts/photos");
   1880 
   1881         /**
   1882          * The directory twig for this sub-table
   1883          * @deprecated see {@link android.provider.ContactsContract}
   1884          */
   1885         @Deprecated
   1886         public static final String CONTENT_DIRECTORY = "photo";
   1887 
   1888         /**
   1889          * The default sort order for this table
   1890          * @deprecated see {@link android.provider.ContactsContract}
   1891          */
   1892         @Deprecated
   1893         public static final String DEFAULT_SORT_ORDER = "person ASC";
   1894     }
   1895 
   1896     /**
   1897      * @deprecated see {@link android.provider.ContactsContract}
   1898      */
   1899     @Deprecated
   1900     public interface ExtensionsColumns {
   1901         /**
   1902          * The name of this extension. May not be null. There may be at most one row for each name.
   1903          * <P>Type: TEXT</P>
   1904          * @deprecated see {@link android.provider.ContactsContract}
   1905          */
   1906         @Deprecated
   1907         public static final String NAME = "name";
   1908 
   1909         /**
   1910          * The value of this extension. May not be null.
   1911          * <P>Type: TEXT</P>
   1912          * @deprecated see {@link android.provider.ContactsContract}
   1913          */
   1914         @Deprecated
   1915         public static final String VALUE = "value";
   1916     }
   1917 
   1918     /**
   1919      * The extensions for a person
   1920      * @deprecated see {@link android.provider.ContactsContract}
   1921      */
   1922     @Deprecated
   1923     public static final class Extensions implements BaseColumns, ExtensionsColumns {
   1924         /**
   1925          * no public constructor since this is a utility class
   1926          */
   1927         private Extensions() {}
   1928 
   1929         /**
   1930          * The content:// style URL for this table
   1931          * @deprecated see {@link android.provider.ContactsContract}
   1932          */
   1933         @Deprecated
   1934         public static final Uri CONTENT_URI =
   1935             Uri.parse("content://contacts/extensions");
   1936 
   1937         /**
   1938          * The MIME type of {@link #CONTENT_URI} providing a directory of
   1939          * phones.
   1940          * @deprecated see {@link android.provider.ContactsContract}
   1941          */
   1942         @Deprecated
   1943         public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact_extensions";
   1944 
   1945         /**
   1946          * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
   1947          * phone.
   1948          * @deprecated see {@link android.provider.ContactsContract}
   1949          */
   1950         @Deprecated
   1951         public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_extensions";
   1952 
   1953         /**
   1954          * The default sort order for this table
   1955          * @deprecated see {@link android.provider.ContactsContract}
   1956          */
   1957         @Deprecated
   1958         public static final String DEFAULT_SORT_ORDER = "person, name ASC";
   1959 
   1960         /**
   1961          * The ID of the person this phone number is assigned to.
   1962          * <P>Type: INTEGER (long)</P>
   1963          * @deprecated see {@link android.provider.ContactsContract}
   1964          */
   1965         @Deprecated
   1966         public static final String PERSON_ID = "person";
   1967     }
   1968 
   1969     /**
   1970      * Contains helper classes used to create or manage {@link android.content.Intent Intents}
   1971      * that involve contacts.
   1972      * @deprecated see {@link android.provider.ContactsContract}
   1973      */
   1974     @Deprecated
   1975     public static final class Intents {
   1976         /**
   1977          * @deprecated see {@link android.provider.ContactsContract}
   1978          */
   1979         @Deprecated
   1980         public Intents() {
   1981         }
   1982 
   1983         /**
   1984          * This is the intent that is fired when a search suggestion is clicked on.
   1985          * @deprecated see {@link android.provider.ContactsContract}
   1986          */
   1987         @Deprecated
   1988         public static final String SEARCH_SUGGESTION_CLICKED =
   1989                 ContactsContract.Intents.SEARCH_SUGGESTION_CLICKED;
   1990 
   1991         /**
   1992          * This is the intent that is fired when a search suggestion for dialing a number
   1993          * is clicked on.
   1994          * @deprecated see {@link android.provider.ContactsContract}
   1995          */
   1996         @Deprecated
   1997         public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED =
   1998                 ContactsContract.Intents.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED;
   1999 
   2000         /**
   2001          * This is the intent that is fired when a search suggestion for creating a contact
   2002          * is clicked on.
   2003          * @deprecated see {@link android.provider.ContactsContract}
   2004          */
   2005         @Deprecated
   2006         public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED =
   2007                 ContactsContract.Intents.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED;
   2008 
   2009         /**
   2010          * Starts an Activity that lets the user pick a contact to attach an image to.
   2011          * After picking the contact it launches the image cropper in face detection mode.
   2012          * @deprecated see {@link android.provider.ContactsContract}
   2013          */
   2014         @Deprecated
   2015         public static final String ATTACH_IMAGE = ContactsContract.Intents.ATTACH_IMAGE;
   2016 
   2017         /**
   2018          * Takes as input a data URI with a mailto: or tel: scheme. If a single
   2019          * contact exists with the given data it will be shown. If no contact
   2020          * exists, a dialog will ask the user if they want to create a new
   2021          * contact with the provided details filled in. If multiple contacts
   2022          * share the data the user will be prompted to pick which contact they
   2023          * want to view.
   2024          * <p>
   2025          * For <code>mailto:</code> URIs, the scheme specific portion must be a
   2026          * raw email address, such as one built using
   2027          * {@link Uri#fromParts(String, String, String)}.
   2028          * <p>
   2029          * For <code>tel:</code> URIs, the scheme specific portion is compared
   2030          * to existing numbers using the standard caller ID lookup algorithm.
   2031          * The number must be properly encoded, for example using
   2032          * {@link Uri#fromParts(String, String, String)}.
   2033          * <p>
   2034          * Any extras from the {@link Insert} class will be passed along to the
   2035          * create activity if there are no contacts to show.
   2036          * <p>
   2037          * Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip
   2038          * prompting the user when the contact doesn't exist.
   2039          * @deprecated see {@link android.provider.ContactsContract}
   2040          */
   2041         @Deprecated
   2042         public static final String SHOW_OR_CREATE_CONTACT =
   2043                 ContactsContract.Intents.SHOW_OR_CREATE_CONTACT;
   2044 
   2045         /**
   2046          * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new
   2047          * contact if no matching contact found. Otherwise, default behavior is
   2048          * to prompt user with dialog before creating.
   2049          * <p>
   2050          * Type: BOOLEAN
   2051          * @deprecated see {@link android.provider.ContactsContract}
   2052          */
   2053         @Deprecated
   2054         public static final String EXTRA_FORCE_CREATE = ContactsContract.Intents.EXTRA_FORCE_CREATE;
   2055 
   2056         /**
   2057          * Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact
   2058          * description to be shown when prompting user about creating a new
   2059          * contact.
   2060          * <p>
   2061          * Type: STRING
   2062          * @deprecated see {@link android.provider.ContactsContract}
   2063          */
   2064         @Deprecated
   2065         public static final String EXTRA_CREATE_DESCRIPTION =
   2066                 ContactsContract.Intents.EXTRA_CREATE_DESCRIPTION;
   2067 
   2068         /**
   2069          * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a
   2070          * dialog location using screen coordinates. When not specified, the
   2071          * dialog will be centered.
   2072          *
   2073          * @hide pending API council review
   2074          * @deprecated see {@link android.provider.ContactsContract}
   2075          */
   2076         @Deprecated
   2077         public static final String EXTRA_TARGET_RECT = ContactsContract.Intents.EXTRA_TARGET_RECT;
   2078 
   2079         /**
   2080          * Intents related to the Contacts app UI.
   2081          * @deprecated see {@link android.provider.ContactsContract}
   2082          */
   2083         @Deprecated
   2084         public static final class UI {
   2085             /**
   2086              * @deprecated see {@link android.provider.ContactsContract}
   2087              */
   2088             @Deprecated
   2089             public UI() {
   2090             }
   2091 
   2092             /**
   2093              * The action for the default contacts list tab.
   2094              * @deprecated see {@link android.provider.ContactsContract}
   2095              */
   2096             @Deprecated
   2097             public static final String LIST_DEFAULT = ContactsContract.Intents.UI.LIST_DEFAULT;
   2098 
   2099             /**
   2100              * The action for the contacts list tab.
   2101              * @deprecated see {@link android.provider.ContactsContract}
   2102              */
   2103             @Deprecated
   2104             public static final String LIST_GROUP_ACTION =
   2105                     ContactsContract.Intents.UI.LIST_GROUP_ACTION;
   2106 
   2107             /**
   2108              * When in LIST_GROUP_ACTION mode, this is the group to display.
   2109              * @deprecated see {@link android.provider.ContactsContract}
   2110              */
   2111             @Deprecated
   2112             public static final String GROUP_NAME_EXTRA_KEY =
   2113                     ContactsContract.Intents.UI.GROUP_NAME_EXTRA_KEY;
   2114             /**
   2115              * The action for the all contacts list tab.
   2116              * @deprecated see {@link android.provider.ContactsContract}
   2117              */
   2118             @Deprecated
   2119             public static final String LIST_ALL_CONTACTS_ACTION =
   2120                     ContactsContract.Intents.UI.LIST_ALL_CONTACTS_ACTION;
   2121 
   2122             /**
   2123              * The action for the contacts with phone numbers list tab.
   2124              * @deprecated see {@link android.provider.ContactsContract}
   2125              */
   2126             @Deprecated
   2127             public static final String LIST_CONTACTS_WITH_PHONES_ACTION =
   2128                     ContactsContract.Intents.UI.LIST_CONTACTS_WITH_PHONES_ACTION;
   2129 
   2130             /**
   2131              * The action for the starred contacts list tab.
   2132              * @deprecated see {@link android.provider.ContactsContract}
   2133              */
   2134             @Deprecated
   2135             public static final String LIST_STARRED_ACTION =
   2136                     ContactsContract.Intents.UI.LIST_STARRED_ACTION;
   2137 
   2138             /**
   2139              * The action for the frequent contacts list tab.
   2140              * @deprecated see {@link android.provider.ContactsContract}
   2141              */
   2142             @Deprecated
   2143             public static final String LIST_FREQUENT_ACTION =
   2144                     ContactsContract.Intents.UI.LIST_FREQUENT_ACTION;
   2145 
   2146             /**
   2147              * The action for the "strequent" contacts list tab. It first lists the starred
   2148              * contacts in alphabetical order and then the frequent contacts in descending
   2149              * order of the number of times they have been contacted.
   2150              * @deprecated see {@link android.provider.ContactsContract}
   2151              */
   2152             @Deprecated
   2153             public static final String LIST_STREQUENT_ACTION =
   2154                     ContactsContract.Intents.UI.LIST_STREQUENT_ACTION;
   2155 
   2156             /**
   2157              * A key for to be used as an intent extra to set the activity
   2158              * title to a custom String value.
   2159              * @deprecated see {@link android.provider.ContactsContract}
   2160              */
   2161             @Deprecated
   2162             public static final String TITLE_EXTRA_KEY =
   2163                     ContactsContract.Intents.UI.TITLE_EXTRA_KEY;
   2164 
   2165             /**
   2166              * Activity Action: Display a filtered list of contacts
   2167              * <p>
   2168              * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for
   2169              * filtering
   2170              * <p>
   2171              * Output: Nothing.
   2172              * @deprecated see {@link android.provider.ContactsContract}
   2173              */
   2174             @Deprecated
   2175             public static final String FILTER_CONTACTS_ACTION =
   2176                     ContactsContract.Intents.UI.FILTER_CONTACTS_ACTION;
   2177 
   2178             /**
   2179              * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION}
   2180              * intents to supply the text on which to filter.
   2181              * @deprecated see {@link android.provider.ContactsContract}
   2182              */
   2183             @Deprecated
   2184             public static final String FILTER_TEXT_EXTRA_KEY =
   2185                     ContactsContract.Intents.UI.FILTER_TEXT_EXTRA_KEY;
   2186         }
   2187 
   2188         /**
   2189          * Convenience class that contains string constants used
   2190          * to create contact {@link android.content.Intent Intents}.
   2191          * @deprecated see {@link android.provider.ContactsContract}
   2192          */
   2193         @Deprecated
   2194         public static final class Insert {
   2195             /**
   2196              * @deprecated see {@link android.provider.ContactsContract}
   2197              */
   2198             @Deprecated
   2199             public Insert() {
   2200             }
   2201 
   2202             /** The action code to use when adding a contact
   2203              * @deprecated see {@link android.provider.ContactsContract}
   2204              */
   2205             @Deprecated
   2206             public static final String ACTION = ContactsContract.Intents.Insert.ACTION;
   2207 
   2208             /**
   2209              * If present, forces a bypass of quick insert mode.
   2210              * @deprecated see {@link android.provider.ContactsContract}
   2211              */
   2212             @Deprecated
   2213             public static final String FULL_MODE = ContactsContract.Intents.Insert.FULL_MODE;
   2214 
   2215             /**
   2216              * The extra field for the contact name.
   2217              * <P>Type: String</P>
   2218              * @deprecated see {@link android.provider.ContactsContract}
   2219              */
   2220             @Deprecated
   2221             public static final String NAME = ContactsContract.Intents.Insert.NAME;
   2222 
   2223             /**
   2224              * The extra field for the contact phonetic name.
   2225              * <P>Type: String</P>
   2226              * @deprecated see {@link android.provider.ContactsContract}
   2227              */
   2228             @Deprecated
   2229             public static final String PHONETIC_NAME =
   2230                     ContactsContract.Intents.Insert.PHONETIC_NAME;
   2231 
   2232             /**
   2233              * The extra field for the contact company.
   2234              * <P>Type: String</P>
   2235              * @deprecated see {@link android.provider.ContactsContract}
   2236              */
   2237             @Deprecated
   2238             public static final String COMPANY = ContactsContract.Intents.Insert.COMPANY;
   2239 
   2240             /**
   2241              * The extra field for the contact job title.
   2242              * <P>Type: String</P>
   2243              * @deprecated see {@link android.provider.ContactsContract}
   2244              */
   2245             @Deprecated
   2246             public static final String JOB_TITLE = ContactsContract.Intents.Insert.JOB_TITLE;
   2247 
   2248             /**
   2249              * The extra field for the contact notes.
   2250              * <P>Type: String</P>
   2251              * @deprecated see {@link android.provider.ContactsContract}
   2252              */
   2253             @Deprecated
   2254             public static final String NOTES = ContactsContract.Intents.Insert.NOTES;
   2255 
   2256             /**
   2257              * The extra field for the contact phone number.
   2258              * <P>Type: String</P>
   2259              * @deprecated see {@link android.provider.ContactsContract}
   2260              */
   2261             @Deprecated
   2262             public static final String PHONE = ContactsContract.Intents.Insert.PHONE;
   2263 
   2264             /**
   2265              * The extra field for the 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 PHONE_TYPE = ContactsContract.Intents.Insert.PHONE_TYPE;
   2272 
   2273             /**
   2274              * The extra field for the phone isprimary flag.
   2275              * <P>Type: boolean</P>
   2276              * @deprecated see {@link android.provider.ContactsContract}
   2277              */
   2278             @Deprecated
   2279             public static final String PHONE_ISPRIMARY =
   2280                     ContactsContract.Intents.Insert.PHONE_ISPRIMARY;
   2281 
   2282             /**
   2283              * The extra field for an optional second contact phone number.
   2284              * <P>Type: String</P>
   2285              * @deprecated see {@link android.provider.ContactsContract}
   2286              */
   2287             @Deprecated
   2288             public static final String SECONDARY_PHONE =
   2289                     ContactsContract.Intents.Insert.SECONDARY_PHONE;
   2290 
   2291             /**
   2292              * The extra field for an optional second contact phone number type.
   2293              * <P>Type: Either an integer value from {@link android.provider.Contacts.PhonesColumns PhonesColumns},
   2294              *  or a string specifying a custom label.</P>
   2295              * @deprecated see {@link android.provider.ContactsContract}
   2296              */
   2297             @Deprecated
   2298             public static final String SECONDARY_PHONE_TYPE =
   2299                     ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE;
   2300 
   2301             /**
   2302              * The extra field for an optional third contact phone number.
   2303              * <P>Type: String</P>
   2304              * @deprecated see {@link android.provider.ContactsContract}
   2305              */
   2306             @Deprecated
   2307             public static final String TERTIARY_PHONE =
   2308                     ContactsContract.Intents.Insert.TERTIARY_PHONE;
   2309 
   2310             /**
   2311              * The extra field for an optional third contact phone number type.
   2312              * <P>Type: Either an integer value from {@link android.provider.Contacts.PhonesColumns PhonesColumns},
   2313              *  or a string specifying a custom label.</P>
   2314              * @deprecated see {@link android.provider.ContactsContract}
   2315              */
   2316             @Deprecated
   2317             public static final String TERTIARY_PHONE_TYPE =
   2318                     ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE;
   2319 
   2320             /**
   2321              * The extra field for the contact email address.
   2322              * <P>Type: String</P>
   2323              * @deprecated see {@link android.provider.ContactsContract}
   2324              */
   2325             @Deprecated
   2326             public static final String EMAIL = ContactsContract.Intents.Insert.EMAIL;
   2327 
   2328             /**
   2329              * The extra field for the 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 EMAIL_TYPE = ContactsContract.Intents.Insert.EMAIL_TYPE;
   2336 
   2337             /**
   2338              * The extra field for the email isprimary flag.
   2339              * <P>Type: boolean</P>
   2340              * @deprecated see {@link android.provider.ContactsContract}
   2341              */
   2342             @Deprecated
   2343             public static final String EMAIL_ISPRIMARY =
   2344                     ContactsContract.Intents.Insert.EMAIL_ISPRIMARY;
   2345 
   2346             /**
   2347              * The extra field for an optional second contact email address.
   2348              * <P>Type: String</P>
   2349              * @deprecated see {@link android.provider.ContactsContract}
   2350              */
   2351             @Deprecated
   2352             public static final String SECONDARY_EMAIL =
   2353                     ContactsContract.Intents.Insert.SECONDARY_EMAIL;
   2354 
   2355             /**
   2356              * The extra field for an optional second contact email type.
   2357              * <P>Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
   2358              *  or a string specifying a custom label.</P>
   2359              * @deprecated see {@link android.provider.ContactsContract}
   2360              */
   2361             @Deprecated
   2362             public static final String SECONDARY_EMAIL_TYPE =
   2363                     ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE;
   2364 
   2365             /**
   2366              * The extra field for an optional third contact email address.
   2367              * <P>Type: String</P>
   2368              * @deprecated see {@link android.provider.ContactsContract}
   2369              */
   2370             @Deprecated
   2371             public static final String TERTIARY_EMAIL =
   2372                     ContactsContract.Intents.Insert.TERTIARY_EMAIL;
   2373 
   2374             /**
   2375              * The extra field for an optional third contact email type.
   2376              * <P>Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
   2377              *  or a string specifying a custom label.</P>
   2378              * @deprecated see {@link android.provider.ContactsContract}
   2379              */
   2380             @Deprecated
   2381             public static final String TERTIARY_EMAIL_TYPE =
   2382                     ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE;
   2383 
   2384             /**
   2385              * The extra field for the contact postal address.
   2386              * <P>Type: String</P>
   2387              * @deprecated see {@link android.provider.ContactsContract}
   2388              */
   2389             @Deprecated
   2390             public static final String POSTAL = ContactsContract.Intents.Insert.POSTAL;
   2391 
   2392             /**
   2393              * The extra field for the contact postal address type.
   2394              * <P>Type: Either an integer value from {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns}
   2395              *  or a string specifying a custom label.</P>
   2396              * @deprecated see {@link android.provider.ContactsContract}
   2397              */
   2398             @Deprecated
   2399             public static final String POSTAL_TYPE = ContactsContract.Intents.Insert.POSTAL_TYPE;
   2400 
   2401             /**
   2402              * The extra field for the postal isprimary flag.
   2403              * <P>Type: boolean</P>
   2404              * @deprecated see {@link android.provider.ContactsContract}
   2405              */
   2406             @Deprecated
   2407             public static final String POSTAL_ISPRIMARY = ContactsContract.Intents.Insert.POSTAL_ISPRIMARY;
   2408 
   2409             /**
   2410              * The extra field for an IM handle.
   2411              * <P>Type: String</P>
   2412              * @deprecated see {@link android.provider.ContactsContract}
   2413              */
   2414             @Deprecated
   2415             public static final String IM_HANDLE = ContactsContract.Intents.Insert.IM_HANDLE;
   2416 
   2417             /**
   2418              * The extra field for the IM protocol
   2419              * <P>Type: the result of {@link Contacts.ContactMethods#encodePredefinedImProtocol}
   2420              * or {@link Contacts.ContactMethods#encodeCustomImProtocol}.</P>
   2421              * @deprecated see {@link android.provider.ContactsContract}
   2422              */
   2423             @Deprecated
   2424             public static final String IM_PROTOCOL = ContactsContract.Intents.Insert.IM_PROTOCOL;
   2425 
   2426             /**
   2427              * The extra field for the IM isprimary flag.
   2428              * <P>Type: boolean</P>
   2429              * @deprecated see {@link android.provider.ContactsContract}
   2430              */
   2431             @Deprecated
   2432             public static final String IM_ISPRIMARY = ContactsContract.Intents.Insert.IM_ISPRIMARY;
   2433         }
   2434     }
   2435 }
   2436