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