Loading telephony/java/com/android/internal/telephony/DataConnection.java +12 −3 Original line number Diff line number Diff line Loading @@ -219,6 +219,7 @@ public abstract class DataConnection extends HierarchicalStateMachine { protected static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100; //***** Member Variables protected ApnSetting mApn; protected int mTag; protected PhoneBase phone; protected int cid; Loading Loading @@ -429,11 +430,12 @@ public abstract class DataConnection extends HierarchicalStateMachine { protected void clearSettings() { if (DBG) log("clearSettings"); this.createTime = -1; this.lastFailTime = -1; this.lastFailCause = FailCause.NONE; createTime = -1; lastFailTime = -1; lastFailCause = FailCause.NONE; mLinkProperties = new LinkProperties(); mApn = null; } /** Loading Loading @@ -1087,4 +1089,11 @@ public abstract class DataConnection extends HierarchicalStateMachine { public FailCause getLastFailCause() { return lastFailCause; } /** * @return the current ApnSetting */ public ApnSetting getApn() { return mApn; } } telephony/java/com/android/internal/telephony/DataConnectionTracker.java +20 −2 Original line number Diff line number Diff line Loading @@ -441,7 +441,6 @@ public abstract class DataConnectionTracker extends Handler { protected abstract void onRadioOffOrNotAvailable(); protected abstract void onDataSetupComplete(AsyncResult ar); protected abstract void onDisconnectDone(int connId, AsyncResult ar); protected abstract void onResetDone(AsyncResult ar); protected abstract void onVoiceCallStarted(); protected abstract void onVoiceCallEnded(); protected abstract void onCleanUpConnection(boolean tearDown, int apnId, String reason); Loading Loading @@ -514,9 +513,10 @@ public abstract class DataConnectionTracker extends Handler { onSetInternalDataEnabled(enabled); break; } case EVENT_RESET_DONE: case EVENT_RESET_DONE: { onResetDone((AsyncResult) msg.obj); break; } case CMD_SET_DATA_ENABLE: { log("CMD_SET_DATA_ENABLE msg=" + msg); boolean enabled = (msg.arg1 == ENABLED) ? true : false; Loading Loading @@ -602,6 +602,8 @@ public abstract class DataConnectionTracker extends Handler { protected abstract void setState(State s); protected abstract void gotoIdleAndNotifyDataConnection(String reason); protected LinkProperties getLinkProperties(String apnType) { int id = apnTypeToId(apnType); if (isApnIdEnabled(id)) { Loading Loading @@ -872,6 +874,22 @@ public abstract class DataConnectionTracker extends Handler { protected void onEnableNewApn() { } /** * Called when EVENT_RESET_DONE is received so goto * IDLE state and send notifications to those interested. * * TODO - currently unused. Needs to be hooked into DataConnection cleanup * TODO - needs to pass some notion of which connection is reset.. */ protected void onResetDone(AsyncResult ar) { if (DBG) log("EVENT_RESET_DONE"); String reason = null; if (ar.userObj instanceof String) { reason = (String) ar.userObj; } gotoIdleAndNotifyDataConnection(reason); } /** * Prevent mobile data connections from being established, or once again * allow mobile data connections. If the state toggles, then either tear Loading telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java +1 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ public class CdmaDataConnection extends DataConnection { protected void onConnect(ConnectionParams cp) { if (DBG) log("CdmaDataConnection Connecting..."); mApn = cp.apn; createTime = -1; lastFailTime = -1; lastFailCause = FailCause.NONE; Loading telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +1 −15 Original line number Diff line number Diff line Loading @@ -508,7 +508,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { notifyDataAvailability(null); } private void gotoIdleAndNotifyDataConnection(String reason) { protected void gotoIdleAndNotifyDataConnection(String reason) { if (DBG) log("gotoIdleAndNotifyDataConnection: reason=" + reason); setState(State.IDLE); notifyDataConnection(reason); Loading Loading @@ -667,20 +667,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } } /** * Called when EVENT_RESET_DONE is received so goto * IDLE state and send notifications to those interested. */ @Override protected void onResetDone(AsyncResult ar) { if (DBG) log("EVENT_RESET_DONE"); String reason = null; if (ar.userObj instanceof String) { reason = (String) ar.userObj; } gotoIdleAndNotifyDataConnection(reason); } /** * @override com.android.internal.telephony.DataConnectionTracker */ Loading telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java +17 −28 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ public class GsmDataConnection extends DataConnection { private static final String LOG_TAG = "GSM"; //***** Instance Variables private ApnSetting apn; protected int mProfileId = RILConstants.DATA_PROFILE_DEFAULT; protected String mActiveApnType = Phone.APN_TYPE_DEFAULT; //***** Constructor Loading Loading @@ -74,13 +72,13 @@ public class GsmDataConnection extends DataConnection { @Override protected void onConnect(ConnectionParams cp) { apn = cp.apn; mApn = cp.apn; if (DBG) log("Connecting to carrier: '" + apn.carrier + "' APN: '" + apn.apn + "' proxy: '" + apn.proxy + "' port: '" + apn.port); if (DBG) log("Connecting to carrier: '" + mApn.carrier + "' APN: '" + mApn.apn + "' proxy: '" + mApn.proxy + "' port: '" + mApn.port); setHttpProxy (apn.proxy, apn.port); setHttpProxy (mApn.proxy, mApn.port); createTime = -1; lastFailTime = -1; Loading @@ -90,23 +88,23 @@ public class GsmDataConnection extends DataConnection { Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); msg.obj = cp; int authType = apn.authType; int authType = mApn.authType; if (authType == -1) { authType = (apn.user != null) ? RILConstants.SETUP_DATA_AUTH_PAP_CHAP : authType = (mApn.user != null) ? RILConstants.SETUP_DATA_AUTH_PAP_CHAP : RILConstants.SETUP_DATA_AUTH_NONE; } String protocol; if (phone.getServiceState().getRoaming()) { protocol = apn.roamingProtocol; protocol = mApn.roamingProtocol; } else { protocol = apn.protocol; protocol = mApn.protocol; } phone.mCM.setupDataCall( Integer.toString(RILConstants.SETUP_DATA_TECH_GSM), Integer.toString(mProfileId), apn.apn, apn.user, apn.password, mApn.apn, mApn.user, mApn.password, Integer.toString(authType), protocol, msg); } Loading @@ -128,15 +126,9 @@ public class GsmDataConnection extends DataConnection { mActiveApnType = apnType; } @Override protected void clearSettings() { super.clearSettings(); apn = null; } @Override public String toString() { return "State=" + getCurrentState().getName() + " Apn=" + apn + return "State=" + getCurrentState().getName() + " Apn=" + mApn + " create=" + createTime + " lastFail=" + lastFailTime + " lastFailCause=" + lastFailCause; } Loading @@ -150,11 +142,12 @@ public class GsmDataConnection extends DataConnection { // Do not apply the race condition workaround for MMS APN // if Proxy is an IP-address. // Otherwise, the default APN will not be restored anymore. if (!apn.types[0].equals(Phone.APN_TYPE_MMS) || !isIpAddress(apn.mmsProxy)) { if (!mApn.types[0].equals(Phone.APN_TYPE_MMS) || !isIpAddress(mApn.mmsProxy)) { log(String.format( "isDnsOk: return false apn.types[0]=%s APN_TYPE_MMS=%s isIpAddress(%s)=%s", apn.types[0], Phone.APN_TYPE_MMS, apn.mmsProxy, isIpAddress(apn.mmsProxy))); mApn.types[0], Phone.APN_TYPE_MMS, mApn.mmsProxy, isIpAddress(mApn.mmsProxy))); return false; } } Loading @@ -166,15 +159,11 @@ public class GsmDataConnection extends DataConnection { Log.d(LOG_TAG, "[" + getName() + "] " + s); } public ApnSetting getApn() { return this.apn; } private void setHttpProxy(String httpProxy, String httpPort) { if (DBG) log("set http proxy for" + "' APN: '" + mActiveApnType + "' proxy: '" + apn.proxy + "' port: '" + apn.port); + "' proxy: '" + mApn.proxy + "' port: '" + mApn.port); if(TextUtils.equals(mActiveApnType, Phone.APN_TYPE_DEFAULT)) { if (httpProxy == null || httpProxy.length() == 0) { phone.setSystemProperty("net.gprs.http-proxy", null); Loading Loading @@ -205,6 +194,6 @@ public class GsmDataConnection extends DataConnection { private boolean isIpAddress(String address) { if (address == null) return false; return Patterns.IP_ADDRESS.matcher(apn.mmsProxy).matches(); return Patterns.IP_ADDRESS.matcher(address).matches(); } } Loading
telephony/java/com/android/internal/telephony/DataConnection.java +12 −3 Original line number Diff line number Diff line Loading @@ -219,6 +219,7 @@ public abstract class DataConnection extends HierarchicalStateMachine { protected static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100; //***** Member Variables protected ApnSetting mApn; protected int mTag; protected PhoneBase phone; protected int cid; Loading Loading @@ -429,11 +430,12 @@ public abstract class DataConnection extends HierarchicalStateMachine { protected void clearSettings() { if (DBG) log("clearSettings"); this.createTime = -1; this.lastFailTime = -1; this.lastFailCause = FailCause.NONE; createTime = -1; lastFailTime = -1; lastFailCause = FailCause.NONE; mLinkProperties = new LinkProperties(); mApn = null; } /** Loading Loading @@ -1087,4 +1089,11 @@ public abstract class DataConnection extends HierarchicalStateMachine { public FailCause getLastFailCause() { return lastFailCause; } /** * @return the current ApnSetting */ public ApnSetting getApn() { return mApn; } }
telephony/java/com/android/internal/telephony/DataConnectionTracker.java +20 −2 Original line number Diff line number Diff line Loading @@ -441,7 +441,6 @@ public abstract class DataConnectionTracker extends Handler { protected abstract void onRadioOffOrNotAvailable(); protected abstract void onDataSetupComplete(AsyncResult ar); protected abstract void onDisconnectDone(int connId, AsyncResult ar); protected abstract void onResetDone(AsyncResult ar); protected abstract void onVoiceCallStarted(); protected abstract void onVoiceCallEnded(); protected abstract void onCleanUpConnection(boolean tearDown, int apnId, String reason); Loading Loading @@ -514,9 +513,10 @@ public abstract class DataConnectionTracker extends Handler { onSetInternalDataEnabled(enabled); break; } case EVENT_RESET_DONE: case EVENT_RESET_DONE: { onResetDone((AsyncResult) msg.obj); break; } case CMD_SET_DATA_ENABLE: { log("CMD_SET_DATA_ENABLE msg=" + msg); boolean enabled = (msg.arg1 == ENABLED) ? true : false; Loading Loading @@ -602,6 +602,8 @@ public abstract class DataConnectionTracker extends Handler { protected abstract void setState(State s); protected abstract void gotoIdleAndNotifyDataConnection(String reason); protected LinkProperties getLinkProperties(String apnType) { int id = apnTypeToId(apnType); if (isApnIdEnabled(id)) { Loading Loading @@ -872,6 +874,22 @@ public abstract class DataConnectionTracker extends Handler { protected void onEnableNewApn() { } /** * Called when EVENT_RESET_DONE is received so goto * IDLE state and send notifications to those interested. * * TODO - currently unused. Needs to be hooked into DataConnection cleanup * TODO - needs to pass some notion of which connection is reset.. */ protected void onResetDone(AsyncResult ar) { if (DBG) log("EVENT_RESET_DONE"); String reason = null; if (ar.userObj instanceof String) { reason = (String) ar.userObj; } gotoIdleAndNotifyDataConnection(reason); } /** * Prevent mobile data connections from being established, or once again * allow mobile data connections. If the state toggles, then either tear Loading
telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java +1 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ public class CdmaDataConnection extends DataConnection { protected void onConnect(ConnectionParams cp) { if (DBG) log("CdmaDataConnection Connecting..."); mApn = cp.apn; createTime = -1; lastFailTime = -1; lastFailCause = FailCause.NONE; Loading
telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +1 −15 Original line number Diff line number Diff line Loading @@ -508,7 +508,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { notifyDataAvailability(null); } private void gotoIdleAndNotifyDataConnection(String reason) { protected void gotoIdleAndNotifyDataConnection(String reason) { if (DBG) log("gotoIdleAndNotifyDataConnection: reason=" + reason); setState(State.IDLE); notifyDataConnection(reason); Loading Loading @@ -667,20 +667,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } } /** * Called when EVENT_RESET_DONE is received so goto * IDLE state and send notifications to those interested. */ @Override protected void onResetDone(AsyncResult ar) { if (DBG) log("EVENT_RESET_DONE"); String reason = null; if (ar.userObj instanceof String) { reason = (String) ar.userObj; } gotoIdleAndNotifyDataConnection(reason); } /** * @override com.android.internal.telephony.DataConnectionTracker */ Loading
telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java +17 −28 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ public class GsmDataConnection extends DataConnection { private static final String LOG_TAG = "GSM"; //***** Instance Variables private ApnSetting apn; protected int mProfileId = RILConstants.DATA_PROFILE_DEFAULT; protected String mActiveApnType = Phone.APN_TYPE_DEFAULT; //***** Constructor Loading Loading @@ -74,13 +72,13 @@ public class GsmDataConnection extends DataConnection { @Override protected void onConnect(ConnectionParams cp) { apn = cp.apn; mApn = cp.apn; if (DBG) log("Connecting to carrier: '" + apn.carrier + "' APN: '" + apn.apn + "' proxy: '" + apn.proxy + "' port: '" + apn.port); if (DBG) log("Connecting to carrier: '" + mApn.carrier + "' APN: '" + mApn.apn + "' proxy: '" + mApn.proxy + "' port: '" + mApn.port); setHttpProxy (apn.proxy, apn.port); setHttpProxy (mApn.proxy, mApn.port); createTime = -1; lastFailTime = -1; Loading @@ -90,23 +88,23 @@ public class GsmDataConnection extends DataConnection { Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); msg.obj = cp; int authType = apn.authType; int authType = mApn.authType; if (authType == -1) { authType = (apn.user != null) ? RILConstants.SETUP_DATA_AUTH_PAP_CHAP : authType = (mApn.user != null) ? RILConstants.SETUP_DATA_AUTH_PAP_CHAP : RILConstants.SETUP_DATA_AUTH_NONE; } String protocol; if (phone.getServiceState().getRoaming()) { protocol = apn.roamingProtocol; protocol = mApn.roamingProtocol; } else { protocol = apn.protocol; protocol = mApn.protocol; } phone.mCM.setupDataCall( Integer.toString(RILConstants.SETUP_DATA_TECH_GSM), Integer.toString(mProfileId), apn.apn, apn.user, apn.password, mApn.apn, mApn.user, mApn.password, Integer.toString(authType), protocol, msg); } Loading @@ -128,15 +126,9 @@ public class GsmDataConnection extends DataConnection { mActiveApnType = apnType; } @Override protected void clearSettings() { super.clearSettings(); apn = null; } @Override public String toString() { return "State=" + getCurrentState().getName() + " Apn=" + apn + return "State=" + getCurrentState().getName() + " Apn=" + mApn + " create=" + createTime + " lastFail=" + lastFailTime + " lastFailCause=" + lastFailCause; } Loading @@ -150,11 +142,12 @@ public class GsmDataConnection extends DataConnection { // Do not apply the race condition workaround for MMS APN // if Proxy is an IP-address. // Otherwise, the default APN will not be restored anymore. if (!apn.types[0].equals(Phone.APN_TYPE_MMS) || !isIpAddress(apn.mmsProxy)) { if (!mApn.types[0].equals(Phone.APN_TYPE_MMS) || !isIpAddress(mApn.mmsProxy)) { log(String.format( "isDnsOk: return false apn.types[0]=%s APN_TYPE_MMS=%s isIpAddress(%s)=%s", apn.types[0], Phone.APN_TYPE_MMS, apn.mmsProxy, isIpAddress(apn.mmsProxy))); mApn.types[0], Phone.APN_TYPE_MMS, mApn.mmsProxy, isIpAddress(mApn.mmsProxy))); return false; } } Loading @@ -166,15 +159,11 @@ public class GsmDataConnection extends DataConnection { Log.d(LOG_TAG, "[" + getName() + "] " + s); } public ApnSetting getApn() { return this.apn; } private void setHttpProxy(String httpProxy, String httpPort) { if (DBG) log("set http proxy for" + "' APN: '" + mActiveApnType + "' proxy: '" + apn.proxy + "' port: '" + apn.port); + "' proxy: '" + mApn.proxy + "' port: '" + mApn.port); if(TextUtils.equals(mActiveApnType, Phone.APN_TYPE_DEFAULT)) { if (httpProxy == null || httpProxy.length() == 0) { phone.setSystemProperty("net.gprs.http-proxy", null); Loading Loading @@ -205,6 +194,6 @@ public class GsmDataConnection extends DataConnection { private boolean isIpAddress(String address) { if (address == null) return false; return Patterns.IP_ADDRESS.matcher(apn.mmsProxy).matches(); return Patterns.IP_ADDRESS.matcher(address).matches(); } }