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

Commit 985a3f05 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge changes from topic "handover_retry"

* changes:
  Support handover retry
  Fixed incorrect unregister from connectivity service
  Removed the usage of NetworkInfo in telephony
parents d04f7bb4 e3ea025b
Loading
Loading
Loading
Loading
+56 −103
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.net.LinkProperties;
import android.net.NetworkAgentConfig;
import android.net.NetworkCapabilities;
import android.net.NetworkFactory;
import android.net.NetworkInfo;
import android.net.NetworkProvider;
import android.net.NetworkRequest;
import android.net.ProxyInfo;
@@ -59,6 +58,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.telephony.data.DataCallResponse;
import android.telephony.data.DataCallResponse.HandoverFailureMode;
import android.telephony.data.DataProfile;
import android.telephony.data.DataService;
import android.telephony.data.DataServiceCallback;
@@ -264,6 +264,9 @@ public class DataConnection extends StateMachine {
    @DataFailureCause
    private int mDcFailCause;

    @HandoverFailureMode
    private int mHandoverFailureMode;

    private Phone mPhone;
    private DataServiceManager mDataServiceManager;
    private final int mTransportType;
@@ -279,7 +282,6 @@ public class DataConnection extends StateMachine {
    private int mRilRat = ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN;
    private int mDataRegState = Integer.MAX_VALUE;
    private boolean mIsSuspended;
    private NetworkInfo mNetworkInfo;
    private int mDownlinkBandwidth = 14;
    private int mUplinkBandwidth = 14;

@@ -300,7 +302,7 @@ public class DataConnection extends StateMachine {
    public int mCid;

    @HandoverState
    private int mHandoverState;
    private int mHandoverState = HANDOVER_STATE_IDLE;
    private final Map<ApnContext, ConnectionParams> mApnContexts = new ConcurrentHashMap<>();
    PendingIntent mReconnectIntent = null;

@@ -655,9 +657,6 @@ public class DataConnection extends StateMachine {
        mRilRat = ServiceState.networkTypeToRilRadioTechnology(networkType);
        updateLinkBandwidthsFromCarrierConfig(mRilRat);

        mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_MOBILE,
                networkType, NETWORK_TYPE, TelephonyManager.getNetworkTypeName(networkType));

        addState(mDefaultState);
            addState(mInactiveState, mDefaultState);
            addState(mActivatingState, mDefaultState);
@@ -859,14 +858,13 @@ public class DataConnection extends StateMachine {
    }

    private void notifyAllWithEvent(ApnContext alreadySent, int event, String reason) {
        mNetworkInfo.setDetailedState(mNetworkInfo.getDetailedState(), reason,
                mNetworkInfo.getExtraInfo());
        for (ConnectionParams cp : mApnContexts.values()) {
            ApnContext apnContext = cp.mApnContext;
            if (apnContext == alreadySent) continue;
            if (reason != null) apnContext.setReason(reason);
            Pair<ApnContext, Integer> pair = new Pair<>(apnContext, cp.mConnectionGeneration);
            Message msg = mDct.obtainMessage(event, mCid, cp.mRequestType, pair);
            Message msg = mDct.obtainMessage(event, cp.mRequestType,
                    DataCallResponse.HANDOVER_FAILURE_MODE_UNKNOWN, pair);
            AsyncResult.forMessage(msg);
            msg.sendToTarget();
        }
@@ -877,10 +875,11 @@ public class DataConnection extends StateMachine {
     *
     * @param cp is the ConnectionParams
     * @param cause and if no error the cause is DataFailCause.NONE
     * @param handoverFailureMode The action on handover failure
     * @param sendAll is true if all contexts are to be notified
     */
    private void notifyConnectCompleted(ConnectionParams cp, @DataFailureCause int cause,
                                        boolean sendAll) {
            @HandoverFailureMode int handoverFailureMode, boolean sendAll) {
        ApnContext alreadySent = null;

        if (cp != null && cp.mOnCompletedMsg != null) {
@@ -890,8 +889,8 @@ public class DataConnection extends StateMachine {
            alreadySent = cp.mApnContext;

            long timeStamp = System.currentTimeMillis();
            connectionCompletedMsg.arg1 = mCid;
            connectionCompletedMsg.arg2 = cp.mRequestType;
            connectionCompletedMsg.arg1 = cp.mRequestType;
            connectionCompletedMsg.arg2 = handoverFailureMode;

            if (cause == DataFailCause.NONE) {
                mCreateTime = timeStamp;
@@ -1005,6 +1004,8 @@ public class DataConnection extends StateMachine {
        mDownlinkBandwidth = 14;
        mUplinkBandwidth = 14;
        mIsSuspended = false;
        mHandoverState = HANDOVER_STATE_IDLE;
        mHandoverFailureMode = DataCallResponse.HANDOVER_FAILURE_MODE_UNKNOWN;
    }

    /**
@@ -1364,9 +1365,6 @@ public class DataConnection extends StateMachine {
    /**
     * Get the network capabilities for this data connection.
     *
     * Note that this method reads fields from mNetworkInfo, so its output is only as fresh
     * as mNetworkInfo. Call updateNetworkInfoSuspendState before calling this.
     *
     * @return the {@link NetworkCapabilities} of this data connection.
     */
    public NetworkCapabilities getNetworkCapabilities() {
@@ -1484,7 +1482,7 @@ public class DataConnection extends StateMachine {
            result.removeCapability(NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED);
        }

        updateNetworkInfoSuspendState();
        updateSuspendState();
        result.setCapability(NetworkCapabilities.NET_CAPABILITY_NOT_SUSPENDED, !mIsSuspended);

        result.setAdministratorUids(mAdministratorUids);
@@ -1752,7 +1750,8 @@ public class DataConnection extends StateMachine {
                case EVENT_CONNECT:
                    if (DBG) log("DcDefaultState: msg.what=EVENT_CONNECT, fail not expected");
                    ConnectionParams cp = (ConnectionParams) msg.obj;
                    notifyConnectCompleted(cp, DataFailCause.UNKNOWN, false);
                    notifyConnectCompleted(cp, DataFailCause.UNKNOWN,
                            DataCallResponse.HANDOVER_FAILURE_MODE_UNKNOWN, false);
                    break;

                case EVENT_DISCONNECT:
@@ -1790,10 +1789,6 @@ public class DataConnection extends StateMachine {
                                + " drs=" + mDataRegState
                                + " mRilRat=" + mRilRat);
                    }
                    if (mNetworkAgent != null) {
                        updateNetworkInfo();
                        mNetworkAgent.sendNetworkInfo(mNetworkInfo, DataConnection.this);
                    }
                    break;
                default:
                    if (DBG) {
@@ -1806,34 +1801,18 @@ public class DataConnection extends StateMachine {
        }
    }

    private void updateNetworkInfo() {
        final ServiceState state = mPhone.getServiceState();

        NetworkRegistrationInfo nri = state.getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS, mTransportType);
        int subtype = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        if (nri != null) {
            subtype = nri.getAccessNetworkTechnology();
        }

        mNetworkInfo.setSubtype(subtype, TelephonyManager.getNetworkTypeName(subtype));
    }

    private void updateNetworkInfoSuspendState() {
    private void updateSuspendState() {
        if (mNetworkAgent == null) {
            Rlog.e(getName(), "Setting suspend state without a NetworkAgent");
            Rlog.d(getName(), "Setting suspend state without a NetworkAgent");
        }

        boolean suspended = isSuspended();
        if (mIsSuspended != suspended) {
            mIsSuspended = suspended;

            // If data connection is active, we need to update the suspended state.
            // If data connection is active, we need to notify the new data connection state
            // changed event.
            if (isActive()) {
                mNetworkInfo.setDetailedState(mIsSuspended
                                ? NetworkInfo.DetailedState.SUSPENDED
                                : NetworkInfo.DetailedState.CONNECTED, null,
                        mNetworkInfo.getExtraInfo());
                notifyDataConnectionState();
            }
        }
@@ -1850,12 +1829,13 @@ public class DataConnection extends StateMachine {
     */
    private class DcInactiveState extends State {
        // Inform all contexts we've failed connecting
        public void setEnterNotificationParams(ConnectionParams cp,
                                               @DataFailureCause int cause) {
        public void setEnterNotificationParams(ConnectionParams cp, @DataFailureCause int cause,
                @HandoverFailureMode int handoverFailureMode) {
            if (VDBG) log("DcInactiveState: setEnterNotificationParams cp,cause");
            mConnectionParams = cp;
            mDisconnectParams = null;
            mDcFailCause = cause;
            mHandoverFailureMode = handoverFailureMode;
        }

        // Inform all contexts we've failed disconnected
@@ -1884,6 +1864,7 @@ public class DataConnection extends StateMachine {
                    mApnSetting != null
                        ? mApnSetting.canHandleType(ApnSetting.TYPE_DEFAULT) : false);
            if (mHandoverState == HANDOVER_STATE_BEING_TRANSFERRED) {
                // This is from source data connection to set itself's state
                setHandoverState(HANDOVER_STATE_COMPLETED);
            }

@@ -1907,15 +1888,8 @@ public class DataConnection extends StateMachine {
                            "Handover failed and dangling agent found.");
                    mHandoverSourceNetworkAgent.acquireOwnership(
                            DataConnection.this, mTransportType);
                    NetworkInfo networkInfo = mHandoverSourceNetworkAgent.getNetworkInfo();
                    if (networkInfo != null) {
                    log("Cleared dangling network agent. " + mHandoverSourceNetworkAgent);
                    mHandoverSourceNetworkAgent.unregister(DataConnection.this);
                    } else {
                        String str = "Failed to get network info.";
                        loge(str);
                        mHandoverLocalLog.log(str);
                    }
                    mHandoverSourceNetworkAgent.releaseOwnership(DataConnection.this);
                }
                mHandoverSourceNetworkAgent = null;
@@ -1926,7 +1900,7 @@ public class DataConnection extends StateMachine {
                    log("DcInactiveState: enter notifyConnectCompleted +ALL failCause="
                            + mDcFailCause);
                }
                notifyConnectCompleted(mConnectionParams, mDcFailCause, true);
                notifyConnectCompleted(mConnectionParams, mDcFailCause, mHandoverFailureMode, true);
            }
            if (mDisconnectParams != null) {
                if (DBG) {
@@ -1979,7 +1953,7 @@ public class DataConnection extends StateMachine {
                    if (!initConnection(cp)) {
                        log("DcInactiveState: msg.what=EVENT_CONNECT initConnection failed");
                        notifyConnectCompleted(cp, DataFailCause.UNACCEPTABLE_NETWORK_PARAMETER,
                                false);
                                DataCallResponse.HANDOVER_FAILURE_MODE_UNKNOWN, false);
                        transitionTo(mInactiveState);
                        return HANDLED;
                    }
@@ -1987,7 +1961,8 @@ public class DataConnection extends StateMachine {
                    int cause = connect(cp);
                    if (cause != DataFailCause.NONE) {
                        log("DcInactiveState: msg.what=EVENT_CONNECT connect failed");
                        notifyConnectCompleted(cp, cause, false);
                        notifyConnectCompleted(cp, cause,
                                DataCallResponse.HANDOVER_FAILURE_MODE_UNKNOWN, false);
                        transitionTo(mInactiveState);
                        return HANDLED;
                    }
@@ -2087,7 +2062,8 @@ public class DataConnection extends StateMachine {
                            // Vendor ril rejected the command and didn't connect.
                            // Transition to inactive but send notifications after
                            // we've entered the mInactive state.
                            mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
                            mInactiveState.setEnterNotificationParams(cp, result.mFailCause,
                                    DataCallResponse.HANDOVER_FAILURE_MODE_UNKNOWN);
                            transitionTo(mInactiveState);
                            break;
                        case ERROR_INVALID_ARG:
@@ -2119,7 +2095,10 @@ public class DataConnection extends StateMachine {
                            // Save the cause. DcTracker.onDataSetupComplete will check this
                            // failure cause and determine if we need to retry this APN later
                            // or not.
                            mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
                            mInactiveState.setEnterNotificationParams(cp, result.mFailCause,
                                    // TODO: The actual failure mode should come from the underlying
                                    //  data service
                                    DataCallResponse.HANDOVER_FAILURE_MODE_LEGACY);
                            transitionTo(mInactiveState);
                            break;
                        case ERROR_STALE:
@@ -2163,9 +2142,6 @@ public class DataConnection extends StateMachine {
                    mApnSetting != null ? (long) mApnSetting.getApnTypeBitmask() : 0L,
                    mApnSetting != null
                        ? mApnSetting.canHandleType(ApnSetting.TYPE_DEFAULT) : false);

            updateNetworkInfo();

            // If we were retrying there maybe more than one, otherwise they'll only be one.
            notifyAllWithEvent(null, DctConstants.EVENT_DATA_SETUP_COMPLETE,
                    Phone.REASON_CONNECTED);
@@ -2179,9 +2155,6 @@ public class DataConnection extends StateMachine {
            // if it didn't then this is effectively a NOP.
            mDcController.addActiveDcByCid(DataConnection.this);

            mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.CONNECTED,
                    mNetworkInfo.getReason(), null);
            mNetworkInfo.setExtraInfo(mApnSetting.getApnName());
            updateTcpBufferSizes(mRilRat);
            updateLinkBandwidthsFromCarrierConfig(mRilRat);

@@ -2241,6 +2214,7 @@ public class DataConnection extends StateMachine {
                    // do it now because connectivity service does not support dynamically removing
                    // immutable capabilities.

                    mNetworkAgent.updateLegacySubtype(DataConnection.this);
                    // Update the capability after handover
                    mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(),
                            DataConnection.this);
@@ -2260,9 +2234,8 @@ public class DataConnection extends StateMachine {

                mDisabledApnTypeBitMask |= getDisallowedApnTypes();
                updateLinkPropertiesHttpProxy();
                mNetworkAgent = new DcNetworkAgent(DataConnection.this,
                        mPhone, mNetworkInfo, mScore, configBuilder.build(), provider,
                        mTransportType);
                mNetworkAgent = new DcNetworkAgent(DataConnection.this, mPhone, mScore,
                        configBuilder.build(), provider, mTransportType);
                // All network agents start out in CONNECTING mode, but DcNetworkAgents are
                // created when the network is already connected. Hence, send the connected
                // notification immediately.
@@ -2283,34 +2256,22 @@ public class DataConnection extends StateMachine {
        @Override
        public void exit() {
            if (DBG) log("DcActiveState: exit dc=" + this);
            String reason = mNetworkInfo.getReason();
            if(mDcController.isExecutingCarrierChange()) {
                reason = Phone.REASON_CARRIER_CHANGE;
            } else if (mDisconnectParams != null && mDisconnectParams.mReason != null) {
                reason = mDisconnectParams.mReason;
            } else {
                reason = DataFailCause.toString(mDcFailCause);
            }
            mPhone.getCallTracker().unregisterForVoiceCallStarted(getHandler());
            mPhone.getCallTracker().unregisterForVoiceCallEnded(getHandler());

            // If the data connection is being handover to other transport, we should not notify
            // disconnected to connectivity service.
            if (mHandoverState != HANDOVER_STATE_BEING_TRANSFERRED) {
                mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.DISCONNECTED,
                        reason, mNetworkInfo.getExtraInfo());
            }

            if (mTransportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) {
                mPhone.mCi.unregisterForNattKeepaliveStatus(getHandler());
                mPhone.mCi.unregisterForLceInfo(getHandler());
            }

            // If we are still owning this agent, then we should inform connectivity service the
            // data connection is disconnected. If we don't own this agent at this point, that means
            // it has been transferred to the new data connection for IWLAN data handover case.
            // data connection is disconnected. There is one exception that we shouldn't unregister,
            // which is when IWLAN handover is ongoing. Instead of unregistering, the agent will
            // be transferred to the new data connection on the other transport.
            if (mNetworkAgent != null) {
                mNetworkAgent.sendNetworkInfo(mNetworkInfo, DataConnection.this);
                if (mHandoverState == HANDOVER_STATE_IDLE) {
                    mNetworkAgent.unregister(DataConnection.this);
                }
                mNetworkAgent.releaseOwnership(DataConnection.this);
            }
            mNetworkAgent = null;
@@ -2339,7 +2300,8 @@ public class DataConnection extends StateMachine {
                    if (DBG) {
                        log("DcActiveState: EVENT_CONNECT cp=" + cp + " dc=" + DataConnection.this);
                    }
                    notifyConnectCompleted(cp, DataFailCause.NONE, false);
                    notifyConnectCompleted(cp, DataFailCause.NONE,
                            DataCallResponse.HANDOVER_FAILURE_MODE_UNKNOWN, false);
                    retVal = HANDLED;
                    break;
                }
@@ -2418,10 +2380,11 @@ public class DataConnection extends StateMachine {
                                + " mRilRat=" + mRilRat);
                    }
                    if (mNetworkAgent != null) {
                        updateNetworkInfoSuspendState();
                        mNetworkAgent.updateLegacySubtype(DataConnection.this);
                        // The new suspended state will be passed through connectivity service
                        // through NET_CAPABILITY_NOT_SUSPENDED.
                        mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(),
                                DataConnection.this);
                        mNetworkAgent.sendNetworkInfo(mNetworkInfo, DataConnection.this);
                        mNetworkAgent.sendLinkProperties(mLinkProperties, DataConnection.this);
                    }
                    retVal = HANDLED;
@@ -2449,12 +2412,13 @@ public class DataConnection extends StateMachine {
                    // fallthrough
                case EVENT_DATA_CONNECTION_ROAM_ON:
                case EVENT_DATA_CONNECTION_ROAM_OFF:
                case EVENT_DATA_CONNECTION_OVERRIDE_CHANGED: {
                case EVENT_DATA_CONNECTION_OVERRIDE_CHANGED:
                case EVENT_DATA_CONNECTION_VOICE_CALL_STARTED:
                case EVENT_DATA_CONNECTION_VOICE_CALL_ENDED: {
                    if (mNetworkAgent != null) {
                        updateNetworkInfo();
                        mNetworkAgent.updateLegacySubtype(DataConnection.this);
                        mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(),
                                DataConnection.this);
                        mNetworkAgent.sendNetworkInfo(mNetworkInfo, DataConnection.this);
                    }
                    retVal = HANDLED;
                    break;
@@ -2471,18 +2435,6 @@ public class DataConnection extends StateMachine {
                    retVal = HANDLED;
                    break;
                }
                case EVENT_DATA_CONNECTION_VOICE_CALL_STARTED:
                case EVENT_DATA_CONNECTION_VOICE_CALL_ENDED: {
                    if (mNetworkAgent != null) {
                        updateNetworkInfoSuspendState();
                        updateNetworkInfo();
                        mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(),
                                DataConnection.this);
                        mNetworkAgent.sendNetworkInfo(mNetworkInfo, DataConnection.this);
                    }
                    retVal = HANDLED;
                    break;
                }
                case EVENT_KEEPALIVE_START_REQUEST: {
                    KeepalivePacketData pkt = (KeepalivePacketData) msg.obj;
                    int slotId = msg.arg1;
@@ -2757,7 +2709,8 @@ public class DataConnection extends StateMachine {
                        // Transition to inactive but send notifications after
                        // we've entered the mInactive state.
                        mInactiveState.setEnterNotificationParams(cp,
                                DataFailCause.UNACCEPTABLE_NETWORK_PARAMETER);
                                DataFailCause.UNACCEPTABLE_NETWORK_PARAMETER,
                                DataCallResponse.HANDOVER_FAILURE_MODE_UNKNOWN);
                        transitionTo(mInactiveState);
                    } else {
                        if (DBG) {
+33 −41
Original line number Diff line number Diff line
@@ -24,14 +24,16 @@ import android.net.NattKeepalivePacketData;
import android.net.NetworkAgent;
import android.net.NetworkAgentConfig;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.net.NetworkProvider;
import android.net.SocketKeepalive;
import android.net.Uri;
import android.os.Message;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.Annotation.NetworkType;
import android.telephony.AnomalyReporter;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.util.ArrayMap;
import android.util.LocalLog;
@@ -78,13 +80,11 @@ public class DcNetworkAgent extends NetworkAgent {

    private final LocalLog mNetCapsLocalLog = new LocalLog(50);

    private NetworkInfo mNetworkInfo;

    // For interface duplicate detection. Key is the net id, value is the interface name in string.
    private static Map<Integer, String> sInterfaceNames = new ArrayMap<>();

    DcNetworkAgent(DataConnection dc, Phone phone, NetworkInfo ni, int score,
            NetworkAgentConfig config, NetworkProvider networkProvider, int transportType) {
    DcNetworkAgent(DataConnection dc, Phone phone, int score, NetworkAgentConfig config,
            NetworkProvider networkProvider, int transportType) {
        super(phone.getContext(), dc.getHandler().getLooper(), "DcNetworkAgent",
                dc.getNetworkCapabilities(), dc.getLinkProperties(), score, config,
                networkProvider);
@@ -95,9 +95,9 @@ public class DcNetworkAgent extends NetworkAgent {
        mNetworkCapabilities = dc.getNetworkCapabilities();
        mTransportType = transportType;
        mDataConnection = dc;
        mNetworkInfo = new NetworkInfo(ni);
        setLegacySubtype(ni.getSubtype(), ni.getSubtypeName());
        setLegacyExtraInfo(ni.getExtraInfo());
        int networkType = getNetworkType();
        setLegacySubtype(networkType, TelephonyManager.getNetworkTypeName(networkType));
        setLegacyExtraInfo(dc.getApnSetting().getApnName());
        if (dc.getLinkProperties() != null) {
            checkDuplicateInterface(mId, dc.getLinkProperties().getInterfaceName());
            logd("created for data connection " + dc.getName() + ", "
@@ -107,6 +107,19 @@ public class DcNetworkAgent extends NetworkAgent {
        }
    }

    private @NetworkType int getNetworkType() {
        ServiceState ss = mPhone.getServiceState();
        int networkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;

        NetworkRegistrationInfo nri = ss.getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS, mTransportType);
        if (nri != null) {
            networkType = nri.getAccessNetworkTechnology();
        }

        return networkType;
    }

    private void checkDuplicateInterface(int netId, @Nullable String interfaceName) {
        for (Map.Entry<Integer, String> entry: sInterfaceNames.entrySet()) {
            if (Objects.equals(interfaceName, entry.getValue())) {
@@ -222,6 +235,18 @@ public class DcNetworkAgent extends NetworkAgent {
        return true;
    }

    /**
     * Update the legacy sub type (i.e. data network type).
     *
     * @param dc The data connection that invokes this method.
     */
    public synchronized void updateLegacySubtype(DataConnection dc) {
        if (!isOwned(dc, "updateLegacySubtype")) return;

        int networkType = getNetworkType();
        setLegacySubtype(networkType, TelephonyManager.getNetworkTypeName(networkType));
    }

    /**
     * Set the network capabilities.
     *
@@ -293,39 +318,6 @@ public class DcNetworkAgent extends NetworkAgent {
        super.unregister();
    }

    /**
     * Set the network info.
     *
     * @param networkInfo The network info.
     * @param dc The data connection that invokes this method.
     */
    public synchronized void sendNetworkInfo(NetworkInfo networkInfo, DataConnection dc) {
        if (!isOwned(dc, "sendNetworkInfo")) return;
        final NetworkInfo.State oldState = mNetworkInfo.getState();
        final NetworkInfo.State state = networkInfo.getState();
        if (!mNetworkInfo.getExtraInfo().equals(networkInfo.getExtraInfo())) {
            setLegacyExtraInfo(networkInfo.getExtraInfo());
        }
        int subType = networkInfo.getSubtype();
        if (mNetworkInfo.getSubtype() != subType) {
            setLegacySubtype(subType, TelephonyManager.getNetworkTypeName(subType));
        }
        if ((oldState == NetworkInfo.State.SUSPENDED || oldState == NetworkInfo.State.CONNECTED)
                && state == NetworkInfo.State.DISCONNECTED) {
            unregister(dc);
        }
        mNetworkInfo = new NetworkInfo(networkInfo);
    }

    /**
     * Get the latest sent network info.
     *
     * @return network info
     */
    public synchronized NetworkInfo getNetworkInfo() {
        return mNetworkInfo;
    }

    @Override
    public synchronized void onStartSocketKeepalive(int slot, @NonNull Duration interval,
            @NonNull KeepalivePacketData packet) {
+39 −24

File changed.

Preview size limit exceeded, changes collapsed.

+4 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.telephony.DataFailCause;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.data.DataCallResponse.HandoverFailureMode;
import android.view.WindowManager;

import com.android.internal.telephony.DctConstants;
@@ -131,7 +132,7 @@ public class VendorDcTracker extends DcTracker {

    @Override
    protected void onDataSetupComplete(ApnContext apnContext, boolean success, int cause,
            @RequestNetworkType int requestType) {
            @RequestNetworkType int requestType, @HandoverFailureMode int handoverFailureMode) {
        boolean isPdpRejectConfigEnabled = mPhone.getContext().getResources().getBoolean(
                com.android.internal.R.bool.config_pdp_reject_enable_retry);
        if (success) {
@@ -142,7 +143,7 @@ public class VendorDcTracker extends DcTracker {
            mPdpRejectCauseCode = cause;
        }

        super.onDataSetupComplete(apnContext, success, cause, requestType);
        super.onDataSetupComplete(apnContext, success, cause, requestType, handoverFailureMode);
    }

    @Override
@@ -187,7 +188,7 @@ public class VendorDcTracker extends DcTracker {
            // Wait a bit before trying the next APN, so that
            // we're not tying up the RIL command channel

            startReconnect(delay, apnContext);
            startReconnect(delay, apnContext, requestType);
        } else {
            // If we are not going to retry any APN, set this APN context to failed state.
            // This would be the final state of a data connection.
+0 −7

File changed.

Preview size limit exceeded, changes collapsed.

Loading