Search in sources :

Example 16 with CellIdentityCdma

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

the class CellIdentityCdmaTest method testEquals.

@SmallTest
public void testEquals() {
    CellIdentityCdma ciA = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT);
    CellIdentityCdma ciB = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT);
    assertTrue(ciA.equals(ciB));
    ciA = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, null, null);
    ciB = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, null, null);
    assertTrue(ciA.equals(ciB));
    ciA = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT);
    ciB = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, null, null);
    assertFalse(ciA.equals(ciB));
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 17 with CellIdentityCdma

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

the class RILTest method testConvertHalCellInfoListForCdma.

@Test
public void testConvertHalCellInfoListForCdma() {
    android.hardware.radio.V1_0.CellInfoCdma cellinfo = new android.hardware.radio.V1_0.CellInfoCdma();
    cellinfo.cellIdentityCdma.networkId = NETWORK_ID;
    cellinfo.cellIdentityCdma.systemId = SYSTEM_ID;
    cellinfo.cellIdentityCdma.baseStationId = BASESTATION_ID;
    cellinfo.cellIdentityCdma.longitude = LONGITUDE;
    cellinfo.cellIdentityCdma.latitude = LATITUDE;
    cellinfo.signalStrengthCdma.dbm = -DBM;
    cellinfo.signalStrengthCdma.ecio = -ECIO;
    cellinfo.signalStrengthEvdo.dbm = -DBM;
    cellinfo.signalStrengthEvdo.ecio = -ECIO;
    cellinfo.signalStrengthEvdo.signalNoiseRatio = SIGNAL_NOISE_RATIO;
    android.hardware.radio.V1_0.CellInfo record = new android.hardware.radio.V1_0.CellInfo();
    record.cellInfoType = TYPE_CDMA;
    record.registered = false;
    record.timeStampType = RIL_TIMESTAMP_TYPE_OEM_RIL;
    record.timeStamp = TIMESTAMP;
    record.cdma.add(cellinfo);
    ArrayList<android.hardware.radio.V1_0.CellInfo> records = new ArrayList<android.hardware.radio.V1_0.CellInfo>();
    records.add(record);
    ArrayList<CellInfo> ret = RIL.convertHalCellInfoList(records);
    assertEquals(1, ret.size());
    CellInfoCdma cellInfoCdma = (CellInfoCdma) ret.get(0);
    CellInfoCdma expected = new CellInfoCdma();
    expected.setRegistered(false);
    expected.setTimeStamp(TIMESTAMP);
    CellIdentityCdma ci = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
    CellSignalStrengthCdma cs = new CellSignalStrengthCdma(DBM, ECIO, DBM, ECIO, SIGNAL_NOISE_RATIO);
    expected.setCellIdentity(ci);
    expected.setCellSignalStrength(cs);
    expected.setCellConnectionStatus(CellInfo.CONNECTION_UNKNOWN);
    // override the timestamp
    cellInfoCdma.setTimeStamp(TIMESTAMP);
    assertEquals(expected, cellInfoCdma);
}
Also used : CellInfoCdma(android.telephony.CellInfoCdma) ArrayList(java.util.ArrayList) CellIdentityCdma(android.telephony.CellIdentityCdma) CellInfo(android.telephony.CellInfo) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 18 with CellIdentityCdma

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

the class ServiceStateTrackerTest method getPlmnFromCellIdentity.

private static String getPlmnFromCellIdentity(final CellIdentity ci) {
    if (ci == null || ci instanceof CellIdentityCdma)
        return "";
    final String mcc = ci.getMccString();
    final String mnc = ci.getMncString();
    if (TextUtils.isEmpty(mcc) || TextUtils.isEmpty(mnc))
        return "";
    return mcc + mnc;
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) Mockito.anyString(org.mockito.Mockito.anyString)

Example 19 with CellIdentityCdma

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

the class ServiceStateTrackerTest method testHasLocationChanged.

@Test
public void testHasLocationChanged() {
    CellIdentityCdma cellIdentity = null;
    CellIdentityCdma newCellIdentity = null;
    boolean hasLocationChanged = (cellIdentity == null ? newCellIdentity != null : !cellIdentity.isSameCell(newCellIdentity));
    assertFalse(hasLocationChanged);
    cellIdentity = new CellIdentityCdma(1, 2, 3, 4, 5, "test", "tst");
    hasLocationChanged = (cellIdentity == null ? newCellIdentity != null : !cellIdentity.isSameCell(newCellIdentity));
    assertTrue(hasLocationChanged);
    newCellIdentity = new CellIdentityCdma(1, 2, 3, 4, 5, "test", "tst");
    hasLocationChanged = (cellIdentity == null ? newCellIdentity != null : !cellIdentity.isSameCell(newCellIdentity));
    assertFalse(hasLocationChanged);
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) FlakyTest(androidx.test.filters.FlakyTest) MediumTest(android.test.suitebuilder.annotation.MediumTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test)

Example 20 with CellIdentityCdma

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

the class ServiceStateTrackerTest method testCdmaCellLocation.

@FlakyTest
/* flakes 0.86% of the time */
@Test
@MediumTest
public // TODO(nharold): we probably should remove support for this procedure (GET_LOC)
void testCdmaCellLocation() {
    CellIdentityCdma cellIdentityCdma = new CellIdentityCdma(1, 2, 3, 4, 5, "test", "tst");
    NetworkRegistrationInfo result = new NetworkRegistrationInfo.Builder().setDomain(NetworkRegistrationInfo.DOMAIN_CS).setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN).setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME).setCellIdentity(cellIdentityCdma).build();
    sst.sendMessage(sst.obtainMessage(ServiceStateTracker.EVENT_GET_LOC_DONE, new AsyncResult(null, result, null)));
    waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
    WorkSource workSource = new WorkSource(Process.myUid(), mContext.getPackageName());
    CdmaCellLocation cl = (CdmaCellLocation) sst.getCellIdentity().asCellLocation();
    assertEquals(5, cl.getBaseStationLatitude());
    assertEquals(4, cl.getBaseStationLongitude());
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) NetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo) CdmaCellLocation(android.telephony.cdma.CdmaCellLocation) WorkSource(android.os.WorkSource) AsyncResult(android.os.AsyncResult) FlakyTest(androidx.test.filters.FlakyTest) FlakyTest(androidx.test.filters.FlakyTest) MediumTest(android.test.suitebuilder.annotation.MediumTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) MediumTest(android.test.suitebuilder.annotation.MediumTest)

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