Home | History | Annotate | Download | only in data

Lines Matching refs:CONTACT

40 public class Contact {
44 public static final int CONTACT_METHOD_TYPE_SELF = 3; // the "Me" or profile contact
56 // log("contact changed, invalidate cache");
75 // Contact, -1 is invalid. e.g. contact method id is 20 when
76 // current contact has phone content://.../phones/20.
93 private boolean mIsMe; // true if this contact is me!
94 private boolean mSendToVoicemail; // true if this contact should not put up notification
98 public void onUpdate(Contact updated);
101 private Contact(String number, String name) {
105 * Make a basic contact object with a phone number.
107 private Contact(String number) {
111 private Contact(boolean isMe) {
161 public static Contact get(String number, boolean canBlock) {
165 public static Contact getMe(boolean canBlock) {
173 public static List<Contact> getByPhoneUris(Parcelable[] uris) {
183 // stale so the next time we're asked for a particular contact, we'll return that
184 // stale contact and at the same time, fire off an asyncUpdateContact to update
185 // that contact's info in the background. UI elements using the contact typically
186 // call addListener() so they immediately get notified when the contact has been
314 Log.i(TAG, "[Contact] dumpListeners; size=" + mListeners.size());
370 // it maybe too aggressive to listen for *any* contact changes, and rebuild MMS contact
456 // query params for contact lookup by email
479 private final HashMap<String, ArrayList<Contact>> mContactsHash =
480 new HashMap<String, ArrayList<Contact>>();
488 Log.d(TAG, "**** Contact cache dump ****");
490 ArrayList<Contact> alc = mContactsHash.get(key);
491 for (Contact c : alc) {
514 break; // Exception sent by Contact.init() to stop Runnable
526 }, "Contact.ContactsCache.TaskStack worker thread");
543 public Contact getMe(boolean canBlock) {
547 public Contact get(String number, boolean canBlock) {
551 private Contact get(String number, boolean isMe, boolean canBlock) {
552 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
563 // Always return a Contact object, if if we don't have an actual contact
565 Contact contact = internalGet(number, isMe);
568 synchronized (contact) {
571 while (canBlock && contact.mQueryPending) {
573 contact.wait();
581 if (contact.mIsStale && !contact.mQueryPending) {
582 contact.mIsStale = false;
585 log("async update for " + contact.toString() + " canBlock: " + canBlock +
586 " isStale: " + contact.mIsStale);
589 final Contact c = contact;
597 // set this to true while we have the lock on contact since we will
601 contact.mQueryPending = true;
613 return contact;
621 public List<Contact> getContactInfoForPhoneUris(Parcelable[] uris) {
651 List<Contact> entries = new ArrayList<Contact>();
655 Contact entry = new Contact(cursor.getString(PHONE_NUMBER_COLUMN),
658 ArrayList<Contact> value = new ArrayList<Contact>();
670 private boolean contactChanged(Contact orig, Contact newContactData) {
684 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
691 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
704 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
713 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
720 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
729 private void updateContact(final Contact c) {
734 Contact entry = getContactInfo(c);
738 log("updateContact: contact changed for " + entry.mName);
757 // We saw a bug where we were updating an empty contact. That would trigger
769 iterator = (HashSet<UpdateListener>)Contact.mListeners.clone();
772 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
787 * Returns the caller info in Contact.
789 private Contact getContactInfo(Contact c) {
796 Contact contact = getContactInfoForEmailAddress(c.mNumber);
797 if (contact.existsInDatabase()) {
798 return contact;
846 * @return a Contact containing the caller id info corresponding to the number.
848 private Contact getContactInfoForPhoneNumber(String number) {
849 Contact entry = new Contact(number);
853 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
878 + " contact uri used " + PHONES_WITH_PRESENCE_URI);
894 * @return a Contact containing the info for the profile.
896 private Contact getContactInfoForSelf() {
897 Contact entry = new Contact(true);
900 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
907 + " contact uri used " + Profile.CONTENT_URI);
921 private void fillPhoneTypeContact(final Contact contact, final Cursor cursor) {
922 synchronized (contact) {
923 contact.mContactMethodType = CONTACT_METHOD_TYPE_PHONE;
924 contact.mContactMethodId = cursor.getLong(PHONE_ID_COLUMN);
925 contact.mLabel = cursor.getString(PHONE_LABEL_COLUMN);
926 contact.mName = cursor.getString(CONTACT_NAME_COLUMN);
927 contact.mPersonId = cursor.getLong(CONTACT_ID_COLUMN);
928 contact.mPresenceResId = getPresenceIconResourceId(
930 contact.mPresenceText = cursor.getString(CONTACT_STATUS_COLUMN);
931 contact.mNumberE164 = cursor.getString(PHONE_NORMALIZED_NUMBER);
932 contact.mSendToVoicemail = cursor.getInt(SEND_TO_VOICEMAIL) == 1;
933 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
934 log("fillPhoneTypeContact: name=" + contact.mName + ", number="
935 + contact.mNumber + ", presence=" + contact.mPresenceResId
936 + " SendToVoicemail: " + contact.mSendToVoicemail);
939 byte[] data = loadAvatarData(contact);
941 synchronized (contact) {
942 contact.mAvatarData = data;
946 private void fillSelfContact(final Contact contact, final Cursor cursor) {
947 synchronized (contact) {
948 contact.mName = cursor.getString(SELF_NAME_COLUMN);
949 if (TextUtils.isEmpty(contact.mName)) {
950 contact.mName = mContext.getString(R.string.messagelist_sender_self);
952 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
953 log("fillSelfContact: name=" + contact.mName + ", number="
954 + contact.mNumber);
957 byte[] data = loadAvatarData(contact);
959 synchronized (contact) {
960 contact.mAvatarData = data;
970 private byte[] loadAvatarData(Contact entry) {
977 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
981 // If the contact is "me", then use my local profile photo. Otherwise, build a
982 // uri to get the avatar of the contact.
1019 * Query the contact email table to get the name of an email address.
1021 private Contact getContactInfoForEmailAddress(String email) {
1022 Contact entry = new Contact(email);
1051 if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
1108 private Contact internalGet(String numberOrEmail, boolean isMe) {
1117 ArrayList<Contact> candidates = mContactsHash.get(key);
1121 Contact c= candidates.get(i);
1133 candidates = new ArrayList<Contact>();
1137 Contact c = isMe ?
1138 new Contact(true) :
1139 new Contact(numberOrEmail);
1149 for (ArrayList<Contact> alc : mContactsHash.values()) {
1150 for (Contact c : alc) {
1159 // Remove a contact from the ContactsCache based on the number or email address
1160 private void remove(Contact contact) {
1162 String number = contact.getNumber();
1163 final boolean isNotRegularPhoneNumber = contact.isMe() ||
1168 ArrayList<Contact> candidates = mContactsHash.get(key);
1172 Contact c = candidates.get(i);