summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2011-09-19 14:35:30 -0700
committerWink Saville <wink@google.com>2011-09-19 14:35:30 -0700
commitd986c609074cda0737a6f06f10700e42fb1704e7 (patch)
treee6be1a3332d273546500634315e5047ead8945ec /telephony
parent31f971b57f526e2688241080b30c7e8df33bf62d (diff)
downloadframeworks_base-d986c609074cda0737a6f06f10700e42fb1704e7.zip
frameworks_base-d986c609074cda0737a6f06f10700e42fb1704e7.tar.gz
frameworks_base-d986c609074cda0737a6f06f10700e42fb1704e7.tar.bz2
Remove isAnyActiveDataConnection and promote isDisconnected.
As Yoonsung Nam pointed out in the bug using isDisconnected is more precise here and this was the only place isAnyActiveDataConnection was used. So I've removed it and promoted isDisconnected to DataConnectionTracker. It should also be noted that although the Framework should be as graceful as possible, it is still a requirement that the radio must be turned off/on anytime the Framework issues the appropriate command. Bug: 5306201 Change-Id: I95130451e11c51e43406b57eb538d01f8dde61be
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/com/android/internal/telephony/DataConnectionTracker.java2
-rw-r--r--telephony/java/com/android/internal/telephony/ServiceStateTracker.java13
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java4
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java8
4 files changed, 13 insertions, 14 deletions
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 42ea4f2..ae152fb 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -1019,7 +1019,7 @@ public abstract class DataConnectionTracker extends Handler {
sendMessage(msg);
}
- public abstract boolean isAnyActiveDataConnections();
+ public abstract boolean isDisconnected();
protected void onSetUserDataEnabled(boolean enabled) {
synchronized (mDataEnabledLock) {
diff --git a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
index 01b807d..1b3ee1e 100644
--- a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -403,7 +403,14 @@ public abstract class ServiceStateTracker extends Handler {
public void powerOffRadioSafely(DataConnectionTracker dcTracker) {
synchronized (this) {
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);
Message msg = Message.obtain(this);
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.");
hangupAndPowerOff();
}
- } else {
- dcTracker.cleanUpAllConnections(Phone.REASON_RADIO_TURNED_OFF);
- if (DBG) log("Data disconnected, turn off radio right away.");
- hangupAndPowerOff();
}
}
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index 078e51d..4dace82 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -946,8 +946,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
}
@Override
- public boolean isAnyActiveDataConnections() {
- return (mState != State.IDLE);
+ public boolean isDisconnected() {
+ return ((mState == State.IDLE) || (mState == State.FAILED));
}
@Override
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index dd8a60a..ebf5e65 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -1961,7 +1961,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
return false;
}
- protected boolean isDisconnected() {
+ @Override
+ public boolean isDisconnected() {
for (ApnContext apnContext : mApnContexts.values()) {
if (!apnContext.isDisconnected()) {
// At least one context was not disconnected return false
@@ -2348,11 +2349,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
}
@Override
- public boolean isAnyActiveDataConnections() {
- return isConnected();
- }
-
- @Override
protected void log(String s) {
Log.d(LOG_TAG, "[GsmDCT] "+ s);
}