ContactsContract.java revision 0c36a517cd01a7112460a96f9f0fa2badf8f7015
1/* 2 * Copyright (C) 2009 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 android.accounts.Account; 20import android.content.ContentProviderClient; 21import android.content.ContentProviderOperation; 22import android.content.ContentResolver; 23import android.content.ContentUris; 24import android.content.Context; 25import android.content.Intent; 26import android.content.res.Resources; 27import android.database.Cursor; 28import android.graphics.BitmapFactory; 29import android.net.Uri; 30import android.os.RemoteException; 31import android.text.TextUtils; 32 33import java.io.ByteArrayInputStream; 34import java.io.InputStream; 35 36/** 37 * The contract between the contacts provider and applications. Contains definitions 38 * for the supported URIs and columns. 39 * 40 * @hide 41 */ 42public final class ContactsContract { 43 /** The authority for the contacts provider */ 44 public static final String AUTHORITY = "com.android.contacts"; 45 /** A content:// style uri to the authority for the contacts provider */ 46 public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY); 47 48 public interface SyncStateColumns extends SyncStateContract.Columns { 49 } 50 51 public static final class SyncState { 52 /** 53 * This utility class cannot be instantiated 54 */ 55 private SyncState() {} 56 57 public static final String CONTENT_DIRECTORY = 58 SyncStateContract.Constants.CONTENT_DIRECTORY; 59 60 /** 61 * The content:// style URI for this table 62 */ 63 public static final Uri CONTENT_URI = 64 Uri.withAppendedPath(AUTHORITY_URI, CONTENT_DIRECTORY); 65 66 /** 67 * @see android.provider.SyncStateContract.Helpers#get 68 */ 69 public static byte[] get(ContentProviderClient provider, Account account) 70 throws RemoteException { 71 return SyncStateContract.Helpers.get(provider, CONTENT_URI, account); 72 } 73 74 /** 75 * @see android.provider.SyncStateContract.Helpers#set 76 */ 77 public static void set(ContentProviderClient provider, Account account, byte[] data) 78 throws RemoteException { 79 SyncStateContract.Helpers.set(provider, CONTENT_URI, account, data); 80 } 81 82 /** 83 * @see android.provider.SyncStateContract.Helpers#newSetOperation 84 */ 85 public static ContentProviderOperation newSetOperation(Account account, byte[] data) { 86 return SyncStateContract.Helpers.newSetOperation(CONTENT_URI, account, data); 87 } 88 } 89 90 /** 91 * Generic columns for use by sync adapters. The specific functions of 92 * these columns are private to the sync adapter. Other clients of the API 93 * should not attempt to either read or write this column. 94 */ 95 private interface BaseSyncColumns { 96 97 /** Generic column for use by sync adapters. */ 98 public static final String SYNC1 = "sync1"; 99 /** Generic column for use by sync adapters. */ 100 public static final String SYNC2 = "sync2"; 101 /** Generic column for use by sync adapters. */ 102 public static final String SYNC3 = "sync3"; 103 /** Generic column for use by sync adapters. */ 104 public static final String SYNC4 = "sync4"; 105 } 106 107 /** 108 * Columns that appear when each row of a table belongs to a specific 109 * account, including sync information that an account may need. 110 */ 111 private interface SyncColumns extends BaseSyncColumns { 112 /** 113 * The name of the account instance to which this row belongs. 114 * <P>Type: TEXT</P> 115 */ 116 public static final String ACCOUNT_NAME = "account_name"; 117 118 /** 119 * The type of account to which this row belongs, which when paired with 120 * {@link #ACCOUNT_NAME} identifies a specific account. 121 * <P>Type: TEXT</P> 122 */ 123 public static final String ACCOUNT_TYPE = "account_type"; 124 125 /** 126 * String that uniquely identifies this row to its source account. 127 * <P>Type: TEXT</P> 128 */ 129 public static final String SOURCE_ID = "sourceid"; 130 131 /** 132 * Version number that is updated whenever this row or its related data 133 * changes. 134 * <P>Type: INTEGER</P> 135 */ 136 public static final String VERSION = "version"; 137 138 /** 139 * Flag indicating that {@link #VERSION} has changed, and this row needs 140 * to be synchronized by its owning account. 141 * <P>Type: INTEGER (boolean)</P> 142 */ 143 public static final String DIRTY = "dirty"; 144 } 145 146 public interface ContactOptionsColumns { 147 /** 148 * The number of times a person has been contacted 149 * <P>Type: INTEGER</P> 150 */ 151 public static final String TIMES_CONTACTED = "times_contacted"; 152 153 /** 154 * The last time a person was contacted. 155 * <P>Type: INTEGER</P> 156 */ 157 public static final String LAST_TIME_CONTACTED = "last_time_contacted"; 158 159 /** 160 * Is the contact starred? 161 * <P>Type: INTEGER (boolean)</P> 162 */ 163 public static final String STARRED = "starred"; 164 165 /** 166 * A custom ringtone associated with a person. Not always present. 167 * <P>Type: TEXT (URI to the ringtone)</P> 168 */ 169 public static final String CUSTOM_RINGTONE = "custom_ringtone"; 170 171 /** 172 * Whether the person should always be sent to voicemail. Not always 173 * present. 174 * <P>Type: INTEGER (0 for false, 1 for true)</P> 175 */ 176 public static final String SEND_TO_VOICEMAIL = "send_to_voicemail"; 177 } 178 179 private interface ContactsColumns { 180 /** 181 * The display name for the contact. 182 * <P>Type: TEXT</P> 183 */ 184 public static final String DISPLAY_NAME = "display_name"; 185 186 /** 187 * Reference to the row in the data table holding the photo. 188 * <P>Type: INTEGER REFERENCES data(_id)</P> 189 */ 190 public static final String PHOTO_ID = "photo_id"; 191 192 /** 193 * Lookup value that reflects the {@link Groups#GROUP_VISIBLE} state of 194 * any {@link CommonDataKinds.GroupMembership} for this contact. 195 */ 196 public static final String IN_VISIBLE_GROUP = "in_visible_group"; 197 198 /** 199 * Contact presence status. See {@link android.provider.Im.CommonPresenceColumns} 200 * for individual status definitions. This column is only returned if explicitly 201 * requested in the query projection. 202 * <p>Type: NUMBER</p> 203 */ 204 public static final String PRESENCE_STATUS = Presence.PRESENCE_STATUS; 205 206 /** 207 * Contact presence custom status. This column is only returned if explicitly 208 * requested in the query projection. 209 * <p>Type: TEXT</p> 210 */ 211 public static final String PRESENCE_CUSTOM_STATUS = Presence.PRESENCE_CUSTOM_STATUS; 212 213 /** 214 * An indicator of whether this contact has at least one phone number. "1" if there is 215 * at least one phone number, "0" otherwise. 216 * <P>Type: INTEGER</P> 217 */ 218 public static final String HAS_PHONE_NUMBER = "has_phone_number"; 219 220 /** 221 * An opaque value that contains hints on how to find the contact if 222 * its row id changed as a result of a sync or aggregation. 223 */ 224 public static final String LOOKUP_KEY = "lookup"; 225 } 226 227 /** 228 * Constants for the contacts table, which contains a record per group 229 * of raw contact representing the same person. 230 */ 231 public static class Contacts implements BaseColumns, ContactsColumns, 232 ContactOptionsColumns { 233 /** 234 * This utility class cannot be instantiated 235 */ 236 private Contacts() {} 237 238 /** 239 * The content:// style URI for this table 240 */ 241 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "contacts"); 242 243 /** 244 * A content:// style URI for this table that should be used to create 245 * shortcuts or otherwise create long-term links to contacts. This URI 246 * should always be followed by a "/" and the contact's {@link #LOOKUP_KEY}. 247 * It can optionally also have a "/" and last known contact ID appended after 248 * that. This "complete" format is an important optimization and is highly recommended. 249 * <p> 250 * As long as the contact's row ID remains the same, this URI is 251 * equivalent to {@link #CONTENT_URI}. If the contact's row ID changes 252 * as a result of a sync or aggregation, this URI will look up the 253 * contact using indirect information (sync IDs or constituent raw 254 * contacts). 255 * <p> 256 * Lookup key should be appended unencoded - it is stored in the encoded 257 * form, ready for use in a URI. 258 */ 259 public static final Uri CONTENT_LOOKUP_URI = Uri.withAppendedPath(CONTENT_URI, 260 "lookup"); 261 262 /** 263 * Computes a complete lookup URI (see {@link #CONTENT_LOOKUP_URI}). 264 * Pass either a basic content URI with a contact ID to obtain an 265 * equivalent lookup URI. Pass a possibly stale lookup URI to get a fresh 266 * lookup URI for the same contact. 267 * <p> 268 * Returns null if the contact cannot be found. 269 */ 270 public static Uri getLookupUri(ContentResolver resolver, Uri contentUri) { 271 Cursor c = resolver.query(contentUri, 272 new String[]{Contacts.LOOKUP_KEY, Contacts._ID}, null, null, null); 273 if (c == null) { 274 return null; 275 } 276 277 try { 278 if (c.moveToFirst()) { 279 String lookupKey = c.getString(0); 280 long contactId = c.getLong(1); 281 return ContentUris.withAppendedId( 282 Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), 283 contactId); 284 } 285 } finally { 286 c.close(); 287 } 288 return null; 289 } 290 291 /** 292 * Computes a content URI (see {@link #CONTENT_URI}) given a lookup URI. 293 * <p> 294 * Returns null if the contact cannot be found. 295 */ 296 public static Uri lookupContact(ContentResolver resolver, Uri lookupUri) { 297 if (lookupUri == null) { 298 return null; 299 } 300 301 Cursor c = resolver.query(lookupUri, new String[]{Contacts._ID}, null, null, null); 302 if (c == null) { 303 return null; 304 } 305 306 try { 307 if (c.moveToFirst()) { 308 long contactId = c.getLong(0); 309 return ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId); 310 } 311 } finally { 312 c.close(); 313 } 314 return null; 315 } 316 317 /** 318 * The content:// style URI for this table joined with useful data from 319 * {@link Data}. 320 * 321 * @deprecated Please use plain CONTENT_URI for the same result 322 */ 323 @Deprecated 324 public static final Uri CONTENT_SUMMARY_URI = CONTENT_URI; 325 326 /** 327 * The content:// style URI used for "type-to-filter" functionality on the 328 * {@link #CONTENT_URI} URI. The filter string will be used to match 329 * various parts of the contact name. The filter argument should be passed 330 * as an additional path segment after this URI. 331 */ 332 public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath( 333 CONTENT_URI, "filter"); 334 335 @Deprecated 336 public static final Uri CONTENT_SUMMARY_FILTER_URI = CONTENT_FILTER_URI; 337 338 /** 339 * The content:// style URI for this table joined with useful data from 340 * {@link Data}, filtered to include only starred contacts 341 * and the most frequently contacted contacts. 342 */ 343 public static final Uri CONTENT_STREQUENT_URI = Uri.withAppendedPath( 344 CONTENT_URI, "strequent"); 345 346 @Deprecated 347 public static final Uri CONTENT_SUMMARY_STREQUENT_URI = CONTENT_STREQUENT_URI; 348 349 /** 350 * The content:// style URI used for "type-to-filter" functionality on the 351 * {@link #CONTENT_STREQUENT_URI} URI. The filter string will be used to match 352 * various parts of the contact name. The filter argument should be passed 353 * as an additional path segment after this URI. 354 */ 355 public static final Uri CONTENT_STREQUENT_FILTER_URI = Uri.withAppendedPath( 356 CONTENT_STREQUENT_URI, "filter"); 357 358 @Deprecated 359 public static final Uri CONTENT_SUMMARY_STREQUENT_FILTER_URI = CONTENT_STREQUENT_FILTER_URI; 360 361 public static final Uri CONTENT_GROUP_URI = Uri.withAppendedPath( 362 CONTENT_URI, "group"); 363 364 @Deprecated 365 public static final Uri CONTENT_SUMMARY_GROUP_URI = CONTENT_GROUP_URI; 366 /** 367 * The MIME type of {@link #CONTENT_URI} providing a directory of 368 * people. 369 */ 370 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact"; 371 372 /** 373 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single 374 * person. 375 */ 376 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact"; 377 378 /** 379 * A sub-directory of a single contact that contains all of the constituent raw contact 380 * {@link Data} rows. 381 */ 382 public static final class Data implements BaseColumns, DataColumns { 383 /** 384 * no public constructor since this is a utility class 385 */ 386 private Data() {} 387 388 /** 389 * The directory twig for this sub-table 390 */ 391 public static final String CONTENT_DIRECTORY = "data"; 392 } 393 394 /** 395 * A sub-directory of a single contact aggregate that contains all aggregation suggestions 396 * (other contacts). The aggregation suggestions are computed based on approximate 397 * data matches with this contact. 398 */ 399 public static final class AggregationSuggestions implements BaseColumns, ContactsColumns { 400 /** 401 * No public constructor since this is a utility class 402 */ 403 private AggregationSuggestions() {} 404 405 /** 406 * The directory twig for this sub-table 407 */ 408 public static final String CONTENT_DIRECTORY = "suggestions"; 409 } 410 411 /** 412 * A sub-directory of a single contact that contains the contact's primary photo. 413 */ 414 public static final class Photo implements BaseColumns, DataColumns { 415 /** 416 * no public constructor since this is a utility class 417 */ 418 private Photo() {} 419 420 /** 421 * The directory twig for this sub-table 422 */ 423 public static final String CONTENT_DIRECTORY = "photo"; 424 } 425 426 /** 427 * Opens an InputStream for the person's default photo and returns the 428 * photo as a Bitmap stream. 429 * 430 * @param contactUri the contact whose photo should be used 431 */ 432 public static InputStream openContactPhotoInputStream(ContentResolver cr, Uri contactUri) { 433 Uri photoUri = Uri.withAppendedPath(contactUri, Photo.CONTENT_DIRECTORY); 434 if (photoUri == null) { 435 return null; 436 } 437 Cursor cursor = cr.query(photoUri, 438 new String[]{ContactsContract.CommonDataKinds.Photo.PHOTO}, null, null, null); 439 try { 440 if (cursor == null || !cursor.moveToNext()) { 441 return null; 442 } 443 byte[] data = cursor.getBlob(0); 444 if (data == null) { 445 return null; 446 } 447 return new ByteArrayInputStream(data); 448 } finally { 449 if (cursor != null) { 450 cursor.close(); 451 } 452 } 453 } 454 } 455 456 private interface RawContactsColumns { 457 /** 458 * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} that this 459 * data belongs to. 460 * <P>Type: INTEGER</P> 461 */ 462 public static final String CONTACT_ID = "contact_id"; 463 464 /** 465 * Flag indicating that this {@link RawContacts} entry and its children has 466 * been restricted to specific platform apps. 467 * <P>Type: INTEGER (boolean)</P> 468 * 469 * @hide until finalized in future platform release 470 */ 471 public static final String IS_RESTRICTED = "is_restricted"; 472 473 /** 474 * The aggregation mode for this contact. 475 * <P>Type: INTEGER</P> 476 */ 477 public static final String AGGREGATION_MODE = "aggregation_mode"; 478 479 /** 480 * The "deleted" flag: "0" by default, "1" if the row has been marked 481 * for deletion. When {@link android.content.ContentResolver#delete} is 482 * called on a raw contact, it is marked for deletion and removed from its 483 * aggregate contact. The sync adaptor deletes the raw contact on the server and 484 * then calls ContactResolver.delete once more, this time passing the 485 * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal. 486 * <P>Type: INTEGER</P> 487 */ 488 public static final String DELETED = "deleted"; 489 } 490 491 /** 492 * Constants for the raw_contacts table, which contains the base contact 493 * information per sync source. Sync adapters and contact management apps 494 * are the primary consumers of this API. 495 */ 496 public static final class RawContacts implements BaseColumns, RawContactsColumns, 497 ContactOptionsColumns, SyncColumns { 498 /** 499 * This utility class cannot be instantiated 500 */ 501 private RawContacts() { 502 } 503 504 /** 505 * The content:// style URI for this table 506 */ 507 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "raw_contacts"); 508 509 /** 510 * The content:// style URL for filtering people by email address. The 511 * filter argument should be passed as an additional path segment after 512 * this URI. 513 * 514 * @hide 515 */ 516 @Deprecated 517 public static final Uri CONTENT_FILTER_EMAIL_URI = 518 Uri.withAppendedPath(CONTENT_URI, "filter_email"); 519 520 /** 521 * The MIME type of {@link #CONTENT_URI} providing a directory of 522 * people. 523 */ 524 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact"; 525 526 /** 527 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single 528 * person. 529 */ 530 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/raw_contact"; 531 532 /** 533 * Query parameter that can be passed with the {@link #CONTENT_URI} URI 534 * to the {@link android.content.ContentResolver#delete} method to 535 * indicate that the raw contact can be deleted physically, rather than 536 * merely marked as deleted. 537 */ 538 public static final String DELETE_PERMANENTLY = "delete_permanently"; 539 540 /** 541 * Aggregation mode: aggregate asynchronously. 542 */ 543 public static final int AGGREGATION_MODE_DEFAULT = 0; 544 545 /** 546 * Aggregation mode: aggregate at the time the raw contact is inserted/updated. 547 */ 548 public static final int AGGREGATION_MODE_IMMEDITATE = 1; 549 550 /** 551 * If {@link #AGGREGATION_MODE} is {@link #AGGREGATION_MODE_SUSPENDED}, changes 552 * to the raw contact do not cause its aggregation to be revisited. Note that changing 553 * {@link #AGGREGATION_MODE} from {@link #AGGREGATION_MODE_SUSPENDED} to 554 * {@link #AGGREGATION_MODE_DEFAULT} does not trigger an aggregation pass. Any subsequent 555 * change to the raw contact's data will. 556 */ 557 public static final int AGGREGATION_MODE_SUSPENDED = 2; 558 559 /** 560 * Aggregation mode: never aggregate this raw contact (note that the raw contact will not 561 * have a corresponding Aggregate and therefore will not be included in Aggregates 562 * query results.) 563 */ 564 public static final int AGGREGATION_MODE_DISABLED = 3; 565 566 /** 567 * A sub-directory of a single raw contact that contains all of their {@link Data} rows. 568 * To access this directory append {@link Data#CONTENT_DIRECTORY} to the contact URI. 569 */ 570 public static final class Data implements BaseColumns, DataColumns { 571 /** 572 * no public constructor since this is a utility class 573 */ 574 private Data() { 575 } 576 577 /** 578 * The directory twig for this sub-table 579 */ 580 public static final String CONTENT_DIRECTORY = "data"; 581 } 582 } 583 584 private interface DataColumns { 585 /** 586 * The package name to use when creating {@link Resources} objects for 587 * this data row. This value is only designed for use when building user 588 * interfaces, and should not be used to infer the owner. 589 */ 590 public static final String RES_PACKAGE = "res_package"; 591 592 /** 593 * The MIME type of the item represented by this row. 594 */ 595 public static final String MIMETYPE = "mimetype"; 596 597 /** 598 * A reference to the {@link RawContacts#_ID} 599 * that this data belongs to. 600 */ 601 public static final String RAW_CONTACT_ID = "raw_contact_id"; 602 603 /** 604 * Whether this is the primary entry of its kind for the raw contact it belongs to 605 * <P>Type: INTEGER (if set, non-0 means true)</P> 606 */ 607 public static final String IS_PRIMARY = "is_primary"; 608 609 /** 610 * Whether this is the primary entry of its kind for the aggregate 611 * contact it belongs to. Any data record that is "super primary" must 612 * also be "primary". 613 * <P>Type: INTEGER (if set, non-0 means true)</P> 614 */ 615 public static final String IS_SUPER_PRIMARY = "is_super_primary"; 616 617 /** 618 * The version of this data record. This is a read-only value. The data column is 619 * guaranteed to not change without the version going up. This value is monotonically 620 * increasing. 621 * <P>Type: INTEGER</P> 622 */ 623 public static final String DATA_VERSION = "data_version"; 624 625 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 626 public static final String DATA1 = "data1"; 627 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 628 public static final String DATA2 = "data2"; 629 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 630 public static final String DATA3 = "data3"; 631 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 632 public static final String DATA4 = "data4"; 633 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 634 public static final String DATA5 = "data5"; 635 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 636 public static final String DATA6 = "data6"; 637 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 638 public static final String DATA7 = "data7"; 639 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 640 public static final String DATA8 = "data8"; 641 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 642 public static final String DATA9 = "data9"; 643 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 644 public static final String DATA10 = "data10"; 645 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 646 public static final String DATA11 = "data11"; 647 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 648 public static final String DATA12 = "data12"; 649 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 650 public static final String DATA13 = "data13"; 651 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 652 public static final String DATA14 = "data14"; 653 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 654 public static final String DATA15 = "data15"; 655 656 /** Generic column for use by sync adapters. */ 657 public static final String SYNC1 = "data_sync1"; 658 /** Generic column for use by sync adapters. */ 659 public static final String SYNC2 = "data_sync2"; 660 /** Generic column for use by sync adapters. */ 661 public static final String SYNC3 = "data_sync3"; 662 /** Generic column for use by sync adapters. */ 663 public static final String SYNC4 = "data_sync4"; 664 665 /** 666 * An optional insert, update or delete URI parameter that determines if 667 * the corresponding raw contact should be marked as dirty. The default 668 * value is true. 669 */ 670 public static final String MARK_AS_DIRTY = "mark_as_dirty"; 671 } 672 673 /** 674 * Constants for the data table, which contains data points tied to a raw contact. 675 * For example, a phone number or email address. Each row in this table contains a type 676 * definition and some generic columns. Each data type can define the meaning for each of 677 * the generic columns. 678 */ 679 public static final class Data implements BaseColumns, DataColumns { 680 /** 681 * This utility class cannot be instantiated 682 */ 683 private Data() {} 684 685 /** 686 * The content:// style URI for this table 687 */ 688 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data"); 689 690 /** 691 * The content:// style URI for this table joined with {@link Presence} 692 * data where applicable. 693 * 694 * @hide 695 */ 696 public static final Uri CONTENT_WITH_PRESENCE_URI = Uri.withAppendedPath(AUTHORITY_URI, 697 "data_with_presence"); 698 699 /** 700 * The MIME type of {@link #CONTENT_URI} providing a directory of data. 701 */ 702 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/data"; 703 } 704 705 private interface PhoneLookupColumns { 706 /** 707 * The phone number as the user entered it. 708 * <P>Type: TEXT</P> 709 */ 710 public static final String NUMBER = "number"; 711 712 /** 713 * The type of phone number, for example Home or Work. 714 * <P>Type: INTEGER</P> 715 */ 716 public static final String TYPE = "type"; 717 718 /** 719 * The user defined label for the phone number. 720 * <P>Type: TEXT</P> 721 */ 722 public static final String LABEL = "label"; 723 } 724 725 /** 726 * A table that represents the result of looking up a phone number, for 727 * example for caller ID. To perform a lookup you must append the number you 728 * want to find to {@link #CONTENT_FILTER_URI}. 729 */ 730 public static final class PhoneLookup implements BaseColumns, PhoneLookupColumns, 731 ContactsColumns, ContactOptionsColumns { 732 /** 733 * This utility class cannot be instantiated 734 */ 735 private PhoneLookup() {} 736 737 /** 738 * The content:// style URI for this table. Append the phone number you want to lookup 739 * to this URI and query it to perform a lookup. For example: 740 * 741 * {@code 742 * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber); 743 * } 744 */ 745 public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI, 746 "phone_lookup"); 747 } 748 749 /** 750 * Additional data mixed in with {@link Im.CommonPresenceColumns} to link 751 * back to specific {@link ContactsContract.Contacts#_ID} entries. 752 */ 753 private interface PresenceColumns { 754 755 /** 756 * The unique ID for a row. 757 * <P>Type: INTEGER (long)</P> 758 */ 759 public static final String _ID = "presence_id"; 760 761 /** 762 * Reference to the {@link RawContacts#_ID} this presence references. 763 * <P>Type: INTEGER</P> 764 * 765 * TODO remove this from public API 766 * @hide 767 */ 768 @Deprecated 769 public static final String RAW_CONTACT_ID = "presence_raw_contact_id"; 770 771 /** 772 * Reference to the {@link Data#_ID} entry that owns this presence. 773 * <P>Type: INTEGER</P> 774 */ 775 public static final String DATA_ID = "presence_data_id"; 776 777 @Deprecated 778 public static final String IM_PROTOCOL = "im_protocol"; 779 780 /** 781 * <p>Type: NUMBER</p> 782 */ 783 public static final String PROTOCOL = "protocol"; 784 785 /** 786 * Name of the custom protocol. Should be supplied along with the {@link #PROTOCOL} value 787 * {@link ContactsContract.CommonDataKinds.Im#PROTOCOL_CUSTOM}. Should be null or 788 * omitted if {@link #PROTOCOL} value is not 789 * {@link ContactsContract.CommonDataKinds.Im#PROTOCOL_CUSTOM}. 790 * 791 * <p>Type: NUMBER</p> 792 */ 793 public static final String CUSTOM_PROTOCOL = "custom_protocol"; 794 795 /** 796 * The IM handle the presence item is for. The handle is scoped to 797 * {@link #PROTOCOL}. 798 * <P>Type: TEXT</P> 799 */ 800 public static final String IM_HANDLE = "im_handle"; 801 802 /** 803 * The IM account for the local user that the presence data came from. 804 * <P>Type: TEXT</P> 805 */ 806 public static final String IM_ACCOUNT = "im_account"; 807 } 808 809 public static final class Presence implements PresenceColumns, Im.CommonPresenceColumns { 810 /** 811 * This utility class cannot be instantiated 812 */ 813 private Presence() { 814 } 815 816 /** 817 * The content:// style URI for this table 818 */ 819 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence"); 820 821 /** 822 * Gets the resource ID for the proper presence icon. 823 * 824 * @param status the status to get the icon for 825 * @return the resource ID for the proper presence icon 826 */ 827 public static final int getPresenceIconResourceId(int status) { 828 switch (status) { 829 case AVAILABLE: 830 return android.R.drawable.presence_online; 831 case IDLE: 832 case AWAY: 833 return android.R.drawable.presence_away; 834 case DO_NOT_DISTURB: 835 return android.R.drawable.presence_busy; 836 case INVISIBLE: 837 return android.R.drawable.presence_invisible; 838 case OFFLINE: 839 default: 840 return android.R.drawable.presence_offline; 841 } 842 } 843 844 /** 845 * Returns the precedence of the status code the higher number being the higher precedence. 846 * 847 * @param status The status code. 848 * @return An integer representing the precedence, 0 being the lowest. 849 */ 850 public static final int getPresencePrecedence(int status) { 851 // Keep this function here incase we want to enforce a different precedence than the 852 // natural order of the status constants. 853 return status; 854 } 855 856 /** 857 * The MIME type of {@link #CONTENT_URI} providing a directory of 858 * presence details. 859 */ 860 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/im-presence"; 861 862 /** 863 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single 864 * presence detail. 865 */ 866 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im-presence"; 867 } 868 869 /** 870 * Container for definitions of common data types stored in the {@link Data} table. 871 */ 872 public static final class CommonDataKinds { 873 /** 874 * The {@link Data#RES_PACKAGE} value for common data that should be 875 * shown using a default style. 876 */ 877 public static final String PACKAGE_COMMON = "common"; 878 879 /** 880 * Columns common across the specific types. 881 */ 882 private interface BaseCommonColumns { 883 /** 884 * The package name to use when creating {@link Resources} objects for 885 * this data row. This value is only designed for use when building user 886 * interfaces, and should not be used to infer the owner. 887 */ 888 public static final String RES_PACKAGE = "res_package"; 889 890 /** 891 * The MIME type of the item represented by this row. 892 */ 893 public static final String MIMETYPE = "mimetype"; 894 895 /** 896 * The {@link RawContacts#_ID} that this data belongs to. 897 */ 898 public static final String RAW_CONTACT_ID = "raw_contact_id"; 899 } 900 901 /** 902 * The base types that all "Typed" data kinds support. 903 */ 904 public interface BaseTypes { 905 906 /** 907 * A custom type. The custom label should be supplied by user. 908 */ 909 public static int TYPE_CUSTOM = 0; 910 } 911 912 /** 913 * Columns common across the specific types. 914 */ 915 private interface CommonColumns extends BaseTypes{ 916 /** 917 * The type of data, for example Home or Work. 918 * <P>Type: INTEGER</P> 919 */ 920 public static final String TYPE = "data1"; 921 922 /** 923 * The data for the contact method. 924 * <P>Type: TEXT</P> 925 */ 926 public static final String DATA = "data2"; 927 928 /** 929 * The user defined label for the the contact method. 930 * <P>Type: TEXT</P> 931 */ 932 public static final String LABEL = "data3"; 933 } 934 935 /** 936 * Parts of the name. 937 */ 938 public static final class StructuredName implements BaseCommonColumns { 939 private StructuredName() {} 940 941 /** MIME type used when storing this in data table. */ 942 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name"; 943 944 /** 945 * The given name for the contact. 946 * <P>Type: TEXT</P> 947 */ 948 public static final String GIVEN_NAME = "data1"; 949 950 /** 951 * The family name for the contact. 952 * <P>Type: TEXT</P> 953 */ 954 public static final String FAMILY_NAME = "data2"; 955 956 /** 957 * The contact's honorific prefix, e.g. "Sir" 958 * <P>Type: TEXT</P> 959 */ 960 public static final String PREFIX = "data3"; 961 962 /** 963 * The contact's middle name 964 * <P>Type: TEXT</P> 965 */ 966 public static final String MIDDLE_NAME = "data4"; 967 968 /** 969 * The contact's honorific suffix, e.g. "Jr" 970 */ 971 public static final String SUFFIX = "data5"; 972 973 /** 974 * The phonetic version of the given name for the contact. 975 * <P>Type: TEXT</P> 976 */ 977 public static final String PHONETIC_GIVEN_NAME = "data6"; 978 979 /** 980 * The phonetic version of the additional name for the contact. 981 * <P>Type: TEXT</P> 982 */ 983 public static final String PHONETIC_MIDDLE_NAME = "data7"; 984 985 /** 986 * The phonetic version of the family name for the contact. 987 * <P>Type: TEXT</P> 988 */ 989 public static final String PHONETIC_FAMILY_NAME = "data8"; 990 991 /** 992 * The name that should be used to display the contact. 993 * <i>Unstructured component of the name should be consistent with 994 * its structured representation.</i> 995 * <p> 996 * Type: TEXT 997 */ 998 public static final String DISPLAY_NAME = "data9"; 999 } 1000 1001 /** 1002 * A nickname. 1003 */ 1004 public static final class Nickname implements CommonColumns, BaseCommonColumns { 1005 private Nickname() {} 1006 1007 /** MIME type used when storing this in data table. */ 1008 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname"; 1009 1010 public static final int TYPE_DEFAULT = 1; 1011 public static final int TYPE_OTHER_NAME = 2; 1012 public static final int TYPE_MAINDEN_NAME = 3; 1013 public static final int TYPE_SHORT_NAME = 4; 1014 public static final int TYPE_INITIALS = 5; 1015 1016 /** 1017 * The name itself 1018 */ 1019 public static final String NAME = DATA; 1020 } 1021 1022 /** 1023 * Common data definition for telephone numbers. 1024 */ 1025 public static final class Phone implements BaseCommonColumns, CommonColumns { 1026 private Phone() {} 1027 1028 /** MIME type used when storing this in data table. */ 1029 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2"; 1030 1031 /** 1032 * The MIME type of {@link #CONTENT_URI} providing a directory of 1033 * phones. 1034 */ 1035 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2"; 1036 1037 /** 1038 * The content:// style URI for all data records of the 1039 * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the 1040 * associated raw contact and aggregate contact data. 1041 */ 1042 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, 1043 "phones"); 1044 1045 /** 1046 * The content:// style URI for filtering data records of the 1047 * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the 1048 * associated raw contact and aggregate contact data. The filter argument should 1049 * be passed as an additional path segment after this URI. 1050 */ 1051 public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI, 1052 "filter"); 1053 1054 public static final int TYPE_HOME = 1; 1055 public static final int TYPE_MOBILE = 2; 1056 public static final int TYPE_WORK = 3; 1057 public static final int TYPE_FAX_WORK = 4; 1058 public static final int TYPE_FAX_HOME = 5; 1059 public static final int TYPE_PAGER = 6; 1060 public static final int TYPE_OTHER = 7; 1061 public static final int TYPE_CALLBACK = 8; 1062 public static final int TYPE_CAR = 9; 1063 public static final int TYPE_COMPANY_MAIN = 10; 1064 public static final int TYPE_ISDN = 11; 1065 public static final int TYPE_MAIN = 12; 1066 public static final int TYPE_OTHER_FAX = 13; 1067 public static final int TYPE_RADIO = 14; 1068 public static final int TYPE_TELEX = 15; 1069 public static final int TYPE_TTY_TDD = 16; 1070 public static final int TYPE_WORK_MOBILE = 17; 1071 public static final int TYPE_WORK_PAGER = 18; 1072 public static final int TYPE_ASSISTANT = 19; 1073 1074 /** 1075 * The phone number as the user entered it. 1076 * <P>Type: TEXT</P> 1077 */ 1078 public static final String NUMBER = DATA; 1079 1080 public static final CharSequence getDisplayLabel(Context context, int type, 1081 CharSequence label, CharSequence[] labelArray) { 1082 CharSequence display = ""; 1083 1084 if (type != Phone.TYPE_CUSTOM) { 1085 CharSequence[] labels = labelArray != null? labelArray 1086 : context.getResources().getTextArray( 1087 com.android.internal.R.array.phoneTypes); 1088 try { 1089 display = labels[type - 1]; 1090 } catch (ArrayIndexOutOfBoundsException e) { 1091 display = labels[Phone.TYPE_CUSTOM]; 1092 } 1093 } else { 1094 if (!TextUtils.isEmpty(label)) { 1095 display = label; 1096 } 1097 } 1098 return display; 1099 } 1100 1101 public static final CharSequence getDisplayLabel(Context context, int type, 1102 CharSequence label) { 1103 return getDisplayLabel(context, type, label, null); 1104 } 1105 } 1106 1107 /** 1108 * Common data definition for email addresses. 1109 */ 1110 public static final class Email implements BaseCommonColumns, CommonColumns { 1111 private Email() {} 1112 1113 /** MIME type used when storing this in data table. */ 1114 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email_v2"; 1115 1116 /** 1117 * The content:// style URI for all data records of the 1118 * {@link Email#CONTENT_ITEM_TYPE} MIME type, combined with the 1119 * associated raw contact and aggregate contact data. 1120 */ 1121 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, 1122 "emails"); 1123 1124 /** 1125 * The content:// style URL for filtering data rows by email address. The 1126 * filter argument should be passed as an additional path segment after 1127 * this URI. 1128 */ 1129 public static final Uri CONTENT_FILTER_EMAIL_URI = Uri.withAppendedPath(CONTENT_URI, 1130 "filter"); 1131 1132 public static final int TYPE_HOME = 1; 1133 public static final int TYPE_WORK = 2; 1134 public static final int TYPE_OTHER = 3; 1135 public static final int TYPE_MOBILE = 4; 1136 1137 /** 1138 * The display name for the email address 1139 * <P>Type: TEXT</P> 1140 */ 1141 public static final String DISPLAY_NAME = "data4"; 1142 } 1143 1144 /** 1145 * Common data definition for postal addresses. 1146 */ 1147 public static final class StructuredPostal implements BaseCommonColumns, CommonColumns { 1148 private StructuredPostal() { 1149 } 1150 1151 /** MIME type used when storing this in data table. */ 1152 public static final String CONTENT_ITEM_TYPE = 1153 "vnd.android.cursor.item/postal-address_v2"; 1154 1155 /** 1156 * The MIME type of {@link #CONTENT_URI} providing a directory of 1157 * postal addresses. 1158 */ 1159 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address_v2"; 1160 1161 /** 1162 * The content:// style URI for all data records of the 1163 * {@link StructuredPostal#CONTENT_ITEM_TYPE} MIME type. 1164 */ 1165 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, 1166 "postals"); 1167 1168 public static final int TYPE_HOME = 1; 1169 public static final int TYPE_WORK = 2; 1170 public static final int TYPE_OTHER = 3; 1171 1172 /** 1173 * The full, unstructured postal address. <i>This field must be 1174 * consistent with any structured data.</i> 1175 * <p> 1176 * Type: TEXT 1177 */ 1178 public static final String FORMATTED_ADDRESS = DATA; 1179 1180 /** 1181 * The agent who actually receives the mail. Used in work addresses. 1182 * Also for 'in care of' or 'c/o'. 1183 * <p> 1184 * Type: TEXT 1185 * @deprecated since this isn't supported by gd:structuredPostalAddress 1186 */ 1187 @Deprecated 1188 public static final String AGENT = "data4"; 1189 1190 /** 1191 * Used in places where houses or buildings have names (and not 1192 * necessarily numbers), eg. "The Pillars". 1193 * <p> 1194 * Type: TEXT 1195 * @deprecated since this isn't supported by gd:structuredPostalAddress 1196 */ 1197 @Deprecated 1198 public static final String HOUSENAME = "data5"; 1199 1200 /** 1201 * Can be street, avenue, road, etc. This element also includes the 1202 * house number and room/apartment/flat/floor number. 1203 * <p> 1204 * Type: TEXT 1205 */ 1206 public static final String STREET = "data6"; 1207 1208 /** 1209 * Covers actual P.O. boxes, drawers, locked bags, etc. This is 1210 * usually but not always mutually exclusive with street. 1211 * <p> 1212 * Type: TEXT 1213 */ 1214 public static final String POBOX = "data7"; 1215 1216 /** 1217 * This is used to disambiguate a street address when a city 1218 * contains more than one street with the same name, or to specify a 1219 * small place whose mail is routed through a larger postal town. In 1220 * China it could be a county or a minor city. 1221 * <p> 1222 * Type: TEXT 1223 */ 1224 public static final String NEIGHBORHOOD = "data8"; 1225 1226 /** 1227 * Can be city, village, town, borough, etc. This is the postal town 1228 * and not necessarily the place of residence or place of business. 1229 * <p> 1230 * Type: TEXT 1231 */ 1232 public static final String CITY = "data9"; 1233 1234 /** 1235 * Handles administrative districts such as U.S. or U.K. counties 1236 * that are not used for mail addressing purposes. Subregion is not 1237 * intended for delivery addresses. 1238 * <p> 1239 * Type: TEXT 1240 * @deprecated since this isn't supported by gd:structuredPostalAddress 1241 */ 1242 @Deprecated 1243 public static final String SUBREGION = "data10"; 1244 1245 /** 1246 * A state, province, county (in Ireland), Land (in Germany), 1247 * departement (in France), etc. 1248 * <p> 1249 * Type: TEXT 1250 */ 1251 public static final String REGION = "data11"; 1252 1253 /** 1254 * Postal code. Usually country-wide, but sometimes specific to the 1255 * city (e.g. "2" in "Dublin 2, Ireland" addresses). 1256 * <p> 1257 * Type: TEXT 1258 */ 1259 public static final String POSTCODE = "data12"; 1260 1261 /** 1262 * The name or code of the country. 1263 * <p> 1264 * Type: TEXT 1265 */ 1266 public static final String COUNTRY = "data13"; 1267 } 1268 1269 /** 1270 * Common data definition for IM addresses. 1271 */ 1272 public static final class Im implements BaseCommonColumns, CommonColumns { 1273 private Im() {} 1274 1275 /** MIME type used when storing this in data table. */ 1276 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im"; 1277 1278 public static final int TYPE_HOME = 1; 1279 public static final int TYPE_WORK = 2; 1280 public static final int TYPE_OTHER = 3; 1281 1282 /** 1283 * This column should be populated with one of the defined 1284 * constants, e.g. {@link #PROTOCOL_YAHOO}. If the value of this 1285 * column is {@link #PROTOCOL_CUSTOM}, the {@link #CUSTOM_PROTOCOL} 1286 * should contain the name of the custom protocol. 1287 */ 1288 public static final String PROTOCOL = "data5"; 1289 1290 public static final String CUSTOM_PROTOCOL = "data6"; 1291 1292 /* 1293 * The predefined IM protocol types. 1294 */ 1295 public static final int PROTOCOL_CUSTOM = -1; 1296 public static final int PROTOCOL_AIM = 0; 1297 public static final int PROTOCOL_MSN = 1; 1298 public static final int PROTOCOL_YAHOO = 2; 1299 public static final int PROTOCOL_SKYPE = 3; 1300 public static final int PROTOCOL_QQ = 4; 1301 public static final int PROTOCOL_GOOGLE_TALK = 5; 1302 public static final int PROTOCOL_ICQ = 6; 1303 public static final int PROTOCOL_JABBER = 7; 1304 public static final int PROTOCOL_NETMEETING = 8; 1305 } 1306 1307 /** 1308 * Common data definition for organizations. 1309 */ 1310 public static final class Organization implements BaseCommonColumns, CommonColumns { 1311 private Organization() {} 1312 1313 /** MIME type used when storing this in data table. */ 1314 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization"; 1315 1316 public static final int TYPE_WORK = 1; 1317 public static final int TYPE_OTHER = 2; 1318 1319 /** 1320 * The company as the user entered it. 1321 * <P>Type: TEXT</P> 1322 */ 1323 public static final String COMPANY = DATA; 1324 1325 /** 1326 * The position title at this company as the user entered it. 1327 * <P>Type: TEXT</P> 1328 */ 1329 public static final String TITLE = "data4"; 1330 1331 /** 1332 * The department at this company as the user entered it. 1333 * <P>Type: TEXT</P> 1334 */ 1335 public static final String DEPARTMENT = "data5"; 1336 1337 /** 1338 * The job description at this company as the user entered it. 1339 * <P>Type: TEXT</P> 1340 */ 1341 public static final String JOB_DESCRIPTION = "data6"; 1342 1343 /** 1344 * The symbol of this company as the user entered it. 1345 * <P>Type: TEXT</P> 1346 */ 1347 public static final String SYMBOL = "data7"; 1348 1349 /** 1350 * The phonetic name of this company as the user entered it. 1351 * <P>Type: TEXT</P> 1352 */ 1353 public static final String PHONETIC_NAME = "data8"; 1354 } 1355 1356 /** 1357 * Common data definition for miscellaneous information. 1358 */ 1359 public static final class Miscellaneous implements BaseCommonColumns { 1360 private Miscellaneous() {} 1361 1362 /** MIME type used when storing this in data table. */ 1363 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/misc"; 1364 1365 /** 1366 * The birthday as the user entered it. 1367 * <P>Type: TEXT</P> 1368 */ 1369 public static final String BIRTHDAY = "data1"; 1370 1371 /** 1372 * The nickname as the user entered it. 1373 * <P>Type: TEXT</P> 1374 */ 1375 public static final String NICKNAME = "data2"; 1376 } 1377 1378 /** 1379 * Common data definition for relations. 1380 */ 1381 public static final class Relation implements BaseCommonColumns, CommonColumns { 1382 private Relation() {} 1383 1384 /** MIME type used when storing this in data table. */ 1385 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/relation"; 1386 1387 public static final int TYPE_ASSISTANT = 1; 1388 public static final int TYPE_BROTHER = 2; 1389 public static final int TYPE_CHILD = 3; 1390 public static final int TYPE_DOMESTIC_PARTNER = 4; 1391 public static final int TYPE_FATHER = 5; 1392 public static final int TYPE_FRIEND = 6; 1393 public static final int TYPE_MANAGER = 7; 1394 public static final int TYPE_MOTHER = 8; 1395 public static final int TYPE_PARENT = 9; 1396 public static final int TYPE_PARTNER = 10; 1397 public static final int TYPE_REFERRED_BY = 11; 1398 public static final int TYPE_RELATIVE = 12; 1399 public static final int TYPE_SISTER = 13; 1400 public static final int TYPE_SPOUSE = 14; 1401 1402 /** 1403 * The name of the relative as the user entered it. 1404 * <P>Type: TEXT</P> 1405 */ 1406 public static final String NAME = DATA; 1407 } 1408 1409 /** 1410 * Common data definition for events. 1411 */ 1412 public static final class Event implements BaseCommonColumns, CommonColumns { 1413 private Event() {} 1414 1415 /** MIME type used when storing this in data table. */ 1416 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/event"; 1417 1418 public static final int TYPE_ANNIVERSARY = 1; 1419 public static final int TYPE_OTHER = 2; 1420 1421 /** 1422 * The event start date as the user entered it. 1423 * <P>Type: TEXT</P> 1424 */ 1425 public static final String START_DATE = DATA; 1426 } 1427 1428 /** 1429 * Photo of the contact. 1430 */ 1431 public static final class Photo implements BaseCommonColumns { 1432 private Photo() {} 1433 1434 /** MIME type used when storing this in data table. */ 1435 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo"; 1436 1437 /** 1438 * Thumbnail photo of the raw contact. This is the raw bytes of an image 1439 * that could be inflated using {@link BitmapFactory}. 1440 * <p> 1441 * Type: BLOB 1442 */ 1443 public static final String PHOTO = "data1"; 1444 } 1445 1446 /** 1447 * Notes about the contact. 1448 */ 1449 public static final class Note implements BaseCommonColumns { 1450 private Note() {} 1451 1452 /** MIME type used when storing this in data table. */ 1453 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note"; 1454 1455 /** 1456 * The note text. 1457 * <P>Type: TEXT</P> 1458 */ 1459 public static final String NOTE = "data1"; 1460 } 1461 1462 /** 1463 * Group Membership. 1464 */ 1465 public static final class GroupMembership implements BaseCommonColumns { 1466 private GroupMembership() {} 1467 1468 /** MIME type used when storing this in data table. */ 1469 public static final String CONTENT_ITEM_TYPE = 1470 "vnd.android.cursor.item/group_membership"; 1471 1472 /** 1473 * The row id of the group that this group membership refers to. Exactly one of 1474 * this or {@link #GROUP_SOURCE_ID} must be set when inserting a row. 1475 * <P>Type: INTEGER</P> 1476 */ 1477 public static final String GROUP_ROW_ID = "data1"; 1478 1479 /** 1480 * The sourceid of the group that this group membership refers to. Exactly one of 1481 * this or {@link #GROUP_ROW_ID} must be set when inserting a row. 1482 * <P>Type: TEXT</P> 1483 */ 1484 public static final String GROUP_SOURCE_ID = "group_sourceid"; 1485 } 1486 1487 /** 1488 * Website related to the contact. 1489 */ 1490 public static final class Website implements BaseCommonColumns, CommonColumns { 1491 private Website() {} 1492 1493 /** MIME type used when storing this in data table. */ 1494 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website"; 1495 1496 public static final int TYPE_HOMEPAGE = 1; 1497 public static final int TYPE_BLOG = 2; 1498 public static final int TYPE_PROFILE = 3; 1499 public static final int TYPE_HOME = 4; 1500 public static final int TYPE_WORK = 5; 1501 public static final int TYPE_FTP = 6; 1502 public static final int TYPE_OTHER = 7; 1503 1504 /** 1505 * The website URL string. 1506 * <P>Type: TEXT</P> 1507 */ 1508 public static final String URL = "data1"; 1509 } 1510 } 1511 1512 // TODO: make this private before unhiding 1513 public interface GroupsColumns { 1514 /** 1515 * The display title of this group. 1516 * <p> 1517 * Type: TEXT 1518 */ 1519 public static final String TITLE = "title"; 1520 1521 /** 1522 * The package name to use when creating {@link Resources} objects for 1523 * this group. This value is only designed for use when building user 1524 * interfaces, and should not be used to infer the owner. 1525 */ 1526 public static final String RES_PACKAGE = "res_package"; 1527 1528 /** 1529 * The display title of this group to load as a resource from 1530 * {@link #RES_PACKAGE}, which may be localized. 1531 * <P>Type: TEXT</P> 1532 */ 1533 public static final String TITLE_RES = "title_res"; 1534 1535 /** 1536 * Notes about the group. 1537 * <p> 1538 * Type: TEXT 1539 */ 1540 public static final String NOTES = "notes"; 1541 1542 /** 1543 * The ID of this group if it is a System Group, i.e. a group that has a special meaning 1544 * to the sync adapter, null otherwise. 1545 * <P>Type: TEXT</P> 1546 */ 1547 public static final String SYSTEM_ID = "system_id"; 1548 1549 /** 1550 * The total number of {@link Contacts} that have 1551 * {@link CommonDataKinds.GroupMembership} in this group. Read-only value that is only 1552 * present when querying {@link Groups#CONTENT_SUMMARY_URI}. 1553 * <p> 1554 * Type: INTEGER 1555 */ 1556 public static final String SUMMARY_COUNT = "summ_count"; 1557 1558 /** 1559 * The total number of {@link Contacts} that have both 1560 * {@link CommonDataKinds.GroupMembership} in this group, and also have phone numbers. 1561 * Read-only value that is only present when querying 1562 * {@link Groups#CONTENT_SUMMARY_URI}. 1563 * <p> 1564 * Type: INTEGER 1565 */ 1566 public static final String SUMMARY_WITH_PHONES = "summ_phones"; 1567 1568 /** 1569 * Flag indicating if the contacts belonging to this group should be 1570 * visible in any user interface. 1571 * <p> 1572 * Type: INTEGER (boolean) 1573 */ 1574 public static final String GROUP_VISIBLE = "group_visible"; 1575 1576 /** 1577 * The "deleted" flag: "0" by default, "1" if the row has been marked 1578 * for deletion. When {@link android.content.ContentResolver#delete} is 1579 * called on a raw contact, it is marked for deletion and removed from its 1580 * aggregate contact. The sync adaptor deletes the raw contact on the server and 1581 * then calls ContactResolver.delete once more, this time passing the 1582 * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal. 1583 * <P>Type: INTEGER</P> 1584 */ 1585 public static final String DELETED = "deleted"; 1586 1587 /** 1588 * Whether this group should be synced if the SYNC_EVERYTHING settings 1589 * is false for this group's account. 1590 * <p> 1591 * Type: INTEGER (boolean) 1592 */ 1593 public static final String SHOULD_SYNC = "should_sync"; 1594 } 1595 1596 /** 1597 * Constants for the groups table. 1598 */ 1599 public static final class Groups implements BaseColumns, GroupsColumns, SyncColumns { 1600 /** 1601 * This utility class cannot be instantiated 1602 */ 1603 private Groups() { 1604 } 1605 1606 /** 1607 * The content:// style URI for this table 1608 */ 1609 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "groups"); 1610 1611 /** 1612 * The content:// style URI for this table joined with details data from 1613 * {@link Data}. 1614 */ 1615 public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI, 1616 "groups_summary"); 1617 1618 /** 1619 * The MIME type of a directory of groups. 1620 */ 1621 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/group"; 1622 1623 /** 1624 * The MIME type of a single group. 1625 */ 1626 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group"; 1627 1628 /** 1629 * Query parameter that can be passed with the {@link #CONTENT_URI} URI 1630 * to the {@link android.content.ContentResolver#delete} method to 1631 * indicate that the raw contact can be deleted physically, rather than 1632 * merely marked as deleted. 1633 */ 1634 public static final String DELETE_PERMANENTLY = "delete_permanently"; 1635 1636 /** 1637 * An optional update or insert URI parameter that determines if the 1638 * group should be marked as dirty. The default value is true. 1639 */ 1640 public static final String MARK_AS_DIRTY = "mark_as_dirty"; 1641 } 1642 1643 /** 1644 * Constants for the contact aggregation exceptions table, which contains 1645 * aggregation rules overriding those used by automatic aggregation. This type only 1646 * supports query and update. Neither insert nor delete are supported. 1647 */ 1648 public static final class AggregationExceptions implements BaseColumns { 1649 /** 1650 * This utility class cannot be instantiated 1651 */ 1652 private AggregationExceptions() {} 1653 1654 /** 1655 * The content:// style URI for this table 1656 */ 1657 public static final Uri CONTENT_URI = 1658 Uri.withAppendedPath(AUTHORITY_URI, "aggregation_exceptions"); 1659 1660 /** 1661 * The MIME type of {@link #CONTENT_URI} providing a directory of data. 1662 */ 1663 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception"; 1664 1665 /** 1666 * The MIME type of a {@link #CONTENT_URI} subdirectory of an aggregation exception 1667 */ 1668 public static final String CONTENT_ITEM_TYPE = 1669 "vnd.android.cursor.item/aggregation_exception"; 1670 1671 /** 1672 * The type of exception: {@link #TYPE_KEEP_IN}, {@link #TYPE_KEEP_OUT} or 1673 * {@link #TYPE_AUTOMATIC}. 1674 * 1675 * <P>Type: INTEGER</P> 1676 */ 1677 public static final String TYPE = "type"; 1678 1679 /** 1680 * Allows the provider to automatically decide whether the aggregate 1681 * contact should include a particular raw contact or not. 1682 */ 1683 public static final int TYPE_AUTOMATIC = 0; 1684 1685 /** 1686 * Makes sure that the specified raw contact is included in the 1687 * specified aggregate contact. 1688 */ 1689 public static final int TYPE_KEEP_IN = 1; 1690 1691 /** 1692 * Makes sure that the specified raw contact is NOT included in the 1693 * specified aggregate contact. 1694 */ 1695 public static final int TYPE_KEEP_OUT = 2; 1696 1697 /** 1698 * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} of the 1699 * aggregate contact that the rule applies to. 1700 */ 1701 public static final String CONTACT_ID = "contact_id"; 1702 1703 /** 1704 * A reference to the {@link RawContacts#_ID} of the raw contact that the rule applies to. 1705 */ 1706 public static final String RAW_CONTACT_ID = "raw_contact_id"; 1707 } 1708 1709 private interface SettingsColumns { 1710 /** 1711 * The name of the account instance to which this row belongs. 1712 * <P>Type: TEXT</P> 1713 */ 1714 public static final String ACCOUNT_NAME = "account_name"; 1715 1716 /** 1717 * The type of account to which this row belongs, which when paired with 1718 * {@link #ACCOUNT_NAME} identifies a specific account. 1719 * <P>Type: TEXT</P> 1720 */ 1721 public static final String ACCOUNT_TYPE = "account_type"; 1722 1723 /** 1724 * Depending on the mode defined by the sync-adapter, this flag controls 1725 * the top-level sync behavior for this data source. 1726 * <p> 1727 * Type: INTEGER (boolean) 1728 */ 1729 public static final String SHOULD_SYNC = "should_sync"; 1730 1731 /** 1732 * Flag indicating if contacts without any {@link CommonDataKinds.GroupMembership} 1733 * entries should be visible in any user interface. 1734 * <p> 1735 * Type: INTEGER (boolean) 1736 */ 1737 public static final String UNGROUPED_VISIBLE = "ungrouped_visible"; 1738 1739 /** 1740 * Read-only count of {@link Contacts} from a specific source that have 1741 * no {@link CommonDataKinds.GroupMembership} entries. 1742 * <p> 1743 * Type: INTEGER 1744 */ 1745 public static final String UNGROUPED_COUNT = "summ_count"; 1746 1747 /** 1748 * Read-only count of {@link Contacts} from a specific source that have 1749 * no {@link CommonDataKinds.GroupMembership} entries, and also have phone numbers. 1750 * <p> 1751 * Type: INTEGER 1752 */ 1753 public static final String UNGROUPED_WITH_PHONES = "summ_phones"; 1754 } 1755 1756 /** 1757 * Contacts-specific settings for various {@link Account}. 1758 */ 1759 public static final class Settings implements SettingsColumns { 1760 /** 1761 * This utility class cannot be instantiated 1762 */ 1763 private Settings() { 1764 } 1765 1766 /** 1767 * The content:// style URI for this table 1768 */ 1769 public static final Uri CONTENT_URI = 1770 Uri.withAppendedPath(AUTHORITY_URI, "settings"); 1771 1772 /** 1773 * The MIME-type of {@link #CONTENT_URI} providing a directory of 1774 * settings. 1775 */ 1776 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/setting"; 1777 1778 /** 1779 * The MIME-type of {@link #CONTENT_URI} providing a single setting. 1780 */ 1781 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/setting"; 1782 } 1783 1784 /** 1785 * Contains helper classes used to create or manage {@link android.content.Intent Intents} 1786 * that involve contacts. 1787 */ 1788 public static final class Intents { 1789 /** 1790 * This is the intent that is fired when a search suggestion is clicked on. 1791 */ 1792 public static final String SEARCH_SUGGESTION_CLICKED = 1793 "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED"; 1794 1795 /** 1796 * This is the intent that is fired when a search suggestion for dialing a number 1797 * is clicked on. 1798 */ 1799 public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = 1800 "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED"; 1801 1802 /** 1803 * This is the intent that is fired when a search suggestion for creating a contact 1804 * is clicked on. 1805 */ 1806 public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = 1807 "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED"; 1808 1809 /** 1810 * Starts an Activity that lets the user pick a contact to attach an image to. 1811 * After picking the contact it launches the image cropper in face detection mode. 1812 */ 1813 public static final String ATTACH_IMAGE = 1814 "com.android.contacts.action.ATTACH_IMAGE"; 1815 1816 /** 1817 * Takes as input a data URI with a mailto: or tel: scheme. If a single 1818 * contact exists with the given data it will be shown. If no contact 1819 * exists, a dialog will ask the user if they want to create a new 1820 * contact with the provided details filled in. If multiple contacts 1821 * share the data the user will be prompted to pick which contact they 1822 * want to view. 1823 * <p> 1824 * For <code>mailto:</code> URIs, the scheme specific portion must be a 1825 * raw email address, such as one built using 1826 * {@link Uri#fromParts(String, String, String)}. 1827 * <p> 1828 * For <code>tel:</code> URIs, the scheme specific portion is compared 1829 * to existing numbers using the standard caller ID lookup algorithm. 1830 * The number must be properly encoded, for example using 1831 * {@link Uri#fromParts(String, String, String)}. 1832 * <p> 1833 * Any extras from the {@link Insert} class will be passed along to the 1834 * create activity if there are no contacts to show. 1835 * <p> 1836 * Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip 1837 * prompting the user when the contact doesn't exist. 1838 */ 1839 public static final String SHOW_OR_CREATE_CONTACT = 1840 "com.android.contacts.action.SHOW_OR_CREATE_CONTACT"; 1841 1842 /** 1843 * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new 1844 * contact if no matching contact found. Otherwise, default behavior is 1845 * to prompt user with dialog before creating. 1846 * <p> 1847 * Type: BOOLEAN 1848 */ 1849 public static final String EXTRA_FORCE_CREATE = 1850 "com.android.contacts.action.FORCE_CREATE"; 1851 1852 /** 1853 * Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact 1854 * description to be shown when prompting user about creating a new 1855 * contact. 1856 * <p> 1857 * Type: STRING 1858 */ 1859 public static final String EXTRA_CREATE_DESCRIPTION = 1860 "com.android.contacts.action.CREATE_DESCRIPTION"; 1861 1862 /** 1863 * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a 1864 * dialog location using screen coordinates. When not specified, the 1865 * dialog will be centered. 1866 */ 1867 public static final String EXTRA_TARGET_RECT = "target_rect"; 1868 1869 /** 1870 * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a 1871 * desired dialog style, usually a variation on size. One of 1872 * {@link #MODE_SMALL}, {@link #MODE_MEDIUM}, or {@link #MODE_LARGE}. 1873 */ 1874 public static final String EXTRA_MODE = "mode"; 1875 1876 /** 1877 * Value for {@link #EXTRA_MODE} to show a small-sized dialog. 1878 */ 1879 public static final int MODE_SMALL = 1; 1880 1881 /** 1882 * Value for {@link #EXTRA_MODE} to show a medium-sized dialog. 1883 */ 1884 public static final int MODE_MEDIUM = 2; 1885 1886 /** 1887 * Value for {@link #EXTRA_MODE} to show a large-sized dialog. 1888 */ 1889 public static final int MODE_LARGE = 3; 1890 1891 /** 1892 * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to indicate 1893 * a list of specific MIME-types to exclude and not display. Stored as a 1894 * {@link String} array. 1895 */ 1896 public static final String EXTRA_EXCLUDE_MIMES = "exclude_mimes"; 1897 1898 /** 1899 * Intents related to the Contacts app UI. 1900 */ 1901 public static final class UI { 1902 /** 1903 * The action for the default contacts list tab. 1904 */ 1905 public static final String LIST_DEFAULT = 1906 "com.android.contacts.action.LIST_DEFAULT"; 1907 1908 /** 1909 * The action for the contacts list tab. 1910 */ 1911 public static final String LIST_GROUP_ACTION = 1912 "com.android.contacts.action.LIST_GROUP"; 1913 1914 /** 1915 * When in LIST_GROUP_ACTION mode, this is the group to display. 1916 */ 1917 public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP"; 1918 1919 /** 1920 * The action for the all contacts list tab. 1921 */ 1922 public static final String LIST_ALL_CONTACTS_ACTION = 1923 "com.android.contacts.action.LIST_ALL_CONTACTS"; 1924 1925 /** 1926 * The action for the contacts with phone numbers list tab. 1927 */ 1928 public static final String LIST_CONTACTS_WITH_PHONES_ACTION = 1929 "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES"; 1930 1931 /** 1932 * The action for the starred contacts list tab. 1933 */ 1934 public static final String LIST_STARRED_ACTION = 1935 "com.android.contacts.action.LIST_STARRED"; 1936 1937 /** 1938 * The action for the frequent contacts list tab. 1939 */ 1940 public static final String LIST_FREQUENT_ACTION = 1941 "com.android.contacts.action.LIST_FREQUENT"; 1942 1943 /** 1944 * The action for the "strequent" contacts list tab. It first lists the starred 1945 * contacts in alphabetical order and then the frequent contacts in descending 1946 * order of the number of times they have been contacted. 1947 */ 1948 public static final String LIST_STREQUENT_ACTION = 1949 "com.android.contacts.action.LIST_STREQUENT"; 1950 1951 /** 1952 * A key for to be used as an intent extra to set the activity 1953 * title to a custom String value. 1954 */ 1955 public static final String TITLE_EXTRA_KEY = 1956 "com.android.contacts.extra.TITLE_EXTRA"; 1957 1958 /** 1959 * Activity Action: Display a filtered list of contacts 1960 * <p> 1961 * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for 1962 * filtering 1963 * <p> 1964 * Output: Nothing. 1965 */ 1966 public static final String FILTER_CONTACTS_ACTION = 1967 "com.android.contacts.action.FILTER_CONTACTS"; 1968 1969 /** 1970 * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION} 1971 * intents to supply the text on which to filter. 1972 */ 1973 public static final String FILTER_TEXT_EXTRA_KEY = 1974 "com.android.contacts.extra.FILTER_TEXT"; 1975 } 1976 1977 /** 1978 * Convenience class that contains string constants used 1979 * to create contact {@link android.content.Intent Intents}. 1980 */ 1981 public static final class Insert { 1982 /** The action code to use when adding a contact */ 1983 public static final String ACTION = Intent.ACTION_INSERT; 1984 1985 /** 1986 * If present, forces a bypass of quick insert mode. 1987 */ 1988 public static final String FULL_MODE = "full_mode"; 1989 1990 /** 1991 * The extra field for the contact name. 1992 * <P>Type: String</P> 1993 */ 1994 public static final String NAME = "name"; 1995 1996 // TODO add structured name values here. 1997 1998 /** 1999 * The extra field for the contact phonetic name. 2000 * <P>Type: String</P> 2001 */ 2002 public static final String PHONETIC_NAME = "phonetic_name"; 2003 2004 /** 2005 * The extra field for the contact company. 2006 * <P>Type: String</P> 2007 */ 2008 public static final String COMPANY = "company"; 2009 2010 /** 2011 * The extra field for the contact job title. 2012 * <P>Type: String</P> 2013 */ 2014 public static final String JOB_TITLE = "job_title"; 2015 2016 /** 2017 * The extra field for the contact notes. 2018 * <P>Type: String</P> 2019 */ 2020 public static final String NOTES = "notes"; 2021 2022 /** 2023 * The extra field for the contact phone number. 2024 * <P>Type: String</P> 2025 */ 2026 public static final String PHONE = "phone"; 2027 2028 /** 2029 * The extra field for the contact phone number type. 2030 * <P>Type: Either an integer value from 2031 * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, 2032 * or a string specifying a custom label.</P> 2033 */ 2034 public static final String PHONE_TYPE = "phone_type"; 2035 2036 /** 2037 * The extra field for the phone isprimary flag. 2038 * <P>Type: boolean</P> 2039 */ 2040 public static final String PHONE_ISPRIMARY = "phone_isprimary"; 2041 2042 /** 2043 * The extra field for an optional second contact phone number. 2044 * <P>Type: String</P> 2045 */ 2046 public static final String SECONDARY_PHONE = "secondary_phone"; 2047 2048 /** 2049 * The extra field for an optional second contact phone number type. 2050 * <P>Type: Either an integer value from 2051 * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, 2052 * or a string specifying a custom label.</P> 2053 */ 2054 public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type"; 2055 2056 /** 2057 * The extra field for an optional third contact phone number. 2058 * <P>Type: String</P> 2059 */ 2060 public static final String TERTIARY_PHONE = "tertiary_phone"; 2061 2062 /** 2063 * The extra field for an optional third contact phone number type. 2064 * <P>Type: Either an integer value from 2065 * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, 2066 * or a string specifying a custom label.</P> 2067 */ 2068 public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type"; 2069 2070 /** 2071 * The extra field for the contact email address. 2072 * <P>Type: String</P> 2073 */ 2074 public static final String EMAIL = "email"; 2075 2076 /** 2077 * The extra field for the contact email type. 2078 * <P>Type: Either an integer value from 2079 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 2080 * or a string specifying a custom label.</P> 2081 */ 2082 public static final String EMAIL_TYPE = "email_type"; 2083 2084 /** 2085 * The extra field for the email isprimary flag. 2086 * <P>Type: boolean</P> 2087 */ 2088 public static final String EMAIL_ISPRIMARY = "email_isprimary"; 2089 2090 /** 2091 * The extra field for an optional second contact email address. 2092 * <P>Type: String</P> 2093 */ 2094 public static final String SECONDARY_EMAIL = "secondary_email"; 2095 2096 /** 2097 * The extra field for an optional second contact email type. 2098 * <P>Type: Either an integer value from 2099 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 2100 * or a string specifying a custom label.</P> 2101 */ 2102 public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type"; 2103 2104 /** 2105 * The extra field for an optional third contact email address. 2106 * <P>Type: String</P> 2107 */ 2108 public static final String TERTIARY_EMAIL = "tertiary_email"; 2109 2110 /** 2111 * The extra field for an optional third contact email type. 2112 * <P>Type: Either an integer value from 2113 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 2114 * or a string specifying a custom label.</P> 2115 */ 2116 public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type"; 2117 2118 /** 2119 * The extra field for the contact postal address. 2120 * <P>Type: String</P> 2121 */ 2122 public static final String POSTAL = "postal"; 2123 2124 /** 2125 * The extra field for the contact postal address type. 2126 * <P>Type: Either an integer value from 2127 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 2128 * or a string specifying a custom label.</P> 2129 */ 2130 public static final String POSTAL_TYPE = "postal_type"; 2131 2132 /** 2133 * The extra field for the postal isprimary flag. 2134 * <P>Type: boolean</P> 2135 */ 2136 public static final String POSTAL_ISPRIMARY = "postal_isprimary"; 2137 2138 /** 2139 * The extra field for an IM handle. 2140 * <P>Type: String</P> 2141 */ 2142 public static final String IM_HANDLE = "im_handle"; 2143 2144 /** 2145 * The extra field for the IM protocol 2146 * <P>Type: the result of {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)} 2147 * or {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.</P> 2148 */ 2149 public static final String IM_PROTOCOL = "im_protocol"; 2150 2151 /** 2152 * The extra field for the IM isprimary flag. 2153 * <P>Type: boolean</P> 2154 */ 2155 public static final String IM_ISPRIMARY = "im_isprimary"; 2156 } 2157 } 2158 2159} 2160