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

Commit e8b0538e authored by Sarah Chin's avatar Sarah Chin Committed by Android (Google) Code Review
Browse files

Merge "Final integration work for IRadio AIDL"

parents 637907b6 4316731e
Loading
Loading
Loading
Loading
+38 −30
Original line number Diff line number Diff line
@@ -24,12 +24,10 @@ import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.hardware.radio.V1_0.IRadio;
import android.hardware.radio.V1_0.ImsSmsMessage;
import android.hardware.radio.V1_0.RadioError;
import android.hardware.radio.V1_0.RadioIndicationType;
import android.hardware.radio.V1_0.RadioResponseInfo;
import android.hardware.radio.V1_0.RadioResponseType;
import android.hardware.radio.V1_0.RadioTechnologyFamily;
import android.net.KeepalivePacketData;
import android.net.LinkProperties;
import android.os.AsyncResult;
@@ -265,11 +263,6 @@ public class RIL extends BaseCommands implements CommandsInterface {

    static final String[] HIDL_SERVICE_NAME = {"slot1", "slot2", "slot3"};

    static final int IRADIO_GET_SERVICE_DELAY_MILLIS = 4 * 1000;

    static final String EMPTY_ALPHA_LONG = "";
    static final String EMPTY_ALPHA_SHORT = "";

    public static List<TelephonyHistogram> getTelephonyRILTimingHistograms() {
        List<TelephonyHistogram> list;
        synchronized (sRilTimeHistograms) {
@@ -1023,11 +1016,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
        return rr;
    }

    private void handleRadioProxyExceptionForRR(RILRequest rr, String caller, Exception e) {
        // TODO: remove
        handleRadioProxyExceptionForRR(RADIO_SERVICE, caller, e);
    }

    private void handleRadioProxyExceptionForRR(int service, String caller, Exception e) {
        riljLoge(caller + ": " + e);
        e.printStackTrace();
@@ -3625,7 +3613,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                messagingProxy.sendImsSms(rr.mSerial, smscPdu, pdu, retry, messageRef);
                messagingProxy.sendImsSms(rr.mSerial, smscPdu, pdu, null, retry, messageRef);
                mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_IMS,
                        SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result));
            } catch (RemoteException | RuntimeException e) {
@@ -3636,8 +3624,9 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public void sendImsCdmaSms(byte[] pdu, int retry, int messageRef, Message result) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
        RadioMessagingProxy messagingProxy =
                getRadioServiceProxy(RadioMessagingProxy.class, result);
        if (!messagingProxy.isEmpty()) {
            RILRequest rr = obtainRequest(RIL_REQUEST_IMS_SEND_SMS, result, mRILDefaultWorkSource);

            // Do not log function args for privacy
@@ -3645,18 +3634,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
                riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
            }

            ImsSmsMessage msg = new ImsSmsMessage();
            msg.tech = RadioTechnologyFamily.THREE_GPP2;
            msg.retry = (byte) retry >= 1 ? true : false;
            msg.messageRef = messageRef;
            msg.cdmaMessage.add(RILUtils.convertToHalCdmaSmsMessage(pdu));

            try {
                radioProxy.sendImsSms(rr.mSerial, msg);
                messagingProxy.sendImsSms(rr.mSerial, null, null, pdu, retry, messageRef);
                mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_IMS,
                        SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result));
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "sendImsCdmaSms", e);
                handleRadioProxyExceptionForRR(MESSAGING_SERVICE, "sendImsCdmaSms", e);
            }
        }
    }
@@ -4034,6 +4017,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
            // We have a 1.2 or later radio, so the LCE 1.0 LCE service control path is unused.
            // Instead the LCE functionality is always-on and provides unsolicited indications.
            if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "startLceService: REQUEST_NOT_SUPPORTED");
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
            }
            return;
        }

@@ -4048,7 +4037,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            try {
                radioProxy.startLceService(rr.mSerial, reportIntervalMs, pullMode);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "startLceService", e);
                handleRadioProxyExceptionForRR(RADIO_SERVICE, "startLceService", e);
            }
        }
    }
@@ -4059,6 +4048,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
            // We have a 1.2 or later radio, so the LCE 1.0 LCE service control is unused.
            // Instead the LCE functionality is always-on and provides unsolicited indications.
            if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "stopLceService: REQUEST_NOT_SUPPORTED");
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
            }
            return;
        }

