use of android.telephony.CellSignalStrengthNr in project android_frameworks_opt_telephony by LineageOS.
the class ServiceStateTrackerTest method testSignalStrength.
@Test
@MediumTest
public void testSignalStrength() {
// Send in GSM Signal Strength Info and expect isGsm == true
SignalStrength ss = new SignalStrength(new CellSignalStrengthCdma(), new CellSignalStrengthGsm(-53, 0, SignalStrength.INVALID), new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), new CellSignalStrengthLte(), new CellSignalStrengthNr());
sendSignalStrength(ss);
assertEquals(sst.getSignalStrength(), ss);
assertEquals(sst.getSignalStrength().isGsm(), true);
// Send in CDMA+LTE Signal Strength Info and expect isGsm == true
ss = new SignalStrength(new CellSignalStrengthCdma(-90, -12, SignalStrength.INVALID, SignalStrength.INVALID, SignalStrength.INVALID), new CellSignalStrengthGsm(), new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), new CellSignalStrengthLte(-110, -114, -5, 0, SignalStrength.INVALID, SignalStrength.INVALID), new CellSignalStrengthNr());
sendSignalStrength(ss);
assertEquals(sst.getSignalStrength(), ss);
assertEquals(sst.getSignalStrength().isGsm(), true);
// Send in CDMA-only Signal Strength Info and expect isGsm == false
ss = new SignalStrength(new CellSignalStrengthCdma(-90, -12, SignalStrength.INVALID, SignalStrength.INVALID, SignalStrength.INVALID), new CellSignalStrengthGsm(), new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), new CellSignalStrengthLte(), new CellSignalStrengthNr());
sendSignalStrength(ss);
assertEquals(sst.getSignalStrength(), ss);
assertEquals(sst.getSignalStrength().isGsm(), false);
}
use of android.telephony.CellSignalStrengthNr in project android_frameworks_opt_telephony by LineageOS.
the class ServiceStateTrackerTest method testLteSignalStrengthReportingCriteria.
@Test
public void testLteSignalStrengthReportingCriteria() {
SignalStrength ss = new SignalStrength(new CellSignalStrengthCdma(), new CellSignalStrengthGsm(), new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), new CellSignalStrengthLte(-110, /* rssi */
-114, /* rsrp */
-5, /* rsrq */
0, /* rssnr */
SignalStrength.INVALID, /* cqi */
SignalStrength.INVALID), new CellSignalStrengthNr());
mBundle.putBoolean(CarrierConfigManager.KEY_USE_ONLY_RSRP_FOR_LTE_SIGNAL_BAR_BOOL, true);
sendCarrierConfigUpdate();
mSimulatedCommands.setSignalStrength(ss);
mSimulatedCommands.notifySignalStrength();
waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
// Default thresholds are POOR=-115 MODERATE=-105 GOOD=-95 GREAT=-85
assertEquals(CellSignalStrength.SIGNAL_STRENGTH_POOR, sst.getSignalStrength().getLevel());
int[] lteThresholds = { // SIGNAL_STRENGTH_POOR
-130, // SIGNAL_STRENGTH_MODERATE
-120, // SIGNAL_STRENGTH_GOOD
-110, // SIGNAL_STRENGTH_GREAT
-100 };
mBundle.putIntArray(CarrierConfigManager.KEY_LTE_RSRP_THRESHOLDS_INT_ARRAY, lteThresholds);
sendCarrierConfigUpdate();
mSimulatedCommands.setSignalStrength(ss);
mSimulatedCommands.notifySignalStrength();
waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
assertEquals(sst.getSignalStrength().getLevel(), CellSignalStrength.SIGNAL_STRENGTH_MODERATE);
}
use of android.telephony.CellSignalStrengthNr in project android_frameworks_opt_telephony by LineageOS.
the class RILTest method testFixupSignalStrength10.
@Test
public void testFixupSignalStrength10() {
final int gsmWcdmaRssiDbm = -65;
// Test the positive case where rat=UMTS and SignalStrength=GSM
doReturn(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS).when(mServiceState).getRilVoiceRadioTechnology();
SignalStrength gsmSignalStrength = new SignalStrength(new CellSignalStrengthCdma(), new CellSignalStrengthGsm(gsmWcdmaRssiDbm, 1, CellInfo.UNAVAILABLE), new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), new CellSignalStrengthLte(), new CellSignalStrengthNr());
SignalStrength result = mRILUnderTest.fixupSignalStrength10(gsmSignalStrength);
assertTrue(result.getCellSignalStrengths(CellSignalStrengthGsm.class).isEmpty());
assertFalse(result.getCellSignalStrengths(CellSignalStrengthWcdma.class).isEmpty());
// Even though the dBm values are equal, the above checks ensure that the value has
// been migrated to WCDMA (with no change in the top-level getDbm() result).
assertEquals(result.getDbm(), gsmSignalStrength.getDbm());
// Test the no-op case where rat=GSM and SignalStrength=GSM
doReturn(ServiceState.RIL_RADIO_TECHNOLOGY_GSM).when(mServiceState).getRilVoiceRadioTechnology();
result = mRILUnderTest.fixupSignalStrength10(gsmSignalStrength);
assertEquals(result, gsmSignalStrength);
// Check that non-GSM non-WCDMA signal strengths are also passed through.
SignalStrength lteSignalStrength = new SignalStrength(new CellSignalStrengthCdma(), new CellSignalStrengthGsm(), new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), new CellSignalStrengthLte(CellInfo.UNAVAILABLE, -120, -10, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE), new CellSignalStrengthNr());
SignalStrength lteResult = mRILUnderTest.fixupSignalStrength10(lteSignalStrength);
assertEquals(lteResult, lteSignalStrength);
}
use of android.telephony.CellSignalStrengthNr 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);
}
use of android.telephony.CellSignalStrengthNr 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;
}
Aggregations