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

Commit 1e607c9c authored by faust93's avatar faust93 Committed by Łukasz Patron
Browse files

RIL: Fix manual network selection with old modem

 * Old modem sends and applies mccmnc+network type, but new aosp
   telephony uses only digits.
 * Manually cut or append the "+" and strings after that to work around.

Change-Id: I1015e6c0d6afdc0c03d70e9491d49331703eddcc
parent 26b8abdd
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -238,6 +238,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

    final Integer mPhoneId;
    private List<String> mOldRilFeatures;
    private boolean mUseOldMncMccFormat;

    /**
     * A set that records if radio service is disabled in hal for
@@ -660,6 +661,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
        final String oldRilFeatures = SystemProperties.get("ro.telephony.ril.config", "");
        mOldRilFeatures = Arrays.asList(oldRilFeatures.split(","));

        mUseOldMncMccFormat = SystemProperties.getBoolean(
                "ro.telephony.use_old_mnc_mcc_format", false);

        TelephonyManager tm = (TelephonyManager) context.getSystemService(
                Context.TELEPHONY_SERVICE);
        mIsCellularSupported = tm.isVoiceCapable() || tm.isSmsCapable() || tm.isDataCapable();
@@ -2379,6 +2383,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, result,
                    mRILDefaultWorkSource);

            if (mUseOldMncMccFormat && !TextUtils.isEmpty(operatorNumeric)) {
                operatorNumeric += "+";
            }

            try {
                int halRan = convertAntToRan(ran);
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
+5 −1
Original line number Diff line number Diff line
@@ -2235,8 +2235,12 @@ public class RadioResponse extends IRadioResponse.Stub {
        if (rr != null) {
            ArrayList<OperatorInfo> ret = new ArrayList<OperatorInfo>();
            for (int i = 0; i < networkInfos.size(); i++) {
                String operatorNumeric = networkInfos.get(i).operatorNumeric;
                if (operatorNumeric != null) {
                    operatorNumeric = operatorNumeric.split("\\+")[0];
                }
                ret.add(new OperatorInfo(networkInfos.get(i).alphaLong,
                        networkInfos.get(i).alphaShort, networkInfos.get(i).operatorNumeric,
                        networkInfos.get(i).alphaShort, operatorNumeric,
                        convertOpertatorInfoToString(networkInfos.get(i).status)));
            }
            if (responseInfo.error == RadioError.NONE) {