@@ -4072,7 +4067,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            try {
                radioProxy.stopLceService(rr.mSerial);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "stopLceService", e);
                handleRadioProxyExceptionForRR(RADIO_SERVICE, "stopLceService", e);
            }
        }
    }
@@ -4131,8 +4126,21 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Deprecated
    @Override
    public void pullLceData(Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
        if (!networkProxy.isEmpty()) {
        IRadio radioProxy = getRadioProxy(result);

        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
            // We have a 1.2 or later radio, so the LCE 1.0 LCE service control path is unused.
            // Instead the LCE functionality is always-on and provides unsolicited indications.
            if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "pullLceData: REQUEST_NOT_SUPPORTED");
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
            }
            return;
        }

        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_PULL_LCEDATA, result, mRILDefaultWorkSource);

            if (RILJ_LOGD) {
@@ -4140,9 +4148,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                networkProxy.pullLceData(rr.mSerial);
                radioProxy.pullLceData(rr.mSerial);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(NETWORK_SERVICE, "pullLceData", e);
                handleRadioProxyExceptionForRR(RADIO_SERVICE, "pullLceData", e);
            }
        }
    }
+8 −5
Original line number Diff line number Diff line
@@ -1003,7 +1003,7 @@ public class RILUtils {
        si.sliceServiceType = (byte) sliceInfo.getSliceServiceType();
        si.mappedHplmnSst = (byte) sliceInfo.getMappedHplmnSliceServiceType();
        si.sliceDifferentiator = sliceInfo.getSliceDifferentiator();
        si.mappedHplmnSD = sliceInfo.getMappedHplmnSliceDifferentiator();
        si.mappedHplmnSd = sliceInfo.getMappedHplmnSliceDifferentiator();
        return si;
    }

@@ -1442,7 +1442,6 @@ public class RILUtils {
        if ((raf & android.hardware.radio.V1_4.RadioAccessFamily.NR) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_NR;
        }
        // TODO: need hal definition
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN)) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_IWLAN;
        }
