Show corp contacts in call-log...
as wells as the missed-call notification.
Just PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI instead of
PhoneLookup.CONTENT_FILTER_URI.
This CL requires the new column in calllog provider.
Change-Id: I61a2f63bcad102cb8a7e8021483b7dfe254abd95
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 8bfe0de..914520e 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -1169,6 +1169,10 @@
values.put(Calls.CACHED_PHOTO_ID, updatedInfo.photoId);
needsUpdate = true;
}
+ if (!UriUtils.areEqual(updatedInfo.photoUri, callLogInfo.photoUri)) {
+ values.put(Calls.CACHED_PHOTO_URI, UriUtils.uriToString(updatedInfo.photoUri));
+ needsUpdate = true;
+ }
if (!TextUtils.equals(updatedInfo.formattedNumber, callLogInfo.formattedNumber)) {
values.put(Calls.CACHED_FORMATTED_NUMBER, updatedInfo.formattedNumber);
needsUpdate = true;
@@ -1182,6 +1186,7 @@
values.put(Calls.CACHED_MATCHED_NUMBER, updatedInfo.number);
values.put(Calls.CACHED_NORMALIZED_NUMBER, updatedInfo.normalizedNumber);
values.put(Calls.CACHED_PHOTO_ID, updatedInfo.photoId);
+ values.put(Calls.CACHED_PHOTO_URI, UriUtils.uriToString(updatedInfo.photoUri));
values.put(Calls.CACHED_FORMATTED_NUMBER, updatedInfo.formattedNumber);
needsUpdate = true;
}
@@ -1214,7 +1219,7 @@
info.number = matchedNumber == null ? c.getString(CallLogQuery.NUMBER) : matchedNumber;
info.normalizedNumber = c.getString(CallLogQuery.CACHED_NORMALIZED_NUMBER);
info.photoId = c.getLong(CallLogQuery.CACHED_PHOTO_ID);
- info.photoUri = null; // We do not cache the photo URI.
+ info.photoUri = UriUtils.parseUriOrNull(c.getString(CallLogQuery.CACHED_PHOTO_URI));
info.formattedNumber = c.getString(CallLogQuery.CACHED_FORMATTED_NUMBER);
return info;
}
@@ -1352,7 +1357,7 @@
} else {
try {
Cursor phonesCursor = mContext.getContentResolver().query(
- Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, number),
+ Uri.withAppendedPath(PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI, number),
PhoneQuery._PROJECTION, null, null, null);
if (phonesCursor != null) {
try {
diff --git a/src/com/android/dialer/calllog/CallLogQuery.java b/src/com/android/dialer/calllog/CallLogQuery.java
index 0ae4cda..2b43c28 100644
--- a/src/com/android/dialer/calllog/CallLogQuery.java
+++ b/src/com/android/dialer/calllog/CallLogQuery.java
@@ -45,7 +45,8 @@
Calls.PHONE_ACCOUNT_ID, // 19
Calls.FEATURES, // 20
Calls.DATA_USAGE, // 21
- Calls.TRANSCRIPTION // 22
+ Calls.TRANSCRIPTION, // 22
+ Calls.CACHED_PHOTO_URI // 23
};
public static final int ID = 0;
@@ -71,4 +72,5 @@
public static final int FEATURES = 20;
public static final int DATA_USAGE = 21;
public static final int TRANSCRIPTION = 22;
+ public static final int CACHED_PHOTO_URI = 23;
}
diff --git a/src/com/android/dialer/calllog/ContactInfo.java b/src/com/android/dialer/calllog/ContactInfo.java
index 7b6014d..effe142 100644
--- a/src/com/android/dialer/calllog/ContactInfo.java
+++ b/src/com/android/dialer/calllog/ContactInfo.java
@@ -27,6 +27,11 @@
*/
public class ContactInfo {
public Uri lookupUri;
+
+ /**
+ * Contact lookup key. Note this may be a lookup key for a corp contact, in which case
+ * "lookup by lookup key" doesn't work on the personal profile.
+ */
public String lookupKey;
public String name;
public int type;
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index 3a1144f..da03b07 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -205,7 +205,7 @@
final ContactInfo info;
// "contactNumber" is a SIP address, so use the PhoneLookup table with the SIP parameter.
- Uri.Builder uriBuilder = PhoneLookup.CONTENT_FILTER_URI.buildUpon();
+ Uri.Builder uriBuilder = PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI.buildUpon();
uriBuilder.appendPath(Uri.encode(sipAddress));
uriBuilder.appendQueryParameter(PhoneLookup.QUERY_PARAMETER_SIP_ADDRESS, "1");
return lookupContactFromUri(uriBuilder.build());
@@ -236,7 +236,8 @@
}
// The "contactNumber" is a regular phone number, so use the PhoneLookup table.
- Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(contactNumber));
+ Uri uri = Uri.withAppendedPath(PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI,
+ Uri.encode(contactNumber));
ContactInfo info = lookupContactFromUri(uri);
if (info != null && info != ContactInfo.EMPTY) {
info.formattedNumber = formatPhoneNumber(number, null, countryIso);
diff --git a/src/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java b/src/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java
index 6d74cd0..960a31b 100644
--- a/src/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java
+++ b/src/com/android/dialer/interactions/UndemoteOutgoingCallReceiver.java
@@ -30,6 +30,8 @@
/**
* This broadcast receiver is used to listen to outgoing calls and undemote formerly demoted
* contacts if a phone call is made to a phone number belonging to that contact.
+ *
+ * NOTE This doesn't work for corp contacts.
*/
public class UndemoteOutgoingCallReceiver extends BroadcastReceiver {