Search in sources :

Example 46 with IRadio

use of android.hardware.radio.V1_0.IRadio in project android_frameworks_opt_telephony by LineageOS.

the class RIL method setSignalStrengthReportingCriteria.

@Override
public void setSignalStrengthReportingCriteria(SignalThresholdInfo signalThresholdInfo, int ran, Message result) {
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        if (mRadioVersion.less(RADIO_HAL_VERSION_1_2)) {
            riljLoge("setSignalStrengthReportingCriteria ignored on IRadio version less " + "than 1.2");
            return;
        }
        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2) && mRadioVersion.less(RADIO_HAL_VERSION_1_5)) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA, result, mRILDefaultWorkSource);
            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
            }
            try {
                android.hardware.radio.V1_2.IRadio radioProxy12 = (android.hardware.radio.V1_2.IRadio) radioProxy;
                radioProxy12.setSignalStrengthReportingCriteria(rr.mSerial, signalThresholdInfo.getHysteresisMs(), signalThresholdInfo.getHysteresisDb(), primitiveArrayToArrayList(signalThresholdInfo.getThresholds()), convertAntToHalAnt(ran));
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setSignalStrengthReportingCriteria", e);
            }
        }
        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA, result, mRILDefaultWorkSource);
            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
            }
            try {
                android.hardware.radio.V1_5.IRadio radioProxy15 = (android.hardware.radio.V1_5.IRadio) radioProxy;
                radioProxy15.setSignalStrengthReportingCriteria_1_5(rr.mSerial, convertToHalSignalThresholdInfo(signalThresholdInfo), convertAntToHalAnt(ran));
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setSignalStrengthReportingCriteria_1_5", e);
            }
        }
    }
}
Also used : IRadio(android.hardware.radio.V1_0.IRadio) RemoteException(android.os.RemoteException)

Example 47 with IRadio

use of android.hardware.radio.V1_0.IRadio in project android_frameworks_opt_telephony by LineageOS.

the class RIL method nvWriteItem.

@Override
public void nvWriteItem(int itemId, String itemValue, Message result, WorkSource workSource) {
    workSource = getDeafultWorkSourceIfInvalid(workSource);
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        RILRequest rr = obtainRequest(RIL_REQUEST_NV_WRITE_ITEM, result, workSource);
        if (RILJ_LOGD) {
            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " itemId = " + itemId + " itemValue = " + itemValue);
        }
        NvWriteItem item = new NvWriteItem();
        item.itemId = itemId;
        item.value = convertNullToEmptyString(itemValue);
        try {
            radioProxy.nvWriteItem(rr.mSerial, item);
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "nvWriteItem", e);
        }
    }
}
Also used : IRadio(android.hardware.radio.V1_0.IRadio) NvWriteItem(android.hardware.radio.V1_0.NvWriteItem) RemoteException(android.os.RemoteException)

Example 48 with IRadio

use of android.hardware.radio.V1_0.IRadio in project android_frameworks_opt_telephony by LineageOS.

the class RIL method startNetworkScan.

/**
 * Radio HAL fallback compatibility feature (b/151106728) assumes that the input parameter
 * networkScanRequest is immutable (read-only) here. Once the caller invokes the method, the
 * parameter networkScanRequest should not be modified. This helps us keep a consistent and
 * simple data model that avoid copying it in the scan result.
 */
