diff options
author | Yorke Lee <yorkelee@google.com> | 2013-10-02 09:45:10 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2013-10-02 09:47:09 -0700 |
commit | 7e7fd2a0642515834a96028937f60ec955edfd91 (patch) | |
tree | 261fcd1c553de8ff8fa883bc07915ae634363fcb | |
parent | 9e21a8b3dd1eab756c3cde836c39d7a408467e5a (diff) |
Send view notification for viewed contact in IncallUI
This triggers a download of the hi-res photo for the contact so the
next time a call is made, the hi-res photo is displayed.
Bug: 11006082
Change-Id: I8243dc0a6899c787807425226f2cfcd4a46e0ec1
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 3 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallerInfoUtils.java | 20 |
2 files changed, 22 insertions, 1 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 4ff4d6523..949d71891 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -261,6 +261,9 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> if (entry.name != null) { Log.d(TAG, "Contact found: " + entry); } + if (entry.personUri != null) { + CallerInfoUtils.sendViewNotification(mContext, entry.personUri); + } } @Override diff --git a/InCallUI/src/com/android/incallui/CallerInfoUtils.java b/InCallUI/src/com/android/incallui/CallerInfoUtils.java index 2971a2954..3d2c5c4a7 100644 --- a/InCallUI/src/com/android/incallui/CallerInfoUtils.java +++ b/InCallUI/src/com/android/incallui/CallerInfoUtils.java @@ -1,6 +1,8 @@ package com.android.incallui; import android.content.Context; +import android.content.Intent; +import android.net.Uri; import android.text.TextUtils; import com.android.services.telephony.common.Call; @@ -9,7 +11,7 @@ import com.android.services.telephony.common.CallIdentification; import java.util.Arrays; /** - * TODO: Insert description here. (generated by yorkelee) + * Utility methods for contact and caller info related functionality */ public class CallerInfoUtils { @@ -18,6 +20,12 @@ public class CallerInfoUtils { /** Define for not a special CNAP string */ private static final int CNAP_SPECIAL_CASE_NO = -1; + private static final String VIEW_NOTIFICATION_ACTION = + "com.android.contacts.VIEW_NOTIFICATION"; + private static final String VIEW_NOTIFICATION_PACKAGE = "com.android.contacts"; + private static final String VIEW_NOTIFICATION_CLASS = + "com.android.contacts.ViewNotificationService"; + public CallerInfoUtils() { } @@ -172,4 +180,14 @@ public class CallerInfoUtils { } return builder.toString(); } + + /** + * Send a notification that that we are viewing a particular contact, so that the high-res + * photo is downloaded by the sync adapter. + */ + public static void sendViewNotification(Context context, Uri contactUri) { + final Intent intent = new Intent(VIEW_NOTIFICATION_ACTION, contactUri); + intent.setClassName(VIEW_NOTIFICATION_PACKAGE, VIEW_NOTIFICATION_CLASS); + context.startService(intent); + } } |