summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2014-05-02 13:36:30 -0400
committerChris Wren <cwren@android.com>2014-05-02 13:36:30 -0400
commita6e545ccc15b4925e7b8d2a34a5acb35b03fb463 (patch)
tree8e73cee32dfd808ba14279175524c4d7521e13d4
parent43f80fa2bfa81f60d33c9cf855e7b7c8c0097946 (diff)
Add EXTRA_PEOPLE to the dialer notifications.
Bug: 14489962 Change-Id: I8e83cf04fc4acaefcb83fa2ea7c37d091c99f5c1
-rw-r--r--InCallUI/src/com/android/incallui/CallerInfo.java9
-rw-r--r--InCallUI/src/com/android/incallui/ContactInfoCache.java8
-rw-r--r--InCallUI/src/com/android/incallui/StatusBarNotifier.java12
3 files changed, 29 insertions, 0 deletions
diff --git a/InCallUI/src/com/android/incallui/CallerInfo.java b/InCallUI/src/com/android/incallui/CallerInfo.java
index 2e89e48d9..c004dc2e4 100644
--- a/InCallUI/src/com/android/incallui/CallerInfo.java
+++ b/InCallUI/src/com/android/incallui/CallerInfo.java
@@ -90,6 +90,7 @@ public class CallerInfo {
public int photoResource;
public long person_id;
+ public String lookupKey;
public boolean needUpdate;
public Uri contactRefUri;
@@ -204,6 +205,14 @@ public class CallerInfo {
if (columnIndex != -1) {
info.person_id = cursor.getLong(columnIndex);
Log.v(TAG, "==> got info.person_id: " + info.person_id);
+
+ // cache the lookup key for later use with person_id to create lookup URIs
+ columnIndex = cursor.getColumnIndex(PhoneLookup.LOOKUP_KEY);
+ if ((columnIndex != -1) && (cursor.getString(columnIndex) != null)) {
+ info.lookupKey = cursor.getString(columnIndex);
+ } else {
+ info.lookupKey = null;
+ }
} else {
// No valid columnIndex, so we can't look up person_id.
Log.v(TAG, "Couldn't find person_id column for " + contactRef);
diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java
index 54de7057d..0359529ea 100644
--- a/InCallUI/src/com/android/incallui/ContactInfoCache.java
+++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java
@@ -333,6 +333,13 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
} else {
cce.personUri = personUri;
}
+
+ if (info.lookupKey == null) {
+ Log.v(TAG, "lookup key is null. Don't create a lookup uri.");
+ cce.lookupUri = null;
+ } else {
+ cce.lookupUri = Contacts.getLookupUri(info.person_id, info.lookupKey);
+ }
}
cce.photo = photo;
@@ -507,6 +514,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
public Drawable photo;
public boolean isSipCall;
public Uri personUri; // Used for local photo load
+ public Uri lookupUri; // Sent to NotificationMananger
@Override
public String toString() {
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
index 807e44b3d..2ce1ac6bd 100644
--- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java
+++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
@@ -16,6 +16,7 @@
package com.android.incallui;
+import android.net.Uri;
import com.google.common.base.Preconditions;
import android.app.Notification;
@@ -309,6 +310,8 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener {
addAnswerAction(builder);
}
+ addPersonReference(builder, contactInfo, call);
+
/*
* Fire off the notification
*/
@@ -371,6 +374,15 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener {
return contactInfo.name;
}
+ private void addPersonReference(Notification.Builder builder, ContactCacheEntry contactInfo,
+ Call call) {
+ if (contactInfo.lookupUri != null) {
+ builder.addPerson(contactInfo.lookupUri.toString());
+ } else if (!TextUtils.isEmpty(call.getNumber())) {
+ builder.addPerson(Uri.fromParts("tel", call.getNumber(), null).toString());
+ }
+ }
+
/**
* Gets a large icon from the contact info object to display in the notification.
*/