summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/CallCardPresenter.java
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2018-06-25 12:36:26 -0700
committerCopybara-Service <copybara-piper@google.com>2018-06-26 13:42:08 -0700
commit5578d928bf777f721ec0ec04c84ddb7d3ea56edb (patch)
tree150f643cf67aee21a2ac730d3f7b1f6cada7db47 /java/com/android/incallui/CallCardPresenter.java
parent03bacec1394032712c534605476fb634b85eee28 (diff)
Refactor ContactPreference
Moving it outside contacts.commons reduces dependency to legacy code. Also removed redundant implementations such as caching SharedPreferences (it is already cached), custom ListPreferences (standard ListPreferences already have what we want), and corrected preference storage location (allow standard ListPreferences to work) TEST=TAP Test: TAP PiperOrigin-RevId: 202000393 Change-Id: I45374e610b3510784b5a4da92e5d8462cbfc92bb
Diffstat (limited to 'java/com/android/incallui/CallCardPresenter.java')
-rw-r--r--java/com/android/incallui/CallCardPresenter.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index 91255cc7e..b9e6744ea 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -44,11 +44,10 @@ import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import com.android.contacts.common.ContactsUtils;
-import com.android.contacts.common.preference.ContactsPreferences;
-import com.android.contacts.common.util.ContactDisplayUtils;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.configprovider.ConfigProviderComponent;
+import com.android.dialer.contacts.ContactsComponent;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
import com.android.dialer.multimedia.MultimediaData;
@@ -123,7 +122,6 @@ public class CallCardPresenter
private String secondaryNumber;
private ContactCacheEntry primaryContactInfo;
private ContactCacheEntry secondaryContactInfo;
- @Nullable private ContactsPreferences contactsPreferences;
private boolean isFullscreen = false;
private InCallScreen inCallScreen;
private boolean isInCallScreenReady;
@@ -159,7 +157,6 @@ public class CallCardPresenter
public void onInCallScreenDelegateInit(InCallScreen inCallScreen) {
Assert.isNotNull(inCallScreen);
this.inCallScreen = inCallScreen;
- contactsPreferences = ContactsPreferencesFactory.newContactsPreferences(context);
// Call may be null if disconnect happened already.
DialerCall call = CallList.getInstance().getFirstCall();
@@ -184,9 +181,6 @@ public class CallCardPresenter
public void onInCallScreenReady() {
LogUtil.i("CallCardPresenter.onInCallScreenReady", null);
Assert.checkState(!isInCallScreenReady);
- if (contactsPreferences != null) {
- contactsPreferences.refreshValue(ContactsPreferences.DISPLAY_ORDER_KEY);
- }
// Contact search may have completed before ui is ready.
if (primaryContactInfo != null) {
@@ -985,8 +979,9 @@ public class CallCardPresenter
/** Gets the name to display for the call. */
private String getNameForCall(ContactCacheEntry contactInfo) {
String preferredName =
- ContactDisplayUtils.getPreferredDisplayName(
- contactInfo.namePrimary, contactInfo.nameAlternative, contactsPreferences);
+ ContactsComponent.get(context)
+ .contactDisplayPreferences()
+ .getDisplayName(contactInfo.namePrimary, contactInfo.nameAlternative);
if (TextUtils.isEmpty(preferredName)) {
return TextUtils.isEmpty(contactInfo.number)
? null