use of android.telephony.CellSignalStrengthTdscdma in project android_frameworks_opt_telephony by LineageOS.
the class SignalStrengthTest method testGetCellSignalStrengths.
@Test
public void testGetCellSignalStrengths() throws Exception {
CellSignalStrengthLte lte = new CellSignalStrengthLte(-85, -91, -6, -10, 12, 1);
CellSignalStrengthGsm gsm = new CellSignalStrengthGsm(-79, 2, 5);
CellSignalStrengthCdma cdma = new CellSignalStrengthCdma(-93, -132, -89, -125, 5);
CellSignalStrengthWcdma wcdma = new CellSignalStrengthWcdma(-94, 4, -102, -5);
CellSignalStrengthTdscdma tdscdma = new CellSignalStrengthTdscdma(-95, 2, -103);
// Test that a single object is properly stored and returned by getCellSignalStrengths()
SignalStrength s = new SignalStrength(new CellSignalStrengthCdma(), gsm, new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), new CellSignalStrengthLte(), new CellSignalStrengthNr());
List<CellSignalStrength> css = s.getCellSignalStrengths();
assertEquals(1, css.size());
assertTrue(gsm.equals(css.get(0)));
// Test that a multiple objects are properly stored and returned by getCellSignalStrengths()
s = new SignalStrength(cdma, new CellSignalStrengthGsm(), new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), lte, new CellSignalStrengthNr());
css = s.getCellSignalStrengths();
assertEquals(2, css.size());
assertTrue(css.contains(cdma));
assertTrue(css.contains(lte));
}
use of android.telephony.CellSignalStrengthTdscdma in project android_frameworks_opt_telephony by LineageOS.
the class CallQualityMetricsTest method testBestAndWorstSs.
/**
* Test that the best and worst SignalStrength (currently just LTE RSSNR) is correctly kept
* track of. CallQualityMetrics should log the best and worst SS for good and bad quality, but
* this just tests for good quality since the logic is the same.
*/
@Test
public void testBestAndWorstSs() {
// save good quality with high rssnr
CallQuality cq1 = constructCallQuality(CallQuality.CALL_QUALITY_EXCELLENT, CallQuality.CALL_QUALITY_EXCELLENT, 5000);
int rssnr1 = 30;
// ignore everything except rssnr
CellSignalStrengthLte lteSs1 = new CellSignalStrengthLte(0, 0, 0, rssnr1, 0, 0);
SignalStrength ss1 = new SignalStrength(new CellSignalStrengthCdma(), new CellSignalStrengthGsm(), new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), lteSs1, new CellSignalStrengthNr());
when(mSST.getSignalStrength()).thenReturn(ss1);
mCallQualityMetrics.saveCallQuality(cq1);
// save good quality with low rssnr
CallQuality cq2 = constructCallQuality(CallQuality.CALL_QUALITY_EXCELLENT, CallQuality.CALL_QUALITY_EXCELLENT, 10000);
int rssnr2 = -20;
// ignore everything except rssnr
CellSignalStrengthLte lteSs2 = new CellSignalStrengthLte(0, 0, 0, rssnr2, 0, 0);
SignalStrength ss2 = new SignalStrength(new CellSignalStrengthCdma(), new CellSignalStrengthGsm(), new CellSignalStrengthWcdma(), new CellSignalStrengthTdscdma(), lteSs2, new CellSignalStrengthNr());
when(mSST.getSignalStrength()).thenReturn(ss2);
mCallQualityMetrics.saveCallQuality(cq1);
CallQualitySummary dlSummary = mCallQualityMetrics.getCallQualitySummaryDl();
assertEquals(rssnr1, dlSummary.bestSsWithGoodQuality.lteSnr);
assertEquals(rssnr2, dlSummary.worstSsWithGoodQuality.lteSnr);
}
use of android.telephony.CellSignalStrengthTdscdma 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.CellSignalStrengthTdscdma 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.CellSignalStrengthTdscdma 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);
}
Aggregations