Search in sources :

Example 16 with CellSignalStrengthNr

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);
}
Also used : CellSignalStrengthLte(android.telephony.CellSignalStrengthLte) CellSignalStrengthGsm(android.telephony.CellSignalStrengthGsm) CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) CellSignalStrengthWcdma(android.telephony.CellSignalStrengthWcdma) CellSignalStrengthTdscdma(android.telephony.CellSignalStrengthTdscdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) CellSignalStrength(android.telephony.CellSignalStrength) SignalStrength(android.telephony.SignalStrength) FlakyTest(androidx.test.filters.FlakyTest) MediumTest(android.test.suitebuilder.annotation.MediumTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 17 with CellSignalStrengthNr

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);
}
Also used : CellSignalStrengthLte(android.telephony.CellSignalStrengthLte) CellSignalStrengthGsm(android.telephony.CellSignalStrengthGsm) CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) CellSignalStrengthWcdma(android.telephony.CellSignalStrengthWcdma) CellSignalStrengthTdscdma(android.telephony.CellSignalStrengthTdscdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) CellSignalStrength(android.telephony.CellSignalStrength) SignalStrength(android.telephony.SignalStrength) FlakyTest(androidx.test.filters.FlakyTest) MediumTest(android.test.suitebuilder.annotation.MediumTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test)

Example 18 with CellSignalStrengthNr

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);
}
Also used : CellSignalStrengthLte(android.telephony.CellSignalStrengthLte) CellSignalStrengthGsm(android.telephony.CellSignalStrengthGsm) CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) CellSignalStrengthWcdma(android.telephony.CellSignalStrengthWcdma) CellSignalStrengthTdscdma(android.telephony.CellSignalStrengthTdscdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) SignalStrength(android.telephony.SignalStrength) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 19 with CellSignalStrengthNr

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);
}
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 20 with CellSignalStrengthNr

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

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