diff options
author | linyuh <linyuh@google.com> | 2018-05-31 20:59:05 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-01 18:19:51 -0700 |
commit | f85644637b808d6a88886e462c1f8fd5f53a6f2f (patch) | |
tree | 6ed1c44ef3a167b27693831b00037db65b8f056c /java/com/android/incallui | |
parent | f0d515573aa65c265ccb104ca982a5ccfbd0fa24 (diff) |
Solve BiDi problem when phone number is concatenated with RTL-string
Solves BiDi problem that might cause phone number to be displayed
incorrectly in the dialer. Issue might occur when a phone number
is concatenated with a custom number label containing an RTL-string.
Solved by changing affected labels from TextView to BidiTextView.
Removed function spanDisplayNumber in BottomRow which are now obsolete.
Updates the DialerBidiFormatter to prevent whitespace to be misplaced
within a BidiTextView.
BUG=78464687
TEST=Manual
Public-Origin-Change-Id: I789a6f76a5ca805c03a437813ce627eef7a0bf2e
Signed-off-by: Linyu He <linyuh@google.com>
Author: Torbjorn Eklund <torbjorn.eklund@sony.com>
Bug: 78464687
Test: Manual
PiperOrigin-RevId: 198823629
Change-Id: Id35c3ebf514609b4a1fe10a7ae5a297bde7c7456
Diffstat (limited to 'java/com/android/incallui')
3 files changed, 5 insertions, 13 deletions
diff --git a/java/com/android/incallui/contactgrid/BottomRow.java b/java/com/android/incallui/contactgrid/BottomRow.java index 7388c50a8..767d66668 100644 --- a/java/com/android/incallui/contactgrid/BottomRow.java +++ b/java/com/android/incallui/contactgrid/BottomRow.java @@ -18,9 +18,6 @@ package com.android.incallui.contactgrid; import android.content.Context; import android.support.annotation.Nullable; -import android.telephony.PhoneNumberUtils; -import android.text.BidiFormatter; -import android.text.TextDirectionHeuristics; import android.text.TextUtils; import com.android.incallui.call.state.DialerCallState; import com.android.incallui.incall.protocol.PrimaryCallState; @@ -118,21 +115,15 @@ public class BottomRow { return primaryInfo.location(); } if (!primaryInfo.nameIsNumber() && !TextUtils.isEmpty(primaryInfo.number())) { - CharSequence spannedNumber = spanDisplayNumber(primaryInfo.number()); if (primaryInfo.label() == null) { - return spannedNumber; + return primaryInfo.number(); } else { - return TextUtils.concat(primaryInfo.label(), " ", spannedNumber); + return TextUtils.concat(primaryInfo.label(), " ", primaryInfo.number()); } } return null; } - private static CharSequence spanDisplayNumber(String displayNumber) { - return PhoneNumberUtils.createTtsSpannable( - BidiFormatter.getInstance().unicodeWrap(displayNumber, TextDirectionHeuristics.LTR)); - } - private static boolean isIncoming(PrimaryCallState state) { return state.state() == DialerCallState.INCOMING || state.state() == DialerCallState.CALL_WAITING; diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java index 86d71141c..e375bd574 100644 --- a/java/com/android/incallui/contactgrid/ContactGridManager.java +++ b/java/com/android/incallui/contactgrid/ContactGridManager.java @@ -40,6 +40,7 @@ import com.android.dialer.glidephotomanager.GlidePhotoManagerComponent; import com.android.dialer.glidephotomanager.PhotoInfo; import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.util.DrawableConverter; +import com.android.dialer.widget.BidiTextView; import com.android.incallui.incall.protocol.ContactPhotoType; import com.android.incallui.incall.protocol.PrimaryCallState; import com.android.incallui.incall.protocol.PrimaryInfo; @@ -77,7 +78,7 @@ public class ContactGridManager { private final TextView forwardedNumberView; private final ImageView spamIconImageView; private final ViewAnimator bottomTextSwitcher; - private final TextView bottomTextView; + private final BidiTextView bottomTextView; private final Chronometer bottomTimerView; private final Space topRowSpace; private int avatarSize; diff --git a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml index ce355ea2d..73db41314 100644 --- a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml +++ b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml @@ -53,7 +53,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="2dp" android:measureAllChildren="false"> - <TextView + <com.android.dialer.widget.BidiTextView android:id="@+id/contactgrid_bottom_text" android:layout_width="wrap_content" android:layout_height="wrap_content" |