Loading telephony/java/com/android/internal/telephony/DataConnection.java +82 −12 Original line number Diff line number Diff line Loading @@ -219,10 +219,8 @@ 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(); Loading @@ -244,10 +242,11 @@ public abstract class DataConnection extends HierarchicalStateMachine { //***** Constructor protected DataConnection(PhoneBase phone, String name, RetryManager rm) { protected DataConnection(PhoneBase phone, String name, int id, RetryManager rm) { super(name); if (DBG) log("DataConnection constructor E"); this.phone = phone; mId = id; mRetryMgr = rm; this.cid = -1; clearSettings(); Loading Loading @@ -342,10 +341,88 @@ public abstract class DataConnection extends HierarchicalStateMachine { clearSettings(); } public RetryManager getRetryMgr() { return mRetryMgr; /* * ************************************************************************** * Begin Members and methods owned by DataConnectionTracker but stored * in a DataConnection because there is one per connection. * ************************************************************************** */ /* * The id is owned by DataConnectionTracker. */ private int mId; /** * Get the DataConnection ID */ public int getDataConnectionId() { return mId; } /* * The retry manager is currently owned by the DataConnectionTracker but is stored * in the DataConnection because there is one per connection. These methods * should only be used by the DataConnectionTracker although someday the retrying * maybe managed by the DataConnection itself and these methods could disappear. */ private RetryManager mRetryMgr; /** * @return retry manager retryCount */ public int getRetryCount() { return mRetryMgr.getRetryCount(); } /** * @return retry manager retryTimer */ public int getRetryTimer() { return mRetryMgr.getRetryTimer(); } /** * increaseRetryCount of retry manager */ public void increaseRetryCount() { mRetryMgr.increaseRetryCount(); } /** * @return retry manager isRetryNeeded */ public boolean isRetryNeeded() { return mRetryMgr.isRetryNeeded(); } /** * resetRetryCount of retry manager */ public void resetRetryCount() { mRetryMgr.resetRetryCount(); } /** * set retryForeverUsingLasttimeout of retry manager */ public void retryForeverUsingLastTimeout() { mRetryMgr.retryForeverUsingLastTimeout(); } /** * @return retry manager isRetryForever */ public boolean isRetryForever() { return mRetryMgr.isRetryForever(); } /* * ************************************************************************** * End members owned by DataConnectionTracker * ************************************************************************** */ /** * Clear all settings called when entering mInactiveState. */ Loading Loading @@ -963,13 +1040,6 @@ public abstract class DataConnection extends HierarchicalStateMachine { return retVal; } /** * Get the DataConnection ID */ public int getDataConnectionId() { return mId; } /** * Return the LinkProperties for the connection. * Loading telephony/java/com/android/internal/telephony/DataConnectionTracker.java +10 −7 Original line number Diff line number Diff line Loading @@ -211,9 +211,6 @@ public abstract class DataConnectionTracker extends Handler { protected int mNoRecvPollCount = 0; protected boolean mNetStatPollEnabled = false; /** Manage the behavior of data retry after failure (TODO: One per connection in the future?) */ protected RetryManager mRetryMgr = new RetryManager(); // wifi connection status will be updated by sticky intent protected boolean mIsWifiConnected = false; Loading Loading @@ -416,7 +413,7 @@ public abstract class DataConnectionTracker extends Handler { Settings.Secure.DATA_ROAMING, enabled ? 1 : 0); if (mPhone.getServiceState().getRoaming()) { if (enabled) { mRetryMgr.resetRetryCount(); resetAllRetryCounts(); } sendMessage(obtainMessage(EVENT_ROAMING_ON)); } Loading Loading @@ -468,7 +465,7 @@ public abstract class DataConnectionTracker extends Handler { case EVENT_ROAMING_OFF: if (getDataOnRoamingEnabled() == false) { mRetryMgr.resetRetryCount(); resetAllRetryCounts(); } onRoamingOff(); break; Loading Loading @@ -902,7 +899,7 @@ public abstract class DataConnectionTracker extends Handler { } if (prevEnabled != getAnyDataEnabled()) { if (!prevEnabled) { mRetryMgr.resetRetryCount(); resetAllRetryCounts(); onTrySetupData(Phone.REASON_DATA_ENABLED); } else { cleanUpAllConnections(); Loading Loading @@ -936,7 +933,7 @@ public abstract class DataConnectionTracker extends Handler { Settings.Secure.MOBILE_DATA, enable ? 1 : 0); if (prevEnabled != getAnyDataEnabled()) { if (!prevEnabled) { mRetryMgr.resetRetryCount(); resetAllRetryCounts(); onTrySetupData(Phone.REASON_DATA_ENABLED); } else { onCleanUpConnection(true, APN_DEFAULT_ID, Phone.REASON_DATA_DISABLED); Loading @@ -944,4 +941,10 @@ public abstract class DataConnectionTracker extends Handler { } } } protected void resetAllRetryCounts() { for (DataConnection dc : mDataConnections.values()) { dc.resetRetryCount(); } } } telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java +4 −5 Original line number Diff line number Diff line Loading @@ -33,8 +33,8 @@ public class CdmaDataConnection extends DataConnection { private static final String LOG_TAG = "CDMA"; // ***** Constructor private CdmaDataConnection(CDMAPhone phone, String name, RetryManager rm) { super(phone, name, rm); private CdmaDataConnection(CDMAPhone phone, String name, int id, RetryManager rm) { super(phone, name, id, rm); } /** Loading @@ -49,11 +49,10 @@ public class CdmaDataConnection extends DataConnection { synchronized (mCountLock) { mCount += 1; } CdmaDataConnection cdmaDc = new CdmaDataConnection(phone, "CdmaDataConnection-" + mCount, rm); CdmaDataConnection cdmaDc = new CdmaDataConnection(phone, "CdmaDataConnection-" + mCount, id, rm); cdmaDc.start(); if (DBG) cdmaDc.log("Made " + cdmaDc.getName()); cdmaDc.mId = id; return cdmaDc; } Loading telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +8 −8 Original line number Diff line number Diff line Loading @@ -328,7 +328,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { setState(State.CONNECTED); notifyDataConnection(reason); startNetStatPoll(); mRetryMgr.resetRetryCount(); mDataConnections.get(0).resetRetryCount(); } private void resetPollStats() { Loading Loading @@ -478,7 +478,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { * at the last time until the state is changed. * TODO: Make this configurable? */ int nextReconnectDelay = mRetryMgr.getRetryTimer(); int nextReconnectDelay = mDataConnections.get(0).getRetryTimer(); log("Data Connection activate failed. Scheduling next attempt for " + (nextReconnectDelay / 1000) + "s"); Loading @@ -492,7 +492,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { SystemClock.elapsedRealtime() + nextReconnectDelay, mReconnectIntent); mRetryMgr.increaseRetryCount(); mDataConnections.get(0).increaseRetryCount(); if (!shouldPostNotification(lastFailCauseCode)) { log("NOT Posting Data Connection Unavailable notification " Loading Loading @@ -593,7 +593,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { */ @Override protected void onRadioOffOrNotAvailable() { mRetryMgr.resetRetryCount(); mDataConnections.get(0).resetRetryCount(); if (mPhone.getSimulatedRadioControl() != null) { // Assume data is connected on the simulator Loading Loading @@ -708,7 +708,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } notifyDataAvailability(Phone.REASON_VOICE_CALL_ENDED); } else { mRetryMgr.resetRetryCount(); mDataConnections.get(0).resetRetryCount(); // in case data setup was attempted when we were on a voice call trySetupData(Phone.REASON_VOICE_CALL_ENDED); } Loading @@ -730,7 +730,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { CdmaDataConnection dataConn; /** TODO: Use one retry manager for all connections for now */ RetryManager rm = mRetryMgr; RetryManager rm = new RetryManager(); if (!rm.configure(SystemProperties.get("ro.cdma.data_retry_config"))) { if (!rm.configure(DEFAULT_DATA_RETRY_CONFIG)) { // Should never happen, log an error and default to a simple linear sequence. Loading Loading @@ -761,7 +761,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } else { if (mState == State.FAILED) { cleanUpConnection(false, Phone.REASON_CDMA_DATA_DETACHED); mRetryMgr.resetRetryCount(); mDataConnections.get(0).resetRetryCount(); CdmaCellLocation loc = (CdmaCellLocation)(mPhone.getCellLocation()); EventLog.writeEvent(EventLogTags.CDMA_DATA_SETUP_FAILED, Loading @@ -779,7 +779,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { switch (otaPrivision[0]) { case Phone.CDMA_OTA_PROVISION_STATUS_COMMITTED: case Phone.CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED: mRetryMgr.resetRetryCount(); mDataConnections.get(0).resetRetryCount(); break; default: break; Loading telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java +4 −5 Original line number Diff line number Diff line Loading @@ -41,8 +41,8 @@ public class GsmDataConnection extends DataConnection { protected int mProfileId = RILConstants.DATA_PROFILE_DEFAULT; protected String mActiveApnType = Phone.APN_TYPE_DEFAULT; //***** Constructor private GsmDataConnection(PhoneBase phone, String name, RetryManager rm) { super(phone, name, rm); private GsmDataConnection(PhoneBase phone, String name, int id, RetryManager rm) { super(phone, name, id, rm); } /** Loading @@ -57,11 +57,10 @@ public class GsmDataConnection extends DataConnection { synchronized (mCountLock) { mCount += 1; } GsmDataConnection gsmDc = new GsmDataConnection(phone, "GsmDataConnection-" + mCount, rm); GsmDataConnection gsmDc = new GsmDataConnection(phone, "GsmDataConnection-" + mCount, id, rm); gsmDc.start(); if (DBG) gsmDc.log("Made " + gsmDc.getName()); gsmDc.mId = id; gsmDc.mRetryMgr = rm; return gsmDc; } Loading Loading
telephony/java/com/android/internal/telephony/DataConnection.java +82 −12 Original line number Diff line number Diff line Loading @@ -219,10 +219,8 @@ 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(); Loading @@ -244,10 +242,11 @@ public abstract class DataConnection extends HierarchicalStateMachine { //***** Constructor protected DataConnection(PhoneBase phone, String name, RetryManager rm) { protected DataConnection(PhoneBase phone, String name, int id, RetryManager rm) { super(name); if (DBG) log("DataConnection constructor E"); this.phone = phone; mId = id; mRetryMgr = rm; this.cid = -1; clearSettings(); Loading Loading @@ -342,10 +341,88 @@ public abstract class DataConnection extends HierarchicalStateMachine { clearSettings(); } public RetryManager getRetryMgr() { return mRetryMgr; /* * ************************************************************************** * Begin Members and methods owned by DataConnectionTracker but stored * in a DataConnection because there is one per connection. * ************************************************************************** */ /* * The id is owned by DataConnectionTracker. */ private int mId; /** * Get the DataConnection ID */ public int getDataConnectionId() { return mId; } /* * The retry manager is currently owned by the DataConnectionTracker but is stored * in the DataConnection because there is one per connection. These methods * should only be used by the DataConnectionTracker although someday the retrying * maybe managed by the DataConnection itself and these methods could disappear. */ private RetryManager mRetryMgr; /** * @return retry manager retryCount */ public int getRetryCount() { return mRetryMgr.getRetryCount(); } /** * @return retry manager retryTimer */ public int getRetryTimer() { return mRetryMgr.getRetryTimer(); } /** * increaseRetryCount of retry manager */ public void increaseRetryCount() { mRetryMgr.increaseRetryCount(); } /** * @return retry manager isRetryNeeded */ public boolean isRetryNeeded() { return mRetryMgr.isRetryNeeded(); } /** * resetRetryCount of retry manager */ public void resetRetryCount() { mRetryMgr.resetRetryCount(); } /** * set retryForeverUsingLasttimeout of retry manager */ public void retryForeverUsingLastTimeout() { mRetryMgr.retryForeverUsingLastTimeout(); } /** * @return retry manager isRetryForever */ public boolean isRetryForever() { return mRetryMgr.isRetryForever(); } /* * ************************************************************************** * End members owned by DataConnectionTracker * ************************************************************************** */ /** * Clear all settings called when entering mInactiveState. */ Loading Loading @@ -963,13 +1040,6 @@ public abstract class DataConnection extends HierarchicalStateMachine { return retVal; } /** * Get the DataConnection ID */ public int getDataConnectionId() { return mId; } /** * Return the LinkProperties for the connection. * Loading
telephony/java/com/android/internal/telephony/DataConnectionTracker.java +10 −7 Original line number Diff line number Diff line Loading @@ -211,9 +211,6 @@ public abstract class DataConnectionTracker extends Handler { protected int mNoRecvPollCount = 0; protected boolean mNetStatPollEnabled = false; /** Manage the behavior of data retry after failure (TODO: One per connection in the future?) */ protected RetryManager mRetryMgr = new RetryManager(); // wifi connection status will be updated by sticky intent protected boolean mIsWifiConnected = false; Loading Loading @@ -416,7 +413,7 @@ public abstract class DataConnectionTracker extends Handler { Settings.Secure.DATA_ROAMING, enabled ? 1 : 0); if (mPhone.getServiceState().getRoaming()) { if (enabled) { mRetryMgr.resetRetryCount(); resetAllRetryCounts(); } sendMessage(obtainMessage(EVENT_ROAMING_ON)); } Loading Loading @@ -468,7 +465,7 @@ public abstract class DataConnectionTracker extends Handler { case EVENT_ROAMING_OFF: if (getDataOnRoamingEnabled() == false) { mRetryMgr.resetRetryCount(); resetAllRetryCounts(); } onRoamingOff(); break; Loading Loading @@ -902,7 +899,7 @@ public abstract class DataConnectionTracker extends Handler { } if (prevEnabled != getAnyDataEnabled()) { if (!prevEnabled) { mRetryMgr.resetRetryCount(); resetAllRetryCounts(); onTrySetupData(Phone.REASON_DATA_ENABLED); } else { cleanUpAllConnections(); Loading Loading @@ -936,7 +933,7 @@ public abstract class DataConnectionTracker extends Handler { Settings.Secure.MOBILE_DATA, enable ? 1 : 0); if (prevEnabled != getAnyDataEnabled()) { if (!prevEnabled) { mRetryMgr.resetRetryCount(); resetAllRetryCounts(); onTrySetupData(Phone.REASON_DATA_ENABLED); } else { onCleanUpConnection(true, APN_DEFAULT_ID, Phone.REASON_DATA_DISABLED); Loading @@ -944,4 +941,10 @@ public abstract class DataConnectionTracker extends Handler { } } } protected void resetAllRetryCounts() { for (DataConnection dc : mDataConnections.values()) { dc.resetRetryCount(); } } }
telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java +4 −5 Original line number Diff line number Diff line Loading @@ -33,8 +33,8 @@ public class CdmaDataConnection extends DataConnection { private static final String LOG_TAG = "CDMA"; // ***** Constructor private CdmaDataConnection(CDMAPhone phone, String name, RetryManager rm) { super(phone, name, rm); private CdmaDataConnection(CDMAPhone phone, String name, int id, RetryManager rm) { super(phone, name, id, rm); } /** Loading @@ -49,11 +49,10 @@ public class CdmaDataConnection extends DataConnection { synchronized (mCountLock) { mCount += 1; } CdmaDataConnection cdmaDc = new CdmaDataConnection(phone, "CdmaDataConnection-" + mCount, rm); CdmaDataConnection cdmaDc = new CdmaDataConnection(phone, "CdmaDataConnection-" + mCount, id, rm); cdmaDc.start(); if (DBG) cdmaDc.log("Made " + cdmaDc.getName()); cdmaDc.mId = id; return cdmaDc; } Loading
telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +8 −8 Original line number Diff line number Diff line Loading @@ -328,7 +328,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { setState(State.CONNECTED); notifyDataConnection(reason); startNetStatPoll(); mRetryMgr.resetRetryCount(); mDataConnections.get(0).resetRetryCount(); } private void resetPollStats() { Loading Loading @@ -478,7 +478,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { * at the last time until the state is changed. * TODO: Make this configurable? */ int nextReconnectDelay = mRetryMgr.getRetryTimer(); int nextReconnectDelay = mDataConnections.get(0).getRetryTimer(); log("Data Connection activate failed. Scheduling next attempt for " + (nextReconnectDelay / 1000) + "s"); Loading @@ -492,7 +492,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { SystemClock.elapsedRealtime() + nextReconnectDelay, mReconnectIntent); mRetryMgr.increaseRetryCount(); mDataConnections.get(0).increaseRetryCount(); if (!shouldPostNotification(lastFailCauseCode)) { log("NOT Posting Data Connection Unavailable notification " Loading Loading @@ -593,7 +593,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { */ @Override protected void onRadioOffOrNotAvailable() { mRetryMgr.resetRetryCount(); mDataConnections.get(0).resetRetryCount(); if (mPhone.getSimulatedRadioControl() != null) { // Assume data is connected on the simulator Loading Loading @@ -708,7 +708,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } notifyDataAvailability(Phone.REASON_VOICE_CALL_ENDED); } else { mRetryMgr.resetRetryCount(); mDataConnections.get(0).resetRetryCount(); // in case data setup was attempted when we were on a voice call trySetupData(Phone.REASON_VOICE_CALL_ENDED); } Loading @@ -730,7 +730,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { CdmaDataConnection dataConn; /** TODO: Use one retry manager for all connections for now */ RetryManager rm = mRetryMgr; RetryManager rm = new RetryManager(); if (!rm.configure(SystemProperties.get("ro.cdma.data_retry_config"))) { if (!rm.configure(DEFAULT_DATA_RETRY_CONFIG)) { // Should never happen, log an error and default to a simple linear sequence. Loading Loading @@ -761,7 +761,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } else { if (mState == State.FAILED) { cleanUpConnection(false, Phone.REASON_CDMA_DATA_DETACHED); mRetryMgr.resetRetryCount(); mDataConnections.get(0).resetRetryCount(); CdmaCellLocation loc = (CdmaCellLocation)(mPhone.getCellLocation()); EventLog.writeEvent(EventLogTags.CDMA_DATA_SETUP_FAILED, Loading @@ -779,7 +779,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { switch (otaPrivision[0]) { case Phone.CDMA_OTA_PROVISION_STATUS_COMMITTED: case Phone.CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED: mRetryMgr.resetRetryCount(); mDataConnections.get(0).resetRetryCount(); break; default: break; Loading
telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java +4 −5 Original line number Diff line number Diff line Loading @@ -41,8 +41,8 @@ public class GsmDataConnection extends DataConnection { protected int mProfileId = RILConstants.DATA_PROFILE_DEFAULT; protected String mActiveApnType = Phone.APN_TYPE_DEFAULT; //***** Constructor private GsmDataConnection(PhoneBase phone, String name, RetryManager rm) { super(phone, name, rm); private GsmDataConnection(PhoneBase phone, String name, int id, RetryManager rm) { super(phone, name, id, rm); } /** Loading @@ -57,11 +57,10 @@ public class GsmDataConnection extends DataConnection { synchronized (mCountLock) { mCount += 1; } GsmDataConnection gsmDc = new GsmDataConnection(phone, "GsmDataConnection-" + mCount, rm); GsmDataConnection gsmDc = new GsmDataConnection(phone, "GsmDataConnection-" + mCount, id, rm); gsmDc.start(); if (DBG) gsmDc.log("Made " + gsmDc.getName()); gsmDc.mId = id; gsmDc.mRetryMgr = rm; return gsmDc; } Loading