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