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

Commit 5a03d17b authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6286840 from 1591e841 to rvc-release

Change-Id: I3c90ce045750f567391d3ac5a8a8b8a23b22a0a8
parents 3f90e4a6 1591e841
Loading
Loading
Loading
Loading
+27 −5
Original line number Original line Diff line number Diff line
@@ -271,7 +271,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {


            ret = new GsmMmiCode(phone, app);
            ret = new GsmMmiCode(phone, app);
            ret.mPoundString = dialString;
            ret.mPoundString = dialString;
        } else if (isTwoDigitShortCode(phone.getContext(), dialString)) {
        } else if (isTwoDigitShortCode(phone.getContext(), phone.getSubId(), dialString)) {
            //Is a country-specific exception to short codes as defined in TS 22.030, 6.5.3.2
            //Is a country-specific exception to short codes as defined in TS 22.030, 6.5.3.2
            ret = null;
            ret = null;
        } else if (isShortCode(dialString, phone)) {
        } else if (isShortCode(dialString, phone)) {
@@ -703,15 +703,16 @@ public final class GsmMmiCode extends Handler implements MmiCode {
        return mPoundString;
        return mPoundString;
    }
    }


    static private boolean
    /**
    isTwoDigitShortCode(Context context, String dialString) {
     * Check if the dial string match the two digital number pattern which defined by Carrier.
     */
    public static boolean isTwoDigitShortCode(Context context, int subId, String dialString) {
        Rlog.d(LOG_TAG, "isTwoDigitShortCode");
        Rlog.d(LOG_TAG, "isTwoDigitShortCode");


        if (dialString == null || dialString.length() > 2) return false;
        if (dialString == null || dialString.length() > 2) return false;


        if (sTwoDigitNumberPattern == null) {
        if (sTwoDigitNumberPattern == null) {
            sTwoDigitNumberPattern = context.getResources().getStringArray(
            sTwoDigitNumberPattern = getTwoDigitNumberPattern(context, subId);
                    com.android.internal.R.array.config_twoDigitNumberPattern);
        }
        }


        for (String dialnumber : sTwoDigitNumberPattern) {
        for (String dialnumber : sTwoDigitNumberPattern) {
@@ -725,6 +726,27 @@ public final class GsmMmiCode extends Handler implements MmiCode {
        return false;
        return false;
    }
    }


    private static String[] getTwoDigitNumberPattern(Context context, int subId) {
        Rlog.d(LOG_TAG, "Get two digit number pattern: subId=" + subId);
        String[] twoDigitNumberPattern = null;
        CarrierConfigManager configManager = (CarrierConfigManager)
                context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
        if (configManager != null) {
            PersistableBundle bundle = configManager.getConfigForSubId(subId);
            if (bundle != null) {
                Rlog.d(LOG_TAG, "Two Digit Number Pattern from carrir config");
                twoDigitNumberPattern = bundle.getStringArray(CarrierConfigManager
                        .KEY_MMI_TWO_DIGIT_NUMBER_PATTERN_STRING_ARRAY);
            }
        }

        // Do NOT return null array
        if (twoDigitNumberPattern == null) {
            twoDigitNumberPattern = new String[0];
        }
        return twoDigitNumberPattern;
    }

    /**
    /**
     * Helper function for newFromDialString. Returns true if dialString appears
     * Helper function for newFromDialString. Returns true if dialString appears
     * to be a short code AND conditions are correct for it to be treated as
     * to be a short code AND conditions are correct for it to be treated as
+3 −23
Original line number Original line Diff line number Diff line
@@ -51,6 +51,7 @@ import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.MmiCode;
import com.android.internal.telephony.MmiCode;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.gsm.GsmMmiCode;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.telephony.Rlog;
import com.android.telephony.Rlog;


@@ -294,7 +295,8 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {


            ret = new ImsPhoneMmiCode(phone);
            ret = new ImsPhoneMmiCode(phone);
            ret.mPoundString = dialString;
            ret.mPoundString = dialString;
        } else if (isTwoDigitShortCode(phone.getContext(), dialString)) {
        } else if (GsmMmiCode.isTwoDigitShortCode(phone.getContext(), phone.getSubId(),
                dialString)) {
            //Is a country-specific exception to short codes as defined in TS 22.030, 6.5.3.2
            //Is a country-specific exception to short codes as defined in TS 22.030, 6.5.3.2
            ret = null;
            ret = null;
        } else if (isShortCode(dialString, phone)) {
        } else if (isShortCode(dialString, phone)) {
@@ -584,28 +586,6 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {
        return mPoundString;
        return mPoundString;
    }
    }


    static private boolean
    isTwoDigitShortCode(Context context, String dialString) {
        Rlog.d(LOG_TAG, "isTwoDigitShortCode");

        if (dialString == null || dialString.length() > 2) return false;

        if (sTwoDigitNumberPattern == null) {
            sTwoDigitNumberPattern = context.getResources().getStringArray(
                    com.android.internal.R.array.config_twoDigitNumberPattern);
        }

        for (String dialnumber : sTwoDigitNumberPattern) {
            Rlog.d(LOG_TAG, "Two Digit Number Pattern " + dialnumber);
            if (dialString.equals(dialnumber)) {
                Rlog.d(LOG_TAG, "Two Digit Number Pattern -true");
                return true;
            }
        }
        Rlog.d(LOG_TAG, "Two Digit Number Pattern -false");
        return false;
    }

    /**
    /**
     * Helper function for newFromDialString. Returns true if dialString appears
     * Helper function for newFromDialString. Returns true if dialString appears
     * to be a short code AND conditions are correct for it to be treated as
     * to be a short code AND conditions are correct for it to be treated as