diff options
author | twyen <twyen@google.com> | 2018-05-29 14:12:58 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-01 18:08:51 -0700 |
commit | 7982723ff5c03ec71c2dc3cc740af239fc327a47 (patch) | |
tree | 871101307376e268b283ce3f06361784b55429c6 /java | |
parent | 47b5655933044cd7c48003bafea1dece1d6575d1 (diff) |
Use geocode as label for businesses.
Business number from PhoneNumberService does not always have a sensible label. Previously it would be "Main", but geocode are a bit more useful.
TEST=manual, old UI has no tests.
Bug: 80251984
Test: manual, old UI has no tests.
PiperOrigin-RevId: 198455846
Change-Id: I5efbc66aa295f8039eecfbcb119f18afc735b15c
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java index 2632fb380..9d04cb2c8 100644 --- a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java +++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java @@ -48,6 +48,8 @@ import com.android.dialer.compat.android.provider.VoicemailCompat; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.logging.ContactSource; import com.android.dialer.oem.MotorolaUtils; +import com.android.dialer.phonenumbercache.CachedNumberLookupService; +import com.android.dialer.phonenumbercache.PhoneNumberCache; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.spannable.ContentWithLearnMoreSpanner; import com.android.dialer.storage.StorageComponent; @@ -76,6 +78,8 @@ public class PhoneCallDetailsHelper private final CallLogCache callLogCache; /** Calendar used to construct dates */ private final Calendar calendar; + + private final CachedNumberLookupService cachedNumberLookupService; /** The injected current time in milliseconds since the epoch. Used only by tests. */ private Long currentTimeMillisForTest; @@ -95,6 +99,7 @@ public class PhoneCallDetailsHelper this.resources = resources; this.callLogCache = callLogCache; calendar = Calendar.getInstance(); + cachedNumberLookupService = PhoneNumberCache.get(context).getCachedNumberLookupService(); } static boolean shouldShowVoicemailDonationPromo( @@ -125,7 +130,7 @@ public class PhoneCallDetailsHelper } /** Returns true if primary name is empty or the data is from Cequint Caller ID. */ - private static boolean shouldShowLocation(PhoneCallDetails details) { + private boolean shouldShowLocation(PhoneCallDetails details) { if (TextUtils.isEmpty(details.geocode)) { return false; } @@ -133,6 +138,11 @@ public class PhoneCallDetailsHelper if (details.sourceType == ContactSource.Type.SOURCE_TYPE_CEQUINT_CALLER_ID) { return true; } + if (cachedNumberLookupService != null + && cachedNumberLookupService.isBusiness(details.sourceType)) { + return true; + } + // Don't bother showing geo location for contacts. if (!TextUtils.isEmpty(details.namePrimary)) { return false; @@ -482,7 +492,6 @@ public class PhoneCallDetailsHelper : Phone.getTypeLabel(resources, details.numberType, details.numberLabel); } } - if (!TextUtils.isEmpty(details.namePrimary) && TextUtils.isEmpty(numberFormattedLabel)) { numberFormattedLabel = details.displayNumber; } |