ContactsContract.java revision 62b83b7fc4642b71829737494258f12996bc1baa
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 * <i>Unstructured component of the name should be consistent with 799 * its structured representation.</i> 800 * <p> 801 * Type: TEXT 802 */ 803 public static final String DISPLAY_NAME = "data9"; 804 } 805 806 /** 807 * A nickname. 808 */ 809 public static final class Nickname implements CommonColumns, BaseCommonColumns { 810 private Nickname() {} 811 812 /** MIME type used when storing this in data table. */ 813 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname"; 814 815 public static final int TYPE_DEFAULT = 1; 816 public static final int TYPE_OTHER_NAME = 2; 817 public static final int TYPE_MAINDEN_NAME = 3; 818 public static final int TYPE_SHORT_NAME = 4; 819 public static final int TYPE_INITIALS = 5; 820 821 /** 822 * The name itself 823 */ 824 public static final String NAME = DATA; 825 } 826 827 /** 828 * Common data definition for telephone numbers. 829 */ 830 public static final class Phone implements BaseCommonColumns, CommonColumns { 831 private Phone() {} 832 833 /** MIME type used when storing this in data table. */ 834 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone"; 835 836 /** 837 * The MIME type of {@link #CONTENT_URI} providing a directory of 838 * phones. 839 */ 840 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone"; 841 842 /** 843 * The content:// style URI for all data records of the 844 * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the 845 * associated raw contact and aggregate contact data. 846 */ 847 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, 848 "phones"); 849 850 /** 851 * The content:// style URI for filtering data records of the 852 * {@link Phone#CONTENT_ITEM_TYPE} MIME type, combined with the 853 * associated raw contact and aggregate contact data. The filter argument should 854 * be passed as an additional path segment after this URI. 855 */ 856 public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI, 857 "filter"); 858 859 public static final int TYPE_HOME = 1; 860 public static final int TYPE_MOBILE = 2; 861 public static final int TYPE_WORK = 3; 862 public static final int TYPE_FAX_WORK = 4; 863 public static final int TYPE_FAX_HOME = 5; 864 public static final int TYPE_PAGER = 6; 865 public static final int TYPE_OTHER = 7; 866 public static final int TYPE_CALLBACK = 8; 867 public static final int TYPE_CAR = 9; 868 public static final int TYPE_COMPANY_MAIN = 10; 869 public static final int TYPE_ISDN = 11; 870 public static final int TYPE_MAIN = 12; 871 public static final int TYPE_OTHER_FAX = 13; 872 public static final int TYPE_RADIO = 14; 873 public static final int TYPE_TELEX = 15; 874 public static final int TYPE_TTY_TDD = 16; 875 public static final int TYPE_WORK_MOBILE = 17; 876 public static final int TYPE_WORK_PAGER = 18; 877 public static final int TYPE_ASSISTANT = 19; 878 879 /** 880 * The phone number as the user entered it. 881 * <P>Type: TEXT</P> 882 */ 883 public static final String NUMBER = DATA; 884 } 885 886 /** 887 * Common data definition for email addresses. 888 */ 889 public static final class Email implements BaseCommonColumns, CommonColumns { 890 private Email() {} 891 892 /** MIME type used when storing this in data table. */ 893 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email"; 894 895 /** 896 * The content:// style URI for all data records of the 897 * {@link Email#CONTENT_ITEM_TYPE} MIME type, combined with the 898 * associated raw contact and aggregate contact data. 899 */ 900 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, 901 "emails"); 902 903 /** 904 * The content:// style URL for filtering data rows by email address. The 905 * filter argument should be passed as an additional path segment after 906 * this URI. 907 */ 908 public static final Uri CONTENT_FILTER_EMAIL_URI = Uri.withAppendedPath(CONTENT_URI, 909 "filter"); 910 911 public static final int TYPE_HOME = 1; 912 public static final int TYPE_WORK = 2; 913 public static final int TYPE_OTHER = 3; 914 915 /** 916 * The display name for the email address 917 * <P>Type: TEXT</P> 918 */ 919 public static final String DISPLAY_NAME = "data4"; 920 } 921 922 /** 923 * Common data definition for postal addresses. 924 */ 925 public static final class StructuredPostal implements BaseCommonColumns, CommonColumns { 926 private StructuredPostal() { 927 } 928 929 /** MIME type used when storing this in data table. */ 930 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/postal-address"; 931 932 /** 933 * The MIME type of {@link #CONTENT_URI} providing a directory of 934 * postal addresses. 935 */ 936 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address"; 937 938 /** 939 * The content:// style URI for all data records of the 940 * {@link StructuredPostal#CONTENT_ITEM_TYPE} MIME type. 941 */ 942 public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI, 943 "postals"); 944 945 public static final int TYPE_HOME = 1; 946 public static final int TYPE_WORK = 2; 947 public static final int TYPE_OTHER = 3; 948 949 /** 950 * The full, unstructured postal address. <i>This field must be 951 * consistent with any structured data.</i> 952 * <p> 953 * Type: TEXT 954 */ 955 public static final String FORMATTED_ADDRESS = DATA; 956 957 /** 958 * The agent who actually receives the mail. Used in work addresses. 959 * Also for 'in care of' or 'c/o'. 960 * <p> 961 * Type: TEXT 962 * @deprecated since this isn't supported by gd:structuredPostalAddress 963 */ 964 @Deprecated 965 public static final String AGENT = "data4"; 966 967 /** 968 * Used in places where houses or buildings have names (and not 969 * necessarily numbers), eg. "The Pillars". 970 * <p> 971 * Type: TEXT 972 * @deprecated since this isn't supported by gd:structuredPostalAddress 973 */ 974 @Deprecated 975 public static final String HOUSENAME = "data5"; 976 977 /** 978 * Can be street, avenue, road, etc. This element also includes the 979 * house number and room/apartment/flat/floor number. 980 * <p> 981 * Type: TEXT 982 */ 983 public static final String STREET = "data6"; 984 985 /** 986 * Covers actual P.O. boxes, drawers, locked bags, etc. This is 987 * usually but not always mutually exclusive with street. 988 * <p> 989 * Type: TEXT 990 */ 991 public static final String POBOX = "data7"; 992 993 /** 994 * This is used to disambiguate a street address when a city 995 * contains more than one street with the same name, or to specify a 996 * small place whose mail is routed through a larger postal town. In 997 * China it could be a county or a minor city. 998 * <p> 999 * Type: TEXT 1000 */ 1001 public static final String NEIGHBORHOOD = "data8"; 1002 1003 /** 1004 * Can be city, village, town, borough, etc. This is the postal town 1005 * and not necessarily the place of residence or place of business. 1006 * <p> 1007 * Type: TEXT 1008 */ 1009 public static final String CITY = "data9"; 1010 1011 /** 1012 * Handles administrative districts such as U.S. or U.K. counties 1013 * that are not used for mail addressing purposes. Subregion is not 1014 * intended for delivery addresses. 1015 * <p> 1016 * Type: TEXT 1017 * @deprecated since this isn't supported by gd:structuredPostalAddress 1018 */ 1019 @Deprecated 1020 public static final String SUBREGION = "data10"; 1021 1022 /** 1023 * A state, province, county (in Ireland), Land (in Germany), 1024 * departement (in France), etc. 1025 * <p> 1026 * Type: TEXT 1027 */ 1028 public static final String REGION = "data11"; 1029 1030 /** 1031 * Postal code. Usually country-wide, but sometimes specific to the 1032 * city (e.g. "2" in "Dublin 2, Ireland" addresses). 1033 * <p> 1034 * Type: TEXT 1035 */ 1036 public static final String POSTCODE = "data12"; 1037 1038 /** 1039 * The name or code of the country. 1040 * <p> 1041 * Type: TEXT 1042 */ 1043 public static final String COUNTRY = "data13"; 1044 } 1045 1046 /** 1047 * Common data definition for IM addresses. 1048 */ 1049 public static final class Im implements BaseCommonColumns, CommonColumns { 1050 private Im() {} 1051 1052 /** MIME type used when storing this in data table. */ 1053 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im"; 1054 1055 public static final int TYPE_HOME = 1; 1056 public static final int TYPE_WORK = 2; 1057 public static final int TYPE_OTHER = 3; 1058 1059 public static final String PROTOCOL = "data5"; 1060 1061 public static final String CUSTOM_PROTOCOL = "data6"; 1062 1063 /** 1064 * The predefined IM protocol types. The protocol can either be non-present, one 1065 * of these types, or a free-form string. These cases are encoded in the PROTOCOL 1066 * column as: 1067 * <ul> 1068 * <li>null</li> 1069 * <li>pre:<an integer, one of the protocols below></li> 1070 * <li>custom:<a string></li> 1071 * </ul> 1072 */ 1073 public static final int PROTOCOL_CUSTOM = -1; 1074 public static final int PROTOCOL_AIM = 0; 1075 public static final int PROTOCOL_MSN = 1; 1076 public static final int PROTOCOL_YAHOO = 2; 1077 public static final int PROTOCOL_SKYPE = 3; 1078 public static final int PROTOCOL_QQ = 4; 1079 public static final int PROTOCOL_GOOGLE_TALK = 5; 1080 public static final int PROTOCOL_ICQ = 6; 1081 public static final int PROTOCOL_JABBER = 7; 1082 public static final int PROTOCOL_NETMEETING = 8; 1083 } 1084 1085 /** 1086 * Common data definition for organizations. 1087 */ 1088 public static final class Organization implements BaseCommonColumns, CommonColumns { 1089 private Organization() {} 1090 1091 /** MIME type used when storing this in data table. */ 1092 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization"; 1093 1094 public static final int TYPE_WORK = 1; 1095 public static final int TYPE_OTHER = 2; 1096 1097 /** 1098 * The company as the user entered it. 1099 * <P>Type: TEXT</P> 1100 */ 1101 public static final String COMPANY = DATA; 1102 1103 /** 1104 * The position title at this company as the user entered it. 1105 * <P>Type: TEXT</P> 1106 */ 1107 public static final String TITLE = "data4"; 1108 1109 /** 1110 * The department at this company as the user entered it. 1111 * <P>Type: TEXT</P> 1112 */ 1113 public static final String DEPARTMENT = "data5"; 1114 1115 /** 1116 * The job description at this company as the user entered it. 1117 * <P>Type: TEXT</P> 1118 */ 1119 public static final String JOB_DESCRIPTION = "data6"; 1120 1121 /** 1122 * The symbol of this company as the user entered it. 1123 * <P>Type: TEXT</P> 1124 */ 1125 public static final String SYMBOL = "data7"; 1126 1127 /** 1128 * The phonetic name of this company as the user entered it. 1129 * <P>Type: TEXT</P> 1130 */ 1131 public static final String PHONETIC_NAME = "data8"; 1132 } 1133 1134 /** 1135 * Common data definition for miscellaneous information. 1136 */ 1137 public static final class Miscellaneous implements BaseCommonColumns { 1138 private Miscellaneous() {} 1139 1140 /** MIME type used when storing this in data table. */ 1141 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/misc"; 1142 1143 /** 1144 * The birthday as the user entered it. 1145 * <P>Type: TEXT</P> 1146 */ 1147 public static final String BIRTHDAY = "data1"; 1148 1149 /** 1150 * The nickname as the user entered it. 1151 * <P>Type: TEXT</P> 1152 */ 1153 public static final String NICKNAME = "data2"; 1154 } 1155 1156 /** 1157 * Common data definition for relations. 1158 */ 1159 public static final class Relation implements BaseCommonColumns, CommonColumns { 1160 private Relation() {} 1161 1162 /** MIME type used when storing this in data table. */ 1163 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/relation"; 1164 1165 public static final int TYPE_ASSISTANT = 1; 1166 public static final int TYPE_BROTHER = 2; 1167 public static final int TYPE_CHILD = 3; 1168 public static final int TYPE_DOMESTIC_PARTNER = 4; 1169 public static final int TYPE_FATHER = 5; 1170 public static final int TYPE_FRIEND = 6; 1171 public static final int TYPE_MANAGER = 7; 1172 public static final int TYPE_MOTHER = 8; 1173 public static final int TYPE_PARENT = 9; 1174 public static final int TYPE_PARTNER = 10; 1175 public static final int TYPE_REFERRED_BY = 11; 1176 public static final int TYPE_RELATIVE = 12; 1177 public static final int TYPE_SISTER = 13; 1178 public static final int TYPE_SPOUSE = 14; 1179 1180 /** 1181 * The name of the relative as the user entered it. 1182 * <P>Type: TEXT</P> 1183 */ 1184 public static final String NAME = DATA; 1185 } 1186 1187 /** 1188 * Common data definition for events. 1189 */ 1190 public static final class Event implements BaseCommonColumns, CommonColumns { 1191 private Event() {} 1192 1193 /** MIME type used when storing this in data table. */ 1194 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/event"; 1195 1196 public static final int TYPE_ANNIVERSARY = 1; 1197 public static final int TYPE_OTHER = 2; 1198 1199 /** 1200 * The event start date as the user entered it. 1201 * <P>Type: TEXT</P> 1202 */ 1203 public static final String START_DATE = DATA; 1204 } 1205 1206 /** 1207 * Photo of the contact. 1208 */ 1209 public static final class Photo implements BaseCommonColumns { 1210 private Photo() {} 1211 1212 /** MIME type used when storing this in data table. */ 1213 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo"; 1214 1215 /** 1216 * Thumbnail photo of the raw contact. This is the raw bytes of an image 1217 * that could be inflated using {@link BitmapFactory}. 1218 * <p> 1219 * Type: BLOB 1220 */ 1221 public static final String PHOTO = "data1"; 1222 } 1223 1224 /** 1225 * Notes about the contact. 1226 */ 1227 public static final class Note implements BaseCommonColumns { 1228 private Note() {} 1229 1230 /** MIME type used when storing this in data table. */ 1231 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note"; 1232 1233 /** 1234 * The note text. 1235 * <P>Type: TEXT</P> 1236 */ 1237 public static final String NOTE = "data1"; 1238 } 1239 1240 /** 1241 * Group Membership. 1242 */ 1243 public static final class GroupMembership implements BaseCommonColumns { 1244 private GroupMembership() {} 1245 1246 /** MIME type used when storing this in data table. */ 1247 public static final String CONTENT_ITEM_TYPE = 1248 "vnd.android.cursor.item/group_membership"; 1249 1250 /** 1251 * The row id of the group that this group membership refers to. Exactly one of 1252 * this or {@link #GROUP_SOURCE_ID} must be set when inserting a row. 1253 * <P>Type: INTEGER</P> 1254 */ 1255 public static final String GROUP_ROW_ID = "data1"; 1256 1257 /** 1258 * The sourceid of the group that this group membership refers to. Exactly one of 1259 * this or {@link #GROUP_ROW_ID} must be set when inserting a row. 1260 * <P>Type: TEXT</P> 1261 */ 1262 public static final String GROUP_SOURCE_ID = "group_sourceid"; 1263 } 1264 1265 /** 1266 * Website related to the contact. 1267 */ 1268 public static final class Website implements BaseCommonColumns, CommonColumns { 1269 private Website() {} 1270 1271 /** MIME type used when storing this in data table. */ 1272 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website"; 1273 1274 public static final int TYPE_HOMEPAGE = 1; 1275 public static final int TYPE_BLOG = 2; 1276 public static final int TYPE_PROFILE = 3; 1277 public static final int TYPE_HOME = 4; 1278 public static final int TYPE_WORK = 5; 1279 public static final int TYPE_FTP = 6; 1280 public static final int TYPE_OTHER = 7; 1281 1282 /** 1283 * The website URL string. 1284 * <P>Type: TEXT</P> 1285 */ 1286 public static final String URL = "data1"; 1287 } 1288 } 1289 1290 public interface GroupsColumns { 1291 /** 1292 * The display title of this group. 1293 * <p> 1294 * Type: TEXT 1295 */ 1296 public static final String TITLE = "title"; 1297 1298 /** 1299 * The package name to use when creating {@link Resources} objects for 1300 * this group. This value is only designed for use when building user 1301 * interfaces, and should not be used to infer the owner. 1302 */ 1303 public static final String RES_PACKAGE = "res_package"; 1304 1305 /** 1306 * The display title of this group to load as a resource from 1307 * {@link #RES_PACKAGE}, which may be localized. 1308 * <P>Type: TEXT</P> 1309 */ 1310 public static final String TITLE_RES = "title_res"; 1311 1312 /** 1313 * Notes about the group. 1314 * <p> 1315 * Type: TEXT 1316 */ 1317 public static final String NOTES = "notes"; 1318 1319 /** 1320 * The ID of this group if it is a System Group, i.e. a group that has a special meaning 1321 * to the sync adapter, null otherwise. 1322 * <P>Type: TEXT</P> 1323 */ 1324 public static final String SYSTEM_ID = "system_id"; 1325 1326 /** 1327 * The total number of {@link Contacts} that have 1328 * {@link GroupMembership} in this group. Read-only value that is only 1329 * present when querying {@link Groups#CONTENT_SUMMARY_URI}. 1330 * <p> 1331 * Type: INTEGER 1332 */ 1333 public static final String SUMMARY_COUNT = "summ_count"; 1334 1335 /** 1336 * The total number of {@link Contacts} that have both 1337 * {@link GroupMembership} in this group, and also have phone numbers. 1338 * Read-only value that is only present when querying 1339 * {@link Groups#CONTENT_SUMMARY_URI}. 1340 * <p> 1341 * Type: INTEGER 1342 */ 1343 public static final String SUMMARY_WITH_PHONES = "summ_phones"; 1344 1345 /** 1346 * Flag indicating if the contacts belonging to this group should be 1347 * visible in any user interface. 1348 * <p> 1349 * Type: INTEGER 1350 */ 1351 public static final String GROUP_VISIBLE = "group_visible"; 1352 1353 /** 1354 * The "deleted" flag: "0" by default, "1" if the row has been marked 1355 * for deletion. When {@link android.content.ContentResolver#delete} is 1356 * called on a raw contact, it is marked for deletion and removed from its 1357 * aggregate contact. The sync adaptor deletes the raw contact on the server and 1358 * then calls ContactResolver.delete once more, this time passing the 1359 * {@link RawContacts#DELETE_PERMANENTLY} query parameter to finalize the data removal. 1360 * <P>Type: INTEGER</P> 1361 */ 1362 public static final String DELETED = "deleted"; 1363 } 1364 1365 /** 1366 * Constants for the groups table. 1367 */ 1368 public static final class Groups implements BaseColumns, GroupsColumns, SyncColumns { 1369 /** 1370 * This utility class cannot be instantiated 1371 */ 1372 private Groups() { 1373 } 1374 1375 /** 1376 * The content:// style URI for this table 1377 */ 1378 public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "groups"); 1379 1380 /** 1381 * The content:// style URI for this table joined with details data from 1382 * {@link Data}. 1383 */ 1384 public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI, 1385 "groups_summary"); 1386 1387 /** 1388 * The MIME type of a directory of groups. 1389 */ 1390 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/group"; 1391 1392 /** 1393 * The MIME type of a single group. 1394 */ 1395 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group"; 1396 1397 /** 1398 * Query parameter that can be passed with the {@link #CONTENT_URI} URI 1399 * to the {@link android.content.ContentResolver#delete} method to 1400 * indicate that the raw contact can be deleted physically, rather than 1401 * merely marked as deleted. 1402 */ 1403 public static final String DELETE_PERMANENTLY = "delete_permanently"; 1404 1405 /** 1406 * An optional update or insert URI parameter that determines if the 1407 * group should be marked as dirty. The default value is true. 1408 */ 1409 public static final String MARK_AS_DIRTY = "mark_as_dirty"; 1410 } 1411 1412 /** 1413 * Constants for the contact aggregation exceptions table, which contains 1414 * aggregation rules overriding those used by automatic aggregation. This type only 1415 * supports query and update. Neither insert nor delete are supported. 1416 */ 1417 public static final class AggregationExceptions implements BaseColumns { 1418 /** 1419 * This utility class cannot be instantiated 1420 */ 1421 private AggregationExceptions() {} 1422 1423 /** 1424 * The content:// style URI for this table 1425 */ 1426 public static final Uri CONTENT_URI = 1427 Uri.withAppendedPath(AUTHORITY_URI, "aggregation_exceptions"); 1428 1429 /** 1430 * The MIME type of {@link #CONTENT_URI} providing a directory of data. 1431 */ 1432 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception"; 1433 1434 /** 1435 * The MIME type of a {@link #CONTENT_URI} subdirectory of an aggregation exception 1436 */ 1437 public static final String CONTENT_ITEM_TYPE = 1438 "vnd.android.cursor.item/aggregation_exception"; 1439 1440 /** 1441 * The type of exception: {@link #TYPE_KEEP_IN}, {@link #TYPE_KEEP_OUT} or 1442 * {@link #TYPE_AUTOMATIC}. 1443 * 1444 * <P>Type: INTEGER</P> 1445 */ 1446 public static final String TYPE = "type"; 1447 1448 /** 1449 * Allows the provider to automatically decide whether the aggregate 1450 * contact should include a particular raw contact or not. 1451 */ 1452 public static final int TYPE_AUTOMATIC = 0; 1453 1454 /** 1455 * Makes sure that the specified raw contact is included in the 1456 * specified aggregate contact. 1457 */ 1458 public static final int TYPE_KEEP_IN = 1; 1459 1460 /** 1461 * Makes sure that the specified raw contact is NOT included in the 1462 * specified aggregate contact. 1463 */ 1464 public static final int TYPE_KEEP_OUT = 2; 1465 1466 /** 1467 * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} of the 1468 * aggregate contact that the rule applies to. 1469 */ 1470 public static final String CONTACT_ID = "contact_id"; 1471 1472 /** 1473 * A reference to the {@link RawContacts#_ID} of the raw contact that the rule applies to. 1474 */ 1475 public static final String RAW_CONTACT_ID = "raw_contact_id"; 1476 } 1477 1478 /** 1479 * Contains helper classes used to create or manage {@link android.content.Intent Intents} 1480 * that involve contacts. 1481 */ 1482 public static final class Intents { 1483 /** 1484 * This is the intent that is fired when a search suggestion is clicked on. 1485 */ 1486 public static final String SEARCH_SUGGESTION_CLICKED = 1487 "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED"; 1488 1489 /** 1490 * This is the intent that is fired when a search suggestion for dialing a number 1491 * is clicked on. 1492 */ 1493 public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = 1494 "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED"; 1495 1496 /** 1497 * This is the intent that is fired when a search suggestion for creating a contact 1498 * is clicked on. 1499 */ 1500 public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = 1501 "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED"; 1502 1503 /** 1504 * Starts an Activity that lets the user pick a contact to attach an image to. 1505 * After picking the contact it launches the image cropper in face detection mode. 1506 */ 1507 public static final String ATTACH_IMAGE = 1508 "com.android.contacts.action.ATTACH_IMAGE"; 1509 1510 /** 1511 * Takes as input a data URI with a mailto: or tel: scheme. If a single 1512 * contact exists with the given data it will be shown. If no contact 1513 * exists, a dialog will ask the user if they want to create a new 1514 * contact with the provided details filled in. If multiple contacts 1515 * share the data the user will be prompted to pick which contact they 1516 * want to view. 1517 * <p> 1518 * For <code>mailto:</code> URIs, the scheme specific portion must be a 1519 * raw email address, such as one built using 1520 * {@link Uri#fromParts(String, String, String)}. 1521 * <p> 1522 * For <code>tel:</code> URIs, the scheme specific portion is compared 1523 * to existing numbers using the standard caller ID lookup algorithm. 1524 * The number must be properly encoded, for example using 1525 * {@link Uri#fromParts(String, String, String)}. 1526 * <p> 1527 * Any extras from the {@link Insert} class will be passed along to the 1528 * create activity if there are no contacts to show. 1529 * <p> 1530 * Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip 1531 * prompting the user when the contact doesn't exist. 1532 */ 1533 public static final String SHOW_OR_CREATE_CONTACT = 1534 "com.android.contacts.action.SHOW_OR_CREATE_CONTACT"; 1535 1536 /** 1537 * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new 1538 * contact if no matching contact found. Otherwise, default behavior is 1539 * to prompt user with dialog before creating. 1540 * <p> 1541 * Type: BOOLEAN 1542 */ 1543 public static final String EXTRA_FORCE_CREATE = 1544 "com.android.contacts.action.FORCE_CREATE"; 1545 1546 /** 1547 * Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact 1548 * description to be shown when prompting user about creating a new 1549 * contact. 1550 * <p> 1551 * Type: STRING 1552 */ 1553 public static final String EXTRA_CREATE_DESCRIPTION = 1554 "com.android.contacts.action.CREATE_DESCRIPTION"; 1555 1556 /** 1557 * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a 1558 * dialog location using screen coordinates. When not specified, the 1559 * dialog will be centered. 1560 */ 1561 public static final String EXTRA_TARGET_RECT = "target_rect"; 1562 1563 /** 1564 * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a 1565 * desired dialog style, usually a variation on size. One of 1566 * {@link #MODE_SMALL}, {@link #MODE_MEDIUM}, or {@link #MODE_LARGE}. 1567 */ 1568 public static final String EXTRA_MODE = "mode"; 1569 1570 /** 1571 * Value for {@link #EXTRA_MODE} to show a small-sized dialog. 1572 */ 1573 public static final int MODE_SMALL = 1; 1574 1575 /** 1576 * Value for {@link #EXTRA_MODE} to show a medium-sized dialog. 1577 */ 1578 public static final int MODE_MEDIUM = 2; 1579 1580 /** 1581 * Value for {@link #EXTRA_MODE} to show a large-sized dialog. 1582 */ 1583 public static final int MODE_LARGE = 3; 1584 1585 /** 1586 * Intents related to the Contacts app UI. 1587 */ 1588 public static final class UI { 1589 /** 1590 * The action for the default contacts list tab. 1591 */ 1592 public static final String LIST_DEFAULT = 1593 "com.android.contacts.action.LIST_DEFAULT"; 1594 1595 /** 1596 * The action for the contacts list tab. 1597 */ 1598 public static final String LIST_GROUP_ACTION = 1599 "com.android.contacts.action.LIST_GROUP"; 1600 1601 /** 1602 * When in LIST_GROUP_ACTION mode, this is the group to display. 1603 */ 1604 public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP"; 1605 1606 /** 1607 * The action for the all contacts list tab. 1608 */ 1609 public static final String LIST_ALL_CONTACTS_ACTION = 1610 "com.android.contacts.action.LIST_ALL_CONTACTS"; 1611 1612 /** 1613 * The action for the contacts with phone numbers list tab. 1614 */ 1615 public static final String LIST_CONTACTS_WITH_PHONES_ACTION = 1616 "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES"; 1617 1618 /** 1619 * The action for the starred contacts list tab. 1620 */ 1621 public static final String LIST_STARRED_ACTION = 1622 "com.android.contacts.action.LIST_STARRED"; 1623 1624 /** 1625 * The action for the frequent contacts list tab. 1626 */ 1627 public static final String LIST_FREQUENT_ACTION = 1628 "com.android.contacts.action.LIST_FREQUENT"; 1629 1630 /** 1631 * The action for the "strequent" contacts list tab. It first lists the starred 1632 * contacts in alphabetical order and then the frequent contacts in descending 1633 * order of the number of times they have been contacted. 1634 */ 1635 public static final String LIST_STREQUENT_ACTION = 1636 "com.android.contacts.action.LIST_STREQUENT"; 1637 1638 /** 1639 * A key for to be used as an intent extra to set the activity 1640 * title to a custom String value. 1641 */ 1642 public static final String TITLE_EXTRA_KEY = 1643 "com.android.contacts.extra.TITLE_EXTRA"; 1644 1645 /** 1646 * Activity Action: Display a filtered list of contacts 1647 * <p> 1648 * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for 1649 * filtering 1650 * <p> 1651 * Output: Nothing. 1652 */ 1653 public static final String FILTER_CONTACTS_ACTION = 1654 "com.android.contacts.action.FILTER_CONTACTS"; 1655 1656 /** 1657 * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION} 1658 * intents to supply the text on which to filter. 1659 */ 1660 public static final String FILTER_TEXT_EXTRA_KEY = 1661 "com.android.contacts.extra.FILTER_TEXT"; 1662 } 1663 1664 /** 1665 * Convenience class that contains string constants used 1666 * to create contact {@link android.content.Intent Intents}. 1667 */ 1668 public static final class Insert { 1669 /** The action code to use when adding a contact */ 1670 public static final String ACTION = Intent.ACTION_INSERT; 1671 1672 /** 1673 * If present, forces a bypass of quick insert mode. 1674 */ 1675 public static final String FULL_MODE = "full_mode"; 1676 1677 /** 1678 * The extra field for the contact name. 1679 * <P>Type: String</P> 1680 */ 1681 public static final String NAME = "name"; 1682 1683 // TODO add structured name values here. 1684 1685 /** 1686 * The extra field for the contact phonetic name. 1687 * <P>Type: String</P> 1688 */ 1689 public static final String PHONETIC_NAME = "phonetic_name"; 1690 1691 /** 1692 * The extra field for the contact company. 1693 * <P>Type: String</P> 1694 */ 1695 public static final String COMPANY = "company"; 1696 1697 /** 1698 * The extra field for the contact job title. 1699 * <P>Type: String</P> 1700 */ 1701 public static final String JOB_TITLE = "job_title"; 1702 1703 /** 1704 * The extra field for the contact notes. 1705 * <P>Type: String</P> 1706 */ 1707 public static final String NOTES = "notes"; 1708 1709 /** 1710 * The extra field for the contact phone number. 1711 * <P>Type: String</P> 1712 */ 1713 public static final String PHONE = "phone"; 1714 1715 /** 1716 * The extra field for the contact phone number type. 1717 * <P>Type: Either an integer value from 1718 * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, 1719 * or a string specifying a custom label.</P> 1720 */ 1721 public static final String PHONE_TYPE = "phone_type"; 1722 1723 /** 1724 * The extra field for the phone isprimary flag. 1725 * <P>Type: boolean</P> 1726 */ 1727 public static final String PHONE_ISPRIMARY = "phone_isprimary"; 1728 1729 /** 1730 * The extra field for an optional second contact phone number. 1731 * <P>Type: String</P> 1732 */ 1733 public static final String SECONDARY_PHONE = "secondary_phone"; 1734 1735 /** 1736 * The extra field for an optional second contact phone number type. 1737 * <P>Type: Either an integer value from 1738 * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, 1739 * or a string specifying a custom label.</P> 1740 */ 1741 public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type"; 1742 1743 /** 1744 * The extra field for an optional third contact phone number. 1745 * <P>Type: String</P> 1746 */ 1747 public static final String TERTIARY_PHONE = "tertiary_phone"; 1748 1749 /** 1750 * The extra field for an optional third contact phone number type. 1751 * <P>Type: Either an integer value from 1752 * {@link android.provider.Contacts.PhonesColumns PhonesColumns}, 1753 * or a string specifying a custom label.</P> 1754 */ 1755 public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type"; 1756 1757 /** 1758 * The extra field for the contact email address. 1759 * <P>Type: String</P> 1760 */ 1761 public static final String EMAIL = "email"; 1762 1763 /** 1764 * The extra field for the contact email type. 1765 * <P>Type: Either an integer value from 1766 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 1767 * or a string specifying a custom label.</P> 1768 */ 1769 public static final String EMAIL_TYPE = "email_type"; 1770 1771 /** 1772 * The extra field for the email isprimary flag. 1773 * <P>Type: boolean</P> 1774 */ 1775 public static final String EMAIL_ISPRIMARY = "email_isprimary"; 1776 1777 /** 1778 * The extra field for an optional second contact email address. 1779 * <P>Type: String</P> 1780 */ 1781 public static final String SECONDARY_EMAIL = "secondary_email"; 1782 1783 /** 1784 * The extra field for an optional second contact email type. 1785 * <P>Type: Either an integer value from 1786 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 1787 * or a string specifying a custom label.</P> 1788 */ 1789 public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type"; 1790 1791 /** 1792 * The extra field for an optional third contact email address. 1793 * <P>Type: String</P> 1794 */ 1795 public static final String TERTIARY_EMAIL = "tertiary_email"; 1796 1797 /** 1798 * The extra field for an optional third contact email type. 1799 * <P>Type: Either an integer value from 1800 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 1801 * or a string specifying a custom label.</P> 1802 */ 1803 public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type"; 1804 1805 /** 1806 * The extra field for the contact postal address. 1807 * <P>Type: String</P> 1808 */ 1809 public static final String POSTAL = "postal"; 1810 1811 /** 1812 * The extra field for the contact postal address type. 1813 * <P>Type: Either an integer value from 1814 * {@link android.provider.Contacts.ContactMethodsColumns ContactMethodsColumns} 1815 * or a string specifying a custom label.</P> 1816 */ 1817 public static final String POSTAL_TYPE = "postal_type"; 1818 1819 /** 1820 * The extra field for the postal isprimary flag. 1821 * <P>Type: boolean</P> 1822 */ 1823 public static final String POSTAL_ISPRIMARY = "postal_isprimary"; 1824 1825 /** 1826 * The extra field for an IM handle. 1827 * <P>Type: String</P> 1828 */ 1829 public static final String IM_HANDLE = "im_handle"; 1830 1831 /** 1832 * The extra field for the IM protocol 1833 * <P>Type: the result of {@link CommonDataKinds.Im#encodePredefinedImProtocol(int)} 1834 * or {@link CommonDataKinds.Im#encodeCustomImProtocol(String)}.</P> 1835 */ 1836 public static final String IM_PROTOCOL = "im_protocol"; 1837 1838 /** 1839 * The extra field for the IM isprimary flag. 1840 * <P>Type: boolean</P> 1841 */ 1842 public static final String IM_ISPRIMARY = "im_isprimary"; 1843 } 1844 } 1845 1846} 1847