Merge "Remove isAnyActiveDataConnection and promote isDisconnected." into ics-factoryrom
This commit is contained in:
@@ -1019,7 +1019,7 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
sendMessage(msg);
|
sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean isAnyActiveDataConnections();
|
public abstract boolean isDisconnected();
|
||||||
|
|
||||||
protected void onSetUserDataEnabled(boolean enabled) {
|
protected void onSetUserDataEnabled(boolean enabled) {
|
||||||
synchronized (mDataEnabledLock) {
|
synchronized (mDataEnabledLock) {
|
||||||
|
|||||||
@@ -403,7 +403,14 @@ public abstract class ServiceStateTracker extends Handler {
|
|||||||
public void powerOffRadioSafely(DataConnectionTracker dcTracker) {
|
public void powerOffRadioSafely(DataConnectionTracker dcTracker) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (!mPendingRadioPowerOffAfterDataOff) {
|
if (!mPendingRadioPowerOffAfterDataOff) {
|
||||||
if (dcTracker.isAnyActiveDataConnections()) {
|
// To minimize race conditions we call cleanUpAllConnections on
|
||||||
|
// both if else paths instead of before this isDisconnected test.
|
||||||
|
if (dcTracker.isDisconnected()) {
|
||||||
|
// To minimize race conditions we do this after isDisconnected
|
||||||
|
dcTracker.cleanUpAllConnections(Phone.REASON_RADIO_TURNED_OFF);
|
||||||
|
if (DBG) log("Data disconnected, turn off radio right away.");
|
||||||
|
hangupAndPowerOff();
|
||||||
|
} else {
|
||||||
dcTracker.cleanUpAllConnections(Phone.REASON_RADIO_TURNED_OFF);
|
dcTracker.cleanUpAllConnections(Phone.REASON_RADIO_TURNED_OFF);
|
||||||
Message msg = Message.obtain(this);
|
Message msg = Message.obtain(this);
|
||||||
msg.what = EVENT_SET_RADIO_POWER_OFF;
|
msg.what = EVENT_SET_RADIO_POWER_OFF;
|
||||||
@@ -415,10 +422,6 @@ public abstract class ServiceStateTracker extends Handler {
|
|||||||
log("Cannot send delayed Msg, turn off radio right away.");
|
log("Cannot send delayed Msg, turn off radio right away.");
|
||||||
hangupAndPowerOff();
|
hangupAndPowerOff();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
dcTracker.cleanUpAllConnections(Phone.REASON_RADIO_TURNED_OFF);
|
|
||||||
if (DBG) log("Data disconnected, turn off radio right away.");
|
|
||||||
hangupAndPowerOff();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -946,8 +946,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAnyActiveDataConnections() {
|
public boolean isDisconnected() {
|
||||||
return (mState != State.IDLE);
|
return ((mState == State.IDLE) || (mState == State.FAILED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1961,7 +1961,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isDisconnected() {
|
@Override
|
||||||
|
public boolean isDisconnected() {
|
||||||
for (ApnContext apnContext : mApnContexts.values()) {
|
for (ApnContext apnContext : mApnContexts.values()) {
|
||||||
if (!apnContext.isDisconnected()) {
|
if (!apnContext.isDisconnected()) {
|
||||||
// At least one context was not disconnected return false
|
// At least one context was not disconnected return false
|
||||||
@@ -2347,11 +2348,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
return cid;
|
return cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAnyActiveDataConnections() {
|
|
||||||
return isConnected();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void log(String s) {
|
protected void log(String s) {
|
||||||
Log.d(LOG_TAG, "[GsmDCT] "+ s);
|
Log.d(LOG_TAG, "[GsmDCT] "+ s);
|
||||||
|
|||||||
Reference in New Issue
Block a user