summaryrefslogtreecommitdiffstats
path: root/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-05-19 12:17:26 -0700
committerAndrew Lee <anwlee@google.com>2015-05-19 18:14:53 -0700
commit49efd91e50a11dc7bdef8382a0ceac01bc060f77 (patch)
tree1968b01c927c95d5359022af481c56fea2a22f78 /src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
parentd9602d00913bfc8e93444ac70645bc82cff7db69 (diff)
downloadpackages_apps_Dialer-49efd91e50a11dc7bdef8382a0ceac01bc060f77.tar.gz
packages_apps_Dialer-49efd91e50a11dc7bdef8382a0ceac01bc060f77.tar.bz2
packages_apps_Dialer-49efd91e50a11dc7bdef8382a0ceac01bc060f77.zip
Performance improvements to call log scrolling.
- Remove call to CallUtil to check if video is enabled. It seems like it's fine to include the content description of what the call was, if it was a video call, even if there is not a video-enabled call account. - Factor out PhoneNumberDisplayHelper so it doesn't need to be an instance. This reduces some extra calls to getDisplayNameHelper. Probably a marginal difference, performance-wise, but it probably helps a smidgen and also simplifies the need for creating and passing or recalculating various instances of things. TODO: It'd be much better if PhoneCallDetails had a builder. It's terribly painful to fix all the tests when adding fields... Change-Id: I6da13dc8b6b047043aba871796a8ed13b112a227
Diffstat (limited to 'src/com/android/dialer/calllog/DefaultVoicemailNotifier.java')
-rw-r--r--src/com/android/dialer/calllog/DefaultVoicemailNotifier.java25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
index 99ca8db10..7c2a96638 100644
--- a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
+++ b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
@@ -58,7 +58,6 @@ public class DefaultVoicemailNotifier {
private final NotificationManager mNotificationManager;
private final NewCallsQuery mNewCallsQuery;
private final NameLookupQuery mNameLookupQuery;
- private final PhoneNumberDisplayHelper mPhoneNumberHelper;
/** Returns the singleton instance of the {@link DefaultVoicemailNotifier}. */
public static synchronized DefaultVoicemailNotifier getInstance(Context context) {
@@ -68,20 +67,18 @@ public class DefaultVoicemailNotifier {
ContentResolver contentResolver = context.getContentResolver();
sInstance = new DefaultVoicemailNotifier(context, notificationManager,
createNewCallsQuery(contentResolver),
- createNameLookupQuery(contentResolver),
- createPhoneNumberHelper(context));
+ createNameLookupQuery(contentResolver));
}
return sInstance;
}
private DefaultVoicemailNotifier(Context context,
NotificationManager notificationManager, NewCallsQuery newCallsQuery,
- NameLookupQuery nameLookupQuery, PhoneNumberDisplayHelper phoneNumberHelper) {
+ NameLookupQuery nameLookupQuery) {
mContext = context;
mNotificationManager = notificationManager;
mNewCallsQuery = newCallsQuery;
mNameLookupQuery = nameLookupQuery;
- mPhoneNumberHelper = phoneNumberHelper;
}
/**
@@ -128,8 +125,12 @@ public class DefaultVoicemailNotifier {
PhoneAccountHandle accountHandle = PhoneAccountUtils.getAccount(
newCall.accountComponentName,
newCall.accountId);
- name = mPhoneNumberHelper.getDisplayName(accountHandle, newCall.number,
- newCall.numberPresentation).toString();
+ name = PhoneNumberDisplayUtil.getDisplayName(
+ mContext,
+ accountHandle,
+ newCall.number,
+ newCall.numberPresentation,
+ /* isVoicemail */ false).toString();
// If we cannot lookup the contact, use the number instead.
if (TextUtils.isEmpty(name)) {
// Look it up in the database.
@@ -338,14 +339,4 @@ public class DefaultVoicemailNotifier {
}
}
}
-
- /**
- * Create a new PhoneNumberHelper.
- * <p>
- * This will cause some Disk I/O, at least the first time it is created, so it should not be
- * called from the main thread.
- */
- public static PhoneNumberDisplayHelper createPhoneNumberHelper(Context context) {
- return new PhoneNumberDisplayHelper(context, context.getResources());
- }
}