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

Commit 278ff47e authored by Jack Yu's avatar Jack Yu
Browse files

Dynamically changing MMTEL capability

1. Dynamically changing MMTEL capability and delayed
   changing it when delay IMS tear down is enabled.
2. Support CSS indicator correctly.
3. Support data suspended correctly in voice/data
   non-concurrent scenario.

Fix: 222390426
Test: atest DataNetworkTest DataNetworkControllerTest & sanity tests
Change-Id: I112651cecade8cd6bc8c184e66c5a2f54ab0137f
parent edbd1c40
Loading
Loading
Loading
Loading
+98 −47
Original line number Original line Diff line number Diff line
@@ -77,7 +77,6 @@ import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArrayMap;
import android.util.IndentingPrintWriter;
import android.util.IndentingPrintWriter;
import android.util.LocalLog;
import android.util.LocalLog;
import android.util.Pair;
import android.util.SparseArray;
import android.util.SparseArray;
import android.util.SparseIntArray;
import android.util.SparseIntArray;


@@ -219,6 +218,15 @@ public class DataNetwork extends StateMachine {
     */
     */
    private static final int EVENT_WAITING_FOR_TEARING_DOWN_CONDITION_MET = 21;
    private static final int EVENT_WAITING_FOR_TEARING_DOWN_CONDITION_MET = 21;


    /** Event for call started. */
    private static final int EVENT_VOICE_CALL_STARTED = 22;

    /** Event for call ended. */
    private static final int EVENT_VOICE_CALL_ENDED = 23;

    /** Event for CSS indicator changed. */
    private static final int EVENT_CSS_INDICATOR_CHANGED = 24;

    /** The default MTU for IPv4 network. */
    /** The default MTU for IPv4 network. */
    private static final int DEFAULT_MTU_V4 = 1280;
    private static final int DEFAULT_MTU_V4 = 1280;


@@ -401,7 +409,11 @@ public class DataNetwork extends StateMachine {
            NetworkCapabilities.NET_CAPABILITY_HEAD_UNIT,
            NetworkCapabilities.NET_CAPABILITY_HEAD_UNIT,
            // Connectivity service will support NOT_METERED as a mutable and requestable
            // Connectivity service will support NOT_METERED as a mutable and requestable
            // capability.
            // capability.
            NetworkCapabilities.NET_CAPABILITY_NOT_METERED
            NetworkCapabilities.NET_CAPABILITY_NOT_METERED,
            // Even though MMTEL is an immutable capability, we still make it an mutable capability
            // here before we have a better solution to deal with network transition from VoPS
            // to non-VoPS network.
            NetworkCapabilities.NET_CAPABILITY_MMTEL
    );
    );


    /** The parent state. Any messages not handled by the child state fallback to this. */
    /** The parent state. Any messages not handled by the child state fallback to this. */
