Search in sources :

Example 6 with CellIdentityTdscdma

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

the class RILTest method testCellIdentityTdscdma_1_5_MultiPlmn.

@Test
public void testCellIdentityTdscdma_1_5_MultiPlmn() {
    android.hardware.radio.V1_5.CellIdentityTdscdma halCellIdentity = new android.hardware.radio.V1_5.CellIdentityTdscdma();
    initializeCellIdentityTdscdma_1_5(halCellIdentity, true, false);
    CellIdentityTdscdma cellIdentity = new CellIdentityTdscdma(halCellIdentity);
    Set<String> additionalPlmns = new HashSet<>();
    Collections.addAll(additionalPlmns, ADDITIONAL_PLMNS);
    assertEquals(cellIdentity.getAdditionalPlmns(), additionalPlmns);
}
Also used : CellIdentityTdscdma(android.telephony.CellIdentityTdscdma) HashSet(java.util.HashSet) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 7 with CellIdentityTdscdma

use of android.telephony.CellIdentityTdscdma 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 CellIdentityTdscdma

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

the class CellIdentityTdscdmaTest method testParcelWithUnknowMccMnc.

@SmallTest
public void testParcelWithUnknowMccMnc() {
    CellIdentityTdscdma ci = new CellIdentityTdscdma(null, null, LAC, CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
    Parcel p = Parcel.obtain();
    p.writeInt(CellInfo.TYPE_TDSCDMA);
    p.writeString(String.valueOf(Integer.MAX_VALUE));
    p.writeString(String.valueOf(Integer.MAX_VALUE));
    p.writeString(ALPHA_LONG);
    p.writeString(ALPHA_SHORT);
    p.writeInt(LAC);
    p.writeInt(CID);
    p.writeInt(CPID);
    p.writeInt(UARFCN);
    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 9 with CellIdentityTdscdma

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

the class CellIdentityTdscdmaTest method testDefaultConstructor.

@SmallTest
public void testDefaultConstructor() {
    CellIdentityTdscdma ci = new CellIdentityTdscdma();
    assertNull(ci.getMccString());
    assertNull(ci.getMncString());
    assertEquals(CellInfo.UNAVAILABLE, ci.getLac());
    assertEquals(CellInfo.UNAVAILABLE, ci.getCid());
    assertEquals(CellInfo.UNAVAILABLE, ci.getCpid());
    assertEquals(CellInfo.UNAVAILABLE, ci.getChannelNumber());
    assertEquals(CellInfo.UNAVAILABLE, ci.getUarfcn());
    assertNull(ci.getOperatorAlphaLong());
    assertNull(ci.getOperatorAlphaShort());
    assertNull(ci.getGlobalCellId());
}
Also used : CellIdentityTdscdma(android.telephony.CellIdentityTdscdma) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 10 with CellIdentityTdscdma

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

the class CellIdentityTdscdmaTest method testParcelWithInvalidMccMnc.

@SmallTest
public void testParcelWithInvalidMccMnc() {
    final String invalidMcc = "randomStuff";
    final String invalidMnc = "randomStuff";
    CellIdentityTdscdma ci = new CellIdentityTdscdma(null, null, LAC, CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
    Parcel p = Parcel.obtain();
    p.writeInt(CellInfo.TYPE_TDSCDMA);
    p.writeString(invalidMcc);
    p.writeString(invalidMnc);
    p.writeString(ALPHA_LONG);
    p.writeString(ALPHA_SHORT);
    p.writeInt(LAC);
    p.writeInt(CID);
    p.writeInt(CPID);
    p.writeInt(UARFCN);
    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)

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