Search in sources :

Example 6 with CellIdentityNr

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

the class RILTest method testConvertHalCellInfoList_1_4ForNr.

@Test
public void testConvertHalCellInfoList_1_4ForNr() {
    android.hardware.radio.V1_4.CellInfoNr cellinfo = new android.hardware.radio.V1_4.CellInfoNr();
    cellinfo.cellidentity.nci = CI;
    cellinfo.cellidentity.pci = PCI;
    cellinfo.cellidentity.tac = TAC;
    cellinfo.cellidentity.nrarfcn = NRARFCN;
    cellinfo.cellidentity.mcc = MCC_STR;
    cellinfo.cellidentity.mnc = MNC_STR;
    cellinfo.cellidentity.operatorNames.alphaLong = ALPHA_LONG;
    cellinfo.cellidentity.operatorNames.alphaShort = ALPHA_SHORT;
    cellinfo.signalStrength.ssRsrp = RSRP;
    cellinfo.signalStrength.ssRsrq = RSRQ;
    cellinfo.signalStrength.ssSinr = SIGNAL_NOISE_RATIO;
    cellinfo.signalStrength.csiRsrp = RSRP;
    cellinfo.signalStrength.csiRsrq = RSRQ;
    cellinfo.signalStrength.csiSinr = SIGNAL_NOISE_RATIO;
    android.hardware.radio.V1_4.CellInfo record = new android.hardware.radio.V1_4.CellInfo();
    record.info.nr(cellinfo);
    ArrayList<android.hardware.radio.V1_4.CellInfo> records = new ArrayList<>();
    records.add(record);
    ArrayList<CellInfo> ret = RIL.convertHalCellInfoList_1_4(records);
    CellInfoNr cellInfoNr = (CellInfoNr) ret.get(0);
    CellIdentityNr cellIdentityNr = (CellIdentityNr) cellInfoNr.getCellIdentity();
    CellSignalStrengthNr signalStrengthNr = (CellSignalStrengthNr) cellInfoNr.getCellSignalStrength();
    CellIdentityNr expectedCellIdentity = new CellIdentityNr(PCI, TAC, NRARFCN, new int[] {}, MCC_STR, MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    CellSignalStrengthNr expectedSignalStrength = new CellSignalStrengthNr(-RSRP, -RSRQ, SIGNAL_NOISE_RATIO, -RSRP, -RSRQ, SIGNAL_NOISE_RATIO);
    assertEquals(expectedCellIdentity, cellIdentityNr);
    assertEquals(expectedSignalStrength, signalStrengthNr);
}
Also used : CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) ArrayList(java.util.ArrayList) CellIdentityNr(android.telephony.CellIdentityNr) CellInfo(android.telephony.CellInfo) CellInfoNr(android.telephony.CellInfoNr) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 7 with CellIdentityNr

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

the class ServiceStateTrackerTest method testGetCidFromCellIdentity.

@Test
public void testGetCidFromCellIdentity() throws Exception {
    CellIdentity gsmCi = new CellIdentityGsm(0, 1, 0, 0, "", "", "", "", Collections.emptyList());
    CellIdentity wcdmaCi = new CellIdentityWcdma(0, 2, 0, 0, "", "", "", "", Collections.emptyList(), null);
    CellIdentity tdscdmaCi = new CellIdentityTdscdma("", "", 0, 3, 0, 0, "", "", Collections.emptyList(), null);
    CellIdentity lteCi = new CellIdentityLte(0, 0, 4, 0, 0);
    CellIdentity nrCi = new CellIdentityNr(0, 0, 0, new int[] {}, "", "", 5, "", "", Collections.emptyList());
    Method method = ServiceStateTracker.class.getDeclaredMethod("getCidFromCellIdentity", CellIdentity.class);
    method.setAccessible(true);
    assertEquals(1, (long) method.invoke(mSST, gsmCi));
    assertEquals(2, (long) method.invoke(mSST, wcdmaCi));
    assertEquals(3, (long) method.invoke(mSST, tdscdmaCi));
    assertEquals(4, (long) method.invoke(mSST, lteCi));
    assertEquals(5, (long) method.invoke(mSST, nrCi));
}
Also used : CellIdentityLte(android.telephony.CellIdentityLte) CellIdentity(android.telephony.CellIdentity) CellIdentityGsm(android.telephony.CellIdentityGsm) Method(java.lang.reflect.Method) CellIdentityWcdma(android.telephony.CellIdentityWcdma) CellIdentityTdscdma(android.telephony.CellIdentityTdscdma) CellIdentityNr(android.telephony.CellIdentityNr) FlakyTest(androidx.test.filters.FlakyTest) MediumTest(android.test.suitebuilder.annotation.MediumTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test)

Example 8 with CellIdentityNr

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

the class CellIdentityNrTest method testGetMethod.

@Test
public void testGetMethod() {
    // GIVEN an instance of CellIdentityNr
    CellIdentityNr cellIdentityNr = new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC_STR, MNC_STR, NCI, ALPHAL, ALPHAS, Collections.emptyList());
    // THEN the get method should return correct value
    assertThat(cellIdentityNr.getType()).isEqualTo(CellInfo.TYPE_NR);
    assertThat(cellIdentityNr.getNrarfcn()).isEqualTo(NRARFCN);
    assertThat(cellIdentityNr.getPci()).isEqualTo(PCI);
    assertThat(cellIdentityNr.getTac()).isEqualTo(TAC);
    assertThat(cellIdentityNr.getOperatorAlphaLong()).isEqualTo(ALPHAL);
    assertThat(cellIdentityNr.getOperatorAlphaShort()).isEqualTo(ALPHAS);
    assertThat(cellIdentityNr.getMccString()).isEqualTo(MCC_STR);
    assertThat(cellIdentityNr.getMncString()).isEqualTo(MNC_STR);
    assertThat(cellIdentityNr.getNci()).isEqualTo(NCI);
    String globalCi = MCC_STR + MNC_STR + "000" + Integer.toString(NCI, 16);
    assertEquals(globalCi, cellIdentityNr.getGlobalCellId());
}
Also used : CellIdentityNr(android.telephony.CellIdentityNr) Test(org.junit.Test)

Aggregations

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