Search in sources :

Example 21 with CellSignalStrengthNr

use of android.telephony.CellSignalStrengthNr 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 22 with CellSignalStrengthNr

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

the class CellSignalStrengthNrTest method testParcel.

@Test
public void testParcel() {
    // GIVEN an instance of CellSignalStrengthNr
    CellSignalStrengthNr css = new CellSignalStrengthNr(CSIRSRP, CSIRSRQ, CSISINR, SSRSRP, SSRSRQ, SSSINR);
    // WHEN write the object to parcel and create another object with that parcel
    Parcel parcel = Parcel.obtain();
    css.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    CellSignalStrengthNr anotherCss = CellSignalStrengthNr.CREATOR.createFromParcel(parcel);
    // THEN the new object is equal to the old one
    assertThat(anotherCss).isEqualTo(css);
    assertThat(anotherCss.getCsiRsrp()).isEqualTo(CSIRSRP);
    assertThat(anotherCss.getCsiRsrq()).isEqualTo(CSIRSRQ);
    assertThat(anotherCss.getCsiSinr()).isEqualTo(CSISINR);
    assertThat(anotherCss.getSsRsrp()).isEqualTo(SSRSRP);
    assertThat(anotherCss.getSsRsrq()).isEqualTo(SSRSRQ);
    assertThat(anotherCss.getSsSinr()).isEqualTo(SSSINR);
}
Also used : CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) Parcel(android.os.Parcel) Test(org.junit.Test)

Example 23 with CellSignalStrengthNr

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

the class CellSignalStrengthNrTest method testEquals_differentParameters.

@Test
public void testEquals_differentParameters() {
    // GIVEN an instance of CellSignalStrengthNr and another object with some different
    // parameters
    CellSignalStrengthNr css = new CellSignalStrengthNr(CSIRSRP, CSIRSRQ, CSISINR, SSRSRP, SSRSRQ, SSSINR);
    CellSignalStrengthNr anotherCss = new CellSignalStrengthNr(ANOTHER_CSIRSRP, ANOTHER_CSIRSRQ, CSISINR, SSRSRP, SSRSRQ, SSSINR);
    // THEN this two objects are different
    assertThat(css).isNotEqualTo(anotherCss);
}
Also used : CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) Test(org.junit.Test)

Example 24 with CellSignalStrengthNr

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

the class CellSignalStrengthNrTest method testUnavailableValueWithHal.

@Test
public void testUnavailableValueWithHal() {
    // GIVEN an instance of NrSignalStrength
    NrSignalStrength nrSignalStrength = new NrSignalStrength();
    nrSignalStrength.csiRsrp = CellInfo.UNAVAILABLE;
    nrSignalStrength.csiRsrq = CellInfo.UNAVAILABLE;
    nrSignalStrength.csiSinr = CellInfo.UNAVAILABLE;
    nrSignalStrength.ssRsrp = CellInfo.UNAVAILABLE;
    nrSignalStrength.ssRsrq = CellInfo.UNAVAILABLE;
    nrSignalStrength.ssSinr = CellInfo.UNAVAILABLE;
    // THEN the get method should return unavailable value
    CellSignalStrengthNr css = new CellSignalStrengthNr(nrSignalStrength);
    assertThat(css.getCsiRsrp()).isEqualTo(CellInfo.UNAVAILABLE);
    assertThat(css.getCsiRsrq()).isEqualTo(CellInfo.UNAVAILABLE);
    assertThat(css.getCsiSinr()).isEqualTo(CellInfo.UNAVAILABLE);
    assertThat(css.getSsRsrp()).isEqualTo(CellInfo.UNAVAILABLE);
    assertThat(css.getSsRsrq()).isEqualTo(CellInfo.UNAVAILABLE);
    assertThat(css.getSsSinr()).isEqualTo(CellInfo.UNAVAILABLE);
    assertThat(css.getDbm()).isEqualTo(CellInfo.UNAVAILABLE);
}
Also used : NrSignalStrength(android.hardware.radio.V1_4.NrSignalStrength) CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) Test(org.junit.Test)

Aggregations

CellSignalStrengthNr (android.telephony.CellSignalStrengthNr)24 Test (org.junit.Test)21 CellSignalStrengthCdma (android.telephony.CellSignalStrengthCdma)13 CellSignalStrengthGsm (android.telephony.CellSignalStrengthGsm)13 CellSignalStrengthLte (android.telephony.CellSignalStrengthLte)13 CellSignalStrengthTdscdma (android.telephony.CellSignalStrengthTdscdma)13 CellSignalStrengthWcdma (android.telephony.CellSignalStrengthWcdma)13 SignalStrength (android.telephony.SignalStrength)13 CellSignalStrength (android.telephony.CellSignalStrength)10 FlakyTest (androidx.test.filters.FlakyTest)8 MediumTest (android.test.suitebuilder.annotation.MediumTest)6 SmallTest (android.test.suitebuilder.annotation.SmallTest)6 PersistableBundle (android.os.PersistableBundle)3 NrSignalStrength (android.hardware.radio.V1_4.NrSignalStrength)2 SmallTest (androidx.test.filters.SmallTest)2 Parcel (android.os.Parcel)1 CallQuality (android.telephony.CallQuality)1 CellIdentityNr (android.telephony.CellIdentityNr)1 CellInfo (android.telephony.CellInfo)1 CellInfoNr (android.telephony.CellInfoNr)1