Add support for DUN over a cdma connection.
It uses the data profile paramater when setting up the connection to indicate it's a tethered connection. We get different behavior from vzw afterwards, so it is getting picked up. bug:2422545 Change-Id: Ic022845088726d723813b82e166d15d7b2945da1
This commit is contained in:
@@ -20,6 +20,8 @@ import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -71,12 +73,20 @@ public class CdmaDataConnection extends DataConnection {
|
||||
createTime = -1;
|
||||
lastFailTime = -1;
|
||||
lastFailCause = FailCause.NONE;
|
||||
int dataProfile;
|
||||
if ((cp.apn != null) && (cp.apn.types.length > 0) && (cp.apn.types[0] != null) &&
|
||||
(cp.apn.types[0].equals(Phone.APN_TYPE_DUN))) {
|
||||
if (DBG) log("CdmaDataConnection using DUN");
|
||||
dataProfile = RILConstants.DATA_PROFILE_TETHERED;
|
||||
} else {
|
||||
dataProfile = RILConstants.DATA_PROFILE_DEFAULT;
|
||||
}
|
||||
|
||||
// msg.obj will be returned in AsyncResult.userObj;
|
||||
Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
|
||||
msg.obj = cp;
|
||||
phone.mCM.setupDataCall(Integer.toString(RILConstants.SETUP_DATA_TECH_CDMA),
|
||||
Integer.toString(RILConstants.DATA_PROFILE_DEFAULT), null, null,
|
||||
Integer.toString(dataProfile), null, null,
|
||||
null, Integer.toString(RILConstants.SETUP_DATA_AUTH_PAP_CHAP), msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ import com.android.internal.telephony.DataConnection.FailCause;
|
||||
import com.android.internal.telephony.DataConnection;
|
||||
import com.android.internal.telephony.DataConnectionTracker;
|
||||
import com.android.internal.telephony.EventLogTags;
|
||||
import com.android.internal.telephony.gsm.ApnSetting;
|
||||
import com.android.internal.telephony.Phone;
|
||||
import com.android.internal.telephony.RetryManager;
|
||||
import com.android.internal.telephony.ServiceStateTracker;
|
||||
@@ -77,9 +78,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
/** Currently active CdmaDataConnection */
|
||||
private CdmaDataConnection mActiveDataConnection;
|
||||
|
||||
/** mimic of GSM's mActiveApn */
|
||||
private boolean mIsApnActive = false;
|
||||
|
||||
private boolean mPendingRestartRadio = false;
|
||||
private static final int TIME_DELAYED_TO_RESTART_RADIO =
|
||||
SystemProperties.getInt("ro.cdma.timetoradiorestart", 60000);
|
||||
@@ -108,6 +106,14 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
Phone.APN_TYPE_DUN,
|
||||
Phone.APN_TYPE_HIPRI };
|
||||
|
||||
private static final String[] mDefaultApnTypes = {
|
||||
Phone.APN_TYPE_DEFAULT,
|
||||
Phone.APN_TYPE_MMS,
|
||||
Phone.APN_TYPE_HIPRI };
|
||||
|
||||
// if we have no active Apn this is null
|
||||
protected ApnSetting mActiveApn;
|
||||
|
||||
// Possibly promoate to base class, the only difference is
|
||||
// the INTENT_RECONNECT_ALARM action is a different string.
|
||||
// Do consider technology changes if it is promoted.
|
||||
@@ -250,7 +256,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
|
||||
@Override
|
||||
protected boolean isApnTypeActive(String type) {
|
||||
return (mIsApnActive && isApnTypeAvailable(type));
|
||||
return mActiveApn != null && mActiveApn.canHandleType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -265,10 +271,9 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
|
||||
protected String[] getActiveApnTypes() {
|
||||
String[] result;
|
||||
if (mIsApnActive) {
|
||||
result = mSupportedApnTypes.clone();
|
||||
if (mActiveApn != null) {
|
||||
result = mActiveApn.types;
|
||||
} else {
|
||||
// TODO - should this return an empty array? See GSM too.
|
||||
result = new String[1];
|
||||
result[0] = Phone.APN_TYPE_DEFAULT;
|
||||
}
|
||||
@@ -414,7 +419,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
}
|
||||
|
||||
private boolean setupData(String reason) {
|
||||
|
||||
CdmaDataConnection conn = findFreeDataConnection();
|
||||
|
||||
if (conn == null) {
|
||||
@@ -423,12 +427,19 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
}
|
||||
|
||||
mActiveDataConnection = conn;
|
||||
mIsApnActive = true;
|
||||
String[] types;
|
||||
if (mRequestedApnType.equals(Phone.APN_TYPE_DUN)) {
|
||||
types = new String[1];
|
||||
types[0] = Phone.APN_TYPE_DUN;
|
||||
} else {
|
||||
types = mDefaultApnTypes;
|
||||
}
|
||||
mActiveApn = new ApnSetting(0, "", "", "", "", "", "", "", "", "", "", 0, types);
|
||||
|
||||
Message msg = obtainMessage();
|
||||
msg.what = EVENT_DATA_SETUP_COMPLETE;
|
||||
msg.obj = reason;
|
||||
conn.connect(msg);
|
||||
conn.connect(msg, mActiveApn);
|
||||
|
||||
setState(State.INITING);
|
||||
phone.notifyDataConnection(reason);
|
||||
@@ -627,7 +638,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
if (DBG) log("gotoIdleAndNotifyDataConnection: reason=" + reason);
|
||||
setState(State.IDLE);
|
||||
phone.notifyDataConnection(reason);
|
||||
mIsApnActive = false;
|
||||
mActiveApn = null;
|
||||
}
|
||||
|
||||
protected void onRecordsLoaded() {
|
||||
@@ -649,8 +660,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
*/
|
||||
@Override
|
||||
protected void onEnableNewApn() {
|
||||
// for cdma we only use this when default data is enabled..
|
||||
onTrySetupData(Phone.REASON_DATA_ENABLED);
|
||||
cleanUpConnection(true, Phone.REASON_APN_SWITCHED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -763,7 +773,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
||||
}
|
||||
|
||||
phone.notifyDataConnection(reason);
|
||||
mIsApnActive = false;
|
||||
mActiveApn = null;
|
||||
if (retryAfterDisconnected(reason)) {
|
||||
trySetupData(reason);
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ public class ApnSetting {
|
||||
String user;
|
||||
String password;
|
||||
int authType;
|
||||
String[] types;
|
||||
public String[] types;
|
||||
int id;
|
||||
String numeric;
|
||||
|
||||
|
||||
ApnSetting(int id, String numeric, String carrier, String apn, String proxy, String port,
|
||||
public ApnSetting(int id, String numeric, String carrier, String apn, String proxy, String port,
|
||||
String mmsc, String mmsProxy, String mmsPort,
|
||||
String user, String password, int authType, String[] types) {
|
||||
this.id = id;
|
||||
@@ -73,7 +73,7 @@ public class ApnSetting {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
boolean canHandleType(String type) {
|
||||
public boolean canHandleType(String type) {
|
||||
for (String t : types) {
|
||||
// DEFAULT handles all, and HIPRI is handled by DEFAULT
|
||||
if (t.equals(type) || t.equals(Phone.APN_TYPE_ALL) ||
|
||||
|
||||
Reference in New Issue
Block a user