diff options
author | wangqi <wangqi@google.com> | 2017-09-25 14:23:15 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-09-26 08:38:38 -0700 |
commit | bc4263efe87601a483bdc0959df16e6de5bba902 (patch) | |
tree | 0120aecad5243f68ace47f881f086405fd21095f | |
parent | 727f602e81db45b2840836fd7206114da81f08e1 (diff) |
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
-rw-r--r-- | java/com/android/incallui/contactgrid/TopRow.java | 11 |
1 files changed, 7 insertions, 4 deletions
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)) { |