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

Commit a6bc00af authored by faust93's avatar faust93 Committed by LuK1337
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 fba2df1d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -256,6 +256,8 @@ public class RIL extends BaseCommands implements CommandsInterface {

    final Integer mPhoneId;

    private boolean mUseOldMncMccFormat;

    private static final String PROPERTY_IS_VONR_ENABLED = "persist.radio.is_vonr_enabled_";

    /**
@@ -620,6 +622,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
            mRadioBugDetector = new RadioBugDetector(context, mPhoneId);
        }

        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();
@@ -2557,6 +2562,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
@@ -2576,8 +2576,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) {