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

Commit 63f47bb9 authored by Muralidhar Reddy's avatar Muralidhar Reddy
Browse files

Add MEP-A1 support in platform

Test: Manual test on Pixel 7, atest FrameworksTelephonyTests
Bug: 254866604
Change-Id: Ieef6c320d70ad8433af00444aff365a58a2a2d4c
parent a6574642
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -2126,6 +2126,27 @@ public interface CommandsInterface {
    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
            int p1, int p2, int p3, String data, Message response);

    /**
     * Exchange APDUs with the SIM on a logical channel.
     *
     * Input parameters equivalent to TS 27.007 AT+CGLA command.
     *
     * @param channel Channel id of the channel to use for communication. Has to
     *            be greater than zero.
     * @param cla Class of the APDU command.
     * @param instruction Instruction of the APDU command.
     * @param p1 P1 value of the APDU command.
     * @param p2 P2 value of the APDU command.
     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
     *            is sent to the SIM.
     * @param data Data to be sent with the APDU.
     * @param isEs10Command whether APDU command is an ES10 command or a regular APDU
     * @param response Callback message. response.obj.userObj will be
     *            an IccIoResult on success.
     */
    void iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
            int p1, int p2, int p3, String data, boolean isEs10Command, Message response);

    /**
     * Exchange APDUs with the SIM on a basic channel.
     *
+8 −1
Original line number Diff line number Diff line
@@ -4077,6 +4077,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction, int p1, int p2,
            int p3, String data, Message result) {
        iccTransmitApduLogicalChannel(channel, cla, instruction, p1, p2, p3, data, false, result);
    }

    @Override
    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction, int p1, int p2,
            int p3, String data, boolean isEs10Command, Message result) {
        if (channel <= 0) {
            throw new RuntimeException(
                    "Invalid channel in iccTransmitApduLogicalChannel: " + channel);
@@ -4093,6 +4099,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            + String.format(" channel = %d", channel)
                            + String.format(" cla = 0x%02X ins = 0x%02X", cla, instruction)
                            + String.format(" p1 = 0x%02X p2 = 0x%02X p3 = 0x%02X", p1, p2, p3)
                            + " isEs10Command = " + isEs10Command
                            + " data = " + data);
                } else {
                    riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
@@ -4101,7 +4108,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

            try {
                simProxy.iccTransmitApduLogicalChannel(
                        rr.mSerial, channel, cla, instruction, p1, p2, p3, data);
                        rr.mSerial, channel, cla, instruction, p1, p2, p3, data, isEs10Command);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "iccTransmitApduLogicalChannel", e);
            }
+14 −3
Original line number Diff line number Diff line
@@ -368,6 +368,7 @@ import com.android.internal.telephony.uicc.IccSimPortInfo;
import com.android.internal.telephony.uicc.IccSlotPortMapping;
import com.android.internal.telephony.uicc.IccSlotStatus;
import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.telephony.uicc.PortUtils;
import com.android.internal.telephony.uicc.SimPhonebookRecord;
import com.android.telephony.Rlog;

@@ -1822,10 +1823,12 @@ public class RILUtils {
     * @param p2 p2
     * @param p3 p3
     * @param data data
     * @param radioHalVersion radio hal version
     * @return The converted SimApdu
     */
    public static android.hardware.radio.sim.SimApdu convertToHalSimApduAidl(int channel, int cla,
            int instruction, int p1, int p2, int p3, String data) {
            int instruction, int p1, int p2, int p3, String data, boolean isEs10Command,
            HalVersion radioHalVersion) {
        android.hardware.radio.sim.SimApdu msg = new android.hardware.radio.sim.SimApdu();
        msg.sessionId = channel;
        msg.cla = cla;
@@ -1834,6 +1837,9 @@ public class RILUtils {
        msg.p2 = p2;
        msg.p3 = p3;
        msg.data = convertNullToEmptyString(data);
        if (radioHalVersion.greaterOrEqual(RIL.RADIO_HAL_VERSION_2_1)) {
            msg.isEs10 = isEs10Command;
        }
        return msg;
    }

@@ -4353,6 +4359,7 @@ public class RILUtils {
            android.hardware.radio.sim.CardStatus cardStatus) {
        IccCardStatus iccCardStatus = new IccCardStatus();
        iccCardStatus.setCardState(cardStatus.cardState);
        iccCardStatus.setMultipleEnabledProfilesMode(cardStatus.supportedMepMode);
        iccCardStatus.setUniversalPinState(cardStatus.universalPinState);
        iccCardStatus.mGsmUmtsSubscriptionAppIndex = cardStatus.gsmUmtsSubscriptionAppIndex;
        iccCardStatus.mCdmaSubscriptionAppIndex = cardStatus.cdmaSubscriptionAppIndex;
@@ -4380,7 +4387,9 @@ public class RILUtils {
        }
        IccSlotPortMapping slotPortMapping = new IccSlotPortMapping();
        slotPortMapping.mPhysicalSlotIndex = cardStatus.slotMap.physicalSlotId;
        slotPortMapping.mPortIndex = cardStatus.slotMap.portId;
        slotPortMapping.mPortIndex = PortUtils.convertFromHalPortIndex(
                cardStatus.slotMap.physicalSlotId, cardStatus.slotMap.portId,
                iccCardStatus.mCardState, iccCardStatus.mSupportedMepMode);
        iccCardStatus.mSlotPortMapping = slotPortMapping;
        return iccCardStatus;
    }
@@ -4496,6 +4505,7 @@ public class RILUtils {
                }
                iccSlotStatus.atr = slotStatus.atr;
                iccSlotStatus.eid = slotStatus.eid;
                iccSlotStatus.setMultipleEnabledProfilesMode(slotStatus.supportedMepMode);
                response.add(iccSlotStatus);
            }
            return response;
