summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-07-09 10:37:00 -0700
committerYorke Lee <yorkelee@google.com>2014-07-21 10:35:03 -0700
commitbf41b978dcb99db47247db6c56821d8090131f6e (patch)
tree65896ffa5c11d01d6fe1abb0a3e53b2beb58ce32
parentbfb48c19b99fb1e2412f9c722f6f55a967c45233 (diff)
downloadpackages_apps_InCallUI-bf41b978dcb99db47247db6c56821d8090131f6e.tar.gz
packages_apps_InCallUI-bf41b978dcb99db47247db6c56821d8090131f6e.tar.bz2
packages_apps_InCallUI-bf41b978dcb99db47247db6c56821d8090131f6e.zip
Remove references to ViewNotificationService in Dialer
ViewNotificationService ultimately uses a ContactLoader to send the view notification to the sync adapter. Since ContactLoader is already a part of ContactsCommon, we just need to create an instance of a ContactLoader in InCallUI to notify the sync adapter to download the high res photo. Bug: 7402960 Change-Id: Icaa120d6c3bc0f1e5ddc45365dfa7684e5a5525c
-rw-r--r--src/com/android/incallui/CallerInfoUtils.java33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/com/android/incallui/CallerInfoUtils.java b/src/com/android/incallui/CallerInfoUtils.java
index bc0ea78b..52646ec2 100644
--- a/src/com/android/incallui/CallerInfoUtils.java
+++ b/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();
}
}