@Override
public void startNetworkScan(NetworkScanRequest networkScanRequest, Message result) {
    final NetworkScanRequest nsr = networkScanRequest;
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        HalVersion overrideHalVersion = getCompatVersion(RIL_REQUEST_START_NETWORK_SCAN);
        if (RILJ_LOGD) {
            riljLog("startNetworkScan: overrideHalVersion=" + overrideHalVersion);
        }
        if ((overrideHalVersion == null || overrideHalVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) && mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
            android.hardware.radio.V1_5.NetworkScanRequest request = new android.hardware.radio.V1_5.NetworkScanRequest();
            request.type = nsr.getScanType();
            request.interval = nsr.getSearchPeriodicity();
            request.maxSearchTime = nsr.getMaxSearchTime();
            request.incrementalResultsPeriodicity = nsr.getIncrementalResultsPeriodicity();
            request.incrementalResults = nsr.getIncrementalResults();
            for (RadioAccessSpecifier ras : nsr.getSpecifiers()) {
                android.hardware.radio.V1_5.RadioAccessSpecifier rasInHalFormat = convertRadioAccessSpecifierToRadioHAL_1_5(ras);
                if (rasInHalFormat == null) {
                    AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                    result.sendToTarget();
                    return;
                }
                request.specifiers.add(rasInHalFormat);
            }
            request.mccMncs.addAll(nsr.getPlmns());
            RILRequest rr = obtainRequest(RIL_REQUEST_START_NETWORK_SCAN, result, mRILDefaultWorkSource, nsr);
            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
            }
            try {
                android.hardware.radio.V1_5.IRadio radioProxy15 = (android.hardware.radio.V1_5.IRadio) radioProxy;
                radioProxy15.startNetworkScan_1_5(rr.mSerial, request);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "startNetworkScan", e);
            }
        } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
            android.hardware.radio.V1_2.NetworkScanRequest request = new android.hardware.radio.V1_2.NetworkScanRequest();
            request.type = nsr.getScanType();
            request.interval = nsr.getSearchPeriodicity();
            request.maxSearchTime = nsr.getMaxSearchTime();
            request.incrementalResultsPeriodicity = nsr.getIncrementalResultsPeriodicity();
            request.incrementalResults = nsr.getIncrementalResults();
            for (RadioAccessSpecifier ras : nsr.getSpecifiers()) {
                android.hardware.radio.V1_1.RadioAccessSpecifier rasInHalFormat = convertRadioAccessSpecifierToRadioHAL(ras);
                if (rasInHalFormat == null) {
                    AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                    result.sendToTarget();
                    return;
                }
                request.specifiers.add(rasInHalFormat);
            }
            request.mccMncs.addAll(nsr.getPlmns());
            RILRequest rr = obtainRequest(RIL_REQUEST_START_NETWORK_SCAN, result, mRILDefaultWorkSource);
            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
            }
            try {
                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
                    android.hardware.radio.V1_4.IRadio radioProxy14 = (android.hardware.radio.V1_4.IRadio) radioProxy;
                    radioProxy14.startNetworkScan_1_4(rr.mSerial, request);
                } else {
                    android.hardware.radio.V1_2.IRadio radioProxy12 = (android.hardware.radio.V1_2.IRadio) radioProxy;
                    radioProxy12.startNetworkScan_1_2(rr.mSerial, request);
                }
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "startNetworkScan", e);
            }
        } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
            android.hardware.radio.V1_1.IRadio radioProxy11 = (android.hardware.radio.V1_1.IRadio) radioProxy;
            android.hardware.radio.V1_1.NetworkScanRequest request = new android.hardware.radio.V1_1.NetworkScanRequest();
            request.type = nsr.getScanType();
            request.interval = nsr.getSearchPeriodicity();
            for (RadioAccessSpecifier ras : nsr.getSpecifiers()) {
                android.hardware.radio.V1_1.RadioAccessSpecifier rasInHalFormat = convertRadioAccessSpecifierToRadioHAL(ras);
                if (rasInHalFormat == null) {
                    AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                    result.sendToTarget();
                    return;
                }
                request.specifiers.add(rasInHalFormat);
            }
            RILRequest rr = obtainRequest(RIL_REQUEST_START_NETWORK_SCAN, result, mRILDefaultWorkSource);
            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
            }
            try {
                radioProxy11.startNetworkScan(rr.mSerial, request);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "startNetworkScan", e);
            }
        } else if (result != null) {
            AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
            result.sendToTarget();
        }
    }
}
Also used : RadioAccessSpecifier(android.telephony.RadioAccessSpecifier) IRadio(android.hardware.radio.V1_0.IRadio) NetworkScanRequest(android.telephony.NetworkScanRequest) RemoteException(android.os.RemoteException)

Example 49 with IRadio

use of android.hardware.radio.V1_0.IRadio in project android_frameworks_opt_telephony by LineageOS.

the class RIL method setAllowedCarriers.

