Search in sources :

Example 1 with CallQuality

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

the class CallAttributesTest method testParcelUnparcelPreciseCallState.

@SmallTest
public void testParcelUnparcelPreciseCallState() {
    CallQuality quality = new CallQuality();
    PreciseCallState pcs = new PreciseCallState();
    CallAttributes data = new CallAttributes(pcs, 10, quality);
    Parcel parcel = Parcel.obtain();
    data.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    CallAttributes unparceledData = CallAttributes.CREATOR.createFromParcel(parcel);
    parcel.recycle();
    assertEquals("PreciseCallState is not equal after parceled/unparceled", data.getPreciseCallState(), unparceledData.getPreciseCallState());
}
Also used : PreciseCallState(android.telephony.PreciseCallState) CallQuality(android.telephony.CallQuality) Parcel(android.os.Parcel) CallAttributes(android.telephony.CallAttributes) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 2 with CallQuality

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

the class CallAttributesTest method testParcelUnparcelNetworkType.

@SmallTest
public void testParcelUnparcelNetworkType() {
    CallQuality quality = new CallQuality();
    PreciseCallState pcs = new PreciseCallState();
    CallAttributes data = new CallAttributes(pcs, 10, quality);
    Parcel parcel = Parcel.obtain();
    data.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    CallAttributes unparceledData = CallAttributes.CREATOR.createFromParcel(parcel);
    parcel.recycle();
    assertEquals("NetworkType is not equal after parceled/unparceled", data.getNetworkType(), unparceledData.getNetworkType());
}
Also used : PreciseCallState(android.telephony.PreciseCallState) CallQuality(android.telephony.CallQuality) Parcel(android.os.Parcel) CallAttributes(android.telephony.CallAttributes) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 3 with CallQuality

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

the class CallQualityTest method testParcelUnparcelCallQuality.

@SmallTest
@Test
public void testParcelUnparcelCallQuality() {
    CallQuality quality = new CallQuality(1, /* downlinkCallQualityLevel */
    2, /* uplinkCallQualityLevel */
    4000, /* callDuration */
    500, /* numRtpPacketsTransmitted */
    600, /* numRtpPacketsReceived */
    70, /* numRtpPacketsTransmittedLost */
    42, /* numRtpPacketsNotReceived */
    30, /* averageRelativeJitter */
    40, /* maxRelativeJitter */
    100, /* averageRoundTripTime */
    1);
    Parcel parcel = Parcel.obtain();
    quality.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    CallQuality unparceledData = CallQuality.CREATOR.createFromParcel(parcel);
    parcel.recycle();
    assertEquals("CallQuality is not equal after parceled/unparceled", quality, unparceledData);
}
Also used : CallQuality(android.telephony.CallQuality) Parcel(android.os.Parcel) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 4 with CallQuality

use of android.telephony.CallQuality 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);
}
Also used : CellSignalStrengthLte(android.telephony.CellSignalStrengthLte) CallQuality(android.telephony.CallQuality) CellSignalStrengthGsm(android.telephony.CellSignalStrengthGsm) CellSignalStrengthNr(android.telephony.CellSignalStrengthNr) CellSignalStrengthWcdma(android.telephony.CellSignalStrengthWcdma) CellSignalStrengthTdscdma(android.telephony.CellSignalStrengthTdscdma) CallQualitySummary(com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.CallQualitySummary) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) SignalStrength(android.telephony.SignalStrength) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test)

Example 5 with CallQuality

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

the class CallQualityMetricsTest method testSnapshotOfEndDuration.

/**
 * Verifies that the snapshot of the end (the last reported call quality) is correct.
 * Currently this just checks the duration since the logic is all the same and it doesn't seem
 * likely that one field would be preserved and others would be lost.
 */
@Test
public void testSnapshotOfEndDuration() {
    CallQuality cq1 = constructCallQuality(CallQuality.CALL_QUALITY_EXCELLENT, CallQuality.CALL_QUALITY_BAD, 5000);
    CallQuality cq2 = constructCallQuality(CallQuality.CALL_QUALITY_BAD, CallQuality.CALL_QUALITY_EXCELLENT, 10000);
    CallQuality cq3 = constructCallQuality(CallQuality.CALL_QUALITY_EXCELLENT, CallQuality.CALL_QUALITY_BAD, 14000);
    mCallQualityMetrics.saveCallQuality(cq1);
    mCallQualityMetrics.saveCallQuality(cq2);
    mCallQualityMetrics.saveCallQuality(cq3);
    // verify snapshot of end
    CallQualitySummary dlSummary = mCallQualityMetrics.getCallQualitySummaryDl();
    assertEquals(14, dlSummary.snapshotOfEnd.durationInSeconds);
    CallQualitySummary ulSummary = mCallQualityMetrics.getCallQualitySummaryUl();
    assertEquals(14, ulSummary.snapshotOfEnd.durationInSeconds);
}
Also used : CallQuality(android.telephony.CallQuality) CallQualitySummary(com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.CallQualitySummary) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test)

Aggregations

CallQuality (android.telephony.CallQuality)11 Test (org.junit.Test)8 TelephonyTest (com.android.internal.telephony.TelephonyTest)7 CallQualitySummary (com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.CallQualitySummary)7 Parcel (android.os.Parcel)4 SmallTest (android.test.suitebuilder.annotation.SmallTest)4 CallAttributes (android.telephony.CallAttributes)3 PreciseCallState (android.telephony.PreciseCallState)3 CellSignalStrengthCdma (android.telephony.CellSignalStrengthCdma)1 CellSignalStrengthGsm (android.telephony.CellSignalStrengthGsm)1 CellSignalStrengthLte (android.telephony.CellSignalStrengthLte)1 CellSignalStrengthNr (android.telephony.CellSignalStrengthNr)1 CellSignalStrengthTdscdma (android.telephony.CellSignalStrengthTdscdma)1 CellSignalStrengthWcdma (android.telephony.CellSignalStrengthWcdma)1 SignalStrength (android.telephony.SignalStrength)1