am ad4d9e5b: Allow CdmaDataConnectionTracker to handle RIL_UNSOL_OTA_PROVISION_STATUS and when data roaming is enabled reset the retry manager.

Merge commit 'ad4d9e5bebb5a9ba01c1459d941019887f4a7d6d'

* commit 'ad4d9e5bebb5a9ba01c1459d941019887f4a7d6d':
  Allow CdmaDataConnectionTracker to handle RIL_UNSOL_OTA_PROVISION_STATUS
This commit is contained in:
Wink Saville
2009-08-15 09:51:29 -07:00
committed by Android Git Automerger
3 changed files with 35 additions and 8 deletions

View File

@@ -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_DISABLED = 33;
public static final int EVENT_CLEAN_UP_CONNECTION = 34;
protected static final int EVENT_CDMA_OTA_PROVISION = 35;
//***** Constants
@@ -146,6 +147,9 @@ public abstract class DataConnectionTracker extends Handler {
protected int mNoRecvPollCount = 0;
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
protected boolean mIsWifiConnected = false;
@@ -202,10 +206,13 @@ public abstract class DataConnectionTracker extends Handler {
if (getDataOnRoamingEnabled() != enabled) {
Settings.Secure.putInt(phone.getContext().getContentResolver(),
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.
@@ -243,6 +250,9 @@ public abstract class DataConnectionTracker extends Handler {
break;
case EVENT_ROAMING_OFF:
if (getDataOnRoamingEnabled() == false) {
mRetryMgr.resetRetryCount();
}
onRoamingOff();
break;

View File

@@ -76,9 +76,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
/** Currently active CdmaDataConnection */
private CdmaDataConnection mActiveDataConnection;
/** Manage the behavior of data retry after failure */
private final RetryManager mRetryMgr = new RetryManager();
/** Defined cdma connection profiles */
private static final int EXTERNAL_NETWORK_DEFAULT_ID = 0;
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.registerForRoamingOn(this, EVENT_ROAMING_ON, 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"));
@@ -210,6 +208,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
mCdmaPhone.mSST.unregisterForCdmaDataConnectionDetached(this);
mCdmaPhone.mSST.unregisterForRoamingOn(this);
mCdmaPhone.mSST.unregisterForRoamingOff(this);
phone.mCM.unregisterForCdmaOtaProvision(this);
phone.getContext().unregisterReceiver(this.mIntentReceiver);
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() {
CdmaCellLocation loc = (CdmaCellLocation)(phone.getCellLocation());
int bsid = (loc != null) ? loc.getBaseStationId() : -1;
@@ -957,6 +972,10 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
onDataStateChanged((AsyncResult) msg.obj);
break;
case EVENT_CDMA_OTA_PROVISION:
onCdmaOtaProvision((AsyncResult) msg.obj);
break;
default:
// handle the message in the super class DataConnectionTracker
super.handleMessage(msg);

View File

@@ -96,8 +96,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
private int mPdpResetCount = 0;
private boolean mIsScreenOn = true;
private final RetryManager mRetryMgr = new RetryManager();
/** Delay between APN attempts */
protected static final int APN_DELAY_MILLIS = 5000;