@@ -1505,6 +1504,9 @@ public class RILUtils {
        if ((networkTypeBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_TD_SCDMA) != 0) {
            raf |= android.hardware.radio.V1_0.RadioAccessFamily.TD_SCDMA;
        }
        if ((networkTypeBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_IWLAN) != 0) {
            raf |= (1 << android.hardware.radio.V1_4.RadioTechnology.IWLAN);
        }
        if ((networkTypeBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_LTE) != 0) {
            raf |= android.hardware.radio.V1_0.RadioAccessFamily.LTE;
        }
@@ -1514,7 +1516,6 @@ public class RILUtils {
        if ((networkTypeBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_NR) != 0) {
            raf |= android.hardware.radio.V1_4.RadioAccessFamily.NR;
        }
        // TODO: need hal definition for IWLAN
        return (raf == 0) ? android.hardware.radio.V1_4.RadioAccessFamily.UNKNOWN : raf;
    }

@@ -1574,6 +1575,9 @@ public class RILUtils {
        if ((networkTypeBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_TD_SCDMA) != 0) {
            raf |= android.hardware.radio.RadioAccessFamily.TD_SCDMA;
        }
        if ((networkTypeBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_IWLAN) != 0) {
            raf |= android.hardware.radio.RadioAccessFamily.IWLAN;
        }
        if ((networkTypeBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_LTE) != 0) {
            raf |= android.hardware.radio.RadioAccessFamily.LTE;
        }
@@ -1583,7 +1587,6 @@ public class RILUtils {
        if ((networkTypeBitmask & TelephonyManager.NETWORK_TYPE_BITMASK_NR) != 0) {
            raf |= android.hardware.radio.RadioAccessFamily.NR;
        }
        // TODO: need hal definition for IWLAN
        return (raf == 0) ? android.hardware.radio.RadioAccessFamily.UNKNOWN : raf;
    }

@@ -3602,7 +3605,7 @@ public class RILUtils {
                .setMappedHplmnSliceServiceType(si.mappedHplmnSst);
        if (si.sliceDifferentiator != NetworkSliceInfo.SLICE_DIFFERENTIATOR_NO_SLICE) {
            builder.setSliceDifferentiator(si.sliceDifferentiator)
                    .setMappedHplmnSliceDifferentiator(si.mappedHplmnSD);
                    .setMappedHplmnSliceDifferentiator(si.mappedHplmnSd);
        }
        return builder.build();
    }
+18 −6
Original line number Diff line number Diff line
@@ -288,14 +288,15 @@ public class RadioMessagingProxy extends RadioServiceProxy {
     * @param serial Serial number of request
     * @param smscPdu SMSC address in PDU form GSM BCD format prefixed by a length byte
     *                or NULL for default SMSC
     * @param pdu SMS in PDU format as an ASCII hex string less the SMSC address
     * @param gsmPdu SMS in PDU format as an ASCII hex string less the SMSC address
     * @param cdmaPdu CDMA-SMS in internal pseudo-PDU format
     * @param retry Whether this is a retry; 0 == not retry, nonzero = retry
     * @param messageRef MessageRef from RIL_SMS_RESPONSE corresponding to failed MO SMS
     *                   if retry is nonzero
     * @throws RemoteException
     */
    public void sendImsSms(int serial, String smscPdu, String pdu, int retry, int messageRef)
            throws RemoteException {
    public void sendImsSms(int serial, String smscPdu, String gsmPdu, byte[] cdmaPdu, int retry,
            int messageRef) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            android.hardware.radio.messaging.ImsSmsMessage msg =
@@ -303,8 +304,14 @@ public class RadioMessagingProxy extends RadioServiceProxy {
            msg.tech = android.hardware.radio.RadioTechnologyFamily.THREE_GPP;
            msg.retry = (byte) retry >= 1;
            msg.messageRef = messageRef;
            if (gsmPdu != null) {
                msg.gsmMessage = new android.hardware.radio.messaging.GsmSmsMessage[]{
                    RILUtils.convertToHalGsmSmsMessageAidl(smscPdu, pdu)};
                        RILUtils.convertToHalGsmSmsMessageAidl(smscPdu, gsmPdu)};
            }
            if (cdmaPdu != null) {
                msg.cdmaMessage = new android.hardware.radio.messaging.CdmaSmsMessage[]{
                        RILUtils.convertToHalCdmaSmsMessageAidl(cdmaPdu)};
            }
            mMessagingProxy.sendImsSms(serial, msg);
        } else {
            android.hardware.radio.V1_0.ImsSmsMessage msg =
@@ -312,7 +319,12 @@ public class RadioMessagingProxy extends RadioServiceProxy {
            msg.tech = android.hardware.radio.V1_0.RadioTechnologyFamily.THREE_GPP;
            msg.retry = (byte) retry >= 1;
            msg.messageRef = messageRef;
            msg.gsmMessage.add(RILUtils.convertToHalGsmSmsMessage(smscPdu, pdu));
            if (gsmPdu != null) {
                msg.gsmMessage.add(RILUtils.convertToHalGsmSmsMessage(smscPdu, gsmPdu));
            }
            if (cdmaPdu != null) {
                msg.cdmaMessage.add(RILUtils.convertToHalCdmaSmsMessage(cdmaPdu));
            }
            mRadioProxy.sendImsSms(serial, msg);
        }
    }
+0 −14
Original line number Diff line number Diff line
@@ -341,20 +341,6 @@ public class RadioNetworkProxy extends RadioServiceProxy {
        }
    }

    /**
     * Call IRadioNetwork#pullLceData
     * @param serial Serial number of request
     * @throws RemoteException
     */
    public void pullLceData(int serial) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mNetworkProxy.pullLceData(serial);
        } else {
            mRadioProxy.pullLceData(serial);
        }
    }

    /**
     * Call IRadioNetwork#responseAcknowledgement
     * @throws RemoteException
+1 −1
Original line number Diff line number Diff line
@@ -463,7 +463,7 @@ public class RadioSimProxy extends RadioServiceProxy {
     * Call IRadioSim#sendTerminalResponseToSim
     * @param serial Serial number of request
     * @param contents String containing SAT/USAT response in hexadecimal format starting with
     *                 command tag
     *                 first byte of response data
     * @throws RemoteException
     */
    public void sendTerminalResponseToSim(int serial, String contents) throws RemoteException {
Loading