1088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar/*
2088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar * Copyright (C) 2009 The Android Open Source Project
3088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar *
4088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar * Licensed under the Apache License, Version 2.0 (the "License");
5088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar * you may not use this file except in compliance with the License.
6088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar * You may obtain a copy of the License at
7088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar *
8088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar *      http://www.apache.org/licenses/LICENSE-2.0
9088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar *
10088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar * Unless required by applicable law or agreed to in writing, software
11088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar * distributed under the License is distributed on an "AS IS" BASIS,
12088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar * See the License for the specific language governing permissions and
14088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar * limitations under the License
15088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar */
16088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
17088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millarpackage android.provider;
18088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
197b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkeyimport android.accounts.Account;
20e6d3d28a6b9a2a15d141ba2d44d7a33bb9c1f04aDaniel Lehmannimport android.app.Activity;
210f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintanaimport android.content.ContentProviderClient;
220f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintanaimport android.content.ContentProviderOperation;
233c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikovimport android.content.ContentResolver;
24f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikovimport android.content.ContentUris;
2585abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamiltonimport android.content.ContentValues;
269303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikovimport android.content.Context;
27328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintanaimport android.content.CursorEntityIterator;
28328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintanaimport android.content.Entity;
29244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neillimport android.content.EntityIterator;
30244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neillimport android.content.Intent;
31f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmannimport android.content.res.AssetFileDescriptor;
328a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkeyimport android.content.res.Resources;
333c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikovimport android.database.Cursor;
34328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintanaimport android.database.DatabaseUtils;
356449eb06acc934ba4007475680f236721181ee47Jeff Sharkeyimport android.graphics.Rect;
36088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millarimport android.net.Uri;
379fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelsonimport android.os.Bundle;
380f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintanaimport android.os.RemoteException;
399303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikovimport android.text.TextUtils;
40a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkeyimport android.util.DisplayMetrics;
41c4516a7b62de525e3d6d5e76851bdfaf12c11f05Fred Quintanaimport android.util.Pair;
426449eb06acc934ba4007475680f236721181ee47Jeff Sharkeyimport android.view.View;
43088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
443c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikovimport java.io.ByteArrayInputStream;
45f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmannimport java.io.IOException;
463c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikovimport java.io.InputStream;
4744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikovimport java.util.ArrayList;
489fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelsonimport java.util.List;
499fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelsonimport java.util.regex.Matcher;
509fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelsonimport java.util.regex.Pattern;
513c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov
52088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar/**
53dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * <p>
54dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * The contract between the contacts provider and applications. Contains
55dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * definitions for the supported URIs and columns. These APIs supersede
56dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * {@link Contacts}.
57dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * </p>
58dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * <h3>Overview</h3>
59dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * <p>
60dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * ContactsContract defines an extensible database of contact-related
61dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * information. Contact information is stored in a three-tier data model:
62dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * </p>
634e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <ul>
644e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <li>
65d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * A row in the {@link Data} table can store any kind of personal data, such
66d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * as a phone number or email addresses.  The set of data kinds that can be
67d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * stored in this table is open-ended. There is a predefined set of common
68d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * kinds, but any application can add its own data kinds.
694e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * </li>
704e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <li>
71d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * A row in the {@link RawContacts} table represents a set of data describing a
72d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * person and associated with a single account (for example, one of the user's
73d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * Gmail accounts).
744e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * </li>
754e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <li>
76dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * A row in the {@link Contacts} table represents an aggregate of one or more
77d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * RawContacts presumably describing the same person.  When data in or associated with
78d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * the RawContacts table is changed, the affected aggregate contacts are updated as
79d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * necessary.
804e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * </li>
814e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * </ul>
82dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * <p>
83dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * Other tables include:
84dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * </p>
854e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <ul>
864e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <li>
87d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * {@link Groups}, which contains information about raw contact groups
88d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill * such as Gmail contact groups.  The
89dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * current API does not support the notion of groups spanning multiple accounts.
904e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * </li>
914e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <li>
92dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * {@link StatusUpdates}, which contains social status updates including IM
93dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * availability.
944e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * </li>
954e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <li>
96dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * {@link AggregationExceptions}, which is used for manual aggregation and
97dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * disaggregation of raw contacts
984e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * </li>
994e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <li>
100dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * {@link Settings}, which contains visibility and sync settings for accounts
101dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * and groups.
1024e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * </li>
1034e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <li>
104dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * {@link SyncState}, which contains free-form data maintained on behalf of sync
105dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov * adapters
1064e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * </li>
1074e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * <li>
1084e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * {@link PhoneLookup}, which is used for quick caller-ID lookup</li>
1094e7db256878bbf2058fa7d1bf07ddbe1c7206103Dirk Dougherty * </ul>
110088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar */
1110c23212ebdfbe008aca95d2ace2e52ca0a0b7ec7Jeff Hamilton@SuppressWarnings("unused")
112088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millarpublic final class ContactsContract {
113088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    /** The authority for the contacts provider */
114088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    public static final String AUTHORITY = "com.android.contacts";
115088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    /** A content:// style uri to the authority for the contacts provider */
116088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
117088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
11833f889ae270f888f8fdc084f5f1f3d443532a46aFred Quintana    /**
119d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * An optional URI parameter for insert, update, or delete queries
120d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * that allows the caller
12133f889ae270f888f8fdc084f5f1f3d443532a46aFred Quintana     * to specify that it is a sync adapter. The default value is false. If true
122d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * {@link RawContacts#DIRTY} is not automatically set and the
123d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * "syncToNetwork" parameter is set to false when calling
124d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * {@link
125d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * ContentResolver#notifyChange(android.net.Uri, android.database.ContentObserver, boolean)}.
126d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * This prevents an unnecessary extra synchronization, see the discussion of
127d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * the delete operation in {@link RawContacts}.
12833f889ae270f888f8fdc084f5f1f3d443532a46aFred Quintana     */
12933f889ae270f888f8fdc084f5f1f3d443532a46aFred Quintana    public static final String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter";
13033f889ae270f888f8fdc084f5f1f3d443532a46aFred Quintana
13185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton    /**
132a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * Query parameter that should be used by the client to access a specific
133a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * {@link Directory}. The parameter value should be the _ID of the corresponding
134a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * directory, e.g.
135a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * {@code content://com.android.contacts/data/emails/filter/acme?directory=3}
136a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     */
137a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov    public static final String DIRECTORY_PARAM_KEY = "directory";
138a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
139a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov    /**
1405a998dd2301b66fab7ad1daaac3df8088108d8ebDmitri Plotnikov     * A query parameter that limits the number of results returned. The
1415a998dd2301b66fab7ad1daaac3df8088108d8ebDmitri Plotnikov     * parameter value should be an integer.
1425a998dd2301b66fab7ad1daaac3df8088108d8ebDmitri Plotnikov     */
1435a998dd2301b66fab7ad1daaac3df8088108d8ebDmitri Plotnikov    public static final String LIMIT_PARAM_KEY = "limit";
1445a998dd2301b66fab7ad1daaac3df8088108d8ebDmitri Plotnikov
1455a998dd2301b66fab7ad1daaac3df8088108d8ebDmitri Plotnikov    /**
14654fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     * A query parameter specifing a primary account. This parameter should be used with
14754fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     * {@link #PRIMARY_ACCOUNT_TYPE}. The contacts provider handling a query may rely on
14854fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     * this information to optimize its query results.
14954fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     *
15054fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     * For example, in an email composition screen, its implementation can specify an account when
15154fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     * obtaining possible recipients, letting the provider know which account is selected during
15254fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     * the composition. The provider may use the "primary account" information to optimize
15354fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     * the search result.
15454fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     */
15554fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa    public static final String PRIMARY_ACCOUNT_NAME = "name_for_primary_account";
15654fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa
15754fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa    /**
15854fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     * A query parameter specifing a primary account. This parameter should be used with
15954fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     * {@link #PRIMARY_ACCOUNT_NAME}. See the doc in {@link #PRIMARY_ACCOUNT_NAME}.
16054fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa     */
16154fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa    public static final String PRIMARY_ACCOUNT_TYPE = "type_for_primary_account";
16254fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa
163f468591cafb797a494d09bb0dd6adfcc439e7b8cDaisuke Miyakawa    /**
164f468591cafb797a494d09bb0dd6adfcc439e7b8cDaisuke Miyakawa     * A boolean parameter for {@link Contacts#CONTENT_STREQUENT_URI} and
165f468591cafb797a494d09bb0dd6adfcc439e7b8cDaisuke Miyakawa     * {@link Contacts#CONTENT_STREQUENT_FILTER_URI}, which requires the ContactsProvider to
166f468591cafb797a494d09bb0dd6adfcc439e7b8cDaisuke Miyakawa     * return only phone-related results. For example, frequently contacted person list should
167f468591cafb797a494d09bb0dd6adfcc439e7b8cDaisuke Miyakawa     * include persons contacted via phone (not email, sms, etc.)
168f468591cafb797a494d09bb0dd6adfcc439e7b8cDaisuke Miyakawa     *
169f468591cafb797a494d09bb0dd6adfcc439e7b8cDaisuke Miyakawa     * @hide
170f468591cafb797a494d09bb0dd6adfcc439e7b8cDaisuke Miyakawa     */
171f468591cafb797a494d09bb0dd6adfcc439e7b8cDaisuke Miyakawa    public static final String STREQUENT_PHONE_ONLY = "strequent_phone_only";
17254fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa
17354fcd4c81fe5b912f22ff7932cc171d0b1740926Daisuke Miyakawa    /**
1749fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * A key to a boolean in the "extras" bundle of the cursor.
1759fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * The boolean indicates that the provider did not create a snippet and that the client asking
1769fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * for the snippet should do it (true means the snippeting was deferred to the client).
1779fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     *
1789fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @hide
1799fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     */
1809fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    public static final String DEFERRED_SNIPPETING = "deferred_snippeting";
1819fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
1829fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    /**
1839fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * Key to retrieve the original query on the client side.
1849fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     *
1859fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @hide
1869fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     */
1879fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    public static final String DEFERRED_SNIPPETING_QUERY = "deferred_snippeting_query";
1889fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
1899fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    /**
19019352e08528a621c94284acdf2888ba5e6689eb6Daisuke Miyakawa     * A boolean parameter for {@link CommonDataKinds.Phone#CONTENT_URI},
19119352e08528a621c94284acdf2888ba5e6689eb6Daisuke Miyakawa     * {@link CommonDataKinds.Email#CONTENT_URI}, and
19219352e08528a621c94284acdf2888ba5e6689eb6Daisuke Miyakawa     * {@link CommonDataKinds.StructuredPostal#CONTENT_URI}.
19319352e08528a621c94284acdf2888ba5e6689eb6Daisuke Miyakawa     * This enables a content provider to remove duplicate entries in results.
19419352e08528a621c94284acdf2888ba5e6689eb6Daisuke Miyakawa     *
19519352e08528a621c94284acdf2888ba5e6689eb6Daisuke Miyakawa     * @hide
19619352e08528a621c94284acdf2888ba5e6689eb6Daisuke Miyakawa     */
19719352e08528a621c94284acdf2888ba5e6689eb6Daisuke Miyakawa    public static final String REMOVE_DUPLICATE_ENTRIES = "remove_duplicate_entries";
19819352e08528a621c94284acdf2888ba5e6689eb6Daisuke Miyakawa
19919352e08528a621c94284acdf2888ba5e6689eb6Daisuke Miyakawa    /**
200e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * <p>
201e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * API for obtaining a pre-authorized version of a URI that normally requires special
202e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * permission (beyond READ_CONTACTS) to read.  The caller obtaining the pre-authorized URI
203e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * must already have the necessary permissions to access the URI; otherwise a
204e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * {@link SecurityException} will be thrown.
205e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * </p>
206e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * <p>
207e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * The authorized URI returned in the bundle contains an expiring token that allows the
208e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * caller to execute the query without having the special permissions that would normally
209e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * be required.
210e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * </p>
211e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * <p>
212e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * This API does not access disk, and should be safe to invoke from the UI thread.
213e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * </p>
214e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * <p>
215e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * Example usage:
216e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * <pre>
217e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * Uri profileUri = ContactsContract.Profile.CONTENT_VCARD_URI;
218e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * Bundle uriBundle = new Bundle();
219e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * uriBundle.putParcelable(ContactsContract.Authorization.KEY_URI_TO_AUTHORIZE, uri);
220e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * Bundle authResponse = getContext().getContentResolver().call(
221e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     *         ContactsContract.AUTHORITY_URI,
222e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     *         ContactsContract.Authorization.AUTHORIZATION_METHOD,
223e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     *         null, // String arg, not used.
224e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     *         uriBundle);
225e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * if (authResponse != null) {
226e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     *     Uri preauthorizedProfileUri = (Uri) authResponse.getParcelable(
227e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     *             ContactsContract.Authorization.KEY_AUTHORIZED_URI);
228e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     *     // This pre-authorized URI can be queried by a caller without READ_PROFILE
229e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     *     // permission.
230e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * }
231e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * </pre>
232e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * </p>
233e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     * @hide
234e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro     */
235e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro    public static final class Authorization {
236e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro        /**
237e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro         * The method to invoke to create a pre-authorized URI out of the input argument.
238e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro         */
239e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro        public static final String AUTHORIZATION_METHOD = "authorize";
240e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro
241e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro        /**
242e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro         * The key to set in the outbound Bundle with the URI that should be authorized.
243e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro         */
244e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro        public static final String KEY_URI_TO_AUTHORIZE = "uri_to_authorize";
245e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro
246e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro        /**
247e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro         * The key to retrieve from the returned Bundle to obtain the pre-authorized URI.
248e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro         */
249e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro        public static final String KEY_AUTHORIZED_URI = "authorized_uri";
250e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro    }
251e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro
252e43185e21d343741b1d98d1024db8f9703e78553Dave Santoro    /**
2532a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov     * @hide
2542a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov     */
2552a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov    public static final class Preferences {
2562a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov
2572a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        /**
2582a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * A key in the {@link android.provider.Settings android.provider.Settings} provider
2592a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * that stores the preferred sorting order for contacts (by given name vs. by family name).
2602a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         *
2612a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * @hide
2622a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         */
2632a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        public static final String SORT_ORDER = "android.contacts.SORT_ORDER";
2642a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov
2652a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        /**
2662a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * The value for the SORT_ORDER key corresponding to sorting by given name first.
2672a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         *
2682a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * @hide
2692a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         */
2702a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        public static final int SORT_ORDER_PRIMARY = 1;
2712a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov
2722a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        /**
2732a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * The value for the SORT_ORDER key corresponding to sorting by family name first.
2742a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         *
2752a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * @hide
2762a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         */
2772a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        public static final int SORT_ORDER_ALTERNATIVE = 2;
2782a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov
2792a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        /**
2802a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * A key in the {@link android.provider.Settings android.provider.Settings} provider
2812a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * that stores the preferred display order for contacts (given name first vs. family
2822a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * name first).
2832a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         *
2842a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * @hide
2852a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         */
2862a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        public static final String DISPLAY_ORDER = "android.contacts.DISPLAY_ORDER";
2872a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov
2882a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        /**
2892a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * The value for the DISPLAY_ORDER key corresponding to showing the given name first.
2902a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         *
2912a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * @hide
2922a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         */
2932a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        public static final int DISPLAY_ORDER_PRIMARY = 1;
2942a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov
2952a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        /**
2962a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * The value for the DISPLAY_ORDER key corresponding to showing the family name first.
2972a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         *
2982a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * @hide
2992a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         */
3002a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov        public static final int DISPLAY_ORDER_ALTERNATIVE = 2;
3012a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov    }
3022a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov
3032a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov    /**
304a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * A Directory represents a contacts corpus, e.g. Local contacts,
305a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * Google Apps Global Address List or Corporate Global Address List.
306a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
307a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * A Directory is implemented as a content provider with its unique authority and
308a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * the same API as the main Contacts Provider.  However, there is no expectation that
309a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * every directory provider will implement this Contract in its entirety.  If a
310a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * directory provider does not have an implementation for a specific request, it
311a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * should throw an UnsupportedOperationException.
312a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </p>
313a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
314a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * The most important use case for Directories is search.  A Directory provider is
31513e0357ec1d816860a7ca16fd304194b7f7ab818Dmitri Plotnikov     * expected to support at least {@link ContactsContract.Contacts#CONTENT_FILTER_URI
31613e0357ec1d816860a7ca16fd304194b7f7ab818Dmitri Plotnikov     * Contacts.CONTENT_FILTER_URI}.  If a Directory provider wants to participate
317a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * in email and phone lookup functionalities, it should also implement
318a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * {@link CommonDataKinds.Email#CONTENT_FILTER_URI CommonDataKinds.Email.CONTENT_FILTER_URI}
319a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * and
320a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * {@link CommonDataKinds.Phone#CONTENT_FILTER_URI CommonDataKinds.Phone.CONTENT_FILTER_URI}.
321a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </p>
322a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
323a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * A directory provider should return NULL for every projection field it does not
324a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * recognize, rather than throwing an exception.  This way it will not be broken
325a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * if ContactsContract is extended with new fields in the future.
326a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </p>
327a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
328a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * The client interacts with a directory via Contacts Provider by supplying an
329a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * optional {@code directory=} query parameter.
330a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
331a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
332a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * When the Contacts Provider receives the request, it transforms the URI and forwards
333a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * the request to the corresponding directory content provider.
334a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * The URI is transformed in the following fashion:
335a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <ul>
336a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <li>The URI authority is replaced with the corresponding {@link #DIRECTORY_AUTHORITY}.</li>
337a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <li>The {@code accountName=} and {@code accountType=} parameters are added or
338a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * replaced using the corresponding {@link #ACCOUNT_TYPE} and {@link #ACCOUNT_NAME} values.</li>
339a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </ul>
340a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </p>
341a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
342a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * Clients should send directory requests to Contacts Provider and let it
3432ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * forward them to the respective providers rather than constructing
3442ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * directory provider URIs by themselves. This level of indirection allows
3452ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * Contacts Provider to implement additional system-level features and
3462ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * optimizations. Access to Contacts Provider is protected by the
3472ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * READ_CONTACTS permission, but access to the directory provider is not.
3482ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * Therefore directory providers must reject requests coming from clients
3492ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * other than the Contacts Provider itself. An easy way to prevent such
3502ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * unauthorized access is to check the name of the calling package:
3512ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * <pre>
3522ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * private boolean isCallerAllowed() {
3532ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     *   PackageManager pm = getContext().getPackageManager();
3542ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     *   for (String packageName: pm.getPackagesForUid(Binder.getCallingUid())) {
3552ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     *     if (packageName.equals("com.android.providers.contacts")) {
3562ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     *       return true;
3572ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     *     }
3582ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     *   }
3592ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     *   return false;
3602ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * }
3612ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * </pre>
362a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </p>
363a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
3642ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * The Directory table is read-only and is maintained by the Contacts Provider
3652ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * automatically.
3662ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * </p>
3672ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * <p>It always has at least these two rows:
368a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <ul>
369a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <li>
370a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * The local directory. It has {@link Directory#_ID Directory._ID} =
371a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * {@link Directory#DEFAULT Directory.DEFAULT}. This directory can be used to access locally
372a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * stored contacts. The same can be achieved by omitting the {@code directory=}
373a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * parameter altogether.
374a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </li>
375a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <li>
376a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * The local invisible contacts. The corresponding directory ID is
377a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * {@link Directory#LOCAL_INVISIBLE Directory.LOCAL_INVISIBLE}.
378a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </li>
379a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </ul>
380a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </p>
3812ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * <p>Custom Directories are discovered by the Contacts Provider following this procedure:
3822ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * <ul>
3832ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * <li>It finds all installed content providers with meta data identifying them
3842ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * as directory providers in AndroidManifest.xml:
3852ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * <code>
3862ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * &lt;meta-data android:name="android.content.ContactDirectory"
3872ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     *               android:value="true" /&gt;
3882ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * </code>
389a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
3902ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * This tag should be placed inside the corresponding content provider declaration.
3912ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * </p>
3922ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * </li>
3932ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * <li>
3942ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * Then Contacts Provider sends a {@link Directory#CONTENT_URI Directory.CONTENT_URI}
3952ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * query to each of the directory authorities.  A directory provider must implement
3962ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * this query and return a list of directories.  Each directory returned by
3972ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * the provider must have a unique combination for the {@link #ACCOUNT_NAME} and
3982ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * {@link #ACCOUNT_TYPE} columns (nulls are allowed).  Since directory IDs are assigned
3992ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * automatically, the _ID field will not be part of the query projection.
4002ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * </li>
4012ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * <li>Contacts Provider compiles directory lists received from all directory
4022ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * providers into one, assigns each individual directory a globally unique ID and
4032ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * stores all directory records in the Directory table.
4042ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * </li>
4052ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * </ul>
4062ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * </p>
4072ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * <p>Contacts Provider automatically interrogates newly installed or replaced packages.
4082ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * Thus simply installing a package containing a directory provider is sufficient
4092ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * to have that provider registered.  A package supplying a directory provider does
4102ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * not have to contain launchable activities.
411a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </p>
412a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
4132ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * Every row in the Directory table is automatically associated with the corresponding package
4142ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * (apk).  If the package is later uninstalled, all corresponding directory rows
4152ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * are automatically removed from the Contacts Provider.
416a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </p>
417a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * <p>
4182ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * When the list of directories handled by a directory provider changes
4192ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * (for instance when the user adds a new Directory account), the directory provider
4202ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * should call {@link #notifyDirectoryChange} to notify the Contacts Provider of the change.
4212ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * In response, the Contacts Provider will requery the directory provider to obtain the
4222ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * new list of directories.
4232ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * </p>
4242ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * <p>
4252ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * A directory row can be optionally associated with an existing account
4262ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov     * (see {@link android.accounts.AccountManager}). If the account is later removed,
427e50ed08afc1ee80409d471753bb6c0930feae999Dmitri Plotnikov     * the corresponding directory rows are automatically removed from the Contacts Provider.
428a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     * </p>
429a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov     */
430a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov    public static final class Directory implements BaseColumns {
431a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
432a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
433a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * Not instantiable.
434a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
435a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        private Directory() {
436a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        }
437a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
438a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
439a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * The content:// style URI for this table.  Requests to this URI can be
440a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * performed on the UI thread because they are always unblocking.
441a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
442a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final Uri CONTENT_URI =
443a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov                Uri.withAppendedPath(AUTHORITY_URI, "directories");
444a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
445a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
446a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * The MIME-type of {@link #CONTENT_URI} providing a directory of
447a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * contact directories.
448a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
449a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final String CONTENT_TYPE =
450a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov                "vnd.android.cursor.dir/contact_directories";
451a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
452a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
453a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * The MIME type of a {@link #CONTENT_URI} item.
454a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
455a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final String CONTENT_ITEM_TYPE =
456a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov                "vnd.android.cursor.item/contact_directory";
457a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
458a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
45930b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * _ID of the default directory, which represents locally stored contacts.
46030b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         */
46130b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        public static final long DEFAULT = 0;
46230b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov
46330b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        /**
46430b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * _ID of the directory that represents locally stored invisible contacts.
46530b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         */
46630b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        public static final long LOCAL_INVISIBLE = 1;
46730b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov
46830b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        /**
4692ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * The name of the package that owns this directory. Contacts Provider
4702ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * fill it in with the name of the package containing the directory provider.
4712ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * If the package is later uninstalled, the directories it owns are
4722ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * automatically removed from this table.
473a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         *
474a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * <p>TYPE: TEXT</p>
475a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
476a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final String PACKAGE_NAME = "packageName";
477a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
478a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
479a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * The type of directory captured as a resource ID in the context of the
480a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * package {@link #PACKAGE_NAME}, e.g. "Corporate Directory"
481a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         *
482a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * <p>TYPE: INTEGER</p>
483a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
484a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final String TYPE_RESOURCE_ID = "typeResourceId";
485a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
486a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
487a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * An optional name that can be used in the UI to represent this directory,
488a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * e.g. "Acme Corp"
489a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * <p>TYPE: text</p>
490a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
491a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final String DISPLAY_NAME = "displayName";
492a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
493a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
4942ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * <p>
4952ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * The authority of the Directory Provider. Contacts Provider will
4962ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * use this authority to forward requests to the directory provider.
4972ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * A directory provider can leave this column empty - Contacts Provider will fill it in.
4982ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * </p>
4992ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * <p>
5002ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * Clients of this API should not send requests directly to this authority.
5012ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * All directory requests must be routed through Contacts Provider.
5022ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * </p>
503a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         *
504a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * <p>TYPE: text</p>
505a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
506a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final String DIRECTORY_AUTHORITY = "authority";
507a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
508a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
509a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * The account type which this directory is associated.
510a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         *
511a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * <p>TYPE: text</p>
512a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
513a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final String ACCOUNT_TYPE = "accountType";
514a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
515a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
516a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * The account with which this directory is associated. If the account is later
517a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * removed, the directories it owns are automatically removed from this table.
518a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         *
519a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * <p>TYPE: text</p>
520a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
521a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final String ACCOUNT_NAME = "accountName";
522a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
523a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
524a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * One of {@link #EXPORT_SUPPORT_NONE}, {@link #EXPORT_SUPPORT_ANY_ACCOUNT},
525a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * {@link #EXPORT_SUPPORT_SAME_ACCOUNT_ONLY}. This is the expectation the
526a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * directory has for data exported from it.  Clients must obey this setting.
527a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
528a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final String EXPORT_SUPPORT = "exportSupport";
529a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
530a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
531a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * An {@link #EXPORT_SUPPORT} setting that indicates that the directory
532a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * does not allow any data to be copied out of it.
533a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
534a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final int EXPORT_SUPPORT_NONE = 0;
535a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
536a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
537a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * An {@link #EXPORT_SUPPORT} setting that indicates that the directory
538a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * allow its data copied only to the account specified by
539a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * {@link #ACCOUNT_TYPE}/{@link #ACCOUNT_NAME}.
540a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
541a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final int EXPORT_SUPPORT_SAME_ACCOUNT_ONLY = 1;
542a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
543a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
544a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * An {@link #EXPORT_SUPPORT} setting that indicates that the directory
545a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         * allow its data copied to any contacts account.
546a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
547a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        public static final int EXPORT_SUPPORT_ANY_ACCOUNT = 2;
548a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
549a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
55030b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * One of {@link #SHORTCUT_SUPPORT_NONE}, {@link #SHORTCUT_SUPPORT_DATA_ITEMS_ONLY},
5513a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * {@link #SHORTCUT_SUPPORT_FULL}. This is the expectation the directory
55230b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * has for shortcuts created for its elements. Clients must obey this setting.
553a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
55430b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        public static final String SHORTCUT_SUPPORT = "shortcutSupport";
555a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
556a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov        /**
55730b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * An {@link #SHORTCUT_SUPPORT} setting that indicates that the directory
55830b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * does not allow any shortcuts created for its contacts.
559a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov         */
56030b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        public static final int SHORTCUT_SUPPORT_NONE = 0;
56130b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov
56230b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        /**
56330b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * An {@link #SHORTCUT_SUPPORT} setting that indicates that the directory
56430b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * allow creation of shortcuts for data items like email, phone or postal address,
56530b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * but not the entire contact.
56630b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         */
56730b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        public static final int SHORTCUT_SUPPORT_DATA_ITEMS_ONLY = 1;
56830b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov
56930b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        /**
57030b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * An {@link #SHORTCUT_SUPPORT} setting that indicates that the directory
57130b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * allow creation of shortcuts for contact as well as their constituent elements.
57230b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         */
57330b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        public static final int SHORTCUT_SUPPORT_FULL = 2;
5742ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov
5752ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov        /**
5763a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * One of {@link #PHOTO_SUPPORT_NONE}, {@link #PHOTO_SUPPORT_THUMBNAIL_ONLY},
5773a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * {@link #PHOTO_SUPPORT_FULL}. This is a feature flag indicating the extent
5783a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * to which the directory supports contact photos.
5793a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         */
5803a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        public static final String PHOTO_SUPPORT = "photoSupport";
5813a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov
5823a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        /**
5833a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * An {@link #PHOTO_SUPPORT} setting that indicates that the directory
5843a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * does not provide any photos.
5853a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         */
5863a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        public static final int PHOTO_SUPPORT_NONE = 0;
5873a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov
5883a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        /**
5893a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * An {@link #PHOTO_SUPPORT} setting that indicates that the directory
5903a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * can only produce small size thumbnails of contact photos.
5913a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         */
5923a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        public static final int PHOTO_SUPPORT_THUMBNAIL_ONLY = 1;
5933a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov
5943a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        /**
5953a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * An {@link #PHOTO_SUPPORT} setting that indicates that the directory
5963a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * has full-size contact photos, but cannot provide scaled thumbnails.
5973a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         */
5983a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        public static final int PHOTO_SUPPORT_FULL_SIZE_ONLY = 2;
5993a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov
6003a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        /**
6013a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * An {@link #PHOTO_SUPPORT} setting that indicates that the directory
6023a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * can produce thumbnails as well as full-size contact photos.
6033a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         */
6043a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        public static final int PHOTO_SUPPORT_FULL = 3;
6053a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov
6063a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        /**
6072ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * Notifies the system of a change in the list of directories handled by
6082ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * a particular directory provider. The Contacts provider will turn around
6092ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * and send a query to the directory provider for the full list of directories,
6102ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         * which will replace the previous list.
6112ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov         */
6122ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov        public static void notifyDirectoryChange(ContentResolver resolver) {
6132ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov            // This is done to trigger a query by Contacts Provider back to the directory provider.
6142ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov            // No data needs to be sent back, because the provider can infer the calling
6152ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov            // package from binder.
6162ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov            ContentValues contentValues = new ContentValues();
6172ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov            resolver.update(Directory.CONTENT_URI, contentValues, null, null);
6182ef9d2538f71e0b40565111f2f4ffd096e2b05a3Dmitri Plotnikov        }
619a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov    }
620a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov
621a7f2f369dae3c836cd4b960d48a3cc988952d9b2Dmitri Plotnikov    /**
62285abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton     * @hide should be removed when users are updated to refer to SyncState
62385abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton     * @deprecated use SyncState instead
62485abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton     */
625879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov    @Deprecated
6260f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana    public interface SyncStateColumns extends SyncStateContract.Columns {
6270f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana    }
6280f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana
62985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton    /**
630063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * A table provided for sync adapters to use for storing private sync state data for contacts.
63185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton     *
63285abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton     * @see SyncStateContract
63385abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton     */
63485abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton    public static final class SyncState implements SyncStateContract.Columns {
6350f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        /**
6360f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana         * This utility class cannot be instantiated
6370f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana         */
6380f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        private SyncState() {}
6390f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana
6400f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        public static final String CONTENT_DIRECTORY =
6410f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana                SyncStateContract.Constants.CONTENT_DIRECTORY;
6420f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana
6430f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        /**
6440f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana         * The content:// style URI for this table
6450f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana         */
6460f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        public static final Uri CONTENT_URI =
6470f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana                Uri.withAppendedPath(AUTHORITY_URI, CONTENT_DIRECTORY);
6480f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana
6490f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        /**
6500f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana         * @see android.provider.SyncStateContract.Helpers#get
6510f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana         */
6520f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        public static byte[] get(ContentProviderClient provider, Account account)
6530f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana                throws RemoteException {
6540f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana            return SyncStateContract.Helpers.get(provider, CONTENT_URI, account);
6550f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        }
6560f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana
6570f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        /**
658c4516a7b62de525e3d6d5e76851bdfaf12c11f05Fred Quintana         * @see android.provider.SyncStateContract.Helpers#get
659c4516a7b62de525e3d6d5e76851bdfaf12c11f05Fred Quintana         */
660c4516a7b62de525e3d6d5e76851bdfaf12c11f05Fred Quintana        public static Pair<Uri, byte[]> getWithUri(ContentProviderClient provider, Account account)
661c4516a7b62de525e3d6d5e76851bdfaf12c11f05Fred Quintana                throws RemoteException {
662c4516a7b62de525e3d6d5e76851bdfaf12c11f05Fred Quintana            return SyncStateContract.Helpers.getWithUri(provider, CONTENT_URI, account);
663c4516a7b62de525e3d6d5e76851bdfaf12c11f05Fred Quintana        }
664c4516a7b62de525e3d6d5e76851bdfaf12c11f05Fred Quintana
665c4516a7b62de525e3d6d5e76851bdfaf12c11f05Fred Quintana        /**
6660f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana         * @see android.provider.SyncStateContract.Helpers#set
6670f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana         */
6680f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        public static void set(ContentProviderClient provider, Account account, byte[] data)
6690f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana                throws RemoteException {
6700f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana            SyncStateContract.Helpers.set(provider, CONTENT_URI, account, data);
6710f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        }
6720f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana
6730f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        /**
6740f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana         * @see android.provider.SyncStateContract.Helpers#newSetOperation
6750f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana         */
6760f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        public static ContentProviderOperation newSetOperation(Account account, byte[] data) {
6770f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana            return SyncStateContract.Helpers.newSetOperation(CONTENT_URI, account, data);
6780f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana        }
6790f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana    }
6800f4e1ab773d4d52bfb85a9ad2f050ead3b8b4e49Fred Quintana
681063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
682063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro    /**
683063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * A table provided for sync adapters to use for storing private sync state data for the
684063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * user's personal profile.
685063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     *
686063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * @see SyncStateContract
687063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     */
688063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro    public static final class ProfileSyncState implements SyncStateContract.Columns {
689063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        /**
690063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * This utility class cannot be instantiated
691063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         */
692063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        private ProfileSyncState() {}
693063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
694063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        public static final String CONTENT_DIRECTORY =
695063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro                SyncStateContract.Constants.CONTENT_DIRECTORY;
696063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
697063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        /**
698063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * The content:// style URI for this table
699063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         */
700063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        public static final Uri CONTENT_URI =
701063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro                Uri.withAppendedPath(Profile.CONTENT_URI, CONTENT_DIRECTORY);
702063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
703063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        /**
704063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * @see android.provider.SyncStateContract.Helpers#get
705063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         */
706063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        public static byte[] get(ContentProviderClient provider, Account account)
707063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro                throws RemoteException {
708063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro            return SyncStateContract.Helpers.get(provider, CONTENT_URI, account);
709063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        }
710063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
711063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        /**
712063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * @see android.provider.SyncStateContract.Helpers#get
713063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         */
714063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        public static Pair<Uri, byte[]> getWithUri(ContentProviderClient provider, Account account)
715063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro                throws RemoteException {
716063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro            return SyncStateContract.Helpers.getWithUri(provider, CONTENT_URI, account);
717063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        }
718063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
719063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        /**
720063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * @see android.provider.SyncStateContract.Helpers#set
721063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         */
722063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        public static void set(ContentProviderClient provider, Account account, byte[] data)
723063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro                throws RemoteException {
724063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro            SyncStateContract.Helpers.set(provider, CONTENT_URI, account, data);
725063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        }
726063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
727063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        /**
728063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * @see android.provider.SyncStateContract.Helpers#newSetOperation
729063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         */
730063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        public static ContentProviderOperation newSetOperation(Account account, byte[] data) {
731063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro            return SyncStateContract.Helpers.newSetOperation(CONTENT_URI, account, data);
732063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        }
733063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro    }
734063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
73591e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov    /**
73691e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov     * Generic columns for use by sync adapters. The specific functions of
73791e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov     * these columns are private to the sync adapter. Other clients of the API
73891e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov     * should not attempt to either read or write this column.
739dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
740dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see RawContacts
741dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see Groups
74291e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov     */
7436e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface BaseSyncColumns {
74491e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov
74591e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        /** Generic column for use by sync adapters. */
74691e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        public static final String SYNC1 = "sync1";
74791e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        /** Generic column for use by sync adapters. */
74891e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        public static final String SYNC2 = "sync2";
74991e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        /** Generic column for use by sync adapters. */
75091e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        public static final String SYNC3 = "sync3";
75191e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        /** Generic column for use by sync adapters. */
75291e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        public static final String SYNC4 = "sync4";
75391e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov    }
75491e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov
75591e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov    /**
75691e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov     * Columns that appear when each row of a table belongs to a specific
75791e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov     * account, including sync information that an account may need.
758dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
759dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see RawContacts
760dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see Groups
76191e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov     */
7626e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface SyncColumns extends BaseSyncColumns {
76391e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        /**
76485abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * The name of the account instance to which this row belongs, which when paired with
76585abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * {@link #ACCOUNT_TYPE} identifies a specific account.
76691e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * <P>Type: TEXT</P>
76791e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         */
76891e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        public static final String ACCOUNT_NAME = "account_name";
76991e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov
77091e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        /**
77191e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * The type of account to which this row belongs, which when paired with
77291e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * {@link #ACCOUNT_NAME} identifies a specific account.
77391e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * <P>Type: TEXT</P>
77491e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         */
77591e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        public static final String ACCOUNT_TYPE = "account_type";
77691e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov
77791e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        /**
77891e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * String that uniquely identifies this row to its source account.
77991e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * <P>Type: TEXT</P>
78091e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         */
78191e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        public static final String SOURCE_ID = "sourceid";
78291e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov
78391e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        /**
78491e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * Version number that is updated whenever this row or its related data
78591e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * changes.
78691e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * <P>Type: INTEGER</P>
78791e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         */
78891e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        public static final String VERSION = "version";
78991e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov
79091e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        /**
79191e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * Flag indicating that {@link #VERSION} has changed, and this row needs
79291e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * to be synchronized by its owning account.
79391e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         * <P>Type: INTEGER (boolean)</P>
79491e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov         */
79591e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov        public static final String DIRTY = "dirty";
79691e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov    }
79791e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov
798dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov    /**
799244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Columns of {@link ContactsContract.Contacts} that track the user's
800244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * preferences for, or interactions with, the contact.
801244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     *
802dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see Contacts
803dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see RawContacts
804dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see ContactsContract.Data
805dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see PhoneLookup
806dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see ContactsContract.Contacts.AggregationSuggestions
807dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     */
8086e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface ContactOptionsColumns {
809088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
81085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * The number of times a contact has been contacted
811088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * <P>Type: INTEGER</P>
812088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
813088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String TIMES_CONTACTED = "times_contacted";
814088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
815088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
81685abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * The last time a contact was contacted.
817088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * <P>Type: INTEGER</P>
818088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
819088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String LAST_TIME_CONTACTED = "last_time_contacted";
820088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
821088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
822088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * Is the contact starred?
823088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * <P>Type: INTEGER (boolean)</P>
824088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
825088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String STARRED = "starred";
826088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
827088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
828244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * URI for a custom ringtone associated with the contact. If null or missing,
829244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * the default ringtone is used.
830693d50e7aef79f16519bf9786af68124ffaf5cd8Dmitri Plotnikov         * <P>Type: TEXT (URI to the ringtone)</P>
831693d50e7aef79f16519bf9786af68124ffaf5cd8Dmitri Plotnikov         */
832693d50e7aef79f16519bf9786af68124ffaf5cd8Dmitri Plotnikov        public static final String CUSTOM_RINGTONE = "custom_ringtone";
833693d50e7aef79f16519bf9786af68124ffaf5cd8Dmitri Plotnikov
834693d50e7aef79f16519bf9786af68124ffaf5cd8Dmitri Plotnikov        /**
835244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * Whether the contact should always be sent to voicemail. If missing,
836244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * defaults to false.
837693d50e7aef79f16519bf9786af68124ffaf5cd8Dmitri Plotnikov         * <P>Type: INTEGER (0 for false, 1 for true)</P>
838693d50e7aef79f16519bf9786af68124ffaf5cd8Dmitri Plotnikov         */
839693d50e7aef79f16519bf9786af68124ffaf5cd8Dmitri Plotnikov        public static final String SEND_TO_VOICEMAIL = "send_to_voicemail";
840c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov    }
841c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov
842dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov    /**
843244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Columns of {@link ContactsContract.Contacts} that refer to intrinsic
844244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * properties of the contact, as opposed to the user-specified options
845244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * found in {@link ContactOptionsColumns}.
846244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     *
847dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see Contacts
848dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see ContactsContract.Data
849dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see PhoneLookup
850dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see ContactsContract.Contacts.AggregationSuggestions
851dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     */
8526e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface ContactsColumns {
853c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov        /**
854c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov         * The display name for the contact.
855c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov         * <P>Type: TEXT</P>
856c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov         */
857b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov        public static final String DISPLAY_NAME = ContactNameColumns.DISPLAY_NAME_PRIMARY;
858693d50e7aef79f16519bf9786af68124ffaf5cd8Dmitri Plotnikov
859693d50e7aef79f16519bf9786af68124ffaf5cd8Dmitri Plotnikov        /**
8609618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov         * Reference to the row in the RawContacts table holding the contact name.
8619618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov         * <P>Type: INTEGER REFERENCES raw_contacts(_id)</P>
8629618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov         * @hide
8639618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov         */
8649618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov        public static final String NAME_RAW_CONTACT_ID = "name_raw_contact_id";
8659618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov
8669618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov        /**
8673a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * Reference to the row in the data table holding the photo.  A photo can
8683a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * be referred to either by ID (this field) or by URI (see {@link #PHOTO_THUMBNAIL_URI}
8693a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * and {@link #PHOTO_URI}).
8703a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * If PHOTO_ID is null, consult {@link #PHOTO_URI} or {@link #PHOTO_THUMBNAIL_URI},
8713a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * which is a more generic mechanism for referencing the contact photo, especially for
8723a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * contacts returned by non-local directories (see {@link Directory}).
8733a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         *
874088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * <P>Type: INTEGER REFERENCES data(_id)</P>
875088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
876088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String PHOTO_ID = "photo_id";
877b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
878b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
879a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * Photo file ID of the full-size photo.  If present, this will be used to populate
880a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * {@link #PHOTO_URI}.  The ID can also be used with
881a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * {@link ContactsContract.DisplayPhoto#CONTENT_URI} to create a URI to the photo.
882a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * If this is present, {@link #PHOTO_ID} is also guaranteed to be populated.
883a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *
884a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <P>Type: INTEGER</P>
885a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
886a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        public static final String PHOTO_FILE_ID = "photo_file_id";
887a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
888a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
8893a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * A URI that can be used to retrieve the contact's full-size photo.
890a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * If PHOTO_FILE_ID is not null, this will be populated with a URI based off
891a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * {@link ContactsContract.DisplayPhoto#CONTENT_URI}.  Otherwise, this will
892a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * be populated with the same value as {@link #PHOTO_THUMBNAIL_URI}.
8933a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * A photo can be referred to either by a URI (this field) or by ID
894a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * (see {@link #PHOTO_ID}). If either PHOTO_FILE_ID or PHOTO_ID is not null,
895a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * PHOTO_URI and PHOTO_THUMBNAIL_URI shall not be null (but not necessarily
896a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * vice versa).  Thus using PHOTO_URI is a more robust method of retrieving
897a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * contact photos.
8983a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         *
8993a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * <P>Type: TEXT</P>
9003a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         */
9013a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        public static final String PHOTO_URI = "photo_uri";
9023a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov
9033a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        /**
9043a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * A URI that can be used to retrieve a thumbnail of the contact's photo.
9053a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * A photo can be referred to either by a URI (this field or {@link #PHOTO_URI})
9063a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * or by ID (see {@link #PHOTO_ID}). If PHOTO_ID is not null, PHOTO_URI and
9073a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * PHOTO_THUMBNAIL_URI shall not be null (but not necessarily vice versa).
9083a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * If the content provider does not differentiate between full-size photos
9093a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * and thumbnail photos, PHOTO_THUMBNAIL_URI and {@link #PHOTO_URI} can contain
910a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * the same value, but either both shall be null or both not null.
9113a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         *
9123a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         * <P>Type: TEXT</P>
9133a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov         */
9143a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        public static final String PHOTO_THUMBNAIL_URI = "photo_thumb_uri";
9153a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov
9163a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov        /**
917432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * Flag that reflects the {@link Groups#GROUP_VISIBLE} state of any
918432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * {@link CommonDataKinds.GroupMembership} for this contact.
919b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
920b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        public static final String IN_VISIBLE_GROUP = "in_visible_group";
92155048a980e80cddf8d3556f3feaf235759ef24ddDmitri Plotnikov
92255048a980e80cddf8d3556f3feaf235759ef24ddDmitri Plotnikov        /**
923432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * Flag that reflects whether this contact represents the user's
924432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * personal profile entry.
925432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         */
926432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        public static final String IS_USER_PROFILE = "is_user_profile";
927432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro
928432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        /**
929879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * An indicator of whether this contact has at least one phone number. "1" if there is
930879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * at least one phone number, "0" otherwise.
931879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * <P>Type: INTEGER</P>
93255048a980e80cddf8d3556f3feaf235759ef24ddDmitri Plotnikov         */
933879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String HAS_PHONE_NUMBER = "has_phone_number";
93455048a980e80cddf8d3556f3feaf235759ef24ddDmitri Plotnikov
93555048a980e80cddf8d3556f3feaf235759ef24ddDmitri Plotnikov        /**
936879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * An opaque value that contains hints on how to find the contact if
937879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * its row id changed as a result of a sync or aggregation.
93831f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         */
939879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String LOOKUP_KEY = "lookup";
940879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov    }
941879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov
942dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov    /**
943dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see Contacts
944dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     */
9456e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface ContactStatusColumns {
946879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        /**
947879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * Contact presence status. See {@link StatusUpdates} for individual status
948879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * definitions.
949879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * <p>Type: NUMBER</p>
950879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         */
951879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String CONTACT_PRESENCE = "contact_presence";
95231f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov
95331f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov        /**
954fb5bccf229b52803649c70780e706c063e835447Vasu Nori         * Contact Chat Capabilities. See {@link StatusUpdates} for individual
9555b31498ba1f9874f395d80152304512fa4c0144dVasu Nori         * definitions.
9565b31498ba1f9874f395d80152304512fa4c0144dVasu Nori         * <p>Type: NUMBER</p>
9575b31498ba1f9874f395d80152304512fa4c0144dVasu Nori         */
9585b31498ba1f9874f395d80152304512fa4c0144dVasu Nori        public static final String CONTACT_CHAT_CAPABILITY = "contact_chat_capability";
9595b31498ba1f9874f395d80152304512fa4c0144dVasu Nori
9605b31498ba1f9874f395d80152304512fa4c0144dVasu Nori        /**
961879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * Contact's latest status update.
962f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov         * <p>Type: TEXT</p>
963f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov         */
964879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String CONTACT_STATUS = "contact_status";
965f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov
966f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov        /**
967879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * The absolute time in milliseconds when the latest status was
968879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * inserted/updated.
969f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov         * <p>Type: NUMBER</p>
970f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov         */
971879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String CONTACT_STATUS_TIMESTAMP = "contact_status_ts";
972f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov
973f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov        /**
974879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * The package containing resources for this status: label and icon.
975dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>Type: TEXT</p>
976f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov         */
977879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String CONTACT_STATUS_RES_PACKAGE = "contact_status_res_package";
978f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov
979f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov        /**
980879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * The resource ID of the label describing the source of contact
981879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * status, e.g. "Google Talk". This resource is scoped by the
982879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * {@link #CONTACT_STATUS_RES_PACKAGE}.
983879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * <p>Type: NUMBER</p>
9848dcd14021c4164f0e75308bcf6bc9d6a1c1f6effDmitri Plotnikov         */
985879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String CONTACT_STATUS_LABEL = "contact_status_label";
986f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov
987f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov        /**
988879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * The resource ID of the icon for the source of contact status. This
989879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * resource is scoped by the {@link #CONTACT_STATUS_RES_PACKAGE}.
990879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * <p>Type: NUMBER</p>
991f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         */
992879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String CONTACT_STATUS_ICON = "contact_status_icon";
993088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    }
994088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
995088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    /**
99607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     * Constants for various styles of combining given name, family name etc into
99707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     * a full name.  For example, the western tradition follows the pattern
99807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     * 'given name' 'middle name' 'family name' with the alternative pattern being
99907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     * 'family name', 'given name' 'middle name'.  The CJK tradition is
100007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     * 'family name' 'middle name' 'given name', with Japanese favoring a space between
100107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     * the names and Chinese omitting the space.
100207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     */
100307ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    public interface FullNameStyle {
100407ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int UNDEFINED = 0;
100507ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int WESTERN = 1;
100607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
100707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
100807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * Used if the name is written in Hanzi/Kanji/Hanja and we could not determine
100907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * which specific language it belongs to: Chinese, Japanese or Korean.
101007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
101107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int CJK = 2;
101207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
101307ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int CHINESE = 3;
101407ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int JAPANESE = 4;
101507ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int KOREAN = 5;
101607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    }
101707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
101807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    /**
101907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     * Constants for various styles of capturing the pronunciation of a person's name.
102007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     */
102107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    public interface PhoneticNameStyle {
102207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int UNDEFINED = 0;
102307ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
102407ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
102507ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * Pinyin is a phonetic method of entering Chinese characters. Typically not explicitly
102607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * shown in UIs, but used for searches and sorting.
102707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
102807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int PINYIN = 3;
102907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
103007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
103107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * Hiragana and Katakana are two common styles of writing out the pronunciation
103207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * of a Japanese names.
103307ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
103407ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int JAPANESE = 4;
103507ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
103607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
103707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * Hangul is the Korean phonetic alphabet.
103807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
103907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int KOREAN = 5;
104007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    }
104107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
104207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    /**
1043dbcdbf21288ddc4e78f24e3363a2db271d069672Dmitri Plotnikov     * Types of data used to produce the display name for a contact. In the order
1044dbcdbf21288ddc4e78f24e3363a2db271d069672Dmitri Plotnikov     * of increasing priority: {@link #EMAIL}, {@link #PHONE},
1045dbcdbf21288ddc4e78f24e3363a2db271d069672Dmitri Plotnikov     * {@link #ORGANIZATION}, {@link #NICKNAME}, {@link #STRUCTURED_NAME}.
104607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     */
104707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    public interface DisplayNameSources {
104807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int UNDEFINED = 0;
104907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int EMAIL = 10;
105007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int PHONE = 20;
105107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int ORGANIZATION = 30;
105207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int NICKNAME = 35;
105307ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final int STRUCTURED_NAME = 40;
105407ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    }
105507ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
105607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    /**
1057244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Contact name and contact name metadata columns in the RawContacts table.
1058244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     *
105907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     * @see Contacts
106007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     * @see RawContacts
106107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov     */
106207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    protected interface ContactNameColumns {
106307ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
106407ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
1065d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * The kind of data that is used as the display name for the contact, such as
106659024f1697e09ea50d4349e9813d0c101411292bDmitri Plotnikov         * structured name or email address.  See {@link DisplayNameSources}.
106707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
106807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final String DISPLAY_NAME_SOURCE = "display_name_source";
106907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
107007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
1071093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * <p>
1072093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * The standard text shown as the contact's display name, based on the best
1073093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * available information for the contact (for example, it might be the email address
1074093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * if the name is not available).
1075093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * The information actually used to compute the name is stored in
1076093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * {@link #DISPLAY_NAME_SOURCE}.
1077093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * </p>
1078093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * <p>
1079093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * A contacts provider is free to choose whatever representation makes most
1080093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * sense for its target market.
1081093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * For example in the default Android Open Source Project implementation,
1082093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * if the display name is
1083093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * based on the structured name and the structured name follows
1084093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * the Western full-name style, then this field contains the "given name first"
1085093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * version of the full name.
1086093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * <p>
1087d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         *
1088d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * @see ContactsContract.ContactNameColumns#DISPLAY_NAME_ALTERNATIVE
108907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
1090b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov        public static final String DISPLAY_NAME_PRIMARY = "display_name";
109107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
109207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
1093093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * <p>
1094093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * An alternative representation of the display name, such as "family name first"
1095093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * instead of "given name first" for Western names.  If an alternative is not
1096093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * available, the values should be the same as {@link #DISPLAY_NAME_PRIMARY}.
1097093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * </p>
1098093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * <p>
1099093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * A contacts provider is free to provide alternatives as necessary for
1100093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * its target market.
1101093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * For example the default Android Open Source Project contacts provider
1102093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * currently provides an
1103093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * alternative in a single case:  if the display name is
110407ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * based on the structured name and the structured name follows
1105093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * the Western full name style, then the field contains the "family name first"
1106093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * version of the full name.
1107093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * Other cases may be added later.
1108093a8700056394ebd122ecf9d39eec7d70e1764aTom O'Neill         * </p>
110907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
111007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final String DISPLAY_NAME_ALTERNATIVE = "display_name_alt";
111107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
111207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
1113d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * The phonetic alphabet used to represent the {@link #PHONETIC_NAME}.  See
111459024f1697e09ea50d4349e9813d0c101411292bDmitri Plotnikov         * {@link PhoneticNameStyle}.
111507ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
111607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final String PHONETIC_NAME_STYLE = "phonetic_name_style";
111707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
111807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
1119d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * <p>
1120d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * Pronunciation of the full name in the phonetic alphabet specified by
1121d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * {@link #PHONETIC_NAME_STYLE}.
1122d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * </p>
1123d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * <p>
112459024f1697e09ea50d4349e9813d0c101411292bDmitri Plotnikov         * The value may be set manually by the user. This capability is of
112559024f1697e09ea50d4349e9813d0c101411292bDmitri Plotnikov         * interest only in countries with commonly used phonetic alphabets,
112659024f1697e09ea50d4349e9813d0c101411292bDmitri Plotnikov         * such as Japan and Korea. See {@link PhoneticNameStyle}.
1127d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * </p>
112807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
112907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final String PHONETIC_NAME = "phonetic_name";
113007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
113107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
113207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * Sort key that takes into account locale-based traditions for sorting
1133d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * names in address books.  The default
1134d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * sort key is {@link #DISPLAY_NAME_PRIMARY}.  For Chinese names
1135d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * the sort key is the name's Pinyin spelling, and for Japanese names
113607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * it is the Hiragana version of the phonetic name.
113707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
1138b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov        public static final String SORT_KEY_PRIMARY = "sort_key";
113907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
114007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        /**
114107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         * Sort key based on the alternative representation of the full name,
1142d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * {@link #DISPLAY_NAME_ALTERNATIVE}.  Thus for Western names,
11432a650dd574a5e2871f51863e2446fbebc47dc0f8Dmitri Plotnikov         * it is the one using the "family name first" format.
114407ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov         */
114507ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov        public static final String SORT_KEY_ALTERNATIVE = "sort_key_alt";
114607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    }
114707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
114807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov    /**
114953de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov     * URI parameter and cursor extras that return counts of rows grouped by the
115053de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov     * address book index, which is usually the first letter of the sort key.
115153de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov     * When this parameter is supplied, the row counts are returned in the
115253de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov     * cursor extras bundle.
115353de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov     *
115453de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov     * @hide
115553de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov     */
115653de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov    public final static class ContactCounts {
115753de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov
115853de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov        /**
115953de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * Add this query parameter to a URI to get back row counts grouped by
116053de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * the address book index as cursor extras. For most languages it is the
116153de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * first letter of the sort key. This parameter does not affect the main
116253de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * content of the cursor.
116353de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         *
116453de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * @hide
116553de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         */
116653de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov        public static final String ADDRESS_BOOK_INDEX_EXTRAS = "address_book_index_extras";
116753de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov
116853de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov        /**
116953de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * The array of address book index titles, which are returned in the
117053de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * same order as the data in the cursor.
117153de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * <p>TYPE: String[]</p>
117253de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         *
117353de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * @hide
117453de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         */
117553de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov        public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "address_book_index_titles";
117653de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov
117753de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov        /**
117853de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * The array of group counts for the corresponding group.  Contains the same number
117953de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * of elements as the EXTRA_ADDRESS_BOOK_INDEX_TITLES array.
118053de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * <p>TYPE: int[]</p>
118153de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         *
118253de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         * @hide
118353de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov         */
118453de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov        public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "address_book_index_counts";
118553de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov    }
118653de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov
118753de90462b1f9b5390a80d5ff6a1522293e1b3d6Dmitri Plotnikov    /**
1188dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Constants for the contacts table, which contains a record per aggregate
118985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton     * of raw contacts representing the same person.
1190dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h3>Operations</h3>
1191dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dl>
1192dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Insert</b></dt>
1193dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>A Contact cannot be created explicitly. When a raw contact is
1194dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * inserted, the provider will first try to find a Contact representing the
1195dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * same person. If one is found, the raw contact's
1196dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link RawContacts#CONTACT_ID} column gets the _ID of the aggregate
1197dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Contact. If no match is found, the provider automatically inserts a new
1198dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Contact and puts its _ID into the {@link RawContacts#CONTACT_ID} column
1199dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * of the newly inserted raw contact.</dd>
1200dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Update</b></dt>
1201dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>Only certain columns of Contact are modifiable:
1202dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #TIMES_CONTACTED}, {@link #LAST_TIME_CONTACTED}, {@link #STARRED},
1203dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #CUSTOM_RINGTONE}, {@link #SEND_TO_VOICEMAIL}. Changing any of
1204dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * these columns on the Contact also changes them on all constituent raw
1205dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * contacts.</dd>
1206dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Delete</b></dt>
1207dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>Be careful with deleting Contacts! Deleting an aggregate contact
1208dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * deletes all constituent raw contacts. The corresponding sync adapters
1209dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * will notice the deletions of their respective raw contacts and remove
1210dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * them from their back end storage.</dd>
1211dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Query</b></dt>
1212dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>
1213dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <ul>
1214dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>If you need to read an individual contact, consider using
1215dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #CONTENT_LOOKUP_URI} instead of {@link #CONTENT_URI}.</li>
1216dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>If you need to look up a contact by the phone number, use
1217dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link PhoneLookup#CONTENT_FILTER_URI PhoneLookup.CONTENT_FILTER_URI},
1218dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * which is optimized for this purpose.</li>
1219dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>If you need to look up a contact by partial name, e.g. to produce
1220dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * filter-as-you-type suggestions, use the {@link #CONTENT_FILTER_URI} URI.
1221dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>If you need to look up a contact by some data element like email
1222dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * address, nickname, etc, use a query against the {@link ContactsContract.Data} table.
1223dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * The result will contain contact ID, name etc.
1224dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </ul>
1225dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dd>
1226dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dl>
1227dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h2>Columns</h2>
1228dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
1229dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1230dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>Contacts</th>
1231dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1232dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1233dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
1234dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #_ID}</td>
1235dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1236dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Row ID. Consider using {@link #LOOKUP_KEY} instead.</td>
1237dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1238dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1239dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
1240dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #LOOKUP_KEY}</td>
1241dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1242dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>An opaque value that contains hints on how to find the contact if its
1243dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * row id changed as a result of a sync or aggregation.</td>
1244dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1245dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
12469618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov     * <td>long</td>
1247780211a9a792dcc4cd57df0a4e8da34d05eb99f1Dmitri Plotnikov     * <td>NAME_RAW_CONTACT_ID</td>
12489618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov     * <td>read-only</td>
12499618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov     * <td>The ID of the raw contact that contributes the display name
12509618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov     * to the aggregate contact. During aggregation one of the constituent
12519618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov     * raw contacts is chosen using a heuristic: a longer name or a name
12529618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov     * with more diacritic marks or more upper case characters is chosen.</td>
12539618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov     * </tr>
12549618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov     * <tr>
1255dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
1256b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov     * <td>DISPLAY_NAME_PRIMARY</td>
1257dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
12589618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov     * <td>The display name for the contact. It is the display name
1259780211a9a792dcc4cd57df0a4e8da34d05eb99f1Dmitri Plotnikov     * contributed by the raw contact referred to by the NAME_RAW_CONTACT_ID
12609618608708694e078da7a567c460d3ce0154ba6fDmitri Plotnikov     * column.</td>
1261dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1262dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1263dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
1264dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #PHOTO_ID}</td>
1265dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1266dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Reference to the row in the {@link ContactsContract.Data} table holding the photo.
1267dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * That row has the mime type
1268dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link CommonDataKinds.Photo#CONTENT_ITEM_TYPE}. The value of this field
1269dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * is computed automatically based on the
1270dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link CommonDataKinds.Photo#IS_SUPER_PRIMARY} field of the data rows of
1271dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * that mime type.</td>
1272dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1273dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
12743a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * <td>long</td>
12753a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * <td>{@link #PHOTO_URI}</td>
12763a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * <td>read-only</td>
12773a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * <td>A URI that can be used to retrieve the contact's full-size photo. This
12783a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * column is the preferred method of retrieving the contact photo.</td>
12793a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * </tr>
12803a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * <tr>
12813a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * <td>long</td>
12823a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * <td>{@link #PHOTO_THUMBNAIL_URI}</td>
12833a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * <td>read-only</td>
12843a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * <td>A URI that can be used to retrieve the thumbnail of contact's photo.  This
12853a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * column is the preferred method of retrieving the contact photo.</td>
12863a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * </tr>
12873a668feec61695c3ffcbf2306d0dc153a97de98bDmitri Plotnikov     * <tr>
1288dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
1289dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #IN_VISIBLE_GROUP}</td>
1290dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1291dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>An indicator of whether this contact is supposed to be visible in the
1292dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * UI. "1" if the contact has at least one raw contact that belongs to a
1293dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * visible group; "0" otherwise.</td>
1294dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1295dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1296dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
1297dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #HAS_PHONE_NUMBER}</td>
1298dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1299dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>An indicator of whether this contact has at least one phone number.
1300dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * "1" if there is at least one phone number, "0" otherwise.</td>
1301dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1302dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1303dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
1304dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #TIMES_CONTACTED}</td>
1305dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
1306dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The number of times the contact has been contacted. See
1307dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #markAsContacted}. When raw contacts are aggregated, this field is
1308dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * computed automatically as the maximum number of times contacted among all
1309dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * constituent raw contacts. Setting this field automatically changes the
1310dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * corresponding field on all constituent raw contacts.</td>
1311dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1312dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1313dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
1314dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #LAST_TIME_CONTACTED}</td>
1315dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
1316dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The timestamp of the last time the contact was contacted. See
1317dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #markAsContacted}. Setting this field also automatically
1318dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * increments {@link #TIMES_CONTACTED}. When raw contacts are aggregated,
1319dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * this field is computed automatically as the latest time contacted of all
1320dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * constituent raw contacts. Setting this field automatically changes the
1321dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * corresponding field on all constituent raw contacts.</td>
1322dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1323dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1324dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
1325dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STARRED}</td>
1326dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
1327dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>An indicator for favorite contacts: '1' if favorite, '0' otherwise.
1328dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * When raw contacts are aggregated, this field is automatically computed:
1329dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * if any constituent raw contacts are starred, then this field is set to
1330dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * '1'. Setting this field automatically changes the corresponding field on
1331dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * all constituent raw contacts.</td>
1332dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1333dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1334dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
1335dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CUSTOM_RINGTONE}</td>
1336dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
1337dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>A custom ringtone associated with a contact. Typically this is the
1338dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * URI returned by an activity launched with the
1339dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link android.media.RingtoneManager#ACTION_RINGTONE_PICKER} intent.</td>
1340dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1341dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1342dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
1343dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SEND_TO_VOICEMAIL}</td>
1344dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
1345dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>An indicator of whether calls from this contact should be forwarded
1346dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * directly to voice mail ('1') or not ('0'). When raw contacts are
1347dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * aggregated, this field is automatically computed: if <i>all</i>
1348dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * constituent raw contacts have SEND_TO_VOICEMAIL=1, then this field is set
1349dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * to '1'. Setting this field automatically changes the corresponding field
1350dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * on all constituent raw contacts.</td>
1351dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1352dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1353dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
1354dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_PRESENCE}</td>
1355dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1356dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Contact IM presence status. See {@link StatusUpdates} for individual
1357dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * status definitions. Automatically computed as the highest presence of all
1358dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * constituent raw contacts. The provider may choose not to store this value
1359dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * in persistent storage. The expectation is that presence status will be
1360dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * updated on a regular basic.</td>
1361dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1362dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1363dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
1364dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_STATUS}</td>
1365dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1366dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Contact's latest status update. Automatically computed as the latest
1367dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * of all constituent raw contacts' status updates.</td>
1368dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1369dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1370dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
1371dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_STATUS_TIMESTAMP}</td>
1372dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1373dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The absolute time in milliseconds when the latest status was
1374dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * inserted/updated.</td>
1375dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1376dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1377dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
1378dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_STATUS_RES_PACKAGE}</td>
1379dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1380dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td> The package containing resources for this status: label and icon.</td>
1381dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1382dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1383dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
1384dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_STATUS_LABEL}</td>
1385dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1386dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The resource ID of the label describing the source of contact status,
1387dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * e.g. "Google Talk". This resource is scoped by the
1388dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #CONTACT_STATUS_RES_PACKAGE}.</td>
1389dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1390dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
1391dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
1392dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_STATUS_ICON}</td>
1393dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
1394dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The resource ID of the icon for the source of contact status. This
1395dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * resource is scoped by the {@link #CONTACT_STATUS_RES_PACKAGE}.</td>
1396dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
1397dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
1398088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar     */
139991e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov    public static class Contacts implements BaseColumns, ContactsColumns,
1400b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov            ContactOptionsColumns, ContactNameColumns, ContactStatusColumns {
1401088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
1402088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * This utility class cannot be instantiated
1403088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
14047cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov        private Contacts()  {}
1405088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
1406088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
1407088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * The content:// style URI for this table
1408088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
14097cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "contacts");
1410088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
1411088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
1412f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * A content:// style URI for this table that should be used to create
1413f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * shortcuts or otherwise create long-term links to contacts. This URI
1414f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * should always be followed by a "/" and the contact's {@link #LOOKUP_KEY}.
1415f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * It can optionally also have a "/" and last known contact ID appended after
1416f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * that. This "complete" format is an important optimization and is highly recommended.
1417f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * <p>
1418f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * As long as the contact's row ID remains the same, this URI is
1419f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * equivalent to {@link #CONTENT_URI}. If the contact's row ID changes
1420f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * as a result of a sync or aggregation, this URI will look up the
1421f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * contact using indirect information (sync IDs or constituent raw
1422f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * contacts).
1423f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * <p>
1424f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * Lookup key should be appended unencoded - it is stored in the encoded
1425f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         * form, ready for use in a URI.
1426f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         */
1427f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov        public static final Uri CONTENT_LOOKUP_URI = Uri.withAppendedPath(CONTENT_URI,
1428f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov                "lookup");
1429f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov
1430f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov        /**
1431ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey         * Base {@link Uri} for referencing a single {@link Contacts} entry,
14328f76734d1e9a21618ad9762c0716ee93f60902ecJeff Sharkey         * created by appending {@link #LOOKUP_KEY} using
1433ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey         * {@link Uri#withAppendedPath(Uri, String)}. Provides
1434ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey         * {@link OpenableColumns} columns when queried, or returns the
1435ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey         * referenced contact formatted as a vCard when opened through
1436ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey         * {@link ContentResolver#openAssetFileDescriptor(Uri, String)}.
1437ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey         */
1438ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey        public static final Uri CONTENT_VCARD_URI = Uri.withAppendedPath(CONTENT_URI,
1439ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey                "as_vcard");
1440ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey
1441037d3ffa20d4ab933891419d79879869c1d9c125Martijn Coenen       /**
1442037d3ffa20d4ab933891419d79879869c1d9c125Martijn Coenen        * Boolean parameter that may be used with {@link #CONTENT_VCARD_URI}
1443037d3ffa20d4ab933891419d79879869c1d9c125Martijn Coenen        * and {@link #CONTENT_MULTI_VCARD_URI} to indicate that the returned
1444037d3ffa20d4ab933891419d79879869c1d9c125Martijn Coenen        * vcard should not contain a photo.
1445037d3ffa20d4ab933891419d79879869c1d9c125Martijn Coenen        *
1446037d3ffa20d4ab933891419d79879869c1d9c125Martijn Coenen        * @hide
1447037d3ffa20d4ab933891419d79879869c1d9c125Martijn Coenen        */
1448037d3ffa20d4ab933891419d79879869c1d9c125Martijn Coenen        public static final String QUERY_PARAMETER_VCARD_NO_PHOTO = "nophoto";
1449037d3ffa20d4ab933891419d79879869c1d9c125Martijn Coenen
1450ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey        /**
145163e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * Base {@link Uri} for referencing multiple {@link Contacts} entry,
145263e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * created by appending {@link #LOOKUP_KEY} using
145363e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * {@link Uri#withAppendedPath(Uri, String)}. The lookup keys have to be
1454432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * encoded and joined with the colon (":") separator. The resulting string
145563e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * has to be encoded again. Provides
145663e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * {@link OpenableColumns} columns when queried, or returns the
145763e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * referenced contact formatted as a vCard when opened through
145863e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * {@link ContentResolver#openAssetFileDescriptor(Uri, String)}.
145963e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         *
146063e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * This is private API because we do not have a well-defined way to
146163e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * specify several entities yet. The format of this Uri might change in the future
146263e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * or the Uri might be completely removed.
146363e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         *
146463e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         * @hide
146563e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann         */
146663e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann        public static final Uri CONTENT_MULTI_VCARD_URI = Uri.withAppendedPath(CONTENT_URI,
146763e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann                "as_multi_vcard");
146863e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann
146963e914096ebfc767dc764519e41a2f4d8e578791Daniel Lehmann        /**
14706449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * Builds a {@link #CONTENT_LOOKUP_URI} style {@link Uri} describing the
14716449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * requested {@link Contacts} entry.
14726449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *
14736449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @param contactUri A {@link #CONTENT_URI} row, or an existing
14746449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            {@link #CONTENT_LOOKUP_URI} to attempt refreshing.
1475f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov         */
14766449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        public static Uri getLookupUri(ContentResolver resolver, Uri contactUri) {
14776449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            final Cursor c = resolver.query(contactUri, new String[] {
14786449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    Contacts.LOOKUP_KEY, Contacts._ID
14796449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            }, null, null, null);
1480f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov            if (c == null) {
1481f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov                return null;
1482f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov            }
1483f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov
1484f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov            try {
1485f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov                if (c.moveToFirst()) {
14866449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    final String lookupKey = c.getString(0);
14876449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    final long contactId = c.getLong(1);
14886449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    return getLookupUri(contactId, lookupKey);
1489f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov                }
1490f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov            } finally {
1491f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov                c.close();
1492f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov            }
1493f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov            return null;
1494f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov        }
1495f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov
1496f35bce45058200ff1209385e63e34fbf59255db6Dmitri Plotnikov        /**
1497f46a9cf38207d03730c04d02cf40aa3859cd9ad3Jeff Sharkey         * Build a {@link #CONTENT_LOOKUP_URI} lookup {@link Uri} using the
1498dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * given {@link ContactsContract.Contacts#_ID} and {@link #LOOKUP_KEY}.
1499f46a9cf38207d03730c04d02cf40aa3859cd9ad3Jeff Sharkey         */
1500f46a9cf38207d03730c04d02cf40aa3859cd9ad3Jeff Sharkey        public static Uri getLookupUri(long contactId, String lookupKey) {
1501f46a9cf38207d03730c04d02cf40aa3859cd9ad3Jeff Sharkey            return ContentUris.withAppendedId(Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI,
1502f46a9cf38207d03730c04d02cf40aa3859cd9ad3Jeff Sharkey                    lookupKey), contactId);
1503f46a9cf38207d03730c04d02cf40aa3859cd9ad3Jeff Sharkey        }
1504f46a9cf38207d03730c04d02cf40aa3859cd9ad3Jeff Sharkey
1505f46a9cf38207d03730c04d02cf40aa3859cd9ad3Jeff Sharkey        /**
1506b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov         * Computes a content URI (see {@link #CONTENT_URI}) given a lookup URI.
1507b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov         * <p>
1508b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov         * Returns null if the contact cannot be found.
1509b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov         */
1510b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov        public static Uri lookupContact(ContentResolver resolver, Uri lookupUri) {
1511b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov            if (lookupUri == null) {
1512b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov                return null;
1513b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov            }
1514b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov
1515b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov            Cursor c = resolver.query(lookupUri, new String[]{Contacts._ID}, null, null, null);
1516b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov            if (c == null) {
1517b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov                return null;
1518b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov            }
1519b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov
1520b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov            try {
1521b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov                if (c.moveToFirst()) {
1522b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov                    long contactId = c.getLong(0);
1523b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov                    return ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
1524b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov                }
1525b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov            } finally {
1526b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov                c.close();
1527b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov            }
1528b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov            return null;
1529b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov        }
1530b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov
1531b5759b5f4f01771a615c100c1d87adc702a6ef71Dmitri Plotnikov        /**
15321ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * Mark a contact as having been contacted. Updates two fields:
15331ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * {@link #TIMES_CONTACTED} and {@link #LAST_TIME_CONTACTED}. The
15341ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * TIMES_CONTACTED field is incremented by 1 and the LAST_TIME_CONTACTED
15351ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * field is populated with the current system time.
153685abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
153785abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @param resolver the ContentResolver to use
153885abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @param contactId the person who was contacted
153985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         */
154085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton        public static void markAsContacted(ContentResolver resolver, long contactId) {
154185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            Uri uri = ContentUris.withAppendedId(CONTENT_URI, contactId);
154285abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            ContentValues values = new ContentValues();
154385abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            // TIMES_CONTACTED will be incremented when LAST_TIME_CONTACTED is modified.
154485abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            values.put(LAST_TIME_CONTACTED, System.currentTimeMillis());
154585abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            resolver.update(uri, values, null, null);
154685abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton        }
154785abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton
154885abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton        /**
1549161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar         * The content:// style URI used for "type-to-filter" functionality on the
1550b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov         * {@link #CONTENT_URI} URI. The filter string will be used to match
15517cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * various parts of the contact name. The filter argument should be passed
1552161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar         * as an additional path segment after this URI.
1553161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar         */
1554b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov        public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(
1555b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov                CONTENT_URI, "filter");
1556b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov
1557dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
1558dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * The content:// style URI for this table joined with useful data from
1559dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * {@link ContactsContract.Data}, filtered to include only starred contacts
15607cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * and the most frequently contacted contacts.
1561dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
1562b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov        public static final Uri CONTENT_STREQUENT_URI = Uri.withAppendedPath(
1563b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov                CONTENT_URI, "strequent");
1564b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov
1565dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
15663604bc50207af783562d2f36cdd3f9b964a7cefcDaisuke Miyakawa         * The content:// style URI for showing frequently contacted person listing.
15673604bc50207af783562d2f36cdd3f9b964a7cefcDaisuke Miyakawa         * @hide
15683604bc50207af783562d2f36cdd3f9b964a7cefcDaisuke Miyakawa         */
15693604bc50207af783562d2f36cdd3f9b964a7cefcDaisuke Miyakawa        public static final Uri CONTENT_FREQUENT_URI = Uri.withAppendedPath(
15703604bc50207af783562d2f36cdd3f9b964a7cefcDaisuke Miyakawa                CONTENT_URI, "frequent");
15713604bc50207af783562d2f36cdd3f9b964a7cefcDaisuke Miyakawa
15723604bc50207af783562d2f36cdd3f9b964a7cefcDaisuke Miyakawa        /**
1573dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * The content:// style URI used for "type-to-filter" functionality on the
1574b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov         * {@link #CONTENT_STREQUENT_URI} URI. The filter string will be used to match
15757cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * various parts of the contact name. The filter argument should be passed
1576dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * as an additional path segment after this URI.
1577dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
1578b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov        public static final Uri CONTENT_STREQUENT_FILTER_URI = Uri.withAppendedPath(
1579b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov                CONTENT_STREQUENT_URI, "filter");
1580b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov
1581b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov        public static final Uri CONTENT_GROUP_URI = Uri.withAppendedPath(
1582b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov                CONTENT_URI, "group");
1583b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov
1584d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        /**
1585088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * The MIME type of {@link #CONTENT_URI} providing a directory of
1586088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * people.
1587088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
15887cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact";
1589088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
1590088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
1591088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
1592088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * person.
1593088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
15947cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact";
1595088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
1596088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
1597ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
1598ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey         * person.
1599ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey         */
1600ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey        public static final String CONTENT_VCARD_TYPE = "text/x-vcard";
1601ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey
1602ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey        /**
16037cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * A sub-directory of a single contact that contains all of the constituent raw contact
16041ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * {@link ContactsContract.Data} rows.  This directory can be used either
16051ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * with a {@link #CONTENT_URI} or {@link #CONTENT_LOOKUP_URI}.
1606088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
16078851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        public static final class Data implements BaseColumns, DataColumns {
1608088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
1609088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * no public constructor since this is a utility class
1610088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
1611088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            private Data() {}
1612088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
1613088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
1614088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * The directory twig for this sub-table
1615088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
1616088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final String CONTENT_DIRECTORY = "data";
1617088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
16180918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov
16190918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov        /**
1620dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
1621b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * A sub-directory of a contact that contains all of its
1622b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * {@link ContactsContract.RawContacts} as well as
1623b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * {@link ContactsContract.Data} rows. To access this directory append
1624b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * {@link #CONTENT_DIRECTORY} to the contact URI.
1625b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * </p>
1626b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * <p>
1627b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * Entity has three ID fields: {@link #CONTACT_ID} for the contact,
1628b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * {@link #RAW_CONTACT_ID} for the raw contact and {@link #DATA_ID} for
1629b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * the data rows. Entity always contains at least one row per
1630b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * constituent raw contact, even if there are no actual data rows. In
1631b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * this case the {@link #DATA_ID} field will be null.
1632b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * </p>
1633b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * <p>
1634b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * Entity reads all data for the entire contact in one transaction, to
1635b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * guarantee consistency.  There is significant data duplication
1636b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * in the Entity (each row repeats all Contact columns and all RawContact
1637b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * columns), so the benefits of transactional consistency should be weighed
1638b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * against the cost of transferring large amounts of denormalized data
1639b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * from the Provider.
1640b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * </p>
1641beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov         * <p>
1642beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov         * To reduce the amount of data duplication the contacts provider and directory
1643beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov         * providers implementing this protocol are allowed to provide common Contacts
1644beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov         * and RawContacts fields in the first row returned for each raw contact only and
1645beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov         * leave them as null in subsequent rows.
1646beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov         * </p>
1647b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         */
1648b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov        public static final class Entity implements BaseColumns, ContactsColumns,
1649b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov                ContactNameColumns, RawContactsColumns, BaseSyncColumns, SyncColumns, DataColumns,
1650b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov                StatusColumns, ContactOptionsColumns, ContactStatusColumns {
1651b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov            /**
1652b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             * no public constructor since this is a utility class
1653b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             */
1654b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov            private Entity() {
1655b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov            }
1656b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov
1657b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov            /**
1658b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             * The directory twig for this sub-table
1659b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             */
1660b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov            public static final String CONTENT_DIRECTORY = "entities";
1661b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov
1662b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov            /**
1663b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             * The ID of the raw contact row.
1664b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             * <P>Type: INTEGER</P>
1665b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             */
1666b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov            public static final String RAW_CONTACT_ID = "raw_contact_id";
1667b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov
1668b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov            /**
1669b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             * The ID of the data row. The value will be null if this raw contact has no
1670b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             * data rows.
1671b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             * <P>Type: INTEGER</P>
1672b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             */
1673b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov            public static final String DATA_ID = "data_id";
1674b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov        }
1675b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov
1676b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov        /**
16770b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * <p>
1678d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * A sub-directory of a single contact that contains all of the constituent raw contact
1679d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * {@link ContactsContract.StreamItems} rows.  This directory can be used either
1680d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * with a {@link #CONTENT_URI} or {@link #CONTENT_LOOKUP_URI}.
16810b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * </p>
16820b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * <p>
16830b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * Querying for social stream data requires android.permission.READ_SOCIAL_STREAM
16840b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * permission.
16850b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * </p>
1686d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
1687d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final class StreamItems implements StreamItemsColumns {
1688d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            /**
1689d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             * no public constructor since this is a utility class
1690d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             */
1691d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            private StreamItems() {}
1692d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
1693d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            /**
1694d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             * The directory twig for this sub-table
1695d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             */
1696d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            public static final String CONTENT_DIRECTORY = "stream_items";
1697d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        }
1698d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
1699d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
1700b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov         * <p>
1701dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A <i>read-only</i> sub-directory of a single contact aggregate that
1702dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * contains all aggregation suggestions (other contacts). The
1703dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * aggregation suggestions are computed based on approximate data
1704dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * matches with this contact.
1705dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
1706dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
1707dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <i>Note: this query may be expensive! If you need to use it in bulk,
1708dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * make sure the user experience is acceptable when the query runs for a
1709dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * long time.</i>
1710dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
1711dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * Usage example:
1712dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *
1713dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <pre>
1714dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * Uri uri = Contacts.CONTENT_URI.buildUpon()
1715dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .appendEncodedPath(String.valueOf(contactId))
1716dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .appendPath(Contacts.AggregationSuggestions.CONTENT_DIRECTORY)
1717dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .appendQueryParameter(&quot;limit&quot;, &quot;3&quot;)
1718dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .build()
1719dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * Cursor cursor = getContentResolver().query(suggestionsUri,
1720dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          new String[] {Contacts.DISPLAY_NAME, Contacts._ID, Contacts.LOOKUP_KEY},
1721dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          null, null, null);
1722dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </pre>
1723dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *
1724dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
17251ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * <p>
17261ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * This directory can be used either with a {@link #CONTENT_URI} or
17271ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * {@link #CONTENT_LOOKUP_URI}.
17281ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * </p>
17290918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov         */
17301ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov        public static final class AggregationSuggestions implements BaseColumns, ContactsColumns,
17311ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov                ContactOptionsColumns, ContactStatusColumns {
17320918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov            /**
17330918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov             * No public constructor since this is a utility class
17340918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov             */
17350918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov            private AggregationSuggestions() {}
17360918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov
17370918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov            /**
17380fc0244e808925e848ee9e350a3a213bd7574249Dmitri Plotnikov             * The directory twig for this sub-table. The URI can be followed by an optional
1739f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * type-to-filter, similar to
1740f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * {@link android.provider.ContactsContract.Contacts#CONTENT_FILTER_URI}.
17410918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov             */
17420918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov            public static final String CONTENT_DIRECTORY = "suggestions";
174344730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
174444730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            /**
174544730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * Used with {@link Builder#addParameter} to specify what kind of data is
174644730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * supplied for the suggestion query.
174744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             *
174844730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * @hide
174944730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             */
175044730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            public static final String PARAMETER_MATCH_NAME = "name";
175144730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
175244730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            /**
175344730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * Used with {@link Builder#addParameter} to specify what kind of data is
175444730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * supplied for the suggestion query.
175544730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             *
175644730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * @hide
175744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             */
175844730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            public static final String PARAMETER_MATCH_EMAIL = "email";
175944730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
176044730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            /**
176144730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * Used with {@link Builder#addParameter} to specify what kind of data is
176244730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * supplied for the suggestion query.
176344730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             *
176444730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * @hide
176544730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             */
176644730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            public static final String PARAMETER_MATCH_PHONE = "phone";
176744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
176844730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            /**
176944730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * Used with {@link Builder#addParameter} to specify what kind of data is
177044730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * supplied for the suggestion query.
177144730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             *
177244730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * @hide
177344730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             */
177444730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            public static final String PARAMETER_MATCH_NICKNAME = "nickname";
177544730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
177644730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            /**
177744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * A convenience builder for aggregation suggestion content URIs.
177844730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             *
177944730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * TODO: change documentation for this class to use the builder.
178044730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * @hide
178144730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             */
178244730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            public static final class Builder {
178344730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                private long mContactId;
178444730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                private ArrayList<String> mKinds = new ArrayList<String>();
178544730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                private ArrayList<String> mValues = new ArrayList<String>();
178644730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                private int mLimit;
178744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
178844730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                /**
178944730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 * Optional existing contact ID.  If it is not provided, the search
179044730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 * will be based exclusively on the values supplied with {@link #addParameter}.
179144730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 */
179244730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                public Builder setContactId(long contactId) {
179344730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    this.mContactId = contactId;
179444730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    return this;
179544730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                }
179644730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
179744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                /**
179844730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 * A value that can be used when searching for an aggregation
179944730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 * suggestion.
180044730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 *
180144730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 * @param kind can be one of
180244730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 *            {@link AggregationSuggestions#PARAMETER_MATCH_NAME},
180344730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 *            {@link AggregationSuggestions#PARAMETER_MATCH_EMAIL},
180444730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 *            {@link AggregationSuggestions#PARAMETER_MATCH_NICKNAME},
180544730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 *            {@link AggregationSuggestions#PARAMETER_MATCH_PHONE}
180644730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                 */
180744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                public Builder addParameter(String kind, String value) {
180844730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    if (!TextUtils.isEmpty(value)) {
180944730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                        mKinds.add(kind);
181044730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                        mValues.add(value);
181144730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    }
181244730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    return this;
181344730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                }
181444730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
181544730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                public Builder setLimit(int limit) {
181644730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    mLimit = limit;
181744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    return this;
181844730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                }
181944730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
182044730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                public Uri build() {
182144730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    android.net.Uri.Builder builder = Contacts.CONTENT_URI.buildUpon();
182244730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    builder.appendEncodedPath(String.valueOf(mContactId));
182344730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    builder.appendPath(Contacts.AggregationSuggestions.CONTENT_DIRECTORY);
182444730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    if (mLimit != 0) {
182544730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                        builder.appendQueryParameter("limit", String.valueOf(mLimit));
182644730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    }
182744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
182844730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    int count = mKinds.size();
182944730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    for (int i = 0; i < count; i++) {
183044730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                        builder.appendQueryParameter("query", mKinds.get(i) + ":" + mValues.get(i));
183144730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    }
183244730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
183344730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                    return builder.build();
183444730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                }
183544730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            }
183644730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov
183744730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            /**
183844730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             * @hide
183944730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov             */
184044730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            public static final Builder builder() {
184144730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov                return new Builder();
184244730c2e63dd0182263b3645f537f4c3d8b7efc2Dmitri Plotnikov            }
18430918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov        }
18443c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov
18453c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov        /**
1846dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A <i>read-only</i> sub-directory of a single contact that contains
1847a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * the contact's primary photo.  The photo may be stored in up to two ways -
1848a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * the default "photo" is a thumbnail-sized image stored directly in the data
1849a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * row, while the "display photo", if present, is a larger version stored as
1850a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * a file.
1851dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
1852dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * Usage example:
1853a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <dl>
1854a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <dt>Retrieving the thumbnail-sized photo</dt>
1855a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <dd>
1856dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <pre>
1857dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * public InputStream openPhoto(long contactId) {
1858dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *     Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
1859dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *     Uri photoUri = Uri.withAppendedPath(contactUri, Contacts.Photo.CONTENT_DIRECTORY);
1860dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *     Cursor cursor = getContentResolver().query(photoUri,
1861dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          new String[] {Contacts.Photo.PHOTO}, null, null, null);
1862dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *     if (cursor == null) {
1863dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *         return null;
1864dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *     }
1865dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *     try {
1866dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *         if (cursor.moveToFirst()) {
1867dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *             byte[] data = cursor.getBlob(0);
1868dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *             if (data != null) {
1869dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *                 return new ByteArrayInputStream(data);
1870dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *             }
1871dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *         }
1872dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *     } finally {
1873dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *         cursor.close();
1874dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *     }
1875dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *     return null;
1876dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * }
1877dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </pre>
1878a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * </dd>
1879a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <dt>Retrieving the larger photo version</dt>
1880a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <dd>
1881a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <pre>
1882a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * public InputStream openDisplayPhoto(long contactId) {
1883a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *     Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
1884a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *     Uri displayPhotoUri = Uri.withAppendedPath(contactUri, Contacts.Photo.DISPLAY_PHOTO);
1885a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *     try {
1886a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *         AssetFileDescriptor fd =
1887040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         *             getContentResolver().openAssetFileDescriptor(displayPhotoUri, "r");
1888a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *         return fd.createInputStream();
1889040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         *     } catch (IOException e) {
1890a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *         return null;
1891a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *     }
1892a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * }
1893a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * </pre>
1894a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * </dd>
1895a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * </dl>
1896dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *
1897dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
1898a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <p>You may also consider using the convenience method
1899f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * {@link ContactsContract.Contacts#openContactPhotoInputStream(ContentResolver, Uri, boolean)}
1900f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * to retrieve the raw photo contents of either the thumbnail-sized or the full-sized photo.
1901dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
19021ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * <p>
19031ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * This directory can be used either with a {@link #CONTENT_URI} or
19041ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * {@link #CONTENT_LOOKUP_URI}.
19051ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * </p>
19063c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov         */
19071ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov        public static final class Photo implements BaseColumns, DataColumnsWithJoins {
1908eb1a2ec4b2a429ceb924e6bce46b2b52c1cd85b2Dmitri Plotnikov            /**
1909eb1a2ec4b2a429ceb924e6bce46b2b52c1cd85b2Dmitri Plotnikov             * no public constructor since this is a utility class
1910eb1a2ec4b2a429ceb924e6bce46b2b52c1cd85b2Dmitri Plotnikov             */
1911eb1a2ec4b2a429ceb924e6bce46b2b52c1cd85b2Dmitri Plotnikov            private Photo() {}
19123c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov
1913eb1a2ec4b2a429ceb924e6bce46b2b52c1cd85b2Dmitri Plotnikov            /**
1914eb1a2ec4b2a429ceb924e6bce46b2b52c1cd85b2Dmitri Plotnikov             * The directory twig for this sub-table
1915eb1a2ec4b2a429ceb924e6bce46b2b52c1cd85b2Dmitri Plotnikov             */
1916eb1a2ec4b2a429ceb924e6bce46b2b52c1cd85b2Dmitri Plotnikov            public static final String CONTENT_DIRECTORY = "photo";
1917dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov
1918dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov            /**
1919a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * The directory twig for retrieving the full-size display photo.
1920a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             */
1921a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            public static final String DISPLAY_PHOTO = "display_photo";
1922a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
1923a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            /**
1924a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * Full-size photo file ID of the raw contact.
1925a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * See {@link ContactsContract.DisplayPhoto}.
1926a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * <p>
1927a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * Type: NUMBER
1928a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             */
1929a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            public static final String PHOTO_FILE_ID = DATA14;
1930a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
1931a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            /**
1932dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * Thumbnail photo of the raw contact. This is the raw bytes of an image
1933dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * that could be inflated using {@link android.graphics.BitmapFactory}.
1934dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * <p>
1935dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * Type: BLOB
1936dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             */
1937dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov            public static final String PHOTO = DATA15;
19383c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov        }
19393c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov
19403c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov        /**
1941f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * Opens an InputStream for the contacts's photo and returns the
1942f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * photo as a byte stream.
1943f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * @param cr The content resolver to use for querying
19441ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * @param contactUri the contact whose photo should be used. This can be used with
19451ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * either a {@link #CONTENT_URI} or a {@link #CONTENT_LOOKUP_URI} URI.
1946f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * @param preferHighres If this is true and the contact has a higher resolution photo
1947f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * available, it is returned. If false, this function always tries to get the thumbnail
194885abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @return an InputStream of the photo, or null if no photo is present
19493c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov         */
1950f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann        public static InputStream openContactPhotoInputStream(ContentResolver cr, Uri contactUri,
1951f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                boolean preferHighres) {
1952f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann            if (preferHighres) {
1953f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                final Uri displayPhotoUri = Uri.withAppendedPath(contactUri,
1954f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                        Contacts.Photo.DISPLAY_PHOTO);
1955f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                InputStream inputStream;
1956f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                try {
1957f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                    AssetFileDescriptor fd = cr.openAssetFileDescriptor(displayPhotoUri, "r");
1958f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                    return fd.createInputStream();
1959f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                } catch (IOException e) {
1960f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                    // fallback to the thumbnail code
1961f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                }
1962f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann           }
1963f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann
1964eb1a2ec4b2a429ceb924e6bce46b2b52c1cd85b2Dmitri Plotnikov            Uri photoUri = Uri.withAppendedPath(contactUri, Photo.CONTENT_DIRECTORY);
19651c1629da30bd1b125c59ab9bbcecff3bb3e74324Dmitri Plotnikov            if (photoUri == null) {
19661c1629da30bd1b125c59ab9bbcecff3bb3e74324Dmitri Plotnikov                return null;
19671c1629da30bd1b125c59ab9bbcecff3bb3e74324Dmitri Plotnikov            }
19683c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov            Cursor cursor = cr.query(photoUri,
1969f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                    new String[] {
1970f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                        ContactsContract.CommonDataKinds.Photo.PHOTO
1971f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann                    }, null, null, null);
19723c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov            try {
19737d6eb9a4b49f2796017bc00e92eaea4eb0a3507aMike Lockwood                if (cursor == null || !cursor.moveToNext()) {
19743c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov                    return null;
19753c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov                }
19763c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov                byte[] data = cursor.getBlob(0);
19773c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov                if (data == null) {
19783c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov                    return null;
19793c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov                }
19803c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov                return new ByteArrayInputStream(data);
19813c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov            } finally {
19827d6eb9a4b49f2796017bc00e92eaea4eb0a3507aMike Lockwood                if (cursor != null) {
19837d6eb9a4b49f2796017bc00e92eaea4eb0a3507aMike Lockwood                    cursor.close();
19847d6eb9a4b49f2796017bc00e92eaea4eb0a3507aMike Lockwood                }
19853c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov            }
19863c513ed95cee2e0bcd7208cb7e46307f09c907c9Dmitri Plotnikov        }
1987f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann
1988f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann        /**
1989f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * Opens an InputStream for the contacts's thumbnail photo and returns the
1990f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * photo as a byte stream.
1991f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * @param cr The content resolver to use for querying
1992f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * @param contactUri the contact whose photo should be used. This can be used with
1993f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * either a {@link #CONTENT_URI} or a {@link #CONTENT_LOOKUP_URI} URI.
1994f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * @return an InputStream of the photo, or null if no photo is present
1995f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * @see #openContactPhotoInputStream(ContentResolver, Uri, boolean), if instead
1996f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         * of the thumbnail the high-res picture is preferred
1997f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann         */
1998f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann        public static InputStream openContactPhotoInputStream(ContentResolver cr, Uri contactUri) {
1999f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann            return openContactPhotoInputStream(cr, contactUri, false);
2000f5d4652e028c5a8ec3d151521e63c9c9191e9149Daniel Lehmann        }
2001088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    }
2002088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
2003432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro    /**
2004432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <p>
2005432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * Constants for the user's profile data, which is represented as a single contact on
2006432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * the device that represents the user.  The profile contact is not aggregated
2007432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * together automatically in the same way that normal contacts are; instead, each
2008063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * account (including data set, if applicable) on the device may contribute a single
2009063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * raw contact representing the user's personal profile data from that source.
2010432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * </p>
2011432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <p>
2012432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * Access to the profile entry through these URIs (or incidental access to parts of
2013432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * the profile if retrieved directly via ID) requires additional permissions beyond
2014432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * the read/write contact permissions required by the provider.  Querying for profile
2015432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * data requires android.permission.READ_PROFILE permission, and inserting or
2016432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * updating profile data requires android.permission.WRITE_PROFILE permission.
2017432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * </p>
2018432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <h3>Operations</h3>
2019432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <dl>
2020432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <dt><b>Insert</b></dt>
2021432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <dd>The user's profile entry cannot be created explicitly (attempting to do so
2022432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * will throw an exception). When a raw contact is inserted into the profile, the
2023432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * provider will check for the existence of a profile on the device.  If one is
2024432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * found, the raw contact's {@link RawContacts#CONTACT_ID} column gets the _ID of
2025432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * the profile Contact. If no match is found, the profile Contact is created and
2026432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * its _ID is put into the {@link RawContacts#CONTACT_ID} column of the newly
2027432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * inserted raw contact.</dd>
2028432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <dt><b>Update</b></dt>
2029432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <dd>The profile Contact has the same update restrictions as Contacts in general,
2030432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * but requires the android.permission.WRITE_PROFILE permission.</dd>
2031432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <dt><b>Delete</b></dt>
2032432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <dd>The profile Contact cannot be explicitly deleted.  It will be removed
2033432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * automatically if all of its constituent raw contact entries are deleted.</dd>
2034432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <dt><b>Query</b></dt>
2035432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <dd>
2036432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <ul>
2037432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <li>The {@link #CONTENT_URI} for profiles behaves in much the same way as
2038432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * retrieving a contact by ID, except that it will only ever return the user's
2039432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * profile contact.
2040432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * </li>
2041432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * <li>
2042432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * The profile contact supports all of the same sub-paths as an individual contact
2043432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * does - the content of the profile contact can be retrieved as entities or
2044432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * data rows.  Similarly, specific raw contact entries can be retrieved by appending
2045432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * the desired raw contact ID within the profile.
2046432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * </li>
2047432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * </ul>
2048432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * </dd>
2049432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     * </dl>
2050432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro     */
2051432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro    public static final class Profile implements BaseColumns, ContactsColumns,
2052432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro            ContactOptionsColumns, ContactNameColumns, ContactStatusColumns {
2053432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        /**
2054432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * This utility class cannot be instantiated
2055432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         */
2056432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        private Profile() {
2057432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        }
2058432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro
2059432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        /**
2060432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * The content:// style URI for this table, which requests the contact entry
2061432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * representing the user's personal profile data.
2062432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         */
2063432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "profile");
2064432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro
2065432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        /**
2066432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * {@link Uri} for referencing the user's profile {@link Contacts} entry,
2067432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * Provides {@link OpenableColumns} columns when queried, or returns the
2068432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * user's profile contact formatted as a vCard when opened through
2069432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * {@link ContentResolver#openAssetFileDescriptor(Uri, String)}.
2070432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         */
2071432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        public static final Uri CONTENT_VCARD_URI = Uri.withAppendedPath(CONTENT_URI,
2072432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro                "as_vcard");
2073432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro
2074432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        /**
2075432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * {@link Uri} for referencing the raw contacts that make up the user's profile
2076432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * {@link Contacts} entry.  An individual raw contact entry within the profile
2077432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * can be addressed by appending the raw contact ID.  The entities or data within
2078432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * that specific raw contact can be requested by appending the entity or data
2079432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * path as well.
2080432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         */
2081432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        public static final Uri CONTENT_RAW_CONTACTS_URI = Uri.withAppendedPath(CONTENT_URI,
2082432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro                "raw_contacts");
2083063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
2084063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        /**
2085063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * The minimum ID for any entity that belongs to the profile.  This essentially
2086063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * defines an ID-space in which profile data is stored, and is used by the provider
2087063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * to determine whether a request via a non-profile-specific URI should be directed
2088063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * to the profile data rather than general contacts data, along with all the special
2089063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * permission checks that entails.
2090063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         *
2091063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * Callers may use {@link #isProfileId} to check whether a specific ID falls into
2092063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * the set of data intended for the profile.
2093063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         */
2094063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        public static final long MIN_ID = Long.MAX_VALUE - (long) Integer.MAX_VALUE;
2095063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro    }
2096063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
2097063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro    /**
2098063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * This method can be used to identify whether the given ID is associated with profile
2099063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * data.  It does not necessarily indicate that the ID is tied to valid data, merely
2100063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * that accessing data using this ID will result in profile access checks and will only
2101063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * return data from the profile.
2102063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     *
2103063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * @param id The ID to check.
2104063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * @return Whether the ID is associated with profile data.
2105063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     */
2106063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro    public static boolean isProfileId(long id) {
2107063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        return id >= Profile.MIN_ID;
2108432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro    }
2109432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro
21106e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface RawContactsColumns {
211103d9490758c9318cee6d14d3cc5007556dce92d0Fred Quintana        /**
2112dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A reference to the {@link ContactsContract.Contacts#_ID} that this
21137cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * data belongs to.
21148a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * <P>Type: INTEGER</P>
2115088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
21167cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov        public static final String CONTACT_ID = "contact_id";
2117088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
2118088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
2119d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * The data set within the account that this row belongs to.  This allows
2120d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * multiple sync adapters for the same account type to distinguish between
2121d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * each others' data.
2122d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         *
2123d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * This is empty by default, and is completely optional.  It only needs to
2124d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * be populated if multiple sync adapters are entering distinct data for
2125d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * the same account type and account name.
2126d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * <P>Type: TEXT</P>
2127d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         */
2128d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro        public static final String DATA_SET = "data_set";
2129d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro
2130d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro        /**
21311d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * A concatenation of the account type and data set (delimited by a forward
21321d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * slash) - if the data set is empty, this will be the same as the account
21331d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * type.  For applications that need to be aware of the data set, this can
21341d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * be used instead of account type to distinguish sets of data.  This is
21351d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * never intended to be used for specifying accounts.
21361d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * @hide
21371d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         */
21381d55c3343d6eb89176fb057233942887466c1b68Dave Santoro        public static final String ACCOUNT_TYPE_AND_DATA_SET = "account_type_and_data_set";
21391d55c3343d6eb89176fb057233942887466c1b68Dave Santoro
21401d55c3343d6eb89176fb057233942887466c1b68Dave Santoro        /**
21418a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * The aggregation mode for this contact.
21428a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * <P>Type: INTEGER</P>
21438a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         */
21448a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        public static final String AGGREGATION_MODE = "aggregation_mode";
2145d5f56d1467cb877aa216effd605745f5f22b1917Dmitri Plotnikov
2146d5f56d1467cb877aa216effd605745f5f22b1917Dmitri Plotnikov        /**
2147d5f56d1467cb877aa216effd605745f5f22b1917Dmitri Plotnikov         * The "deleted" flag: "0" by default, "1" if the row has been marked
2148d5f56d1467cb877aa216effd605745f5f22b1917Dmitri Plotnikov         * for deletion. When {@link android.content.ContentResolver#delete} is
2149facbbb37835020b767f259f0f625386b52b2ad89Dmitri Plotnikov         * called on a raw contact, it is marked for deletion and removed from its
21507cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * aggregate contact. The sync adaptor deletes the raw contact on the server and
2151d5f56d1467cb877aa216effd605745f5f22b1917Dmitri Plotnikov         * then calls ContactResolver.delete once more, this time passing the
215233f889ae270f888f8fdc084f5f1f3d443532a46aFred Quintana         * {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter to finalize
215333f889ae270f888f8fdc084f5f1f3d443532a46aFred Quintana         * the data removal.
2154d5f56d1467cb877aa216effd605745f5f22b1917Dmitri Plotnikov         * <P>Type: INTEGER</P>
2155d5f56d1467cb877aa216effd605745f5f22b1917Dmitri Plotnikov         */
2156d5f56d1467cb877aa216effd605745f5f22b1917Dmitri Plotnikov        public static final String DELETED = "deleted";
2157918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov
2158918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov        /**
2159918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * The "name_verified" flag: "1" means that the name fields on this raw
2160918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * contact can be trusted and therefore should be used for the entire
2161918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * aggregated contact.
2162918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * <p>
2163918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * If an aggregated contact contains more than one raw contact with a
2164918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * verified name, one of those verified names is chosen at random.
2165918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * If an aggregated contact contains no verified names, the
2166918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * name is chosen randomly from the constituent raw contacts.
2167918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * </p>
2168918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * <p>
2169918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * Updating this flag from "0" to "1" automatically resets it to "0" on
2170918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * all other raw contacts in the same aggregated contact.
2171918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * </p>
2172918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * <p>
2173918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * Sync adapters should only specify a value for this column when
2174918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * inserting a raw contact and leave it out when doing an update.
2175918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * </p>
2176918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * <p>
2177918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * The default value is "0"
2178918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * </p>
2179918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * <p>Type: INTEGER</p>
2180918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         *
2181918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         * @hide
2182918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov         */
2183918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov        public static final String NAME_VERIFIED = "name_verified";
218430b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov
218530b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        /**
218630b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * The "read-only" flag: "0" by default, "1" if the row cannot be modified or
218730b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * deleted except by a sync adapter.  See {@link ContactsContract#CALLER_IS_SYNCADAPTER}.
218830b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * <P>Type: INTEGER</P>
218930b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         */
219086fe839284277eeab5cb4272392bd004822edec8Dmitri Plotnikov        public static final String RAW_CONTACT_IS_READ_ONLY = "raw_contact_is_read_only";
2191432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro
2192432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        /**
2193432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * Flag that reflects whether this raw contact belongs to the user's
2194432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         * personal profile entry.
2195432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro         */
2196432513380e8ea8f4c70853190bfd55a9186407f4Dave Santoro        public static final String RAW_CONTACT_IS_USER_PROFILE = "raw_contact_is_user_profile";
21978a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey    }
21988a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
21998a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey    /**
2200d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Constants for the raw contacts table, which contains one row of contact
2201d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * information for each person in each synced account. Sync adapters and
2202d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * contact management apps
22032365ded4465332cc1de7fa661e2198854153d6ddDmitri Plotnikov     * are the primary consumers of this API.
2204d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     *
2205d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <h3>Aggregation</h3>
2206d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <p>
2207d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * As soon as a raw contact is inserted or whenever its constituent data
2208d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * changes, the provider will check if the raw contact matches other
2209d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * existing raw contacts and if so will aggregate it with those. The
2210d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * aggregation is reflected in the {@link RawContacts} table by the change of the
2211d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * {@link #CONTACT_ID} field, which is the reference to the aggregate contact.
2212d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * </p>
2213d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <p>
2214d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Changes to the structured name, organization, phone number, email address,
2215d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * or nickname trigger a re-aggregation.
2216d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * </p>
2217d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <p>
2218d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * See also {@link AggregationExceptions} for a mechanism to control
2219d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * aggregation programmatically.
2220d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * </p>
2221d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     *
2222dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h3>Operations</h3>
2223dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dl>
2224dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Insert</b></dt>
2225d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <dd>
2226d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <p>
2227d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Raw contacts can be inserted incrementally or in a batch.
2228d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * The incremental method is more traditional but less efficient.
2229d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * It should be used
2230d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * only if no {@link Data} values are available at the time the raw contact is created:
2231dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
2232dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * ContentValues values = new ContentValues();
2233dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.put(RawContacts.ACCOUNT_TYPE, accountType);
2234dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.put(RawContacts.ACCOUNT_NAME, accountName);
2235dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Uri rawContactUri = getContentResolver().insert(RawContacts.CONTENT_URI, values);
2236dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * long rawContactId = ContentUris.parseId(rawContactUri);
2237dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
2238d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * </p>
2239dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
2240d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Once {@link Data} values become available, insert those.
2241d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * For example, here's how you would insert a name:
2242dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
2243dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
2244dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.clear();
2245dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.put(Data.RAW_CONTACT_ID, rawContactId);
2246dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);
2247dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.put(StructuredName.DISPLAY_NAME, &quot;Mike Sullivan&quot;);
2248dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * getContentResolver().insert(Data.CONTENT_URI, values);
2249dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
2250dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
2251dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
2252dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * The batch method is by far preferred.  It inserts the raw contact and its
2253dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * constituent data rows in a single database transaction
2254dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * and causes at most one aggregation pass.
2255dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
2256beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     * ArrayList&lt;ContentProviderOperation&gt; ops =
2257beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     *          new ArrayList&lt;ContentProviderOperation&gt;();
2258d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * ...
2259dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * int rawContactInsertIndex = ops.size();
2260dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI)
2261dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValue(RawContacts.ACCOUNT_TYPE, accountType)
2262dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValue(RawContacts.ACCOUNT_NAME, accountName)
2263dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .build());
2264dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
2265dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
2266dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex)
2267dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)
2268dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValue(StructuredName.DISPLAY_NAME, &quot;Mike Sullivan&quot;)
2269dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .build());
2270dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
2271dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
2272dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
2273dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
2274dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
2275d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Note the use of {@link ContentProviderOperation.Builder#withValueBackReference(String, int)}
2276d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * to refer to the as-yet-unknown index value of the raw contact inserted in the
2277d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * first operation.
2278dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
2279d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     *
2280dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Update</b></dt>
2281d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <dd><p>
2282d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Raw contacts can be updated incrementally or in a batch.
2283d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Batch mode should be used whenever possible.
2284d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * The procedures and considerations are analogous to those documented above for inserts.
2285d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * </p></dd>
2286dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Delete</b></dt>
2287dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd><p>When a raw contact is deleted, all of its Data rows as well as StatusUpdates,
2288dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * AggregationExceptions, PhoneLookup rows are deleted automatically. When all raw
2289d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * contacts associated with a {@link Contacts} row are deleted, the {@link Contacts} row
2290d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * itself is also deleted automatically.
2291dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
2292dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
2293d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * The invocation of {@code resolver.delete(...)}, does not immediately delete
2294d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * a raw contacts row.
2295d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Instead, it sets the {@link #DELETED} flag on the raw contact and
2296dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * removes the raw contact from its aggregate contact.
2297dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * The sync adapter then deletes the raw contact from the server and
2298dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * finalizes phone-side deletion by calling {@code resolver.delete(...)}
2299328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana     * again and passing the {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter.<p>
2300dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>Some sync adapters are read-only, meaning that they only sync server-side
2301dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * changes to the phone, but not the reverse.  If one of those raw contacts
2302dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * is marked for deletion, it will remain on the phone.  However it will be
2303dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * effectively invisible, because it will not be part of any aggregate contact.
2304dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dd>
2305d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     *
2306dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Query</b></dt>
2307dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>
2308dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
2309d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * It is easy to find all raw contacts in a Contact:
2310dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
2311dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Cursor c = getContentResolver().query(RawContacts.CONTENT_URI,
2312dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          new String[]{RawContacts._ID},
2313dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          RawContacts.CONTACT_ID + "=?",
2314dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          new String[]{String.valueOf(contactId)}, null);
2315dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
2316dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
2317dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
2318d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * To find raw contacts within a specific account,
2319dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * you can either put the account name and type in the selection or pass them as query
2320dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * parameters.  The latter approach is preferable, especially when you can reuse the
2321dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * URI:
2322dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
2323dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Uri rawContactUri = RawContacts.URI.buildUpon()
2324dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName)
2325dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType)
2326dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .build();
2327dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Cursor c1 = getContentResolver().query(rawContactUri,
2328dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          RawContacts.STARRED + "&lt;&gt;0", null, null, null);
2329dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * ...
2330dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Cursor c2 = getContentResolver().query(rawContactUri,
2331dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          RawContacts.DELETED + "&lt;&gt;0", null, null, null);
2332dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
2333dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
2334dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>The best way to read a raw contact along with all the data associated with it is
2335dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * by using the {@link Entity} directory. If the raw contact has data rows,
2336dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * the Entity cursor will contain a row for each data row.  If the raw contact has no
2337dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * data rows, the cursor will still contain one row with the raw contact-level information.
2338dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
2339dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
2340dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Uri entityUri = Uri.withAppendedPath(rawContactUri, Entity.CONTENT_DIRECTORY);
2341dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Cursor c = getContentResolver().query(entityUri,
2342dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          new String[]{RawContacts.SOURCE_ID, Entity.DATA_ID, Entity.MIMETYPE, Entity.DATA1},
2343dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          null, null, null);
2344dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * try {
2345dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *     while (c.moveToNext()) {
2346dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *         String sourceId = c.getString(0);
2347dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *         if (!c.isNull(1)) {
2348dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *             String mimeType = c.getString(2);
2349dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *             String data = c.getString(3);
2350dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *             ...
2351dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *         }
2352dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *     }
2353dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * } finally {
2354dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *     c.close();
2355dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * }
2356dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
2357dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
2358dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dd>
2359dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dl>
2360dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h2>Columns</h2>
2361d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     *
2362dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
2363dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2364dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>RawContacts</th>
2365dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2366dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2367dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
2368dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #_ID}</td>
2369dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
2370d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <td>Row ID. Sync adapters should try to preserve row IDs during updates. In other words,
2371d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * it is much better for a sync adapter to update a raw contact rather than to delete and
2372d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * re-insert it.</td>
2373dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2374dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2375dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
2376dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_ID}</td>
2377dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
2378d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <td>The ID of the row in the {@link ContactsContract.Contacts} table
2379d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * that this raw contact belongs
2380dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * to. Raw contacts are linked to contacts by the aggregation process, which can be controlled
2381dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * by the {@link #AGGREGATION_MODE} field and {@link AggregationExceptions}.</td>
2382dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2383dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2384dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
2385dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #AGGREGATION_MODE}</td>
2386dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2387dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>A mechanism that allows programmatic control of the aggregation process. The allowed
2388dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values are {@link #AGGREGATION_MODE_DEFAULT}, {@link #AGGREGATION_MODE_DISABLED}
2389dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * and {@link #AGGREGATION_MODE_SUSPENDED}. See also {@link AggregationExceptions}.</td>
2390dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2391dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2392dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
2393dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #DELETED}</td>
2394dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2395dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The "deleted" flag: "0" by default, "1" if the row has been marked
2396dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * for deletion. When {@link android.content.ContentResolver#delete} is
2397dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * called on a raw contact, it is marked for deletion and removed from its
2398dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * aggregate contact. The sync adaptor deletes the raw contact on the server and
2399dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * then calls ContactResolver.delete once more, this time passing the
2400dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter to finalize
2401dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * the data removal.</td>
2402dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2403dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2404dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
2405dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #TIMES_CONTACTED}</td>
2406dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2407dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The number of times the contact has been contacted. To have an effect
2408dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * on the corresponding value of the aggregate contact, this field
2409dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * should be set at the time the raw contact is inserted.
2410d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * After that, this value is typically updated via
2411d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * {@link ContactsContract.Contacts#markAsContacted}.</td>
2412dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2413dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2414dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
2415dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #LAST_TIME_CONTACTED}</td>
2416dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2417dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The timestamp of the last time the contact was contacted. To have an effect
2418dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * on the corresponding value of the aggregate contact, this field
2419dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * should be set at the time the raw contact is inserted.
2420d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * After that, this value is typically updated via
2421d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * {@link ContactsContract.Contacts#markAsContacted}.
2422d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * </td>
2423dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2424dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2425dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
2426dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STARRED}</td>
2427dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2428dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>An indicator for favorite contacts: '1' if favorite, '0' otherwise.
2429d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Changing this field immediately affects the corresponding aggregate contact:
2430dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * if any raw contacts in that aggregate contact are starred, then the contact
2431dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * itself is marked as starred.</td>
2432dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2433dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2434dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
2435dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CUSTOM_RINGTONE}</td>
2436dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2437dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>A custom ringtone associated with a raw contact. Typically this is the
2438dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * URI returned by an activity launched with the
2439dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link android.media.RingtoneManager#ACTION_RINGTONE_PICKER} intent.
2440dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * To have an effect on the corresponding value of the aggregate contact, this field
2441dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * should be set at the time the raw contact is inserted. To set a custom
2442d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * ringtone on a contact, use the field {@link ContactsContract.Contacts#CUSTOM_RINGTONE
2443d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Contacts.CUSTOM_RINGTONE}
2444dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * instead.</td>
2445dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2446dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2447dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
2448dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SEND_TO_VOICEMAIL}</td>
2449dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2450dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>An indicator of whether calls from this raw contact should be forwarded
2451dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * directly to voice mail ('1') or not ('0'). To have an effect
2452dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * on the corresponding value of the aggregate contact, this field
2453dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * should be set at the time the raw contact is inserted.</td>
2454dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2455dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2456dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
2457dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #ACCOUNT_NAME}</td>
2458dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write-once</td>
2459dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The name of the account instance to which this row belongs, which when paired with
2460d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * {@link #ACCOUNT_TYPE} identifies a specific account.
2461d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * For example, this will be the Gmail address if it is a Google account.
2462d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * It should be set at the time the raw contact is inserted and never
2463d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * changed afterwards.</td>
2464dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2465dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2466dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
2467dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #ACCOUNT_TYPE}</td>
2468dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write-once</td>
2469d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <td>
2470d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <p>
2471d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * The type of account to which this row belongs, which when paired with
2472d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * {@link #ACCOUNT_NAME} identifies a specific account.
2473d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * It should be set at the time the raw contact is inserted and never
2474d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * changed afterwards.
2475d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * </p>
2476d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <p>
2477d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * To ensure uniqueness, new account types should be chosen according to the
2478d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Java package naming convention.  Thus a Google account is of type "com.google".
2479d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * </p>
2480d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * </td>
2481dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2482dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2483dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
2484d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <td>{@link #DATA_SET}</td>
2485d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <td>read/write-once</td>
2486d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <td>
2487d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <p>
2488d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * The data set within the account that this row belongs to.  This allows
2489d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * multiple sync adapters for the same account type to distinguish between
2490d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * each others' data.  The combination of {@link #ACCOUNT_TYPE},
2491d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * {@link #ACCOUNT_NAME}, and {@link #DATA_SET} identifies a set of data
2492d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * that is associated with a single sync adapter.
2493d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * </p>
2494d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <p>
2495d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * This is empty by default, and is completely optional.  It only needs to
2496d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * be populated if multiple sync adapters are entering distinct data for
2497d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * the same account type and account name.
2498d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * </p>
2499d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <p>
2500d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * It should be set at the time the raw contact is inserted and never
2501d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * changed afterwards.
2502d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * </p>
2503d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * </td>
2504d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * </tr>
2505d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <tr>
2506d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <td>String</td>
2507dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SOURCE_ID}</td>
2508dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2509dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String that uniquely identifies this row to its source account.
2510dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Typically it is set at the time the raw contact is inserted and never
2511dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * changed afterwards. The one notable exception is a new raw contact: it
2512d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * will have an account name and type (and possibly a data set), but no
2513d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * source id. This indicates to the sync adapter that a new contact needs
2514d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * to be created server-side and its ID stored in the corresponding
2515d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * SOURCE_ID field on the phone.
2516dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
2517dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2518dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2519dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
2520dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #VERSION}</td>
2521dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
2522dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Version number that is updated whenever this row or its related data
2523dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * changes. This field can be used for optimistic locking of a raw contact.
2524dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
2525dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2526dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2527dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
2528dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #DIRTY}</td>
2529dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2530dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Flag indicating that {@link #VERSION} has changed, and this row needs
2531dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * to be synchronized by its owning account.  The value is set to "1" automatically
2532dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * whenever the raw contact changes, unless the URI has the
2533dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter specified.
2534dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * The sync adapter should always supply this query parameter to prevent
2535dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * unnecessary synchronization: user changes some data on the server,
2536dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * the sync adapter updates the contact on the phone (without the
2537dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * CALLER_IS_SYNCADAPTER flag) flag, which sets the DIRTY flag,
2538dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * which triggers a sync to bring the changes to the server.
2539dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
2540dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2541dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2542dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
2543dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SYNC1}</td>
2544dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2545d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <td>Generic column provided for arbitrary use by sync adapters.
2546d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * The content provider
2547dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * stores this information on behalf of the sync adapter but does not
2548dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * interpret it in any way.
2549dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
2550dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2551dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2552dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
2553dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SYNC2}</td>
2554dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2555dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Generic column for use by sync adapters.
2556dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
2557dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2558dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2559dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
2560dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SYNC3}</td>
2561dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2562dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Generic column for use by sync adapters.
2563dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
2564dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2565dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
2566dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
2567dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SYNC4}</td>
2568dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
2569dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Generic column for use by sync adapters.
2570dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
2571dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
2572dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
25738a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey     */
25747cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov    public static final class RawContacts implements BaseColumns, RawContactsColumns,
257507ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov            ContactOptionsColumns, ContactNameColumns, SyncColumns  {
25768a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        /**
25778a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * This utility class cannot be instantiated
25788a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         */
25792365ded4465332cc1de7fa661e2198854153d6ddDmitri Plotnikov        private RawContacts() {
25808a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        }
25818a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
25828a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        /**
2583d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * The content:// style URI for this table, which requests a directory of
2584d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * raw contact rows matching the selection criteria.
2585088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
2586facbbb37835020b767f259f0f625386b52b2ad89Dmitri Plotnikov        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "raw_contacts");
2587088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
2588088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
2589d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * The MIME type of the results from {@link #CONTENT_URI} when a specific
2590d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * ID value is not provided, and multiple raw contacts may be returned.
2591088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
25927cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact";
2593088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
2594088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
2595d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * The MIME type of the results when a raw contact ID is appended to {@link #CONTENT_URI},
2596d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * yielding a subdirectory of a single person.
2597088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
25987cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/raw_contact";
2599088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
2600088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
2601d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * Aggregation mode: aggregate immediately after insert or update operation(s) are complete.
2602c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov         */
2603c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov        public static final int AGGREGATION_MODE_DEFAULT = 0;
2604c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov
2605c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov        /**
26061ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * Aggregation mode: aggregate at the time the raw contact is inserted/updated.
26071ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * @deprecated Aggregation is synchronous, this historic value is a no-op
2608c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov         */
26091ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov        @Deprecated
2610bc9aa775ae244977e840fc2c21e03a039b399af8Omari Stephens        public static final int AGGREGATION_MODE_IMMEDIATE = 1;
2611c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov
2612c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov        /**
2613d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * <p>
2614d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * Aggregation mode: aggregation suspended temporarily, and is likely to be resumed later.
2615d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * Changes to the raw contact will update the associated aggregate contact but will not
2616d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * result in any change in how the contact is aggregated. Similar to
2617d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * {@link #AGGREGATION_MODE_DISABLED}, but maintains a link to the corresponding
2618d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * {@link Contacts} aggregate.
2619d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * </p>
2620d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * <p>
2621d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * This can be used to postpone aggregation until after a series of updates, for better
2622d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * performance and/or user experience.
2623d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * </p>
2624d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * <p>
2625d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * Note that changing
26265223b1668a987d90cdbd7f6c62ca17486281893bDmitri Plotnikov         * {@link #AGGREGATION_MODE} from {@link #AGGREGATION_MODE_SUSPENDED} to
2627d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * {@link #AGGREGATION_MODE_DEFAULT} does not trigger an aggregation pass, but any
2628d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * subsequent
26295223b1668a987d90cdbd7f6c62ca17486281893bDmitri Plotnikov         * change to the raw contact's data will.
2630d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * </p>
26315223b1668a987d90cdbd7f6c62ca17486281893bDmitri Plotnikov         */
26325223b1668a987d90cdbd7f6c62ca17486281893bDmitri Plotnikov        public static final int AGGREGATION_MODE_SUSPENDED = 2;
26335223b1668a987d90cdbd7f6c62ca17486281893bDmitri Plotnikov
26345223b1668a987d90cdbd7f6c62ca17486281893bDmitri Plotnikov        /**
2635d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * <p>
2636d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * Aggregation mode: never aggregate this raw contact.  The raw contact will not
2637d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * have a corresponding {@link Contacts} aggregate and therefore will not be included in
2638d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * {@link Contacts} query results.
2639d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * </p>
2640d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * <p>
2641d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * For example, this mode can be used for a raw contact that is marked for deletion while
2642d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * waiting for the deletion to occur on the server side.
2643d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * </p>
2644d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         *
2645d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * @see #AGGREGATION_MODE_SUSPENDED
2646c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov         */
26475223b1668a987d90cdbd7f6c62ca17486281893bDmitri Plotnikov        public static final int AGGREGATION_MODE_DISABLED = 3;
2648c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov
2649c991bfc53ff287c512a8ba567135499cc4157900Dmitri Plotnikov        /**
2650f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton         * Build a {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}
2651f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton         * style {@link Uri} for the parent {@link android.provider.ContactsContract.Contacts}
2652f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton         * entry of the given {@link RawContacts} entry.
26536449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
26546449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        public static Uri getContactLookupUri(ContentResolver resolver, Uri rawContactUri) {
26556449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            // TODO: use a lighter query by joining rawcontacts with contacts in provider
26566449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            final Uri dataUri = Uri.withAppendedPath(rawContactUri, Data.CONTENT_DIRECTORY);
26576449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            final Cursor cursor = resolver.query(dataUri, new String[] {
26586449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    RawContacts.CONTACT_ID, Contacts.LOOKUP_KEY
26596449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            }, null, null, null);
26606449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
26616449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            Uri lookupUri = null;
26626449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            try {
26636449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                if (cursor != null && cursor.moveToFirst()) {
26646449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    final long contactId = cursor.getLong(0);
26656449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    final String lookupKey = cursor.getString(1);
26666449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    return Contacts.getLookupUri(contactId, lookupKey);
26676449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                }
26686449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            } finally {
26696449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                if (cursor != null) cursor.close();
26706449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            }
26716449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            return lookupUri;
26726449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        }
26736449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
26746449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
2675d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * A sub-directory of a single raw contact that contains all of its
2676dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * {@link ContactsContract.Data} rows. To access this directory
26771ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * append {@link Data#CONTENT_DIRECTORY} to the raw contact URI.
2678088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
2679088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final class Data implements BaseColumns, DataColumns {
2680088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
2681088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * no public constructor since this is a utility class
2682088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
26838a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            private Data() {
26848a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            }
2685088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
2686088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
2687088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * The directory twig for this sub-table
2688088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
2689088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final String CONTENT_DIRECTORY = "data";
2690088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
26915bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana
26925bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        /**
2693dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
2694d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * A sub-directory of a single raw contact that contains all of its
2695dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * {@link ContactsContract.Data} rows. To access this directory append
26961ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * {@link RawContacts.Entity#CONTENT_DIRECTORY} to the raw contact URI. See
2697dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * {@link RawContactsEntity} for a stand-alone table containing the same
2698dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * data.
2699dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
2700dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
2701d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * Entity has two ID fields: {@link #_ID} for the raw contact
2702d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * and {@link #DATA_ID} for the data rows.
2703d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * Entity always contains at least one row, even if there are no
2704dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * actual data rows. In this case the {@link #DATA_ID} field will be
2705d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * null.
2706d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * </p>
2707d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * <p>
27081ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * Using Entity should be preferred to using two separate queries:
27091ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * RawContacts followed by Data. The reason is that Entity reads all
27101ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * data for a raw contact in one transaction, so there is no possibility
27111ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * of the data changing between the two queries.
27125bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         */
27135bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        public static final class Entity implements BaseColumns, DataColumns {
27145bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana            /**
27155bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana             * no public constructor since this is a utility class
27165bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana             */
27175bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana            private Entity() {
27185bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana            }
27195bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana
27205bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana            /**
27215bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana             * The directory twig for this sub-table
27225bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana             */
27235bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana            public static final String CONTENT_DIRECTORY = "entity";
27245bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana
27255bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana            /**
2726b2ce481c81414489c26bb59304a7705d9ef19573Dmitri Plotnikov             * The ID of the data row. The value will be null if this raw contact has no
27275bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana             * data rows.
27285bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana             * <P>Type: INTEGER</P>
27295bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana             */
27305bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana            public static final String DATA_ID = "data_id";
27315bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        }
2732328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
2733d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill        /**
2734d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <p>
2735d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * A sub-directory of a single raw contact that contains all of its
2736d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * {@link ContactsContract.StreamItems} rows. To access this directory append
2737d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * {@link RawContacts.StreamItems#CONTENT_DIRECTORY} to the raw contact URI. See
2738d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * {@link ContactsContract.StreamItems} for a stand-alone table containing the
2739d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * same data.
2740d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * </p>
27410b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * <p>
27420b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * Access to the social stream through this sub-directory requires additional permissions
27430b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * beyond the read/write contact permissions required by the provider.  Querying for
27440b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * social stream data requires android.permission.READ_SOCIAL_STREAM permission, and
27450b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * inserting or updating social stream items requires android.permission.WRITE_SOCIAL_STREAM
27460b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * permission.
27470b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * </p>
2748d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
2749d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final class StreamItems implements BaseColumns, StreamItemsColumns {
2750d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            /**
2751d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             * No public constructor since this is a utility class
2752d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             */
2753d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            private StreamItems() {
2754d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            }
2755d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
2756d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            /**
2757d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             * The directory twig for this sub-table
2758d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             */
2759d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            public static final String CONTENT_DIRECTORY = "stream_items";
2760d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        }
2761d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
2762d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
2763a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <p>
2764a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * A sub-directory of a single raw contact that represents its primary
2765a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * display photo.  To access this directory append
2766a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * {@link RawContacts.DisplayPhoto#CONTENT_DIRECTORY} to the raw contact URI.
2767a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * The resulting URI represents an image file, and should be interacted with
2768040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * using ContentResolver.openAssetFileDescriptor.
2769a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <p>
2770a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <p>
2771a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * Note that this sub-directory also supports opening the photo as an asset file
2772a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * in write mode.  Callers can create or replace the primary photo associated
2773a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * with this raw contact by opening the asset file and writing the full-size
2774a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * photo contents into it.  When the file is closed, the image will be parsed,
2775a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * sized down if necessary for the full-size display photo and thumbnail
2776a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * dimensions, and stored.
2777a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * </p>
2778a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <p>
2779a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * Usage example:
2780a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <pre>
2781a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * public void writeDisplayPhoto(long rawContactId, byte[] photo) {
2782a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *     Uri rawContactPhotoUri = Uri.withAppendedPath(
2783a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *             ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId),
2784a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *             RawContacts.DisplayPhoto.CONTENT_DIRECTORY);
2785a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *     try {
2786a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *         AssetFileDescriptor fd =
2787040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         *             getContentResolver().openAssetFileDescriptor(rawContactPhotoUri, "rw");
2788a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *         OutputStream os = fd.createOutputStream();
2789a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *         os.write(photo);
2790a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *         os.close();
2791a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *         fd.close();
2792a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *     } catch (IOException e) {
2793a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *         // Handle error cases.
2794a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         *     }
2795a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * }
2796a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * </pre>
2797a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * </p>
2798a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
2799a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        public static final class DisplayPhoto {
2800a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            /**
2801a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * No public constructor since this is a utility class
2802a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             */
2803a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            private DisplayPhoto() {
2804a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            }
2805a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
2806a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            /**
2807a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * The directory twig for this sub-table
2808a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             */
2809a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            public static final String CONTENT_DIRECTORY = "display_photo";
2810a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        }
2811a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
2812a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
2813d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * TODO: javadoc
2814d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * @param cursor
2815d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         * @return
2816d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill         */
2817328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana        public static EntityIterator newEntityIterator(Cursor cursor) {
2818328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            return new EntityIteratorImpl(cursor);
2819328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana        }
2820328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
2821328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana        private static class EntityIteratorImpl extends CursorEntityIterator {
2822328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            private static final String[] DATA_KEYS = new String[]{
2823328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA1,
2824328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA2,
2825328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA3,
2826328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA4,
2827328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA5,
2828328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA6,
2829328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA7,
2830328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA8,
2831328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA9,
2832328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA10,
2833328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA11,
2834328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA12,
2835328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA13,
2836328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA14,
2837328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.DATA15,
2838328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.SYNC1,
2839328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.SYNC2,
2840328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.SYNC3,
2841328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    Data.SYNC4};
2842328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
2843328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            public EntityIteratorImpl(Cursor cursor) {
2844328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                super(cursor);
2845328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            }
2846328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
2847b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov            @Override
2848328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            public android.content.Entity getEntityAndIncrementCursor(Cursor cursor)
2849328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    throws RemoteException {
2850328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                final int columnRawContactId = cursor.getColumnIndexOrThrow(RawContacts._ID);
2851328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                final long rawContactId = cursor.getLong(columnRawContactId);
2852328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
2853328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                // we expect the cursor is already at the row we need to read from
2854328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                ContentValues cv = new ContentValues();
2855328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ACCOUNT_NAME);
2856328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ACCOUNT_TYPE);
28571d837232d2b86ecb844c586db76ccf1ddfda4cf0Katherine Kuan                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, DATA_SET);
2858328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, _ID);
2859328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DIRTY);
2860328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, VERSION);
2861328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SOURCE_ID);
2862328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC1);
2863328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC2);
2864328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC3);
2865328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC4);
2866328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DELETED);
2867328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, CONTACT_ID);
2868328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, STARRED);
2869918007b75539f5eabfd173a369c2da628c607ba7Dmitri Plotnikov                DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, NAME_VERIFIED);
2870328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                android.content.Entity contact = new android.content.Entity(cv);
2871328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
2872328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                // read data rows until the contact id changes
2873328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                do {
2874328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    if (rawContactId != cursor.getLong(columnRawContactId)) {
2875328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                        break;
2876328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    }
2877328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    // add the data to to the contact
2878328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    cv = new ContentValues();
2879328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    cv.put(Data._ID, cursor.getLong(cursor.getColumnIndexOrThrow(Entity.DATA_ID)));
2880328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
2881328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                            Data.RES_PACKAGE);
2882328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Data.MIMETYPE);
2883328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, Data.IS_PRIMARY);
2884328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv,
2885328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                            Data.IS_SUPER_PRIMARY);
2886328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, Data.DATA_VERSION);
2887328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
2888328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                            CommonDataKinds.GroupMembership.GROUP_SOURCE_ID);
2889328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
2890328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                            Data.DATA_VERSION);
2891328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    for (String key : DATA_KEYS) {
2892328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                        final int columnIndex = cursor.getColumnIndexOrThrow(key);
2893156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                        switch (cursor.getType(columnIndex)) {
2894156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                            case Cursor.FIELD_TYPE_NULL:
2895156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                                // don't put anything
2896156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                                break;
2897156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                            case Cursor.FIELD_TYPE_INTEGER:
2898156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                            case Cursor.FIELD_TYPE_FLOAT:
2899156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                            case Cursor.FIELD_TYPE_STRING:
2900274dc9d35fdf5d0464f74071a9a8f14e497d4d5fFred Quintana                                cv.put(key, cursor.getString(columnIndex));
2901156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                                break;
2902156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                            case Cursor.FIELD_TYPE_BLOB:
2903274dc9d35fdf5d0464f74071a9a8f14e497d4d5fFred Quintana                                cv.put(key, cursor.getBlob(columnIndex));
2904156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                                break;
2905156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                            default:
2906156add957525746a4f7a430a6ba0cff8d1342339Daniel Lehmann                                throw new IllegalStateException("Invalid or unhandled data type");
2907328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                        }
2908328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    }
2909328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                    contact.addSubValue(ContactsContract.Data.CONTENT_URI, cv);
2910328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                } while (cursor.moveToNext());
2911328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
2912328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                return contact;
2913328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            }
2914328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
2915328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana        }
2916088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    }
2917088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
2918dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov    /**
2919dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Social status update columns.
2920dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
2921dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see StatusUpdates
2922dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see ContactsContract.Data
2923dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     */
2924f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton    protected interface StatusColumns {
2925879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        /**
2926a60479d2ea7857455ebad6c56e357d00b0492364Dmitri Plotnikov         * Contact's latest presence level.
2927879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * <P>Type: INTEGER (one of the values below)</P>
2928879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         */
2929f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        public static final String PRESENCE = "mode";
2930f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton
2931f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        /**
2932f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton         * @deprecated use {@link #PRESENCE}
2933f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton         */
2934f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        @Deprecated
2935f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        public static final String PRESENCE_STATUS = PRESENCE;
2936f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton
2937244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill        /**
2938244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * An allowed value of {@link #PRESENCE}.
2939f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton         */
2940f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        int OFFLINE = 0;
2941244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill
2942244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill        /**
2943244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * An allowed value of {@link #PRESENCE}.
2944244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         */
2945f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        int INVISIBLE = 1;
2946244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill
2947244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill        /**
2948244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * An allowed value of {@link #PRESENCE}.
2949244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         */
2950f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        int AWAY = 2;
2951244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill
2952244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill        /**
2953244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * An allowed value of {@link #PRESENCE}.
2954244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         */
2955f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        int IDLE = 3;
2956244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill
2957244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill        /**
2958244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * An allowed value of {@link #PRESENCE}.
2959244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         */
2960f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        int DO_NOT_DISTURB = 4;
2961244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill
2962244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill        /**
2963244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * An allowed value of {@link #PRESENCE}.
2964244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         */
2965f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        int AVAILABLE = 5;
2966879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov
2967879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        /**
2968879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * Contact latest status update.
2969879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * <p>Type: TEXT</p>
2970879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         */
2971f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        public static final String STATUS = "status";
2972f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton
2973f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        /**
2974f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton         * @deprecated use {@link #STATUS}
2975f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton         */
2976244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill        @Deprecated
2977f3960b1271c65d64f9836894af600948bd804e7cJeff Hamilton        public static final String PRESENCE_CUSTOM_STATUS = STATUS;
2978879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov
2979879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        /**
2980879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * The absolute time in milliseconds when the latest status was inserted/updated.
2981879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * <p>Type: NUMBER</p>
2982879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         */
2983879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String STATUS_TIMESTAMP = "status_ts";
2984879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov
2985879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        /**
2986879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * The package containing resources for this status: label and icon.
2987040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * <p>Type: TEXT</p>
2988879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         */
2989879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String STATUS_RES_PACKAGE = "status_res_package";
2990879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov
2991879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        /**
2992879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * The resource ID of the label describing the source of the status update, e.g. "Google
2993879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * Talk".  This resource should be scoped by the {@link #STATUS_RES_PACKAGE}.
2994879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * <p>Type: NUMBER</p>
2995879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         */
2996879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String STATUS_LABEL = "status_label";
2997879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov
2998879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        /**
2999879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * The resource ID of the icon for the source of the status update.
3000879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * This resource should be scoped by the {@link #STATUS_RES_PACKAGE}.
3001879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * <p>Type: NUMBER</p>
3002879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         */
3003879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String STATUS_ICON = "status_icon";
30045b31498ba1f9874f395d80152304512fa4c0144dVasu Nori
30055b31498ba1f9874f395d80152304512fa4c0144dVasu Nori        /**
30065b31498ba1f9874f395d80152304512fa4c0144dVasu Nori         * Contact's audio/video chat capability level.
30075b31498ba1f9874f395d80152304512fa4c0144dVasu Nori         * <P>Type: INTEGER (one of the values below)</P>
30085b31498ba1f9874f395d80152304512fa4c0144dVasu Nori         */
30095b31498ba1f9874f395d80152304512fa4c0144dVasu Nori        public static final String CHAT_CAPABILITY = "chat_capability";
30105b31498ba1f9874f395d80152304512fa4c0144dVasu Nori
30115b31498ba1f9874f395d80152304512fa4c0144dVasu Nori        /**
3012b332747ee087d2baa5c54b3382e57ad435158737Daniel Lehmann         * An allowed flag of {@link #CHAT_CAPABILITY}. Indicates audio-chat capability (microphone
3013b332747ee087d2baa5c54b3382e57ad435158737Daniel Lehmann         * and speaker)
30145b31498ba1f9874f395d80152304512fa4c0144dVasu Nori         */
3015b332747ee087d2baa5c54b3382e57ad435158737Daniel Lehmann        public static final int CAPABILITY_HAS_VOICE = 1;
30165b31498ba1f9874f395d80152304512fa4c0144dVasu Nori
30175b31498ba1f9874f395d80152304512fa4c0144dVasu Nori        /**
3018b332747ee087d2baa5c54b3382e57ad435158737Daniel Lehmann         * An allowed flag of {@link #CHAT_CAPABILITY}. Indicates that the contact's device can
3019b332747ee087d2baa5c54b3382e57ad435158737Daniel Lehmann         * display a video feed.
30205b31498ba1f9874f395d80152304512fa4c0144dVasu Nori         */
3021b332747ee087d2baa5c54b3382e57ad435158737Daniel Lehmann        public static final int CAPABILITY_HAS_VIDEO = 2;
30225b31498ba1f9874f395d80152304512fa4c0144dVasu Nori
30235b31498ba1f9874f395d80152304512fa4c0144dVasu Nori        /**
3024b332747ee087d2baa5c54b3382e57ad435158737Daniel Lehmann         * An allowed flag of {@link #CHAT_CAPABILITY}. Indicates that the contact's device has a
30255b31498ba1f9874f395d80152304512fa4c0144dVasu Nori         * camera that can be used for video chat (e.g. a front-facing camera on a phone).
30265b31498ba1f9874f395d80152304512fa4c0144dVasu Nori         */
30275b31498ba1f9874f395d80152304512fa4c0144dVasu Nori        public static final int CAPABILITY_HAS_CAMERA = 4;
3028879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov    }
3029879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov
3030dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov    /**
3031d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <p>
3032d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Constants for the stream_items table, which contains social stream updates from
3033d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * the user's contact list.
3034d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </p>
3035d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <p>
3036d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Only a certain number of stream items will ever be stored under a given raw contact.
3037d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Users of this API can query {@link ContactsContract.StreamItems#CONTENT_LIMIT_URI} to
3038d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * determine this limit, and should restrict the number of items inserted in any given
3039d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * transaction correspondingly.  Insertion of more items beyond the limit will
3040d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * automatically lead to deletion of the oldest items, by {@link StreamItems#TIMESTAMP}.
3041d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </p>
30420b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * <p>
30430b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * Access to the social stream through these URIs requires additional permissions beyond the
30440b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * read/write contact permissions required by the provider.  Querying for social stream data
30450b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * requires android.permission.READ_SOCIAL_STREAM permission, and inserting or updating social
30460b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * stream items requires android.permission.WRITE_SOCIAL_STREAM permission.
30470b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * </p>
3048d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <h3>Operations</h3>
3049d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dl>
3050d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt><b>Insert</b></dt>
3051d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3052d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <p>Social stream updates are always associated with a raw contact.  There are a couple
3053d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * of ways to insert these entries.
3054d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dl>
3055d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Via the {@link RawContacts.StreamItems#CONTENT_DIRECTORY} sub-path of a raw contact:</dt>
3056d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3057d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3058d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * ContentValues values = new ContentValues();
3059d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItems.TEXT, "Breakfasted at Tiffanys");
3060d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItems.TIMESTAMP, timestamp);
3061040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * values.put(StreamItems.COMMENTS, "3 people reshared this");
3062d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Uri streamItemUri = getContentResolver().insert(
3063d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     Uri.withAppendedPath(ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId),
3064d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         RawContacts.StreamItems.CONTENT_DIRECTORY), values);
3065d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * long streamItemId = ContentUris.parseId(streamItemUri);
3066d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3067d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
30684510705b2862dba20e4ccee34641029f699859acScott Main     * <dt>Via {@link StreamItems#CONTENT_URI}:</dt>
3069d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
30704510705b2862dba20e4ccee34641029f699859acScott Main     *<pre>
3071d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * ContentValues values = new ContentValues();
3072d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItems.RAW_CONTACT_ID, rawContactId);
3073d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItems.TEXT, "Breakfasted at Tiffanys");
3074d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItems.TIMESTAMP, timestamp);
3075040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * values.put(StreamItems.COMMENTS, "3 people reshared this");
3076d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Uri streamItemUri = getContentResolver().insert(StreamItems.CONTENT_URI, values);
3077d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * long streamItemId = ContentUris.parseId(streamItemUri);
30784510705b2862dba20e4ccee34641029f699859acScott Main     *</pre>
3079d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3080d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dl>
3081d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3082d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </p>
3083d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <p>
3084d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Once a {@link StreamItems} entry has been inserted, photos associated with that
3085d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * social update can be inserted.  For example, after one of the insertions above,
3086d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * photos could be added to the stream item in one of the following ways:
3087d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dl>
3088d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Via a URI including the stream item ID:</dt>
3089d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3090d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3091d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.clear();
3092d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItemPhotos.SORT_INDEX, 1);
3093040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * values.put(StreamItemPhotos.PHOTO, photoData);
3094d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * getContentResolver().insert(Uri.withAppendedPath(
3095d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId),
3096d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     StreamItems.StreamItemPhotos.CONTENT_DIRECTORY), values);
3097d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3098d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
30994510705b2862dba20e4ccee34641029f699859acScott Main     * <dt>Via {@link ContactsContract.StreamItems#CONTENT_PHOTO_URI}:</dt>
3100d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3101d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3102d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.clear();
3103d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
3104d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItemPhotos.SORT_INDEX, 1);
3105040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * values.put(StreamItemPhotos.PHOTO, photoData);
3106d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * getContentResolver().insert(StreamItems.CONTENT_PHOTO_URI, values);
3107d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
31084510705b2862dba20e4ccee34641029f699859acScott Main     * <p>Note that this latter form allows the insertion of a stream item and its
3109d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * photos in a single transaction, by using {@link ContentProviderOperation} with
3110d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * back references to populate the stream item ID in the {@link ContentValues}.
3111d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3112d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dl>
3113d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </p>
3114d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3115d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt><b>Update</b></dt>
3116d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>Updates can be performed by appending the stream item ID to the
3117d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * {@link StreamItems#CONTENT_URI} URI.  Only social stream entries that were
3118d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * created by the calling package can be updated.</dd>
3119d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt><b>Delete</b></dt>
3120d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>Deletes can be performed by appending the stream item ID to the
3121d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * {@link StreamItems#CONTENT_URI} URI.  Only social stream entries that were
3122d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * created by the calling package can be deleted.</dd>
3123d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt><b>Query</b></dt>
3124d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dl>
3125d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Finding all social stream updates for a given contact</dt>
3126d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>By Contact ID:
3127d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3128d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Cursor c = getContentResolver().query(Uri.withAppendedPath(
3129d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId),
3130d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          Contacts.StreamItems.CONTENT_DIRECTORY),
3131d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          null, null, null, null);
3132d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3133d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3134d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>By lookup key:
3135d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3136d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Cursor c = getContentResolver().query(Contacts.CONTENT_URI.buildUpon()
3137d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          .appendPath(lookupKey)
3138d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          .appendPath(Contacts.StreamItems.CONTENT_DIRECTORY).build(),
3139d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          null, null, null, null);
3140d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3141d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3142d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Finding all social stream updates for a given raw contact</dt>
3143d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3144d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3145d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Cursor c = getContentResolver().query(Uri.withAppendedPath(
3146d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId),
3147d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          RawContacts.StreamItems.CONTENT_DIRECTORY)),
3148d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          null, null, null, null);
3149d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3150d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3151d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Querying for a specific stream item by ID</dt>
3152d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3153d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3154d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Cursor c = getContentResolver().query(ContentUris.withAppendedId(
3155d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          StreamItems.CONTENT_URI, streamItemId),
3156d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *          null, null, null, null);
3157d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3158d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3159d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dl>
3160d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     */
3161d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    public static final class StreamItems implements BaseColumns, StreamItemsColumns {
3162d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3163d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * This utility class cannot be instantiated
3164d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3165d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        private StreamItems() {
3166d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        }
3167d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3168d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3169d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * The content:// style URI for this table, which handles social network stream
3170d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * updates for the user's contacts.
3171d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3172d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "stream_items");
3173d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3174d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3175d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <p>
3176d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * A content:// style URI for the photos stored in a sub-table underneath
3177d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * stream items.  This is only used for inserts, and updates - queries and deletes
3178d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * for photos should be performed by appending
3179d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * {@link StreamItems.StreamItemPhotos#CONTENT_DIRECTORY} path to URIs for a
3180d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * specific stream item.
3181d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * </p>
3182d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <p>
3183d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * When using this URI, the stream item ID for the photo(s) must be identified
3184d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * in the {@link ContentValues} passed in.
3185d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * </p>
3186d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3187d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final Uri CONTENT_PHOTO_URI = Uri.withAppendedPath(CONTENT_URI, "photo");
3188d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3189d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3190d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * This URI allows the caller to query for the maximum number of stream items
3191040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * that will be stored under any single raw contact.
3192d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3193d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final Uri CONTENT_LIMIT_URI =
3194d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro                Uri.withAppendedPath(AUTHORITY_URI, "stream_items_limit");
3195d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3196d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3197fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki         * The MIME type of a directory of stream items.
3198fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki         */
3199fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item";
3200fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki
3201fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki        /**
3202fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki         * The MIME type of a single stream item.
3203fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki         */
3204fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item";
3205fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki
3206fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki        /**
3207d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * Queries to {@link ContactsContract.StreamItems#CONTENT_LIMIT_URI} will
3208d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * contain this column, with the value indicating the maximum number of
3209d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * stream items that will be stored under any single raw contact.
3210d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3211d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final String MAX_ITEMS = "max_items";
3212d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3213d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3214d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <p>
3215d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * A sub-directory of a single stream item entry that contains all of its
3216d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * photo rows. To access this
3217d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * directory append {@link StreamItems.StreamItemPhotos#CONTENT_DIRECTORY} to
3218d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * an individual stream item URI.
3219d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * </p>
32200b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * <p>
32210b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * Access to social stream photos requires additional permissions beyond the read/write
32220b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * contact permissions required by the provider.  Querying for social stream photos
32230b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * requires android.permission.READ_SOCIAL_STREAM permission, and inserting or updating
32240b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * social stream photos requires android.permission.WRITE_SOCIAL_STREAM permission.
32250b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro         * </p>
3226d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3227d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final class StreamItemPhotos
3228d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro                implements BaseColumns, StreamItemPhotosColumns {
3229d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            /**
3230d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             * No public constructor since this is a utility class
3231d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             */
3232d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            private StreamItemPhotos() {
3233d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            }
3234d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3235d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            /**
3236d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             * The directory twig for this sub-table
3237d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro             */
3238d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro            public static final String CONTENT_DIRECTORY = "photo";
3239fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki
3240fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki            /**
3241fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki             * The MIME type of a directory of stream item photos.
3242fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki             */
3243fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki            public static final String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo";
3244fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki
3245fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki            /**
3246fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki             * The MIME type of a single stream item photo.
3247fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki             */
3248fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki            public static final String CONTENT_ITEM_TYPE
3249fc6d2fde25ccf00174b7419d91a76b2fc52773aeMakoto Onuki                    = "vnd.android.cursor.item/stream_item_photo";
3250d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        }
3251d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    }
3252d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3253d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    /**
3254d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Columns in the StreamItems table.
3255d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *
3256d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * @see ContactsContract.StreamItems
3257d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     */
3258d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    protected interface StreamItemsColumns {
3259d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3260e8aae096d8ced8767ef5024e44f91e0342d778ecDaniel Lehmann         * A reference to the {@link android.provider.ContactsContract.Contacts#_ID}
3261e8aae096d8ced8767ef5024e44f91e0342d778ecDaniel Lehmann         * that this stream item belongs to.
3262ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         *
3263ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         * <p>Type: INTEGER</p>
3264ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         * <p>read-only</p>
3265e8aae096d8ced8767ef5024e44f91e0342d778ecDaniel Lehmann         */
3266e8aae096d8ced8767ef5024e44f91e0342d778ecDaniel Lehmann        public static final String CONTACT_ID = "contact_id";
3267e8aae096d8ced8767ef5024e44f91e0342d778ecDaniel Lehmann
3268e8aae096d8ced8767ef5024e44f91e0342d778ecDaniel Lehmann        /**
3269ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         * A reference to the {@link android.provider.ContactsContract.Contacts#LOOKUP_KEY}
3270ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         * that this stream item belongs to.
3271ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         *
3272ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         * <p>Type: TEXT</p>
3273ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         * <p>read-only</p>
3274ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         */
3275ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann        public static final String CONTACT_LOOKUP_KEY = "contact_lookup";
3276ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann
3277ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann        /**
3278d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * A reference to the {@link RawContacts#_ID}
3279d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * that this stream item belongs to.
3280ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         * <p>Type: INTEGER</p>
3281d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3282d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final String RAW_CONTACT_ID = "raw_contact_id";
3283d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3284d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3285d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * The package name to use when creating {@link Resources} objects for
3286d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * this stream item. This value is only designed for use when building
3287d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * user interfaces, and should not be used to infer the owner.
3288040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * <P>Type: TEXT</P>
3289d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3290d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final String RES_PACKAGE = "res_package";
3291d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3292d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3293f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * The account type to which the raw_contact of this item is associated. See
3294f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * {@link RawContacts#ACCOUNT_TYPE}
3295f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         *
3296ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         * <p>Type: TEXT</p>
3297f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * <p>read-only</p>
3298f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         */
3299f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String ACCOUNT_TYPE = "account_type";
3300f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann
3301f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /**
3302f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * The account name to which the raw_contact of this item is associated. See
3303f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * {@link RawContacts#ACCOUNT_NAME}
3304f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         *
3305ceb476a584e7f0b1866821955ea3284686dd6975Daniel Lehmann         * <p>Type: TEXT</p>
3306f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * <p>read-only</p>
3307f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         */
3308f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String ACCOUNT_NAME = "account_name";
3309f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann
3310f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /**
3311f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * The data set within the account that the raw_contact of this row belongs to. This allows
3312f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * multiple sync adapters for the same account type to distinguish between
3313f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * each others' data.
3314f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * {@link RawContacts#DATA_SET}
3315f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         *
3316f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * <P>Type: TEXT</P>
3317f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * <p>read-only</p>
3318f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         */
3319f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String DATA_SET = "data_set";
3320f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann
3321f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /**
3322f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * The source_id of the raw_contact that this row belongs to.
3323f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * {@link RawContacts#SOURCE_ID}
3324f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         *
3325f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * <P>Type: TEXT</P>
3326f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * <p>read-only</p>
3327f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         */
3328f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String RAW_CONTACT_SOURCE_ID = "raw_contact_source_id";
3329f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann
3330f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /**
3331f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * The resource name of the icon for the source of the stream item.
3332f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * This resource should be scoped by the {@link #RES_PACKAGE}. As this can only reference
3333f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * drawables, the "@drawable/" prefix must be omitted.
3334f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * <P>Type: TEXT</P>
3335d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3336d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final String RES_ICON = "icon";
3337d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3338d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3339f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * The resource name of the label describing the source of the status update, e.g. "Google
3340f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * Talk". This resource should be scoped by the {@link #RES_PACKAGE}. As this can only
3341f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * reference strings, the "@string/" prefix must be omitted.
3342f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann         * <p>Type: TEXT</p>
3343d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3344d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final String RES_LABEL = "label";
3345d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3346d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3347d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <P>
3348d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * The main textual contents of the item. Typically this is content
3349d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * that was posted by the source of this stream item, but it can also
3350d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * be a textual representation of an action (e.g. ”Checked in at Joe's”).
3351d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * This text is displayed to the user and allows formatting and embedded
3352d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * resource images via HTML (as parseable via
3353d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * {@link android.text.Html#fromHtml}).
3354d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * </P>
3355d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <P>
3356d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * Long content may be truncated and/or ellipsized - the exact behavior
3357d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * is unspecified, but it should not break tags.
3358d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * </P>
3359d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <P>Type: TEXT</P>
3360d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3361d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final String TEXT = "text";
3362d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3363d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3364d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * The absolute time (milliseconds since epoch) when this stream item was
3365d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * inserted/updated.
3366d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <P>Type: NUMBER</P>
3367d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3368d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final String TIMESTAMP = "timestamp";
3369d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3370d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3371d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <P>
3372d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * Summary information about the stream item, for example to indicate how
3373d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * many people have reshared it, how many have liked it, how many thumbs
3374d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * up and/or thumbs down it has, what the original source was, etc.
3375d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * </P>
3376d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <P>
3377d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * This text is displayed to the user and allows simple formatting via
3378d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * HTML, in the same manner as {@link #TEXT} allows.
3379d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * </P>
3380d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <P>
3381d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * Long content may be truncated and/or ellipsized - the exact behavior
3382d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * is unspecified, but it should not break tags.
3383d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * </P>
3384d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <P>Type: TEXT</P>
3385d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3386d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final String COMMENTS = "comments";
3387d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3388f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /** Generic column for use by sync adapters. */
3389f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String SYNC1 = "stream_item_sync1";
3390f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /** Generic column for use by sync adapters. */
3391f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String SYNC2 = "stream_item_sync2";
3392f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /** Generic column for use by sync adapters. */
3393f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String SYNC3 = "stream_item_sync3";
3394f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /** Generic column for use by sync adapters. */
3395f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String SYNC4 = "stream_item_sync4";
3396d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    }
3397d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3398d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    /**
3399d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <p>
3400d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Constants for the stream_item_photos table, which contains photos associated with
3401d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * social stream updates.
3402d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </p>
34030b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * <p>
34040b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * Access to social stream photos requires additional permissions beyond the read/write
34050b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * contact permissions required by the provider.  Querying for social stream photos
34060b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * requires android.permission.READ_SOCIAL_STREAM permission, and inserting or updating
34070b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * social stream photos requires android.permission.WRITE_SOCIAL_STREAM permission.
34080b61f59d77153e7d63a33fc5d47805feb99d918bDave Santoro     * </p>
3409d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <h3>Operations</h3>
3410d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dl>
3411d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt><b>Insert</b></dt>
3412d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3413d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <p>Social stream photo entries are associated with a social stream item.  Photos
3414d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * can be inserted into a social stream item in a couple of ways:
3415d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dl>
3416d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>
3417d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Via the {@link StreamItems.StreamItemPhotos#CONTENT_DIRECTORY} sub-path of a
3418d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * stream item:
3419d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dt>
3420d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3421d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3422d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * ContentValues values = new ContentValues();
3423d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItemPhotos.SORT_INDEX, 1);
3424040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * values.put(StreamItemPhotos.PHOTO, photoData);
3425d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Uri photoUri = getContentResolver().insert(Uri.withAppendedPath(
3426d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
3427d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     StreamItems.StreamItemPhotos#CONTENT_DIRECTORY), values);
3428d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * long photoId = ContentUris.parseId(photoUri);
3429d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3430d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3431d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Via the {@link ContactsContract.StreamItems#CONTENT_PHOTO_URI} URI:</dt>
3432d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3433d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3434d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * ContentValues values = new ContentValues();
3435d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
3436d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItemPhotos.SORT_INDEX, 1);
3437040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * values.put(StreamItemPhotos.PHOTO, photoData);
3438d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Uri photoUri = getContentResolver().insert(StreamItems.CONTENT_PHOTO_URI, values);
3439d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * long photoId = ContentUris.parseId(photoUri);
3440d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3441d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3442d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dl>
3443d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </p>
3444d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3445d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt><b>Update</b></dt>
3446d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3447d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <p>Updates can only be made against a specific {@link StreamItemPhotos} entry,
3448d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * identified by both the stream item ID it belongs to and the stream item photo ID.
3449d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * This can be specified in two ways.
3450d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dl>
3451d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Via the {@link StreamItems.StreamItemPhotos#CONTENT_DIRECTORY} sub-path of a
3452d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * stream item:
3453d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dt>
3454d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3455d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3456d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * ContentValues values = new ContentValues();
3457040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * values.put(StreamItemPhotos.PHOTO, newPhotoData);
3458d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * getContentResolver().update(
3459d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     ContentUris.withAppendedId(
3460d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         Uri.withAppendedPath(
3461d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *             ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
3462d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *             StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
3463d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         streamItemPhotoId), values, null, null);
3464d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3465d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3466d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Via the {@link ContactsContract.StreamItems#CONTENT_PHOTO_URI} URI:</dt>
3467d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3468d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3469d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * ContentValues values = new ContentValues();
3470d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
3471040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * values.put(StreamItemPhotos.PHOTO, newPhotoData);
3472d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * getContentResolver().update(StreamItems.CONTENT_PHOTO_URI, values);
3473d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3474d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3475d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dl>
3476d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </p>
3477d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3478d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt><b>Delete</b></dt>
3479d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>Deletes can be made against either a specific photo item in a stream item, or
3480d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * against all or a selected subset of photo items under a stream item.
3481d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * For example:
3482d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dl>
3483d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Deleting a single photo via the
3484d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * {@link StreamItems.StreamItemPhotos#CONTENT_DIRECTORY} sub-path of a stream item:
3485d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dt>
3486d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3487d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3488d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * getContentResolver().delete(
3489d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     ContentUris.withAppendedId(
3490d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         Uri.withAppendedPath(
3491d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *             ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
3492d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *             StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
3493d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         streamItemPhotoId), null, null);
3494d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3495d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3496d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Deleting all photos under a stream item</dt>
3497d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3498d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3499d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * getContentResolver().delete(
3500d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     Uri.withAppendedPath(
3501d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
3502d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         StreamItems.StreamItemPhotos#CONTENT_DIRECTORY), null, null);
3503d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3504d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3505d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dl>
3506d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3507d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt><b>Query</b></dt>
3508d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dl>
3509d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Querying for a specific photo in a stream item</dt>
3510d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3511d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3512d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Cursor c = getContentResolver().query(
3513d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     ContentUris.withAppendedId(
3514d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         Uri.withAppendedPath(
3515d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *             ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
3516d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *             StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
3517d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         streamItemPhotoId), null, null, null, null);
3518d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3519d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3520d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dt>Querying for all photos in a stream item</dt>
3521d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <dd>
3522d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * <pre>
3523d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Cursor c = getContentResolver().query(
3524d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     Uri.withAppendedPath(
3525d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
3526d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *         StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
3527d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *     null, null, null, StreamItemPhotos.SORT_INDEX);
3528d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </pre>
3529d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dl>
3530040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * The record will contain both a {@link StreamItemPhotos#PHOTO_FILE_ID} and a
3531040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * {@link StreamItemPhotos#PHOTO_URI}.  The {@link StreamItemPhotos#PHOTO_FILE_ID}
3532040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * can be used in conjunction with the {@link ContactsContract.DisplayPhoto} API to
3533040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * retrieve photo content, or you can open the {@link StreamItemPhotos#PHOTO_URI} as
3534040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * an asset file, as follows:
3535040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * <pre>
3536040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * public InputStream openDisplayPhoto(String photoUri) {
3537040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     *     try {
3538040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     *         AssetFileDescriptor fd = getContentResolver().openAssetFileDescriptor(photoUri, "r");
3539040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     *         return fd.createInputStream();
3540040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     *     } catch (IOException e) {
3541040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     *         return null;
3542040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     *     }
3543040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * }
3544040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     * <pre>
3545d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dd>
3546d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * </dl>
3547d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     */
3548d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    public static final class StreamItemPhotos implements BaseColumns, StreamItemPhotosColumns {
3549d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3550d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * No public constructor since this is a utility class
3551d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3552d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        private StreamItemPhotos() {
3553d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        }
3554040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro
3555040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro        /**
3556040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * <p>
3557040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * The binary representation of the photo.  Any size photo can be inserted;
3558040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * the provider will resize it appropriately for storage and display.
3559040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * </p>
3560040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * <p>
3561040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * This is only intended for use when inserting or updating a stream item photo.
3562040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * To retrieve the photo that was stored, open {@link StreamItemPhotos#PHOTO_URI}
3563040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * as an asset file.
3564040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * </p>
3565040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * <P>Type: BLOB</P>
3566040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         */
3567040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro        public static final String PHOTO = "photo";
3568d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    }
3569d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3570d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    /**
3571d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * Columns in the StreamItemPhotos table.
3572d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     *
3573d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     * @see ContactsContract.StreamItemPhotos
3574d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro     */
3575d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    protected interface StreamItemPhotosColumns {
3576d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3577d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * A reference to the {@link StreamItems#_ID} this photo is associated with.
3578d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <P>Type: NUMBER</P>
3579d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3580d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final String STREAM_ITEM_ID = "stream_item_id";
3581d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3582d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3583d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * An integer to use for sort order for photos in the stream item.  If not
3584d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * specified, the {@link StreamItemPhotos#_ID} will be used for sorting.
3585d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         * <P>Type: NUMBER</P>
3586d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3587d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        public static final String SORT_INDEX = "sort_index";
3588d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3589d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro        /**
3590040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * Photo file ID for the photo.
3591040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * See {@link ContactsContract.DisplayPhoto}.
3592040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * <P>Type: NUMBER</P>
3593040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         */
3594040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro        public static final String PHOTO_FILE_ID = "photo_file_id";
3595040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro
3596040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro        /**
3597040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * URI for retrieving the photo content, automatically populated.  Callers
3598040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * may retrieve the photo content by opening this URI as an asset file.
3599040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro         * <P>Type: TEXT</P>
3600d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro         */
3601040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro        public static final String PHOTO_URI = "photo_uri";
3602d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3603f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /** Generic column for use by sync adapters. */
3604f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String SYNC1 = "stream_item_photo_sync1";
3605f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /** Generic column for use by sync adapters. */
3606f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String SYNC2 = "stream_item_photo_sync2";
3607f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /** Generic column for use by sync adapters. */
3608f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String SYNC3 = "stream_item_photo_sync3";
3609f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        /** Generic column for use by sync adapters. */
3610f188dfda30cda5df4c7131e7987218c7c20203abDaniel Lehmann        public static final String SYNC4 = "stream_item_photo_sync4";
3611d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    }
3612d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro
3613d414f108e70766b1a9d6f4e99201f960cfa45310Dave Santoro    /**
3614a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * <p>
3615a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * Constants for the photo files table, which tracks metadata for hi-res photos
3616a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * stored in the file system.
3617a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * </p>
3618a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     *
3619a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * @hide
3620a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     */
3621a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro    public static final class PhotoFiles implements BaseColumns, PhotoFilesColumns {
3622a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
3623a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * No public constructor since this is a utility class
3624a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
3625a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        private PhotoFiles() {
3626a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        }
3627a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro    }
3628a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
3629a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro    /**
3630a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * Columns in the PhotoFiles table.
3631a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     *
3632a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * @see ContactsContract.PhotoFiles
3633a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     *
3634a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * @hide
3635a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     */
3636a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro    protected interface PhotoFilesColumns {
3637a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
3638a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
3639a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * The height, in pixels, of the photo this entry is associated with.
3640a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <P>Type: NUMBER</P>
3641a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
3642a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        public static final String HEIGHT = "height";
3643a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
3644a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
3645a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * The width, in pixels, of the photo this entry is associated with.
3646a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <P>Type: NUMBER</P>
3647a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
3648a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        public static final String WIDTH = "width";
3649a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
3650a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
3651a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * The size, in bytes, of the photo stored on disk.
3652a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <P>Type: NUMBER</P>
3653a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
3654a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        public static final String FILESIZE = "filesize";
3655a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro    }
3656a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
3657a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro    /**
3658dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Columns in the Data table.
3659dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
3660dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see ContactsContract.Data
3661dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     */
36626e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface DataColumns {
3663088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
36648a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * The package name to use when creating {@link Resources} objects for
36658a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * this data row. This value is only designed for use when building user
36668a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * interfaces, and should not be used to infer the owner.
366785abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
366885abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide
36698a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         */
36708a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        public static final String RES_PACKAGE = "res_package";
36718a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
36728a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        /**
36738a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * The MIME type of the item represented by this row.
3674088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
3675088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String MIMETYPE = "mimetype";
3676088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
3677088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
36787cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * A reference to the {@link RawContacts#_ID}
3679569277732b4180c07c9f917ff8c3fc3111b10338Dmitri Plotnikov         * that this data belongs to.
3680088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
3681facbbb37835020b767f259f0f625386b52b2ad89Dmitri Plotnikov        public static final String RAW_CONTACT_ID = "raw_contact_id";
3682facbbb37835020b767f259f0f625386b52b2ad89Dmitri Plotnikov
3683ab5742dd63f4e62ee0f55f786854c024ef8c5bb4Evan Millar        /**
3684244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * Whether this is the primary entry of its kind for the raw contact it belongs to.
3685ab5742dd63f4e62ee0f55f786854c024ef8c5bb4Evan Millar         * <P>Type: INTEGER (if set, non-0 means true)</P>
3686ab5742dd63f4e62ee0f55f786854c024ef8c5bb4Evan Millar         */
3687ab5742dd63f4e62ee0f55f786854c024ef8c5bb4Evan Millar        public static final String IS_PRIMARY = "is_primary";
3688ab5742dd63f4e62ee0f55f786854c024ef8c5bb4Evan Millar
3689ab5742dd63f4e62ee0f55f786854c024ef8c5bb4Evan Millar        /**
36907cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * Whether this is the primary entry of its kind for the aggregate
36917cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * contact it belongs to. Any data record that is "super primary" must
36927cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * also be "primary".
3693ab5742dd63f4e62ee0f55f786854c024ef8c5bb4Evan Millar         * <P>Type: INTEGER (if set, non-0 means true)</P>
3694ab5742dd63f4e62ee0f55f786854c024ef8c5bb4Evan Millar         */
3695ab5742dd63f4e62ee0f55f786854c024ef8c5bb4Evan Millar        public static final String IS_SUPER_PRIMARY = "is_super_primary";
3696ab5742dd63f4e62ee0f55f786854c024ef8c5bb4Evan Millar
369728b68e5a59289f6947dc799b66a3b503571f876eJeff Sharkey        /**
369830b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * The "read-only" flag: "0" by default, "1" if the row cannot be modified or
369930b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * deleted except by a sync adapter.  See {@link ContactsContract#CALLER_IS_SYNCADAPTER}.
370030b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         * <P>Type: INTEGER</P>
370130b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov         */
370230b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        public static final String IS_READ_ONLY = "is_read_only";
370330b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov
370430b7be333f4b1e7f14bee32a6fdd42c68ca11450Dmitri Plotnikov        /**
3705c933fb663e4748c4fa3f92fc63649e5199519a86Fred Quintana         * The version of this data record. This is a read-only value. The data column is
3706c933fb663e4748c4fa3f92fc63649e5199519a86Fred Quintana         * guaranteed to not change without the version going up. This value is monotonically
3707c933fb663e4748c4fa3f92fc63649e5199519a86Fred Quintana         * increasing.
3708c933fb663e4748c4fa3f92fc63649e5199519a86Fred Quintana         * <P>Type: INTEGER</P>
3709c933fb663e4748c4fa3f92fc63649e5199519a86Fred Quintana         */
3710c933fb663e4748c4fa3f92fc63649e5199519a86Fred Quintana        public static final String DATA_VERSION = "data_version";
3711c933fb663e4748c4fa3f92fc63649e5199519a86Fred Quintana
3712088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
3713088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String DATA1 = "data1";
3714088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
3715088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String DATA2 = "data2";
3716088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
3717088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String DATA3 = "data3";
3718088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
3719088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String DATA4 = "data4";
3720088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
3721088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String DATA5 = "data5";
3722088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
3723088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String DATA6 = "data6";
3724088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
3725088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String DATA7 = "data7";
3726088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
3727088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String DATA8 = "data8";
3728088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
3729088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String DATA9 = "data9";
3730088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
3731088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String DATA10 = "data10";
37328a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
37338a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        public static final String DATA11 = "data11";
37348a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
37358a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        public static final String DATA12 = "data12";
37368a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
37378a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        public static final String DATA13 = "data13";
37388a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
37398a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        public static final String DATA14 = "data14";
3740244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill        /**
3741244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * Generic data column, the meaning is {@link #MIMETYPE} specific. By convention,
3742244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * this field is used to store BLOBs (binary data).
3743244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         */
37448a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        public static final String DATA15 = "data15";
374591e4e85752ee60ef4965e5974cc3f62e3d0651fdDmitri Plotnikov
37468851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        /** Generic column for use by sync adapters. */
37478851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        public static final String SYNC1 = "data_sync1";
37488851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        /** Generic column for use by sync adapters. */
37498851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        public static final String SYNC2 = "data_sync2";
37508851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        /** Generic column for use by sync adapters. */
37518851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        public static final String SYNC3 = "data_sync3";
37528851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        /** Generic column for use by sync adapters. */
37538851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        public static final String SYNC4 = "data_sync4";
3754088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    }
3755088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
3756088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    /**
3757dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Combines all columns returned by {@link ContactsContract.Data} table queries.
3758dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
3759dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see ContactsContract.Data
37600dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov     */
37616e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface DataColumnsWithJoins extends BaseColumns, DataColumns, StatusColumns,
3762b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov            RawContactsColumns, ContactsColumns, ContactNameColumns, ContactOptionsColumns,
3763b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov            ContactStatusColumns {
37640dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov    }
37650dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov
37660dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov    /**
3767dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3768dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Constants for the data table, which contains data points tied to a raw
3769244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * contact.  Each row of the data table is typically used to store a single
3770244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * piece of contact
3771244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * information (such as a phone number) and its
3772244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * associated metadata (such as whether it is a work or home number).
3773dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3774dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h3>Data kinds</h3>
3775dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3776244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Data is a generic table that can hold any kind of contact data.
3777244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * The kind of data stored in a given row is specified by the row's
3778244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * {@link #MIMETYPE} value, which determines the meaning of the
3779244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * generic columns {@link #DATA1} through
3780244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * {@link #DATA15}.
3781dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * For example, if the data kind is
3782244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * {@link CommonDataKinds.Phone Phone.CONTENT_ITEM_TYPE}, then the column
3783244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * {@link #DATA1} stores the
3784dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * phone number, but if the data kind is
3785244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * {@link CommonDataKinds.Email Email.CONTENT_ITEM_TYPE}, then {@link #DATA1}
3786244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * stores the email address.
3787244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Sync adapters and applications can introduce their own data kinds.
3788dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3789dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3790244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * ContactsContract defines a small number of pre-defined data kinds, e.g.
3791dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link CommonDataKinds.Phone}, {@link CommonDataKinds.Email} etc. As a
3792dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * convenience, these classes define data kind specific aliases for DATA1 etc.
3793dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * For example, {@link CommonDataKinds.Phone Phone.NUMBER} is the same as
3794dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContactsContract.Data Data.DATA1}.
3795dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3796dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3797dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA1} is an indexed column and should be used for the data element that is
3798dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * expected to be most frequently used in query selections. For example, in the
3799dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * case of a row representing email addresses {@link #DATA1} should probably
3800dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * be used for the email address itself, while {@link #DATA2} etc can be
3801dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * used for auxiliary information like type of email address.
3802dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3803dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3804dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * By convention, {@link #DATA15} is used for storing BLOBs (binary data).
3805dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3806dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3807d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * The sync adapter for a given account type must correctly handle every data type
3808d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * used in the corresponding raw contacts.  Otherwise it could result in lost or
3809d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * corrupted data.
3810d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * </p>
3811d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * <p>
3812d6f9cd2cee96e9503f74081f98b0a6c6ef5b6b06Tom O'Neill     * Similarly, you should refrain from introducing new kinds of data for an other
3813244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * party's account types. For example, if you add a data row for
3814dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * "favorite song" to a raw contact owned by a Google account, it will not
3815dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * get synced to the server, because the Google sync adapter does not know
3816dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * how to handle this data kind. Thus new data kinds are typically
3817dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * introduced along with new account types, i.e. new sync adapters.
3818dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3819dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h3>Batch operations</h3>
3820dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3821dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Data rows can be inserted/updated/deleted using the traditional
3822dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContentResolver#insert}, {@link ContentResolver#update} and
3823dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContentResolver#delete} methods, however the newer mechanism based
3824dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * on a batch of {@link ContentProviderOperation} will prove to be a better
3825dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * choice in almost all cases. All operations in a batch are executed in a
3826dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * single transaction, which ensures that the phone-side and server-side
3827dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * state of a raw contact are always consistent. Also, the batch-based
3828dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * approach is far more efficient: not only are the database operations
3829dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * faster when executed in a single transaction, but also sending a batch of
3830dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * commands to the content provider saves a lot of time on context switching
3831dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * between your process and the process in which the content provider runs.
3832dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3833dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3834dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * The flip side of using batched operations is that a large batch may lock
3835dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * up the database for a long time preventing other applications from
3836dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * accessing data and potentially causing ANRs ("Application Not Responding"
3837dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * dialogs.)
3838dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3839dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3840dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * To avoid such lockups of the database, make sure to insert "yield points"
3841dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * in the batch. A yield point indicates to the content provider that before
3842dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * executing the next operation it can commit the changes that have already
3843dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * been made, yield to other requests, open another transaction and continue
3844dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * processing operations. A yield point will not automatically commit the
3845dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * transaction, but only if there is another request waiting on the
3846dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * database. Normally a sync adapter should insert a yield point at the
3847dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * beginning of each raw contact operation sequence in the batch. See
3848dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContentProviderOperation.Builder#withYieldAllowed(boolean)}.
3849dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3850dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h3>Operations</h3>
3851dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dl>
3852dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Insert</b></dt>
3853dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>
3854dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3855dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * An individual data row can be inserted using the traditional
3856dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContentResolver#insert(Uri, ContentValues)} method. Multiple rows
3857dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * should always be inserted as a batch.
3858dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3859dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3860dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * An example of a traditional insert:
3861dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
3862dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * ContentValues values = new ContentValues();
3863dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.put(Data.RAW_CONTACT_ID, rawContactId);
3864dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
3865dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.put(Phone.NUMBER, "1-800-GOOG-411");
3866dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.put(Phone.TYPE, Phone.TYPE_CUSTOM);
3867dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * values.put(Phone.LABEL, "free directory assistance");
3868dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Uri dataUri = getContentResolver().insert(Data.CONTENT_URI, values);
3869dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
3870dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3871dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * The same done using ContentProviderOperations:
3872dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
3873beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     * ArrayList&lt;ContentProviderOperation&gt; ops =
3874beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     *          new ArrayList&lt;ContentProviderOperation&gt;();
3875beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     *
3876dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
3877dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValue(Data.RAW_CONTACT_ID, rawContactId)
3878dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
3879dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValue(Phone.NUMBER, "1-800-GOOG-411")
3880dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValue(Phone.TYPE, Phone.TYPE_CUSTOM)
3881dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValue(Phone.LABEL, "free directory assistance")
3882dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .build());
3883dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
3884dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
3885dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3886dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Update</b></dt>
3887dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>
3888dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3889dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Just as with insert, update can be done incrementally or as a batch,
3890dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * the batch mode being the preferred method:
3891dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
3892beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     * ArrayList&lt;ContentProviderOperation&gt; ops =
3893beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     *          new ArrayList&lt;ContentProviderOperation&gt;();
3894beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     *
3895dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI)
3896dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withSelection(Data._ID + "=?", new String[]{String.valueOf(dataId)})
3897dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withValue(Email.DATA, "somebody@android.com")
3898dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .build());
3899dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
3900dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
3901dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3902dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dd>
3903dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Delete</b></dt>
3904dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>
3905dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3906dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Just as with insert and update, deletion can be done either using the
3907dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContentResolver#delete} method or using a ContentProviderOperation:
3908dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
3909beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     * ArrayList&lt;ContentProviderOperation&gt; ops =
3910beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     *          new ArrayList&lt;ContentProviderOperation&gt;();
3911beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov     *
3912dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * ops.add(ContentProviderOperation.newDelete(Data.CONTENT_URI)
3913dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .withSelection(Data._ID + "=?", new String[]{String.valueOf(dataId)})
3914dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          .build());
3915dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
3916dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
3917dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3918dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dd>
3919dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt><b>Query</b></dt>
3920dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>
3921dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3922dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dl>
3923dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt>Finding all Data of a given type for a given contact</dt>
3924dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>
3925dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
3926dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Cursor c = getContentResolver().query(Data.CONTENT_URI,
3927dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          new String[] {Data._ID, Phone.NUMBER, Phone.TYPE, Phone.LABEL},
3928dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          Data.CONTACT_ID + &quot;=?&quot; + " AND "
3929dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *                  + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'",
3930dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          new String[] {String.valueOf(contactId)}, null);
3931dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
3932dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3933dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
3934dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dd>
3935dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt>Finding all Data of a given type for a given raw contact</dt>
3936dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>
3937dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
3938dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Cursor c = getContentResolver().query(Data.CONTENT_URI,
3939dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          new String[] {Data._ID, Phone.NUMBER, Phone.TYPE, Phone.LABEL},
3940dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          Data.RAW_CONTACT_ID + &quot;=?&quot; + " AND "
3941dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *                  + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'",
3942dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          new String[] {String.valueOf(rawContactId)}, null);
3943dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
3944dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dd>
3945dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dt>Finding all Data for a given raw contact</dt>
3946dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <dd>
3947dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Most sync adapters will want to read all data rows for a raw contact
3948dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * along with the raw contact itself.  For that you should use the
3949dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link RawContactsEntity}. See also {@link RawContacts}.
3950dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dd>
3951dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dl>
3952dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3953dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dd>
3954dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </dl>
3955dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h2>Columns</h2>
3956244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <p>
3957244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Many columns are available via a {@link Data#CONTENT_URI} query.  For best performance you
3958244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * should explicitly specify a projection to only those columns that you need.
3959244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * </p>
3960dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
3961dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
3962dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>Data</th>
3963dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
3964dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
3965dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 7em;">long</td>
3966dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 20em;">{@link #_ID}</td>
3967dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 5em;">read-only</td>
3968dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Row ID. Sync adapter should try to preserve row IDs during updates. In other words,
3969244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * it would be a bad idea to delete and reinsert a data row. A sync adapter should
3970dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * always do an update instead.</td>
3971dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
3972dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
3973dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
3974dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #MIMETYPE}</td>
3975dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write-once</td>
3976dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>
3977dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>The MIME type of the item represented by this row. Examples of common
3978dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * MIME types are:
3979dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <ul>
3980dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.StructuredName StructuredName.CONTENT_ITEM_TYPE}</li>
3981dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.Phone Phone.CONTENT_ITEM_TYPE}</li>
3982dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.Email Email.CONTENT_ITEM_TYPE}</li>
3983dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.Photo Photo.CONTENT_ITEM_TYPE}</li>
3984dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.Organization Organization.CONTENT_ITEM_TYPE}</li>
3985dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.Im Im.CONTENT_ITEM_TYPE}</li>
3986dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.Nickname Nickname.CONTENT_ITEM_TYPE}</li>
3987dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.Note Note.CONTENT_ITEM_TYPE}</li>
3988dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.StructuredPostal StructuredPostal.CONTENT_ITEM_TYPE}</li>
3989dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.GroupMembership GroupMembership.CONTENT_ITEM_TYPE}</li>
3990dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.Website Website.CONTENT_ITEM_TYPE}</li>
3991dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.Event Event.CONTENT_ITEM_TYPE}</li>
3992dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link CommonDataKinds.Relation Relation.CONTENT_ITEM_TYPE}</li>
3993846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown     * <li>{@link CommonDataKinds.SipAddress SipAddress.CONTENT_ITEM_TYPE}</li>
3994dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </ul>
3995dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
3996dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
3997dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
3998dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
3999dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4000dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #RAW_CONTACT_ID}</td>
4001dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write-once</td>
4002244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <td>The id of the row in the {@link RawContacts} table that this data belongs to.</td>
4003dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4004dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4005dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4006dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #IS_PRIMARY}</td>
4007dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4008dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Whether this is the primary entry of its kind for the raw contact it belongs to.
4009244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * "1" if true, "0" if false.
4010244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * </td>
4011dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4012dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4013dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4014dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #IS_SUPER_PRIMARY}</td>
4015dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4016dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Whether this is the primary entry of its kind for the aggregate
4017dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * contact it belongs to. Any data record that is "super primary" must
4018244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * also be "primary".  For example, the super-primary entry may be
4019244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * interpreted as the default contact value of its kind (for example,
4020244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * the default phone number to use for the contact).</td>
4021dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4022dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4023dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4024dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #DATA_VERSION}</td>
4025dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4026dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The version of this data record. Whenever the data row changes
4027dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * the version goes up. This value is monotonically increasing.</td>
4028dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4029dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4030dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Any type</td>
4031dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>
4032dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA1}<br>
4033dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA2}<br>
4034dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA3}<br>
4035dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA4}<br>
4036dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA5}<br>
4037dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA6}<br>
4038dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA7}<br>
4039dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA8}<br>
4040dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA9}<br>
4041dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA10}<br>
4042dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA11}<br>
4043dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA12}<br>
4044dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA13}<br>
4045dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA14}<br>
4046dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA15}
4047dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
4048dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4049244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <td>
4050244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <p>
4051244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Generic data columns.  The meaning of each column is determined by the
4052244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * {@link #MIMETYPE}.  By convention, {@link #DATA15} is used for storing
4053244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * BLOBs (binary data).
4054244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * </p>
4055244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <p>
4056244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Data columns whose meaning is not explicitly defined for a given MIMETYPE
4057244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * should not be used.  There is no guarantee that any sync adapter will
4058244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * preserve them.  Sync adapters themselves should not use such columns either,
4059244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * but should instead use {@link #SYNC1}-{@link #SYNC4}.
4060244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * </p>
4061244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * </td>
4062dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4063dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4064dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Any type</td>
4065dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>
4066dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #SYNC1}<br>
4067dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #SYNC2}<br>
4068dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #SYNC3}<br>
4069dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #SYNC4}
4070dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
4071dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4072dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Generic columns for use by sync adapters. For example, a Photo row
4073dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * may store the image URL in SYNC1, a status (not loaded, loading, loaded, error)
4074dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * in SYNC2, server-side version number in SYNC3 and error code in SYNC4.</td>
4075dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4076dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
4077dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4078244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <p>
4079244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Some columns from the most recent associated status update are also available
4080244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * through an implicit join.
4081244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * </p>
4082dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
4083dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4084dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>Join with {@link StatusUpdates}</th>
4085dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4086dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4087dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 7em;">int</td>
4088dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 20em;">{@link #PRESENCE}</td>
4089dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 5em;">read-only</td>
4090dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>IM presence status linked to this data row. Compare with
4091dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #CONTACT_PRESENCE}, which contains the contact's presence across
4092dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * all IM rows. See {@link StatusUpdates} for individual status definitions.
4093dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * The provider may choose not to store this value
4094dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * in persistent storage. The expectation is that presence status will be
4095dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * updated on a regular basic.
4096dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
4097dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4098dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4099dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4100dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STATUS}</td>
4101dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4102dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Latest status update linked with this data row.</td>
4103dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4104dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4105dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4106dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STATUS_TIMESTAMP}</td>
4107dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4108dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The absolute time in milliseconds when the latest status was
4109dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * inserted/updated for this data row.</td>
4110dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4111dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4112dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4113dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STATUS_RES_PACKAGE}</td>
4114dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4115dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The package containing resources for this status: label and icon.</td>
4116dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4117dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4118dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4119dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STATUS_LABEL}</td>
4120dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4121dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The resource ID of the label describing the source of status update linked
4122dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * to this data row. This resource is scoped by the {@link #STATUS_RES_PACKAGE}.</td>
4123dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4124dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4125dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4126dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STATUS_ICON}</td>
4127dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4128dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The resource ID of the icon for the source of the status update linked
4129dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * to this data row. This resource is scoped by the {@link #STATUS_RES_PACKAGE}.</td>
4130dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4131dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
4132dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4133dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4134244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Some columns from the associated raw contact are also available through an
4135244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * implicit join.  The other columns are excluded as uninteresting in this
4136244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * context.
4137dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
4138dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4139dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
4140dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4141244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <th colspan='4'>Join with {@link ContactsContract.RawContacts}</th>
4142dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4143dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4144244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <td style="width: 7em;">long</td>
4145244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <td style="width: 20em;">{@link #CONTACT_ID}</td>
4146dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 5em;">read-only</td>
4147244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <td>The id of the row in the {@link Contacts} table that this data belongs
4148244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * to.</td>
4149244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * </tr>
4150244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <tr>
4151244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <td>int</td>
4152244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <td>{@link #AGGREGATION_MODE}</td>
4153244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <td>read-only</td>
4154dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link RawContacts}.</td>
4155dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4156dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4157dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4158dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #DELETED}</td>
4159dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4160dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link RawContacts}.</td>
4161dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4162dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
4163dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4164dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4165244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * The ID column for the associated aggregated contact table
4166244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * {@link ContactsContract.Contacts} is available
4167244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * via the implicit join to the {@link RawContacts} table, see above.
4168244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * The remaining columns from this table are also
4169244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * available, through an implicit join.  This
4170244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * facilitates lookup by
4171244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * the value of a single data element, such as the email address.
4172dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
4173dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4174dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
4175dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4176244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * <th colspan='4'>Join with {@link ContactsContract.Contacts}</th>
4177dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4178dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4179dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 7em;">String</td>
4180dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 20em;">{@link #LOOKUP_KEY}</td>
4181dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 5em;">read-only</td>
4182dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}</td>
4183dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4184dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4185dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4186dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #DISPLAY_NAME}</td>
4187dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4188dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}</td>
4189dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4190dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4191dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4192dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #PHOTO_ID}</td>
4193dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4194dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4195dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4196dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4197dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4198dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #IN_VISIBLE_GROUP}</td>
4199dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4200dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4201dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4202dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4203dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4204dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #HAS_PHONE_NUMBER}</td>
4205dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4206dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4207dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4208dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4209dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4210dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #TIMES_CONTACTED}</td>
4211dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4212dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4213dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4214dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4215dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4216dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #LAST_TIME_CONTACTED}</td>
4217dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4218dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4219dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4220dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4221dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4222dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STARRED}</td>
4223dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4224dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4225dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4226dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4227dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4228dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CUSTOM_RINGTONE}</td>
4229dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4230dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4231dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4232dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4233dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4234dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SEND_TO_VOICEMAIL}</td>
4235dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4236dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4237dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4238dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4239dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4240dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_PRESENCE}</td>
4241dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4242dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4243dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4244dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4245dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4246dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_STATUS}</td>
4247dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4248dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4249dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4250dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4251dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4252dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_STATUS_TIMESTAMP}</td>
4253dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4254dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4255dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4256dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4257dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4258dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_STATUS_RES_PACKAGE}</td>
4259dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4260dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4261dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4262dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4263dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4264dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_STATUS_LABEL}</td>
4265dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4266dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4267dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4268dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4269dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4270dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_STATUS_ICON}</td>
4271dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4272dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4273dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4274dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
4275088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar     */
42760dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov    public final static class Data implements DataColumnsWithJoins {
4277088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
4278088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * This utility class cannot be instantiated
4279088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
4280088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        private Data() {}
4281088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
4282088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
4283244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * The content:// style URI for this table, which requests a directory
4284244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * of data rows matching the selection criteria.
4285088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
4286088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data");
4287088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
4288088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
4289244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * The MIME type of the results from {@link #CONTENT_URI}.
4290088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
4291088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/data";
42926449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
42936449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
4294244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * <p>
4295f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton         * Build a {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}
4296f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton         * style {@link Uri} for the parent {@link android.provider.ContactsContract.Contacts}
4297dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * entry of the given {@link ContactsContract.Data} entry.
4298244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * </p>
4299244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * <p>
4300244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * Returns the Uri for the contact in the first entry returned by
4301244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * {@link ContentResolver#query(Uri, String[], String, String[], String)}
4302244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * for the provided {@code dataUri}.  If the query returns null or empty
4303244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * results, silently returns null.
4304244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill         * </p>
43056449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
43066449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        public static Uri getContactLookupUri(ContentResolver resolver, Uri dataUri) {
43076449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            final Cursor cursor = resolver.query(dataUri, new String[] {
43086449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    RawContacts.CONTACT_ID, Contacts.LOOKUP_KEY
43096449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            }, null, null, null);
43106449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
43116449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            Uri lookupUri = null;
43126449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            try {
43136449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                if (cursor != null && cursor.moveToFirst()) {
43146449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    final long contactId = cursor.getLong(0);
43156449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    final String lookupKey = cursor.getString(1);
43166449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                    return Contacts.getLookupUri(contactId, lookupKey);
43176449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                }
43186449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            } finally {
43196449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                if (cursor != null) cursor.close();
43206449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            }
43216449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            return lookupUri;
43226449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        }
4323088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    }
4324088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
43255bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana    /**
4326dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4327244327e2097df053b1818c79bcb84ae9e4f3af76Tom O'Neill     * Constants for the raw contacts entities table, which can be thought of as
4328dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * an outer join of the raw_contacts table with the data table.  It is a strictly
4329dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * read-only table.
4330dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
4331dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4332dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * If a raw contact has data rows, the RawContactsEntity cursor will contain
4333dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * a one row for each data row. If the raw contact has no data rows, the
4334dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * cursor will still contain one row with the raw contact-level information
4335dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * and nulls for data columns.
4336dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4337dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
4338dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Uri entityUri = ContentUris.withAppendedId(RawContactsEntity.CONTENT_URI, rawContactId);
4339dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Cursor c = getContentResolver().query(entityUri,
4340dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          new String[]{
4341dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *              RawContactsEntity.SOURCE_ID,
4342dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *              RawContactsEntity.DATA_ID,
4343dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *              RawContactsEntity.MIMETYPE,
4344dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *              RawContactsEntity.DATA1
4345dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *          }, null, null, null);
4346dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * try {
4347dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *     while (c.moveToNext()) {
4348dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *         String sourceId = c.getString(0);
4349dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *         if (!c.isNull(1)) {
4350dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *             String mimeType = c.getString(2);
4351dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *             String data = c.getString(3);
4352dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *             ...
4353dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *         }
4354dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *     }
4355dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * } finally {
4356dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *     c.close();
4357dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * }
4358dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
4359dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4360dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h3>Columns</h3>
4361dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * RawContactsEntity has a combination of RawContact and Data columns.
4362dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4363dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
4364dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4365dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>RawContacts</th>
4366dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4367dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4368dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 7em;">long</td>
4369dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 20em;">{@link #_ID}</td>
4370dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 5em;">read-only</td>
4371dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Raw contact row ID. See {@link RawContacts}.</td>
4372dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4373dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4374dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4375dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CONTACT_ID}</td>
4376dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4377dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link RawContacts}.</td>
4378dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4379dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4380dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4381dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #AGGREGATION_MODE}</td>
4382dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4383dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link RawContacts}.</td>
4384dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4385dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4386dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4387dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #DELETED}</td>
4388dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4389dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link RawContacts}.</td>
4390dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4391dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
4392dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4393dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
4394dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4395dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>Data</th>
4396dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4397dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4398dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 7em;">long</td>
4399dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 20em;">{@link #DATA_ID}</td>
4400dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td style="width: 5em;">read-only</td>
4401dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Data row ID. It will be null if the raw contact has no data rows.</td>
4402dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4403dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4404dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4405dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #MIMETYPE}</td>
4406dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4407dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Data}.</td>
4408dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4409dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4410dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4411dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #IS_PRIMARY}</td>
4412dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4413dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Data}.</td>
4414dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4415dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4416dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4417dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #IS_SUPER_PRIMARY}</td>
4418dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4419dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Data}.</td>
4420dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4421dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4422dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4423dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #DATA_VERSION}</td>
4424dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4425dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Data}.</td>
4426dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4427dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4428dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Any type</td>
4429dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>
4430dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA1}<br>
4431dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA2}<br>
4432dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA3}<br>
4433dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA4}<br>
4434dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA5}<br>
4435dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA6}<br>
4436dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA7}<br>
4437dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA8}<br>
4438dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA9}<br>
4439dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA10}<br>
4440dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA11}<br>
4441dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA12}<br>
4442dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA13}<br>
4443dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA14}<br>
4444dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #DATA15}
4445dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
4446dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4447dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Data}.</td>
4448dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4449dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4450dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Any type</td>
4451dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>
4452dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #SYNC1}<br>
4453dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #SYNC2}<br>
4454dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #SYNC3}<br>
4455dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #SYNC4}
4456dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
4457dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4458dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Data}.</td>
4459dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4460dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
44615bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana     */
44625bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana    public final static class RawContactsEntity
44635bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana            implements BaseColumns, DataColumns, RawContactsColumns {
44645bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        /**
44655bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * This utility class cannot be instantiated
44665bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         */
44675bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        private RawContactsEntity() {}
44685bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana
44695bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        /**
44705bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * The content:// style URI for this table
44715bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         */
44725bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        public static final Uri CONTENT_URI =
44735bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana                Uri.withAppendedPath(AUTHORITY_URI, "raw_contact_entities");
44745bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana
44755bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        /**
44762b4d07519e428227c806831b401aa72f9409efa5Dave Santoro         * The content:// style URI for this table, specific to the user's profile.
44772b4d07519e428227c806831b401aa72f9409efa5Dave Santoro         */
44782b4d07519e428227c806831b401aa72f9409efa5Dave Santoro        public static final Uri PROFILE_CONTENT_URI =
44792b4d07519e428227c806831b401aa72f9409efa5Dave Santoro                Uri.withAppendedPath(Profile.CONTENT_URI, "raw_contact_entities");
44802b4d07519e428227c806831b401aa72f9409efa5Dave Santoro
44812b4d07519e428227c806831b401aa72f9409efa5Dave Santoro        /**
44825bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * The MIME type of {@link #CONTENT_URI} providing a directory of raw contact entities.
44835bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         */
44845bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact_entity";
44855bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana
44865bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        /**
44875bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * If {@link #FOR_EXPORT_ONLY} is explicitly set to "1", returned Cursor toward
44885bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * Data.CONTENT_URI contains only exportable data.
44895bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         *
44905bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * This flag is useful (currently) only for vCard exporter in Contacts app, which
44915bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * needs to exclude "un-exportable" data from available data to export, while
44925bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * Contacts app itself has priviledge to access all data including "un-expotable"
44935bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * ones and providers return all of them regardless of the callers' intention.
44945bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * <P>Type: INTEGER</p>
44955bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         *
44965bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * @hide Maybe available only in Eclair and not really ready for public use.
44975bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * TODO: remove, or implement this feature completely. As of now (Eclair),
44985bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * we only use this flag in queryEntities(), not query().
44995bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         */
45005bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        public static final String FOR_EXPORT_ONLY = "for_export_only";
45015bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana
45025bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        /**
45035bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * The ID of the data column. The value will be null if this raw contact has no data rows.
45045bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         * <P>Type: INTEGER</P>
45055bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana         */
45065bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana        public static final String DATA_ID = "data_id";
45075bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana    }
45085bba632d877c2878384ff21566c8eb6a1a22f37bFred Quintana
4509dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov    /**
4510dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see PhoneLookup
4511dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     */
45126e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface PhoneLookupColumns {
45139303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov        /**
45149303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov         * The phone number as the user entered it.
45159303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov         * <P>Type: TEXT</P>
45169303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov         */
45179303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov        public static final String NUMBER = "number";
45189303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov
45199303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov        /**
45209303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov         * The type of phone number, for example Home or Work.
45219303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov         * <P>Type: INTEGER</P>
45229303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov         */
45239303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov        public static final String TYPE = "type";
45249303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov
45259303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov        /**
45269303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov         * The user defined label for the phone number.
45279303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov         * <P>Type: TEXT</P>
45289303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov         */
45299303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov        public static final String LABEL = "label";
4530224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao
4531224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao        /**
4532224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao         * The phone number's E164 representation.
4533224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao         * <P>Type: TEXT</P>
4534224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao         *
4535224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao         * @hide
4536224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao         */
4537224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao        public static final String NORMALIZED_NUMBER = "normalized_number";
45389303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov    }
45399303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov
4540088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    /**
45418a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey     * A table that represents the result of looking up a phone number, for
45429303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov     * example for caller ID. To perform a lookup you must append the number you
4543dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * want to find to {@link #CONTENT_FILTER_URI}.  This query is highly
4544dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * optimized.
4545dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <pre>
4546dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber));
4547dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * resolver.query(uri, new String[]{PhoneLookup.DISPLAY_NAME,...
4548dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </pre>
4549dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4550dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h3>Columns</h3>
4551dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4552dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
4553dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4554dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>PhoneLookup</th>
4555dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4556dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4557dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4558dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #NUMBER}</td>
4559dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4560dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Phone number.</td>
4561dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4562dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4563dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4564dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #TYPE}</td>
4565dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4566dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Phone number type. See {@link CommonDataKinds.Phone}.</td>
4567dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4568dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4569dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4570dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #LABEL}</td>
4571dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4572dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Custom label for the phone number. See {@link CommonDataKinds.Phone}.</td>
4573dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4574dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
4575dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4576dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Columns from the Contacts table are also available through a join.
4577dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
4578dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
4579dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4580dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>Join with {@link Contacts}</th>
4581dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4582dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4583817b3f934271115258838d5cc4903ad5a2bef0f3Dmitri Plotnikov     * <td>long</td>
4584817b3f934271115258838d5cc4903ad5a2bef0f3Dmitri Plotnikov     * <td>{@link #_ID}</td>
4585817b3f934271115258838d5cc4903ad5a2bef0f3Dmitri Plotnikov     * <td>read-only</td>
4586817b3f934271115258838d5cc4903ad5a2bef0f3Dmitri Plotnikov     * <td>Contact ID.</td>
4587817b3f934271115258838d5cc4903ad5a2bef0f3Dmitri Plotnikov     * </tr>
4588817b3f934271115258838d5cc4903ad5a2bef0f3Dmitri Plotnikov     * <tr>
4589dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4590dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #LOOKUP_KEY}</td>
4591dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4592dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}</td>
4593dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4594dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4595dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4596dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #DISPLAY_NAME}</td>
4597dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4598dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}</td>
4599dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4600dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4601dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4602dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #PHOTO_ID}</td>
4603dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4604dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4605dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4606dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4607dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4608dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #IN_VISIBLE_GROUP}</td>
4609dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4610dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4611dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4612dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4613dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4614dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #HAS_PHONE_NUMBER}</td>
4615dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4616dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4617dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4618dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4619dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4620dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #TIMES_CONTACTED}</td>
4621dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4622dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4623dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4624dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4625dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4626dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #LAST_TIME_CONTACTED}</td>
4627dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4628dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4629dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4630dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4631dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4632dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STARRED}</td>
4633dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4634dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4635dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4636dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4637dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4638dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CUSTOM_RINGTONE}</td>
4639dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4640dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4641dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4642dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4643dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4644dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SEND_TO_VOICEMAIL}</td>
4645dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
4646dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link ContactsContract.Contacts}.</td>
4647dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4648dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
4649088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar     */
46509303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov    public static final class PhoneLookup implements BaseColumns, PhoneLookupColumns,
46519303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov            ContactsColumns, ContactOptionsColumns {
4652088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
4653088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * This utility class cannot be instantiated
4654088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
4655088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        private PhoneLookup() {}
4656088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
4657088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
4658088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * The content:// style URI for this table. Append the phone number you want to lookup
4659088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * to this URI and query it to perform a lookup. For example:
4660dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <pre>
4661dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_URI, Uri.encode(phoneNumber));
4662dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </pre>
4663088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
4664d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(AUTHORITY_URI,
4665d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                "phone_lookup");
46660b0b8a8dae45e6f35d05da9c0d70c62cdf23fb20Dmitri Plotnikov
46670b0b8a8dae45e6f35d05da9c0d70c62cdf23fb20Dmitri Plotnikov        /**
46680b0b8a8dae45e6f35d05da9c0d70c62cdf23fb20Dmitri Plotnikov         * The MIME type of {@link #CONTENT_FILTER_URI} providing a directory of phone lookup rows.
46690b0b8a8dae45e6f35d05da9c0d70c62cdf23fb20Dmitri Plotnikov         *
46700b0b8a8dae45e6f35d05da9c0d70c62cdf23fb20Dmitri Plotnikov         * @hide
46710b0b8a8dae45e6f35d05da9c0d70c62cdf23fb20Dmitri Plotnikov         */
46720b0b8a8dae45e6f35d05da9c0d70c62cdf23fb20Dmitri Plotnikov        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone_lookup";
467352c01c22a53cfd87e36b3c078235600260567c08Flavio Lerda
467452c01c22a53cfd87e36b3c078235600260567c08Flavio Lerda       /**
467552c01c22a53cfd87e36b3c078235600260567c08Flavio Lerda        * Boolean parameter that is used to look up a SIP address.
467652c01c22a53cfd87e36b3c078235600260567c08Flavio Lerda        *
467752c01c22a53cfd87e36b3c078235600260567c08Flavio Lerda        * @hide
467852c01c22a53cfd87e36b3c078235600260567c08Flavio Lerda        */
467952c01c22a53cfd87e36b3c078235600260567c08Flavio Lerda        public static final String QUERY_PARAMETER_SIP_ADDRESS = "sip";
4680d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey    }
4681d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey
4682d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey    /**
4683879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov     * Additional data mixed in with {@link StatusColumns} to link
4684879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov     * back to specific {@link ContactsContract.Data#_ID} entries.
4685dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4686dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see StatusUpdates
4687d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey     */
46886e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface PresenceColumns {
468955048a980e80cddf8d3556f3feaf235759ef24ddDmitri Plotnikov
4690d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        /**
4691d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         * Reference to the {@link Data#_ID} entry that owns this presence.
46928a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * <P>Type: INTEGER</P>
4693d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         */
4694d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov        public static final String DATA_ID = "presence_data_id";
4695d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey
4696d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        /**
4697dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * See {@link CommonDataKinds.Im} for a list of defined protocol constants.
469831f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * <p>Type: NUMBER</p>
4699d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         */
470031f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov        public static final String PROTOCOL = "protocol";
4701d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey
4702d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        /**
470331f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * Name of the custom protocol.  Should be supplied along with the {@link #PROTOCOL} value
470431f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * {@link ContactsContract.CommonDataKinds.Im#PROTOCOL_CUSTOM}.  Should be null or
470531f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * omitted if {@link #PROTOCOL} value is not
470631f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * {@link ContactsContract.CommonDataKinds.Im#PROTOCOL_CUSTOM}.
470731f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         *
470831f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * <p>Type: NUMBER</p>
470931f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         */
471031f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov        public static final String CUSTOM_PROTOCOL = "custom_protocol";
471131f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov
471231f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov        /**
471331f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * The IM handle the presence item is for. The handle is scoped to
471431f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * {@link #PROTOCOL}.
47158a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * <P>Type: TEXT</P>
4716d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         */
4717d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        public static final String IM_HANDLE = "im_handle";
4718d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey
4719d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        /**
4720d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         * The IM account for the local user that the presence data came from.
47218a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * <P>Type: TEXT</P>
4722d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         */
4723d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        public static final String IM_ACCOUNT = "im_account";
4724d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey    }
4725d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey
4726879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov    /**
4727dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4728dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * A status update is linked to a {@link ContactsContract.Data} row and captures
4729dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * the user's latest status update via the corresponding source, e.g.
4730dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * "Having lunch" via "Google Talk".
4731dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
4732dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4733dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * There are two ways a status update can be inserted: by explicitly linking
4734dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * it to a Data row using {@link #DATA_ID} or indirectly linking it to a data row
4735dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * using a combination of {@link #PROTOCOL} (or {@link #CUSTOM_PROTOCOL}) and
4736dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #IM_HANDLE}.  There is no difference between insert and update, you can use
4737dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * either.
4738dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
4739dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4740063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * Inserting or updating a status update for the user's profile requires either using
4741063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * the {@link #DATA_ID} to identify the data row to attach the update to, or
4742063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * {@link StatusUpdates#PROFILE_CONTENT_URI} to ensure that the change is scoped to the
4743063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * profile.
4744063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * </p>
4745063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro     * <p>
4746dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * You cannot use {@link ContentResolver#update} to change a status, but
4747dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContentResolver#insert} will replace the latests status if it already
4748dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * exists.
4749dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
4750dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4751dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Use {@link ContentResolver#bulkInsert(Uri, ContentValues[])} to insert/update statuses
4752dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * for multiple contacts at once.
4753dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
4754dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     *
4755dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h3>Columns</h3>
4756dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
4757dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4758dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>StatusUpdates</th>
4759dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4760dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4761dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4762dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #DATA_ID}</td>
4763dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4764dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Reference to the {@link Data#_ID} entry that owns this presence. If this
4765dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * field is <i>not</i> specified, the provider will attempt to find a data row
4766dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * that matches the {@link #PROTOCOL} (or {@link #CUSTOM_PROTOCOL}) and
4767dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #IM_HANDLE} columns.
4768dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
4769dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4770dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4771dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4772dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #PROTOCOL}</td>
4773dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4774dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>See {@link CommonDataKinds.Im} for a list of defined protocol constants.</td>
4775dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4776dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4777dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4778dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #CUSTOM_PROTOCOL}</td>
4779dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4780dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Name of the custom protocol.  Should be supplied along with the {@link #PROTOCOL} value
4781dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContactsContract.CommonDataKinds.Im#PROTOCOL_CUSTOM}.  Should be null or
4782dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * omitted if {@link #PROTOCOL} value is not
4783dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link ContactsContract.CommonDataKinds.Im#PROTOCOL_CUSTOM}.</td>
4784dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4785dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4786dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4787dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #IM_HANDLE}</td>
4788dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4789dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td> The IM handle the presence item is for. The handle is scoped to
4790dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #PROTOCOL}.</td>
4791dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4792dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4793dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4794dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #IM_ACCOUNT}</td>
4795dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4796dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The IM account for the local user that the presence data came from.</td>
4797dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4798dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4799dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
4800dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #PRESENCE}</td>
4801dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4802dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Contact IM presence status. The allowed values are:
4803dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4804dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <ul>
4805dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link #OFFLINE}</li>
4806dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link #INVISIBLE}</li>
4807dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link #AWAY}</li>
4808dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link #IDLE}</li>
4809dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link #DO_NOT_DISTURB}</li>
4810dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <li>{@link #AVAILABLE}</li>
4811dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </ul>
4812dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
4813dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
4814dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Since presence status is inherently volatile, the content provider
4815dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * may choose not to store this field in long-term storage.
4816dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
4817dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </td>
4818dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4819dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
48205b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * <td>int</td>
48215b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * <td>{@link #CHAT_CAPABILITY}</td>
48225b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * <td>read/write</td>
4823b332747ee087d2baa5c54b3382e57ad435158737Daniel Lehmann     * <td>Contact IM chat compatibility value. The allowed values combinations of the following
4824b332747ee087d2baa5c54b3382e57ad435158737Daniel Lehmann     * flags. If None of these flags is set, the device can only do text messaging.
48255b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * <p>
48265b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * <ul>
4827b332747ee087d2baa5c54b3382e57ad435158737Daniel Lehmann     * <li>{@link #CAPABILITY_HAS_VIDEO}</li>
48285b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * <li>{@link #CAPABILITY_HAS_VOICE}</li>
48295b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * <li>{@link #CAPABILITY_HAS_CAMERA}</li>
48305b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * </ul>
48315b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * </p>
48325b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * <p>
48335b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * Since chat compatibility is inherently volatile as the contact's availability moves from
48345b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * one device to another, the content provider may choose not to store this field in long-term
48355b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * storage.
48365b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * </p>
48375b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * </td>
48385b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * </tr>
48395b31498ba1f9874f395d80152304512fa4c0144dVasu Nori     * <tr>
4840dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4841dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STATUS}</td>
4842dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4843dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Contact's latest status update, e.g. "having toast for breakfast"</td>
4844dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4845dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4846dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4847dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STATUS_TIMESTAMP}</td>
4848dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4849dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The absolute time in milliseconds when the status was
4850dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * entered by the user. If this value is not provided, the provider will follow
4851dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * this logic: if there was no prior status update, the value will be left as null.
4852dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * If there was a prior status update, the provider will default this field
4853dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * to the current time.</td>
4854dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4855dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4856dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
4857dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STATUS_RES_PACKAGE}</td>
4858dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4859dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td> The package containing resources for this status: label and icon.</td>
4860dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4861dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4862dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4863dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STATUS_LABEL}</td>
4864dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4865dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The resource ID of the label describing the source of contact status,
4866dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * e.g. "Google Talk". This resource is scoped by the
4867dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #STATUS_RES_PACKAGE}.</td>
4868dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4869dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
4870dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
4871dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #STATUS_ICON}</td>
4872dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
4873dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The resource ID of the icon for the source of contact status. This
4874dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * resource is scoped by the {@link #STATUS_RES_PACKAGE}.</td>
4875dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
4876dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
4877879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov     */
4878dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov    public static class StatusUpdates implements StatusColumns, PresenceColumns {
4879f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov
4880d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        /**
4881d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         * This utility class cannot be instantiated
4882d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         */
4883879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        private StatusUpdates() {}
4884d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey
4885d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        /**
4886d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         * The content:// style URI for this table
4887d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         */
4888879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "status_updates");
488985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton
489085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton        /**
4891063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         * The content:// style URI for this table, specific to the user's profile.
4892063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro         */
4893063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        public static final Uri PROFILE_CONTENT_URI =
4894063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro                Uri.withAppendedPath(Profile.CONTENT_URI, "status_updates");
4895063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro
4896063084e619dcd9f81c410ce675fd21c53b1e940dDave Santoro        /**
4897d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         * Gets the resource ID for the proper presence icon.
4898d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         *
4899d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         * @param status the status to get the icon for
4900d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         * @return the resource ID for the proper presence icon
4901d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         */
4902d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        public static final int getPresenceIconResourceId(int status) {
4903d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey            switch (status) {
4904d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                case AVAILABLE:
4905d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                    return android.R.drawable.presence_online;
4906d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                case IDLE:
4907d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                case AWAY:
4908d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                    return android.R.drawable.presence_away;
4909d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                case DO_NOT_DISTURB:
4910d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                    return android.R.drawable.presence_busy;
4911d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                case INVISIBLE:
4912d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                    return android.R.drawable.presence_invisible;
4913d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                case OFFLINE:
4914d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                default:
4915d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey                    return android.R.drawable.presence_offline;
4916d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey            }
4917d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        }
4918d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey
4919d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        /**
4920c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar         * Returns the precedence of the status code the higher number being the higher precedence.
4921c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar         *
4922c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar         * @param status The status code.
4923c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar         * @return An integer representing the precedence, 0 being the lowest.
4924c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar         */
4925c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar        public static final int getPresencePrecedence(int status) {
4926c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar            // Keep this function here incase we want to enforce a different precedence than the
4927c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar            // natural order of the status constants.
4928c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar            return status;
4929c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar        }
4930c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar
4931c043752ca3cdd71fbee868a351881bd4272c31a7Evan Millar        /**
4932d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         * The MIME type of {@link #CONTENT_URI} providing a directory of
4933879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * status update details.
4934d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         */
4935879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/status-update";
4936d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey
4937d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey        /**
4938d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         * The MIME type of a {@link #CONTENT_URI} subdirectory of a single
4939879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov         * status update detail.
4940d530b3ce850cfa3d61b79eba1aee6f67b04dba15Jeff Sharkey         */
4941879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/status-update";
4942879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov    }
4943879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov
4944dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov    /**
4945dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @deprecated This old name was never meant to be made public. Do not use.
4946dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     */
4947879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov    @Deprecated
4948879664e3e2e0169aba53d88f6c30c8b15858315dDmitri Plotnikov    public static final class Presence extends StatusUpdates {
4949f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov
4950088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    }
4951088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
4952088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    /**
4953123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov     * Additional column returned by the {@link Contacts#CONTENT_FILTER_URI} providing the
4954123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov     * explanation of why the filter matched the contact.  Specifically, it contains the
4955123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov     * data elements that matched the query.  The overall number of words in the snippet
4956123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov     * can be capped.
49573ba8a3b39bb5eb91a1b5c85c073c03e264b1736bDmitri Plotnikov     *
49583ba8a3b39bb5eb91a1b5c85c073c03e264b1736bDmitri Plotnikov     * @hide
49593ba8a3b39bb5eb91a1b5c85c073c03e264b1736bDmitri Plotnikov     */
49603ba8a3b39bb5eb91a1b5c85c073c03e264b1736bDmitri Plotnikov    public static class SearchSnippetColumns {
49613ba8a3b39bb5eb91a1b5c85c073c03e264b1736bDmitri Plotnikov
49623ba8a3b39bb5eb91a1b5c85c073c03e264b1736bDmitri Plotnikov        /**
4963123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * The search snippet constructed according to the SQLite rules, see
4964123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * http://www.sqlite.org/fts3.html#snippet
4965123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * <p>
4966123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * The snippet may contain (parts of) several data elements comprising
4967123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * the contact.
4968123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         *
4969123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * @hide
4970123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         */
4971123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov        public static final String SNIPPET = "snippet";
4972123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov
4973123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov
4974123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov        /**
4975123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * Comma-separated parameters for the generation of the snippet:
4976123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * <ul>
4977123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * <li>The "start match" text. Default is &lt;b&gt;</li>
4978123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * <li>The "end match" text. Default is &lt;/b&gt;</li>
4979123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * <li>The "ellipsis" text. Default is &lt;b&gt;...&lt;/b&gt;</li>
4980123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * <li>Maximum number of tokens to include in the snippet. Can be either
4981123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * a positive or a negative number: A positive number indicates how many
4982123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * tokens can be returned in total. A negative number indicates how many
4983123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * tokens can be returned per occurrence of the search terms.</li>
4984123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * </ul>
4985123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         *
4986123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         * @hide
4987123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov         */
4988123653b890df3e18f9921db8144a8119578e0c61Dmitri Plotnikov        public static final String SNIPPET_ARGS_PARAM_KEY = "snippet_args";
49899fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
49909fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        /**
49919fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson         * A key to ask the provider to defer the snippeting to the client if possible.
49929fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson         * Value of 1 implies true, 0 implies false when 0 is the default.
49939fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson         * When a cursor is returned to the client, it should check for an extra with the name
49949fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson         * {@link ContactsContract#DEFERRED_SNIPPETING} in the cursor. If it exists, the client
49959fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson         * should do its own snippeting using {@link ContactsContract#snippetize}. If
49969fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson         * it doesn't exist, the snippet column in the cursor should already contain a snippetized
49979fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson         * string.
49989fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson         *
49999fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson         * @hide
50009fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson         */
50019fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        public static final String DEFERRED_SNIPPETING_KEY = "deferred_snippeting";
50023ba8a3b39bb5eb91a1b5c85c073c03e264b1736bDmitri Plotnikov    }
50033ba8a3b39bb5eb91a1b5c85c073c03e264b1736bDmitri Plotnikov
50043ba8a3b39bb5eb91a1b5c85c073c03e264b1736bDmitri Plotnikov    /**
5005dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Container for definitions of common data types stored in the {@link ContactsContract.Data}
5006dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * table.
5007088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar     */
5008088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar    public static final class CommonDataKinds {
5009088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
501085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * This utility class cannot be instantiated
501185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         */
501285abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton        private CommonDataKinds() {}
501385abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton
501485abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton        /**
50158a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * The {@link Data#RES_PACKAGE} value for common data that should be
50168a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * shown using a default style.
501785abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
501885abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide RES_PACKAGE is hidden
5019088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
5020088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        public static final String PACKAGE_COMMON = "common";
5021088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5022088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
5023761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov         * The base types that all "Typed" data kinds support.
5024761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov         */
5025761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov        public interface BaseTypes {
5026761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov            /**
5027761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov             * A custom type. The custom label should be supplied by user.
5028761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov             */
5029761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov            public static int TYPE_CUSTOM = 0;
5030761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov        }
5031761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov
5032761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov        /**
5033088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * Columns common across the specific types.
5034088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
50356e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov        protected interface CommonColumns extends BaseTypes {
5036088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
503715e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov             * The data for the contact method.
503815e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov             * <P>Type: TEXT</P>
5039088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
504015e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String DATA = DataColumns.DATA1;
5041088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5042088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
504315e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov             * The type of data, for example Home or Work.
504415e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov             * <P>Type: INTEGER</P>
5045088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
504615e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String TYPE = DataColumns.DATA2;
5047088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5048088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
5049c9260540729d731e22458ce48127ca2ffaef33eeDmitri Plotnikov             * The user defined label for the the contact method.
5050088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
5051088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
505215e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String LABEL = DataColumns.DATA3;
5053088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
5054088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5055088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
5056dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A data kind representing the contact's proper name. You can use all
5057dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * columns defined for {@link ContactsContract.Data} as well as the following aliases.
5058dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *
5059dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
5060dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
5061dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5062dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th><th>Alias</th><th colspan='2'>Data column</th>
5063dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5064dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5065dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5066dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DISPLAY_NAME}</td>
5067dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
5068dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5069dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5070dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5071dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5072dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #GIVEN_NAME}</td>
5073dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA2}</td>
5074dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5075dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5076dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5077dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5078dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #FAMILY_NAME}</td>
5079dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA3}</td>
5080dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5081dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5082dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5083dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5084dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #PREFIX}</td>
5085dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA4}</td>
5086dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Common prefixes in English names are "Mr", "Ms", "Dr" etc.</td>
5087dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5088dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5089dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5090dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #MIDDLE_NAME}</td>
5091dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA5}</td>
5092dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5093dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5094dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5095dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5096dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #SUFFIX}</td>
5097dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA6}</td>
5098dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Common suffixes in English names are "Sr", "Jr", "III" etc.</td>
5099dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5100dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5101dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5102dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #PHONETIC_GIVEN_NAME}</td>
5103dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA7}</td>
5104dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Used for phonetic spelling of the name, e.g. Pinyin, Katakana, Hiragana</td>
5105dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5106dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5107dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5108dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #PHONETIC_MIDDLE_NAME}</td>
5109dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA8}</td>
5110dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5111dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5112dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5113dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5114dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #PHONETIC_FAMILY_NAME}</td>
5115dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA9}</td>
5116dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5117dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5118dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
5119088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
51200dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class StructuredName implements DataColumnsWithJoins {
512185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
512285abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
512385abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
5124088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            private StructuredName() {}
5125088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
51268a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
5127088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name";
5128088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5129088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
513015e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov             * The name that should be used to display the contact.
513115e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov             * <i>Unstructured component of the name should be consistent with
513215e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov             * its structured representation.</i>
513315e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov             * <p>
513415e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov             * Type: TEXT
513515e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov             */
513615e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String DISPLAY_NAME = DATA1;
513715e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov
513815e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            /**
5139c9260540729d731e22458ce48127ca2ffaef33eeDmitri Plotnikov             * The given name for the contact.
5140c9260540729d731e22458ce48127ca2ffaef33eeDmitri Plotnikov             * <P>Type: TEXT</P>
5141088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
514215e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String GIVEN_NAME = DATA2;
5143088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5144088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
5145c9260540729d731e22458ce48127ca2ffaef33eeDmitri Plotnikov             * The family name for the contact.
5146088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
5147088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
514815e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String FAMILY_NAME = DATA3;
5149088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5150088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
5151c9260540729d731e22458ce48127ca2ffaef33eeDmitri Plotnikov             * The contact's honorific prefix, e.g. "Sir"
5152088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
5153088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
515415e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String PREFIX = DATA4;
5155088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5156088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
5157c9260540729d731e22458ce48127ca2ffaef33eeDmitri Plotnikov             * The contact's middle name
5158088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
5159088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
516015e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String MIDDLE_NAME = DATA5;
5161088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5162088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
5163088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * The contact's honorific suffix, e.g. "Jr"
5164088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
516515e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String SUFFIX = DATA6;
5166088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5167088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
5168088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * The phonetic version of the given name for the contact.
5169088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
5170088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
517115e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String PHONETIC_GIVEN_NAME = DATA7;
5172088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5173088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
5174088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * The phonetic version of the additional name for the contact.
5175088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
5176088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
517715e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String PHONETIC_MIDDLE_NAME = DATA8;
5178088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5179088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
5180088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * The phonetic version of the family name for the contact.
5181088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
5182088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
518315e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String PHONETIC_FAMILY_NAME = DATA9;
518407ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
518507ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov            /**
518607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov             * The style used for combining given/middle/family name into a full name.
518707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov             * See {@link ContactsContract.FullNameStyle}.
518807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov             *
518907ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov             * @hide
519007ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov             */
519107ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov            public static final String FULL_NAME_STYLE = DATA10;
519207ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov
519307ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov            /**
519407ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov             * The alphabet used for capturing the phonetic name.
5195b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov             * See ContactsContract.PhoneticNameStyle.
519607ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov             * @hide
519707ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov             */
519807ab85b338d6e08a901a13230ae4cedc57e418eaDmitri Plotnikov            public static final String PHONETIC_NAME_STYLE = DATA11;
5199088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
5200088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5201088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
5202dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>A data kind representing the contact's nickname. For example, for
5203dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * Bob Parr ("Mr. Incredible"):
5204dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <pre>
5205beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov         * ArrayList&lt;ContentProviderOperation&gt; ops =
5206beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov         *          new ArrayList&lt;ContentProviderOperation&gt;();
5207beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov         *
5208dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
5209dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .withValue(Data.RAW_CONTACT_ID, rawContactId)
5210dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)
5211dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .withValue(StructuredName.DISPLAY_NAME, &quot;Bob Parr&quot;)
5212dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .build());
5213dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *
5214dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
5215dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .withValue(Data.RAW_CONTACT_ID, rawContactId)
5216dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .withValue(Data.MIMETYPE, Nickname.CONTENT_ITEM_TYPE)
5217dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .withValue(Nickname.NAME, "Mr. Incredible")
5218dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .withValue(Nickname.TYPE, Nickname.TYPE_CUSTOM)
5219dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .withValue(Nickname.LABEL, "Superhero")
5220dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *          .build());
5221dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *
5222dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
5223dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </pre>
5224dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5225dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5226dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as well as the
5227dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * following aliases.
5228dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5229dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         *
5230dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
5231dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
5232dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5233dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th><th>Alias</th><th colspan='2'>Data column</th>
5234dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5235dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5236dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5237dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #NAME}</td>
5238dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
5239dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5240dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5241dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5242dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>int</td>
5243dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #TYPE}</td>
5244dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA2}</td>
5245dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>
5246dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * Allowed values are:
5247dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5248dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <ul>
5249dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.</li>
5250dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_DEFAULT}</li>
5251dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_OTHER_NAME}</li>
5252747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <li>{@link #TYPE_MAIDEN_NAME}</li>
5253dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_SHORT_NAME}</li>
5254dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_INITIALS}</li>
5255dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </ul>
5256dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5257dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
5258dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5259dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5260dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5261dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #LABEL}</td>
5262dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA3}</td>
5263dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5264dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5265dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
5266088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
52670dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class Nickname implements DataColumnsWithJoins, CommonColumns {
526885abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
526985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
527085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
5271088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            private Nickname() {}
5272088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
52738a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
5274088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname";
5275088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
527678e79ad61bee932a9ce1418a9b9e8a5bae8bf2dfEvan Millar            public static final int TYPE_DEFAULT = 1;
527778e79ad61bee932a9ce1418a9b9e8a5bae8bf2dfEvan Millar            public static final int TYPE_OTHER_NAME = 2;
5278747c61535281b4d2958e293e83245a19ba58f6a0David Brown            public static final int TYPE_MAIDEN_NAME = 3;
5279747c61535281b4d2958e293e83245a19ba58f6a0David Brown            /** @deprecated Use TYPE_MAIDEN_NAME instead. */
5280747c61535281b4d2958e293e83245a19ba58f6a0David Brown            @Deprecated
528178e79ad61bee932a9ce1418a9b9e8a5bae8bf2dfEvan Millar            public static final int TYPE_MAINDEN_NAME = 3;
528278e79ad61bee932a9ce1418a9b9e8a5bae8bf2dfEvan Millar            public static final int TYPE_SHORT_NAME = 4;
528378e79ad61bee932a9ce1418a9b9e8a5bae8bf2dfEvan Millar            public static final int TYPE_INITIALS = 5;
5284088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5285088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
5286c9260540729d731e22458ce48127ca2ffaef33eeDmitri Plotnikov             * The name itself
5287088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
5288761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov            public static final String NAME = DATA;
5289088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
5290088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5291088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
5292dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5293dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A data kind representing a telephone number.
5294dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5295dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5296dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
5297dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
5298dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5299dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
5300dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
5301dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5302dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
5303dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
5304dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5305dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5306dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5307dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #NUMBER}</td>
5308dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
5309dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5310dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5311dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5312dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>int</td>
5313dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #TYPE}</td>
5314dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA2}</td>
5315dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Allowed values are:
5316dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5317dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <ul>
5318dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.</li>
5319dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_HOME}</li>
5320dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_MOBILE}</li>
5321dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_WORK}</li>
5322dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_FAX_WORK}</li>
5323dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_FAX_HOME}</li>
5324dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_PAGER}</li>
5325dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_OTHER}</li>
5326dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CALLBACK}</li>
5327dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CAR}</li>
5328dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_COMPANY_MAIN}</li>
5329dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_ISDN}</li>
5330dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_MAIN}</li>
5331dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_OTHER_FAX}</li>
5332dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_RADIO}</li>
5333dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_TELEX}</li>
5334dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_TTY_TDD}</li>
5335dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_WORK_MOBILE}</li>
5336dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_WORK_PAGER}</li>
5337dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_ASSISTANT}</li>
5338dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_MMS}</li>
5339dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </ul>
5340dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5341dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
5342dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5343dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5344dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5345dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #LABEL}</td>
5346dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA3}</td>
5347dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5348dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5349dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
5350088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
53510dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class Phone implements DataColumnsWithJoins, CommonColumns {
535285abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
535385abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
535485abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
5355088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            private Phone() {}
5356088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
53578a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
5358b3c49982840c05a5392d53efe97253c04fc59ef0Evan Millar            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2";
5359088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5360161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar            /**
5361161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             * The MIME type of {@link #CONTENT_URI} providing a directory of
5362161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             * phones.
5363161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             */
5364b3c49982840c05a5392d53efe97253c04fc59ef0Evan Millar            public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2";
5365161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar
5366161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar            /**
5367161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             * The content:// style URI for all data records of the
5368f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * {@link #CONTENT_ITEM_TYPE} MIME type, combined with the
53697cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov             * associated raw contact and aggregate contact data.
5370161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             */
5371161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar            public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
5372161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar                    "phones");
5373161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar
5374161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar            /**
5375989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov             * The content:// style URL for phone lookup using a filter. The filter returns
5376f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * records of MIME type {@link #CONTENT_ITEM_TYPE}. The filter is applied
5377989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov             * to display names as well as phone numbers. The filter argument should be passed
5378989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov             * as an additional path segment after this URI.
5379161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             */
5380161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar            public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI,
5381161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar                    "filter");
5382161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar
5383088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_HOME = 1;
5384088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_MOBILE = 2;
5385088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_WORK = 3;
5386088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_FAX_WORK = 4;
5387088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_FAX_HOME = 5;
5388088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_PAGER = 6;
5389088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_OTHER = 7;
53903f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_CALLBACK = 8;
53913f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_CAR = 9;
53923f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_COMPANY_MAIN = 10;
53933f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_ISDN = 11;
53943f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_MAIN = 12;
53953f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_OTHER_FAX = 13;
53963f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_RADIO = 14;
53973f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_TELEX = 15;
53983f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_TTY_TDD = 16;
53993f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_WORK_MOBILE = 17;
54003f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_WORK_PAGER = 18;
54013f86715d77f5c3d504aac449755d69d99aecdf51Fred Quintana            public static final int TYPE_ASSISTANT = 19;
5402d5abd46059f1970de2fed2b88183e8ec198d4cf2Jeff Sharkey            public static final int TYPE_MMS = 20;
5403088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5404088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
5405088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * The phone number as the user entered it.
5406088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
5407088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
5408761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov            public static final String NUMBER = DATA;
54099303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov
541088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
5411224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao             * The phone number's E164 representation.
5412224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao             * <P>Type: TEXT</P>
5413224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao             *
5414224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao             * @hide
5415224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao             */
5416224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao            public static final String NORMALIZED_NUMBER = DATA4;
5417224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao
5418224744cc72aa7799fb3e5c505123d09d64d4e0c4Bai Tao            /**
541988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * @deprecated use {@link #getTypeLabel(Resources, int, CharSequence)} instead.
542085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * @hide
542188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
542288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            @Deprecated
54239303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov            public static final CharSequence getDisplayLabel(Context context, int type,
54249303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov                    CharSequence label, CharSequence[] labelArray) {
542588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                return getTypeLabel(context.getResources(), type, label);
54269303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov            }
54279303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov
542888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
542988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * @deprecated use {@link #getTypeLabel(Resources, int, CharSequence)} instead.
543085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * @hide
543188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
543288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            @Deprecated
54339303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov            public static final CharSequence getDisplayLabel(Context context, int type,
54349303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov                    CharSequence label) {
543588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                return getTypeLabel(context.getResources(), type, label);
543688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
543788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
543888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
543988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return the string resource that best describes the given
5440f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * {@link #TYPE}. Will always return a valid resource.
544188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
544288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final int getTypeLabelResource(int type) {
544388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                switch (type) {
544488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_HOME: return com.android.internal.R.string.phoneTypeHome;
544588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_MOBILE: return com.android.internal.R.string.phoneTypeMobile;
544688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_WORK: return com.android.internal.R.string.phoneTypeWork;
544788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_FAX_WORK: return com.android.internal.R.string.phoneTypeFaxWork;
544888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_FAX_HOME: return com.android.internal.R.string.phoneTypeFaxHome;
544988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_PAGER: return com.android.internal.R.string.phoneTypePager;
545088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_OTHER: return com.android.internal.R.string.phoneTypeOther;
545188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_CALLBACK: return com.android.internal.R.string.phoneTypeCallback;
545288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_CAR: return com.android.internal.R.string.phoneTypeCar;
545388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_COMPANY_MAIN: return com.android.internal.R.string.phoneTypeCompanyMain;
545488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_ISDN: return com.android.internal.R.string.phoneTypeIsdn;
545588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_MAIN: return com.android.internal.R.string.phoneTypeMain;
545688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_OTHER_FAX: return com.android.internal.R.string.phoneTypeOtherFax;
545788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_RADIO: return com.android.internal.R.string.phoneTypeRadio;
545888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_TELEX: return com.android.internal.R.string.phoneTypeTelex;
545988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_TTY_TDD: return com.android.internal.R.string.phoneTypeTtyTdd;
546088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_WORK_MOBILE: return com.android.internal.R.string.phoneTypeWorkMobile;
546188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_WORK_PAGER: return com.android.internal.R.string.phoneTypeWorkPager;
546288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_ASSISTANT: return com.android.internal.R.string.phoneTypeAssistant;
546388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_MMS: return com.android.internal.R.string.phoneTypeMms;
546488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    default: return com.android.internal.R.string.phoneTypeCustom;
546588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
546688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
546788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
546888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
546988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return a {@link CharSequence} that best describes the given type,
5470f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * possibly substituting the given {@link #LABEL} value
5471f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * for {@link #TYPE_CUSTOM}.
547288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
547388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final CharSequence getTypeLabel(Resources res, int type,
547488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    CharSequence label) {
547588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                if ((type == TYPE_CUSTOM || type == TYPE_ASSISTANT) && !TextUtils.isEmpty(label)) {
547688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return label;
547788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                } else {
547888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    final int labelRes = getTypeLabelResource(type);
547988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return res.getText(labelRes);
548088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
54819303295e1db08bf73ebabac425bd39728bb2f893Dmitri Plotnikov            }
5482088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
5483088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5484088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
5485dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5486dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A data kind representing an email address.
5487dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5488dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5489dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
5490dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
5491dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5492dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
5493dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
5494dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5495dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
5496dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
5497dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5498dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5499dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
55001ecf551b80d91552fe7e1a56ede8f21bbe99b144Dmitri Plotnikov         * <td>{@link #ADDRESS}</td>
5501dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
5502dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Email address itself.</td>
5503dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5504dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5505dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>int</td>
5506dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #TYPE}</td>
5507dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA2}</td>
5508dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Allowed values are:
5509dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5510dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <ul>
5511dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.</li>
5512dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_HOME}</li>
5513dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_WORK}</li>
5514dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_OTHER}</li>
5515dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_MOBILE}</li>
5516dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </ul>
5517dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5518dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
5519dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5520dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5521dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5522dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #LABEL}</td>
5523dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA3}</td>
5524dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5525dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5526dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
5527088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
55280dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class Email implements DataColumnsWithJoins, CommonColumns {
552985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
553085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
553185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
5532088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            private Email() {}
5533088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
55348a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
5535b3c49982840c05a5392d53efe97253c04fc59ef0Evan Millar            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email_v2";
5536088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5537d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov            /**
5538abf15c30c11162b6756689b5f7543f0085d8302eDmitri Plotnikov             * The MIME type of {@link #CONTENT_URI} providing a directory of email addresses.
5539abf15c30c11162b6756689b5f7543f0085d8302eDmitri Plotnikov             */
5540abf15c30c11162b6756689b5f7543f0085d8302eDmitri Plotnikov            public static final String CONTENT_TYPE = "vnd.android.cursor.dir/email_v2";
5541abf15c30c11162b6756689b5f7543f0085d8302eDmitri Plotnikov
5542abf15c30c11162b6756689b5f7543f0085d8302eDmitri Plotnikov            /**
5543d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov             * The content:// style URI for all data records of the
5544f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * {@link #CONTENT_ITEM_TYPE} MIME type, combined with the
5545d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov             * associated raw contact and aggregate contact data.
5546d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov             */
5547d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov            public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
5548d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov                    "emails");
5549d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov
5550d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov            /**
5551dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * <p>
5552989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov             * The content:// style URL for looking up data rows by email address. The
5553989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov             * lookup argument, an email address, should be passed as an additional path segment
5554989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov             * after this URI.
5555dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * </p>
5556dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * <p>Example:
5557dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * <pre>
5558dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * Uri uri = Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(email));
5559dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * Cursor c = getContentResolver().query(uri,
5560dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             *          new String[]{Email.CONTACT_ID, Email.DISPLAY_NAME, Email.DATA},
5561dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             *          null, null, null);
5562dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * </pre>
5563dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * </p>
5564989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov             */
5565989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov            public static final Uri CONTENT_LOOKUP_URI = Uri.withAppendedPath(CONTENT_URI,
5566989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov                    "lookup");
5567989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov
5568989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov            /**
5569dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * <p>
5570989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov             * The content:// style URL for email lookup using a filter. The filter returns
5571f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * records of MIME type {@link #CONTENT_ITEM_TYPE}. The filter is applied
5572989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov             * to display names as well as email addresses. The filter argument should be passed
5573989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov             * as an additional path segment after this URI.
5574dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * </p>
5575dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * <p>The query in the following example will return "Robert Parr (bob@incredibles.com)"
5576dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * as well as "Bob Parr (incredible@android.com)".
5577dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * <pre>
5578dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * Uri uri = Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode("bob"));
5579dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * Cursor c = getContentResolver().query(uri,
5580dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             *          new String[]{Email.DISPLAY_NAME, Email.DATA},
5581dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             *          null, null, null);
5582dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * </pre>
5583dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * </p>
5584d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov             */
5585989f263dcffc37a43846c3667f51ce8f752f2479Dmitri Plotnikov            public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI,
5586d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov                    "filter");
5587d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov
5588dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov            /**
5589dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * The email address.
5590dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * <P>Type: TEXT</P>
5591dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             */
5592dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov            public static final String ADDRESS = DATA1;
5593dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov
5594088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_HOME = 1;
5595088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_WORK = 2;
5596088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_OTHER = 3;
559714fb1538662724ef57d6b6bfb4bb53efed5a6650Jeff Sharkey            public static final int TYPE_MOBILE = 4;
55988851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
55998851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            /**
56008851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * The display name for the email address
56018851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * <P>Type: TEXT</P>
56028851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             */
560315e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String DISPLAY_NAME = DATA4;
560488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
560588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
560688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return the string resource that best describes the given
5607f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * {@link #TYPE}. Will always return a valid resource.
560888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
560988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final int getTypeLabelResource(int type) {
561088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                switch (type) {
561188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_HOME: return com.android.internal.R.string.emailTypeHome;
561288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_WORK: return com.android.internal.R.string.emailTypeWork;
561388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_OTHER: return com.android.internal.R.string.emailTypeOther;
561488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_MOBILE: return com.android.internal.R.string.emailTypeMobile;
561588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    default: return com.android.internal.R.string.emailTypeCustom;
561688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
561788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
561888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
561988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
562088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return a {@link CharSequence} that best describes the given type,
5621f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * possibly substituting the given {@link #LABEL} value
5622f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * for {@link #TYPE_CUSTOM}.
562388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
562488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final CharSequence getTypeLabel(Resources res, int type,
562588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    CharSequence label) {
562688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
562788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return label;
562888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                } else {
562988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    final int labelRes = getTypeLabelResource(type);
563088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return res.getText(labelRes);
563188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
563288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
5633088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
5634088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5635088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
5636dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5637dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A data kind representing a postal addresses.
5638dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5639dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5640dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
5641dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
5642dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5643dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
5644dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
5645dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5646dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
5647dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
5648dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5649dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5650dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5651dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #FORMATTED_ADDRESS}</td>
5652dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
5653dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5654dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5655dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5656dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>int</td>
5657dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #TYPE}</td>
5658dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA2}</td>
5659dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Allowed values are:
5660dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5661dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <ul>
5662dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.</li>
5663dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_HOME}</li>
5664dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_WORK}</li>
5665dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_OTHER}</li>
5666dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </ul>
5667dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5668dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
5669dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5670dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5671dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5672dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #LABEL}</td>
5673dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA3}</td>
5674dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5675dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5676dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5677dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5678dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #STREET}</td>
5679dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA4}</td>
5680dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5681dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5682dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5683dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5684dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #POBOX}</td>
5685dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA5}</td>
5686dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Post Office Box number</td>
5687dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5688dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5689dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5690dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #NEIGHBORHOOD}</td>
5691dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA6}</td>
5692dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5693dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5694dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5695dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5696dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #CITY}</td>
5697dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA7}</td>
5698dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5699dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5700dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5701dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5702dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #REGION}</td>
5703dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA8}</td>
5704dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5705dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5706dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5707dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5708dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #POSTCODE}</td>
5709dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA9}</td>
5710dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5711dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5712dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5713dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5714dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #COUNTRY}</td>
5715dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA10}</td>
5716dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5717dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5718dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
5719088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
57200dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class StructuredPostal implements DataColumnsWithJoins, CommonColumns {
572185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
572285abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
572385abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
57248a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            private StructuredPostal() {
57258a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            }
5726088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
57278a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
5728b3c49982840c05a5392d53efe97253c04fc59ef0Evan Millar            public static final String CONTENT_ITEM_TYPE =
5729b3c49982840c05a5392d53efe97253c04fc59ef0Evan Millar                    "vnd.android.cursor.item/postal-address_v2";
5730088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5731161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar            /**
5732161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             * The MIME type of {@link #CONTENT_URI} providing a directory of
5733161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             * postal addresses.
5734161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             */
5735b3c49982840c05a5392d53efe97253c04fc59ef0Evan Millar            public static final String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address_v2";
5736161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar
5737161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar            /**
5738161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             * The content:// style URI for all data records of the
57398a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * {@link StructuredPostal#CONTENT_ITEM_TYPE} MIME type.
5740161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar             */
5741161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar            public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
5742161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar                    "postals");
5743161dd86394a9733fd7ff303c31481cae7e31e7b4Evan Millar
5744088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_HOME = 1;
5745088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_WORK = 2;
5746088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_OTHER = 3;
57478a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
57488a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /**
574962b83b7fc4642b71829737494258f12996bc1baaJeff Sharkey             * The full, unstructured postal address. <i>This field must be
575062b83b7fc4642b71829737494258f12996bc1baaJeff Sharkey             * consistent with any structured data.</i>
57518a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * <p>
57528a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Type: TEXT
57538a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             */
57548a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            public static final String FORMATTED_ADDRESS = DATA;
57558a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
57568a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /**
57578a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Can be street, avenue, road, etc. This element also includes the
57588a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * house number and room/apartment/flat/floor number.
57598a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * <p>
57608a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Type: TEXT
57618a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             */
576215e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String STREET = DATA4;
57638a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
57648a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /**
57658a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Covers actual P.O. boxes, drawers, locked bags, etc. This is
57668a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * usually but not always mutually exclusive with street.
57678a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * <p>
57688a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Type: TEXT
57698a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             */
577015e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String POBOX = DATA5;
57718a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
57728a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /**
57738a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * This is used to disambiguate a street address when a city
57748a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * contains more than one street with the same name, or to specify a
57758a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * small place whose mail is routed through a larger postal town. In
57768a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * China it could be a county or a minor city.
57778a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * <p>
57788a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Type: TEXT
57798a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             */
578015e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String NEIGHBORHOOD = DATA6;
57818a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
57828a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /**
57838a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Can be city, village, town, borough, etc. This is the postal town
57848a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * and not necessarily the place of residence or place of business.
57858a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * <p>
57868a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Type: TEXT
57878a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             */
578815e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String CITY = DATA7;
57898a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
57908a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /**
57918a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * A state, province, county (in Ireland), Land (in Germany),
57928a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * departement (in France), etc.
57938a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * <p>
57948a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Type: TEXT
57958a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             */
579615e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String REGION = DATA8;
57978a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
57988a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /**
5799ef348c757d79e1751329db6746dbf846bdea6fc9Jeff Sharkey             * Postal code. Usually country-wide, but sometimes specific to the
58008a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * city (e.g. "2" in "Dublin 2, Ireland" addresses).
58018a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * <p>
58028a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Type: TEXT
58038a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             */
580415e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String POSTCODE = DATA9;
58058a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
58068a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /**
58078a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * The name or code of the country.
58088a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * <p>
58098a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * Type: TEXT
58108a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             */
581115e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String COUNTRY = DATA10;
581288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
581388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
581488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return the string resource that best describes the given
5815f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * {@link #TYPE}. Will always return a valid resource.
581688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
581788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final int getTypeLabelResource(int type) {
581888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                switch (type) {
581988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_HOME: return com.android.internal.R.string.postalTypeHome;
582088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_WORK: return com.android.internal.R.string.postalTypeWork;
582188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_OTHER: return com.android.internal.R.string.postalTypeOther;
582288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    default: return com.android.internal.R.string.postalTypeCustom;
582388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
582488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
582588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
582688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
582788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return a {@link CharSequence} that best describes the given type,
5828f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * possibly substituting the given {@link #LABEL} value
5829f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * for {@link #TYPE_CUSTOM}.
583088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
583188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final CharSequence getTypeLabel(Resources res, int type,
583288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    CharSequence label) {
583388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
583488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return label;
583588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                } else {
583688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    final int labelRes = getTypeLabelResource(type);
583788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return res.getText(labelRes);
583888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
583988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
5840088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
5841088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
58428851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        /**
5843dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5844dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A data kind representing an IM address
5845dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5846dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5847dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
5848dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
5849dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5850dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
5851dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
5852dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5853dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
5854dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
5855dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5856dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5857dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5858dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA}</td>
5859dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
5860dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5861dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5862dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5863dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>int</td>
5864dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #TYPE}</td>
5865dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA2}</td>
5866dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Allowed values are:
5867dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5868dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <ul>
5869dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.</li>
5870dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_HOME}</li>
5871dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_WORK}</li>
5872dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_OTHER}</li>
5873dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </ul>
5874dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5875dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
5876dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5877dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5878dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5879dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #LABEL}</td>
5880dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA3}</td>
5881dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5882dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5883dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5884dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5885dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #PROTOCOL}</td>
5886dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA5}</td>
5887dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>
5888dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
5889dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * Allowed values:
5890dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <ul>
5891dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #PROTOCOL_CUSTOM}. Also provide the actual protocol name
5892dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * as {@link #CUSTOM_PROTOCOL}.</li>
5893dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #PROTOCOL_AIM}</li>
5894dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #PROTOCOL_MSN}</li>
5895dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #PROTOCOL_YAHOO}</li>
5896dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #PROTOCOL_SKYPE}</li>
5897dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #PROTOCOL_QQ}</li>
5898dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #PROTOCOL_GOOGLE_TALK}</li>
5899dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #PROTOCOL_ICQ}</li>
5900dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #PROTOCOL_JABBER}</li>
5901dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #PROTOCOL_NETMEETING}</li>
5902dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </ul>
5903dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
5904dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
5905dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5906dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
5907dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
5908dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #CUSTOM_PROTOCOL}</td>
5909dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA6}</td>
5910dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
5911dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
5912dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
59138851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana         */
59140dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class Im implements DataColumnsWithJoins, CommonColumns {
591585abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
591685abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
591785abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
5918088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            private Im() {}
5919088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
59208a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
5921088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im";
5922088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
5923088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_HOME = 1;
5924088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_WORK = 2;
5925088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int TYPE_OTHER = 3;
5926569277732b4180c07c9f917ff8c3fc3111b10338Dmitri Plotnikov
592731f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov            /**
592831f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov             * This column should be populated with one of the defined
592931f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov             * constants, e.g. {@link #PROTOCOL_YAHOO}. If the value of this
593031f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov             * column is {@link #PROTOCOL_CUSTOM}, the {@link #CUSTOM_PROTOCOL}
593131f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov             * should contain the name of the custom protocol.
593231f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov             */
593315e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String PROTOCOL = DATA5;
5934569277732b4180c07c9f917ff8c3fc3111b10338Dmitri Plotnikov
593515e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String CUSTOM_PROTOCOL = DATA6;
5936732da9293ac39bd0f14ed61367b7e76a76df2793Jeff Sharkey
593731f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov            /*
593831f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov             * The predefined IM protocol types.
5939088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
5940732da9293ac39bd0f14ed61367b7e76a76df2793Jeff Sharkey            public static final int PROTOCOL_CUSTOM = -1;
5941088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int PROTOCOL_AIM = 0;
5942088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int PROTOCOL_MSN = 1;
5943088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int PROTOCOL_YAHOO = 2;
5944088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int PROTOCOL_SKYPE = 3;
5945088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int PROTOCOL_QQ = 4;
5946088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int PROTOCOL_GOOGLE_TALK = 5;
5947088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int PROTOCOL_ICQ = 6;
5948088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final int PROTOCOL_JABBER = 7;
59498851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int PROTOCOL_NETMEETING = 8;
595088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
595188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
595288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return the string resource that best describes the given
5953f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * {@link #TYPE}. Will always return a valid resource.
595488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
595588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final int getTypeLabelResource(int type) {
595688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                switch (type) {
595788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_HOME: return com.android.internal.R.string.imTypeHome;
595888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_WORK: return com.android.internal.R.string.imTypeWork;
595988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_OTHER: return com.android.internal.R.string.imTypeOther;
596088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    default: return com.android.internal.R.string.imTypeCustom;
596188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
596288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
596388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
596488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
596588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return a {@link CharSequence} that best describes the given type,
5966f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * possibly substituting the given {@link #LABEL} value
5967f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * for {@link #TYPE_CUSTOM}.
596888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
596988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final CharSequence getTypeLabel(Resources res, int type,
597088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    CharSequence label) {
597188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
597288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return label;
597388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                } else {
597488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    final int labelRes = getTypeLabelResource(type);
597588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return res.getText(labelRes);
597688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
597788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
597888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
597988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
598088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return the string resource that best describes the given
5981f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * {@link #PROTOCOL}. Will always return a valid resource.
598288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
598388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final int getProtocolLabelResource(int type) {
598488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                switch (type) {
598588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case PROTOCOL_AIM: return com.android.internal.R.string.imProtocolAim;
598688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case PROTOCOL_MSN: return com.android.internal.R.string.imProtocolMsn;
598788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case PROTOCOL_YAHOO: return com.android.internal.R.string.imProtocolYahoo;
598888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case PROTOCOL_SKYPE: return com.android.internal.R.string.imProtocolSkype;
598988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case PROTOCOL_QQ: return com.android.internal.R.string.imProtocolQq;
599088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case PROTOCOL_GOOGLE_TALK: return com.android.internal.R.string.imProtocolGoogleTalk;
599188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case PROTOCOL_ICQ: return com.android.internal.R.string.imProtocolIcq;
599288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case PROTOCOL_JABBER: return com.android.internal.R.string.imProtocolJabber;
599388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case PROTOCOL_NETMEETING: return com.android.internal.R.string.imProtocolNetMeeting;
599488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    default: return com.android.internal.R.string.imProtocolCustom;
599588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
599688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
599788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
599888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
599988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return a {@link CharSequence} that best describes the given
600088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * protocol, possibly substituting the given
600188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * {@link #CUSTOM_PROTOCOL} value for {@link #PROTOCOL_CUSTOM}.
600288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
600388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final CharSequence getProtocolLabel(Resources res, int type,
600488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    CharSequence label) {
600588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                if (type == PROTOCOL_CUSTOM && !TextUtils.isEmpty(label)) {
600688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return label;
600788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                } else {
600888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    final int labelRes = getProtocolLabelResource(type);
600988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return res.getText(labelRes);
601088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
601188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
6012088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
6013088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
6014088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
6015dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6016dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A data kind representing an organization.
6017dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6018dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6019dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
6020dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
6021dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6022dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
6023dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
6024dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6025dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
6026dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
6027dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6028dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6029dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6030dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #COMPANY}</td>
6031dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
6032dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6033dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6034dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6035dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>int</td>
6036dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #TYPE}</td>
6037dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA2}</td>
6038dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Allowed values are:
6039dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6040dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <ul>
6041dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.</li>
6042dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_WORK}</li>
6043dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_OTHER}</li>
6044dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </ul>
6045dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6046dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
6047dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6048dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6049dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6050dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #LABEL}</td>
6051dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA3}</td>
6052dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6053dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6054dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6055dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6056dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #TITLE}</td>
6057dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA4}</td>
6058dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6059dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6060dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6061dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6062dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DEPARTMENT}</td>
6063dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA5}</td>
6064dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6065dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6066dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6067dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6068dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #JOB_DESCRIPTION}</td>
6069dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA6}</td>
6070dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6071dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6072dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6073dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6074dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #SYMBOL}</td>
6075dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA7}</td>
6076dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6077dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6078dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6079dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6080dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #PHONETIC_NAME}</td>
6081dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA8}</td>
6082dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6083dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6084dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6085dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6086dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #OFFICE_LOCATION}</td>
6087dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA9}</td>
6088dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6089dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6090b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov         * <tr>
6091b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov         * <td>String</td>
6092b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov         * <td>PHONETIC_NAME_STYLE</td>
6093b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov         * <td>{@link #DATA10}</td>
6094b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov         * <td></td>
6095b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov         * </tr>
6096dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
6097088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
60980dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class Organization implements DataColumnsWithJoins, CommonColumns {
609985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
610085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
610185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
6102088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            private Organization() {}
6103088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
61048a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
6105088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization";
6106088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
6107761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov            public static final int TYPE_WORK = 1;
6108761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov            public static final int TYPE_OTHER = 2;
6109088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
6110088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
6111088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * The company as the user entered it.
6112088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
6113088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
6114761ef2a281a16bade5203db99e204aa303660ac4Dmitri Plotnikov            public static final String COMPANY = DATA;
6115088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
6116088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
6117088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * The position title at this company as the user entered it.
6118088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
6119088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
612015e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String TITLE = DATA4;
61218851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
61228851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            /**
61238851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * The department at this company as the user entered it.
61248851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * <P>Type: TEXT</P>
61258851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             */
612615e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String DEPARTMENT = DATA5;
61278851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
61288851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            /**
61298851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * The job description at this company as the user entered it.
61308851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * <P>Type: TEXT</P>
61318851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             */
613215e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String JOB_DESCRIPTION = DATA6;
61338851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
61348851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            /**
61358851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * The symbol of this company as the user entered it.
61368851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * <P>Type: TEXT</P>
61378851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             */
613815e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String SYMBOL = DATA7;
61398851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
61408851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            /**
61418851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * The phonetic name of this company as the user entered it.
61428851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * <P>Type: TEXT</P>
61438851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             */
614415e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String PHONETIC_NAME = DATA8;
614588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
614688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
6147ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey             * The office location of this organization.
6148ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey             * <P>Type: TEXT</P>
6149ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey             */
6150ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey            public static final String OFFICE_LOCATION = DATA9;
6151ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey
6152ff18bbf83562b8a827a37c19cdc27e520786119eJeff Sharkey            /**
6153b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov             * The alphabet used for capturing the phonetic name.
6154b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov             * See {@link ContactsContract.PhoneticNameStyle}.
6155b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov             * @hide
6156b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov             */
6157b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov            public static final String PHONETIC_NAME_STYLE = DATA10;
6158b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov
6159b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov            /**
616088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return the string resource that best describes the given
6161f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * {@link #TYPE}. Will always return a valid resource.
616288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
616388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final int getTypeLabelResource(int type) {
616488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                switch (type) {
616588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_WORK: return com.android.internal.R.string.orgTypeWork;
616688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    case TYPE_OTHER: return com.android.internal.R.string.orgTypeOther;
616788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    default: return com.android.internal.R.string.orgTypeCustom;
616888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
616988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
617088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey
617188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            /**
617288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             * Return a {@link CharSequence} that best describes the given type,
6173f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * possibly substituting the given {@link #LABEL} value
6174f852698cc3bd40c7a54317a711360bae2606cd2dJeff Hamilton             * for {@link #TYPE_CUSTOM}.
617588a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey             */
617688a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            public static final CharSequence getTypeLabel(Resources res, int type,
617788a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    CharSequence label) {
617888a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
617988a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return label;
618088a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                } else {
618188a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    final int labelRes = getTypeLabelResource(type);
618288a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                    return res.getText(labelRes);
618388a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey                }
618488a83d3f108dcf01443b241439e14eedbd9615f5Jeff Sharkey            }
61858851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        }
61868851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
61878851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        /**
6188dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6189dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A data kind representing a relation.
6190dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6191dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6192dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
6193dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
6194dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6195dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
6196dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
6197dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6198dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
6199dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
6200dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6201dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6202dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6203dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #NAME}</td>
6204dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
6205dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6206dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6207dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6208dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>int</td>
6209dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #TYPE}</td>
6210dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA2}</td>
6211dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Allowed values are:
6212dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6213dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <ul>
6214dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.</li>
6215dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_ASSISTANT}</li>
6216dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_BROTHER}</li>
6217dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CHILD}</li>
6218dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_DOMESTIC_PARTNER}</li>
6219dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_FATHER}</li>
6220dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_FRIEND}</li>
6221dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_MANAGER}</li>
6222dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_MOTHER}</li>
6223dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_PARENT}</li>
6224dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_PARTNER}</li>
6225dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_REFERRED_BY}</li>
6226dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_RELATIVE}</li>
6227dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_SISTER}</li>
6228dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_SPOUSE}</li>
6229dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </ul>
6230dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6231dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
6232dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6233dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6234dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6235dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #LABEL}</td>
6236dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA3}</td>
6237dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6238dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6239dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
62408851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana         */
62410dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class Relation implements DataColumnsWithJoins, CommonColumns {
624285abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
624385abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
624485abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
62458851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            private Relation() {}
62468851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
62478851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            /** MIME type used when storing this in data table. */
62488851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/relation";
62498851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
62508851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_ASSISTANT = 1;
62518851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_BROTHER = 2;
62528851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_CHILD = 3;
62538851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_DOMESTIC_PARTNER = 4;
62548851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_FATHER = 5;
62558851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_FRIEND = 6;
62568851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_MANAGER = 7;
62578851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_MOTHER = 8;
62588851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_PARENT = 9;
62598851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_PARTNER = 10;
62608851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_REFERRED_BY = 11;
62618851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_RELATIVE = 12;
62628851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_SISTER = 13;
62638851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_SPOUSE = 14;
62648851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
62658851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            /**
62668851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * The name of the relative as the user entered it.
62678851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * <P>Type: TEXT</P>
62688851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             */
62698851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final String NAME = DATA;
62701fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann
62711fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann            /**
62721fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann             * Return the string resource that best describes the given
62731fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann             * {@link #TYPE}. Will always return a valid resource.
62741fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann             */
62751fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann            public static final int getTypeLabelResource(int type) {
62761fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                switch (type) {
62771fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_ASSISTANT: return com.android.internal.R.string.relationTypeAssistant;
62781fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_BROTHER: return com.android.internal.R.string.relationTypeBrother;
62791fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_CHILD: return com.android.internal.R.string.relationTypeChild;
62801fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_DOMESTIC_PARTNER:
62811fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                            return com.android.internal.R.string.relationTypeDomesticPartner;
62821fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_FATHER: return com.android.internal.R.string.relationTypeFather;
62831fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_FRIEND: return com.android.internal.R.string.relationTypeFriend;
62841fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_MANAGER: return com.android.internal.R.string.relationTypeManager;
62851fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_MOTHER: return com.android.internal.R.string.relationTypeMother;
62861fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_PARENT: return com.android.internal.R.string.relationTypeParent;
62871fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_PARTNER: return com.android.internal.R.string.relationTypePartner;
62881fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_REFERRED_BY:
62891fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                            return com.android.internal.R.string.relationTypeReferredBy;
62901fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_RELATIVE: return com.android.internal.R.string.relationTypeRelative;
62911fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_SISTER: return com.android.internal.R.string.relationTypeSister;
62921fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    case TYPE_SPOUSE: return com.android.internal.R.string.relationTypeSpouse;
62931fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    default: return com.android.internal.R.string.orgTypeCustom;
62941fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                }
62951fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann            }
62961fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann
62971fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann            /**
62981fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann             * Return a {@link CharSequence} that best describes the given type,
62991fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann             * possibly substituting the given {@link #LABEL} value
63001fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann             * for {@link #TYPE_CUSTOM}.
63011fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann             */
63021fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann            public static final CharSequence getTypeLabel(Resources res, int type,
63031fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    CharSequence label) {
63041fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
63051fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    return label;
63061fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                } else {
63071fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    final int labelRes = getTypeLabelResource(type);
63081fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                    return res.getText(labelRes);
63091fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann                }
63101fb39f0ffca314d2fc597e2849decf3e4148713aDaniel Lehmann            }
63118851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        }
63128851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
63138851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana        /**
6314dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6315dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A data kind representing an event.
6316dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6317dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6318dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
6319dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
6320dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6321dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
6322dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
6323dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6324dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
6325dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
6326dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6327dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6328dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6329dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #START_DATE}</td>
6330dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
6331dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6332dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6333dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6334dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>int</td>
6335dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #TYPE}</td>
6336dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA2}</td>
6337dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Allowed values are:
6338dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6339dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <ul>
6340dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.</li>
6341dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_ANNIVERSARY}</li>
6342dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_OTHER}</li>
6343dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_BIRTHDAY}</li>
6344dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </ul>
6345dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6346dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
6347dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6348dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6349dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6350dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #LABEL}</td>
6351dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA3}</td>
6352dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6353dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6354dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
63558851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana         */
63560dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class Event implements DataColumnsWithJoins, CommonColumns {
635785abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
635885abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
635985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
63608851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            private Event() {}
63618851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
63628851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            /** MIME type used when storing this in data table. */
6363c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_event";
63648851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
63658851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_ANNIVERSARY = 1;
63668851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_OTHER = 2;
6367c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana            public static final int TYPE_BIRTHDAY = 3;
6368d4e0b5713add447bbba7d716c112f425d6888f3bDmitri Plotnikov
63698851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            /**
63708851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * The event start date as the user entered it.
63718851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             * <P>Type: TEXT</P>
63728851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana             */
63738851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final String START_DATE = DATA;
6374c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana
6375c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana            /**
6376c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana             * Return the string resource that best describes the given
6377c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana             * {@link #TYPE}. Will always return a valid resource.
6378c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana             */
6379c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana            public static int getTypeResource(Integer type) {
6380c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana                if (type == null) {
6381c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana                    return com.android.internal.R.string.eventTypeOther;
6382c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana                }
6383c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana                switch (type) {
6384c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana                    case TYPE_ANNIVERSARY:
6385c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana                        return com.android.internal.R.string.eventTypeAnniversary;
6386c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana                    case TYPE_BIRTHDAY: return com.android.internal.R.string.eventTypeBirthday;
6387c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana                    case TYPE_OTHER: return com.android.internal.R.string.eventTypeOther;
6388dd384a7453b61af8b606f8974c20431c545c3800Daniel Lehmann                    default: return com.android.internal.R.string.eventTypeCustom;
6389c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana                }
6390c868acf442a69429056a574c67a5e0187e2b9536Fred Quintana            }
6391088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
6392088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
6393088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
6394dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6395a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * A data kind representing a photo for the contact.
6396dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6397dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6398dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * Some sync adapters will choose to download photos in a separate
6399dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * pass. A common pattern is to use columns {@link ContactsContract.Data#SYNC1}
6400dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * through {@link ContactsContract.Data#SYNC4} to store temporary
6401dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * data, e.g. the image URL or ID, state of download, server-side version
6402dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * of the image.  It is allowed for the {@link #PHOTO} to be null.
6403dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6404dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6405dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
6406dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
6407dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6408dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
6409dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
6410dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6411dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
6412dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
6413dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6414dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6415a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <td>NUMBER</td>
6416a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <td>{@link #PHOTO_FILE_ID}</td>
6417a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <td>{@link #DATA14}</td>
6418a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <td>ID of the hi-res photo file.</td>
6419a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * </tr>
6420a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <tr>
6421dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>BLOB</td>
6422dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #PHOTO}</td>
6423dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA15}</td>
6424a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * <td>By convention, binary data is stored in DATA15.  The thumbnail of the
6425a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * photo is stored in this column.</td>
6426dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6427dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
6428088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
64290dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class Photo implements DataColumnsWithJoins {
643085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
643185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
643285abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
6433088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            private Photo() {}
6434088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
64358a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
6436088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo";
6437088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
6438088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
6439a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * Photo file ID for the display photo of the raw contact.
6440a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * See {@link ContactsContract.DisplayPhoto}.
6441a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * <p>
6442a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             * Type: NUMBER
6443a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro             */
6444a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            public static final String PHOTO_FILE_ID = DATA14;
6445a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
6446a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro            /**
6447facbbb37835020b767f259f0f625386b52b2ad89Dmitri Plotnikov             * Thumbnail photo of the raw contact. This is the raw bytes of an image
6448f22fc124ff7974d0b6380199f7d53e66bb7feb29Dmitri Plotnikov             * that could be inflated using {@link android.graphics.BitmapFactory}.
6449088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <p>
6450088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * Type: BLOB
6451088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
645215e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String PHOTO = DATA15;
6453088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
6454088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
6455088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        /**
6456dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6457088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         * Notes about the contact.
6458dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6459dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6460dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
6461dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
6462dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6463dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
6464dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
6465dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6466dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
6467dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
6468dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6469dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6470dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6471dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #NOTE}</td>
6472dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
6473dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6474dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6475dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
6476088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar         */
64770dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class Note implements DataColumnsWithJoins {
647885abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
647985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
648085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
6481088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            private Note() {}
6482088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
64838a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
6484088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note";
6485088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar
6486088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar            /**
6487088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * The note text.
6488088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             * <P>Type: TEXT</P>
6489088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar             */
649015e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String NOTE = DATA1;
6491088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar        }
6492569277732b4180c07c9f917ff8c3fc3111b10338Dmitri Plotnikov
6493c9260540729d731e22458ce48127ca2ffaef33eeDmitri Plotnikov        /**
6494dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6495d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana         * Group Membership.
6496dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6497dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6498dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
6499dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
6500dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6501dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
6502dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
6503dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6504dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
6505dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
6506dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6507dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6508dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>long</td>
6509dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #GROUP_ROW_ID}</td>
6510dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
6511dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6512dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6513dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6514dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6515dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #GROUP_SOURCE_ID}</td>
6516dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>none</td>
6517dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>
6518dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6519dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * The sourceid of the group that this group membership refers to.
6520dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * Exactly one of this or {@link #GROUP_ROW_ID} must be set when
6521dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * inserting a row.
6522dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6523dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6524dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * If this field is specified, the provider will first try to
6525dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * look up a group with this {@link Groups Groups.SOURCE_ID}.  If such a group
6526dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * is found, it will use the corresponding row id.  If the group is not
6527dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * found, it will create one.
6528dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
6529dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6530dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
6531ceaafa5f1f0504ec85a7d6cdf45381cf748f54aaDmitri Plotnikov         */
65320dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class GroupMembership implements DataColumnsWithJoins {
653385abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
653485abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
653585abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
6536d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana            private GroupMembership() {}
6537d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana
65388a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
6539d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana            public static final String CONTENT_ITEM_TYPE =
6540d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana                    "vnd.android.cursor.item/group_membership";
6541d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana
6542d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana            /**
6543ffc34c13fb6b420c78fbd317f21363cd97a43db9Fred Quintana             * The row id of the group that this group membership refers to. Exactly one of
6544ffc34c13fb6b420c78fbd317f21363cd97a43db9Fred Quintana             * this or {@link #GROUP_SOURCE_ID} must be set when inserting a row.
6545d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana             * <P>Type: INTEGER</P>
6546d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana             */
654715e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String GROUP_ROW_ID = DATA1;
6548d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana
6549d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana            /**
6550ffc34c13fb6b420c78fbd317f21363cd97a43db9Fred Quintana             * The sourceid of the group that this group membership refers to.  Exactly one of
6551ffc34c13fb6b420c78fbd317f21363cd97a43db9Fred Quintana             * this or {@link #GROUP_ROW_ID} must be set when inserting a row.
65528a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * <P>Type: TEXT</P>
6553d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana             */
6554ffc34c13fb6b420c78fbd317f21363cd97a43db9Fred Quintana            public static final String GROUP_SOURCE_ID = "group_sourceid";
6555d8dfeb5ee82d679f491cd20e776907a69fb4f27cFred Quintana        }
6556435e427d6930f8610191071656dc26528000620bFred Quintana
6557b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
6558dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6559dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * A data kind representing a website related to the contact.
6560dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6561dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6562dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * You can use all columns defined for {@link ContactsContract.Data} as
6563dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * well as the following aliases.
6564dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6565dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <h2>Column aliases</h2>
6566dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <table class="jd-sumtable">
6567dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6568dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Type</th>
6569dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <th>Alias</th><th colspan='2'>Data column</th>
6570dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6571dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6572dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6573dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #URL}</td>
6574dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA1}</td>
6575dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6576dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6577dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6578dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>int</td>
6579dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #TYPE}</td>
6580dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA2}</td>
6581dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>Allowed values are:
6582dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <p>
6583dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <ul>
6584dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.</li>
6585dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_HOMEPAGE}</li>
6586dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_BLOG}</li>
6587dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_PROFILE}</li>
6588dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_HOME}</li>
6589dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_WORK}</li>
6590dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_FTP}</li>
6591dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <li>{@link #TYPE_OTHER}</li>
6592dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </ul>
6593dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </p>
6594dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </td>
6595dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6596dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <tr>
6597dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>String</td>
6598dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #LABEL}</td>
6599dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td>{@link #DATA3}</td>
6600dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * <td></td>
6601dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </tr>
6602dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * </table>
6603b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
66040dc9841821fda472eaeb1aeea80aded0dbbfe687Dmitri Plotnikov        public static final class Website implements DataColumnsWithJoins, CommonColumns {
660585abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton            /**
660685abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             * This utility class cannot be instantiated
660785abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton             */
66088a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            private Website() {}
6609b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
66108a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /** MIME type used when storing this in data table. */
66118a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website";
66128a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
66138851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_HOMEPAGE = 1;
66148851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_BLOG = 2;
66158851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_PROFILE = 3;
66168851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_HOME = 4;
66178851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_WORK = 5;
66188851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_FTP = 6;
66198851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana            public static final int TYPE_OTHER = 7;
66208851e163fc5bc17d139bf29cd2ec2f3926d342bcFred Quintana
66218a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey            /**
66228a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * The website URL string.
66238a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             * <P>Type: TEXT</P>
66248a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey             */
662515e2669fcd8407519e9bb9609e6d8663c84734e6Dmitri Plotnikov            public static final String URL = DATA;
66268a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        }
6627846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown
6628846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown        /**
6629846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <p>
6630846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * A data kind representing a SIP address for the contact.
6631846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * </p>
6632846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <p>
6633846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * You can use all columns defined for {@link ContactsContract.Data} as
6634846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * well as the following aliases.
6635846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * </p>
6636846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <h2>Column aliases</h2>
6637846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <table class="jd-sumtable">
6638846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <tr>
6639846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <th>Type</th>
6640846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <th>Alias</th><th colspan='2'>Data column</th>
6641846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * </tr>
6642846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <tr>
6643846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <td>String</td>
6644846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <td>{@link #SIP_ADDRESS}</td>
6645846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <td>{@link #DATA1}</td>
6646846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * <td></td>
6647846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * </tr>
6648747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <tr>
6649747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <td>int</td>
6650747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <td>{@link #TYPE}</td>
6651747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <td>{@link #DATA2}</td>
6652747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <td>Allowed values are:
6653747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <p>
6654747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <ul>
6655747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <li>{@link #TYPE_CUSTOM}. Put the actual type in {@link #LABEL}.</li>
6656747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <li>{@link #TYPE_HOME}</li>
6657747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <li>{@link #TYPE_WORK}</li>
6658747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <li>{@link #TYPE_OTHER}</li>
6659747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * </ul>
6660747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * </p>
6661747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * </td>
6662747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * </tr>
6663747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <tr>
6664747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <td>String</td>
6665747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <td>{@link #LABEL}</td>
6666747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <td>{@link #DATA3}</td>
6667747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * <td></td>
6668747c61535281b4d2958e293e83245a19ba58f6a0David Brown         * </tr>
6669846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         * </table>
6670846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown         */
6671747c61535281b4d2958e293e83245a19ba58f6a0David Brown        public static final class SipAddress implements DataColumnsWithJoins, CommonColumns {
6672846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown            /**
6673846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown             * This utility class cannot be instantiated
6674846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown             */
6675846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown            private SipAddress() {}
6676846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown
6677846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown            /** MIME type used when storing this in data table. */
6678846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/sip_address";
6679846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown
6680747c61535281b4d2958e293e83245a19ba58f6a0David Brown            public static final int TYPE_HOME = 1;
6681747c61535281b4d2958e293e83245a19ba58f6a0David Brown            public static final int TYPE_WORK = 2;
6682747c61535281b4d2958e293e83245a19ba58f6a0David Brown            public static final int TYPE_OTHER = 3;
6683747c61535281b4d2958e293e83245a19ba58f6a0David Brown
6684846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown            /**
6685846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown             * The SIP address.
6686846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown             * <P>Type: TEXT</P>
6687846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown             */
6688846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown            public static final String SIP_ADDRESS = DATA1;
6689747c61535281b4d2958e293e83245a19ba58f6a0David Brown            // ...and TYPE and LABEL come from the CommonColumns interface.
6690747c61535281b4d2958e293e83245a19ba58f6a0David Brown
6691747c61535281b4d2958e293e83245a19ba58f6a0David Brown            /**
6692747c61535281b4d2958e293e83245a19ba58f6a0David Brown             * Return the string resource that best describes the given
6693747c61535281b4d2958e293e83245a19ba58f6a0David Brown             * {@link #TYPE}. Will always return a valid resource.
6694747c61535281b4d2958e293e83245a19ba58f6a0David Brown             */
6695747c61535281b4d2958e293e83245a19ba58f6a0David Brown            public static final int getTypeLabelResource(int type) {
6696747c61535281b4d2958e293e83245a19ba58f6a0David Brown                switch (type) {
6697747c61535281b4d2958e293e83245a19ba58f6a0David Brown                    case TYPE_HOME: return com.android.internal.R.string.sipAddressTypeHome;
6698747c61535281b4d2958e293e83245a19ba58f6a0David Brown                    case TYPE_WORK: return com.android.internal.R.string.sipAddressTypeWork;
6699747c61535281b4d2958e293e83245a19ba58f6a0David Brown                    case TYPE_OTHER: return com.android.internal.R.string.sipAddressTypeOther;
6700747c61535281b4d2958e293e83245a19ba58f6a0David Brown                    default: return com.android.internal.R.string.sipAddressTypeCustom;
6701747c61535281b4d2958e293e83245a19ba58f6a0David Brown                }
6702747c61535281b4d2958e293e83245a19ba58f6a0David Brown            }
6703747c61535281b4d2958e293e83245a19ba58f6a0David Brown
6704747c61535281b4d2958e293e83245a19ba58f6a0David Brown            /**
6705747c61535281b4d2958e293e83245a19ba58f6a0David Brown             * Return a {@link CharSequence} that best describes the given type,
6706747c61535281b4d2958e293e83245a19ba58f6a0David Brown             * possibly substituting the given {@link #LABEL} value
6707747c61535281b4d2958e293e83245a19ba58f6a0David Brown             * for {@link #TYPE_CUSTOM}.
6708747c61535281b4d2958e293e83245a19ba58f6a0David Brown             */
6709747c61535281b4d2958e293e83245a19ba58f6a0David Brown            public static final CharSequence getTypeLabel(Resources res, int type,
6710747c61535281b4d2958e293e83245a19ba58f6a0David Brown                    CharSequence label) {
6711747c61535281b4d2958e293e83245a19ba58f6a0David Brown                if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
6712747c61535281b4d2958e293e83245a19ba58f6a0David Brown                    return label;
6713747c61535281b4d2958e293e83245a19ba58f6a0David Brown                } else {
6714747c61535281b4d2958e293e83245a19ba58f6a0David Brown                    final int labelRes = getTypeLabelResource(type);
6715747c61535281b4d2958e293e83245a19ba58f6a0David Brown                    return res.getText(labelRes);
6716747c61535281b4d2958e293e83245a19ba58f6a0David Brown                }
6717747c61535281b4d2958e293e83245a19ba58f6a0David Brown            }
6718846eb30f78a9153102c743c2c1b49de1a4079fb1David Brown        }
67194923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana
67204923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana        /**
67214923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana         * A data kind representing an Identity related to the contact.
67224923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana         * <p>
67234923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana         * This can be used as a signal by the aggregator to combine raw contacts into
67244923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana         * contacts, e.g. if two contacts have Identity rows with
67254923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana         * the same NAMESPACE and IDENTITY values the aggregator can know that they refer
67264923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana         * to the same person.
67274923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana         * </p>
67284923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana         */
67294923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana        public static final class Identity implements DataColumnsWithJoins {
67304923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana            /**
67314923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana             * This utility class cannot be instantiated
67324923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana             */
67334923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana            private Identity() {}
67344923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana
67354923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana            /** MIME type used when storing this in data table. */
67364923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana            public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/identity";
67374923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana
67384923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana            /**
67394923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana             * The identity string.
67404923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana             * <P>Type: TEXT</P>
67414923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana             */
67424923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana            public static final String IDENTITY = DataColumns.DATA1;
67434923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana
67444923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana            /**
67454923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana             * The namespace of the identity string, e.g. "com.google"
67464923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana             * <P>Type: TEXT</P>
67474923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana             */
67484923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana            public static final String NAMESPACE = DataColumns.DATA2;
67494923f1d0d9d45b201dc637be1035b33b6a3c2611Fred Quintana        }
67508a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey    }
6751b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
6752dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov    /**
6753dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see Groups
6754dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     */
67556e144ad885f6cc3f090616a7ad4911d093049ad1Dmitri Plotnikov    protected interface GroupsColumns {
6756b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
6757d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * The data set within the account that this group belongs to.  This allows
6758d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * multiple sync adapters for the same account type to distinguish between
6759d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * each others' group data.
6760d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         *
6761d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * This is empty by default, and is completely optional.  It only needs to
6762d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * be populated if multiple sync adapters are entering distinct group data
6763d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * for the same account type and account name.
6764d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         * <P>Type: TEXT</P>
6765d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro         */
6766d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro        public static final String DATA_SET = "data_set";
6767d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro
6768d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro        /**
67691d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * A concatenation of the account type and data set (delimited by a forward
67701d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * slash) - if the data set is empty, this will be the same as the account
67711d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * type.  For applications that need to be aware of the data set, this can
67721d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * be used instead of account type to distinguish sets of data.  This is
67731d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * never intended to be used for specifying accounts.
67741d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         * @hide
67751d55c3343d6eb89176fb057233942887466c1b68Dave Santoro         */
67761d55c3343d6eb89176fb057233942887466c1b68Dave Santoro        public static final String ACCOUNT_TYPE_AND_DATA_SET = "account_type_and_data_set";
67771d55c3343d6eb89176fb057233942887466c1b68Dave Santoro
67781d55c3343d6eb89176fb057233942887466c1b68Dave Santoro        /**
6779b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * The display title of this group.
6780b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * <p>
6781b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * Type: TEXT
6782b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
6783b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        public static final String TITLE = "title";
6784b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
6785b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
67868a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * The package name to use when creating {@link Resources} objects for
67878a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * this group. This value is only designed for use when building user
67888a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * interfaces, and should not be used to infer the owner.
678985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
679085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide
67918a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         */
67928a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        public static final String RES_PACKAGE = "res_package";
67938a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey
67948a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        /**
6795b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * The display title of this group to load as a resource from
67968a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * {@link #RES_PACKAGE}, which may be localized.
67978a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey         * <P>Type: TEXT</P>
679885abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
679985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide
6800b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
68018a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        public static final String TITLE_RES = "title_res";
6802b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
6803b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
680402c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov         * Notes about the group.
680502c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov         * <p>
680602c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov         * Type: TEXT
680702c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov         */
680802c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov        public static final String NOTES = "notes";
680902c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov
681002c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov        /**
681102c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov         * The ID of this group if it is a System Group, i.e. a group that has a special meaning
681202c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov         * to the sync adapter, null otherwise.
681302c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov         * <P>Type: TEXT</P>
681402c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov         */
681502c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov        public static final String SYSTEM_ID = "system_id";
681602c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov
681702c5b45565fd3a933b5dd5a868b7db33455d697cDmitri Plotnikov        /**
68187cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * The total number of {@link Contacts} that have
681931f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * {@link CommonDataKinds.GroupMembership} in this group. Read-only value that is only
6820b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * present when querying {@link Groups#CONTENT_SUMMARY_URI}.
6821b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * <p>
6822b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * Type: INTEGER
6823b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
6824b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        public static final String SUMMARY_COUNT = "summ_count";
6825b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
6826b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
682715dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * A boolean query parameter that can be used with {@link Groups#CONTENT_SUMMARY_URI}.
682815dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * It will additionally return {@link #SUMMARY_GROUP_COUNT_PER_ACCOUNT}.
682915dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         *
683015dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * @hide
683115dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         */
683215dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa        public static final String PARAM_RETURN_GROUP_COUNT_PER_ACCOUNT =
683315dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa                "return_group_count_per_account";
683415dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa
683515dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa        /**
683615dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * The total number of groups of the account that a group belongs to.
683715dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * This column is available only when the parameter
683815dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * {@link #PARAM_RETURN_GROUP_COUNT_PER_ACCOUNT} is specified in
683915dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * {@link Groups#CONTENT_SUMMARY_URI}.
684015dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         *
684115dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * For example, when the account "A" has two groups "group1" and "group2", and the account
684215dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * "B" has a group "group3", the rows for "group1" and "group2" return "2" and the row for
684315dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * "group3" returns "1" for this column.
684415dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         *
684515dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * Note: This counts only non-favorites, non-auto-add, and not deleted groups.
684615dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         *
684715dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * Type: INTEGER
684815dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         * @hide
684915dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa         */
685015dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa        public static final String SUMMARY_GROUP_COUNT_PER_ACCOUNT = "group_count_per_account";
685115dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa
685215dec3967efcff339fb14a84b85320ba85ed47f0Daisuke Miyakawa        /**
68537cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * The total number of {@link Contacts} that have both
685431f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * {@link CommonDataKinds.GroupMembership} in this group, and also have phone numbers.
6855b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * Read-only value that is only present when querying
6856b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * {@link Groups#CONTENT_SUMMARY_URI}.
6857b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * <p>
6858b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * Type: INTEGER
6859b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
6860b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        public static final String SUMMARY_WITH_PHONES = "summ_phones";
6861b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
6862b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
6863b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * Flag indicating if the contacts belonging to this group should be
6864b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * visible in any user interface.
6865b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * <p>
68667b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * Type: INTEGER (boolean)
6867b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
6868b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        public static final String GROUP_VISIBLE = "group_visible";
686900c89f6266d1b559538b00000efeb905e00161cdFred Quintana
687000c89f6266d1b559538b00000efeb905e00161cdFred Quintana        /**
687100c89f6266d1b559538b00000efeb905e00161cdFred Quintana         * The "deleted" flag: "0" by default, "1" if the row has been marked
687200c89f6266d1b559538b00000efeb905e00161cdFred Quintana         * for deletion. When {@link android.content.ContentResolver#delete} is
6873dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * called on a group, it is marked for deletion. The sync adaptor
6874dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * deletes the group on the server and then calls ContactResolver.delete
6875dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * once more, this time setting the the
6876dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * {@link ContactsContract#CALLER_IS_SYNCADAPTER} query parameter to
6877dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * finalize the data removal.
687800c89f6266d1b559538b00000efeb905e00161cdFred Quintana         * <P>Type: INTEGER</P>
687900c89f6266d1b559538b00000efeb905e00161cdFred Quintana         */
688000c89f6266d1b559538b00000efeb905e00161cdFred Quintana        public static final String DELETED = "deleted";
6881403d7ac7d14e87ecc7df25a1fbb79649ec5ada90Jeff Sharkey
6882403d7ac7d14e87ecc7df25a1fbb79649ec5ada90Jeff Sharkey        /**
6883403d7ac7d14e87ecc7df25a1fbb79649ec5ada90Jeff Sharkey         * Whether this group should be synced if the SYNC_EVERYTHING settings
6884403d7ac7d14e87ecc7df25a1fbb79649ec5ada90Jeff Sharkey         * is false for this group's account.
6885403d7ac7d14e87ecc7df25a1fbb79649ec5ada90Jeff Sharkey         * <p>
6886403d7ac7d14e87ecc7df25a1fbb79649ec5ada90Jeff Sharkey         * Type: INTEGER (boolean)
6887403d7ac7d14e87ecc7df25a1fbb79649ec5ada90Jeff Sharkey         */
6888403d7ac7d14e87ecc7df25a1fbb79649ec5ada90Jeff Sharkey        public static final String SHOULD_SYNC = "should_sync";
6889a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana
6890a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana        /**
6891a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         * Any newly created contacts will automatically be added to groups that have this
6892a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         * flag set to true.
6893a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         * <p>
6894a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         * Type: INTEGER (boolean)
6895a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         */
6896a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana        public static final String AUTO_ADD = "auto_add";
6897a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana
6898a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana        /**
6899a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         * When a contacts is marked as a favorites it will be automatically added
6900a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         * to the groups that have this flag set, and when it is removed from favorites
6901a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         * it will be removed from these groups.
6902a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         * <p>
6903a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         * Type: INTEGER (boolean)
6904a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         */
6905a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana        public static final String FAVORITES = "favorites";
69064ccf33acbc3d1af1a343af0f1e0f020b9b4eb507Dmitri Plotnikov
69074ccf33acbc3d1af1a343af0f1e0f020b9b4eb507Dmitri Plotnikov        /**
69084ccf33acbc3d1af1a343af0f1e0f020b9b4eb507Dmitri Plotnikov         * The "read-only" flag: "0" by default, "1" if the row cannot be modified or
69094ccf33acbc3d1af1a343af0f1e0f020b9b4eb507Dmitri Plotnikov         * deleted except by a sync adapter.  See {@link ContactsContract#CALLER_IS_SYNCADAPTER}.
69104ccf33acbc3d1af1a343af0f1e0f020b9b4eb507Dmitri Plotnikov         * <P>Type: INTEGER</P>
69114ccf33acbc3d1af1a343af0f1e0f020b9b4eb507Dmitri Plotnikov         */
69124ccf33acbc3d1af1a343af0f1e0f020b9b4eb507Dmitri Plotnikov        public static final String GROUP_IS_READ_ONLY = "group_is_read_only";
6913b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey    }
6914b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
6915b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey    /**
6916dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Constants for the groups table. Only per-account groups are supported.
6917dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h2>Columns</h2>
6918dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
6919dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
6920dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>Groups</th>
6921dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
6922dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
6923dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
6924dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #_ID}</td>
6925dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
6926dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Row ID. Sync adapter should try to preserve row IDs during updates.
6927dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * In other words, it would be a really bad idea to delete and reinsert a
6928dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * group. A sync adapter should always do an update instead.</td>
6929dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
6930d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     # <tr>
6931d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <td>String</td>
6932d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <td>{@link #DATA_SET}</td>
6933d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <td>read/write-once</td>
6934d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <td>
6935d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <p>
6936d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * The data set within the account that this group belongs to.  This allows
6937d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * multiple sync adapters for the same account type to distinguish between
6938d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * each others' group data.  The combination of {@link #ACCOUNT_TYPE},
6939d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * {@link #ACCOUNT_NAME}, and {@link #DATA_SET} identifies a set of data
6940d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * that is associated with a single sync adapter.
6941d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * </p>
6942d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <p>
6943d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * This is empty by default, and is completely optional.  It only needs to
6944d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * be populated if multiple sync adapters are entering distinct data for
6945d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * the same account type and account name.
6946d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * </p>
6947d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * <p>
6948d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * It should be set at the time the group is inserted and never changed
6949d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * afterwards.
6950d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * </p>
6951d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * </td>
6952d7bdc18f875c4fdd1848aa9b941109acc0f99635Dave Santoro     * </tr>
6953dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
6954dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
6955dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #TITLE}</td>
6956dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
6957dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The display title of this group.</td>
6958dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
6959dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
6960dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
6961dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #NOTES}</td>
6962dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
6963dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Notes about the group.</td>
6964dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
6965dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
6966dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
6967dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SYSTEM_ID}</td>
6968dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
6969dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The ID of this group if it is a System Group, i.e. a group that has a
6970dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * special meaning to the sync adapter, null otherwise.</td>
6971dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
6972dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
6973dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
6974dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SUMMARY_COUNT}</td>
6975dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
6976dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The total number of {@link Contacts} that have
6977dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link CommonDataKinds.GroupMembership} in this group. Read-only value
6978dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * that is only present when querying {@link Groups#CONTENT_SUMMARY_URI}.</td>
6979dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
6980dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
6981dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
6982dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SUMMARY_WITH_PHONES}</td>
6983dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
6984dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The total number of {@link Contacts} that have both
6985dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link CommonDataKinds.GroupMembership} in this group, and also have
6986dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * phone numbers. Read-only value that is only present when querying
6987dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link Groups#CONTENT_SUMMARY_URI}.</td>
6988dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
6989dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
6990dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
6991dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #GROUP_VISIBLE}</td>
6992dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
6993dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Flag indicating if the contacts belonging to this group should be
6994dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * visible in any user interface. Allowed values: 0 and 1.</td>
6995dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
6996dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
6997dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
6998dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #DELETED}</td>
6999dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
7000dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The "deleted" flag: "0" by default, "1" if the row has been marked
7001dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * for deletion. When {@link android.content.ContentResolver#delete} is
7002dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * called on a group, it is marked for deletion. The sync adaptor deletes
7003dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * the group on the server and then calls ContactResolver.delete once more,
7004dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * this time setting the the {@link ContactsContract#CALLER_IS_SYNCADAPTER}
7005dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * query parameter to finalize the data removal.</td>
7006dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7007dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7008dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
7009dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SHOULD_SYNC}</td>
7010dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
7011dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Whether this group should be synced if the SYNC_EVERYTHING settings
7012dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * is false for this group's account.</td>
7013dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7014dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
7015b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey     */
70168a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey    public static final class Groups implements BaseColumns, GroupsColumns, SyncColumns {
7017b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
7018b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * This utility class cannot be instantiated
7019b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
70208a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        private Groups() {
70218a0193e4ca1522b9a817ebd399812b6e2f1b0cdcJeff Sharkey        }
7022b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
7023b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
7024b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * The content:// style URI for this table
7025b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
7026b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "groups");
7027b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
7028b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
7029b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * The content:// style URI for this table joined with details data from
7030dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * {@link ContactsContract.Data}.
7031b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
7032b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        public static final Uri CONTENT_SUMMARY_URI = Uri.withAppendedPath(AUTHORITY_URI,
7033b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey                "groups_summary");
7034b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
7035b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
7036b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * The MIME type of a directory of groups.
7037b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
7038b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/group";
7039b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
7040b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        /**
7041b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         * The MIME type of a single group.
7042b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey         */
7043b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group";
7044328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
7045328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana        public static EntityIterator newEntityIterator(Cursor cursor) {
7046328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            return new EntityIteratorImpl(cursor);
7047328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana        }
7048328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
7049328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana        private static class EntityIteratorImpl extends CursorEntityIterator {
7050328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            public EntityIteratorImpl(Cursor cursor) {
7051328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                super(cursor);
7052328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            }
7053328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana
7054b4413fa3c6e8ce788c7a924cabacb2943946267bDmitri Plotnikov            @Override
7055328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            public Entity getEntityAndIncrementCursor(Cursor cursor) throws RemoteException {
7056328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                // we expect the cursor is already at the row we need to read from
7057328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                final ContentValues values = new ContentValues();
7058328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, values, _ID);
7059328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, ACCOUNT_NAME);
7060328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, ACCOUNT_TYPE);
7061328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, values, DIRTY);
7062328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, values, VERSION);
7063328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, SOURCE_ID);
7064328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, RES_PACKAGE);
7065328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, TITLE);
7066328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, TITLE_RES);
7067328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, values, GROUP_VISIBLE);
7068328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, SYNC1);
7069328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, SYNC2);
7070328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, SYNC3);
7071328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, SYNC4);
7072328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, SYSTEM_ID);
7073328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, values, DELETED);
7074328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, NOTES);
7075328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, SHOULD_SYNC);
7076a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, FAVORITES);
7077a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana                DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, values, AUTO_ADD);
7078328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                cursor.moveToNext();
7079328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana                return new Entity(values);
7080328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana            }
7081328c0e7986aa6bb7752ec6de3da9c999920bb55fFred Quintana        }
7082b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey    }
7083b2909eb9509092f1479ba7883dfaa1f1e7f4cc23Jeff Sharkey
7084435e427d6930f8610191071656dc26528000620bFred Quintana    /**
7085dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
7086435e427d6930f8610191071656dc26528000620bFred Quintana     * Constants for the contact aggregation exceptions table, which contains
7087dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * aggregation rules overriding those used by automatic aggregation. This
7088dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * type only supports query and update. Neither insert nor delete are
7089dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * supported.
7090dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
7091dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h2>Columns</h2>
7092dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
7093dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7094dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>AggregationExceptions</th>
7095dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7096dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7097dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
7098dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #TYPE}</td>
7099dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
7100dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The type of exception: {@link #TYPE_KEEP_TOGETHER},
7101dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #TYPE_KEEP_SEPARATE} or {@link #TYPE_AUTOMATIC}.</td>
7102dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7103dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7104dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
7105dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #RAW_CONTACT_ID1}</td>
7106dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
7107dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>A reference to the {@link RawContacts#_ID} of the raw contact that
7108dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * the rule applies to.</td>
7109dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7110dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7111dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>long</td>
7112dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #RAW_CONTACT_ID2}</td>
7113dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
7114dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>A reference to the other {@link RawContacts#_ID} of the raw contact
7115dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * that the rule applies to.</td>
7116dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7117dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
7118435e427d6930f8610191071656dc26528000620bFred Quintana     */
71190918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov    public static final class AggregationExceptions implements BaseColumns {
7120435e427d6930f8610191071656dc26528000620bFred Quintana        /**
7121435e427d6930f8610191071656dc26528000620bFred Quintana         * This utility class cannot be instantiated
7122435e427d6930f8610191071656dc26528000620bFred Quintana         */
7123435e427d6930f8610191071656dc26528000620bFred Quintana        private AggregationExceptions() {}
7124435e427d6930f8610191071656dc26528000620bFred Quintana
7125435e427d6930f8610191071656dc26528000620bFred Quintana        /**
7126435e427d6930f8610191071656dc26528000620bFred Quintana         * The content:// style URI for this table
7127435e427d6930f8610191071656dc26528000620bFred Quintana         */
7128435e427d6930f8610191071656dc26528000620bFred Quintana        public static final Uri CONTENT_URI =
7129435e427d6930f8610191071656dc26528000620bFred Quintana                Uri.withAppendedPath(AUTHORITY_URI, "aggregation_exceptions");
7130435e427d6930f8610191071656dc26528000620bFred Quintana
7131435e427d6930f8610191071656dc26528000620bFred Quintana        /**
7132435e427d6930f8610191071656dc26528000620bFred Quintana         * The MIME type of {@link #CONTENT_URI} providing a directory of data.
7133435e427d6930f8610191071656dc26528000620bFred Quintana         */
7134435e427d6930f8610191071656dc26528000620bFred Quintana        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception";
7135435e427d6930f8610191071656dc26528000620bFred Quintana
7136435e427d6930f8610191071656dc26528000620bFred Quintana        /**
71370918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov         * The MIME type of a {@link #CONTENT_URI} subdirectory of an aggregation exception
71380918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov         */
71390918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov        public static final String CONTENT_ITEM_TYPE =
71400918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov                "vnd.android.cursor.item/aggregation_exception";
71410918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov
71420918bf06881f32e6e3cf750f713b16c7d65e4012Dmitri Plotnikov        /**
714384ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov         * The type of exception: {@link #TYPE_KEEP_TOGETHER}, {@link #TYPE_KEEP_SEPARATE} or
71449d044514f7777cd42776b7c5251ea83dc4e97931Dmitri Plotnikov         * {@link #TYPE_AUTOMATIC}.
7145435e427d6930f8610191071656dc26528000620bFred Quintana         *
7146435e427d6930f8610191071656dc26528000620bFred Quintana         * <P>Type: INTEGER</P>
7147435e427d6930f8610191071656dc26528000620bFred Quintana         */
7148435e427d6930f8610191071656dc26528000620bFred Quintana        public static final String TYPE = "type";
7149435e427d6930f8610191071656dc26528000620bFred Quintana
71509d044514f7777cd42776b7c5251ea83dc4e97931Dmitri Plotnikov        /**
715184ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov         * Allows the provider to automatically decide whether the specified raw contacts should
715284ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov         * be included in the same aggregate contact or not.
71539d044514f7777cd42776b7c5251ea83dc4e97931Dmitri Plotnikov         */
71549d044514f7777cd42776b7c5251ea83dc4e97931Dmitri Plotnikov        public static final int TYPE_AUTOMATIC = 0;
71559d044514f7777cd42776b7c5251ea83dc4e97931Dmitri Plotnikov
71569d044514f7777cd42776b7c5251ea83dc4e97931Dmitri Plotnikov        /**
715784ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov         * Makes sure that the specified raw contacts are included in the same
715884ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov         * aggregate contact.
71599d044514f7777cd42776b7c5251ea83dc4e97931Dmitri Plotnikov         */
716084ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov        public static final int TYPE_KEEP_TOGETHER = 1;
716184ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov
7162435e427d6930f8610191071656dc26528000620bFred Quintana        /**
716384ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov         * Makes sure that the specified raw contacts are NOT included in the same
716484ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov         * aggregate contact.
7165435e427d6930f8610191071656dc26528000620bFred Quintana         */
716684ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov        public static final int TYPE_KEEP_SEPARATE = 2;
716784ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov
71689d044514f7777cd42776b7c5251ea83dc4e97931Dmitri Plotnikov        /**
71697cca5f83638b019cc68acfaedd533602a97486b0Dmitri Plotnikov         * A reference to the {@link RawContacts#_ID} of the raw contact that the rule applies to.
7170435e427d6930f8610191071656dc26528000620bFred Quintana         */
717184ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov        public static final String RAW_CONTACT_ID1 = "raw_contact_id1";
717284ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov
717384ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov        /**
717484ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov         * A reference to the other {@link RawContacts#_ID} of the raw contact that the rule
717584ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov         * applies to.
717684ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov         */
717784ba06586b8dc079fec476b0d39b3d71687354a0Dmitri Plotnikov        public static final String RAW_CONTACT_ID2 = "raw_contact_id2";
7178435e427d6930f8610191071656dc26528000620bFred Quintana    }
717928b68e5a59289f6947dc799b66a3b503571f876eJeff Sharkey
7180dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov    /**
7181dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * @see Settings
7182dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     */
7183fe4c8715c02a8b723c56e3e48ededa657c9ab6a6Dmitri Plotnikov    protected interface SettingsColumns {
71847b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        /**
71857b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * The name of the account instance to which this row belongs.
71867b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * <P>Type: TEXT</P>
71877b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         */
71887b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        public static final String ACCOUNT_NAME = "account_name";
71897b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey
71907b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        /**
71917b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * The type of account to which this row belongs, which when paired with
71927b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * {@link #ACCOUNT_NAME} identifies a specific account.
71937b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * <P>Type: TEXT</P>
71947b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         */
71957b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        public static final String ACCOUNT_TYPE = "account_type";
71967b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey
71977b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        /**
71987c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro         * The data set within the account that this row belongs to.  This allows
71997c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro         * multiple sync adapters for the same account type to distinguish between
72007c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro         * each others' data.
72017c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro         *
72027c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro         * This is empty by default, and is completely optional.  It only needs to
72037c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro         * be populated if multiple sync adapters are entering distinct data for
72047c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro         * the same account type and account name.
72057c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro         * <P>Type: TEXT</P>
72067c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro         */
72077c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro        public static final String DATA_SET = "data_set";
72087c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro
72097c4479f3c9dfdbfa7ee09d4f05dc054b35b87e98Dave Santoro        /**
721006a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey         * Depending on the mode defined by the sync-adapter, this flag controls
721106a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey         * the top-level sync behavior for this data source.
72127b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * <p>
72137b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * Type: INTEGER (boolean)
72147b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         */
72157b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        public static final String SHOULD_SYNC = "should_sync";
72167b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey
72177b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        /**
721831f5dd3cdc4ade58ece5b5e14365634a0a3e6a1cDmitri Plotnikov         * Flag indicating if contacts without any {@link CommonDataKinds.GroupMembership}
7219a659744041d0b74b4243fdd448a5fa302a581278Jeff Sharkey         * entries should be visible in any user interface.
72207b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * <p>
72217b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * Type: INTEGER (boolean)
72227b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         */
72237b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        public static final String UNGROUPED_VISIBLE = "ungrouped_visible";
722406a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey
722506a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey        /**
722697bda4c5ae3f77a1b450d4abc06f3cf378cc6c1dJeff Sharkey         * Read-only flag indicating if this {@link #SHOULD_SYNC} or any
722797bda4c5ae3f77a1b450d4abc06f3cf378cc6c1dJeff Sharkey         * {@link Groups#SHOULD_SYNC} under this account have been marked as
722897bda4c5ae3f77a1b450d4abc06f3cf378cc6c1dJeff Sharkey         * unsynced.
722997bda4c5ae3f77a1b450d4abc06f3cf378cc6c1dJeff Sharkey         */
723097bda4c5ae3f77a1b450d4abc06f3cf378cc6c1dJeff Sharkey        public static final String ANY_UNSYNCED = "any_unsynced";
723197bda4c5ae3f77a1b450d4abc06f3cf378cc6c1dJeff Sharkey
723297bda4c5ae3f77a1b450d4abc06f3cf378cc6c1dJeff Sharkey        /**
723306a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey         * Read-only count of {@link Contacts} from a specific source that have
7234b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov         * no {@link CommonDataKinds.GroupMembership} entries.
723506a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey         * <p>
723606a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey         * Type: INTEGER
723706a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey         */
723806a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey        public static final String UNGROUPED_COUNT = "summ_count";
723906a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey
724006a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey        /**
724106a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey         * Read-only count of {@link Contacts} from a specific source that have
7242b87d0e0e5778826cc4421aa7afa1798f232d3247Dmitri Plotnikov         * no {@link CommonDataKinds.GroupMembership} entries, and also have phone numbers.
724306a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey         * <p>
724406a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey         * Type: INTEGER
724506a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey         */
724606a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey        public static final String UNGROUPED_WITH_PHONES = "summ_phones";
72477b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey    }
72487b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey
72497b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey    /**
7250dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <p>
7251dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * Contacts-specific settings for various {@link Account}'s.
7252dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </p>
7253dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <h2>Columns</h2>
7254dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <table class="jd-sumtable">
7255dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7256dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <th colspan='4'>Settings</th>
7257dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7258dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7259dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
7260dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #ACCOUNT_NAME}</td>
7261dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write-once</td>
7262dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The name of the account instance to which this row belongs.</td>
7263dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7264dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7265dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>String</td>
7266dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #ACCOUNT_TYPE}</td>
7267dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write-once</td>
7268dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>The type of account to which this row belongs, which when paired with
7269dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link #ACCOUNT_NAME} identifies a specific account.</td>
7270dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7271dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7272dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
7273dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #SHOULD_SYNC}</td>
7274dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
7275dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Depending on the mode defined by the sync-adapter, this flag controls
7276dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * the top-level sync behavior for this data source.</td>
7277dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7278dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7279dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
7280dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #UNGROUPED_VISIBLE}</td>
7281dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read/write</td>
7282dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Flag indicating if contacts without any
7283dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link CommonDataKinds.GroupMembership} entries should be visible in any
7284dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * user interface.</td>
7285dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7286dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7287dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
7288dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #ANY_UNSYNCED}</td>
7289dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
7290dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Read-only flag indicating if this {@link #SHOULD_SYNC} or any
7291dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * {@link Groups#SHOULD_SYNC} under this account have been marked as
7292dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * unsynced.</td>
7293dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7294dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7295dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
7296dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #UNGROUPED_COUNT}</td>
7297dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
7298dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Read-only count of {@link Contacts} from a specific source that have
7299dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * no {@link CommonDataKinds.GroupMembership} entries.</td>
7300dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7301dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <tr>
7302dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>int</td>
7303dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>{@link #UNGROUPED_WITH_PHONES}</td>
7304dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>read-only</td>
7305dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * <td>Read-only count of {@link Contacts} from a specific source that have
7306dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * no {@link CommonDataKinds.GroupMembership} entries, and also have phone
7307dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * numbers.</td>
7308dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </tr>
7309dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov     * </table>
73107b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey     */
731106a0323a5439ba5c1c31f9adb70918b5bf5f61deJeff Sharkey    public static final class Settings implements SettingsColumns {
73127b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        /**
73137b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * This utility class cannot be instantiated
73147b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         */
73157b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        private Settings() {
73167b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        }
73177b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey
73187b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        /**
73197b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * The content:// style URI for this table
73207b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         */
73217b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        public static final Uri CONTENT_URI =
73227b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey                Uri.withAppendedPath(AUTHORITY_URI, "settings");
73237b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey
73247b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        /**
73257b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * The MIME-type of {@link #CONTENT_URI} providing a directory of
73267b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * settings.
73277b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         */
73287b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/setting";
73297b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey
73307b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        /**
73317b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         * The MIME-type of {@link #CONTENT_URI} providing a single setting.
73327b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey         */
73337b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/setting";
73347b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey    }
73357b6771a97b9abe821e1cc6c126990fe960278f3aJeff Sharkey
7336dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar    /**
73374a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov     * Private API for inquiring about the general status of the provider.
73384a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov     *
73394a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov     * @hide
73404a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov     */
73414a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov    public static final class ProviderStatus {
73424a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov
73434a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        /**
73444a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * Not instantiable.
73454a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         */
73464a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        private ProviderStatus() {
73474a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        }
73484a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov
73494a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        /**
73504a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * The content:// style URI for this table.  Requests to this URI can be
73514a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * performed on the UI thread because they are always unblocking.
73524a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         *
73534a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * @hide
73544a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         */
73554a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        public static final Uri CONTENT_URI =
73564a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov                Uri.withAppendedPath(AUTHORITY_URI, "provider_status");
73574a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov
73584a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        /**
73594a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * The MIME-type of {@link #CONTENT_URI} providing a directory of
73604a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * settings.
73614a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         *
73624a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * @hide
73634a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         */
73644a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/provider_status";
73654a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov
73664a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        /**
73674a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * An integer representing the current status of the provider.
73684a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         *
73694a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * @hide
73704a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         */
73714a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        public static final String STATUS = "status";
73724a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov
73734a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        /**
73744a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * Default status of the provider.
73754a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         *
73764a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * @hide
73774a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         */
73784a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        public static final int STATUS_NORMAL = 0;
73794a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov
73804a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        /**
73814a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * The status used when the provider is in the process of upgrading.  Contacts
73824a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * are temporarily unaccessible.
73834a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         *
73844a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * @hide
73854a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         */
73864a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        public static final int STATUS_UPGRADING = 1;
73874a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov
73884a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        /**
73894a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * The status used if the provider was in the process of upgrading but ran
73904a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * out of storage. The DATA1 column will contain the estimated amount of
73914a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * storage required (in bytes). Update status to STATUS_NORMAL to force
73924a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * the provider to retry the upgrade.
73934a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         *
73944a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * @hide
73954a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         */
73964a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        public static final int STATUS_UPGRADE_OUT_OF_MEMORY = 2;
73974a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov
73984a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        /**
73994a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * The status used during a locale change.
74004a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         *
74014a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * @hide
74024a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         */
74034a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        public static final int STATUS_CHANGING_LOCALE = 3;
74044a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov
74054a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        /**
740637c34861d07da49d5d706730dc7810fbe53df0caDmitri Plotnikov         * The status that indicates that there are no accounts and no contacts
740737c34861d07da49d5d706730dc7810fbe53df0caDmitri Plotnikov         * on the device.
740837c34861d07da49d5d706730dc7810fbe53df0caDmitri Plotnikov         *
740937c34861d07da49d5d706730dc7810fbe53df0caDmitri Plotnikov         * @hide
741037c34861d07da49d5d706730dc7810fbe53df0caDmitri Plotnikov         */
741137c34861d07da49d5d706730dc7810fbe53df0caDmitri Plotnikov        public static final int STATUS_NO_ACCOUNTS_NO_CONTACTS = 4;
741237c34861d07da49d5d706730dc7810fbe53df0caDmitri Plotnikov
741337c34861d07da49d5d706730dc7810fbe53df0caDmitri Plotnikov        /**
74144a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * Additional data associated with the status.
74154a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         *
74164a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         * @hide
74174a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov         */
74184a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov        public static final String DATA1 = "data1";
74194a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov    }
74204a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov
74214a8a310aae4280cd54957e75fcece592601d6625Dmitri Plotnikov    /**
7422b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * <p>
7423b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * API allowing applications to send usage information for each {@link Data} row to the
7424b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * Contacts Provider.
7425b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * </p>
7426b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * <p>
7427b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * With the feedback, Contacts Provider may return more contextually appropriate results for
7428b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * Data listing, typically supplied with
7429b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * {@link ContactsContract.Contacts#CONTENT_FILTER_URI},
7430b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * {@link ContactsContract.CommonDataKinds.Email#CONTENT_FILTER_URI},
7431b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * {@link ContactsContract.CommonDataKinds.Phone#CONTENT_FILTER_URI}, and users can benefit
7432b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * from better ranked (sorted) lists in applications that show auto-complete list.
7433b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * </p>
7434b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * <p>
7435b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * There is no guarantee for how this feedback is used, or even whether it is used at all.
7436b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * The ranking algorithm will make best efforts to use the feedback data, but the exact
7437b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * implementation, the storage data structures as well as the resulting sort order is device
7438b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * and version specific and can change over time.
7439b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * </p>
7440b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * <p>
7441b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * When updating usage information, users of this API need to use
7442b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * {@link ContentResolver#update(Uri, ContentValues, String, String[])} with a Uri constructed
7443b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * from {@link DataUsageFeedback#FEEDBACK_URI}. The Uri must contain one or more data id(s) as
7444b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * its last path. They also need to append a query parameter to the Uri, to specify the type of
7445b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * the communication, which enables the Contacts Provider to differentiate between kinds of
7446b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * interactions using the same contact data field (for example a phone number can be used to
7447b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * make phone calls or send SMS).
7448b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * </p>
7449b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * <p>
7450b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * Selection and selectionArgs are ignored and must be set to null. To get data ids,
7451b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * you may need to call {@link ContentResolver#query(Uri, String[], String, String[], String)}
7452b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * toward {@link Data#CONTENT_URI}.
7453b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * </p>
7454b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * <p>
745563b709d9c691f413b3d3d92740a6e2dc457ee32bDaisuke Miyakawa     * {@link ContentResolver#update(Uri, ContentValues, String, String[])} returns a positive
745663b709d9c691f413b3d3d92740a6e2dc457ee32bDaisuke Miyakawa     * integer when successful, and returns 0 if no contact with that id was found.
745763b709d9c691f413b3d3d92740a6e2dc457ee32bDaisuke Miyakawa     * </p>
745863b709d9c691f413b3d3d92740a6e2dc457ee32bDaisuke Miyakawa     * <p>
7459b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * Example:
7460b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * <pre>
746152e3823bd79715a7fada06f1e12d92eb2de39989Daisuke Miyakawa     * Uri uri = DataUsageFeedback.FEEDBACK_URI.buildUpon()
7462b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     *         .appendPath(TextUtils.join(",", dataIds))
746352e3823bd79715a7fada06f1e12d92eb2de39989Daisuke Miyakawa     *         .appendQueryParameter(DataUsageFeedback.USAGE_TYPE,
746452e3823bd79715a7fada06f1e12d92eb2de39989Daisuke Miyakawa     *                 DataUsageFeedback.USAGE_TYPE_CALL)
7465b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     *         .build();
746663b709d9c691f413b3d3d92740a6e2dc457ee32bDaisuke Miyakawa     * boolean successful = resolver.update(uri, new ContentValues(), null, null) > 0;
7467b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * </pre>
7468b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     * </p>
7469b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa     */
7470b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa    public static final class DataUsageFeedback {
7471b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa
7472b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa        /**
7473b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * The content:// style URI for sending usage feedback.
7474b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * Must be used with {@link ContentResolver#update(Uri, ContentValues, String, String[])}.
7475b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         */
7476b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa        public static final Uri FEEDBACK_URI =
7477b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa                Uri.withAppendedPath(Data.CONTENT_URI, "usagefeedback");
7478b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa
7479b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa        /**
7480b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * <p>
7481b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * Name for query parameter specifying the type of data usage.
7482b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * </p>
7483b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         */
748463b709d9c691f413b3d3d92740a6e2dc457ee32bDaisuke Miyakawa        public static final String USAGE_TYPE = "type";
7485b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa
7486b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa        /**
7487b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * <p>
7488b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * Type of usage for voice interaction, which includes phone call, voice chat, and
7489b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * video chat.
7490b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * </p>
7491b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         */
7492b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa        public static final String USAGE_TYPE_CALL = "call";
7493b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa
7494b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa        /**
7495b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * <p>
7496b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * Type of usage for text interaction involving longer messages, which includes email.
7497b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * </p>
7498b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         */
7499b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa        public static final String USAGE_TYPE_LONG_TEXT = "long_text";
7500b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa
7501b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa        /**
7502b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * <p>
7503b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * Type of usage for text interaction involving shorter messages, which includes SMS,
7504b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * text chat with email addresses.
7505b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         * </p>
7506b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa         */
7507b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa        public static final String USAGE_TYPE_SHORT_TEXT = "short_text";
7508b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa    }
7509b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa
7510b2b651f16df3c1e1690056728ce869259abcf75bDaisuke Miyakawa    /**
7511e3ec9977bbfbdd6659cf27c7341f4c1c826f2209Evan Millar     * Helper methods to display QuickContact dialogs that allow users to pivot on
75126449eb06acc934ba4007475680f236721181ee47Jeff Sharkey     * a specific {@link Contacts} entry.
75136449eb06acc934ba4007475680f236721181ee47Jeff Sharkey     */
7514e3ec9977bbfbdd6659cf27c7341f4c1c826f2209Evan Millar    public static final class QuickContact {
75156449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
75166449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * Action used to trigger person pivot dialog.
75176449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @hide
75186449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
75195042f7eae6baa6fa4f93248361e94eeb6894f90fEvan Millar        public static final String ACTION_QUICK_CONTACT =
75205042f7eae6baa6fa4f93248361e94eeb6894f90fEvan Millar                "com.android.contacts.action.QUICK_CONTACT";
75216449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
75226449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
75236449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * Extra used to specify pivot dialog location in screen coordinates.
7524a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey         * @deprecated Use {@link Intent#setSourceBounds(Rect)} instead.
75256449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @hide
75266449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
7527a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey        @Deprecated
75286449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        public static final String EXTRA_TARGET_RECT = "target_rect";
75296449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
75306449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
75316449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * Extra used to specify size of pivot dialog.
75326449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @hide
75336449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
75346449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        public static final String EXTRA_MODE = "mode";
75356449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
75366449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
75376449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * Extra used to indicate a list of specific MIME-types to exclude and
75386449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * not display. Stored as a {@link String} array.
75396449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @hide
75406449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
75416449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        public static final String EXTRA_EXCLUDE_MIMES = "exclude_mimes";
75426449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
75436449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
7544e3ec9977bbfbdd6659cf27c7341f4c1c826f2209Evan Millar         * Small QuickContact mode, usually presented with minimal actions.
75456449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
75466449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        public static final int MODE_SMALL = 1;
75476449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
75486449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
7549e3ec9977bbfbdd6659cf27c7341f4c1c826f2209Evan Millar         * Medium QuickContact mode, includes actions and light summary describing
75506449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * the {@link Contacts} entry being shown. This may include social
75516449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * status and presence details.
75526449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
75536449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        public static final int MODE_MEDIUM = 2;
75546449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
75556449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
7556e3ec9977bbfbdd6659cf27c7341f4c1c826f2209Evan Millar         * Large QuickContact mode, includes actions and larger, card-like summary
75576449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * of the {@link Contacts} entry being shown. This may include detailed
75586449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * information, such as a photo.
75596449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
75606449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        public static final int MODE_LARGE = 3;
75616449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
75626449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
75636449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * Trigger a dialog that lists the various methods of interacting with
75646449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * the requested {@link Contacts} entry. This may be based on available
7565dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * {@link ContactsContract.Data} rows under that contact, and may also
7566dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * include social status and presence details.
75676449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *
75686449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @param context The parent {@link Context} that may be used as the
75696449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            parent for this dialog.
75706449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @param target Specific {@link View} from your layout that this dialog
75716449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            should be centered around. In particular, if the dialog
75726449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            has a "callout" arrow, it will be pointed and centered
75736449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            around this {@link View}.
7574772722e4b7c3ce0e478528f7bc96c0458cf2869aEvan Millar         * @param lookupUri A {@link ContactsContract.Contacts#CONTENT_LOOKUP_URI} style
75756449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            {@link Uri} that describes a specific contact to feature
75766449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            in this dialog.
75776449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @param mode Any of {@link #MODE_SMALL}, {@link #MODE_MEDIUM}, or
75786449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            {@link #MODE_LARGE}, indicating the desired dialog size,
75796449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            when supported.
75806449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @param excludeMimes Optional list of {@link Data#MIMETYPE} MIME-types
75816449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            to exclude when showing this dialog. For example, when
75826449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            already viewing the contact details card, this can be used
75836449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            to omit the details entry from the dialog.
75846449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
7585e3ec9977bbfbdd6659cf27c7341f4c1c826f2209Evan Millar        public static void showQuickContact(Context context, View target, Uri lookupUri, int mode,
75866449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                String[] excludeMimes) {
7587a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey            // Find location and bounds of target view, adjusting based on the
7588a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey            // assumed local density.
7589a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey            final float appScale = context.getResources().getCompatibilityInfo().applicationScale;
7590a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey            final int[] pos = new int[2];
7591a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey            target.getLocationOnScreen(pos);
75926449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
75936449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            final Rect rect = new Rect();
7594a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey            rect.left = (int) (pos[0] * appScale + 0.5f);
7595a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey            rect.top = (int) (pos[1] * appScale + 0.5f);
7596a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey            rect.right = (int) ((pos[0] + target.getWidth()) * appScale + 0.5f);
7597a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey            rect.bottom = (int) ((pos[1] + target.getHeight()) * appScale + 0.5f);
75986449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
75996449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            // Trigger with obtained rectangle
7600e3ec9977bbfbdd6659cf27c7341f4c1c826f2209Evan Millar            showQuickContact(context, rect, lookupUri, mode, excludeMimes);
76016449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        }
76026449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
76036449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        /**
76046449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * Trigger a dialog that lists the various methods of interacting with
76056449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * the requested {@link Contacts} entry. This may be based on available
7606dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * {@link ContactsContract.Data} rows under that contact, and may also
7607dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov         * include social status and presence details.
76086449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *
76096449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @param context The parent {@link Context} that may be used as the
76106449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            parent for this dialog.
76116449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @param target Specific {@link Rect} that this dialog should be
76126449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            centered around, in screen coordinates. In particular, if
76136449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            the dialog has a "callout" arrow, it will be pointed and
7614a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey         *            centered around this {@link Rect}. If you are running at a
7615a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey         *            non-native density, you need to manually adjust using
7616a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey         *            {@link DisplayMetrics#density} before calling.
7617223bd7af9832971075ba9fd9b0e41b7d693bd791Jeff Sharkey         * @param lookupUri A
7618223bd7af9832971075ba9fd9b0e41b7d693bd791Jeff Sharkey         *            {@link ContactsContract.Contacts#CONTENT_LOOKUP_URI} style
76196449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            {@link Uri} that describes a specific contact to feature
76206449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            in this dialog.
76216449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @param mode Any of {@link #MODE_SMALL}, {@link #MODE_MEDIUM}, or
76226449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            {@link #MODE_LARGE}, indicating the desired dialog size,
76236449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            when supported.
76246449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         * @param excludeMimes Optional list of {@link Data#MIMETYPE} MIME-types
76256449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            to exclude when showing this dialog. For example, when
76266449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            already viewing the contact details card, this can be used
76276449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         *            to omit the details entry from the dialog.
76286449eb06acc934ba4007475680f236721181ee47Jeff Sharkey         */
7629e3ec9977bbfbdd6659cf27c7341f4c1c826f2209Evan Millar        public static void showQuickContact(Context context, Rect target, Uri lookupUri, int mode,
76306449eb06acc934ba4007475680f236721181ee47Jeff Sharkey                String[] excludeMimes) {
76316449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            // Launch pivot dialog through intent for now
76325042f7eae6baa6fa4f93248361e94eeb6894f90fEvan Millar            final Intent intent = new Intent(ACTION_QUICK_CONTACT);
7633c00099ef62fc496429d0a06e580b600f61304f9cJeff Sharkey            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP
7634c00099ef62fc496429d0a06e580b600f61304f9cJeff Sharkey                    | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
7635c00099ef62fc496429d0a06e580b600f61304f9cJeff Sharkey
76366449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            intent.setData(lookupUri);
7637a503f6f7cf09c64bde708e3bcfb7103378ddfcffJeff Sharkey            intent.setSourceBounds(target);
76386449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            intent.putExtra(EXTRA_MODE, mode);
76396449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            intent.putExtra(EXTRA_EXCLUDE_MIMES, excludeMimes);
76406449eb06acc934ba4007475680f236721181ee47Jeff Sharkey            context.startActivity(intent);
76416449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        }
76426449eb06acc934ba4007475680f236721181ee47Jeff Sharkey    }
76436449eb06acc934ba4007475680f236721181ee47Jeff Sharkey
76446449eb06acc934ba4007475680f236721181ee47Jeff Sharkey    /**
7645a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * Helper class for accessing full-size photos by photo file ID.
7646a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * <p>
7647a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * Usage example:
7648a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * <dl>
7649a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * <dt>Retrieving a full-size photo by photo file ID (see
7650a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * {@link ContactsContract.ContactsColumns#PHOTO_FILE_ID})
7651a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * </dt>
7652a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * <dd>
7653a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * <pre>
7654a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * public InputStream openDisplayPhoto(long photoFileId) {
7655a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     *     Uri displayPhotoUri = ContentUris.withAppendedId(DisplayPhoto.CONTENT_URI, photoKey);
7656a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     *     try {
7657040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     *         AssetFileDescriptor fd = getContentResolver().openAssetFileDescriptor(
7658040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     *             displayPhotoUri, "r");
7659a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     *         return fd.createInputStream();
7660040e6b302cc47afbda9d8d08ac3b02c8192eccabDave Santoro     *     } catch (IOException e) {
7661a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     *         return null;
7662a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     *     }
7663a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * }
7664a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * </pre>
7665a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * </dd>
7666a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * </dl>
7667a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     * </p>
7668a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro     */
7669a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro    public static final class DisplayPhoto {
7670a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
7671a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * no public constructor since this is a utility class
7672a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
7673a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        private DisplayPhoto() {}
7674a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
7675a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
7676a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * The content:// style URI for this class, which allows access to full-size photos,
7677a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * given a key.
7678a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
7679a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "display_photo");
7680a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
7681a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
7682a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * This URI allows the caller to query for the maximum dimensions of a display photo
7683a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * or thumbnail.  Requests to this URI can be performed on the UI thread because
7684a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * they are always unblocking.
7685a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
7686a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        public static final Uri CONTENT_MAX_DIMENSIONS_URI =
7687a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro                Uri.withAppendedPath(AUTHORITY_URI, "photo_dimensions");
7688a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
7689a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
7690a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * Queries to {@link ContactsContract.DisplayPhoto#CONTENT_MAX_DIMENSIONS_URI} will
7691a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * contain this column, populated with the maximum height and width (in pixels)
7692a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * that will be stored for a display photo.  Larger photos will be down-sized to
7693a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * fit within a square of this many pixels.
7694a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
7695a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        public static final String DISPLAY_MAX_DIM = "display_max_dim";
7696a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
7697a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        /**
7698a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * Queries to {@link ContactsContract.DisplayPhoto#CONTENT_MAX_DIMENSIONS_URI} will
7699a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * contain this column, populated with the height and width (in pixels) for photo
7700a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         * thumbnails.
7701a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro         */
7702a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro        public static final String THUMBNAIL_MAX_DIM = "thumbnail_max_dim";
7703a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro    }
7704a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro
7705a528237b807236bd09f01e915f4519b3c3c430c6Dave Santoro    /**
7706dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar     * Contains helper classes used to create or manage {@link android.content.Intent Intents}
7707dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar     * that involve contacts.
7708dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar     */
7709dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar    public static final class Intents {
7710dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
7711dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * This is the intent that is fired when a search suggestion is clicked on.
7712dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
7713dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        public static final String SEARCH_SUGGESTION_CLICKED =
7714dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED";
7715dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7716dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
7717dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * This is the intent that is fired when a search suggestion for dialing a number
7718dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * is clicked on.
7719dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
7720dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED =
7721dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED";
7722dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7723dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
7724dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * This is the intent that is fired when a search suggestion for creating a contact
7725dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * is clicked on.
7726dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
7727dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED =
7728dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED";
7729dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7730dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
7731dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * Starts an Activity that lets the user pick a contact to attach an image to.
7732dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * After picking the contact it launches the image cropper in face detection mode.
7733dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
7734dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        public static final String ATTACH_IMAGE =
7735dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                "com.android.contacts.action.ATTACH_IMAGE";
7736dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7737dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
773885a01a6b4609fe6ffc14760b9fadfdad50a0b513Makoto Onuki         * This is the intent that is fired when the user clicks the "invite to the network" button
773985a01a6b4609fe6ffc14760b9fadfdad50a0b513Makoto Onuki         * on a contact.  Only sent to an activity which is explicitly registered by a contact
774085a01a6b4609fe6ffc14760b9fadfdad50a0b513Makoto Onuki         * provider which supports the "invite to the network" feature.
774185a01a6b4609fe6ffc14760b9fadfdad50a0b513Makoto Onuki         * <p>
774285a01a6b4609fe6ffc14760b9fadfdad50a0b513Makoto Onuki         * {@link Intent#getData()} contains the lookup URI for the contact.
774385a01a6b4609fe6ffc14760b9fadfdad50a0b513Makoto Onuki         */
774485a01a6b4609fe6ffc14760b9fadfdad50a0b513Makoto Onuki        public static final String INVITE_CONTACT =
774585a01a6b4609fe6ffc14760b9fadfdad50a0b513Makoto Onuki                "com.android.contacts.action.INVITE_CONTACT";
774685a01a6b4609fe6ffc14760b9fadfdad50a0b513Makoto Onuki
774785a01a6b4609fe6ffc14760b9fadfdad50a0b513Makoto Onuki        /**
7748dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * Takes as input a data URI with a mailto: or tel: scheme. If a single
7749dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * contact exists with the given data it will be shown. If no contact
7750dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * exists, a dialog will ask the user if they want to create a new
7751dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * contact with the provided details filled in. If multiple contacts
7752dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * share the data the user will be prompted to pick which contact they
7753dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * want to view.
7754dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * <p>
7755dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * For <code>mailto:</code> URIs, the scheme specific portion must be a
7756dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * raw email address, such as one built using
7757dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * {@link Uri#fromParts(String, String, String)}.
7758dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * <p>
7759dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * For <code>tel:</code> URIs, the scheme specific portion is compared
7760dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * to existing numbers using the standard caller ID lookup algorithm.
7761dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * The number must be properly encoded, for example using
7762dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * {@link Uri#fromParts(String, String, String)}.
7763dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * <p>
7764dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * Any extras from the {@link Insert} class will be passed along to the
7765dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * create activity if there are no contacts to show.
7766dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * <p>
7767dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * Passing true for the {@link #EXTRA_FORCE_CREATE} extra will skip
7768dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * prompting the user when the contact doesn't exist.
7769dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
7770dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        public static final String SHOW_OR_CREATE_CONTACT =
7771dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                "com.android.contacts.action.SHOW_OR_CREATE_CONTACT";
7772dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7773dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
7774fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * Starts an Activity that lets the user select the multiple phones from a
7775fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * list of phone numbers which come from the contacts or
7776fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * {@link #EXTRA_PHONE_URIS}.
7777fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * <p>
7778fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * The phone numbers being passed in through {@link #EXTRA_PHONE_URIS}
7779fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * could belong to the contacts or not, and will be selected by default.
7780fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * <p>
7781fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * The user's selection will be returned from
7782fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * {@link android.app.Activity#onActivityResult(int, int, android.content.Intent)}
7783a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         * if the resultCode is
7784fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * {@link android.app.Activity#RESULT_OK}, the array of picked phone
7785fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * numbers are in the Intent's
7786fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * {@link #EXTRA_PHONE_URIS}; otherwise, the
7787fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * {@link android.app.Activity#RESULT_CANCELED} is returned if the user
7788fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * left the Activity without changing the selection.
7789fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         *
7790fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * @hide
7791fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         */
7792fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao        public static final String ACTION_GET_MULTIPLE_PHONES =
7793fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao                "com.android.contacts.action.GET_MULTIPLE_PHONES";
7794fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao
7795fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao        /**
7796dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * Used with {@link #SHOW_OR_CREATE_CONTACT} to force creating a new
7797dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * contact if no matching contact found. Otherwise, default behavior is
7798dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * to prompt user with dialog before creating.
7799dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * <p>
7800dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * Type: BOOLEAN
7801dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
7802dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        public static final String EXTRA_FORCE_CREATE =
7803dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                "com.android.contacts.action.FORCE_CREATE";
7804dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7805dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
7806dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * Used with {@link #SHOW_OR_CREATE_CONTACT} to specify an exact
7807dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * description to be shown when prompting user about creating a new
7808dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * contact.
7809dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * <p>
7810dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * Type: STRING
7811dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
7812dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        public static final String EXTRA_CREATE_DESCRIPTION =
7813dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            "com.android.contacts.action.CREATE_DESCRIPTION";
7814dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7815dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
7816fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * Used with {@link #ACTION_GET_MULTIPLE_PHONES} as the input or output value.
7817fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * <p>
7818fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * The phone numbers want to be picked by default should be passed in as
7819fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * input value. These phone numbers could belong to the contacts or not.
7820fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * <p>
7821fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * The phone numbers which were picked by the user are returned as output
7822fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * value.
7823fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * <p>
7824fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * Type: array of URIs, the tel URI is used for the phone numbers which don't
7825fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * belong to any contact, the content URI is used for phone id in contacts.
7826a31a945ba6ec41f6c5278c44a545e2254f4cd034Fred Quintana         *
7827fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         * @hide
7828fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao         */
7829fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao        public static final String EXTRA_PHONE_URIS =
7830fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao            "com.android.contacts.extra.PHONE_URIS";
7831fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao
7832fc7838b45c4d38efd5835e55fcc9d5517015f274Bai Tao        /**
78331132200fa1f545a34f700d6000ded8c8c56134e4Jeff Sharkey         * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a
78341132200fa1f545a34f700d6000ded8c8c56134e4Jeff Sharkey         * dialog location using screen coordinates. When not specified, the
78351132200fa1f545a34f700d6000ded8c8c56134e4Jeff Sharkey         * dialog will be centered.
783685abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
783785abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide
78381132200fa1f545a34f700d6000ded8c8c56134e4Jeff Sharkey         */
78396449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        @Deprecated
78401132200fa1f545a34f700d6000ded8c8c56134e4Jeff Sharkey        public static final String EXTRA_TARGET_RECT = "target_rect";
78411132200fa1f545a34f700d6000ded8c8c56134e4Jeff Sharkey
78421132200fa1f545a34f700d6000ded8c8c56134e4Jeff Sharkey        /**
78436bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey         * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to specify a
78446bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey         * desired dialog style, usually a variation on size. One of
78456bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey         * {@link #MODE_SMALL}, {@link #MODE_MEDIUM}, or {@link #MODE_LARGE}.
784685abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
784785abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide
78486bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey         */
78496449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        @Deprecated
78506bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey        public static final String EXTRA_MODE = "mode";
78516bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey
78526bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey        /**
78536bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey         * Value for {@link #EXTRA_MODE} to show a small-sized dialog.
785485abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
785585abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide
78566bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey         */
78576449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        @Deprecated
78586bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey        public static final int MODE_SMALL = 1;
78596bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey
78606bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey        /**
78616bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey         * Value for {@link #EXTRA_MODE} to show a medium-sized dialog.
786285abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
786385abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide
78646bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey         */
78656449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        @Deprecated
78666bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey        public static final int MODE_MEDIUM = 2;
78676bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey
78686bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey        /**
78696bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey         * Value for {@link #EXTRA_MODE} to show a large-sized dialog.
787085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
787185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide
78726bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey         */
78736449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        @Deprecated
78746bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey        public static final int MODE_LARGE = 3;
78756bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey
78766bfe14dea21deec4c90ceea79b8f810164f88031Jeff Sharkey        /**
787784235ee923c13e58ce339c25c86f734b338a81e0Jeff Sharkey         * Optional extra used with {@link #SHOW_OR_CREATE_CONTACT} to indicate
787884235ee923c13e58ce339c25c86f734b338a81e0Jeff Sharkey         * a list of specific MIME-types to exclude and not display. Stored as a
787984235ee923c13e58ce339c25c86f734b338a81e0Jeff Sharkey         * {@link String} array.
788085abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
788185abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide
788284235ee923c13e58ce339c25c86f734b338a81e0Jeff Sharkey         */
78836449eb06acc934ba4007475680f236721181ee47Jeff Sharkey        @Deprecated
788484235ee923c13e58ce339c25c86f734b338a81e0Jeff Sharkey        public static final String EXTRA_EXCLUDE_MIMES = "exclude_mimes";
788584235ee923c13e58ce339c25c86f734b338a81e0Jeff Sharkey
788684235ee923c13e58ce339c25c86f734b338a81e0Jeff Sharkey        /**
7887dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * Intents related to the Contacts app UI.
788885abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         *
788985abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton         * @hide
7890dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
7891dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        public static final class UI {
7892dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7893dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The action for the default contacts list tab.
7894dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7895dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String LIST_DEFAULT =
7896dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                    "com.android.contacts.action.LIST_DEFAULT";
7897dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7898dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7899dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The action for the contacts list tab.
7900dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7901dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String LIST_GROUP_ACTION =
7902dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                    "com.android.contacts.action.LIST_GROUP";
7903dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7904dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7905dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * When in LIST_GROUP_ACTION mode, this is the group to display.
7906dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7907dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP";
7908dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7909dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7910dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The action for the all contacts list tab.
7911dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7912dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String LIST_ALL_CONTACTS_ACTION =
7913dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                    "com.android.contacts.action.LIST_ALL_CONTACTS";
7914dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7915dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7916dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The action for the contacts with phone numbers list tab.
7917dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7918dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String LIST_CONTACTS_WITH_PHONES_ACTION =
7919dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                    "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES";
7920dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7921dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7922dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The action for the starred contacts list tab.
7923dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7924dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String LIST_STARRED_ACTION =
7925dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                    "com.android.contacts.action.LIST_STARRED";
7926dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7927dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7928dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The action for the frequent contacts list tab.
7929dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7930dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String LIST_FREQUENT_ACTION =
7931dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                    "com.android.contacts.action.LIST_FREQUENT";
7932dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7933dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7934dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The action for the "strequent" contacts list tab. It first lists the starred
7935dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * contacts in alphabetical order and then the frequent contacts in descending
7936dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * order of the number of times they have been contacted.
7937dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7938dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String LIST_STREQUENT_ACTION =
7939dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar                    "com.android.contacts.action.LIST_STREQUENT";
7940dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7941dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7942dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * A key for to be used as an intent extra to set the activity
7943dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * title to a custom String value.
7944dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7945dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String TITLE_EXTRA_KEY =
794685abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton                    "com.android.contacts.extra.TITLE_EXTRA";
7947dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7948dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7949dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * Activity Action: Display a filtered list of contacts
7950dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <p>
7951dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for
7952dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * filtering
7953dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <p>
7954dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * Output: Nothing.
7955dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7956dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String FILTER_CONTACTS_ACTION =
795785abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton                    "com.android.contacts.action.FILTER_CONTACTS";
7958dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7959dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7960dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION}
7961dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * intents to supply the text on which to filter.
7962dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7963dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String FILTER_TEXT_EXTRA_KEY =
796485abdc59c3a31df6dc6ac4f20e64d5c91fa70023Jeff Hamilton                    "com.android.contacts.extra.FILTER_TEXT";
7965dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        }
7966dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7967dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        /**
7968dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * Convenience class that contains string constants used
7969dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         * to create contact {@link android.content.Intent Intents}.
7970dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar         */
7971dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        public static final class Insert {
7972dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /** The action code to use when adding a contact */
7973dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String ACTION = Intent.ACTION_INSERT;
7974dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7975dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7976dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * If present, forces a bypass of quick insert mode.
7977dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7978dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String FULL_MODE = "full_mode";
7979dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7980dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7981dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact name.
7982dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
7983dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7984dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String NAME = "name";
7985dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7986dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            // TODO add structured name values here.
7987dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7988dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7989dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact phonetic name.
7990dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
7991dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7992dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String PHONETIC_NAME = "phonetic_name";
7993dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
7994dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
7995dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact company.
7996dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
7997dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
7998dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String COMPANY = "company";
7999dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8000dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8001dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact job title.
8002dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
8003dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8004dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String JOB_TITLE = "job_title";
8005dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8006dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8007dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact notes.
8008dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
8009dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8010dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String NOTES = "notes";
8011dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8012dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8013dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact phone number.
8014dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
8015dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8016dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String PHONE = "phone";
8017dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8018dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8019dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact phone number type.
8020dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: Either an integer value from
8021dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * {@link CommonDataKinds.Phone},
8022dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             *  or a string specifying a custom label.</P>
8023dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8024dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String PHONE_TYPE = "phone_type";
8025dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8026dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8027dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the phone isprimary flag.
8028dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: boolean</P>
8029dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8030dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String PHONE_ISPRIMARY = "phone_isprimary";
8031dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8032dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8033dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for an optional second contact phone number.
8034dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
8035dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8036dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String SECONDARY_PHONE = "secondary_phone";
8037dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8038dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8039dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for an optional second contact phone number type.
8040dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: Either an integer value from
8041dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * {@link CommonDataKinds.Phone},
8042dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             *  or a string specifying a custom label.</P>
8043dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8044dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type";
8045dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8046dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8047dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for an optional third contact phone number.
8048dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
8049dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8050dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String TERTIARY_PHONE = "tertiary_phone";
8051dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8052dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8053dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for an optional third contact phone number type.
8054dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: Either an integer value from
8055dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * {@link CommonDataKinds.Phone},
8056dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             *  or a string specifying a custom label.</P>
8057dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8058dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type";
8059dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8060dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8061dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact email address.
8062dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
8063dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8064dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String EMAIL = "email";
8065dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8066dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8067dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact email type.
8068dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: Either an integer value from
8069dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * {@link CommonDataKinds.Email}
8070dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             *  or a string specifying a custom label.</P>
8071dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8072dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String EMAIL_TYPE = "email_type";
8073dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8074dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8075dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the email isprimary flag.
8076dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: boolean</P>
8077dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8078dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String EMAIL_ISPRIMARY = "email_isprimary";
8079dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8080dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8081dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for an optional second contact email address.
8082dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
8083dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8084dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String SECONDARY_EMAIL = "secondary_email";
8085dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8086dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8087dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for an optional second contact email type.
8088dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: Either an integer value from
8089dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * {@link CommonDataKinds.Email}
8090dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             *  or a string specifying a custom label.</P>
8091dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8092dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type";
8093dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8094dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8095dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for an optional third contact email address.
8096dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
8097dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8098dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String TERTIARY_EMAIL = "tertiary_email";
8099dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8100dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8101dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for an optional third contact email type.
8102dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: Either an integer value from
8103dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * {@link CommonDataKinds.Email}
8104dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             *  or a string specifying a custom label.</P>
8105dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8106dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type";
8107dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8108dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8109dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact postal address.
8110dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
8111dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8112dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String POSTAL = "postal";
8113dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8114dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8115dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the contact postal address type.
8116dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: Either an integer value from
8117dbe449e5220f4064f052532b425027f1487e9460Dmitri Plotnikov             * {@link CommonDataKinds.StructuredPostal}
8118dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             *  or a string specifying a custom label.</P>
8119dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8120dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String POSTAL_TYPE = "postal_type";
8121dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8122dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8123dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the postal isprimary flag.
8124dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: boolean</P>
8125dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8126dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String POSTAL_ISPRIMARY = "postal_isprimary";
8127dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8128dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8129dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for an IM handle.
8130dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: String</P>
8131dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8132dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String IM_HANDLE = "im_handle";
8133dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8134dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8135dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the IM protocol
8136dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8137dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String IM_PROTOCOL = "im_protocol";
8138dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar
8139dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            /**
8140dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * The extra field for the IM isprimary flag.
8141dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             * <P>Type: boolean</P>
8142dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar             */
8143dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar            public static final String IM_ISPRIMARY = "im_isprimary";
8144bb54929f76dab7d64c817df32cfbd353e1ae0be6Dmitri Plotnikov
8145bb54929f76dab7d64c817df32cfbd353e1ae0be6Dmitri Plotnikov            /**
8146bb54929f76dab7d64c817df32cfbd353e1ae0be6Dmitri Plotnikov             * The extra field that allows the client to supply multiple rows of
8147beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * arbitrary data for a single contact created using the {@link Intent#ACTION_INSERT}
8148beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * or edited using {@link Intent#ACTION_EDIT}. It is an ArrayList of
8149beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * {@link ContentValues}, one per data row. Supplying this extra is
8150beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * similar to inserting multiple rows into the {@link Data} table,
8151beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * except the user gets a chance to see and edit them before saving.
8152beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * Each ContentValues object must have a value for {@link Data#MIMETYPE}.
8153beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * If supplied values are not visible in the editor UI, they will be
8154beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * dropped.  Duplicate data will dropped.  Some fields
8155beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * like {@link CommonDataKinds.Email#TYPE Email.TYPE} may be automatically
8156beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * adjusted to comply with the constraints of the specific account type.
8157beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * For example, an Exchange contact can only have one phone numbers of type Home,
8158beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * so the contact editor may choose a different type for this phone number to
8159beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * avoid dropping the valueable part of the row, which is the phone number.
8160beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * <p>
8161beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * Example:
8162beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * <pre>
8163beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  ArrayList&lt;ContentValues&gt; data = new ArrayList&lt;ContentValues&gt;();
8164bb54929f76dab7d64c817df32cfbd353e1ae0be6Dmitri Plotnikov             *
8165beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  ContentValues row1 = new ContentValues();
8166beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  row1.put(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE);
8167beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  row1.put(Organization.COMPANY, "Android");
8168beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  data.add(row1);
8169beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *
8170beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  ContentValues row2 = new ContentValues();
8171beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  row2.put(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE);
8172beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  row2.put(Email.TYPE, Email.TYPE_CUSTOM);
8173beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  row2.put(Email.LABEL, "Green Bot");
8174beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  row2.put(Email.ADDRESS, "android@android.com");
8175beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  data.add(row2);
8176beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *
8177beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
8178beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  intent.putParcelableArrayListExtra(Insert.DATA, data);
8179beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *
8180beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             *  startActivity(intent);
8181beb2178b49e29550a4d2957cff2b602ed8517c6bDmitri Plotnikov             * </pre>
8182bb54929f76dab7d64c817df32cfbd353e1ae0be6Dmitri Plotnikov             */
8183bb54929f76dab7d64c817df32cfbd353e1ae0be6Dmitri Plotnikov            public static final String DATA = "data";
8184cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann
8185cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann            /**
8186cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann             * Used to specify the account in which to create the new contact.
8187cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann             * <p>
8188cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann             * If this value is not provided, the user is presented with a disambiguation
8189cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann             * dialog to chose an account
8190cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann             * <p>
8191cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann             * Type: {@link Account}
8192cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann             *
8193cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann             * @hide
8194cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann             */
8195cde1ac6006689294dedee5260519dbd3d34971eaDaniel Lehmann            public static final String ACCOUNT = "com.android.contacts.extra.ACCOUNT";
81961d55c3343d6eb89176fb057233942887466c1b68Dave Santoro
81971d55c3343d6eb89176fb057233942887466c1b68Dave Santoro            /**
81981d55c3343d6eb89176fb057233942887466c1b68Dave Santoro             * Used to specify the data set within the account in which to create the
81991d55c3343d6eb89176fb057233942887466c1b68Dave Santoro             * new contact.
82001d55c3343d6eb89176fb057233942887466c1b68Dave Santoro             * <p>
82011d55c3343d6eb89176fb057233942887466c1b68Dave Santoro             * This value is optional - if it is not specified, the contact will be
82021d55c3343d6eb89176fb057233942887466c1b68Dave Santoro             * created in the base account, with no data set.
82031d55c3343d6eb89176fb057233942887466c1b68Dave Santoro             * <p>
82041d55c3343d6eb89176fb057233942887466c1b68Dave Santoro             * Type: String
82051d55c3343d6eb89176fb057233942887466c1b68Dave Santoro             *
82061d55c3343d6eb89176fb057233942887466c1b68Dave Santoro             * @hide
82071d55c3343d6eb89176fb057233942887466c1b68Dave Santoro             */
82081d55c3343d6eb89176fb057233942887466c1b68Dave Santoro            public static final String DATA_SET = "com.android.contacts.extra.DATA_SET";
8209dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar        }
8210dc2da5fd922fc8de0ffcb22df3622b57ed777732Evan Millar    }
82119fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82129fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    /**
82139fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * Creates a snippet out of the given content that matches the given query.
82149fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @param content - The content to use to compute the snippet.
82159fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @param displayName - Display name for the contact - if this already contains the search
82169fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     *        content, no snippet should be shown.
82179fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @param query - String to search for in the content.
82189fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @param snippetStartMatch - Marks the start of the matching string in the snippet.
82199fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @param snippetEndMatch - Marks the end of the matching string in the snippet.
82209fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @param snippetEllipsis - Ellipsis string appended to the end of the snippet (if too long).
82219fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @param snippetMaxTokens - Maximum number of words from the snippet that will be displayed.
82229fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @return The computed snippet, or null if the snippet could not be computed or should not be
82239fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     *         shown.
82249fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     *
82259fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     *  @hide
82269fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     */
82279fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    public static String snippetize(String content, String displayName, String query,
82289fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson            char snippetStartMatch, char snippetEndMatch, String snippetEllipsis,
82299fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson            int snippetMaxTokens) {
82309fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82319fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        String lowerQuery = query != null ? query.toLowerCase() : null;
82329fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        if (TextUtils.isEmpty(content) || TextUtils.isEmpty(query) ||
82339fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                TextUtils.isEmpty(displayName) || !content.toLowerCase().contains(lowerQuery)) {
82349fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson            return null;
82359fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        }
82369fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82379fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        // If the display name already contains the query term, return empty - snippets should
82389fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        // not be needed in that case.
82399fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        String lowerDisplayName = displayName != null ? displayName.toLowerCase() : "";
82409fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        List<String> nameTokens = new ArrayList<String>();
82419fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        List<Integer> nameTokenOffsets = new ArrayList<Integer>();
82429fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        split(lowerDisplayName.trim(), nameTokens, nameTokenOffsets);
82439fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        for (String nameToken : nameTokens) {
82449fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson            if (nameToken.startsWith(lowerQuery)) {
82459fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                return null;
82469fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson            }
82479fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        }
82489fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82499fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        String[] contentLines = content.split("\n");
82509fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82519fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        // Locate the lines of the content that contain the query term.
82529fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        for (String contentLine : contentLines) {
82539fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson            if (contentLine.toLowerCase().contains(lowerQuery)) {
82549fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82559fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                // Line contains the query string - now search for it at the start of tokens.
82569fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                List<String> lineTokens = new ArrayList<String>();
82579fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                List<Integer> tokenOffsets = new ArrayList<Integer>();
82589fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                split(contentLine.trim(), lineTokens, tokenOffsets);
82599fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82609fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                // As we find matches against the query, we'll populate this list with the marked
82619fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                // (or unchanged) tokens.
82629fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                List<String> markedTokens = new ArrayList<String>();
82639fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82649fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                int firstToken = -1;
82659fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                int lastToken = -1;
82669fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                for (int i = 0; i < lineTokens.size(); i++) {
82679fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    String token = lineTokens.get(i);
82689fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    String lowerToken = token.toLowerCase();
82699fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    if (lowerToken.startsWith(lowerQuery)) {
82709fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82719fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        // Query term matched; surround the token with match markers.
82729fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        markedTokens.add(snippetStartMatch + token + snippetEndMatch);
82739fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82749fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        // If this is the first token found with a match, mark the token
82759fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        // positions to use for assembling the snippet.
82769fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        if (firstToken == -1) {
82779fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                            firstToken =
82789fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                                    Math.max(0, i - (int) Math.floor(
82799fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                                            Math.abs(snippetMaxTokens)
82809fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                                            / 2.0));
82819fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                            lastToken =
82829fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                                    Math.min(lineTokens.size(), firstToken +
82839fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                                            Math.abs(snippetMaxTokens));
82849fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        }
82859fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    } else {
82869fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        markedTokens.add(token);
82879fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    }
82889fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                }
82899fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
82909fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                // Assemble the snippet by piecing the tokens back together.
82919fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                if (firstToken > -1) {
82929fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    StringBuilder sb = new StringBuilder();
82939fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    if (firstToken > 0) {
82949fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        sb.append(snippetEllipsis);
82959fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    }
82969fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    for (int i = firstToken; i < lastToken; i++) {
82979fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        String markedToken = markedTokens.get(i);
82989fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        String originalToken = lineTokens.get(i);
82999fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        sb.append(markedToken);
83009fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        if (i < lastToken - 1) {
83019fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                            // Add the characters that appeared between this token and the next.
83029fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                            sb.append(contentLine.substring(
83039fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                                    tokenOffsets.get(i) + originalToken.length(),
83049fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                                    tokenOffsets.get(i + 1)));
83059fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        }
83069fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    }
83079fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    if (lastToken < lineTokens.size()) {
83089fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                        sb.append(snippetEllipsis);
83099fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    }
83109fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                    return sb.toString();
83119fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson                }
83129fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson            }
83139fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        }
83149fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        return null;
83159fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    }
83169fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
83179fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    /**
83189fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * Pattern for splitting a line into tokens.  This matches e-mail addresses as a single token,
83199fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * otherwise splitting on any group of non-alphanumeric characters.
83209fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     *
83219fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @hide
83229fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     */
83239fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    private static Pattern SPLIT_PATTERN =
83249fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        Pattern.compile("([\\w-\\.]+)@((?:[\\w]+\\.)+)([a-zA-Z]{2,4})|[\\w]+");
83259fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
83269fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    /**
83279fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * Helper method for splitting a string into tokens.  The lists passed in are populated with the
83289fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * tokens and offsets into the content of each token.  The tokenization function parses e-mail
83299fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * addresses as a single token; otherwise it splits on any non-alphanumeric character.
83309fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @param content Content to split.
83319fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @param tokens List of token strings to populate.
83329fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @param offsets List of offsets into the content for each token returned.
83339fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     *
83349fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     * @hide
83359fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson     */
83369fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    private static void split(String content, List<String> tokens, List<Integer> offsets) {
83379fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        Matcher matcher = SPLIT_PATTERN.matcher(content);
83389fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        while (matcher.find()) {
83399fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson            tokens.add(matcher.group());
83409fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson            offsets.add(matcher.start());
83419fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson        }
83429fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson    }
83439fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
83449fe83f0b54bc98e3e33e00ebdb0f017687395678Isaac Katzenelson
8345088b2918423ef79b92c0b0433f2f59a1fd0f7c1bEvan Millar}
8346