Search in sources :

Example 16 with CellIdentityGsm

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

the class CellIdentityGsmTest method testConstructorWithEmptyMccMnc.

@SmallTest
public void testConstructorWithEmptyMccMnc() {
    CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertEquals(Integer.MAX_VALUE, ci.getMcc());
    assertEquals(Integer.MAX_VALUE, ci.getMnc());
    assertNull(ci.getMccString());
    assertNull(ci.getMncString());
    assertNull(ci.getMobileNetworkOperator());
    assertNull(ci.getGlobalCellId());
    ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertEquals(MCC, ci.getMcc());
    assertEquals(Integer.MAX_VALUE, ci.getMnc());
    assertEquals(MCC_STR, ci.getMccString());
    assertNull(ci.getMncString());
    assertNull(ci.getMobileNetworkOperator());
    assertNull(ci.getGlobalCellId());
    ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertEquals(MNC, ci.getMnc());
    assertEquals(Integer.MAX_VALUE, ci.getMcc());
    assertEquals(MNC_STR, ci.getMncString());
    assertNull(ci.getMccString());
    assertNull(ci.getMobileNetworkOperator());
    assertNull(ci.getGlobalCellId());
    ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, "", "", ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertEquals(Integer.MAX_VALUE, ci.getMcc());
    assertEquals(Integer.MAX_VALUE, ci.getMnc());
    assertNull(ci.getMccString());
    assertNull(ci.getMncString());
    assertNull(ci.getMobileNetworkOperator());
    assertNull(ci.getGlobalCellId());
}
Also used : CellIdentityGsm(android.telephony.CellIdentityGsm) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 17 with CellIdentityGsm

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

the class CellIdentityGsmTest method testParcelWithInvalidMccMnc.

@SmallTest
public void testParcelWithInvalidMccMnc() {
    final String invalidMcc = "randomStuff";
    final String invalidMnc = "randomStuff";
    CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    Parcel p = Parcel.obtain();
    ci.writeToParcel(p, 0);
    p.setDataPosition(0);
    CellIdentityGsm newCi = CellIdentityGsm.CREATOR.createFromParcel(p);
    assertEquals(ci, newCi);
}
Also used : Parcel(android.os.Parcel) CellIdentityGsm(android.telephony.CellIdentityGsm) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 18 with CellIdentityGsm

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

the class CellIdentityGsmTest method testParcel.

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

Example 19 with CellIdentityGsm

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

the class CellIdentityGsmTest method testConstructorWithTwoDigitMnc.

@SmallTest
public void testConstructorWithTwoDigitMnc() {
    final String mncWithTwoDigit = "61";
    CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, mncWithTwoDigit, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    assertEquals(MCC, ci.getMcc());
    assertEquals(61, ci.getMnc());
    assertEquals(MCC_STR, ci.getMccString());
    assertEquals(mncWithTwoDigit, ci.getMncString());
    assertEquals(MCC_STR + mncWithTwoDigit, ci.getMobileNetworkOperator());
    String globalCi = MCC_STR + mncWithTwoDigit + 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 20 with CellIdentityGsm

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

the class CellIdentityGsmTest method testParcelWithUnknowMccMnc.

@SmallTest
public void testParcelWithUnknowMccMnc() {
    CellIdentityGsm ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
    Parcel p = Parcel.obtain();
    ci.writeToParcel(p, 0);
    p.setDataPosition(0);
    CellIdentityGsm newCi = CellIdentityGsm.CREATOR.createFromParcel(p);
    assertEquals(ci, newCi);
}
Also used : Parcel(android.os.Parcel) 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