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

Commit fe229798 authored by Chi Zhang's avatar Chi Zhang
Browse files

Fix codec metrics for CS MT calls

Bug: 171244077
Test: build and atest
Change-Id: I74a310cffbad014c13803e0bba32b02d1516b95b
Merged-In: I74a310cffbad014c13803e0bba32b02d1516b95b
(cherry picked from commit 5298c129)
parent 07bee69e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -414,6 +414,12 @@ public class VoiceCallSessionStats {
            // internal fields for tracking
            proto.setupBeginMillis = getTimeMillis();

            // audio codec might have already been set
            int codec = audioQualityToCodec(bearer, conn.getAudioCodec());
            if (codec != AudioCodec.AUDIO_CODEC_UNKNOWN) {
                proto.codecBitmask = (1L << codec);
            }

            proto.concurrentCallCountAtStart = mCallProtos.size();
            mCallProtos.put(id, proto);

+6 −5
Original line number Diff line number Diff line
@@ -1313,9 +1313,9 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall.ratSwitchCount = 1L;
        expectedCall.setupFailed = true;
        expectedCall.ratAtConnected = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        expectedCall.codecBitmask = 1L << AudioCodec.AUDIO_CODEC_AMR;
        expectedCall.codecBitmask = 0L;
        expectedCall.mainCodecQuality =
                VOICE_CALL_SESSION__MAIN_CODEC_QUALITY__CODEC_QUALITY_NARROWBAND;
                VOICE_CALL_SESSION__MAIN_CODEC_QUALITY__CODEC_QUALITY_UNKNOWN;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 3000L, 1L);
@@ -1333,8 +1333,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        mVoiceCallSessionStats0.setTimeMillis(3000L);
        doReturn(TelephonyManager.NETWORK_TYPE_UMTS).when(mServiceState).getVoiceNetworkType();
        mVoiceCallSessionStats0.onServiceStateChanged(mServiceState);
        mVoiceCallSessionStats0.setTimeMillis(3100L);
        mVoiceCallSessionStats0.onAudioCodecChanged(mGsmConnection0, DriverCall.AUDIO_QUALITY_AMR);
        mVoiceCallSessionStats0.setTimeMillis(15000L);
        doReturn(DisconnectCause.LOST_SIGNAL).when(mGsmConnection0).getDisconnectCause();
        mVoiceCallSessionStats0.onRilCallListChanged(List.of(mGsmConnection0));
@@ -1437,7 +1435,8 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall.setupFailed = true;
        expectedCall.ratAtConnected = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        expectedCall.bandAtEnd = 0;
        expectedCall.codecBitmask = 1L << AudioCodec.AUDIO_CODEC_AMR;
        expectedCall.codecBitmask =
                (1L << AudioCodec.AUDIO_CODEC_AMR) | (1L << AudioCodec.AUDIO_CODEC_AMR_WB);
        expectedCall.mainCodecQuality =
                VOICE_CALL_SESSION__MAIN_CODEC_QUALITY__CODEC_QUALITY_NARROWBAND;
        VoiceCallRatUsage expectedRatUsage =
@@ -1450,10 +1449,12 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        mVoiceCallSessionStats0.setTimeMillis(2500L);
        doReturn(Call.State.INCOMING).when(mCsCall0).getState();
        doReturn(Call.State.INCOMING).when(mGsmConnection0).getState();
        doReturn(DriverCall.AUDIO_QUALITY_AMR_WB).when(mGsmConnection0).getAudioCodec();
        doReturn(DisconnectCause.NOT_DISCONNECTED).when(mGsmConnection0).getDisconnectCause();
        mVoiceCallSessionStats0.onRilCallListChanged(List.of(mGsmConnection0));
        mVoiceCallSessionStats0.setTimeMillis(3000L);
        mVoiceCallSessionStats0.onAudioCodecChanged(mGsmConnection0, DriverCall.AUDIO_QUALITY_AMR);
        doReturn(DriverCall.AUDIO_QUALITY_AMR).when(mGsmConnection0).getAudioCodec();
        mVoiceCallSessionStats0.setTimeMillis(15000L);
        doReturn(DisconnectCause.NORMAL).when(mGsmConnection0).getDisconnectCause();
        doReturn(PreciseDisconnectCause.CALL_REJECTED)