Search in sources :

Example 51 with CellIdentityGsm

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

the class CellIdentityGsmTest method testgetGlobalCellId.

@SmallTest
public void testgetGlobalCellId() {
    CellIdentityGsm ci = new CellIdentityGsm(LAC + 1, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertNull(ci.getGlobalCellId());
    ci = new CellIdentityGsm(LAC, CID + 1, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertNull(ci.getGlobalCellId());
    ci = new CellIdentityGsm(LAC, -1, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertNull(ci.getGlobalCellId());
    // Test id with one digit and corresponding zero padding
    int cid = 1;
    ci = new CellIdentityGsm(LAC, cid, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    String globalCi = MCC_STR + MNC_STR + Integer.toString(LAC, 16) + "000" + Integer.toString(cid, 16);
    assertEquals(globalCi, ci.getGlobalCellId());
}
Also used : CellIdentityGsm(android.telephony.CellIdentityGsm) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 52 with CellIdentityGsm

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

the class CellIdentityGsmTest method testConstructorWithThreeDigitMnc.

@SmallTest
public void testConstructorWithThreeDigitMnc() {
    final String mncWithThreeDigit = "061";
    CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, mncWithThreeDigit, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertEquals(MCC, ci.getMcc());
    assertEquals(61, ci.getMnc());
    assertEquals(MCC_STR, ci.getMccString());
    assertEquals(mncWithThreeDigit, ci.getMncString());
    assertEquals(MCC_STR + mncWithThreeDigit, ci.getMobileNetworkOperator());
    String globalCi = MCC_STR + mncWithThreeDigit + Integer.toString(LAC, 16) + Integer.toString(CID, 16);
    assertEquals(globalCi, ci.getGlobalCellId());
}
Also used : CellIdentityGsm(android.telephony.CellIdentityGsm) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 53 with CellIdentityGsm

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

the class CellIdentityGsmTest method testEquals.

@SmallTest
public void testEquals() {
    CellIdentityGsm ciA = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    CellIdentityGsm ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertTrue(ciA.equals(ciB));
    ciA = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertTrue(ciA.equals(ciB));
    ciA = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertFalse(ciA.equals(ciB));
}
Also used : CellIdentityGsm(android.telephony.CellIdentityGsm) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

CellIdentityGsm (android.telephony.CellIdentityGsm)53 CellInfoGsm (android.telephony.CellInfoGsm)25 CellSignalStrengthGsm (android.telephony.CellSignalStrengthGsm)20 SmallTest (android.test.suitebuilder.annotation.SmallTest)19 CellIdentityCdma (android.telephony.CellIdentityCdma)16 CellIdentityLte (android.telephony.CellIdentityLte)16 CellInfo (android.telephony.CellInfo)16 CellIdentityWcdma (android.telephony.CellIdentityWcdma)14 CellInfoCdma (android.telephony.CellInfoCdma)14 CellInfoLte (android.telephony.CellInfoLte)13 Test (org.junit.Test)13 CellInfoWcdma (android.telephony.CellInfoWcdma)12 FlakyTest (androidx.test.filters.FlakyTest)11 CellSignalStrengthCdma (android.telephony.CellSignalStrengthCdma)6 MediumTest (android.test.suitebuilder.annotation.MediumTest)6 PendingIntent (android.app.PendingIntent)5 Intent (android.content.Intent)5 WifiInfo (android.net.wifi.WifiInfo)5 Parcel (android.os.Parcel)4 CellIdentity (android.telephony.CellIdentity)4