Search in sources :

Example 31 with CellIdentityCdma

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;
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) TargetApi(android.annotation.TargetApi)

Example 32 with CellIdentityCdma

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);
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) CellInfo(android.telephony.CellInfo) CellInfoCdma(android.telephony.CellInfoCdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 33 with CellIdentityCdma

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);
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) CellInfo(android.telephony.CellInfo) CellInfoCdma(android.telephony.CellInfoCdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 34 with CellIdentityCdma

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);
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) Parcel(android.os.Parcel) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 35 with CellIdentityCdma

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());
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) 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