diff options
author | Chris Wren <cwren@android.com> | 2014-05-02 18:47:24 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-02 18:47:24 +0000 |
commit | 451537557c033c9fd36904d9bd95938546408563 (patch) | |
tree | 72980e67b13525114e7839226d6e3e42597610d7 | |
parent | 9329f6b15b6692187ed69ed8f26d22724bf4ac2a (diff) | |
parent | a6e545ccc15b4925e7b8d2a34a5acb35b03fb463 (diff) |
Merge "Add EXTRA_PEOPLE to the dialer notifications."
-rw-r--r-- | InCallUI/src/com/android/incallui/CallerInfo.java | 9 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/ContactInfoCache.java | 8 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/StatusBarNotifier.java | 12 |
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. */ |