Merge "Fix issue on infinite retry config in RetryManager" into honeycomb-LTE
This commit is contained in:
@@ -394,6 +394,20 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
return mRetryMgr.isRetryForever();
|
return mRetryMgr.isRetryForever();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether the retry config is set successfully or not
|
||||||
|
*/
|
||||||
|
public boolean configureRetry(int maxRetryCount, int retryTime, int randomizationTime) {
|
||||||
|
return mRetryMgr.configure(maxRetryCount, retryTime, randomizationTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether the retry config is set successfully or not
|
||||||
|
*/
|
||||||
|
public boolean configureRetry(String configStr) {
|
||||||
|
return mRetryMgr.configure(configStr);
|
||||||
|
}
|
||||||
|
|
||||||
private AtomicInteger mRefCount = new AtomicInteger(0);
|
private AtomicInteger mRefCount = new AtomicInteger(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -308,12 +308,10 @@ public class RetryManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset network re-registration indicator and clear the data-retry counter
|
* Clear the data-retry counter
|
||||||
* and turns off retrying forever.
|
|
||||||
*/
|
*/
|
||||||
public void resetRetryCount() {
|
public void resetRetryCount() {
|
||||||
mRetryCount = 0;
|
mRetryCount = 0;
|
||||||
mRetryForever = false;
|
|
||||||
if (DBG) log("resetRetryCount: " + mRetryCount);
|
if (DBG) log("resetRetryCount: " + mRetryCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -935,7 +935,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dc == null) {
|
if (dc == null) {
|
||||||
dc = createDataConnection(apnContext.getApnType());
|
dc = createDataConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dc == null) {
|
if (dc == null) {
|
||||||
@@ -947,6 +947,11 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
dc.setActiveApnType(apnContext.getApnType());
|
dc.setActiveApnType(apnContext.getApnType());
|
||||||
int refCount = dc.incAndGetRefCount();
|
int refCount = dc.incAndGetRefCount();
|
||||||
if (DBG) log("setupData: init dc and apnContext refCount=" + refCount);
|
if (DBG) log("setupData: init dc and apnContext refCount=" + refCount);
|
||||||
|
|
||||||
|
// configure retry count if no other Apn is using the same connection.
|
||||||
|
if (refCount == 1) {
|
||||||
|
configureRetry(dc, apnContext.getApnType());
|
||||||
|
}
|
||||||
DataConnectionAc dcac = mDataConnectionAsyncChannels.get(dc.getDataConnectionId());
|
DataConnectionAc dcac = mDataConnectionAsyncChannels.get(dc.getDataConnectionId());
|
||||||
apnContext.setDataConnectionAc(mDataConnectionAsyncChannels.get(dc.getDataConnectionId()));
|
apnContext.setDataConnectionAc(mDataConnectionAsyncChannels.get(dc.getDataConnectionId()));
|
||||||
apnContext.setApnSetting(apn);
|
apnContext.setApnSetting(apn);
|
||||||
@@ -1785,33 +1790,12 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Return the id for a new data connection */
|
/** Return the id for a new data connection */
|
||||||
private GsmDataConnection createDataConnection(String apnType) {
|
private GsmDataConnection createDataConnection() {
|
||||||
if (DBG) log("createDataConnection(" + apnType + ") E");
|
if (DBG) log("createDataConnection E");
|
||||||
|
|
||||||
RetryManager rm = new RetryManager();
|
RetryManager rm = new RetryManager();
|
||||||
|
|
||||||
if (apnType.equals(Phone.APN_TYPE_DEFAULT)) {
|
|
||||||
if (!rm.configure(SystemProperties.get("ro.gsm.data_retry_config"))) {
|
|
||||||
if (!rm.configure(DEFAULT_DATA_RETRY_CONFIG)) {
|
|
||||||
// Should never happen, log an error and default to a simple linear sequence.
|
|
||||||
loge("createDataConnection: Could not configure using " +
|
|
||||||
"DEFAULT_DATA_RETRY_CONFIG=" + DEFAULT_DATA_RETRY_CONFIG);
|
|
||||||
rm.configure(20, 2000, 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!rm.configure(SystemProperties.get("ro.gsm.2nd_data_retry_config"))) {
|
|
||||||
if (!rm.configure(SECONDARY_DATA_RETRY_CONFIG)) {
|
|
||||||
// Should never happen, log an error and default to a simple sequence.
|
|
||||||
loge("createDataConnection: Could note configure using " +
|
|
||||||
"SECONDARY_DATA_RETRY_CONFIG=" + SECONDARY_DATA_RETRY_CONFIG);
|
|
||||||
rm.configure("max_retries=3, 333, 333, 333");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int id = mUniqueIdGenerator.getAndIncrement();
|
int id = mUniqueIdGenerator.getAndIncrement();
|
||||||
GsmDataConnection conn = GsmDataConnection.makeDataConnection(mPhone, id, rm);
|
GsmDataConnection conn = GsmDataConnection.makeDataConnection(mPhone, id, rm);
|
||||||
conn.resetRetryCount();
|
|
||||||
mDataConnections.put(id, conn);
|
mDataConnections.put(id, conn);
|
||||||
DataConnectionAc dcac = new DataConnectionAc(conn, LOG_TAG);
|
DataConnectionAc dcac = new DataConnectionAc(conn, LOG_TAG);
|
||||||
int status = dcac.fullyConnectSync(mPhone.getContext(), this, conn.getHandler());
|
int status = dcac.fullyConnectSync(mPhone.getContext(), this, conn.getHandler());
|
||||||
@@ -1822,10 +1806,34 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
" status=" + status);
|
" status=" + status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DBG) log("createDataConnection(" + apnType + ") X id=" + id);
|
if (DBG) log("createDataConnection() X id=" + id);
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void configureRetry(DataConnection dc, String apnType) {
|
||||||
|
if ((dc == null) || (apnType == null)) return;
|
||||||
|
|
||||||
|
if (apnType.equals(Phone.APN_TYPE_DEFAULT)) {
|
||||||
|
if (!dc.configureRetry(SystemProperties.get("ro.gsm.data_retry_config"))) {
|
||||||
|
if (!dc.configureRetry(DEFAULT_DATA_RETRY_CONFIG)) {
|
||||||
|
// Should never happen, log an error and default to a simple linear sequence.
|
||||||
|
loge("createDataConnection: Could not configure using " +
|
||||||
|
"DEFAULT_DATA_RETRY_CONFIG=" + DEFAULT_DATA_RETRY_CONFIG);
|
||||||
|
dc.configureRetry(20, 2000, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!dc.configureRetry(SystemProperties.get("ro.gsm.2nd_data_retry_config"))) {
|
||||||
|
if (!dc.configureRetry(SECONDARY_DATA_RETRY_CONFIG)) {
|
||||||
|
// Should never happen, log an error and default to a simple sequence.
|
||||||
|
loge("createDataConnection: Could note configure using " +
|
||||||
|
"SECONDARY_DATA_RETRY_CONFIG=" + SECONDARY_DATA_RETRY_CONFIG);
|
||||||
|
dc.configureRetry("max_retries=3, 333, 333, 333");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void destroyDataConnections() {
|
private void destroyDataConnections() {
|
||||||
if(mDataConnections != null) {
|
if(mDataConnections != null) {
|
||||||
if (DBG) log("destroyDataConnections: clear mDataConnectionList");
|
if (DBG) log("destroyDataConnections: clear mDataConnectionList");
|
||||||
|
|||||||
Reference in New Issue
Block a user