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

Commit e6253b41 authored by qingqi's avatar qingqi Committed by Qingqi Lei
Browse files

Fix call setup delay for calls that never connected

Bug: 257121061
Test: Manual test
Change-Id: I0e92529b9b6b098dbccbdbe2354c8c53d34a0ef7
parent 5a5a8e68
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -465,8 +465,14 @@ public class VoiceCallSessionStats {
        proto.isRoaming = serviceState != null ? serviceState.getVoiceRoaming() : false;
        proto.isMultiparty = conn.isMultiparty();
        proto.lastKnownRat = rat;

        // internal fields for tracking
        if (getDirection(conn) == VOICE_CALL_SESSION__DIRECTION__CALL_DIRECTION_MT) {
            // MT call setup hasn't begun hence set to 0
            proto.setupBeginMillis = 0L;
        } else {
            proto.setupBeginMillis = getTimeMillis();
        }

        // audio codec might have already been set
        int codec = audioQualityToCodec(bearer, conn.getAudioCodec());
@@ -492,6 +498,12 @@ public class VoiceCallSessionStats {
            loge("finishCall: could not find call to be removed, connectionId=%d", connectionId);
            return;
        }

        // Compute time it took to fail setup (except for MT calls that have never been picked up)
        if (proto.setupFailed && proto.setupBeginMillis != 0L && proto.setupDurationMillis == 0) {
            proto.setupDurationMillis = (int) (getTimeMillis() - proto.setupBeginMillis);
        }

        mCallProtos.delete(connectionId);
        proto.concurrentCallCountAtEnd = mCallProtos.size();

+3 −0
Original line number Diff line number Diff line
@@ -284,6 +284,7 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
                        TelephonyManager.NETWORK_TYPE_LTE,
                        ImsReasonInfo.CODE_SIP_FORBIDDEN);
        expectedCall.setupFailed = true;
        expectedCall.setupDurationMillis = 200;
        expectedCall.ratAtConnected = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        expectedCall.callDuration = VOICE_CALL_SESSION__CALL_DURATION__CALL_DURATION_UNKNOWN;
        VoiceCallRatUsage expectedRatUsage =
@@ -325,6 +326,7 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
                        TelephonyManager.NETWORK_TYPE_LTE,
                        ImsReasonInfo.CODE_SIP_REQUEST_CANCELLED);
        expectedCall.setupFailed = true;
        expectedCall.setupDurationMillis = 200;
        expectedCall.ratAtConnected = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        expectedCall.callDuration = VOICE_CALL_SESSION__CALL_DURATION__CALL_DURATION_UNKNOWN;
        VoiceCallRatUsage expectedRatUsage =
@@ -1547,6 +1549,7 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall.bandAtEnd = 0;
        expectedCall.ratSwitchCount = 1L;
        expectedCall.setupFailed = true;
        expectedCall.setupDurationMillis = 13000;
        expectedCall.ratAtConnected = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        expectedCall.codecBitmask = 0L;
        expectedCall.mainCodecQuality =