From bc4263efe87601a483bdc0959df16e6de5bba902 Mon Sep 17 00:00:00 2001 From: wangqi Date: Mon, 25 Sep 2017 14:23:15 -0700 Subject: Fix bug that phone number is not shown for non-contacts. (CNAP, business etc.) Phone number should always be shown for non-contacts. Screenshots: https://screenshot.googleplex.com/guKEWdQKDpG https://screenshot.googleplex.com/iMcPte5Vhyc Bug: 64685156 Test: TopRowTest PiperOrigin-RevId: 169961072 Change-Id: Iaf8fc5b1e7f3d386d20deb01f4325efb5e645363 --- java/com/android/incallui/contactgrid/TopRow.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'java/com/android/incallui') diff --git a/java/com/android/incallui/contactgrid/TopRow.java b/java/com/android/incallui/contactgrid/TopRow.java index 12a118491..8f54266f3 100644 --- a/java/com/android/incallui/contactgrid/TopRow.java +++ b/java/com/android/incallui/contactgrid/TopRow.java @@ -79,7 +79,7 @@ public class TopRow { label = getLabelForIncoming(context, state); // Show phone number if it's not displayed in name (center row) or location field (bottom // row). - if (shouldShowNumber(primaryInfo)) { + if (shouldShowNumber(primaryInfo, true /* isIncoming */)) { label = TextUtils.concat(label, " ", spanDisplayNumber(primaryInfo.number)); } } @@ -94,7 +94,8 @@ public class TopRow { label = getLabelForDialing(context, state); } else if (state.state == State.ACTIVE && state.isRemotelyHeld) { label = context.getString(R.string.incall_remotely_held); - } else if (state.state == State.ACTIVE && shouldShowNumber(primaryInfo)) { + } else if (state.state == State.ACTIVE + && shouldShowNumber(primaryInfo, false /* isIncoming */)) { label = spanDisplayNumber(primaryInfo.number); } else if (state.state == State.CALL_PENDING && !TextUtils.isEmpty(state.customLabel)) { label = state.customLabel; @@ -112,11 +113,13 @@ public class TopRow { BidiFormatter.getInstance().unicodeWrap(displayNumber, TextDirectionHeuristics.LTR)); } - private static boolean shouldShowNumber(PrimaryInfo primaryInfo) { + private static boolean shouldShowNumber(PrimaryInfo primaryInfo, boolean isIncoming) { if (primaryInfo.nameIsNumber) { return false; } - if (primaryInfo.location == null) { + // Don't show number since it's already shown in bottom row of incoming screen if there is no + // location info. + if (primaryInfo.location == null && isIncoming) { return false; } if (TextUtils.isEmpty(primaryInfo.number)) { -- cgit v1.2.3