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

Commit 8785c064 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change Ie5df08ef into eclair-mr2

* changes:
  Let PLUS occur once anywhere in dial-str network portion.
parents 2a2805b7 9e534153
Loading
Loading
Loading
Loading
+40 −4
Original line number Diff line number Diff line
@@ -206,6 +206,42 @@ public class PhoneNumberUtils
        return ret.toString();
    }

    /**
     * Extracts the network address portion and canonicalize.
     *
     * This function is equivalent to extractNetworkPortion(), except
     * for allowing the PLUS character to occur at arbitrary positions
     * in the address portion, not just the first position.
     *
     * @hide
     */
    public static String extractNetworkPortionAlt(String phoneNumber) {
        if (phoneNumber == null) {
            return null;
        }

        int len = phoneNumber.length();
        StringBuilder ret = new StringBuilder(len);
        boolean haveSeenPlus = false;

        for (int i = 0; i < len; i++) {
            char c = phoneNumber.charAt(i);
            if (c == '+') {
                if (haveSeenPlus) {
                    continue;
                }
                haveSeenPlus = true;
            }
            if (isDialable(c)) {
                ret.append(c);
            } else if (isStartsPostDial (c)) {
                break;
            }
        }

        return ret.toString();
    }

    /**
     * Strips separators from a phone number string.
     * @param phoneNumber phone number to strip.
@@ -590,7 +626,7 @@ public class PhoneNumberUtils
     */
    public static String
    toCallerIDMinMatch(String phoneNumber) {
        String np = extractNetworkPortion(phoneNumber);
        String np = extractNetworkPortionAlt(phoneNumber);
        return internalGetStrippedReversed(np, MIN_MATCH);
    }

@@ -603,7 +639,7 @@ public class PhoneNumberUtils
     */
    public static String
    getStrippedReversed(String phoneNumber) {
        String np = extractNetworkPortion(phoneNumber);
        String np = extractNetworkPortionAlt(phoneNumber);

        if (np == null) return null;

@@ -1247,7 +1283,7 @@ public class PhoneNumberUtils

        // Strip the separators from the number before comparing it
        // to the list.
        number = extractNetworkPortion(number);
        number = extractNetworkPortionAlt(number);

        // retrieve the list of emergency numbers
        String numbers = SystemProperties.get("ro.ril.ecclist");
@@ -1290,7 +1326,7 @@ public class PhoneNumberUtils

        // Strip the separators from the number before comparing it
        // to the list.
        number = extractNetworkPortion(number);
        number = extractNetworkPortionAlt(number);

        // compare tolerates null so we need to make sure that we
        // don't return true when both are null.
+1 −2
Original line number Diff line number Diff line
@@ -73,8 +73,7 @@ public class DriverCall implements Comparable {
            if (p.hasMore()) {
                // Some lame implementations return strings
                // like "NOT AVAILABLE" in the CLCC line
                ret.number = PhoneNumberUtils.extractNetworkPortion(
                                    p.nextString());
                ret.number = PhoneNumberUtils.extractNetworkPortionAlt(p.nextString());

                if (ret.number.length() == 0) {
                    ret.number = null;
+1 −1
Original line number Diff line number Diff line
@@ -1317,7 +1317,7 @@ public class CDMAPhone extends PhoneBase {
    @Override
    public  boolean isOtaSpNumber(String dialStr){
        boolean isOtaSpNum = false;
        String dialableStr = PhoneNumberUtils.extractNetworkPortion(dialStr);
        String dialableStr = PhoneNumberUtils.extractNetworkPortionAlt(dialStr);
        if (dialableStr != null) {
            isOtaSpNum = isIs683OtaSpDialStr(dialableStr);
            if (isOtaSpNum == false) {
+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ public class CdmaConnection extends Connection {
        dialString = formatDialString(dialString);
        Log.d(LOG_TAG, "[CDMAConn] CdmaConnection:formated dialString=" + dialString);

        this.address = PhoneNumberUtils.extractNetworkPortion(dialString);
        this.address = PhoneNumberUtils.extractNetworkPortionAlt(dialString);
        this.postDialString = PhoneNumberUtils.extractPostDialPortion(dialString);

        index = -1;
+1 −1
Original line number Diff line number Diff line
@@ -729,7 +729,7 @@ public class GSMPhone extends PhoneBase {
        }

        // Only look at the Network portion for mmi
        String networkPortion = PhoneNumberUtils.extractNetworkPortion(newDialString);
        String networkPortion = PhoneNumberUtils.extractNetworkPortionAlt(newDialString);
        GsmMmiCode mmi = GsmMmiCode.newFromDialString(networkPortion, this);
        if (LOCAL_DEBUG) Log.d(LOG_TAG,
                               "dialing w/ mmi '" + mmi + "'...");
Loading