Resolve race conditions with disconnect of CDMA data and airplane mode

Specifically, wait for data to be deactivated when setPowerStateToDesired()
is called during data activation.

Bug: 2101430
Change-Id: Ia97dd799f779c3f88f66bc1235e7a65958e1e04f
This commit is contained in:
Yong Zhang
2009-09-04 16:41:36 -05:00
committed by Wink Saville
parent 31a12429b7
commit e4e8e4d4f2

View File

@@ -538,12 +538,15 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
if (!mPendingRadioPowerOffAfterDataOff) {
DataConnectionTracker.State currentState = dcTracker.getState();
if (currentState != DataConnectionTracker.State.CONNECTED
&& currentState != DataConnectionTracker.State.DISCONNECTING) {
&& currentState != DataConnectionTracker.State.DISCONNECTING
&& currentState != DataConnectionTracker.State.INITING) {
if (DBG) log("Data disconnected, turn off radio right away.");
cm.setRadioPower(false, null);
}
else if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 5000)) {
if (DBG) log("Wait 5 sec for data to be disconnected, then turn off radio.");
else if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 30000)) {
if (DBG) {
log("Wait up to 30 sec for data to disconnect, then turn off radio.");
}
mPendingRadioPowerOffAfterDataOff = true;
} else {
Log.w(LOG_TAG, "Cannot send delayed Msg, turn off radio right away.");