diff options
author | Christine Chen <christinech@google.com> | 2013-10-01 12:00:01 -0700 |
---|---|---|
committer | Christine Chen <christinech@google.com> | 2013-10-02 11:53:29 -0700 |
commit | 75245f68b77c9c3d0be2a195e140a97b2d7c7f7b (patch) | |
tree | e5b8a6060e82ed1c6f6f0b94d43dd11194a474ba /src/com/android | |
parent | 769ad7e024e4bf9f3352aaefbef9af9d10b762b3 (diff) | |
download | packages_apps_Dialer-75245f68b77c9c3d0be2a195e140a97b2d7c7f7b.tar.gz packages_apps_Dialer-75245f68b77c9c3d0be2a195e140a97b2d7c7f7b.tar.bz2 packages_apps_Dialer-75245f68b77c9c3d0be2a195e140a97b2d7c7f7b.zip |
Fixes how voicemail looks up contact names
Bug: 10966248
Change-Id: I6532e71c3a63104587e5f9bdba59ce2eb3423bb4
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/dialer/calllog/DefaultVoicemailNotifier.java | 10 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/PhoneNumberHelper.java | 34 |
2 files changed, 28 insertions, 16 deletions
diff --git a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java index cb3d99466..14e1bedbb 100644 --- a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java +++ b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java @@ -118,12 +118,12 @@ public class DefaultVoicemailNotifier implements VoicemailNotifier { // Check if we already know the name associated with this number. String name = names.get(newCall.number); if (name == null) { - // Look it up in the database. - name = mNameLookupQuery.query(newCall.number); + name = mPhoneNumberHelper.getDisplayName(newCall.number, + newCall.numberPresentation).toString(); // If we cannot lookup the contact, use the number instead. - if (name == null) { - name = mPhoneNumberHelper.getDisplayNumber(newCall.number, - newCall.numberPresentation, "").toString(); + if (TextUtils.isEmpty(name)) { + // Look it up in the database. + name = mNameLookupQuery.query(newCall.number); if (TextUtils.isEmpty(name)) { name = newCall.number; } diff --git a/src/com/android/dialer/calllog/PhoneNumberHelper.java b/src/com/android/dialer/calllog/PhoneNumberHelper.java index 5a882e8a8..336facb37 100644 --- a/src/com/android/dialer/calllog/PhoneNumberHelper.java +++ b/src/com/android/dialer/calllog/PhoneNumberHelper.java @@ -33,14 +33,7 @@ public class PhoneNumberHelper { mResources = resources; } - /** - * Returns the string to display for the given phone number. - * - * @param number the number to display - * @param formattedNumber the formatted number if available, may be null - */ - public CharSequence getDisplayNumber(CharSequence number, - int presentation, CharSequence formattedNumber) { + /* package */ CharSequence getDisplayName(CharSequence number, int presentation) { if (presentation == Calls.PRESENTATION_UNKNOWN) { return mResources.getString(R.string.unknown); } @@ -50,15 +43,34 @@ public class PhoneNumberHelper { if (presentation == Calls.PRESENTATION_PAYPHONE) { return mResources.getString(R.string.payphone); } - if (TextUtils.isEmpty(number)) { - return ""; - } if (new PhoneNumberUtilsWrapper().isVoicemailNumber(number)) { return mResources.getString(R.string.voicemail); } if (PhoneNumberUtilsWrapper.isLegacyUnknownNumbers(number)) { return mResources.getString(R.string.unknown); } + return ""; + } + + /** + * Returns the string to display for the given phone number. + * + * @param number the number to display + * @param formattedNumber the formatted number if available, may be null + */ + public CharSequence getDisplayNumber(CharSequence number, + int presentation, CharSequence formattedNumber) { + + final CharSequence displayName = getDisplayName(number, presentation); + + if (!TextUtils.isEmpty(displayName)) { + return displayName; + } + + if (TextUtils.isEmpty(number)) { + return ""; + } + if (TextUtils.isEmpty(formattedNumber)) { return number; } else { |