Search in sources :

Example 6 with RadioAccessSpecifier

use of android.telephony.RadioAccessSpecifier in project android_frameworks_opt_telephony by LineageOS.

the class RadioAccessSpecifierTest method testParcel.

@Test
@SmallTest
public void testParcel() {
    int ranGsm = AccessNetworkType.GERAN;
    int[] gsmBands = { GeranBand.BAND_T380, GeranBand.BAND_T410 };
    int[] gsmChannels = { 1, 2, 3, 4 };
    RadioAccessSpecifier ras = new RadioAccessSpecifier(ranGsm, gsmBands, gsmChannels);
    Parcel p = Parcel.obtain();
    ras.writeToParcel(p, 0);
    p.setDataPosition(0);
    RadioAccessSpecifier newRas = RadioAccessSpecifier.CREATOR.createFromParcel(p);
    assertEquals(ras, newRas);
}
Also used : Parcel(android.os.Parcel) RadioAccessSpecifier(android.telephony.RadioAccessSpecifier) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test) SmallTest(androidx.test.filters.SmallTest)

Example 7 with RadioAccessSpecifier

use of android.telephony.RadioAccessSpecifier in project android_frameworks_opt_telephony by LineageOS.

the class NetworkScanRequestTest method testParcel.

@Test
@SmallTest
public void testParcel() {
    int ranGsm = AccessNetworkType.GERAN;
    int[] gsmBands = { GeranBand.BAND_T380, GeranBand.BAND_T410 };
    int[] gsmChannels = { 1, 2, 3, 4 };
    RadioAccessSpecifier gsm = new RadioAccessSpecifier(ranGsm, gsmBands, gsmChannels);
    int ranLte = AccessNetworkType.EUTRAN;
    int[] lteBands = { EutranBand.BAND_10, EutranBand.BAND_11 };
    int[] lteChannels = { 5, 6, 7, 8 };
    RadioAccessSpecifier lte = new RadioAccessSpecifier(ranLte, lteBands, lteChannels);
    RadioAccessSpecifier[] ras = { gsm, lte };
    int searchPeriodicity = 70;
    int maxSearchTime = 200;
    boolean incrementalResults = true;
    int incrementalResultsPeriodicity = 7;
    ArrayList<String> mccmncs = new ArrayList<String>();
    mccmncs.add("310480");
    mccmncs.add("21002");
    NetworkScanRequest nsq = new NetworkScanRequest(NetworkScanRequest.SCAN_TYPE_ONE_SHOT, ras, searchPeriodicity, maxSearchTime, incrementalResults, incrementalResultsPeriodicity, mccmncs);
    Parcel p = Parcel.obtain();
    nsq.writeToParcel(p, 0);
    p.setDataPosition(0);
    NetworkScanRequest newNsq = NetworkScanRequest.CREATOR.createFromParcel(p);
    assertEquals(nsq, newNsq);
}
Also used : NetworkScanRequest(android.telephony.NetworkScanRequest) Parcel(android.os.Parcel) ArrayList(java.util.ArrayList) RadioAccessSpecifier(android.telephony.RadioAccessSpecifier) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test) SmallTest(androidx.test.filters.SmallTest)

Example 8 with RadioAccessSpecifier

use of android.telephony.RadioAccessSpecifier 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 9 with RadioAccessSpecifier

use of android.telephony.RadioAccessSpecifier in project android_frameworks_opt_telephony by LineageOS.

the class RIL method setSystemSelectionChannels.

@Override
public void setSystemSelectionChannels(@NonNull List<RadioAccessSpecifier> specifiers, Message onComplete) {
    IRadio radioProxy = getRadioProxy(onComplete);
    if (mRadioVersion.less(RADIO_HAL_VERSION_1_3)) {
        if (RILJ_LOGV)
            riljLog("setSystemSelectionChannels: not supported.");
        if (onComplete != null) {
            AsyncResult.forMessage(onComplete, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
            onComplete.sendToTarget();
        }
        return;
    }
    RILRequest rr = obtainRequest(RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS, onComplete, mRILDefaultWorkSource);
    if (mRadioVersion.less(RADIO_HAL_VERSION_1_5)) {
        android.hardware.radio.V1_3.IRadio radioProxy13 = (android.hardware.radio.V1_3.IRadio) radioProxy;
        if (radioProxy13 != null) {
            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " setSystemSelectionChannels_1.3= " + specifiers);
            }
            ArrayList<android.hardware.radio.V1_1.RadioAccessSpecifier> halSpecifiers = specifiers.stream().map(this::convertRadioAccessSpecifierToRadioHAL).collect(Collectors.toCollection(ArrayList::new));
            try {
                radioProxy13.setSystemSelectionChannels(rr.mSerial, !halSpecifiers.isEmpty(), halSpecifiers);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setSystemSelectionChannels", e);
            }
        }
    }
    if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
        android.hardware.radio.V1_5.IRadio radioProxy15 = (android.hardware.radio.V1_5.IRadio) radioProxy;
        if (radioProxy15 != null) {
            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " setSystemSelectionChannels_1.5= " + specifiers);
            }
            ArrayList<android.hardware.radio.V1_5.RadioAccessSpecifier> halSpecifiers = specifiers.stream().map(this::convertRadioAccessSpecifierToRadioHAL_1_5).collect(Collectors.toCollection(ArrayList::new));
            try {
                radioProxy15.setSystemSelectionChannels_1_5(rr.mSerial, !halSpecifiers.isEmpty(), halSpecifiers);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setSystemSelectionChannels", e);
            }
        }
    }
}
Also used : RadioAccessSpecifier(android.telephony.RadioAccessSpecifier) IRadio(android.hardware.radio.V1_0.IRadio) RemoteException(android.os.RemoteException)

Aggregations

RadioAccessSpecifier (android.telephony.RadioAccessSpecifier)9 NetworkScanRequest (android.telephony.NetworkScanRequest)6 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)4 IRadio (android.hardware.radio.V1_0.IRadio)2 Parcel (android.os.Parcel)2 RemoteException (android.os.RemoteException)2 PhoneCapability (android.telephony.PhoneCapability)2 SmallTest (androidx.test.filters.SmallTest)2 CellInfo (android.telephony.CellInfo)1 CellInfoGsm (android.telephony.CellInfoGsm)1 CellInfoLte (android.telephony.CellInfoLte)1 CellInfoWcdma (android.telephony.CellInfoWcdma)1 VisibleForTesting (androidx.annotation.VisibleForTesting)1