diff options
Diffstat (limited to 'src/com')
5 files changed, 36 insertions, 7 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index e26d2f020..24b59fb3e 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -436,7 +436,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware // Cache the details about the phone number. final boolean canPlaceCallsTo = PhoneNumberHelper.canPlaceCallsTo(mNumber, numberPresentation); - final boolean isVoicemailNumber = mPhoneNumberHelper.isVoicemailNumber(mNumber); + final boolean isVoicemailNumber = PhoneNumberHelper.isVoicemailNumber(mNumber); final boolean isSipNumber = mPhoneNumberHelper.isSipNumber(mNumber); // Let user view contact details if they exist, otherwise add option to create new @@ -631,7 +631,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware // If this is not a regular number, there is no point in looking it up in the contacts. ContactInfo info = PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation) - && !mPhoneNumberHelper.isVoicemailNumber(number) + && !PhoneNumberHelper.isVoicemailNumber(number) ? mContactInfoHelper.lookupNumber(number, countryIso) : null; if (info == null) { diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java index be9cb660f..d882eb686 100644 --- a/src/com/android/dialer/PhoneCallDetailsHelper.java +++ b/src/com/android/dialer/PhoneCallDetailsHelper.java @@ -117,7 +117,7 @@ public class PhoneCallDetailsHelper { if (TextUtils.isEmpty(details.name)) { nameText = displayNumber; if (TextUtils.isEmpty(details.geocode) - || mPhoneNumberHelper.isVoicemailNumber(details.number)) { + || PhoneNumberHelper.isVoicemailNumber(details.number)) { numberText = mResources.getString(R.string.call_log_empty_gecode); } else { numberText = details.geocode; diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index c0054ba79..136899eaf 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -542,7 +542,7 @@ public class CallLogAdapter extends GroupingListAdapter mContactInfoCache.getCachedValue(numberCountryIso); ContactInfo info = cachedInfo == null ? null : cachedInfo.getValue(); if (!PhoneNumberHelper.canPlaceCallsTo(number, numberPresentation) - || mPhoneNumberHelper.isVoicemailNumber(number)) { + || PhoneNumberHelper.isVoicemailNumber(number)) { // If this is a number that cannot be dialed, there is no point in looking up a contact // for it. info = ContactInfo.EMPTY; @@ -615,10 +615,11 @@ public class CallLogAdapter extends GroupingListAdapter mViewTreeObserver.addOnPreDrawListener(this); } - postBindView(views, info); + postBindView(views, info, details); } - protected void postBindView(CallLogListItemViews views, ContactInfo info) { + protected void postBindView(CallLogListItemViews views, ContactInfo info, + PhoneCallDetails details) { // no-op } diff --git a/src/com/android/dialer/calllog/ContactInfo.java b/src/com/android/dialer/calllog/ContactInfo.java index ac858df87..2006744d3 100644 --- a/src/com/android/dialer/calllog/ContactInfo.java +++ b/src/com/android/dialer/calllog/ContactInfo.java @@ -20,6 +20,7 @@ import android.net.Uri; import android.text.TextUtils; import com.android.contacts.common.util.UriUtils; +import com.google.common.base.Objects; /** * Information for a contact as needed by the Call Log. @@ -70,4 +71,12 @@ public class ContactInfo { if (!UriUtils.areEqual(photoUri, other.photoUri)) return false; return true; } + + @Override + public String toString() { + return Objects.toStringHelper(this).add("lookupUri", lookupUri).add("name", name).add( + "type", type).add("label", label).add("number", number).add("formattedNumber", + formattedNumber).add("normalizedNumber", normalizedNumber).add("photoId", photoId) + .add("photoUri", photoUri).toString(); + } } diff --git a/src/com/android/dialer/calllog/PhoneNumberHelper.java b/src/com/android/dialer/calllog/PhoneNumberHelper.java index 7d46f40c9..b89c727a7 100644 --- a/src/com/android/dialer/calllog/PhoneNumberHelper.java +++ b/src/com/android/dialer/calllog/PhoneNumberHelper.java @@ -75,11 +75,30 @@ public class PhoneNumberHelper { } } + public static boolean isUnknownNumberThatCanBeLookedUp(CharSequence number, int presentation) { + if (presentation == Calls.PRESENTATION_UNKNOWN) { + return false; + } + if (presentation == Calls.PRESENTATION_RESTRICTED) { + return false; + } + if (presentation == Calls.PRESENTATION_PAYPHONE) { + return false; + } + if (TextUtils.isEmpty(number)) { + return false; + } + if (isVoicemailNumber(number)) { + return false; + } + return true; + } + /** * Returns true if the given number is the number of the configured voicemail. * To be able to mock-out this, it is not a static method. */ - public boolean isVoicemailNumber(CharSequence number) { + public static boolean isVoicemailNumber(CharSequence number) { return PhoneNumberUtils.isVoiceMailNumber(number.toString()); } |