Fix the bug that number format is not correct in RTL mode.
Bug: 76227259
Test: manual
PiperOrigin-RevId: 191347301
Change-Id: I18d63f4e85ca07be00f7564a5ee256d3a6b1b480
diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java
index 2f88c88..1f7a0d3 100644
--- a/java/com/android/incallui/CallCardPresenter.java
+++ b/java/com/android/incallui/CallCardPresenter.java
@@ -36,6 +36,8 @@
import android.telecom.Call.Details;
import android.telecom.StatusHints;
import android.telecom.TelecomManager;
+import android.text.BidiFormatter;
+import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
import android.view.Display;
import android.view.View;
@@ -987,7 +989,10 @@
ContactDisplayUtils.getPreferredDisplayName(
contactInfo.namePrimary, contactInfo.nameAlternative, contactsPreferences);
if (TextUtils.isEmpty(preferredName)) {
- return contactInfo.number;
+ return TextUtils.isEmpty(contactInfo.number)
+ ? null
+ : BidiFormatter.getInstance()
+ .unicodeWrap(contactInfo.number, TextDirectionHeuristics.LTR);
}
return preferredName;
}