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

Commit 7d9c28bd authored by Wink Saville's avatar Wink Saville Committed by Android (Google) Code Review
Browse files

Merge "Allow DataConnectionTrackers to manage multiple data connections."

parents 0c91a8ee 3611e5c9
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -261,8 +261,10 @@ public abstract class DataConnection extends HierarchicalStateMachine {
    protected static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100;

    //***** Member Variables
    protected int mId;
    protected int mTag;
    protected PhoneBase phone;
    protected RetryManager mRetryMgr;
    protected int cid;
    protected LinkProperties mLinkProperties = new LinkProperties();
    protected LinkCapabilities mCapabilities = new LinkCapabilities();
@@ -285,10 +287,11 @@ public abstract class DataConnection extends HierarchicalStateMachine {


   //***** Constructor
    protected DataConnection(PhoneBase phone, String name) {
    protected DataConnection(PhoneBase phone, String name, RetryManager rm) {
        super(name);
        if (DBG) log("DataConnection constructor E");
        this.phone = phone;
        mRetryMgr = rm;
        this.cid = -1;
        clearSettings();

@@ -358,8 +361,8 @@ public abstract class DataConnection extends HierarchicalStateMachine {

        if (dp.onCompletedMsg != null) {
            Message msg = dp.onCompletedMsg;
            log(String.format("msg.what=%d msg.obj=%s",
                    msg.what, ((msg.obj instanceof String) ? (String) msg.obj : "<no-reason>")));
            log(String.format("msg=%s msg.obj=%s", msg.toString(),
                    ((msg.obj instanceof String) ? (String) msg.obj : "<no-reason>")));
            AsyncResult.forMessage(msg);
            msg.sendToTarget();
        }
@@ -372,6 +375,10 @@ public abstract class DataConnection extends HierarchicalStateMachine {
        clearSettings();
    }

    public RetryManager getRetryMgr() {
        return mRetryMgr;
    }

    /**
     * Clear all settings called when entering mInactiveState.
     */
@@ -857,13 +864,13 @@ public abstract class DataConnection extends HierarchicalStateMachine {

    /**
     * Connect to the apn and return an AsyncResult in onCompletedMsg.
     * Used for cellular networks that use Acess Point Names (APN) such
     * Used for cellular networks that use Acesss Point Names (APN) such
     * as GSM networks.
     *
     * @param onCompletedMsg is sent with its msg.obj as an AsyncResult object.
     *        With AsyncResult.userObj set to the original msg.obj,
     *        AsyncResult.result = FailCause and AsyncResult.exception = Exception().
     * @param apn is the Acces Point Name to connect to
     * @param apn is the Access Point Name to connect to
     */
    public void connect(Message onCompletedMsg, ApnSetting apn) {
        sendMessage(obtainMessage(EVENT_CONNECT, new ConnectionParams(apn, onCompletedMsg)));
@@ -914,6 +921,13 @@ public abstract class DataConnection extends HierarchicalStateMachine {
        return retVal;
    }

    /**
     * Get the DataConnection ID
     */
    public int getDataConnectionId() {
        return mId;
    }

    /**
     * Return the LinkProperties for the connection.
     *
+207 −75

File changed.

Preview size limit exceeded, changes collapsed.

+10 −5
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import com.android.internal.telephony.DataConnection;
import com.android.internal.telephony.gsm.ApnSetting;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.RetryManager;

/**
 * {@hide}
@@ -39,23 +40,27 @@ public class CdmaDataConnection extends DataConnection {


    // ***** Constructor
    private CdmaDataConnection(CDMAPhone phone, String name) {
        super(phone, name);
    private CdmaDataConnection(CDMAPhone phone, String name, RetryManager rm) {
        super(phone, name, rm);
    }

    /**
     * Create the connection object
     *
     * @param phone
     * @param phone the Phone
     * @param id the connection id
     * @param rm the RetryManager
     * @return CdmaDataConnection that was created.
     */
    static CdmaDataConnection makeDataConnection(CDMAPhone phone) {
    static CdmaDataConnection makeDataConnection(CDMAPhone phone, int id, RetryManager rm) {
        synchronized (mCountLock) {
            mCount += 1;
        }
        CdmaDataConnection cdmaDc = new CdmaDataConnection(phone, "CdmaDataConnection-" + mCount);
        CdmaDataConnection cdmaDc = new CdmaDataConnection(phone,
                "CdmaDataConnection-" + mCount, rm);
        cdmaDc.start();
        if (DBG) cdmaDc.log("Made " + cdmaDc.getName());
        cdmaDc.mId = id;
        return cdmaDc;
    }

+183 −241

File changed.

Preview size limit exceeded, changes collapsed.

+10 −5
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.util.Patterns;
import com.android.internal.telephony.DataConnection;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.RetryManager;

/**
 * {@hide}
@@ -53,23 +54,27 @@ public class GsmDataConnection extends DataConnection {
    private ApnSetting apn;

    //***** Constructor
    private GsmDataConnection(GSMPhone phone, String name) {
        super(phone, name);
    private GsmDataConnection(GSMPhone phone, String name, RetryManager rm) {
        super(phone, name, rm);
    }

    /**
     * Create the connection object
     *
     * @param phone
     * @param phone the Phone
     * @param id the connection id
     * @param rm the RetryManager
     * @return GsmDataConnection that was created.
     */
    static GsmDataConnection makeDataConnection(GSMPhone phone) {
    static GsmDataConnection makeDataConnection(GSMPhone phone, int id, RetryManager rm) {
        synchronized (mCountLock) {
            mCount += 1;
        }
        GsmDataConnection gsmDc = new GsmDataConnection(phone, "GsmDataConnection-" + mCount);
        GsmDataConnection gsmDc = new GsmDataConnection(phone, "GsmDataConnection-" + mCount, rm);
        gsmDc.start();
        if (DBG) gsmDc.log("Made " + gsmDc.getName());
        gsmDc.mId = id;
        gsmDc.mRetryMgr = rm;
        return gsmDc;
    }

Loading