@@ -4563,7 +4573,8 @@ public class RILUtils {
            int logicalSlotIdx = mapping.getLogicalSlotIndex();
            res[logicalSlotIdx] = new android.hardware.radio.config.SlotPortMapping();
            res[logicalSlotIdx].physicalSlotId = mapping.getPhysicalSlotIndex();
            res[logicalSlotIdx].portId = mapping.getPortIndex();
            res[logicalSlotIdx].portId = PortUtils.convertToHalPortIndex(
                    mapping.getPhysicalSlotIndex(), mapping.getPortIndex());
        }
        return res;
    }
+25 −2
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ public class RadioSimProxy extends RadioServiceProxy {
            HalVersion newHalVersion;
            int version = sim.getInterfaceVersion();
            switch(version) {
                case 2:
                    newHalVersion = RIL.RADIO_HAL_VERSION_2_1;
                    break;
                default:
                    newHalVersion = RIL.RADIO_HAL_VERSION_2_0;
                    break;
@@ -373,7 +376,8 @@ public class RadioSimProxy extends RadioServiceProxy {
        if (isEmpty()) return;
        if (isAidl()) {
            mSimProxy.iccTransmitApduBasicChannel(serial,
                    RILUtils.convertToHalSimApduAidl(0, cla, instruction, p1, p2, p3, data));
                    RILUtils.convertToHalSimApduAidl(0, cla, instruction, p1, p2, p3, data,
                            false, mHalVersion));
        } else {
            mRadioProxy.iccTransmitApduBasicChannel(serial,
                    RILUtils.convertToHalSimApdu(0, cla, instruction, p1, p2, p3, data));
@@ -394,10 +398,29 @@ public class RadioSimProxy extends RadioServiceProxy {
     */
    public void iccTransmitApduLogicalChannel(int serial, int channel, int cla, int instruction,
            int p1, int p2, int p3, String data) throws RemoteException {
        iccTransmitApduLogicalChannel(serial, channel, cla, instruction, p1, p2, p3, data, false);
    }

    /**
     * Call IRadioSim#iccTransmitApduLogicalChannel
     * @param serial Serial number of request
     * @param channel Channel ID of the channel to use for communication
     * @param cla Class of the command
     * @param instruction Instruction of the command
     * @param p1 P1 value of the command
     * @param p2 P2 value of the command
     * @param p3 P3 value of the command
     * @param data Data to be sent
     * @param isEs10Command APDU is an isEs10 command or not
     * @throws RemoteException
     */
    public void iccTransmitApduLogicalChannel(int serial, int channel, int cla, int instruction,
            int p1, int p2, int p3, String data, boolean isEs10Command) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mSimProxy.iccTransmitApduLogicalChannel(serial,
                    RILUtils.convertToHalSimApduAidl(channel, cla, instruction, p1, p2, p3, data));
                    RILUtils.convertToHalSimApduAidl(channel, cla, instruction, p1, p2, p3, data,
                            isEs10Command, mHalVersion));
        } else {
            mRadioProxy.iccTransmitApduLogicalChannel(serial,
                    RILUtils.convertToHalSimApdu(channel, cla, instruction, p1, p2, p3, data));
+6 −0
Original line number Diff line number Diff line
@@ -609,6 +609,12 @@ class ImsPhoneCommandInterface extends BaseCommands implements CommandsInterface
    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
                                              int p1, int p2, int p3, String data,
                                              Message response) {}

    @Override
    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
                                              int p1, int p2, int p3, String data,
                                              boolean isEs10Command, Message response) {}

    @Override
    public void iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2,
                                            int p3, String data, Message response) {}
Loading