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

Commit 8732e8c3 authored by Chi Zhang's avatar Chi Zhang Committed by Android (Google) Code Review
Browse files

Merge "Fix codec metrics for CS MT calls" into sc-v2-dev

parents 7eaef8b4 fe229798
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)