Merge "Fix order of '+' in call forwarding return result in RTL locales"
diff --git a/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java b/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java
index c2bafbe..7927c82 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java
@@ -26,6 +26,8 @@
import android.os.*;
import android.telephony.PhoneNumberUtils;
import android.text.SpannableStringBuilder;
+import android.text.BidiFormatter;
+import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
import android.telephony.Rlog;
@@ -1260,7 +1262,8 @@
// {2} is time in seconds
destinations[0] = serviceClassToCFString(info.serviceClass & serviceClassMask);
- destinations[1] = PhoneNumberUtils.stringFromStringAndTOA(info.number, info.toa);
+ destinations[1] = formatLtr(
+ PhoneNumberUtils.stringFromStringAndTOA(info.number, info.toa));
destinations[2] = Integer.toString(info.timeSeconds);
if (info.reason == CommandsInterface.CF_REASON_UNCONDITIONAL &&
@@ -1275,6 +1278,13 @@
return TextUtils.replace(template, sources, destinations);
}
+ /**
+ * Used to format a string that should be displayed as LTR even in RTL locales
+ */
+ private String formatLtr(String str) {
+ BidiFormatter fmt = BidiFormatter.getInstance();
+ return str == null ? str : fmt.unicodeWrap(str, TextDirectionHeuristics.LTR, true);
+ }
private void
onQueryCfComplete(AsyncResult ar) {