Search in sources :

Example 16 with CellSignalStrengthTdscdma

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

the class SignalStrengthTest method testParcelUnparcel.

@Test
public void testParcelUnparcel() throws Exception {
    assertParcelingIsLossless(new SignalStrength());
    SignalStrength s = new SignalStrength(new CellSignalStrengthCdma(-93, -132, -89, -125, 5), new CellSignalStrengthGsm(-79, 2, 5), new CellSignalStrengthWcdma(-94, 4, -102, -5), new CellSignalStrengthTdscdma(-95, 2, -103), new CellSignalStrengthLte(-85, -91, -6, -10, 12, 1), new CellSignalStrengthNr(-91, -6, 3, -80, -7, 4));
    assertParcelingIsLossless(s);
    PersistableBundle bundle = new PersistableBundle();
    bundle.putIntArray(CarrierConfigManager.KEY_LTE_RSRQ_THRESHOLDS_INT_ARRAY, DEFAULT_LTE_RSRQ_THRESHOLDS);
    bundle.putIntArray(CarrierConfigManager.KEY_LTE_RSRP_THRESHOLDS_INT_ARRAY, DEFAULT_LTE_RSRP_THRESHOLDS);
    bundle.putIntArray(CarrierConfigManager.KEY_LTE_RSSNR_THRESHOLDS_INT_ARRAY, DEFAULT_LTE_RSSNR_THRESHOLDS);
    bundle.putIntArray(CarrierConfigManager.KEY_5G_NR_SSRSRP_THRESHOLDS_INT_ARRAY, DEFAULT_5G_NR_SSRSRP_THRESHOLDS);
    s.updateLevel(bundle, null);
    assertParcelingIsLossless(s);
}
Also used : CellSignalStrengthLte(android.telephony.CellSignalStrengthLte) PersistableBundle(android.os.PersistableBundle) CellSignalStrengthGsm(android.telephony.CellSignalStrengthGsm) CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) CellSignalStrengthWcdma(android.telephony.CellSignalStrengthWcdma) CellSignalStrengthTdscdma(android.telephony.CellSignalStrengthTdscdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) SignalStrength(android.telephony.SignalStrength) CellSignalStrength(android.telephony.CellSignalStrength) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 17 with CellSignalStrengthTdscdma

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

the class SignalStrengthTest method createSignalStrengthLteReportRsrq.

private static SignalStrength createSignalStrengthLteReportRsrq(int lteRsrp, int lteRsrq) {
    CellSignalStrengthLte lte = new CellSignalStrengthLte(// rssi
    -89, // rsrp
    lteRsrp, // rsrq
    lteRsrq, // rssnr
    -25, // cqi
    CellInfo.UNAVAILABLE, // timingAdvance
    CellInfo.UNAVAILABLE);
    SignalStrength signalStrength = new SignalStrength(new CellSignalStrengthCdma(), new CellSignalStrengthGsm(), new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), lte, new CellSignalStrengthNr());
    PersistableBundle bundle = new PersistableBundle();
    bundle.putInt(CarrierConfigManager.KEY_PARAMETERS_USED_FOR_LTE_SIGNAL_BAR_INT, CellSignalStrengthLte.USE_RSRP | CellSignalStrengthLte.USE_RSRQ);
    bundle.putIntArray(CarrierConfigManager.KEY_LTE_RSRQ_THRESHOLDS_INT_ARRAY, DEFAULT_LTE_RSRQ_THRESHOLDS);
    bundle.putIntArray(CarrierConfigManager.KEY_LTE_RSRP_THRESHOLDS_INT_ARRAY, DEFAULT_LTE_RSRP_THRESHOLDS);
    signalStrength.updateLevel(bundle, null);
    return signalStrength;
}
Also used : CellSignalStrengthLte(android.telephony.CellSignalStrengthLte) PersistableBundle(android.os.PersistableBundle) CellSignalStrengthGsm(android.telephony.CellSignalStrengthGsm) CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) CellSignalStrengthWcdma(android.telephony.CellSignalStrengthWcdma) CellSignalStrengthTdscdma(android.telephony.CellSignalStrengthTdscdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) SignalStrength(android.telephony.SignalStrength) CellSignalStrength(android.telephony.CellSignalStrength)

Example 18 with CellSignalStrengthTdscdma

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

the class RIL method fixupSignalStrength10.

/**
 * Fixup for SignalStrength 1.0 to Assume GSM to WCDMA when
 * The current RAT type is one of the UMTS RATs.
 * @param signalStrength the initial signal strength
 * @return a new SignalStrength if RAT is UMTS or existing SignalStrength
 */
