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