use of android.telephony.CallQuality 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 android.telephony.CallQuality 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);
}
use of android.telephony.CallQuality in project android_frameworks_opt_telephony by LineageOS.
the class CallQualityMetricsTest method testTotalDurations_ReportedOutOfOrder.
/**
* Verify that good/bad quality and total duration stats are correct.
*
* Similar to testTotalDurations but we report the call quality out of order.
*/
@Test
public void testTotalDurations_ReportedOutOfOrder() {
// 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(cq3);
mCallQualityMetrics.saveCallQuality(cq2);
// 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 android.telephony.CallQuality in project android_frameworks_opt_telephony by LineageOS.
the class CallQualityMetricsTest method testNotAvailableIsIgnored.
/**
* Verify that if either UL or DL call quality level is not available, the CallQuality update is
* ignored.
*/
@Test
public void testNotAvailableIsIgnored() {
// CallQuality updates from the IMS service with CALL_QUALITY_NOT_AVAILABLE should be
// ignored
CallQuality cq1 = constructCallQuality(CallQuality.CALL_QUALITY_NOT_AVAILABLE, CallQuality.CALL_QUALITY_BAD, 5000);
CallQuality cq2 = constructCallQuality(CallQuality.CALL_QUALITY_BAD, CallQuality.CALL_QUALITY_NOT_AVAILABLE, 10000);
mCallQualityMetrics.saveCallQuality(cq1);
mCallQualityMetrics.saveCallQuality(cq2);
CallQualitySummary dlSummary = mCallQualityMetrics.getCallQualitySummaryDl();
assertEquals(0, dlSummary.totalGoodQualityDurationInSeconds);
assertEquals(0, dlSummary.totalBadQualityDurationInSeconds);
assertEquals(0, dlSummary.totalDurationWithQualityInformationInSeconds);
CallQualitySummary ulSummary = mCallQualityMetrics.getCallQualitySummaryUl();
assertEquals(0, ulSummary.totalGoodQualityDurationInSeconds);
assertEquals(0, ulSummary.totalBadQualityDurationInSeconds);
assertEquals(0, ulSummary.totalDurationWithQualityInformationInSeconds);
}
use of android.telephony.CallQuality in project android_frameworks_opt_telephony by LineageOS.
the class CallQualityMetricsTest method testSnapshotOfEndDuration_ReportedOutOfOrder.
/**
* 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.
*
* Similar to testSnapshotOfEndDuration but we report the call quality out of order
*/
@Test
public void testSnapshotOfEndDuration_ReportedOutOfOrder() {
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(cq3);
mCallQualityMetrics.saveCallQuality(cq2);
// verify snapshot of end
CallQualitySummary dlSummary = mCallQualityMetrics.getCallQualitySummaryDl();
assertEquals(14, dlSummary.snapshotOfEnd.durationInSeconds);
CallQualitySummary ulSummary = mCallQualityMetrics.getCallQualitySummaryUl();
assertEquals(14, ulSummary.snapshotOfEnd.durationInSeconds);
}
Aggregations