From ae6c8ec0d86d2c4756ab876b8ee44249713c86fb Mon Sep 17 00:00:00 2001 From: wangqi Date: Thu, 28 Sep 2017 17:39:40 -0700 Subject: Fix bug that phone number is shown for local contacts. This is a regression caused by cl/169961072. This change will make sure phone number is only shown on top row for non-local contacts if the name is not number and the call is active. Bug: 67047386 Test: TopRowTest PiperOrigin-RevId: 170424277 Change-Id: I9b3ab9432a938b2fb1c6632f2d9404bee413588f --- java/com/android/incallui/CallCardPresenter.java | 2 ++ java/com/android/incallui/ContactInfoCache.java | 4 ++++ java/com/android/incallui/callpending/CallPendingActivity.java | 1 + java/com/android/incallui/contactgrid/TopRow.java | 3 +++ java/com/android/incallui/incall/protocol/PrimaryInfo.java | 4 ++++ 5 files changed, 14 insertions(+) (limited to 'java') diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index be9b3ef6c..d49d556a6 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -712,6 +712,7 @@ public class CallCardPresenter showContactPhoto, hasWorkCallProperty, false /* isSpam */, + false /* isLocalContact */, false /* answeringDisconnectsOngoingCall */, shouldShowLocation(), null /* contactInfoLookupKey */, @@ -760,6 +761,7 @@ public class CallCardPresenter showContactPhoto, hasWorkCallProperty || isWorkContact, mPrimary.isSpam(), + mPrimaryContactInfo.isLocalContact(), mPrimary.answeringDisconnectsForegroundVideoCall(), shouldShowLocation(), mPrimaryContactInfo.lookupKey, diff --git a/java/com/android/incallui/ContactInfoCache.java b/java/com/android/incallui/ContactInfoCache.java index 39c4c2fda..2a9394526 100644 --- a/java/com/android/incallui/ContactInfoCache.java +++ b/java/com/android/incallui/ContactInfoCache.java @@ -721,6 +721,10 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { boolean isEmergencyNumber; boolean isVoicemailNumber; + public boolean isLocalContact() { + return contactLookupResult == ContactLookupResult.Type.LOCAL_CONTACT; + } + @Override public String toString() { return "ContactCacheEntry{" diff --git a/java/com/android/incallui/callpending/CallPendingActivity.java b/java/com/android/incallui/callpending/CallPendingActivity.java index 26490d973..7fc4caf5a 100644 --- a/java/com/android/incallui/callpending/CallPendingActivity.java +++ b/java/com/android/incallui/callpending/CallPendingActivity.java @@ -189,6 +189,7 @@ public class CallPendingActivity extends FragmentActivity true /* isContactPhotoShown */, false /* isWorkCall */, false /* isSpam */, + true /* isLocalContact */, false /* answeringDisconnectsOngoingCall */, false /* shouldShowLocation */, getLookupKey(), diff --git a/java/com/android/incallui/contactgrid/TopRow.java b/java/com/android/incallui/contactgrid/TopRow.java index 8f54266f3..3593c991d 100644 --- a/java/com/android/incallui/contactgrid/TopRow.java +++ b/java/com/android/incallui/contactgrid/TopRow.java @@ -122,6 +122,9 @@ public class TopRow { if (primaryInfo.location == null && isIncoming) { return false; } + if (primaryInfo.isLocalContact && !isIncoming) { + return false; + } if (TextUtils.isEmpty(primaryInfo.number)) { return false; } diff --git a/java/com/android/incallui/incall/protocol/PrimaryInfo.java b/java/com/android/incallui/incall/protocol/PrimaryInfo.java index 7fe0a0f6a..69eee20ff 100644 --- a/java/com/android/incallui/incall/protocol/PrimaryInfo.java +++ b/java/com/android/incallui/incall/protocol/PrimaryInfo.java @@ -36,6 +36,7 @@ public class PrimaryInfo { public final boolean isContactPhotoShown; public final boolean isWorkCall; public final boolean isSpam; + public final boolean isLocalContact; public final boolean answeringDisconnectsOngoingCall; public final boolean shouldShowLocation; // Used for consistent LetterTile coloring. @@ -60,6 +61,7 @@ public class PrimaryInfo { false, false, false, + false, null, null, true, @@ -78,6 +80,7 @@ public class PrimaryInfo { boolean isContactPhotoShown, boolean isWorkCall, boolean isSpam, + boolean isLocalContact, boolean answeringDisconnectsOngoingCall, boolean shouldShowLocation, @Nullable String contactInfoLookupKey, @@ -95,6 +98,7 @@ public class PrimaryInfo { this.isContactPhotoShown = isContactPhotoShown; this.isWorkCall = isWorkCall; this.isSpam = isSpam; + this.isLocalContact = isLocalContact; this.answeringDisconnectsOngoingCall = answeringDisconnectsOngoingCall; this.shouldShowLocation = shouldShowLocation; this.contactInfoLookupKey = contactInfoLookupKey; -- cgit v1.2.3