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

Commit c9a4dad2 authored by Nazanin's avatar Nazanin Committed by Nazanin Bakhshi
Browse files

Move onDataCallDisconnected to DcInactiveState so

we can indicate failureCause

Bug: 182408231
Test: build
Change-Id: I401d2231821476c6f243ebb5ed84494e1d2eaab9
parent adae5ffa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2439,6 +2439,7 @@ public class DataConnection extends StateMachine {
                    mApnSetting != null ? (long) mApnSetting.getApnTypeBitmask() : 0L,
                    mApnSetting != null
                        ? mApnSetting.canHandleType(ApnSetting.TYPE_DEFAULT) : false);
            mDataCallSessionStats.onDataCallDisconnected(mDcFailCause);
            if (mHandoverState == HANDOVER_STATE_BEING_TRANSFERRED) {
                // This is from source data connection to set itself's state
                setHandoverState(HANDOVER_STATE_COMPLETED);
@@ -2930,7 +2931,6 @@ public class DataConnection extends StateMachine {

            TelephonyMetrics.getInstance().writeRilDataCallEvent(mPhone.getPhoneId(),
                    mCid, mApnSetting.getApnTypeBitmask(), RilDataCall.State.DISCONNECTED);
            mDataCallSessionStats.onDataCallDisconnected();

            mVcnManager.removeVcnNetworkPolicyChangeListener(mVcnPolicyChangeListener);

+8 −5
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.android.internal.telephony.TelephonyStatsLog.DATA_CALL_SESSION

import android.os.SystemClock;
import android.telephony.Annotation.ApnType;
import android.telephony.Annotation.DataFailureCause;
import android.telephony.Annotation.NetworkType;
import android.telephony.DataFailCause;
import android.telephony.ServiceState;
@@ -69,8 +70,7 @@ public class DataCallSessionStats {
            // deactivateDataCall hasn't been processed properly, so we save the previous atom here
            // and move on to create a new atom.
            if (mOngoingDataCall != null) {
                mOngoingDataCall.failureCause = DataFailCause.UNKNOWN;
                onDataCallDisconnected();
                onDataCallDisconnected(DataFailCause.UNKNOWN);
            }
            mOngoingDataCall = getDefaultProto(apnTypeBitMask);
            mStartTime = getTimeMillis();
@@ -96,7 +96,7 @@ public class DataCallSessionStats {
            @RilRadioTechnology int radioTechnology,
            @ApnType int apnTypeBitmask,
            @ProtocolType int protocol,
            int failureCause) {
            @DataFailureCause int failureCause) {
        // there should've been another call to initiate the atom,
        // so this method is being called out of order -> no metric will be logged
        if (mOngoingDataCall == null) {
@@ -161,14 +161,17 @@ public class DataCallSessionStats {
        mOngoingDataCall.oosAtEnd = getIsOos();
    }

    /** Stores the atom when DataConnection reaches DISCONNECTED state. */
    public synchronized void onDataCallDisconnected() {
    /** Stores the atom when DataConnection reaches DISCONNECTED state.
     *  @param failureCause failure cause as per android.telephony.DataFailCause
     **/
    public synchronized void onDataCallDisconnected(@DataFailureCause int failureCause) {
        // there should've been another call to initiate the atom,
        // so this method is being called out of order -> no atom will be saved
        if (mOngoingDataCall == null) {
            loge("onSetupDataCallResponse: no DataCallSession atom has been initiated.");
            return;
        }
        mOngoingDataCall.failureCause = failureCause;
        mOngoingDataCall.ongoing = false;
        mOngoingDataCall.durationMinutes = convertMillisToMinutes(getTimeMillis() - mStartTime);
        // store for the data call list event, after DataCall is disconnected and entered into