use of android.telephony.CellIdentityCdma in project satstat by mvglasow.
the class CellTowerListCdma method update.
/**
* Adds or updates a cell tower.
* <p>
* If the cell tower is already in the list, it is replaced; if not, a new
* entry is created.
* <p>
* This method will set the cell's identity data, its signal strength and
* whether it is the currently serving cell. If the API level is 18 or
* higher, it will also set the generation.
* @return The new or updated entry.
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public CellTowerCdma update(CellInfoCdma cell) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)
return null;
CellIdentityCdma cid = cell.getCellIdentity();
CellTowerCdma result = this.get(cid.getSystemId(), cid.getNetworkId(), cid.getBasestationId());
if (result == null) {
result = new CellTowerCdma(cid.getSystemId(), cid.getNetworkId(), cid.getBasestationId());
this.put(result.getText(), result);
}
result.setCellInfo(true);
result.setDbm(cell.getCellSignalStrength().getDbm());
result.setServing(cell.isRegistered());
return result;
}
use of android.telephony.CellIdentityCdma in project android_frameworks_opt_telephony by LineageOS.
the class RILTest method testConvertHalCellInfoList_1_2ForCdmaWithEmptyOperatorInfo.
@Test
public void testConvertHalCellInfoList_1_2ForCdmaWithEmptyOperatorInfo() {
ArrayList<CellInfo> ret = getCellInfoListForCdma(EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
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_NONE);
// override the timestamp
cellInfoCdma.setTimeStamp(TIMESTAMP);
assertEquals(expected, cellInfoCdma);
}
use of android.telephony.CellIdentityCdma in project android_frameworks_opt_telephony by LineageOS.
the class RILTest method testConvertHalCellInfoList_1_2ForCdma.
@Test
public void testConvertHalCellInfoList_1_2ForCdma() {
ArrayList<CellInfo> ret = getCellInfoListForCdma(ALPHA_LONG, ALPHA_SHORT);
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, ALPHA_LONG, ALPHA_SHORT);
CellSignalStrengthCdma cs = new CellSignalStrengthCdma(DBM, ECIO, DBM, ECIO, SIGNAL_NOISE_RATIO);
expected.setCellIdentity(ci);
expected.setCellSignalStrength(cs);
expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
// override the timestamp
cellInfoCdma.setTimeStamp(TIMESTAMP);
assertEquals(expected, cellInfoCdma);
}
use of android.telephony.CellIdentityCdma in project android_frameworks_opt_telephony by LineageOS.
the class CellIdentityCdmaTest method testParcel.
@SmallTest
public void testParcel() {
CellIdentityCdma ci = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, LONGITUDE, LATITUDE, ALPHA_LONG, ALPHA_SHORT);
Parcel p = Parcel.obtain();
ci.writeToParcel(p, 0);
p.setDataPosition(0);
CellIdentityCdma newCi = CellIdentityCdma.CREATOR.createFromParcel(p);
assertEquals(ci, newCi);
}
use of android.telephony.CellIdentityCdma in project android_frameworks_opt_telephony by LineageOS.
the class CellIdentityCdmaTest method testNullIsland.
@SmallTest
public void testNullIsland() {
CellIdentityCdma ci = new CellIdentityCdma(NETWORK_ID, SYSTEM_ID, BASESTATION_ID, -1, 0, ALPHA_LONG, ALPHA_SHORT);
assertEquals(Integer.MAX_VALUE, ci.getLatitude());
assertEquals(Integer.MAX_VALUE, ci.getLongitude());
}
Aggregations