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

Commit b3d56073 authored by Martijn Coenen's avatar Martijn Coenen Committed by Automerger Merge Worker
Browse files

Merge "Revert "Track last known RAT in voice call."" into tm-qpr-dev am: 4683069b

parents d8ca662f 4683069b
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -222,7 +222,6 @@ message VoiceCallSession {
    optional int32 rat_at_connected = 30;
    optional bool is_multiparty = 31;
    optional int32 call_duration = 32;
    optional int32 last_known_rat = 33;
    // Internal use only
    optional int64 setup_begin_millis = 10001;
}
+1 −2
Original line number Diff line number Diff line
@@ -770,8 +770,7 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                session.videoEnabled,
                session.ratAtConnected,
                session.isMultiparty,
                session.callDuration,
                session.lastKnownRat);
                session.callDuration);
    }

    private static StatsEvent buildStatsEvent(IncomingSms sms) {
+1 −4
Original line number Diff line number Diff line
@@ -449,7 +449,7 @@ public class VoiceCallSessionStats {
        proto.isEmergency = conn.isEmergencyCall();
        proto.isRoaming = serviceState != null ? serviceState.getVoiceRoaming() : false;
        proto.isMultiparty = conn.isMultiparty();
        proto.lastKnownRat = rat;

        // internal fields for tracking
        proto.setupBeginMillis = getTimeMillis();

@@ -579,9 +579,6 @@ public class VoiceCallSessionStats {
            if (proto.ratAtEnd != rat) {
                proto.ratSwitchCount++;
                proto.ratAtEnd = rat;
                if (rat != TelephonyManager.NETWORK_TYPE_UNKNOWN) {
                    proto.lastKnownRat = rat;
                }
            }
            proto.bandAtEnd = (rat == TelephonyManager.NETWORK_TYPE_IWLAN)
                            ? 0
+0 −101
Original line number Diff line number Diff line
@@ -844,7 +844,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall.bandAtEnd = 0;
        expectedCall.callDuration =
                VOICE_CALL_SESSION__CALL_DURATION__CALL_DURATION_LESS_THAN_THIRTY_MINUTES;
        expectedCall.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 4000L, 1L);
@@ -892,92 +891,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
                ratUsage.get());
    }

    @Test
    @SmallTest
    public void singleImsCall_ratSwitchToUnknown() {
        setServiceState(mServiceState, TelephonyManager.NETWORK_TYPE_LTE);
        doReturn(true).when(mImsConnection0).isIncoming();
        doReturn(2000L).when(mImsConnection0).getCreateTime();
        doReturn(600001L).when(mImsConnection0).getDurationMillis();
        doReturn(mImsCall0).when(mImsConnection0).getCall();
        doReturn(new ArrayList(List.of(mImsConnection0))).when(mImsCall0).getConnections();
        VoiceCallSession expectedCall =
                makeSlot0CallProto(
                        VOICE_CALL_SESSION__BEARER_AT_END__CALL_BEARER_IMS,
                        VOICE_CALL_SESSION__DIRECTION__CALL_DIRECTION_MT,
                        TelephonyManager.NETWORK_TYPE_LTE,
                        ImsReasonInfo.CODE_USER_TERMINATED);
        expectedCall.setupDurationMillis = 80;
        expectedCall.setupFailed = false;
        expectedCall.codecBitmask = 1L << AudioCodec.AUDIO_CODEC_AMR;
        expectedCall.mainCodecQuality =
                VOICE_CALL_SESSION__MAIN_CODEC_QUALITY__CODEC_QUALITY_NARROWBAND;
        expectedCall.ratSwitchCount = 3L;
        expectedCall.ratAtEnd = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        expectedCall.bandAtEnd = 0;
        expectedCall.callDuration =
                VOICE_CALL_SESSION__CALL_DURATION__CALL_DURATION_LESS_THAN_THIRTY_MINUTES;
        expectedCall.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 4000L, 1L);
        VoiceCallRatUsage expectedRatUsageHspa =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_HSPA, 4000L, 6000L, 1L);
        VoiceCallRatUsage expectedRatUsageUmts =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_UMTS, 6000L, 8000L, 1L);
        VoiceCallRatUsage expectedRatUsageUnknown =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0,
                        TelephonyManager.NETWORK_TYPE_UNKNOWN,
                        8000L,
                        10000L,
                        1L);
        final AtomicReference<VoiceCallRatUsage[]> ratUsage = setupRatUsageCapture();

        mVoiceCallSessionStats0.setTimeMillis(2000L);
        doReturn(Call.State.INCOMING).when(mImsCall0).getState();
        doReturn(Call.State.INCOMING).when(mImsConnection0).getState();
        mVoiceCallSessionStats0.onImsCallReceived(mImsConnection0);
        mVoiceCallSessionStats0.setTimeMillis(2100L);
        mVoiceCallSessionStats0.onAudioCodecChanged(
                mImsConnection0, ImsStreamMediaProfile.AUDIO_QUALITY_AMR);
        mVoiceCallSessionStats0.setTimeMillis(2200L);
        mVoiceCallSessionStats0.onImsAcceptCall(List.of(mImsConnection0));
        mVoiceCallSessionStats0.setTimeMillis(2280L);
        doReturn(Call.State.ACTIVE).when(mImsCall0).getState();
        doReturn(Call.State.ACTIVE).when(mImsConnection0).getState();
        mVoiceCallSessionStats0.onCallStateChanged(mImsCall0);
        mVoiceCallSessionStats0.setTimeMillis(4000L);
        setServiceState(mServiceState, TelephonyManager.NETWORK_TYPE_HSPA);
        mVoiceCallSessionStats0.onServiceStateChanged(mServiceState);
        mVoiceCallSessionStats0.setTimeMillis(6000L);
        setServiceState(mServiceState, TelephonyManager.NETWORK_TYPE_UMTS);
        mVoiceCallSessionStats0.onServiceStateChanged(mServiceState);
        mVoiceCallSessionStats0.setTimeMillis(8000L);
        setServiceState(mServiceState, TelephonyManager.NETWORK_TYPE_UNKNOWN);
        mVoiceCallSessionStats0.onServiceStateChanged(mServiceState);
        mVoiceCallSessionStats0.setTimeMillis(10000L);
        mVoiceCallSessionStats0.onImsCallTerminated(
                mImsConnection0, new ImsReasonInfo(ImsReasonInfo.CODE_USER_TERMINATED, 0));

        ArgumentCaptor<VoiceCallSession> callCaptor =
                ArgumentCaptor.forClass(VoiceCallSession.class);
        verify(mPersistAtomsStorage, times(1)).addVoiceCallSession(callCaptor.capture());
        verify(mPersistAtomsStorage, times(1)).addVoiceCallRatUsage(any());
        verifyNoMoreInteractions(mPersistAtomsStorage);
        assertProtoEquals(expectedCall, callCaptor.getValue());
        assertSortedProtoArrayEquals(
                new VoiceCallRatUsage[] {
                    expectedRatUsageLte,
                    expectedRatUsageHspa,
                    expectedRatUsageUmts,
                    expectedRatUsageUnknown
                },
                ratUsage.get());
    }

    @Test
    @SmallTest
    public void singleImsCall_rttOnDial() {
@@ -1098,7 +1011,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall0.ratSwitchCount = 1L;
        expectedCall0.ratAtEnd = TelephonyManager.NETWORK_TYPE_HSPA;
        expectedCall0.bandAtEnd = 0;
        expectedCall0.lastKnownRat = TelephonyManager.NETWORK_TYPE_HSPA;
        // call 1 starts later, MT
        doReturn(true).when(mImsConnection1).isIncoming();
        doReturn(60000L).when(mImsConnection1).getCreateTime();
@@ -1120,7 +1032,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall1.ratSwitchCount = 2L;
        expectedCall1.ratAtEnd = TelephonyManager.NETWORK_TYPE_UMTS;
        expectedCall1.bandAtEnd = 0;
        expectedCall1.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 80000L, 2L);