@@ -962,15 +974,29 @@ public class DataNetwork extends StateMachine {
            mDataConfigManager.registerForConfigUpdate(getHandler(), EVENT_DATA_CONFIG_UPDATED);
            mDataConfigManager.registerForConfigUpdate(getHandler(), EVENT_DATA_CONFIG_UPDATED);
            mPhone.getDisplayInfoController().registerForTelephonyDisplayInfoChanged(
            mPhone.getDisplayInfoController().registerForTelephonyDisplayInfoChanged(
                    getHandler(), EVENT_DISPLAY_INFO_CHANGED, null);
                    getHandler(), EVENT_DISPLAY_INFO_CHANGED, null);
            mPhone.getServiceStateTracker().registerForServiceStateChanged(getHandler(),
                    EVENT_SERVICE_STATE_CHANGED);
            for (int transport : mAccessNetworksManager.getAvailableTransports()) {
            for (int transport : mAccessNetworksManager.getAvailableTransports()) {
                mDataServiceManagers.get(transport)
                mDataServiceManagers.get(transport)
                        .registerForDataCallListChanged(getHandler(), EVENT_DATA_STATE_CHANGED);
                        .registerForDataCallListChanged(getHandler(), EVENT_DATA_STATE_CHANGED);
                mPhone.getServiceStateTracker().registerForDataRegStateOrRatChanged(
                        transport, getHandler(), EVENT_SERVICE_STATE_CHANGED, transport);
            }
            }
            mPhone.getCarrierPrivilegesTracker().registerCarrierPrivilegesListener(getHandler(),
            mPhone.getCarrierPrivilegesTracker().registerCarrierPrivilegesListener(getHandler(),
                    EVENT_CARRIER_PRIVILEGED_UIDS_CHANGED, null);
                    EVENT_CARRIER_PRIVILEGED_UIDS_CHANGED, null);


            mPhone.getServiceStateTracker().registerForCssIndicatorChanged(
                    getHandler(), EVENT_CSS_INDICATOR_CHANGED, null);
            mPhone.getCallTracker().registerForVoiceCallStarted(
                    getHandler(), EVENT_VOICE_CALL_STARTED, null);
            mPhone.getCallTracker().registerForVoiceCallEnded(
                    getHandler(), EVENT_VOICE_CALL_ENDED, null);
            // Check null for devices not supporting FEATURE_TELEPHONY_IMS.
            if (mPhone.getImsPhone() != null) {
                mPhone.getImsPhone().getCallTracker().registerForVoiceCallStarted(
                        getHandler(), EVENT_VOICE_CALL_STARTED, null);
                mPhone.getImsPhone().getCallTracker().registerForVoiceCallEnded(
                        getHandler(), EVENT_VOICE_CALL_ENDED, null);
            }

            // Only add symmetric code here, for example, registering and unregistering.
            // Only add symmetric code here, for example, registering and unregistering.
            // DefaultState.enter() is the starting point in the life cycle of the DataNetwork,
            // DefaultState.enter() is the starting point in the life cycle of the DataNetwork,
            // and DefaultState.exit() is the end. For non-symmetric initializing works, put them
            // and DefaultState.exit() is the end. For non-symmetric initializing works, put them
@@ -980,13 +1006,21 @@ public class DataNetwork extends StateMachine {
        @Override
        @Override
        public void exit() {
        public void exit() {
            logv("Unregistering all events.");
            logv("Unregistering all events.");
            // Check null for devices not supporting FEATURE_TELEPHONY_IMS.
            if (mPhone.getImsPhone() != null) {
                mPhone.getImsPhone().getCallTracker().unregisterForVoiceCallStarted(getHandler());
                mPhone.getImsPhone().getCallTracker().unregisterForVoiceCallEnded(getHandler());
            }
            mPhone.getCallTracker().unregisterForVoiceCallStarted(getHandler());
            mPhone.getCallTracker().unregisterForVoiceCallEnded(getHandler());

            mPhone.getServiceStateTracker().unregisterForCssIndicatorChanged(getHandler());
            mPhone.getCarrierPrivilegesTracker().unregisterCarrierPrivilegesListener(getHandler());
            mPhone.getCarrierPrivilegesTracker().unregisterCarrierPrivilegesListener(getHandler());
            for (int transport : mAccessNetworksManager.getAvailableTransports()) {
            for (int transport : mAccessNetworksManager.getAvailableTransports()) {
                mDataServiceManagers.get(transport)
                mDataServiceManagers.get(transport)
                        .unregisterForDataCallListChanged(getHandler());
                        .unregisterForDataCallListChanged(getHandler());
                mPhone.getServiceStateTracker().unregisterForDataRegStateOrRatChanged(
                        transport, getHandler());
            }
            }
            mPhone.getServiceStateTracker().unregisterForServiceStateChanged(getHandler());
            mPhone.getDisplayInfoController().unregisterForTelephonyDisplayInfoChanged(
            mPhone.getDisplayInfoController().unregisterForTelephonyDisplayInfoChanged(
                    getHandler());
                    getHandler());
            mDataConfigManager.unregisterForConfigUpdate(getHandler());
            mDataConfigManager.unregisterForConfigUpdate(getHandler());
@@ -999,12 +1033,9 @@ public class DataNetwork extends StateMachine {
                    onDataConfigUpdated();
                    onDataConfigUpdated();
                    break;
                    break;
                case EVENT_SERVICE_STATE_CHANGED: {
                case EVENT_SERVICE_STATE_CHANGED: {
                    // TODO: Should update suspend state when CSS indicator changes.
                    mDataCallSessionStats.onDrsOrRatChanged(getDataNetworkType());
                    // TODO: Should update suspend state when call started/ended.
                    updateSuspendState();
                    updateSuspendState();
                    updateTcpBufferSizes();
                    updateNetworkCapabilities();
                    updateBandwidthFromDataConfig();
                    updateDataCallSessionStatsOfDrsOrRatChange((AsyncResult) msg.obj);
                    break;
                    break;
                }
                }
                case EVENT_ATTACH_NETWORK_REQUEST: {
                case EVENT_ATTACH_NETWORK_REQUEST: {
@@ -1046,6 +1077,9 @@ public class DataNetwork extends StateMachine {
                case EVENT_STUCK_IN_TRANSIENT_STATE:
                case EVENT_STUCK_IN_TRANSIENT_STATE:
                case EVENT_DISPLAY_INFO_CHANGED:
                case EVENT_DISPLAY_INFO_CHANGED:
                case EVENT_WAITING_FOR_TEARING_DOWN_CONDITION_MET:
                case EVENT_WAITING_FOR_TEARING_DOWN_CONDITION_MET:
                case EVENT_CSS_INDICATOR_CHANGED:
                case EVENT_VOICE_CALL_STARTED:
                case EVENT_VOICE_CALL_ENDED:
                    // Ignore the events when not in the correct state.
                    // Ignore the events when not in the correct state.
                    log("Ignored " + eventToString(msg.what));
                    log("Ignored " + eventToString(msg.what));
                    break;
                    break;
@@ -1187,10 +1221,6 @@ public class DataNetwork extends StateMachine {
            updateSuspendState();
            updateSuspendState();
        }
        }


        @Override
        public void exit() {
        }

        @Override
        @Override
        public boolean processMessage(Message msg) {
        public boolean processMessage(Message msg) {
            logv("event=" + eventToString(msg.what));
            logv("event=" + eventToString(msg.what));
@@ -1208,7 +1238,7 @@ public class DataNetwork extends StateMachine {
                    // request is from IMS service itself, that means IMS service is already aware
                    // request is from IMS service itself, that means IMS service is already aware
                    // of the tear down. So there is no need to delay in this case.
                    // of the tear down. So there is no need to delay in this case.
                    if (tearDownReason != TEAR_DOWN_REASON_CONNECTIVITY_SERVICE_UNWANTED
                    if (tearDownReason != TEAR_DOWN_REASON_CONNECTIVITY_SERVICE_UNWANTED
                            && shouldDelayTearDown()) {
                            && shouldDelayImsTearDown()) {
                        logl("Delay IMS tear down until call ends. reason="
                        logl("Delay IMS tear down until call ends. reason="
                                + tearDownReasonToString(tearDownReason));
                                + tearDownReasonToString(tearDownReason));
                        break;
                        break;
@@ -1249,6 +1279,14 @@ public class DataNetwork extends StateMachine {
                    transitionTo(mDisconnectingState);
                    transitionTo(mDisconnectingState);
                    sendMessageDelayed(EVENT_TEAR_DOWN_NETWORK, msg.arg1, msg.arg2);
                    sendMessageDelayed(EVENT_TEAR_DOWN_NETWORK, msg.arg1, msg.arg2);
                    break;
                    break;
                case EVENT_VOICE_CALL_STARTED:
                case EVENT_VOICE_CALL_ENDED:
                case EVENT_CSS_INDICATOR_CHANGED:
                    // We might entered non-VoPS network. Need to update the network capability to
                    // remove MMTEL capability.
                    updateSuspendState();
                    updateNetworkCapabilities();
                    break;
                default:
                default:
                    return NOT_HANDLED;
                    return NOT_HANDLED;
            }
            }
@@ -1290,6 +1328,9 @@ public class DataNetwork extends StateMachine {
                case EVENT_WAITING_FOR_TEARING_DOWN_CONDITION_MET:
                case EVENT_WAITING_FOR_TEARING_DOWN_CONDITION_MET:
                case EVENT_DISPLAY_INFO_CHANGED:
                case EVENT_DISPLAY_INFO_CHANGED:
                case EVENT_TEAR_DOWN_NETWORK:
                case EVENT_TEAR_DOWN_NETWORK:
                case EVENT_CSS_INDICATOR_CHANGED:
                case EVENT_VOICE_CALL_ENDED:
                case EVENT_VOICE_CALL_STARTED:
                    // Defer the request until handover succeeds or fails.
                    // Defer the request until handover succeeds or fails.
                    deferMessage(msg);
                    deferMessage(msg);
                    break;
                    break;
@@ -1414,6 +1455,14 @@ public class DataNetwork extends StateMachine {
                case EVENT_DISPLAY_INFO_CHANGED:
                case EVENT_DISPLAY_INFO_CHANGED:
                    onDisplayInfoChanged();
                    onDisplayInfoChanged();
                    break;
                    break;
                case EVENT_CSS_INDICATOR_CHANGED:
                case EVENT_VOICE_CALL_STARTED:
                case EVENT_VOICE_CALL_ENDED:
                    // We might entered non-VoPS network. Need to update the network capability to
                    // remove MMTEL capability.
                    updateSuspendState();
                    updateNetworkCapabilities();
                    break;
                default:
                default:
                    return NOT_HANDLED;
                    return NOT_HANDLED;
            }
            }
@@ -1679,23 +1728,21 @@ public class DataNetwork extends StateMachine {
                    .forEach(builder::addCapability);
                    .forEach(builder::addCapability);
        }
        }


        // If voice call is on-going, do not change MMTEL capability, which is a immutable
        // If voice call is on-going, do not change MMTEL capability, which is an immutable
        // capability. Changing it will result in re-recreating network agent below, and the voice
        // capability. Changing it will result in CS tearing down IMS network, and the voice
        // call will drop. Whether tearing down an IMS network or not when VoPS is lost
        // call will drop.
        if (mPhone.getImsPhone() != null && mPhone.getImsPhone().getCallTracker().getState()
        if (shouldDelayImsTearDown() && mNetworkCapabilities != null
                != PhoneConstants.State.IDLE && mNetworkCapabilities != null
                && mNetworkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL)) {
                && mNetworkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL)) {
            // Previous capability has MMTEL, so add it again.
            // Previous capability has MMTEL, so add it again.
            builder.addCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL);
            builder.addCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL);
            log("Delayed IMS tear down. Reporting MMTEL capability for now.");
        } else {
        } else {
            // Always add MMTEL capability on IMS network unless network explicitly indicates VoPS
            // Always add MMTEL capability on IMS network unless network explicitly indicates VoPS
            // not supported.
            // not supported.
            if (mDataProfile.canSatisfy(NetworkCapabilities.NET_CAPABILITY_IMS)) {
            if (mDataProfile.canSatisfy(NetworkCapabilities.NET_CAPABILITY_IMS)) {
                builder.addCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL);
                builder.addCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL);
                if (mTransport == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) {
                if (mTransport == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) {
                    NetworkRegistrationInfo nri = mPhone.getServiceStateTracker().getServiceState()
                    NetworkRegistrationInfo nri = getNetworkRegistrationInfo();
                            .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
                                    AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
                    if (nri != null) {
                    if (nri != null) {
                        DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
                        DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
                        // Check if VoPS is supported by the network.
                        // Check if VoPS is supported by the network.
@@ -1703,6 +1750,7 @@ public class DataNetwork extends StateMachine {
                                && !dsri.getVopsSupportInfo().isVopsSupported()) {
                                && !dsri.getVopsSupportInfo().isVopsSupported()) {
                            builder.removeCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL);
                            builder.removeCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL);
                        }
                        }
                        log("updateNetworkCapabilities: dsri=" + dsri);
                    }
                    }
                }
                }
            }
            }
@@ -1899,19 +1947,6 @@ public class DataNetwork extends StateMachine {
        return mDataProfile;
        return mDataProfile;
    }
    }


    /**
     * Once RIL Data Radio Technology changes, the new radio technology will be returned in
     * AsyncResult.
     * See
     * {@link com.android.internal.telephony.ServiceStateTracker#registerForDataRegStateOrRatChanged}
     *
     * @param ar RegistrationInfo: {@code Pair(drs, rat)}
     */
    private void updateDataCallSessionStatsOfDrsOrRatChange(AsyncResult ar) {
        Pair<Integer, Integer> drsRatPair = (Pair<Integer, Integer>) ar.result;
        mDataCallSessionStats.onDrsOrRatChanged(drsRatPair.second);
    }

    /**
    /**
     * Update data suspended state.
     * Update data suspended state.
     */
     */
@@ -1923,13 +1958,8 @@ public class DataNetwork extends StateMachine {


        boolean newSuspendedState = false;
        boolean newSuspendedState = false;
        // Get the uncombined service state directly.
        // Get the uncombined service state directly.
        NetworkRegistrationInfo nri = mPhone.getServiceStateTracker().getServiceState()
        NetworkRegistrationInfo nri = getNetworkRegistrationInfo();
                .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, mTransport);
        if (nri == null) return;
        if (nri == null) {
            loge("Can't get network registration info for "
                    + AccessNetworkConstants.transportTypeToString(mTransport));
            return;
        }


        // Never set suspended for emergency apn. Emergency data connection
        // Never set suspended for emergency apn. Emergency data connection
        // can work while device is not in service.
        // can work while device is not in service.
@@ -2296,11 +2326,12 @@ public class DataNetwork extends StateMachine {
    }
    }


    /**
    /**
     * @return {@code true} if this tear down should be delayed until call ends on this data
     * @return {@code true} if this is an IMS network and tear down should be delayed until call
     * network. For now this is specific to IMS network only.
     * ends on this data network.
     */
     */
    public boolean shouldDelayTearDown() {
    public boolean shouldDelayImsTearDown() {
        return mDataConfigManager.isImsDelayTearDownEnabled()
        return mDataConfigManager.isImsDelayTearDownEnabled()
                && mNetworkCapabilities != null
                && mNetworkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_IMS)
                && mNetworkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_IMS)
                && mPhone.getImsPhone() != null
                && mPhone.getImsPhone() != null
                && mPhone.getImsPhone().getCallTracker().getState()
                && mPhone.getImsPhone().getCallTracker().getState()
@@ -2639,6 +2670,20 @@ public class DataNetwork extends StateMachine {
        return new NetworkScore.Builder().setLegacyInt(score).build();
        return new NetworkScore.Builder().setLegacyInt(score).build();
    }
    }


    /**
     * @return Network registration info on the current transport.
     */
    private @Nullable NetworkRegistrationInfo getNetworkRegistrationInfo() {
        NetworkRegistrationInfo nri = mPhone.getServiceStateTracker().getServiceState()
                .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, mTransport);
        if (nri == null) {
            loge("Can't get network registration info for "
                    + AccessNetworkConstants.transportTypeToString(mTransport));
            return null;
        }
        return nri;
    }

    /**
    /**
     * Get the APN type network capability. If there are more than one capabilities that are
     * Get the APN type network capability. If there are more than one capabilities that are
     * APN-types, then return the highest priority one.
     * APN-types, then return the highest priority one.
@@ -3059,6 +3104,12 @@ public class DataNetwork extends StateMachine {
                return "EVENT_STUCK_IN_TRANSIENT_STATE";
                return "EVENT_STUCK_IN_TRANSIENT_STATE";
            case EVENT_WAITING_FOR_TEARING_DOWN_CONDITION_MET:
            case EVENT_WAITING_FOR_TEARING_DOWN_CONDITION_MET:
                return "EVENT_WAITING_FOR_TEARING_DOWN_CONDITION_MET";
                return "EVENT_WAITING_FOR_TEARING_DOWN_CONDITION_MET";
            case EVENT_VOICE_CALL_STARTED:
                return "EVENT_VOICE_CALL_STARTED";
            case EVENT_VOICE_CALL_ENDED:
                return "EVENT_VOICE_CALL_ENDED";
            case EVENT_CSS_INDICATOR_CHANGED:
                return "EVENT_CSS_INDICATOR_CHANGED";
            default:
            default:
                return "Unknown(" + event + ")";
                return "Unknown(" + event + ")";
        }
        }
+1 −26
Original line number Original line Diff line number Diff line
@@ -892,7 +892,7 @@ public class DataNetworkController extends Handler {
                                            preferredTransport));
                                            preferredTransport));
                            return;
                            return;
                        }
                        }
                        if (dataNetwork.shouldDelayTearDown()) {
                        if (dataNetwork.shouldDelayImsTearDown()) {
                            log("onDataNetworkHandoverRetryStopped: Delay IMS tear down until call "
                            log("onDataNetworkHandoverRetryStopped: Delay IMS tear down until call "
                                    + "ends. " + dataNetwork);
                                    + "ends. " + dataNetwork);
                            return;
                            return;
@@ -1629,31 +1629,6 @@ public class DataNetworkController extends Handler {
            evaluation.addDataDisallowedReason(DataDisallowedReason.DATA_RESTRICTED_BY_NETWORK);
            evaluation.addDataDisallowedReason(DataDisallowedReason.DATA_RESTRICTED_BY_NETWORK);
        }
        }


        boolean delayImsTearDown = false;
        if (dataNetwork.shouldDelayTearDown()) {
            // Some carriers requires delay tearing down IMS network until the call ends even if
            // VoPS bit is lost.
            log("Ignore VoPS bit and delay IMS tear down until call ends.");
            delayImsTearDown = true;
        }

        // Check VoPS support (except for the case that we want to delay IMS tear down until the
        // voice call ends.
        if (!delayImsTearDown
                && dataNetwork.getTransport() == AccessNetworkConstants.TRANSPORT_TYPE_WWAN
                && dataNetwork.getNetworkCapabilities().hasCapability(
                        NetworkCapabilities.NET_CAPABILITY_MMTEL)) {
            NetworkRegistrationInfo nri = mServiceState.getNetworkRegistrationInfo(
                    NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
            if (nri != null) {
                DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
                if (dsri != null && dsri.getVopsSupportInfo() != null
                        && !dsri.getVopsSupportInfo().isVopsSupported()) {
                    evaluation.addDataDisallowedReason(DataDisallowedReason.VOPS_NOT_SUPPORTED);
                }
            }
        }

        // Check if device is in CDMA ECBM
        // Check if device is in CDMA ECBM
        if (mPhone.isInCdmaEcm()) {
        if (mPhone.isInCdmaEcm()) {
            evaluation.addDataDisallowedReason(DataDisallowedReason.CDMA_EMERGENCY_CALLBACK_MODE);
            evaluation.addDataDisallowedReason(DataDisallowedReason.CDMA_EMERGENCY_CALLBACK_MODE);
+4 −2
Original line number Original line Diff line number Diff line
@@ -2344,7 +2344,8 @@ public class DataConnection extends StateMachine {
                                + " regState=" + ServiceState.rilServiceStateToString(mDataRegState)
                                + " regState=" + ServiceState.rilServiceStateToString(mDataRegState)
                                + " RAT=" + ServiceState.rilRadioTechnologyToString(mRilRat));
                                + " RAT=" + ServiceState.rilRadioTechnologyToString(mRilRat));
                    }
                    }
                    mDataCallSessionStats.onDrsOrRatChanged(mRilRat);
                    mDataCallSessionStats.onDrsOrRatChanged(
                            ServiceState.rilRadioTechnologyToNetworkType(mRilRat));
                    break;
                    break;


                case EVENT_START_HANDOVER:  //calls startHandover()
                case EVENT_START_HANDOVER:  //calls startHandover()
@@ -3123,7 +3124,8 @@ public class DataConnection extends StateMachine {
                        mNetworkAgent.sendLinkProperties(mLinkProperties, DataConnection.this);
                        mNetworkAgent.sendLinkProperties(mLinkProperties, DataConnection.this);
                    }
                    }
                    retVal = HANDLED;
                    retVal = HANDLED;
                    mDataCallSessionStats.onDrsOrRatChanged(mRilRat);
                    mDataCallSessionStats.onDrsOrRatChanged(
                            ServiceState.rilRadioTechnologyToNetworkType(mRilRat));
                    break;
                    break;
                }
                }
                case EVENT_NR_FREQUENCY_CHANGED:
                case EVENT_NR_FREQUENCY_CHANGED:
+1 −3
Original line number Original line Diff line number Diff line
@@ -29,7 +29,6 @@ import android.telephony.Annotation.DataFailureCause;
import android.telephony.Annotation.NetworkType;
import android.telephony.Annotation.NetworkType;
import android.telephony.DataFailCause;
import android.telephony.DataFailCause;
import android.telephony.ServiceState;
import android.telephony.ServiceState;
import android.telephony.ServiceState.RilRadioTechnology;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting.ProtocolType;
import android.telephony.data.ApnSetting.ProtocolType;
import android.telephony.data.DataCallResponse;
import android.telephony.data.DataCallResponse;
@@ -196,8 +195,7 @@ public class DataCallSessionStats {
     * <p>NOTE: in {@link ServiceStateTracker}, change of channel number will trigger data
     * <p>NOTE: in {@link ServiceStateTracker}, change of channel number will trigger data
     * registration state change.
     * registration state change.
     */
     */
    public synchronized void onDrsOrRatChanged(@RilRadioTechnology int radioTechnology) {
    public synchronized void onDrsOrRatChanged(@NetworkType int currentRat) {
        @NetworkType int currentRat = ServiceState.rilRadioTechnologyToNetworkType(radioTechnology);
        if (mDataCallSession != null && currentRat != TelephonyManager.NETWORK_TYPE_UNKNOWN) {
        if (mDataCallSession != null && currentRat != TelephonyManager.NETWORK_TYPE_UNKNOWN) {
            if (mDataCallSession.ratAtEnd != currentRat) {
            if (mDataCallSession.ratAtEnd != currentRat) {
                mDataCallSession.ratSwitchCount++;
                mDataCallSession.ratSwitchCount++;
+3 −3
Original line number Original line Diff line number Diff line
@@ -706,9 +706,9 @@ public abstract class TelephonyTest {
                anyInt(), anyBoolean());
                anyInt(), anyBoolean());


        //Misc
        //Misc
        doReturn(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS).when(mServiceState).
        doReturn(ServiceState.RIL_RADIO_TECHNOLOGY_LTE).when(mServiceState)
                getRilDataRadioTechnology();
                .getRilDataRadioTechnology();
        doReturn(new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_UMTS,
        doReturn(new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_LTE,
                TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE))
                TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE))
                .when(mDisplayInfoController).getTelephonyDisplayInfo();
                .when(mDisplayInfoController).getTelephonyDisplayInfo();
        doReturn(mPhone).when(mCT).getPhone();
        doReturn(mPhone).when(mCT).getPhone();
Loading