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

Commit 6ce2cce4 authored by arunvoddu's avatar arunvoddu
Browse files

Sending the carrier restriction rules to CP in CarrierInfo format in RADIO_HAL 2.2

Carrier.aidl is deprecated  in RADIO_HAL 2.2

Bug: 356526468
Test: Manually Verified
Flag: EXEMPT bugfix
Change-Id: Iae21e7c9e8d620b5a92d13b26e5255c0c3b559cc
parent 32b015b4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4374,9 +4374,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
            riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
                    + " params: " + carrierRestrictionRules);
        }

        radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "setAllowedCarriers", () -> {
            simProxy.setAllowedCarriers(rr.mSerial, carrierRestrictionRules);
            simProxy.setAllowedCarriers(rr.mSerial, carrierRestrictionRules,
                    getHalVersion(HAL_SERVICE_SIM));
        });
    }

+25 −0
Original line number Diff line number Diff line
@@ -1943,6 +1943,31 @@ public class RILUtils {
        return result;
    }

    /**
     * Convert a list of CarrierIdentifiers into an array of CarrierInfo.aidl
     *
     * @param carriers List of CarrierIdentifiers
     * @return The converted array of CarrierInfos.
     */
    public static android.hardware.radio.sim.CarrierInfo[] convertToHalCarrierInfoListAidl(
            List<CarrierIdentifier> carriers) {
        android.hardware.radio.sim.CarrierInfo[] result =
                new android.hardware.radio.sim.CarrierInfo[carriers.size()];
        for (int i = 0; i < carriers.size(); i++) {
            CarrierIdentifier ci = carriers.get(i);
            android.hardware.radio.sim.CarrierInfo carrierInfo =
                    new android.hardware.radio.sim.CarrierInfo();
            carrierInfo.mcc = convertNullToEmptyString(ci.getMcc());
            carrierInfo.mnc = convertNullToEmptyString(ci.getMnc());
            carrierInfo.spn = ci.getSpn();
            carrierInfo.imsiPrefix = ci.getImsi();
            carrierInfo.gid1 = ci.getGid1();
            carrierInfo.gid2 = ci.getGid2();
            result[i] = carrierInfo;
        }
        return result;
    }

    /**
     * Convert to Dial defined in radio/1.0/types.hal
     * @param address Address
+27 −9
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.telephony.Rlog;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubState;
import com.android.internal.telephony.uicc.SimPhonebookRecord;

import java.util.Collections;

/**
 * A holder for IRadioSim.
 * Use getAidl to get IRadioSim and call the AIDL implementations of the HAL APIs.
@@ -512,21 +514,36 @@ public class RadioSimProxy extends RadioServiceProxy {

    /**
     * Call IRadioSim#setAllowedCarriers
     *
     * @param serial                  Serial number of request
     * @param carrierRestrictionRules Allowed carriers
     * @throws RemoteException
     */
    public void setAllowedCarriers(int serial, CarrierRestrictionRules carrierRestrictionRules)
            throws RemoteException {
    public void setAllowedCarriers(int serial, CarrierRestrictionRules carrierRestrictionRules,
            HalVersion halversion) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            // Prepare structure with allowed list, excluded list and priority
            android.hardware.radio.sim.CarrierRestrictions carrierRestrictions =
                    new android.hardware.radio.sim.CarrierRestrictions();
            carrierRestrictions.allowedCarriers = RILUtils.convertToHalCarrierRestrictionListAidl(
            if (halversion.greaterOrEqual(RIL.RADIO_HAL_VERSION_2_2)) {
                carrierRestrictions.allowedCarrierInfoList =
                        RILUtils.convertToHalCarrierInfoListAidl(
                                carrierRestrictionRules.getAllowedCarriers());
            carrierRestrictions.excludedCarriers = RILUtils.convertToHalCarrierRestrictionListAidl(
                carrierRestrictions.excludedCarrierInfoList =
                        RILUtils.convertToHalCarrierInfoListAidl(
                                carrierRestrictionRules.getExcludedCarriers());
                carrierRestrictions.allowedCarriers =
                        RILUtils.convertToHalCarrierRestrictionListAidl(Collections.EMPTY_LIST);
                carrierRestrictions.excludedCarriers =
                        RILUtils.convertToHalCarrierRestrictionListAidl(Collections.EMPTY_LIST);
            } else {
                // Prepare structure with allowed list, excluded list and priority
                carrierRestrictions.allowedCarriers =
                        RILUtils.convertToHalCarrierRestrictionListAidl(
                                carrierRestrictionRules.getAllowedCarriers());
                carrierRestrictions.excludedCarriers =
                        RILUtils.convertToHalCarrierRestrictionListAidl(
                                carrierRestrictionRules.getExcludedCarriers());
            }
            carrierRestrictions.allowedCarriersPrioritized =
                    (carrierRestrictionRules.getDefaultCarrierRestriction()
                            == CarrierRestrictionRules.CARRIER_RESTRICTION_DEFAULT_NOT_ALLOWED);
@@ -534,6 +551,7 @@ public class RadioSimProxy extends RadioServiceProxy {
            mSimProxy.setAllowedCarriers(serial, carrierRestrictions,
                    RILUtils.convertToHalSimLockMultiSimPolicyAidl(
                            carrierRestrictionRules.getMultiSimPolicy()));
            Rlog.d(TAG, "RadioSimProxy setAllowedCarriers params = " + carrierRestrictions);
        } else {
            // Prepare structure with allowed list, excluded list and priority
            android.hardware.radio.V1_4.CarrierRestrictionsWithPriority carrierRestrictions =