Search in sources :

Example 1 with CellIdentityTdscdma

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

the class CellIdentityTest method testGetMccMncString.

@SmallTest
public void testGetMccMncString() {
    List<CellIdentity> identities = new ArrayList<>(5);
    CellIdentityGsm gsm = new CellIdentityGsm(MAX_LAC, MAX_CID, MAX_ARFCN, MAX_BSIC, MCC_STR, MNC_STR, null, null, Collections.emptyList());
    identities.add(gsm);
    CellIdentityCdma cdma = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT);
    identities.add(cdma);
    CellIdentity lte = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDS, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
    identities.add(lte);
    CellIdentityWcdma wcdma = new CellIdentityWcdma(MAX_LAC, MAX_CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
    identities.add(wcdma);
    CellIdentityTdscdma tdscdma = new CellIdentityTdscdma(MCC_STR, MNC_STR, MAX_LAC, MAX_CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
    identities.add(tdscdma);
    CellIdentityNr nr = new CellIdentityNr(PCI, TAC, EARFCN, BANDS, MCC_STR, MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    identities.add(nr);
    for (CellIdentity identity : identities) {
        final String mccStr = identity.getMccString();
        final String mncStr = identity.getMncString();
        if (identity instanceof CellIdentityCdma) {
            assertNull(mccStr);
            assertNull(mncStr);
        } else {
            assertEquals(MCC_STR, mccStr);
            assertEquals(MNC_STR, mncStr);
        }
    }
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) CellIdentityLte(android.telephony.CellIdentityLte) CellIdentity(android.telephony.CellIdentity) ArrayList(java.util.ArrayList) CellIdentityGsm(android.telephony.CellIdentityGsm) CellIdentityWcdma(android.telephony.CellIdentityWcdma) CellIdentityTdscdma(android.telephony.CellIdentityTdscdma) CellIdentityNr(android.telephony.CellIdentityNr) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 2 with CellIdentityTdscdma

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

the class CellIdentityTdscdmaTest method testConstructor.

@SmallTest
public void testConstructor() {
    CellIdentityTdscdma ci = new CellIdentityTdscdma(MCC_STR, MNC_STR, LAC, CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
    assertEquals(MCC_STR, ci.getMccString());
    assertEquals(MNC_STR, ci.getMncString());
    assertEquals(LAC, ci.getLac());
    assertEquals(CID, ci.getCid());
    assertEquals(CPID, ci.getCpid());
    assertEquals(UARFCN, ci.getChannelNumber());
    assertEquals(UARFCN, ci.getUarfcn());
    assertEquals(ALPHA_LONG, ci.getOperatorAlphaLong());
    assertEquals(ALPHA_SHORT, ci.getOperatorAlphaShort());
    String globalCi = MCC_STR + MNC_STR + Integer.toString(LAC, 16) + Integer.toString(CID, 16);
    assertEquals(globalCi, ci.getGlobalCellId());
}
Also used : CellIdentityTdscdma(android.telephony.CellIdentityTdscdma) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 3 with CellIdentityTdscdma

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

the class CellIdentityTdscdmaTest method testParcel.

@SmallTest
public void testParcel() {
    CellIdentityTdscdma ci = new CellIdentityTdscdma(MCC_STR, MNC_STR, LAC, CID, UARFCN, CPID, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
    Parcel p = Parcel.obtain();
    ci.writeToParcel(p, 0);
    p.setDataPosition(0);
    CellIdentityTdscdma newCi = CellIdentityTdscdma.CREATOR.createFromParcel(p);
    assertEquals(ci, newCi);
}
Also used : Parcel(android.os.Parcel) CellIdentityTdscdma(android.telephony.CellIdentityTdscdma) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 4 with CellIdentityTdscdma

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

the class RILTest method testConvertHalCellInfoListForTdscdma.

@Test
public void testConvertHalCellInfoListForTdscdma() {
    android.hardware.radio.V1_2.CellInfoTdscdma cellinfo = new android.hardware.radio.V1_2.CellInfoTdscdma();
    initializeCellIdentityTdscdma_1_2(cellinfo.cellIdentityTdscdma);
    cellinfo.signalStrengthTdscdma.signalStrength = RSSI_ASU;
    cellinfo.signalStrengthTdscdma.bitErrorRate = BIT_ERROR_RATE;
    cellinfo.signalStrengthTdscdma.rscp = RSCP_ASU;
    android.hardware.radio.V1_2.CellInfo record = new android.hardware.radio.V1_2.CellInfo();
    record.cellInfoType = TYPE_TD_SCDMA;
    record.registered = false;
    record.timeStampType = RIL_TIMESTAMP_TYPE_OEM_RIL;
    record.timeStamp = TIMESTAMP;
    record.tdscdma.add(cellinfo);
    ArrayList<android.hardware.radio.V1_2.CellInfo> records = new ArrayList<android.hardware.radio.V1_2.CellInfo>();
    records.add(record);
    ArrayList<CellInfo> ret = RIL.convertHalCellInfoList_1_2(records);
    assertEquals(1, ret.size());
    CellInfoTdscdma cellInfoTdscdma = (CellInfoTdscdma) ret.get(0);
    CellInfoTdscdma expected = new CellInfoTdscdma();
    expected.setRegistered(false);
    expected.setTimeStamp(TIMESTAMP);
    expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
    CellIdentityTdscdma ci = new CellIdentityTdscdma(MCC_STR, MNC_STR, LAC, CID, PSC, UARFCN, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
    CellSignalStrengthTdscdma cs = new CellSignalStrengthTdscdma(RSSI, BIT_ERROR_RATE, RSCP);
    expected.setCellIdentity(ci);
    expected.setCellSignalStrength(cs);
    // override the timestamp
    cellInfoTdscdma.setTimeStamp(TIMESTAMP);
    assertEquals(expected, cellInfoTdscdma);
}
Also used : ArrayList(java.util.ArrayList) CellSignalStrengthTdscdma(android.telephony.CellSignalStrengthTdscdma) CellInfoTdscdma(android.telephony.CellInfoTdscdma) CellIdentityTdscdma(android.telephony.CellIdentityTdscdma) CellInfo(android.telephony.CellInfo) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 5 with CellIdentityTdscdma

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

the class RILTest method testCellIdentityTdscdma_1_5_CsgInfo.

@Test
public void testCellIdentityTdscdma_1_5_CsgInfo() {
    android.hardware.radio.V1_5.CellIdentityTdscdma halCellIdentity = new android.hardware.radio.V1_5.CellIdentityTdscdma();
    initializeCellIdentityTdscdma_1_5(halCellIdentity, false, true);
    CellIdentityTdscdma cellIdentity = new CellIdentityTdscdma(halCellIdentity);
    assertEquals(CSG_INDICATION, cellIdentity.getClosedSubscriberGroupInfo().getCsgIndicator());
    assertEquals(HOME_NODEB_NAME, cellIdentity.getClosedSubscriberGroupInfo().getHomeNodebName());
    assertEquals(CSG_IDENTITY, cellIdentity.getClosedSubscriberGroupInfo().getCsgIdentity());
}
Also used : CellIdentityTdscdma(android.telephony.CellIdentityTdscdma) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Aggregations

CellIdentityTdscdma (android.telephony.CellIdentityTdscdma)11 SmallTest (android.test.suitebuilder.annotation.SmallTest)8 FlakyTest (androidx.test.filters.FlakyTest)4 Test (org.junit.Test)4 Parcel (android.os.Parcel)3 CellIdentity (android.telephony.CellIdentity)2 CellIdentityGsm (android.telephony.CellIdentityGsm)2 CellIdentityLte (android.telephony.CellIdentityLte)2 CellIdentityNr (android.telephony.CellIdentityNr)2 CellIdentityWcdma (android.telephony.CellIdentityWcdma)2 ArrayList (java.util.ArrayList)2 CellIdentityCdma (android.telephony.CellIdentityCdma)1 CellInfo (android.telephony.CellInfo)1 CellInfoTdscdma (android.telephony.CellInfoTdscdma)1 CellSignalStrengthTdscdma (android.telephony.CellSignalStrengthTdscdma)1 MediumTest (android.test.suitebuilder.annotation.MediumTest)1 Method (java.lang.reflect.Method)1 HashSet (java.util.HashSet)1