@@ -1224,7 +1135,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall0.ratSwitchCount = 2L;
        expectedCall0.ratAtEnd = TelephonyManager.NETWORK_TYPE_UMTS;
        expectedCall0.bandAtEnd = 0;
        expectedCall0.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        // call 1 starts later, MT
        doReturn(true).when(mImsConnection1).isIncoming();
        doReturn(60000L).when(mImsConnection1).getCreateTime();
@@ -1246,7 +1156,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall1.ratSwitchCount = 1L;
        expectedCall1.ratAtEnd = TelephonyManager.NETWORK_TYPE_HSPA;
        expectedCall1.bandAtEnd = 0;
        expectedCall1.lastKnownRat = TelephonyManager.NETWORK_TYPE_HSPA;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 80000L, 2L);
@@ -1370,7 +1279,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall1.ratSwitchCount = 1L;
        expectedCall1.ratAtEnd = TelephonyManager.NETWORK_TYPE_HSPA;
        expectedCall1.bandAtEnd = 0;
        expectedCall1.lastKnownRat = TelephonyManager.NETWORK_TYPE_HSPA;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 80000L, 2L);
@@ -1458,7 +1366,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall.codecBitmask = 1L << AudioCodec.AUDIO_CODEC_AMR;
        expectedCall.mainCodecQuality =
                VOICE_CALL_SESSION__MAIN_CODEC_QUALITY__CODEC_QUALITY_NARROWBAND;
        expectedCall.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 3000L, 1L);