@Override
public void setAllowedCarriers(CarrierRestrictionRules carrierRestrictionRules, Message result, WorkSource workSource) {
    riljLog("RIL.java - setAllowedCarriers");
    checkNotNull(carrierRestrictionRules, "Carrier restriction cannot be null.");
    workSource = getDeafultWorkSourceIfInvalid(workSource);
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy == null)
        return;
    RILRequest rr = obtainRequest(RIL_REQUEST_SET_ALLOWED_CARRIERS, result, workSource);
    if (RILJ_LOGD) {
        riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " params: " + carrierRestrictionRules);
    }
    // Extract multisim policy
    int policy = SimLockMultiSimPolicy.NO_MULTISIM_POLICY;
    switch(carrierRestrictionRules.getMultiSimPolicy()) {
        case CarrierRestrictionRules.MULTISIM_POLICY_ONE_VALID_SIM_MUST_BE_PRESENT:
            policy = SimLockMultiSimPolicy.ONE_VALID_SIM_MUST_BE_PRESENT;
            break;
    }
    if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
        riljLog("RIL.java - Using IRadio 1.4 or greater");
        android.hardware.radio.V1_4.IRadio radioProxy14 = (android.hardware.radio.V1_4.IRadio) radioProxy;
        // Prepare structure with allowed list, excluded list and priority
        CarrierRestrictionsWithPriority carrierRestrictions = new CarrierRestrictionsWithPriority();
        carrierRestrictions.allowedCarriers = createCarrierRestrictionList(carrierRestrictionRules.getAllowedCarriers());
        carrierRestrictions.excludedCarriers = createCarrierRestrictionList(carrierRestrictionRules.getExcludedCarriers());
        carrierRestrictions.allowedCarriersPrioritized = (carrierRestrictionRules.getDefaultCarrierRestriction() == CarrierRestrictionRules.CARRIER_RESTRICTION_DEFAULT_NOT_ALLOWED);
        try {
            radioProxy14.setAllowedCarriers_1_4(rr.mSerial, carrierRestrictions, policy);
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "setAllowedCarriers_1_4", e);
        }
    } else {
        boolean isAllCarriersAllowed = carrierRestrictionRules.isAllCarriersAllowed();
        boolean supported = (isAllCarriersAllowed || (carrierRestrictionRules.getExcludedCarriers().isEmpty() && (carrierRestrictionRules.getDefaultCarrierRestriction() == CarrierRestrictionRules.CARRIER_RESTRICTION_DEFAULT_NOT_ALLOWED)));
        supported = supported && (policy == SimLockMultiSimPolicy.NO_MULTISIM_POLICY);
        if (!supported) {
            // Feature is not supported by IRadio interface
            riljLoge("setAllowedCarriers does not support excluded list on IRadio version" + " less than 1.4");
            if (result != null) {
                AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
            }
            return;
        }
        riljLog("RIL.java - Using IRadio 1.3 or lower");
        // Prepare structure with allowed list
        CarrierRestrictions carrierRestrictions = new CarrierRestrictions();
        carrierRestrictions.allowedCarriers = createCarrierRestrictionList(carrierRestrictionRules.getAllowedCarriers());
        try {
            radioProxy.setAllowedCarriers(rr.mSerial, isAllCarriersAllowed, carrierRestrictions);
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "setAllowedCarriers", e);
        }
    }
}
Also used : CarrierRestrictionsWithPriority(android.hardware.radio.V1_4.CarrierRestrictionsWithPriority) IRadio(android.hardware.radio.V1_0.IRadio) CarrierRestrictions(android.hardware.radio.V1_0.CarrierRestrictions) RemoteException(android.os.RemoteException)

Example 50 with IRadio

use of android.hardware.radio.V1_0.IRadio in project android_frameworks_opt_telephony by LineageOS.

the class RIL method writeSmsToRuim.

@Override
public void writeSmsToRuim(int status, byte[] pdu, Message result) {
    status = translateStatus(status);
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, result, mRILDefaultWorkSource);
        if (RILJ_LOGV) {
            riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " status = " + status);
        }
        CdmaSmsWriteArgs args = new CdmaSmsWriteArgs();
        args.status = status;
        constructCdmaSendSmsRilRequest(args.message, pdu);
        try {
            radioProxy.writeSmsToRuim(rr.mSerial, args);
        } catch (RemoteException | RuntimeException e) {
            handleRadioProxyExceptionForRR(rr, "writeSmsToRuim", e);
        }
    }
}
Also used : IRadio(android.hardware.radio.V1_0.IRadio) CdmaSmsWriteArgs(android.hardware.radio.V1_0.CdmaSmsWriteArgs) RemoteException(android.os.RemoteException)

Aggregations

IRadio (android.hardware.radio.V1_0.IRadio)63 RemoteException (android.os.RemoteException)63 ArrayList (java.util.ArrayList)6 CdmaSmsMessage (android.hardware.radio.V1_0.CdmaSmsMessage)5 GsmSmsMessage (android.hardware.radio.V1_0.GsmSmsMessage)5 ImsSmsMessage (android.hardware.radio.V1_0.ImsSmsMessage)4 CdmaSmsWriteArgs (android.hardware.radio.V1_0.CdmaSmsWriteArgs)3 Dial (android.hardware.radio.V1_0.Dial)3 UusInfo (android.hardware.radio.V1_0.UusInfo)3 CarrierRestrictions (android.hardware.radio.V1_0.CarrierRestrictions)2 NvWriteItem (android.hardware.radio.V1_0.NvWriteItem)2 SimApdu (android.hardware.radio.V1_0.SimApdu)2 Message (android.os.Message)2 RadioAccessSpecifier (android.telephony.RadioAccessSpecifier)2 InetAddress (java.net.InetAddress)2 Carrier (android.hardware.radio.V1_0.Carrier)1 CdmaBroadcastSmsConfigInfo (android.hardware.radio.V1_0.CdmaBroadcastSmsConfigInfo)1 CdmaSmsAck (android.hardware.radio.V1_0.CdmaSmsAck)1 DataProfileInfo (android.hardware.radio.V1_0.DataProfileInfo)1 GsmBroadcastSmsConfigInfo (android.hardware.radio.V1_0.GsmBroadcastSmsConfigInfo)1