ContactsContract.java revision 91e4e85752ee60ef4965e5974cc3f62e3d0651fd
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.content.Intent; 20import android.content.ContentProviderClient; 21import android.content.ContentProviderOperation; 22import android.content.res.Resources; 23import android.graphics.BitmapFactory; 24import android.net.Uri; 25import android.provider.ContactsContract.CommonDataKinds.GroupMembership; 26import android.accounts.Account; 27import android.os.RemoteException; 28 29/** 30 * The contract between the contacts provider and applications. Contains definitions 31 * for the supported URIs and columns. 32 * 33 * @hide 34 */ 35public final class ContactsContract { 36 /** The authority for the contacts provider */ 37 public static final String AUTHORITY = "com.android.contacts"; 38 /** A content:// style uri to the authority for the contacts provider */ 39 public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY); 40 41 public interface SyncStateColumns extends SyncStateContract.Columns { 42 } 43 44 public static final class SyncState { 45 /** 46 * This utility class cannot be instantiated 47 */ 48 private SyncState() {} 49 50 public static final String CONTENT_DIRECTORY = 51 SyncStateContract.Constants.CONTENT_DIRECTORY; 52 53 /** 54 * The content:// style URI for this table 55 */ 56 public static final Uri CONTENT_URI = 57 Uri.withAppendedPath(AUTHORITY_URI, CONTENT_DIRECTORY); 58 59 /** 60 * @see android.provider.SyncStateContract.Helpers#get 61 */ 62 public static byte[] get(ContentProviderClient provider, Account account) 63 throws RemoteException { 64 return SyncStateContract.Helpers.get(provider, CONTENT_URI, account); 65 } 66 67 /** 68 * @see android.provider.SyncStateContract.Helpers#set 69 */ 70 public static void set(ContentProviderClient provider, Account account, byte[] data) 71 throws RemoteException { 72 SyncStateContract.Helpers.set(provider, CONTENT_URI, account, data); 73 } 74 75 /** 76 * @see android.provider.SyncStateContract.Helpers#newSetOperation 77 */ 78 public static ContentProviderOperation newSetOperation(Account account, byte[] data) { 79 return SyncStateContract.Helpers.newSetOperation(CONTENT_URI, account, data); 80 } 81 } 82 83 /** 84 * Generic columns for use by sync adapters. The specific functions of 85 * these columns are private to the sync adapter. Other clients of the API 86 * should not attempt to either read or write this column. 87 */ 88 private interface BaseSyncColumns { 89 90 /** Generic column for use by sync adapters. */ 91 public static final String SYNC1 = "sync1"; 92 /** Generic column for use by sync adapters. */ 93 public static final String SYNC2 = "sync2"; 94 /** Generic column for use by sync adapters. */ 95 public static final String SYNC3 = "sync3"; 96 /** Generic column for use by sync adapters. */ 97 public static final String SYNC4 = "sync4"; 98 } 99 100 /** 101 * Columns that appear when each row of a table belongs to a specific 102 * account, including sync information that an account may need. 103 */ 104 private interface SyncColumns extends BaseSyncColumns { 105 /** 106 * The name of the account instance to which this row belongs. 107 * <P>Type: TEXT</P> 108 */ 109 public static final String ACCOUNT_NAME = "account_name"; 110 111 /** 112 * The type of account to which this row belongs, which when paired with 113 * {@link #ACCOUNT_NAME} identifies a specific account. 114 * <P>Type: TEXT</P> 115 */ 116 public static final String ACCOUNT_TYPE = "account_type"; 117 118 /** 119 * String that uniquely identifies this row to its source account. 120 * <P>Type: TEXT</P> 121 */ 122 public static final String SOURCE_ID = "sourceid"; 123 124 /** 125 * Version number that is updated whenever this row or its related data 126 * changes. 127 * <P>Type: INTEGER</P> 128 */ 129 public static final String VERSION = "version"; 130 131 /** 132 * Flag indicating that {@link #VERSION} has changed, and this row needs 133 * to be synchronized by its owning account. 134 * <P>Type: INTEGER (boolean)</P> 135 */ 136 public static final String DIRTY = "dirty"; 137 } 138 139 public interface ContactOptionsColumns { 140 /** 141 * The number of times a person has been contacted 142 * <P>Type: INTEGER</P> 143 */ 144 public static final String TIMES_CONTACTED = "times_contacted"; 145 146 /** 147 * The last time a person was contacted. 148 * <P>Type: INTEGER</P> 149 */ 150 public static final String LAST_TIME_CONTACTED = "last_time_contacted"; 151 152 /** 153 * Is the contact starred? 154 * <P>Type: INTEGER (boolean)</P> 155 */ 156 public static final String STARRED = "starred"; 157 158 /** 159 * A custom ringtone associated with a person. Not always present. 160 * <P>Type: TEXT (URI to the ringtone)</P> 161 */ 162 public static final String CUSTOM_RINGTONE = "custom_ringtone"; 163 164 /** 165 * Whether the person should always be sent to voicemail. Not always 166 * present. 167 * <P>Type: INTEGER (0 for false, 1 for true)</P> 168 */ 169 public static final String SEND_TO_VOICEMAIL = "send_to_voicemail"; 170 } 171 172 private interface ContactsColumns { 173 /** 174 * The display name for the contact. 175 * <P>Type: TEXT</P> 176 */ 177 public static final String DISPLAY_NAME = "display_name"; 178 179 /** 180 * Reference to the row in the data table holding the primary phone number. 181 * <P>Type: INTEGER REFERENCES data(_id)</P> 182 */ 183 public static final String PRIMARY_PHONE_ID = "primary_phone_id"; 184 185 /** 186 * Reference to the row in the data table holding the primary email address. 187 * <P>Type: INTEGER REFERENCES data(_id)</P> 188 */ 189 public static final String PRIMARY_EMAIL_ID = "primary_email_id"; 190 191 /** 192 * Reference to the row in the data table holding the photo. 193 * <P>Type: INTEGER REFERENCES data(_id)</P> 194 */ 195 public static final String PHOTO_ID = "photo_id"; 196 197 /** 198 * Lookup value that reflects the {@link Groups#GROUP_VISIBLE} state of 199 * any {@link GroupMembership} for this contact. 200 */ 201 public static final String IN_VISIBLE_GROUP = "in_visible_group"; 202 203 /** 204 * Contact presence status. See {@link android.provider.Im.CommonPresenceColumns} 205 * for individual status definitions. 206 */ 207 public static final String PRESENCE_STATUS = Presence.PRESENCE_STATUS; 208 209 /** 210 * The type of data, for example Home or Work. 211 * <P>Type: INTEGER</P> 212 */ 213 public static final String PRIMARY_PHONE_TYPE = CommonDataKinds.Phone.TYPE; 214 215 /** 216 * The user defined label for the primary phone. 217 * <P>Type: TEXT</P> 218 */ 219 public static final String PRIMARY_PHONE_LABEL = CommonDataKinds.Phone.LABEL; 220 221 /** 222 * The primary phone number. 223 * <P>Type: TEXT</P> 224 */ 225 public static final String PRIMARY_PHONE_NUMBER = CommonDataKinds.Phone.NUMBER; 226 } 227 228 /** 229 * Constants for the contacts table, which contains a record per group 230 * of raw contact representing the same person. 231 */ 232 public static class Contacts implements BaseColumns, ContactsColumns, 233 ContactOptionsColumns, SyncColumns { 234 /** 235 * This utility class cannot be instantiated 236 */ 237 private Contacts() {} 238 239 /** 240 * The content:// style URI for this table 241 */ 242 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "contacts"); 243 244 /** 245 * The content:// style URI for this table joined with useful data from 246 * {@link Data}. 247 */ 248 public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI, 249 "contacts_summary"); 250 251 /** 252 * The content:// style URI used for "type-to-filter" functionality on the 253 * {@link #CONTENT_SUMMARY_URI} URI. The filter string will be used to match 254 * various parts of the contact name. The filter argument should be passed 255 * as an additional path segment after this URI. 256 */ 257 public static final Uri CONTENT_SUMMARY_FILTER_URI = Uri.withAppendedPath( 258 CONTENT_SUMMARY_URI, "filter"); 259 260 /** 261 * The content:// style URI for this table joined with useful data from 262 * {@link Data}, filtered to include only starred contacts 263 * and the most frequently contacted contacts. 264 */ 265 public static final Uri CONTENT_SUMMARY_STREQUENT_URI = Uri.withAppendedPath( 266 CONTENT_SUMMARY_URI, "strequent"); 267 268 /** 269 * The content:// style URI used for "type-to-filter" functionality on the 270 * {@link #CONTENT_SUMMARY_STREQUENT_URI} URI. The filter string will be used to match 271 * various parts of the contact name. The filter argument should be passed 272 * as an additional path segment after this URI. 273 */ 274 public static final Uri CONTENT_SUMMARY_STREQUENT_FILTER_URI = Uri.withAppendedPath( 275 CONTENT_SUMMARY_STREQUENT_URI, "filter"); 276 277 public static final Uri CONTENT_SUMMARY_GROUP_URI = Uri.withAppendedPath( 278 CONTENT_SUMMARY_URI, "group"); 279 /** 280 * The MIME type of {@link #CONTENT_URI} providing a directory of 281 * people. 282 */ 283 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact"; 284 285 /** 286 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single 287 * person. 288 */ 289 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact"; 290 291 /** 292 * A sub-directory of a single contact that contains all of the constituent raw contact 293 * {@link Data} rows. 294 */ 295 public static final class Data implements BaseColumns, DataColumns, BaseSyncColumns { 296 /** 297 * no public constructor since this is a utility class 298 */ 299 private Data() {} 300 301 /** 302 * The directory twig for this sub-table 303 */ 304 public static final String CONTENT_DIRECTORY = "data"; 305 } 306 307 /** 308 * A sub-directory of a single contact aggregate that contains all aggregation suggestions 309 * (other contacts). The aggregation suggestions are computed based on approximate 310 * data matches with this contact. 311 */ 312 public static final class AggregationSuggestions implements BaseColumns, ContactsColumns { 313 /** 314 * No public constructor since this is a utility class 315 */ 316 private AggregationSuggestions() {} 317 318 /** 319 * The directory twig for this sub-table 320 */ 321 public static final String CONTENT_DIRECTORY = "suggestions"; 322 323 /** 324 * An optional query parameter that can be supplied to limit the number of returned 325 * suggestions. 326 * <p> 327 * Type: INTEGER 328 * 329 * @deprecated Please use the "limit" parameter 330 */ 331 @Deprecated 332 public static final String MAX_SUGGESTIONS = "max_suggestions"; 333 } 334 } 335 336 private interface RawContactsColumns { 337 /** 338 * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} that this 339 * data belongs to. 340 * <P>Type: INTEGER</P> 341 */ 342 public static final String CONTACT_ID = "contact_id"; 343 344 /** 345 * Flag indicating that this {@link RawContacts} entry and its children has 346 * been restricted to specific platform apps. 347 * <P>Type: INTEGER (boolean)</P> 348 * 349 * @hide until finalized in future platform release 350 */ 351 public static final String IS_RESTRICTED = "is_restricted"; 352 353 /** 354 * The aggregation mode for this contact. 355 * <P>Type: INTEGER</P> 356 */ 357 public static final String AGGREGATION_MODE = "aggregation_mode"; 358 359 /** 360 * The "deleted" flag: "0" by default, "1" if the row has been marked 361 * for deletion. When {@link android.content.ContentResolver#delete} is 362 * called on a raw contact, it is marked for deletion and removed from its 363 * aggregate contact. The sync adaptor deletes the raw contact on the server and 364 * then calls ContactResolver.delete once more, this time passing the 365 * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal. 366 * <P>Type: INTEGER</P> 367 */ 368 public static final String DELETED = "deleted"; 369 } 370 371 /** 372 * Constants for the raw_contacts table, which contains the base contact 373 * information per sync source. Sync adapters and contact management apps 374 * are the primary consumers of this API. 375 */ 376 public static final class RawContacts implements BaseColumns, RawContactsColumns, 377 ContactOptionsColumns, SyncColumns { 378 /** 379 * This utility class cannot be instantiated 380 */ 381 private RawContacts() { 382 } 383 384 /** 385 * The content:// style URI for this table 386 */ 387 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "raw_contacts"); 388 389 /** 390 * The content:// style URL for filtering people by email address. The 391 * filter argument should be passed as an additional path segment after 392 * this URI. 393 * 394 * @hide 395 */ 396 public static final Uri CONTENT_FILTER_EMAIL_URI = 397 Uri.withAppendedPath(CONTENT_URI, "filter_email"); 398 399 /** 400 * The MIME type of {@link #CONTENT_URI} providing a directory of 401 * people. 402 */ 403 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact"; 404 405 /** 406 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single 407 * person. 408 */ 409 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/raw_contact"; 410 411 /** 412 * Query parameter that can be passed with the {@link #CONTENT_URI} URI 413 * to the {@link android.content.ContentResolver#delete} method to 414 * indicate that the raw contact can be deleted physically, rather than 415 * merely marked as deleted. 416 */ 417 public static final String DELETE_PERMANENTLY = "delete_permanently"; 418 419 /** 420 * Aggregation mode: aggregate asynchronously. 421 */ 422 public static final int AGGREGATION_MODE_DEFAULT = 0; 423 424 /** 425 * Aggregation mode: aggregate at the time the raw contact is inserted/updated. 426 */ 427 public static final int AGGREGATION_MODE_IMMEDITATE = 1; 428 429 /** 430 * Aggregation mode: never aggregate this raw contact (note that the raw contact will not 431 * have a corresponding Aggregate and therefore will not be included in Aggregates 432 * query results.) 433 */ 434 public static final int AGGREGATION_MODE_DISABLED = 2; 435 436 /** 437 * A sub-directory of a single raw contact that contains all of their {@link Data} rows. 438 * To access this directory append 439 */ 440 public static final class Data implements BaseColumns, DataColumns { 441 /** 442 * no public constructor since this is a utility class 443 */ 444 private Data() { 445 } 446 447 /** 448 * The directory twig for this sub-table 449 */ 450 public static final String CONTENT_DIRECTORY = "data"; 451 } 452 } 453 454 private interface DataColumns { 455 /** 456 * The package name to use when creating {@link Resources} objects for 457 * this data row. This value is only designed for use when building user 458 * interfaces, and should not be used to infer the owner. 459 */ 460 public static final String RES_PACKAGE = "res_package"; 461 462 /** 463 * The MIME type of the item represented by this row. 464 */ 465 public static final String MIMETYPE = "mimetype"; 466 467 /** 468 * A reference to the {@link RawContacts#_ID} 469 * that this data belongs to. 470 */ 471 public static final String RAW_CONTACT_ID = "raw_contact_id"; 472 473 /** 474 * Whether this is the primary entry of its kind for the raw contact it belongs to 475 * <P>Type: INTEGER (if set, non-0 means true)</P> 476 */ 477 public static final String IS_PRIMARY = "is_primary"; 478 479 /** 480 * Whether this is the primary entry of its kind for the aggregate 481 * contact it belongs to. Any data record that is "super primary" must 482 * also be "primary". 483 * <P>Type: INTEGER (if set, non-0 means true)</P> 484 */ 485 public static final String IS_SUPER_PRIMARY = "is_super_primary"; 486 487 /** 488 * The version of this data record. This is a read-only value. The data column is 489 * guaranteed to not change without the version going up. This value is monotonically 490 * increasing. 491 * <P>Type: INTEGER</P> 492 */ 493 public static final String DATA_VERSION = "data_version"; 494 495 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 496 public static final String DATA1 = "data1"; 497 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 498 public static final String DATA2 = "data2"; 499 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 500 public static final String DATA3 = "data3"; 501 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 502 public static final String DATA4 = "data4"; 503 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 504 public static final String DATA5 = "data5"; 505 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 506 public static final String DATA6 = "data6"; 507 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 508 public static final String DATA7 = "data7"; 509 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 510 public static final String DATA8 = "data8"; 511 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 512 public static final String DATA9 = "data9"; 513 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 514 public static final String DATA10 = "data10"; 515 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 516 public static final String DATA11 = "data11"; 517 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 518 public static final String DATA12 = "data12"; 519 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 520 public static final String DATA13 = "data13"; 521 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 522 public static final String DATA14 = "data14"; 523 /** Generic data column, the meaning is {@link #MIMETYPE} specific */ 524 public static final String DATA15 = "data15"; 525 526 /** 527 * An optional update or insert URI parameter that determines if the 528 * corresponding raw contact should be marked as dirty. The default 529 * value is true. 530 */ 531 public static final String MARK_AS_DIRTY = "mark_as_dirty"; 532 } 533 534 /** 535 * Constants for the data table, which contains data points tied to a raw contact. 536 * For example, a phone number or email address. Each row in this table contains a type 537 * definition and some generic columns. Each data type can define the meaning for each of 538 * the generic columns. 539 */ 540 public static final class Data implements BaseColumns, DataColumns, BaseSyncColumns { 541 /** 542 * This utility class cannot be instantiated 543 */ 544 private Data() {} 545 546 /** 547 * The content:// style URI for this table 548 */ 549 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data"); 550 551 /** 552 * The MIME type of {@link #CONTENT_URI} providing a directory of data. 553 */ 554 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/data"; 555 } 556 557 /** 558 * A table that represents the result of looking up a phone number, for 559 * example for caller ID. The table joins that data row for the phone number 560 * with the raw contact that owns the number. To perform a lookup you must 561 * append the number you want to find to {@link #CONTENT_FILTER_URI}. 562 */ 563 public static final class PhoneLookup implements BaseColumns, DataColumns, ContactsColumns { 564 /** 565 * This utility class cannot be instantiated 566 */ 567 private PhoneLookup() {} 568 569 /** 570 * The content:// style URI for this table. Append the phone number you want to lookup 571 * to this URI and query it to perform a lookup. For example: 572 * 573 * {@code 574 * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, phoneNumber); 575 * } 576 */ 577 public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI, 578 "phone_lookup"); 579 } 580 581 /** 582 * Additional data mixed in with {@link Im.CommonPresenceColumns} to link 583 * back to specific {@link ContactsContract.Contacts#_ID} entries. 584 */ 585 private interface PresenceColumns { 586 587 /** 588 * The unique ID for a row. 589 * <P>Type: INTEGER (long)</P> 590 */ 591 public static final String _ID = "presence_id"; 592 593 /** 594 * Reference to the {@link RawContacts#_ID} this presence references. 595 * <P>Type: INTEGER</P> 596 */ 597 public static final String RAW_CONTACT_ID = "raw_contact_id"; 598 599 /** 600 * Reference to the {@link Data#_ID} entry that owns this presence. 601 * <P>Type: INTEGER</P> 602 */ 603 public static final String DATA_ID = "data_id"; 604 605 /** 606 * The IM service the presence is coming from. Formatted using either 607 * {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)} or 608 * {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}. 609 * <P>Type: TEXT</P> 610 */ 611 public static final String IM_PROTOCOL = "im_protocol"; 612 613 /** 614 * The IM handle the presence item is for. The handle is scoped to the 615 * {@link #IM_PROTOCOL}. 616 * <P>Type: TEXT</P> 617 */ 618 public static final String IM_HANDLE = "im_handle"; 619 620 /** 621 * The IM account for the local user that the presence data came from. 622 * <P>Type: TEXT</P> 623 */ 624 public static final String IM_ACCOUNT = "im_account"; 625 } 626 627 public static final class Presence implements PresenceColumns, Im.CommonPresenceColumns { 628 /** 629 * This utility class cannot be instantiated 630 */ 631 private Presence() { 632 } 633 634 /** 635 * The content:// style URI for this table 636 */ 637 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "presence"); 638 639 /** 640 * Gets the resource ID for the proper presence icon. 641 * 642 * @param status the status to get the icon for 643 * @return the resource ID for the proper presence icon 644 */ 645 public static final int getPresenceIconResourceId(int status) { 646 switch (status) { 647 case AVAILABLE: 648 return android.R.drawable.presence_online; 649 case IDLE: 650 case AWAY: 651 return android.R.drawable.presence_away; 652 case DO_NOT_DISTURB: 653 return android.R.drawable.presence_busy; 654 case INVISIBLE: 655 return android.R.drawable.presence_invisible; 656 case OFFLINE: 657 default: 658 return android.R.drawable.presence_offline; 659 } 660 } 661 662 /** 663 * Returns the precedence of the status code the higher number being the higher precedence. 664 * 665 * @param status The status code. 666 * @return An integer representing the precedence, 0 being the lowest. 667 */ 668 public static final int getPresencePrecedence(int status) { 669 // Keep this function here incase we want to enforce a different precedence than the 670 // natural order of the status constants. 671 return status; 672 } 673 674 /** 675 * The MIME type of {@link #CONTENT_URI} providing a directory of 676 * presence details. 677 */ 678 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/im-presence"; 679 680 /** 681 * The MIME type of a {@link #CONTENT_URI} subdirectory of a single 682 * presence detail. 683 */ 684 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im-presence"; 685 } 686 687 /** 688 * Container for definitions of common data types stored in the {@link Data} table. 689 */ 690 public static final class CommonDataKinds { 691 /** 692 * The {@link Data#RES_PACKAGE} value for common data that should be 693 * shown using a default style. 694 */ 695 public static final String PACKAGE_COMMON = "common"; 696 697 /** 698 * Columns common across the specific types. 699 */ 700 private interface BaseCommonColumns { 701 /** 702 * The package name to use when creating {@link Resources} objects for 703 * this data row. This value is only designed for use when building user 704 * interfaces, and should not be used to infer the owner. 705 */ 706 public static final String RES_PACKAGE = "res_package"; 707 708 /** 709 * The MIME type of the item represented by this row. 710 */ 711 public static final String MIMETYPE = "mimetype"; 712 713 /** 714 * The {@link RawContacts#_ID} that this data belongs to. 715 */ 716 public static final String RAW_CONTACT_ID = "raw_contact_id"; 717 } 718 719 /** 720 * The base types that all "Typed" data kinds support. 721 */ 722 public interface BaseTypes { 723 724 /** 725 * A custom type. The custom label should be supplied by user. 726 */ 727 public static int TYPE_CUSTOM = 0; 728 } 729 730 /** 731 * Columns common across the specific types. 732 */ 733 private interface CommonColumns extends BaseTypes{ 734 /** 735 * The type of data, for example Home or Work. 736 * <P>Type: INTEGER</P> 737 */ 738 public static final String TYPE = "data1"; 739 740 /** 741 * The data for the contact method. 742 * <P>Type: TEXT</P> 743 */ 744 public static final String DATA = "data2"; 745 746 /** 747 * The user defined label for the the contact method. 748 * <P>Type: TEXT</P> 749 */ 750 public static final String LABEL = "data3"; 751 } 752 753 /** 754 * Parts of the name. 755 */ 756 public static final class StructuredName implements BaseCommonColumns { 757 private StructuredName() {} 758 759 /** MIME type used when storing this in data table. */ 760 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name"; 761 762 /** 763 * The given name for the contact. 764 * <P>Type: TEXT</P> 765 */ 766 public static final String GIVEN_NAME = "data1"; 767 768 /** 769 * The family name for the contact. 770 * <P>Type: TEXT</P> 771 */ 772 public static final String FAMILY_NAME = "data2"; 773 774 /** 775 * The contact's honorific prefix, e.g. "Sir" 776 * <P>Type: TEXT</P> 777 */ 778 public static final String PREFIX = "data3"; 779 780 /** 781 * The contact's middle name 782 * <P>Type: TEXT</P> 783 */ 784 public static final String MIDDLE_NAME = "data4"; 785 786 /** 787 * The contact's honorific suffix, e.g. "Jr" 788 */ 789 public static final String SUFFIX = "data5"; 790 791 /** 792 * The phonetic version of the given name for the contact. 793 * <P>Type: TEXT</P> 794 */ 795 public static final String PHONETIC_GIVEN_NAME = "data6"; 796 797 /** 798 * The phonetic version of the additional name for the contact. 799 * <P>Type: TEXT</P> 800 */ 801 public static final String PHONETIC_MIDDLE_NAME = "data7"; 802 803 /** 804 * The phonetic version of the family name for the contact. 805 * <P>Type: TEXT</P> 806 */ 807 public static final String PHONETIC_FAMILY_NAME = "data8"; 808 809 /** 810 * The name that should be used to display the contact. 811 * <P>Type: TEXT</P> 812 */ 813 public static final String DISPLAY_NAME = "data9"; 814 } 815 816 /** 817 * A nickname. 818 */ 819 public static final class Nickname implements CommonColumns, BaseCommonColumns { 820 private Nickname() {} 821 822 /** MIME type used when storing this in data table. */ 823 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname"; 824 825 public static final int TYPE_DEFAULT = 1; 826 public static final int TYPE_OTHER_NAME = 2; 827 public static final int TYPE_MAINDEN_NAME = 3; 828 public static final int TYPE_SHORT_NAME = 4; 829 public static final int TYPE_INITIALS = 5; 830 831 /** 832 * The name itself 833 */ 834 public static final String NAME = DATA; 835 } 836 837 /** 838 * Common data definition for telephone numbers. 839 */ 840 public static final class Phone implements BaseCommonColumns, CommonColumns { 841 private Phone() {} 842 843 /** MIME type used when storing this in data table. */ 844 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone"; 845 846 /** 847 * The MIME type of {@link #CONTENT_URI} providing a directory of 848 * phones. 849 */ 850 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone"; 851 852 /** 853 * The content:// style URI for all data records of the 854 * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the 855 * associated raw contact and aggregate contact data. 856 */ 857 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, 858 "phones"); 859 860 /** 861 * The content:// style URI for filtering data records of the 862 * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the 863 * associated raw contact and aggregate contact data. The filter argument should 864 * be passed as an additional path segment after this URI. 865 */ 866 public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI, 867 "filter"); 868 869 public static final int TYPE_HOME = 1; 870 public static final int TYPE_MOBILE = 2; 871 public static final int TYPE_WORK = 3; 872 public static final int TYPE_FAX_WORK = 4; 873 public static final int TYPE_FAX_HOME = 5; 874 public static final int TYPE_PAGER = 6; 875 public static final int TYPE_OTHER = 7; 876 877 /** 878 * The phone number as the user entered it. 879 * <P>Type: TEXT</P> 880 */ 881 public static final String NUMBER = DATA; 882 } 883 884 /** 885 * Common data definition for email addresses. 886 */ 887 public static final class Email implements BaseCommonColumns, CommonColumns { 888 private Email() {} 889 890 /** MIME type used when storing this in data table. */ 891 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email"; 892 893 public static final int TYPE_HOME = 1; 894 public static final int TYPE_WORK = 2; 895 public static final int TYPE_OTHER = 3; 896 } 897 898 /** 899 * Common data definition for postal addresses. 900 */ 901 public static final class StructuredPostal implements BaseCommonColumns, CommonColumns { 902 private StructuredPostal() { 903 } 904 905 /** MIME type used when storing this in data table. */ 906 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/postal-address"; 907 908 /** 909 * The MIME type of {@link #CONTENT_URI} providing a directory of 910 * postal addresses. 911 */ 912 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address"; 913 914 /** 915 * The content:// style URI for all data records of the 916 * {@link StructuredPostal#CONTENT_ITEM_TYPE} MIME type. 917 */ 918 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, 919 "postals"); 920 921 public static final int TYPE_HOME = 1; 922 public static final int TYPE_WORK = 2; 923 public static final int TYPE_OTHER = 3; 924 925 /** 926 * The full, unstructured postal address. 927 * <p> 928 * Type: TEXT 929 */ 930 public static final String FORMATTED_ADDRESS = DATA; 931 932 /** 933 * The agent who actually receives the mail. Used in work addresses. 934 * Also for 'in care of' or 'c/o'. 935 * <p> 936 * Type: TEXT 937 */ 938 public static final String AGENT = "data4"; 939 940 /** 941 * Used in places where houses or buildings have names (and not 942 * necessarily numbers), eg. "The Pillars". 943 * <p> 944 * Type: TEXT 945 */ 946 public static final String HOUSENAME = "data5"; 947 948 /** 949 * Can be street, avenue, road, etc. This element also includes the 950 * house number and room/apartment/flat/floor number. 951 * <p> 952 * Type: TEXT 953 */ 954 public static final String STREET = "data6"; 955 956 /** 957 * Covers actual P.O. boxes, drawers, locked bags, etc. This is 958 * usually but not always mutually exclusive with street. 959 * <p> 960 * Type: TEXT 961 */ 962 public static final String POBOX = "data7"; 963 964 /** 965 * This is used to disambiguate a street address when a city 966 * contains more than one street with the same name, or to specify a 967 * small place whose mail is routed through a larger postal town. In 968 * China it could be a county or a minor city. 969 * <p> 970 * Type: TEXT 971 */ 972 public static final String NEIGHBORHOOD = "data8"; 973 974 /** 975 * Can be city, village, town, borough, etc. This is the postal town 976 * and not necessarily the place of residence or place of business. 977 * <p> 978 * Type: TEXT 979 */ 980 public static final String CITY = "data9"; 981 982 /** 983 * Handles administrative districts such as U.S. or U.K. counties 984 * that are not used for mail addressing purposes. Subregion is not 985 * intended for delivery addresses. 986 * <p> 987 * Type: TEXT 988 */ 989 public static final String SUBREGION = "data10"; 990 991 /** 992 * A state, province, county (in Ireland), Land (in Germany), 993 * departement (in France), etc. 994 * <p> 995 * Type: TEXT 996 */ 997 public static final String REGION = "data11"; 998 999 /** 1000 * Postal code. Usually country-wide, but sometimes specific to the 1001 * city (e.g. "2" in "Dublin 2, Ireland" addresses). 1002 * <p> 1003 * Type: TEXT 1004 */ 1005 public static final String POSTCODE = "data12"; 1006 1007 /** 1008 * The name or code of the country. 1009 * <p> 1010 * Type: TEXT 1011 */ 1012 public static final String COUNTRY = "data13"; 1013 } 1014 1015 /** 1016 * Common data definition for IM addresses. 1017 */ 1018 public static final class Im implements BaseCommonColumns, CommonColumns { 1019 private Im() {} 1020 1021 /** MIME type used when storing this in data table. */ 1022 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im"; 1023 1024 public static final int TYPE_HOME = 1; 1025 public static final int TYPE_WORK = 2; 1026 public static final int TYPE_OTHER = 3; 1027 1028 public static final String PROTOCOL = "data5"; 1029 1030 public static final String CUSTOM_PROTOCOL = "data6"; 1031 1032 /** 1033 * The predefined IM protocol types. The protocol can either be non-present, one 1034 * of these types, or a free-form string. These cases are encoded in the PROTOCOL 1035 * column as: 1036 * <ul> 1037 * <li>null</li> 1038 * <li>pre:<an integer, one of the protocols below></li> 1039 * <li>custom:<a string></li> 1040 * </ul> 1041 */ 1042 public static final int PROTOCOL_CUSTOM = -1; 1043 public static final int PROTOCOL_AIM = 0; 1044 public static final int PROTOCOL_MSN = 1; 1045 public static final int PROTOCOL_YAHOO = 2; 1046 public static final int PROTOCOL_SKYPE = 3; 1047 public static final int PROTOCOL_QQ = 4; 1048 public static final int PROTOCOL_GOOGLE_TALK = 5; 1049 public static final int PROTOCOL_ICQ = 6; 1050 public static final int PROTOCOL_JABBER = 7; 1051 } 1052 1053 /** 1054 * Common data definition for organizations. 1055 */ 1056 public static final class Organization implements BaseCommonColumns, CommonColumns { 1057 private Organization() {} 1058 1059 /** MIME type used when storing this in data table. */ 1060 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization"; 1061 1062 public static final int TYPE_WORK = 1; 1063 public static final int TYPE_OTHER = 2; 1064 1065 /** 1066 * The company as the user entered it. 1067 * <P>Type: TEXT</P> 1068 */ 1069 public static final String COMPANY = DATA; 1070 1071 /** 1072 * The position title at this company as the user entered it. 1073 * <P>Type: TEXT</P> 1074 */ 1075 public static final String TITLE = "data4"; 1076 } 1077 1078 /** 1079 * Photo of the contact. 1080 */ 1081 public static final class Photo implements BaseCommonColumns { 1082 private Photo() {} 1083 1084 /** MIME type used when storing this in data table. */ 1085 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo"; 1086 1087 /** 1088 * Thumbnail photo of the raw contact. This is the raw bytes of an image 1089 * that could be inflated using {@link BitmapFactory}. 1090 * <p> 1091 * Type: BLOB 1092 */ 1093 public static final String PHOTO = "data1"; 1094 } 1095 1096 /** 1097 * Notes about the contact. 1098 */ 1099 public static final class Note implements BaseCommonColumns { 1100 private Note() {} 1101 1102 /** MIME type used when storing this in data table. */ 1103 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note"; 1104 1105 /** 1106 * The note text. 1107 * <P>Type: TEXT</P> 1108 */ 1109 public static final String NOTE = "data1"; 1110 } 1111 1112 /** 1113 * Group Membership. 1114 */ 1115 public static final class GroupMembership implements BaseCommonColumns { 1116 private GroupMembership() {} 1117 1118 /** MIME type used when storing this in data table. */ 1119 public static final String CONTENT_ITEM_TYPE = 1120 "vnd.android.cursor.item/group_membership"; 1121 1122 /** 1123 * The row id of the group that this group membership refers to. Exactly one of 1124 * this or {@link #GROUP_SOURCE_ID} must be set when inserting a row. 1125 * <P>Type: INTEGER</P> 1126 */ 1127 public static final String GROUP_ROW_ID = "data1"; 1128 1129 /** 1130 * The sourceid of the group that this group membership refers to. Exactly one of 1131 * this or {@link #GROUP_ROW_ID} must be set when inserting a row. 1132 * <P>Type: TEXT</P> 1133 */ 1134 public static final String GROUP_SOURCE_ID = "group_sourceid"; 1135 } 1136 1137 /** 1138 * Website related to the contact. 1139 */ 1140 public static final class Website implements BaseCommonColumns { 1141 private Website() {} 1142 1143 /** MIME type used when storing this in data table. */ 1144 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website"; 1145 1146 /** 1147 * The website URL string. 1148 * <P>Type: TEXT</P> 1149 */ 1150 public static final String URL = "data1"; 1151 } 1152 } 1153 1154 public interface GroupsColumns { 1155 /** 1156 * The display title of this group. 1157 * <p> 1158 * Type: TEXT 1159 */ 1160 public static final String TITLE = "title"; 1161 1162 /** 1163 * The package name to use when creating {@link Resources} objects for 1164 * this group. This value is only designed for use when building user 1165 * interfaces, and should not be used to infer the owner. 1166 */ 1167 public static final String RES_PACKAGE = "res_package"; 1168 1169 /** 1170 * The display title of this group to load as a resource from 1171 * {@link #RES_PACKAGE}, which may be localized. 1172 * <P>Type: TEXT</P> 1173 */ 1174 public static final String TITLE_RES = "title_res"; 1175 1176 /** 1177 * Notes about the group. 1178 * <p> 1179 * Type: TEXT 1180 */ 1181 public static final String NOTES = "notes"; 1182 1183 /** 1184 * The ID of this group if it is a System Group, i.e. a group that has a special meaning 1185 * to the sync adapter, null otherwise. 1186 * <P>Type: TEXT</P> 1187 */ 1188 public static final String SYSTEM_ID = "system_id"; 1189 1190 /** 1191 * The total number of {@link Contacts} that have 1192 * {@link GroupMembership} in this group. Read-only value that is only 1193 * present when querying {@link Groups#CONTENT_SUMMARY_URI}. 1194 * <p> 1195 * Type: INTEGER 1196 */ 1197 public static final String SUMMARY_COUNT = "summ_count"; 1198 1199 /** 1200 * The total number of {@link Contacts} that have both 1201 * {@link GroupMembership} in this group, and also have phone numbers. 1202 * Read-only value that is only present when querying 1203 * {@link Groups#CONTENT_SUMMARY_URI}. 1204 * <p> 1205 * Type: INTEGER 1206 */ 1207 public static final String SUMMARY_WITH_PHONES = "summ_phones"; 1208 1209 /** 1210 * Flag indicating if the contacts belonging to this group should be 1211 * visible in any user interface. 1212 * <p> 1213 * Type: INTEGER 1214 */ 1215 public static final String GROUP_VISIBLE = "group_visible"; 1216 } 1217 1218 /** 1219 * Constants for the groups table. 1220 */ 1221 public static final class Groups implements BaseColumns, GroupsColumns, SyncColumns { 1222 /** 1223 * This utility class cannot be instantiated 1224 */ 1225 private Groups() { 1226 } 1227 1228 /** 1229 * The content:// style URI for this table 1230 */ 1231 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "groups"); 1232 1233 /** 1234 * The content:// style URI for this table joined with details data from 1235 * {@link Data}. 1236 */ 1237 public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI, 1238 "groups_summary"); 1239 1240 /** 1241 * The MIME type of a directory of groups. 1242 */ 1243 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/group"; 1244 1245 /** 1246 * The MIME type of a single group. 1247 */ 1248 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group"; 1249 } 1250 1251 /** 1252 * Constants for the contact aggregation exceptions table, which contains 1253 * aggregation rules overriding those used by automatic aggregation. This type only 1254 * supports query and update. Neither insert nor delete are supported. 1255 */ 1256 public static final class AggregationExceptions implements BaseColumns { 1257 /** 1258 * This utility class cannot be instantiated 1259 */ 1260 private AggregationExceptions() {} 1261 1262 /** 1263 * The content:// style URI for this table 1264 */ 1265 public static final Uri CONTENT_URI = 1266 Uri.withAppendedPath(AUTHORITY_URI, "aggregation_exceptions"); 1267 1268 /** 1269 * The MIME type of {@link #CONTENT_URI} providing a directory of data. 1270 */ 1271 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception"; 1272 1273 /** 1274 * The MIME type of a {@link #CONTENT_URI} subdirectory of an aggregation exception 1275 */ 1276 public static final String CONTENT_ITEM_TYPE = 1277 "vnd.android.cursor.item/aggregation_exception"; 1278 1279 /** 1280 * The type of exception: {@link #TYPE_KEEP_IN}, {@link #TYPE_KEEP_OUT} or 1281 * {@link #TYPE_AUTOMATIC}. 1282 * 1283 * <P>Type: INTEGER</P> 1284 */ 1285 public static final String TYPE = "type"; 1286 1287 /** 1288 * Allows the provider to automatically decide whether the aggregate 1289 * contact should include a particular raw contact or not. 1290 */ 1291 public static final int TYPE_AUTOMATIC = 0; 1292 1293 /** 1294 * Makes sure that the specified raw contact is included in the 1295 * specified aggregate contact. 1296 */ 1297 public static final int TYPE_KEEP_IN = 1; 1298 1299 /** 1300 * Makes sure that the specified raw contact is NOT included in the 1301 * specified aggregate contact. 1302 */ 1303 public static final int TYPE_KEEP_OUT = 2; 1304 1305 /** 1306 * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} of the 1307 * aggregate contact that the rule applies to. 1308 */ 1309 public static final String CONTACT_ID = "contact_id"; 1310 1311 /** 1312 * A reference to the {@link RawContacts#_ID} of the raw contact that the rule applies to. 1313 */ 1314 public static final String RAW_CONTACT_ID = "raw_contact_id"; 1315 } 1316 1317 /** 1318 * Contains helper classes used to create or manage {@link android.content.Intent Intents} 1319 * that involve contacts. 1320 */ 1321 public static final class Intents { 1322 /** 1323 * This is the intent that is fired when a search suggestion is clicked on. 1324 */ 1325 public static final String SEARCH_SUGGESTION_CLICKED = 1326 "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED"; 1327 1328 /** 1329 * This is the intent that is fired when a search suggestion for dialing a number 1330 * is clicked on. 1331 */ 1332 public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = 1333 "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED"; 1334 1335 /** 1336 * This is the intent that is fired when a search suggestion for creating a contact 1337 * is clicked on. 1338 */ 1339 public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = 1340 "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED"; 1341 1342 /** 1343 * Starts an Activity that lets the user pick a contact to attach an image to. 1344 * After picking the contact it launches the image cropper in face detection mode. 1345 */ 1346 public static final String ATTACH_IMAGE = 1347 "com.android.contacts.action.ATTACH_IMAGE"; 1348 1349 /** 1350 * Takes as input a data URI with a mailto: or tel: scheme. If a single 1351 * contact exists with the given data it will be shown. If no contact 1352 * exists, a dialog will ask the user if they want to create a new 1353 * contact with the provided details filled in. If multiple contacts 1354 * share the data the user will be prompted to pick which contact they 1355 * want to view. 1356 * <p> 1357 * For <code>mailto:</code> URIs, the scheme specific portion must be a 1358 * raw email address, such as one built using 1359 * {@link Uri#fromParts(String, String, String)}. 1360 * <p> 1361 * For <code>tel:</code> URIs, the scheme specific portion is compared 1362 * to existing numbers using the standard caller ID lookup algorithm. 1363 * The number must be properly encoded, for example using 1364 * {@link Uri#fromParts(String, String, String)}. 1365 * <p> 1366 * Any extras from the {@link Insert} class will be passed along to the 1367 * create activity if there are no contacts to show. 1368 * <p> 1369 * Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip 1370 * prompting the user when the contact doesn't exist. 1371 */ 1372 public static final String SHOW_OR_CREATE_CONTACT = 1373 "com.android.contacts.action.SHOW_OR_CREATE_CONTACT"; 1374 1375 /** 1376 * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new 1377 * contact if no matching contact found. Otherwise, default behavior is 1378 * to prompt user with dialog before creating. 1379 * <p> 1380 * Type: BOOLEAN 1381 */ 1382 public static final String EXTRA_FORCE_CREATE = 1383 "com.android.contacts.action.FORCE_CREATE"; 1384 1385 /** 1386 * Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact 1387 * description to be shown when prompting user about creating a new 1388 * contact. 1389 * <p> 1390 * Type: STRING 1391 */ 1392 public static final String EXTRA_CREATE_DESCRIPTION = 1393 "com.android.contacts.action.CREATE_DESCRIPTION"; 1394 1395 /** 1396 * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a 1397 * dialog location using screen coordinates. When not specified, the 1398 * dialog will be centered. 1399 */ 1400 public static final String EXTRA_TARGET_RECT = "target_rect"; 1401 1402 /** 1403 * Intents related to the Contacts app UI. 1404 */ 1405 public static final class UI { 1406 /** 1407 * The action for the default contacts list tab. 1408 */ 1409 public static final String LIST_DEFAULT = 1410 "com.android.contacts.action.LIST_DEFAULT"; 1411 1412 /** 1413 * The action for the contacts list tab. 1414 */ 1415 public static final String LIST_GROUP_ACTION = 1416 "com.android.contacts.action.LIST_GROUP"; 1417 1418 /** 1419 * When in LIST_GROUP_ACTION mode, this is the group to display. 1420 */ 1421 public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP"; 1422 1423 /** 1424 * The action for the all contacts list tab. 1425 */ 1426 public static final String LIST_ALL_CONTACTS_ACTION = 1427 "com.android.contacts.action.LIST_ALL_CONTACTS"; 1428 1429 /** 1430 * The action for the contacts with phone numbers list tab. 1431 */ 1432 public static final String LIST_CONTACTS_WITH_PHONES_ACTION = 1433 "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES"; 1434 1435 /** 1436 * The action for the starred contacts list tab. 1437 */ 1438 public static final String LIST_STARRED_ACTION = 1439 "com.android.contacts.action.LIST_STARRED"; 1440 1441 /** 1442 * The action for the frequent contacts list tab. 1443 */ 1444 public static final String LIST_FREQUENT_ACTION = 1445 "com.android.contacts.action.LIST_FREQUENT"; 1446 1447 /** 1448 * The action for the "strequent" contacts list tab. It first lists the starred 1449 * contacts in alphabetical order and then the frequent contacts in descending 1450 * order of the number of times they have been contacted. 1451 */ 1452 public static final String LIST_STREQUENT_ACTION = 1453 "com.android.contacts.action.LIST_STREQUENT"; 1454 1455 /** 1456 * A key for to be used as an intent extra to set the activity 1457 * title to a custom String value. 1458 */ 1459 public static final String TITLE_EXTRA_KEY = 1460 "com.android.contacts.extra.TITLE_EXTRA"; 1461 1462 /** 1463 * Activity Action: Display a filtered list of contacts 1464 * <p> 1465 * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for 1466 * filtering 1467 * <p> 1468 * Output: Nothing. 1469 */ 1470 public static final String FILTER_CONTACTS_ACTION = 1471 "com.android.contacts.action.FILTER_CONTACTS"; 1472 1473 /** 1474 * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION} 1475 * intents to supply the text on which to filter. 1476 */ 1477 public static final String FILTER_TEXT_EXTRA_KEY = 1478 "com.android.contacts.extra.FILTER_TEXT"; 1479 } 1480 1481 /** 1482 * Convenience class that contains string constants used 1483 * to create contact {@link android.content.Intent Intents}. 1484 */ 1485 public static final class Insert { 1486 /** The action code to use when adding a contact */ 1487 public static final String ACTION = Intent.ACTION_INSERT; 1488 1489 /** 1490 * If present, forces a bypass of quick insert mode. 1491 */ 1492 public static final String FULL_MODE = "full_mode"; 1493 1494 /** 1495 * The extra field for the contact name. 1496 * <P>Type: String</P> 1497 */ 1498 public static final String NAME = "name"; 1499 1500 // TODO add structured name values here. 1501 1502 /** 1503 * The extra field for the contact phonetic name. 1504 * <P>Type: String</P> 1505 */ 1506 public static final String PHONETIC_NAME = "phonetic_name"; 1507 1508 /** 1509 * The extra field for the contact company. 1510 * <P>Type: String</P> 1511 */ 1512 public static final String COMPANY = "company"; 1513 1514 /** 1515 * The extra field for the contact job title. 1516 * <P>Type: String</P> 1517 */ 1518 public static final String JOB_TITLE = "job_title"; 1519 1520 /** 1521 * The extra field for the contact notes. 1522 * <P>Type: String</P> 1523 */ 1524 public static final String NOTES = "notes"; 1525 1526 /** 1527 * The extra field for the contact phone number. 1528 * <P>Type: String</P> 1529 */ 1530 public static final String PHONE = "phone"; 1531 1532 /** 1533 * The extra field for the contact phone number type. 1534 * <P>Type: Either an integer value from 1535 * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, 1536 * or a string specifying a custom label.</P> 1537 */ 1538 public static final String PHONE_TYPE = "phone_type"; 1539 1540 /** 1541 * The extra field for the phone isprimary flag. 1542 * <P>Type: boolean</P> 1543 */ 1544 public static final String PHONE_ISPRIMARY = "phone_isprimary"; 1545 1546 /** 1547 * The extra field for an optional second contact phone number. 1548 * <P>Type: String</P> 1549 */ 1550 public static final String SECONDARY_PHONE = "secondary_phone"; 1551 1552 /** 1553 * The extra field for an optional second contact phone number type. 1554 * <P>Type: Either an integer value from 1555 * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, 1556 * or a string specifying a custom label.</P> 1557 */ 1558 public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type"; 1559 1560 /** 1561 * The extra field for an optional third contact phone number. 1562 * <P>Type: String</P> 1563 */ 1564 public static final String TERTIARY_PHONE = "tertiary_phone"; 1565 1566 /** 1567 * The extra field for an optional third contact phone number type. 1568 * <P>Type: Either an integer value from 1569 * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, 1570 * or a string specifying a custom label.</P> 1571 */ 1572 public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type"; 1573 1574 /** 1575 * The extra field for the contact email address. 1576 * <P>Type: String</P> 1577 */ 1578 public static final String EMAIL = "email"; 1579 1580 /** 1581 * The extra field for the contact email type. 1582 * <P>Type: Either an integer value from 1583 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 1584 * or a string specifying a custom label.</P> 1585 */ 1586 public static final String EMAIL_TYPE = "email_type"; 1587 1588 /** 1589 * The extra field for the email isprimary flag. 1590 * <P>Type: boolean</P> 1591 */ 1592 public static final String EMAIL_ISPRIMARY = "email_isprimary"; 1593 1594 /** 1595 * The extra field for an optional second contact email address. 1596 * <P>Type: String</P> 1597 */ 1598 public static final String SECONDARY_EMAIL = "secondary_email"; 1599 1600 /** 1601 * The extra field for an optional second contact email type. 1602 * <P>Type: Either an integer value from 1603 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 1604 * or a string specifying a custom label.</P> 1605 */ 1606 public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type"; 1607 1608 /** 1609 * The extra field for an optional third contact email address. 1610 * <P>Type: String</P> 1611 */ 1612 public static final String TERTIARY_EMAIL = "tertiary_email"; 1613 1614 /** 1615 * The extra field for an optional third contact email type. 1616 * <P>Type: Either an integer value from 1617 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 1618 * or a string specifying a custom label.</P> 1619 */ 1620 public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type"; 1621 1622 /** 1623 * The extra field for the contact postal address. 1624 * <P>Type: String</P> 1625 */ 1626 public static final String POSTAL = "postal"; 1627 1628 /** 1629 * The extra field for the contact postal address type. 1630 * <P>Type: Either an integer value from 1631 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 1632 * or a string specifying a custom label.</P> 1633 */ 1634 public static final String POSTAL_TYPE = "postal_type"; 1635 1636 /** 1637 * The extra field for the postal isprimary flag. 1638 * <P>Type: boolean</P> 1639 */ 1640 public static final String POSTAL_ISPRIMARY = "postal_isprimary"; 1641 1642 /** 1643 * The extra field for an IM handle. 1644 * <P>Type: String</P> 1645 */ 1646 public static final String IM_HANDLE = "im_handle"; 1647 1648 /** 1649 * The extra field for the IM protocol 1650 * <P>Type: the result of {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)} 1651 * or {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.</P> 1652 */ 1653 public static final String IM_PROTOCOL = "im_protocol"; 1654 1655 /** 1656 * The extra field for the IM isprimary flag. 1657 * <P>Type: boolean</P> 1658 */ 1659 public static final String IM_ISPRIMARY = "im_isprimary"; 1660 } 1661 } 1662 1663} 1664