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