summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-07-21 17:41:04 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-07-21 17:41:04 +0000
commitd87b4c7ef0abba3a8cb5a2deab328c1e97361471 (patch)
tree127b46d2d13b6d7fd19619f83d135c1dba29eec0 /InCallUI
parent5a829fd62844448074dbb773a4d5cf35de280e2d (diff)
parent504b92ca48ad57fd97a07de95ca459a5e24ded17 (diff)
am bf41b978: Remove references to ViewNotificationService in Dialer
* commit 'bf41b978dcb99db47247db6c56821d8090131f6e': Remove references to ViewNotificationService in Dialer
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/CallerInfoUtils.java33
1 files changed, 22 insertions, 11 deletions
diff --git a/InCallUI/src/com/android/incallui/CallerInfoUtils.java b/InCallUI/src/com/android/incallui/CallerInfoUtils.java
index bc0ea78b4..52646ec27 100644
--- a/InCallUI/src/com/android/incallui/CallerInfoUtils.java
+++ b/InCallUI/src/com/android/incallui/CallerInfoUtils.java
@@ -2,9 +2,15 @@ package com.android.incallui;
import android.content.Context;
import android.content.Intent;
+import android.content.Loader;
+import android.content.Loader.OnLoadCompleteListener;
import android.net.Uri;
import android.telecomm.CallPropertyPresentation;
import android.text.TextUtils;
+import android.util.Log;
+
+import com.android.contacts.common.model.Contact;
+import com.android.contacts.common.model.ContactLoader;
import java.util.Arrays;
@@ -18,12 +24,6 @@ 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() {
}
@@ -163,12 +163,23 @@ public class CallerInfoUtils {
}
/**
- * Send a notification that that we are viewing a particular contact, so that the high-res
- * photo is downloaded by the sync adapter.
+ * Send a notification using a {@link ContactLoader} to inform the sync adapter that we are
+ * viewing a particular contact, so that it can download the high-res photo.
*/
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);
+ final ContactLoader loader = new ContactLoader(context, contactUri,
+ true /* postViewNotification */);
+ loader.registerListener(0, new OnLoadCompleteListener<Contact>() {
+ @Override
+ public void onLoadComplete(
+ Loader<Contact> loader, Contact contact) {
+ try {
+ loader.reset();
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Error resetting loader", e);
+ }
+ }
+ });
+ loader.startLoading();
}
}