Search in sources :

Example 36 with CellIdentityCdma

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

the class GsmCdmaPhoneTest method testGetCellLocation.

@Test
@SmallTest
public void testGetCellLocation() {
    // GSM
    CellIdentity cellLocation = new CellIdentityGsm();
    WorkSource workSource = new WorkSource(Process.myUid(), mContext.getPackageName());
    doReturn(cellLocation).when(mSST).getCellIdentity();
    assertEquals(cellLocation, mPhoneUT.getCellIdentity());
    // Switch to CDMA
    switchToCdma();
    CellIdentityCdma cdmaCellLocation = new CellIdentityCdma();
    doReturn(cdmaCellLocation).when(mSST).getCellIdentity();
    CellIdentityCdma actualCellLocation = (CellIdentityCdma) mPhoneUT.getCellIdentity();
    assertEquals(actualCellLocation, cdmaCellLocation);
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) CellIdentity(android.telephony.CellIdentity) CellIdentityGsm(android.telephony.CellIdentityGsm) WorkSource(android.os.WorkSource) FlakyTest(androidx.test.filters.FlakyTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 37 with CellIdentityCdma

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

the class CellIdentityTest method testParcel.

@SmallTest
public void testParcel() {
    CellIdentity ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDS, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
    Parcel p = Parcel.obtain();
    ci.writeToParcel(p, 0);
    p.setDataPosition(0);
    CellIdentity newCi = CellIdentity.CREATOR.createFromParcel(p);
    assertEquals(ci, newCi);
    ci = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT);
    p = Parcel.obtain();
    ci.writeToParcel(p, 0);
    p.setDataPosition(0);
    newCi = CellIdentity.CREATOR.createFromParcel(p);
    assertEquals(ci, newCi);
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) CellIdentityLte(android.telephony.CellIdentityLte) CellIdentity(android.telephony.CellIdentity) Parcel(android.os.Parcel) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

CellIdentityCdma (android.telephony.CellIdentityCdma)37 CellInfoCdma (android.telephony.CellInfoCdma)18 CellIdentityGsm (android.telephony.CellIdentityGsm)16 CellSignalStrengthCdma (android.telephony.CellSignalStrengthCdma)16 CellInfo (android.telephony.CellInfo)14 CellInfoGsm (android.telephony.CellInfoGsm)14 CellIdentityLte (android.telephony.CellIdentityLte)13 CellIdentityWcdma (android.telephony.CellIdentityWcdma)12 CellInfoLte (android.telephony.CellInfoLte)11 CellInfoWcdma (android.telephony.CellInfoWcdma)11 SmallTest (android.test.suitebuilder.annotation.SmallTest)9 CellSignalStrengthGsm (android.telephony.CellSignalStrengthGsm)6 FlakyTest (androidx.test.filters.FlakyTest)6 Test (org.junit.Test)6 PendingIntent (android.app.PendingIntent)5 Intent (android.content.Intent)5 WifiInfo (android.net.wifi.WifiInfo)5 TargetApi (android.annotation.TargetApi)3 CellIdentity (android.telephony.CellIdentity)3 CellSignalStrengthLte (android.telephony.CellSignalStrengthLte)3