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
diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
index 2632fb3..9d04cb2 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.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 @@
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 @@
this.resources = resources;
this.callLogCache = callLogCache;
calendar = Calendar.getInstance();
+ cachedNumberLookupService = PhoneNumberCache.get(context).getCachedNumberLookupService();
}
static boolean shouldShowVoicemailDonationPromo(
@@ -125,7 +130,7 @@
}
/** 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 @@
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 @@
: Phone.getTypeLabel(resources, details.numberType, details.numberLabel);
}
}
-
if (!TextUtils.isEmpty(details.namePrimary) && TextUtils.isEmpty(numberFormattedLabel)) {
numberFormattedLabel = details.displayNumber;
}