Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9a98901 authored by Jordan Liu's avatar Jordan Liu
Browse files

Null checks on max/min call quality snapshots

The bad-quality snapshot may be null if the whole call had good quality.
The same is true of the good-quality snapshot if the whole call was bad.

Fixes: 130613973
Test: manual
Change-Id: Ibf7cbce46675a7998963070b776654033e0cc46d
parent 8534eac2
Loading
Loading
Loading
Loading
+40 −22
Original line number Diff line number Diff line
@@ -268,17 +268,26 @@ public class CallQualityMetrics {
        // TODO(b/130302396) this also may be possible when we put a call on hold and continue with
        // another call
        summary.totalDurationWithQualityInformationInSeconds = mLastCallQuality.getCallDuration();
        if (mWorstSsWithGoodDlQuality != null) {
            summary.snapshotOfWorstSsWithGoodQuality =
                    toCallQualityProto(mWorstSsWithGoodDlQuality.first);
            summary.worstSsWithGoodQuality = toProto(mWorstSsWithGoodDlQuality.second);
        }
        if (mBestSsWithGoodDlQuality != null) {
            summary.snapshotOfBestSsWithGoodQuality =
                    toCallQualityProto(mBestSsWithGoodDlQuality.first);
            summary.bestSsWithGoodQuality = toProto(mBestSsWithGoodDlQuality.second);
        }
        if (mWorstSsWithBadDlQuality != null) {
            summary.snapshotOfWorstSsWithBadQuality =
                    toCallQualityProto(mWorstSsWithBadDlQuality.first);
        summary.snapshotOfBestSsWithBadQuality = toCallQualityProto(mBestSsWithBadDlQuality.first);
        summary.worstSsWithGoodQuality = toProto(mWorstSsWithGoodDlQuality.second);
        summary.bestSsWithGoodQuality = toProto(mBestSsWithGoodDlQuality.second);
            summary.worstSsWithBadQuality = toProto(mWorstSsWithBadDlQuality.second);
        }
        if (mBestSsWithBadDlQuality != null) {
            summary.snapshotOfBestSsWithBadQuality =
                    toCallQualityProto(mBestSsWithBadDlQuality.first);
            summary.bestSsWithBadQuality = toProto(mBestSsWithBadDlQuality.second);
        }
        summary.snapshotOfEnd = toCallQualityProto(mLastCallQuality);
        return summary;
    }
@@ -296,17 +305,26 @@ public class CallQualityMetrics {
        // TODO(b/130302396) this also may be possible when we put a call on hold and continue with
        // another call
        summary.totalDurationWithQualityInformationInSeconds = mLastCallQuality.getCallDuration();
        if (mWorstSsWithGoodUlQuality != null) {
            summary.snapshotOfWorstSsWithGoodQuality =
                    toCallQualityProto(mWorstSsWithGoodUlQuality.first);
            summary.worstSsWithGoodQuality = toProto(mWorstSsWithGoodUlQuality.second);
        }
        if (mBestSsWithGoodUlQuality != null) {
            summary.snapshotOfBestSsWithGoodQuality =
                    toCallQualityProto(mBestSsWithGoodUlQuality.first);
            summary.bestSsWithGoodQuality = toProto(mBestSsWithGoodUlQuality.second);
        }
        if (mWorstSsWithBadUlQuality != null) {
            summary.snapshotOfWorstSsWithBadQuality =
                    toCallQualityProto(mWorstSsWithBadUlQuality.first);
        summary.snapshotOfBestSsWithBadQuality = toCallQualityProto(mBestSsWithBadUlQuality.first);
        summary.worstSsWithGoodQuality = toProto(mWorstSsWithGoodUlQuality.second);
        summary.bestSsWithGoodQuality = toProto(mBestSsWithGoodUlQuality.second);
            summary.worstSsWithBadQuality = toProto(mWorstSsWithBadUlQuality.second);
        }
        if (mBestSsWithBadUlQuality != null) {
            summary.snapshotOfBestSsWithBadQuality =
                    toCallQualityProto(mBestSsWithBadUlQuality.first);
            summary.bestSsWithBadQuality = toProto(mBestSsWithBadUlQuality.second);
        }
        summary.snapshotOfEnd = toCallQualityProto(mLastCallQuality);
        return summary;
    }