@@ -1520,7 +1427,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall.codecBitmask = 0L;
        expectedCall.mainCodecQuality =
                VOICE_CALL_SESSION__MAIN_CODEC_QUALITY__CODEC_QUALITY_UNKNOWN;
        expectedCall.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 3000L, 1L);
@@ -1575,7 +1481,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall.codecBitmask = 1L << AudioCodec.AUDIO_CODEC_AMR;
        expectedCall.mainCodecQuality =
                VOICE_CALL_SESSION__MAIN_CODEC_QUALITY__CODEC_QUALITY_NARROWBAND;
        expectedCall.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 3000L, 1L);
@@ -1754,7 +1659,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall.codecBitmask = 1L << AudioCodec.AUDIO_CODEC_AMR;
        expectedCall.mainCodecQuality =
                VOICE_CALL_SESSION__MAIN_CODEC_QUALITY__CODEC_QUALITY_NARROWBAND;
        expectedCall.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 10000L, 1L);
@@ -1903,7 +1807,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall.codecBitmask = 1L << AudioCodec.AUDIO_CODEC_AMR;
        expectedCall.mainCodecQuality =
                VOICE_CALL_SESSION__MAIN_CODEC_QUALITY__CODEC_QUALITY_NARROWBAND;
        expectedCall.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 7000L, 1L);
@@ -1998,7 +1901,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall0.bandAtEnd = 0;
        expectedCall0.srvccCompleted = true;
        expectedCall0.bearerAtEnd = VOICE_CALL_SESSION__BEARER_AT_END__CALL_BEARER_CS;
        expectedCall0.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        // call 1 starts later, MT
        doReturn(true).when(mImsConnection1).isIncoming();
        doReturn(60000L).when(mImsConnection1).getCreateTime();
@@ -2025,7 +1927,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        expectedCall1.bandAtEnd = 0;
        expectedCall1.srvccCompleted = true;
        expectedCall1.bearerAtEnd = VOICE_CALL_SESSION__BEARER_AT_END__CALL_BEARER_CS;
        expectedCall1.lastKnownRat = TelephonyManager.NETWORK_TYPE_UMTS;
        VoiceCallRatUsage expectedRatUsageLte =
                makeRatUsageProto(
                        CARRIER_ID_SLOT_0, TelephonyManager.NETWORK_TYPE_LTE, 2000L, 80000L, 2L);
@@ -2264,7 +2165,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        call.ratAtStart = rat;
        call.ratAtConnected = rat;
        call.ratAtEnd = rat;
        call.lastKnownRat = rat;
        call.bandAtEnd = 1;
        call.ratSwitchCount = 0L;
        call.codecBitmask = 0L;
@@ -2298,7 +2198,6 @@ public class VoiceCallSessionStatsTest extends TelephonyTest {
        call.ratAtStart = rat;
        call.ratAtConnected = rat;
        call.ratAtEnd = rat;
        call.lastKnownRat = rat;
        call.bandAtEnd = 1;
        call.ratSwitchCount = 0L;
        call.codecBitmask = 0L;