Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c86b462 authored by Magnus Karlsson's avatar Magnus Karlsson Committed by Michael Bestas
Browse files

Fix order of '+' in call forwarding return result in RTL locales

The '+' is presented at the end of the phone number
instead of in the front.
Phone numbers should be presented left-to-right even
for right-to-left oriented languages (e.g. Hebrew),
hence the '+' should be placed accordingly.

Change-Id: I07d89078de4d81609e08099f93fc929a81ec172b
parent 527b36d0
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
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;

@@ -1433,7 +1435,8 @@ public final class GsmMmiCode extends Handler implements MmiCode {
        //      {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 &&
@@ -1449,6 +1452,13 @@ public final class GsmMmiCode extends Handler implements MmiCode {
        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) {