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));
}
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);
}
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;
}
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);
}
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());
}
Aggregations