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);
}
}
}
}
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);
}
}
}
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();
}
}
}
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);
}
}
}
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);
}
}
}
Aggregations