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

Commit 723e47db authored by Kiwon Park's avatar Kiwon Park Committed by Automerger Merge Worker
Browse files

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

Merge "Revert^2 "Track last known RAT in voice call."" into tm-qpr-dev am: e50fd722 am: e98d956b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/20180495



Change-Id: I18b2063ed396f4d9b33a7766e4080ea02faf5dd4
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents bbfb1326 e98d956b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -228,6 +228,7 @@ 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;
}
+2 −1
Original line number Diff line number Diff line
@@ -788,7 +788,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                session.videoEnabled,
                session.ratAtConnected,
                session.isMultiparty,
                session.callDuration);
                session.callDuration,
                session.lastKnownRat);
    }

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

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

@@ -579,6 +579,9 @@ 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
+101 −0
Original line number Diff line number Diff line
@@ -844,6 +844,7 @@ 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);
@@ -891,6 +892,92 @@ 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() {
@@ -1011,6 +1098,7 @@ 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();
@@ -1032,6 +1120,7 @@ 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);
@@ -1135,6 +1224,7 @@ 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();
@@ -1156,6 +1246,7 @@ 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);
@@ -1279,6 +1370,7 @@ 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);
@@ -1366,6 +1458,7 @@ 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);
@@ -1427,6 +1520,7 @@ 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);
@@ -1481,6 +1575,7 @@ 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);
@@ -1659,6 +1754,7 @@ 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);
@@ -1807,6 +1903,7 @@ 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);
@@ -1901,6 +1998,7 @@ 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();
@@ -1927,6 +2025,7 @@ 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);
@@ -2165,6 +2264,7 @@ 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;
@@ -2198,6 +2298,7 @@ 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;