public SignalStrength fixupSignalStrength10(SignalStrength signalStrength) {
    List<CellSignalStrengthGsm> gsmList = signalStrength.getCellSignalStrengths(CellSignalStrengthGsm.class);
    // If GSM is not the primary type, then bail out; no fixup needed.
    if (gsmList.isEmpty() || !gsmList.get(0).isValid()) {
        return signalStrength;
    }
    CellSignalStrengthGsm gsmStrength = gsmList.get(0);
    // Use the voice RAT which is a guarantee in GSM and UMTS
    int voiceRat = ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN;
    Phone phone = PhoneFactory.getPhone(mPhoneId);
    if (phone != null) {
        ServiceState ss = phone.getServiceState();
        if (ss != null) {
            voiceRat = ss.getRilVoiceRadioTechnology();
        }
    }
    switch(voiceRat) {
        case ServiceState.RIL_RADIO_TECHNOLOGY_GPRS:
        /* fallthrough */
        case ServiceState.RIL_RADIO_TECHNOLOGY_EDGE:
        /* fallthrough */
        case ServiceState.RIL_RADIO_TECHNOLOGY_UMTS:
        /* fallthrough */
        case ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA:
        /* fallthrough */
        case ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA:
        /* fallthrough */
        case ServiceState.RIL_RADIO_TECHNOLOGY_HSPA:
        /* fallthrough */
        case ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP:
        /* fallthrough */
        case ServiceState.RIL_RADIO_TECHNOLOGY_GSM:
            /* fallthrough */
            break;
        default:
            // If we are not currently on WCDMA/HSPA, then we don't need to do a fixup.
            return signalStrength;
    }
    // GSM report to the WCDMA report, leaving everything else empty.
    return new SignalStrength(new CellSignalStrengthCdma(), new CellSignalStrengthGsm(), new CellSignalStrengthWcdma(gsmStrength.getRssi(), gsmStrength.getBitErrorRate(), CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE), new CellSignalStrengthTdscdma(), new CellSignalStrengthLte(), new CellSignalStrengthNr());
}
Also used : CellSignalStrengthLte(android.telephony.CellSignalStrengthLte) CellSignalStrengthGsm(android.telephony.CellSignalStrengthGsm) ServiceState(android.telephony.ServiceState) CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) CellSignalStrengthWcdma(android.telephony.CellSignalStrengthWcdma) CellSignalStrengthTdscdma(android.telephony.CellSignalStrengthTdscdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) SignalStrength(android.telephony.SignalStrength)

Example 19 with CellSignalStrengthTdscdma

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

the class CellSignalStrengthTdscdmaTest method testDefaultConstructor.

@SmallTest
public void testDefaultConstructor() {
    CellSignalStrengthTdscdma css = new CellSignalStrengthTdscdma();
    assertEquals(CellInfo.UNAVAILABLE, css.getRssi());
    assertEquals(CellInfo.UNAVAILABLE, css.getBitErrorRate());
    assertEquals(CellInfo.UNAVAILABLE, css.getRscp());
}
Also used : CellSignalStrengthTdscdma(android.telephony.CellSignalStrengthTdscdma) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

CellSignalStrengthTdscdma (android.telephony.CellSignalStrengthTdscdma)19 CellSignalStrengthCdma (android.telephony.CellSignalStrengthCdma)13 CellSignalStrengthGsm (android.telephony.CellSignalStrengthGsm)13 CellSignalStrengthLte (android.telephony.CellSignalStrengthLte)13 CellSignalStrengthNr (android.telephony.CellSignalStrengthNr)13 CellSignalStrengthWcdma (android.telephony.CellSignalStrengthWcdma)13 SignalStrength (android.telephony.SignalStrength)13 SmallTest (android.test.suitebuilder.annotation.SmallTest)11 Test (org.junit.Test)11 CellSignalStrength (android.telephony.CellSignalStrength)10 FlakyTest (androidx.test.filters.FlakyTest)8 MediumTest (android.test.suitebuilder.annotation.MediumTest)6 PersistableBundle (android.os.PersistableBundle)3 SmallTest (androidx.test.filters.SmallTest)2 Parcel (android.os.Parcel)1 CallQuality (android.telephony.CallQuality)1 CellIdentityTdscdma (android.telephony.CellIdentityTdscdma)1 CellInfo (android.telephony.CellInfo)1 CellInfoTdscdma (android.telephony.CellInfoTdscdma)1 ServiceState (android.telephony.ServiceState)1