use of com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.CallQualitySummary 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 com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.CallQualitySummary 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);
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.CallQualitySummary in project android_frameworks_opt_telephony by LineageOS.
the class CallQualityMetricsTest method testTotalDurations.
/**
* Verify that good/bad quality and total duration stats are correct.
*/
@Test
public void testTotalDurations() {
// Call quality in the following sequence:
//
// DL: GOOD GOOD BAD
// UL: GOOD BAD GOOD
// |----------|----------|--------|
// 0 5 10 14
//
// 0s = Start of call. Assumed to be good quality
// 5s = Switches to UL bad quality
// 10s = Switches to UL good quality, DL bad quality
// 14s = End of call. Switches to UL bad quality, DL good quality
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 UL quality durations
CallQualitySummary dlSummary = mCallQualityMetrics.getCallQualitySummaryDl();
assertEquals(9, dlSummary.totalGoodQualityDurationInSeconds);
assertEquals(5, dlSummary.totalBadQualityDurationInSeconds);
assertEquals(14, dlSummary.totalDurationWithQualityInformationInSeconds);
// verify DL quality durations
CallQualitySummary ulSummary = mCallQualityMetrics.getCallQualitySummaryUl();
assertEquals(5, ulSummary.totalGoodQualityDurationInSeconds);
assertEquals(9, ulSummary.totalBadQualityDurationInSeconds);
assertEquals(14, ulSummary.totalDurationWithQualityInformationInSeconds);
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.CallQualitySummary in project android_frameworks_opt_telephony by LineageOS.
the class InProgressCallSessionTest method testAddCallQualitySummaryEvent.
@Test
@SmallTest
public void testAddCallQualitySummaryEvent() {
SignalStrength ss1 = new SignalStrength();
ss1.lteSnr = 22;
SignalStrength ss2 = new SignalStrength();
ss2.lteSnr = 44;
CallQuality cq1 = new CallQuality();
cq1.downlinkLevel = CallQuality.CallQualityLevel.GOOD;
cq1.uplinkLevel = CallQuality.CallQualityLevel.GOOD;
CallQuality cq2 = new CallQuality();
cq1.downlinkLevel = CallQuality.CallQualityLevel.BAD;
cq1.uplinkLevel = CallQuality.CallQualityLevel.BAD;
CallQualitySummary cqs = new CallQualitySummary();
cqs.totalGoodQualityDurationInSeconds = 2;
cqs.totalBadQualityDurationInSeconds = 3;
cqs.totalDurationWithQualityInformationInSeconds = 5;
cqs.snapshotOfWorstSsWithGoodQuality = cq2;
cqs.snapshotOfBestSsWithGoodQuality = cq2;
cqs.snapshotOfWorstSsWithBadQuality = cq1;
cqs.snapshotOfBestSsWithBadQuality = cq1;
cqs.worstSsWithGoodQuality = ss1;
cqs.bestSsWithGoodQuality = ss2;
cqs.worstSsWithBadQuality = ss1;
cqs.bestSsWithBadQuality = ss2;
CallSessionEventBuilder builder = new CallSessionEventBuilder(TelephonyProto.TelephonyCallSession.Event.Type.CALL_QUALITY_CHANGED).setCallQualitySummaryDl(cqs).setCallQualitySummaryUl(cqs);
mCallSession.addEvent(builder);
assertEquals(builder.build(), mCallSession.events.getFirst());
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.CallQualitySummary in project android_frameworks_opt_telephony by LineageOS.
the class CallQualityMetricsTest method testTotalDurations_MultipleChecks.
/**
* Verify that good/bad quality and total duration stats are correct.
*
* Similar to testTotalDurations, but getCallQualitySummaryUl/Dl will be called multiple times,
* so verify that it continues to work after the first call.
*/
@Test
public void testTotalDurations_MultipleChecks() {
// Call quality in the following sequence:
//
// DL: GOOD GOOD BAD
// UL: GOOD BAD GOOD
// |----------|----------|--------|
// 0 5 10 14
//
// 0s = Start of call. Assumed to be good quality
// 5s = Switches to UL bad quality
// 10s = Switches to UL good quality, DL bad quality
// 14s = End of call. Switches to UL bad quality, DL good quality
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 UL quality durations
CallQualitySummary dlSummary = mCallQualityMetrics.getCallQualitySummaryDl();
assertEquals(9, dlSummary.totalGoodQualityDurationInSeconds);
assertEquals(5, dlSummary.totalBadQualityDurationInSeconds);
assertEquals(14, dlSummary.totalDurationWithQualityInformationInSeconds);
// verify DL quality durations
CallQualitySummary ulSummary = mCallQualityMetrics.getCallQualitySummaryUl();
assertEquals(5, ulSummary.totalGoodQualityDurationInSeconds);
assertEquals(9, ulSummary.totalBadQualityDurationInSeconds);
assertEquals(14, ulSummary.totalDurationWithQualityInformationInSeconds);
// verify UL quality durations
dlSummary = mCallQualityMetrics.getCallQualitySummaryDl();
assertEquals(9, dlSummary.totalGoodQualityDurationInSeconds);
assertEquals(5, dlSummary.totalBadQualityDurationInSeconds);
assertEquals(14, dlSummary.totalDurationWithQualityInformationInSeconds);
// verify DL quality durations
ulSummary = mCallQualityMetrics.getCallQualitySummaryUl();
assertEquals(5, ulSummary.totalGoodQualityDurationInSeconds);
assertEquals(9, ulSummary.totalBadQualityDurationInSeconds);
assertEquals(14, ulSummary.totalDurationWithQualityInformationInSeconds);
}
Aggregations