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