Allow CdmaDataConnectionTracker to handle RIL_UNSOL_OTA_PROVISION_STATUS
and when data roaming is enabled reset the retry manager. This change also refactors mRetryMgr to DataConnectionTracker removing it from Cdma and Gsm data connection trackers child classes.
This commit is contained in:
@ -94,6 +94,7 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
protected static final int EVENT_PS_RESTRICT_ENABLED = 32;
|
protected static final int EVENT_PS_RESTRICT_ENABLED = 32;
|
||||||
protected static final int EVENT_PS_RESTRICT_DISABLED = 33;
|
protected static final int EVENT_PS_RESTRICT_DISABLED = 33;
|
||||||
public static final int EVENT_CLEAN_UP_CONNECTION = 34;
|
public static final int EVENT_CLEAN_UP_CONNECTION = 34;
|
||||||
|
protected static final int EVENT_CDMA_OTA_PROVISION = 35;
|
||||||
|
|
||||||
//***** Constants
|
//***** Constants
|
||||||
|
|
||||||
@ -146,6 +147,9 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
protected int mNoRecvPollCount = 0;
|
protected int mNoRecvPollCount = 0;
|
||||||
protected boolean netStatPollEnabled = false;
|
protected boolean netStatPollEnabled = false;
|
||||||
|
|
||||||
|
/** Manage the behavior of data retry after failure */
|
||||||
|
protected final RetryManager mRetryMgr = new RetryManager();
|
||||||
|
|
||||||
// wifi connection status will be updated by sticky intent
|
// wifi connection status will be updated by sticky intent
|
||||||
protected boolean mIsWifiConnected = false;
|
protected boolean mIsWifiConnected = false;
|
||||||
|
|
||||||
@ -202,10 +206,13 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
if (getDataOnRoamingEnabled() != enabled) {
|
if (getDataOnRoamingEnabled() != enabled) {
|
||||||
Settings.Secure.putInt(phone.getContext().getContentResolver(),
|
Settings.Secure.putInt(phone.getContext().getContentResolver(),
|
||||||
Settings.Secure.DATA_ROAMING, enabled ? 1 : 0);
|
Settings.Secure.DATA_ROAMING, enabled ? 1 : 0);
|
||||||
|
if (phone.getServiceState().getRoaming()) {
|
||||||
|
if (enabled) {
|
||||||
|
mRetryMgr.resetRetryCount();
|
||||||
|
}
|
||||||
|
sendMessage(obtainMessage(EVENT_ROAMING_ON));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Message roamingMsg = phone.getServiceState().getRoaming() ?
|
|
||||||
obtainMessage(EVENT_ROAMING_ON) : obtainMessage(EVENT_ROAMING_OFF);
|
|
||||||
sendMessage(roamingMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Retrieve the data roaming setting from the shared preferences.
|
//Retrieve the data roaming setting from the shared preferences.
|
||||||
@ -243,6 +250,9 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_ROAMING_OFF:
|
case EVENT_ROAMING_OFF:
|
||||||
|
if (getDataOnRoamingEnabled() == false) {
|
||||||
|
mRetryMgr.resetRetryCount();
|
||||||
|
}
|
||||||
onRoamingOff();
|
onRoamingOff();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -76,9 +76,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
/** Currently active CdmaDataConnection */
|
/** Currently active CdmaDataConnection */
|
||||||
private CdmaDataConnection mActiveDataConnection;
|
private CdmaDataConnection mActiveDataConnection;
|
||||||
|
|
||||||
/** Manage the behavior of data retry after failure */
|
|
||||||
private final RetryManager mRetryMgr = new RetryManager();
|
|
||||||
|
|
||||||
/** Defined cdma connection profiles */
|
/** Defined cdma connection profiles */
|
||||||
private static final int EXTERNAL_NETWORK_DEFAULT_ID = 0;
|
private static final int EXTERNAL_NETWORK_DEFAULT_ID = 0;
|
||||||
private static final int EXTERNAL_NETWORK_NUM_TYPES = 1;
|
private static final int EXTERNAL_NETWORK_NUM_TYPES = 1;
|
||||||
@ -163,6 +160,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
p.mSST.registerForCdmaDataConnectionDetached(this, EVENT_CDMA_DATA_DETACHED, null);
|
p.mSST.registerForCdmaDataConnectionDetached(this, EVENT_CDMA_DATA_DETACHED, null);
|
||||||
p.mSST.registerForRoamingOn(this, EVENT_ROAMING_ON, null);
|
p.mSST.registerForRoamingOn(this, EVENT_ROAMING_ON, null);
|
||||||
p.mSST.registerForRoamingOff(this, EVENT_ROAMING_OFF, null);
|
p.mSST.registerForRoamingOff(this, EVENT_ROAMING_OFF, null);
|
||||||
|
p.mCM.registerForCdmaOtaProvision(this, EVENT_CDMA_OTA_PROVISION, null);
|
||||||
|
|
||||||
this.netstat = INetStatService.Stub.asInterface(ServiceManager.getService("netstat"));
|
this.netstat = INetStatService.Stub.asInterface(ServiceManager.getService("netstat"));
|
||||||
|
|
||||||
@ -210,6 +208,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
mCdmaPhone.mSST.unregisterForCdmaDataConnectionDetached(this);
|
mCdmaPhone.mSST.unregisterForCdmaDataConnectionDetached(this);
|
||||||
mCdmaPhone.mSST.unregisterForRoamingOn(this);
|
mCdmaPhone.mSST.unregisterForRoamingOn(this);
|
||||||
mCdmaPhone.mSST.unregisterForRoamingOff(this);
|
mCdmaPhone.mSST.unregisterForRoamingOff(this);
|
||||||
|
phone.mCM.unregisterForCdmaOtaProvision(this);
|
||||||
|
|
||||||
phone.getContext().unregisterReceiver(this.mIntentReceiver);
|
phone.getContext().unregisterReceiver(this.mIntentReceiver);
|
||||||
destroyAllDataConnectionList();
|
destroyAllDataConnectionList();
|
||||||
@ -849,6 +848,22 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onCdmaOtaProvision(AsyncResult ar) {
|
||||||
|
if (ar.exception != null) {
|
||||||
|
int [] otaPrivision = (int [])ar.result;
|
||||||
|
if ((otaPrivision != null) && (otaPrivision.length > 1)) {
|
||||||
|
switch (otaPrivision[0]) {
|
||||||
|
case Phone.CDMA_OTA_PROVISION_STATUS_COMMITTED:
|
||||||
|
case Phone.CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED:
|
||||||
|
mRetryMgr.resetRetryCount();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void writeEventLogCdmaDataDrop() {
|
private void writeEventLogCdmaDataDrop() {
|
||||||
CdmaCellLocation loc = (CdmaCellLocation)(phone.getCellLocation());
|
CdmaCellLocation loc = (CdmaCellLocation)(phone.getCellLocation());
|
||||||
int bsid = (loc != null) ? loc.getBaseStationId() : -1;
|
int bsid = (loc != null) ? loc.getBaseStationId() : -1;
|
||||||
@ -957,6 +972,10 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
onDataStateChanged((AsyncResult) msg.obj);
|
onDataStateChanged((AsyncResult) msg.obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EVENT_CDMA_OTA_PROVISION:
|
||||||
|
onCdmaOtaProvision((AsyncResult) msg.obj);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// handle the message in the super class DataConnectionTracker
|
// handle the message in the super class DataConnectionTracker
|
||||||
super.handleMessage(msg);
|
super.handleMessage(msg);
|
||||||
|
@ -96,8 +96,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
private int mPdpResetCount = 0;
|
private int mPdpResetCount = 0;
|
||||||
private boolean mIsScreenOn = true;
|
private boolean mIsScreenOn = true;
|
||||||
|
|
||||||
private final RetryManager mRetryMgr = new RetryManager();
|
|
||||||
|
|
||||||
/** Delay between APN attempts */
|
/** Delay between APN attempts */
|
||||||
protected static final int APN_DELAY_MILLIS = 5000;
|
protected static final int APN_DELAY_MILLIS = 5000;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user