Home | History | Annotate | Download | only in contacts

Lines Matching defs:CONTACTS

17 package com.android.providers.contacts;
86 import android.provider.ContactsContract.Contacts;
87 import android.provider.ContactsContract.Contacts.AggregationSuggestions;
121 import com.android.providers.contacts.ContactLookupKey.LookupKeySegment;
122 import com.android.providers.contacts.ContactsDatabaseHelper.AccountsColumns;
123 import com.android.providers.contacts.ContactsDatabaseHelper.AggregatedPresenceColumns;
124 import com.android.providers.contacts.ContactsDatabaseHelper.AggregationExceptionColumns;
125 import com.android.providers.contacts.ContactsDatabaseHelper.Clauses;
126 import com.android.providers.contacts.ContactsDatabaseHelper.ContactsColumns;
127 import com.android.providers.contacts.ContactsDatabaseHelper.ContactsStatusUpdatesColumns;
128 import com.android.providers.contacts.ContactsDatabaseHelper.DataColumns;
129 import com.android.providers.contacts.ContactsDatabaseHelper.DataUsageStatColumns;
130 import com.android.providers.contacts.ContactsDatabaseHelper.DbProperties;
131 import com.android.providers.contacts.ContactsDatabaseHelper.GroupsColumns;
132 import com.android.providers.contacts.ContactsDatabaseHelper.Joins;
133 import com.android.providers.contacts.ContactsDatabaseHelper.MetadataSyncColumns;
134 import com.android.providers.contacts.ContactsDatabaseHelper.MetadataSyncStateColumns;
135 import com.android.providers.contacts.ContactsDatabaseHelper.NameLookupColumns;
136 import com.android.providers.contacts.ContactsDatabaseHelper.NameLookupType;
137 import com.android.providers.contacts.ContactsDatabaseHelper.PhoneLookupColumns;
138 import com.android.providers.contacts.ContactsDatabaseHelper.PhotoFilesColumns;
139 import com.android.providers.contacts.ContactsDatabaseHelper.PreAuthorizedUris;
140 import com.android.providers.contacts.ContactsDatabaseHelper.PresenceColumns;
141 import com.android.providers.contacts.ContactsDatabaseHelper.Projections;
142 import com.android.providers.contacts.ContactsDatabaseHelper.RawContactsColumns;
143 import com.android.providers.contacts.ContactsDatabaseHelper.SearchIndexColumns;
144 import com.android.providers.contacts.ContactsDatabaseHelper.SettingsColumns;
145 import com.android.providers.contacts.ContactsDatabaseHelper.StatusUpdatesColumns;
146 import com.android.providers.contacts.ContactsDatabaseHelper.StreamItemPhotosColumns;
147 import com.android.providers.contacts.ContactsDatabaseHelper.StreamItemsColumns;
148 import com.android.providers.contacts.ContactsDatabaseHelper.Tables;
149 import com.android.providers.contacts.ContactsDatabaseHelper.ViewGroupsColumns;
150 import com.android.providers.contacts.ContactsDatabaseHelper.Views;
151 import com.android.providers.contacts.MetadataEntryParser.AggregationData;
152 import com.android.providers.contacts.MetadataEntryParser.FieldData;
153 import com.android.providers.contacts.MetadataEntryParser.MetadataEntry;
154 import com.android.providers.contacts.MetadataEntryParser.RawContactInfo;
155 import com.android.providers.contacts.MetadataEntryParser.UsageStats;
156 import com.android.providers.contacts.SearchIndexManager.FtsQueryBuilder;
157 import com.android.providers.contacts.aggregation.AbstractContactAggregator;
158 import com.android.providers.contacts.aggregation.AbstractContactAggregator.AggregationSuggestionParameter;
159 import com.android.providers.contacts.aggregation.ContactAggregator;
160 import com.android.providers.contacts.aggregation.ContactAggregator2;
161 import com.android.providers.contacts.aggregation.ProfileAggregator;
162 import com.android.providers.contacts.aggregation.util.CommonNicknameCache;
163 import com.android.providers.contacts.database.ContactsTableUtil;
164 import com.android.providers.contacts.database.DeletedContactsTableUtil;
165 import com.android.providers.contacts.database.MoreDatabaseUtils;
166 import com.android.providers.contacts.enterprise.EnterpriseContactsCursorWrapper;
167 import com.android.providers.contacts.enterprise.EnterprisePolicyGuard;
168 import com.android.providers.contacts.util.Clock;
169 import com.android.providers.contacts.util.ContactsPermissions;
170 import com.android.providers.contacts.util.DbQueryUtils;
171 import com.android.providers.contacts.util.NeededForTesting;
172 import com.android.providers.contacts.util.UserUtils;
209 * Contacts content provider. The contract between this provider and applications
220 "UPDATE " + Tables.CONTACTS + " SET " + Contacts.RAW_TIMES_CONTACTED + "=" +
221 " ifnull(" + Contacts.RAW_TIMES_CONTACTED + ",0)+1" +
222 " WHERE " + Contacts._ID + "=?";
235 // The database tag to use for representing the contacts DB in contacts transactions.
236 /* package */ static final String CONTACTS_DB_TAG = "contacts";
238 // The database tag to use for representing the profile DB in contacts transactions.
294 private static final String AGGREGATE_CONTACTS = "sync.contacts.aggregate";
308 "debug.contacts.ksad";
314 + Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";
316 public static final int CONTACTS = 1000;
502 + "JOIN contacts ON (raw_contacts.contact_id = contacts._id)";
543 Contacts._ID + " IN "
555 /** Sql for updating DIRTY flag on multiple raw contacts */
561 /** Sql for updating METADATA_DIRTY flag on multiple raw contacts */
567 // Sql for updating MetadataSync.DELETED flag on multiple raw contacts.
568 // When using this sql, add comma separated raw contacts ids and "))".
578 /** Sql for updating VERSION on multiple raw contacts */
586 "UPDATE " + Tables.CONTACTS +
587 " SET " + Contacts.PINNED + " = " + PinnedPositions.UNPINNED +
588 " WHERE " + Contacts._ID + " = ?1 AND " + Contacts.PINNED + " <= " +
595 " WHERE " + RawContacts.CONTACT_ID + " = ?1 AND " + Contacts.PINNED + " <= " +
598 // Contacts contacted within the last 3 days (in seconds)
601 // Contacts contacted within the last 7 days (in seconds)
604 // Contacts contacted within the last 14 days (in seconds)
607 // Contacts contacted within the last 30 days (in seconds)
638 Contacts.STARRED + " DESC, "
641 + Contacts.IN_VISIBLE_GROUP + " DESC, "
642 + Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC, "
673 .add(Contacts.CUSTOM_RINGTONE)
674 Contacts.DISPLAY_NAME)
675 .add(Contacts.DISPLAY_NAME_ALTERNATIVE)
676 .add(Contacts.DISPLAY_NAME_SOURCE)
677 .add(Contacts.IN_DEFAULT_DIRECTORY)
678 .add(Contacts.IN_VISIBLE_GROUP)
679 .add(Contacts.LR_LAST_TIME_CONTACTED)
680 .add(Contacts.LOOKUP_KEY)
681 .add(Contacts.PHONETIC_NAME)
682 .add(Contacts.PHONETIC_NAME_STYLE)
683 .add(Contacts.PHOTO_ID)
684 .add(Contacts.PHOTO_FILE_ID)
685 .add(Contacts.PHOTO_URI)
686 .add(Contacts.PHOTO_THUMBNAIL_URI)
687 .add(Contacts.SEND_TO_VOICEMAIL)
688 .add(Contacts.SORT_KEY_ALTERNATIVE)
689 .add(Contacts.SORT_KEY_PRIMARY)
694 .add(Contacts.STARRED)
695 .add(Contacts.PINNED)
696 .add(Contacts.LR_TIMES_CONTACTED)
697 .add(Contacts.HAS_PHONE_NUMBER)
698 .add(Contacts.CONTACT_LAST_UPDATED_TIMESTAMP)
702 .add(Contacts.CONTACT_PRESENCE,
704 .add(Contacts.CONTACT_CHAT_CAPABILITY,
706 .add(Contacts.CONTACT_STATUS,
708 .add(Contacts.CONTACT_STATUS_TIMESTAMP,
710 .add(Contacts.CONTACT_STATUS_RES_PACKAGE,
712 .add(Contacts.CONTACT_STATUS_LABEL,
714 .add(Contacts.CONTACT_STATUS_ICON,
772 .add(Contacts.CONTACT_PRESENCE,
774 .add(Contacts.CONTACT_CHAT_CAPABILITY,
776 .add(Contacts.CONTACT_STATUS,
778 .add(Contacts.CONTACT_STATUS_TIMESTAMP,
780 .add(Contacts.CONTACT_STATUS_RES_PACKAGE,
782 .add(Contacts.CONTACT_STATUS_LABEL,
784 .add(Contacts.CONTACT_STATUS_ICON,
808 /** Contains just the contacts columns */
810 .add(Contacts._ID)
811 .add(Contacts.HAS_PHONE_NUMBER)
812 .add(Contacts.NAME_RAW_CONTACT_ID)
813 .add(Contacts.IS_USER_PROFILE)
818 /** Contains just the contacts columns */
824 /** Used for pushing starred contacts to the top of a times contacted list **/
843 * users to obtain part of Data columns. We hard-code {@link Contacts#IS_USER_PROFILE} to NULL,
857 .add(Contacts.IS_USER_PROFILE, "NULL")
860 /** Contains just the contacts vCard columns */
862 .add(Contacts._ID)
863 .add(OpenableColumns.DISPLAY_NAME, Contacts.DISPLAY_NAME + " || '.vcf'")
867 /** Contains just the raw contacts columns */
911 .add(Contacts.Entity._ID)
912 .add(Contacts.Entity.CONTACT_ID)
913 .add(Contacts.Entity.RAW_CONTACT_ID)
914 .add(Contacts.Entity.DATA_ID)
915 .add(Contacts.Entity.NAME_RAW_CONTACT_ID)
916 .add(Contacts.Entity.DELETED)
917 .add(Contacts.IS_USER_PROFILE)
977 /** Contains the data and contacts columns, for joined tables */
979 .add(PhoneLookup._ID, "contacts_view." + Contacts._ID)
980 .add(PhoneLookup.CONTACT_ID, "contacts_view." + Contacts._ID)
982 .add(PhoneLookup.LOOKUP_KEY, "contacts_view." + Contacts.LOOKUP_KEY)
983 .add(PhoneLookup.DISPLAY_NAME_SOURCE, "contacts_view." + Contacts.DISPLAY_NAME_SOURCE)
984 .add(PhoneLookup.DISPLAY_NAME, "contacts_view." + Contacts.DISPLAY_NAME)
986 "contacts_view." + Contacts.DISPLAY_NAME_ALTERNATIVE)
987 .add(PhoneLookup.PHONETIC_NAME, "contacts_view." + Contacts.PHONETIC_NAME)
988 .add(PhoneLookup.PHONETIC_NAME_STYLE, "contacts_view." + Contacts.PHONETIC_NAME_STYLE)
989 .add(PhoneLookup.SORT_KEY_PRIMARY, "contacts_view." + Contacts.SORT_KEY_PRIMARY)
990 .add(PhoneLookup.SORT_KEY_ALTERNATIVE, "contacts_view." + Contacts.SORT_KEY_ALTERNATIVE)
991 .add(PhoneLookup.LR_LAST_TIME_CONTACTED, "contacts_view." + Contacts.LR_LAST_TIME_CONTACTED)
992 .add(PhoneLookup.LR_TIMES_CONTACTED, "contacts_view." + Contacts.LR_TIMES_CONTACTED)
993 .add(PhoneLookup.STARRED, "contacts_view." + Contacts.STARRED)
994 .add(PhoneLookup.IN_DEFAULT_DIRECTORY, "contacts_view." + Contacts.IN_DEFAULT_DIRECTORY)
995 .add(PhoneLookup.IN_VISIBLE_GROUP, "contacts_view." + Contacts.IN_VISIBLE_GROUP)
996 .add(PhoneLookup.PHOTO_ID, "contacts_view." + Contacts.PHOTO_ID)
997 .add(PhoneLookup.PHOTO_FILE_ID, "contacts_view." + Contacts.PHOTO_FILE_ID)
998 .add(PhoneLookup.PHOTO_URI, "contacts_view." + Contacts.PHOTO_URI)
999 .add(PhoneLookup.PHOTO_THUMBNAIL_URI, "contacts_view." + Contacts.PHOTO_THUMBNAIL_URI)
1000 .add(PhoneLookup.CUSTOM_RINGTONE, "contacts_view." + Contacts.CUSTOM_RINGTONE)
1001 .add(PhoneLookup.HAS_PHONE_NUMBER, "contacts_view." + Contacts.HAS_PHONE_NUMBER)
1002 .add(PhoneLookup.SEND_TO_VOICEMAIL, "contacts_view." + Contacts.SEND_TO_VOICEMAIL)
1056 + " WHERE " + Contacts.HAS_PHONE_NUMBER + ")")
1105 + " WHERE " + Contacts.HAS_PHONE_NUMBER
1208 // Contacts URI matching table
1211 // DO NOT use constants such as Contacts.CONTENT_URI here. This is the only place
1214 matcher.addURI(ContactsContract.AUTHORITY, "contacts", CONTACTS);
1215 matcher.addURI(ContactsContract.AUTHORITY, "contacts/#", CONTACTS_ID);
1216 matcher.addURI(ContactsContract.AUTHORITY, "contacts/#/data", CONTACTS_ID_DATA);
1217 matcher.addURI(ContactsContract.AUTHORITY, "contacts/#/entities", CONTACTS_ID_ENTITIES);
1218 matcher.addURI(ContactsContract.AUTHORITY, "contacts/#/suggestions",
1220 matcher.addURI(ContactsContract.AUTHORITY, "contacts/#/suggestions/*",
1222 matcher.addURI(ContactsContract.AUTHORITY, "contacts/#/photo", CONTACTS_ID_PHOTO);
1223 matcher.addURI(ContactsContract.AUTHORITY, "contacts/#/display_photo",
1231 matcher.addURI(ContactsContract.AUTHORITY, "contacts/#/stream_items",
1233 matcher.addURI(ContactsContract.AUTHORITY, "contacts/filter", CONTACTS_FILTER);
1234 matcher.addURI(ContactsContract.AUTHORITY, "contacts/filter/*", CONTACTS_FILTER);
1235 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*", CONTACTS_LOOKUP);
1236 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/data", CONTACTS_LOOKUP_DATA);
1237 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/photo",
1239 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/#", CONTACTS_LOOKUP_ID);
1240 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/#/data",
1242 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/#/photo",
1244 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/display_photo",
1246 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/#/display_photo",
1248 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/entities",
1250 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/#/entities",
1252 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/stream_items",
1254 matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/#/stream_items",
1256 matcher.addURI(ContactsContract.AUTHORITY, "contacts/as_vcard/*", CONTACTS_AS_VCARD);
1257 matcher.addURI(ContactsContract.AUTHORITY, "contacts/as_multi_vcard/*",
1259 matcher.addURI(ContactsContract.AUTHORITY, "contacts/strequent/", CONTACTS_STREQUENT);
1260 matcher.addURI(ContactsContract.AUTHORITY, "contacts/strequent/filter/*",
1262 matcher.addURI(ContactsContract.AUTHORITY, "contacts/group/*", CONTACTS_GROUP);
1263 matcher.addURI(ContactsContract.AUTHORITY, "contacts/frequent", CONTACTS_FREQUENT);
1264 matcher.addURI(ContactsContract.AUTHORITY, "contacts/delete_usage", CONTACTS_DELETE_USAGE);
1266 matcher.addURI(ContactsContract.AUTHORITY, "contacts/filter_enterprise",
1268 matcher.addURI(ContactsContract.AUTHORITY, "contacts/filter_enterprise/*",
1695 // Set initial thread-local state variables for the Contacts DB.
1745 // Make sure we operate on the contacts db by default.
1770 // Update the accounts for both the contacts and profile DBs.
1823 // Clean up photo stores for both contacts and profiles.
1872 * Verifies that the contacts database is properly configured for the current locale.
1876 * a large set of contacts.
1964 // No accounts/no contacts status is true if there are no account and
1965 // there are no contacts or one profile contact
1967 boolean isContactsEmpty = DatabaseUtils.queryIsEmpty(mContactsHelper.getReadableDatabase(), Tables.CONTACTS);
1969 Tables.CONTACTS, null);
1971 // TODO: Different status if there is a profile but no contacts?
2123 * Wipes all data from the contacts database.
2137 * During initialization, this content provider will block all attempts to change contacts data.
2176 * database rather than the contacts database. This is true under either
2190 * should be directed to the profile database rather than the contacts
2231 * a contacts operation.
2376 // end it. Unlike the Contacts DB yield (which re-starts a transaction at its
2386 // Now proceed with the Contacts DB yield.
2411 Log.i(TAG, "onBeginTransaction: " + (forProfile ? "profile" : "contacts"),
2432 Log.i(TAG, "onCommitTransactionInternal: " + (forProfile ? "profile" : "contacts"),
2467 Log.i(TAG, "onRollbackTransactionInternal: " + (forProfile ? "profile" : "contacts"),
2488 Log.v(TAG, "flushTransactionalChanges: " + (inProfileMode() ? "profile" : "contacts"));
2685 case CONTACTS: {
2865 * Inserts an item in the contacts table
2871 contacts are created automatically");
2875 * Inserts a new entry into the raw-contacts table.
3279 // Favorite group, add all starred raw contacts to it.
3640 case CONTACTS: {
3682 lookupQb.appendWhere(Contacts._ID + "=? AND " + Contacts.LOOKUP_KEY + "=?");
3913 // of raw contacts.
4008 Contacts.RAW_TIMES_CONTACTED + "=0," +
4009 Contacts.RAW_LAST_TIME_CONTACTED + "=NULL");
4011 db.execSQL("UPDATE " + Tables.CONTACTS + " SET " +
4012 Contacts.RAW_TIMES_CONTACTED + "=0," +
4013 Contacts.RAW_LAST_TIME_CONTACTED + "=NULL");
4067 case CONTACTS:
4520 * Used for insert/update raw_contacts/contacts to adjust TIMES_CONTACTED and
4524 if (!cv.containsKey(Contacts.LR_LAST_TIME_CONTACTED)
4525 && !cv.containsKey(Contacts.LR_TIMES_CONTACTED)) {
4531 ret, Contacts.RAW_LAST_TIME_CONTACTED,
4532 ret, Contacts.LR_LAST_TIME_CONTACTED);
4534 ret, Contacts.RAW_TIMES_CONTACTED,
4535 ret, Contacts.LR_TIMES_CONTACTED);
4537 ret.remove(Contacts.LR_LAST_TIME_CONTACTED);
4538 ret.remove(Contacts.LR_TIMES_CONTACTED);
4772 Cursor cursor = db.query(Views.CONTACTS,
4773 new String[] { Contacts._ID }, selection, selectionArgs, null, null, null);
4796 inputValues, Contacts.CUSTOM_RINGTONE);
4799 inputValues, Contacts.SEND_TO_VOICEMAIL);
4802 inputValues, Contacts.RAW_LAST_TIME_CONTACTED);
4805 inputValues, Contacts.RAW_TIMES_CONTACTED);
4808 inputValues, Contacts.STARRED);
4811 inputValues, Contacts.PINNED);
4861 inputValues, Contacts.CUSTOM_RINGTONE);
4864 inputValues, Contacts.SEND_TO_VOICEMAIL);
4867 inputValues, Contacts.RAW_LAST_TIME_CONTACTED);
4870 inputValues, Contacts.RAW_TIMES_CONTACTED);
4873 inputValues, Contacts.STARRED);
4876 inputValues, Contacts.PINNED);
4878 values.put(Contacts.CONTACT_LAST_UPDATED_TIMESTAMP,
4881 int rslt = db.update(Tables.CONTACTS, values, Contacts._ID + "=?",
4884 if (inputValues.containsKey(Contacts.RAW_LAST_TIME_CONTACTED) &&
4885 !inputValues.containsKey(Contacts.RAW_TIMES_CONTACTED)) {
5248 // WARNING: This method can be run in either contacts mode or profile mode. It is
5250 // interact with a specific contacts or profile DB. Otherwise it is quite possible for a
5322 // Delta API is only needed for regular contacts.
5324 // Contacts are deleted by a trigger on the raw_contacts table.
5329 // contacts will be deleted in a single batch below. Contacts with
5330 // multiple raw contacts in the same account will be missed.
5332 // Find all contacts that do not have raw contacts in other accounts.
5358 // be refreshed since one of its raw contacts got removed.
5359 // Find all contacts that will not be deleted (i.e. contacts with
5360 // raw contacts in other accounts)
5393 // Find all aggregated contacts that used to contain the raw contacts
5395 // names or photos. If so, fix up those contacts.
5397 Cursor cursor = db.rawQuery("SELECT " + Contacts._ID +
5398 " FROM " + Tables.CONTACTS +
5399 " WHERE (" + Contacts.NAME_RAW_CONTACT_ID + " NOT NULL AND " +
5400 Contacts.NAME_RAW_CONTACT_ID + " NOT IN " +
5403 " OR (" + Contacts.PHOTO_ID + " NOT NULL AND " +
5404 Contacts.PHOTO_ID + " NOT IN " +
5421 // search index for the profile DB, and updating it for the contacts DB in this case
5424 // TODO Fix it. It only updates index for contacts/raw_contacts that the
5551 // Otherwise proceed with a normal query against the contacts DB.
5840 case CONTACTS: {
5850 qb.appendWhere(Contacts._ID + "=?");
5871 Contacts._ID, contactId, Contacts.LOOKUP_KEY, lookupKey,
5881 qb.appendWhere(Contacts._ID + "=?");
5901 lookupQb.appendWhere(" AND " + Data._ID + "=" + Contacts.PHOTO_ID);
5920 qb.appendWhere(" AND " + Data._ID + "=" + Contacts.PHOTO_ID);
5967 qb.setTables(Views.CONTACTS);
5971 qb.appendWhere(Contacts._ID + "=?");
6014 sb.append(Contacts._ID + " IN ");
6027 // String that will store the query for starred contacts. For phone only queries,
6028 // these will return a list of all phone numbers that belong to starred contacts.
6037 // contacts/raw_contacts to obtain actual phone numbers. One problem is that
6042 // starred contacts, and then do an outer join against the data usage table,
6046 + Contacts.STARRED + "=1)" + " AS " + Tables.DATA
6065 "(" + Contacts.STARRED + "=1",
6094 "(" + Contacts.STARRED + "=0 OR " + Contacts.STARRED + " IS NULL",
6102 // Build the first query for starred contacts
6108 DbQueryUtils.concatenateClauses(selection, Contacts.STARRED + "=1"),
6109 Contacts._ID, null, Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC",
6112 // Reset the builder, and build the second query for frequents contacts
6120 "(" + Contacts.STARRED + " =0 OR " + Contacts.STARRED + " IS NULL)"));
6126 null, Contacts._ID, HAVING, SORT_BY_DATA_USAGE, "25");
6168 groupBy = Contacts._ID;
6169 having = Contacts._ID + " IN " + Tables.DEFAULT_DIRECTORY;
6201 qb.setTables(Views.CONTACTS);
6219 qb.appendWhere(" AND " + Data._ID + "=" + Contacts.PHOTO_ID);
6248 Contacts.Entity.CONTACT_ID, contactId,
6249 Contacts.Entity.LOOKUP_KEY, lookupKey,
6259 qb.appendWhere(" AND " + Contacts.Entity.CONTACT_ID + "=?");
6340 // This only slows down the query by 14% with 10,000 contacts.
6495 initialUri = Contacts.CONTENT_FILTER_URI;
6496 contactIdString = Contacts._ID;
6537 // unless told otherwise, we'll return visible before invisible contacts
6676 // all contacts that have any data items (or name) that match the query
6680 // All contacts where the email address data1 column matches the query
6693 // All contacts where the phone number matches the query (determined by checking
6707 // All contacts where the name matches the query (determined by checking
6836 qb.appendWhere(" AND " + Data._ID + "=" + Contacts.PHOTO_ID);
6855 sortOrder = Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";
7161 if (readBooleanQueryParameter(uri, Contacts.EXTRA_ADDRESS_BOOK_INDEX, false)) {
7189 if (TextUtils.equals(sortKey, Contacts.SORT_KEY_PRIMARY)) {
7192 } else if (TextUtils.equals(sortKey, Contacts.SORT_KEY_ALTERNATIVE)) {
7291 // MergeCursor will copy all the contacts from two cursors, which may
7292 // cause OOM if there's a lot of contacts. But it's only used by
7712 sortKey = Contacts.SORT_KEY_PRIMARY;
7717 if (TextUtils.equals(sortKey, Contacts.SORT_KEY_PRIMARY)) {
7720 } else if (TextUtils.equals(sortKey, Contacts.SORT_KEY_ALTERNATIVE)) {
7810 Tables.CONTACTS, new String[] {Contacts._ID}, null, null, null, null, null, "1");
8038 * Note that this uses INNER JOIN instead of LEFT OUTER JOIN, so some of data in Contacts
8049 sb.append(Views.CONTACTS);
8051 // Just for frequently contacted contacts in Strequent URI handling.
8056 RawContacts.CONTACT_ID + "=" + Views.CONTACTS + "." + Contacts._ID) +
8060 appendContactPresenceJoin(sb, projection, Contacts._ID);
8068 * contact and joins that with other contacts tables.
8074 sb.append(Views.CONTACTS);
8085 appendContactPresenceJoin(sb, projection, Contacts._ID);
8268 // Omit results in "Other Contacts".
8270 sb.append(" ON (" + Contacts._ID + "=" + SNIPPET_CONTACT_ID + ")");
8397 appendContactPresenceJoin(sb, projection, Contacts.Entity.CONTACT_ID);
8399 appendDataPresenceJoin(sb, projection, Contacts.Entity.DATA_ID);
8400 appendDataStatusUpdateJoin(sb, projection, Contacts.Entity.DATA_ID);
8402 appendDataUsageStatJoin(sb, USAGE_TYPE_ALL, Contacts.Entity.DATA_ID);
8413 Contacts.CONTACT_STATUS,
8414 Contacts.CONTACT_STATUS_RES_PACKAGE,
8415 Contacts.CONTACT_STATUS_ICON,
8416 Contacts.CONTACT_STATUS_LABEL,
8417 Contacts.CONTACT_STATUS_TIMESTAMP)) {
8479 projection, Contacts.CONTACT_PRESENCE, Contacts.CONTACT_CHAT_CAPABILITY)) {
8502 sb.append("(" + Contacts._ID + " IN " + Tables.DEFAULT_DIRECTORY + ")");
8504 sb.append("(" + Contacts._ID + " NOT IN " + Tables.DEFAULT_DIRECTORY + ")");
8521 " AND (" + Contacts._ID + " IN (" +
8735 Data._ID + "=" + Contacts.PHOTO_ID + " AND " +
8746 Cursor c = db.query(Tables.CONTACTS,
8747 new String[] {Contacts.PHOTO_FILE_ID},
8748 Contacts._ID + "=?", new String[] {String.valueOf(contactId)},
8767 Cursor c = db.query(Tables.CONTACTS,
8768 new String[] {Contacts.PHOTO_FILE_ID}, null, null, null, null, null);
8799 String[] projection = new String[] {Contacts.PHOTO_ID, Contacts.PHOTO_FILE_ID};
8806 Contacts._ID, contactId, Contacts.LOOKUP_KEY, lookupKey, null);
8812 c.getLong(c.getColumnIndex(Contacts.PHOTO_FILE_ID));
8815 long photoId = c.getLong(c.getColumnIndex(Contacts.PHOTO_ID));
8827 Cursor c = qb.query(db, projection, Contacts._ID + "=?",
8832 long photoFileId = c.getLong(c.getColumnIndex(Contacts.PHOTO_FILE_ID));
8836 long photoId = c.getLong(c.getColumnIndex(Contacts.PHOTO_ID));
8927 Uri queryUri = Contacts.CONTENT_URI;
8943 final String selection = Contacts._ID + " IN " + inBuilder.toString();
9052 // content://USER@com.android.contacts/contacts_corp/ID/{photo,display_photo}
9055 ContentUris.appendId(Contacts.CONTENT_URI.buildUpon(), contactId)
9057 Contacts.Photo.DISPLAY_PHOTO : Contacts.Photo.CONTENT_DIRECTORY)
9262 if(uri.getBooleanQueryParameter(Contacts.QUERY_PARAMETER_VCARD_NO_PHOTO, false)) {
9305 case CONTACTS:
9306 return Contacts.CONTENT_TYPE;
9311 return Contacts.CONTENT_ITEM_TYPE;
9315 return Contacts.CONTENT_VCARD_TYPE;
9367 return Contacts.CONTENT_TYPE;
9399 case CONTACTS:
9616 Log.e(TAG, "Cannot determine the default account for contacts compatibility", e);
9753 // Re-aggregate all visible raw contacts.
9760 // Re-aggregation is only for the contacts DB.
9784 Log.i(TAG, "Aggregation algorithm upgraded for " + count + " raw contacts"
9901 db.execSQL("UPDATE " + Tables.CONTACTS +
9902 " SET " + Contacts.RAW_LAST_TIME_CONTACTED + "=?1" +
9903 "," + Contacts.RAW_TIMES_CONTACTED + "=" +
9904 "ifnull(" + Contacts.RAW_TIMES_CONTACTED + ",0) + 1" +
9905 "," + Contacts.CONTACT_LAST_UPDATED_TIMESTAMP + "=?1" +
9906 " WHERE " + Contacts._ID + " IN (SELECT " + RawContacts.CONTACT_ID +
10182 dump(pw, "Contacts");