summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2011-03-29 17:00:11 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-29 17:00:11 -0700
commit03128c2880a8ab9d712c429ccd534b1154d3bd13 (patch)
tree2ff89f4dd660c9db7b11c09d04a47087f3fb2934
parent248292030915b555e82c01eb6699ac458e274474 (diff)
parent8a395624042ed06732703c4e272ad416a45ecf10 (diff)
downloadframeworks_base-03128c2880a8ab9d712c429ccd534b1154d3bd13.zip
frameworks_base-03128c2880a8ab9d712c429ccd534b1154d3bd13.tar.gz
frameworks_base-03128c2880a8ab9d712c429ccd534b1154d3bd13.tar.bz2
am 8a395624: am fc151b6e: Merge "Cleanup DataConnectionTracker" into honeycomb-LTE
* commit '8a395624042ed06732703c4e272ad416a45ecf10': Cleanup DataConnectionTracker
-rw-r--r--telephony/java/com/android/internal/telephony/DataConnectionTracker.java70
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java8
-rwxr-xr-xtelephony/java/com/android/internal/telephony/cdma/CDMAPhone.java2
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java5
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GSMPhone.java2
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java31
6 files changed, 47 insertions, 71 deletions
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index be97124..8a029f1 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -42,6 +42,7 @@ import com.android.internal.R;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
/**
@@ -244,9 +245,26 @@ public abstract class DataConnectionTracker extends Handler {
protected HashMap<Integer, DataConnection> mDataConnections =
new HashMap<Integer, DataConnection>();
+ /** Convert an ApnType string to Id (TODO: Use "enumeration" instead of String for ApnType) */
+ protected HashMap<String, Integer> mApnToDataConnectionId =
+ new HashMap<String, Integer>();
+
+ /** Phone.APN_TYPE_* ===> ApnContext */
+ protected ConcurrentHashMap<String, ApnContext> mApnContexts;
+
/* Currently active APN */
protected ApnSetting mActiveApn;
+ /** allApns holds all apns */
+ protected ArrayList<ApnSetting> mAllApns = null;
+
+ /** preferred apn */
+ protected ApnSetting mPreferredApn = null;
+
+ /** Is packet service restricted by network */
+ protected boolean mIsPsRestricted = false;
+
+
/* Once disposed dont handle any messages */
protected boolean mIsDisposed = false;
@@ -344,11 +362,6 @@ public abstract class DataConnectionTracker extends Handler {
return mActivity;
}
- public State getState() {
- // TODO: reimplement to use apnType better yet REMOVE.
- return mState;
- }
-
/**
* @return the data connections
*/
@@ -390,16 +403,7 @@ public abstract class DataConnectionTracker extends Handler {
return result;
}
- private String getActiveApnType() {
- String result;
- if (mActiveApn != null) {
- result = apnIdToType(mActiveApn.id);
- } else {
- result = null;
- }
- return result;
- }
-
+ /** TODO: See if we can remove */
public String getActiveApnString() {
String result = null;
if (mActiveApn != null) {
@@ -434,10 +438,19 @@ public abstract class DataConnectionTracker extends Handler {
}
}
-
+ // abstract methods
protected abstract String getActionIntentReconnectAlarm();
+ protected abstract void startNetStatPoll();
+ protected abstract void stopNetStatPoll();
+ protected abstract void restartRadio();
+ protected abstract void log(String s);
+ protected abstract void loge(String s);
+ protected abstract boolean isDataAllowed();
+ protected abstract boolean isApnTypeAvailable(String type);
+ public abstract State getState(String apnType);
+ protected abstract void setState(State s);
+ protected abstract void gotoIdleAndNotifyDataConnection(String reason);
- // abstract handler methods
protected abstract boolean onTrySetupData(String reason);
protected abstract void onRoamingOff();
protected abstract void onRoamingOn();
@@ -546,16 +559,6 @@ public abstract class DataConnectionTracker extends Handler {
return result;
}
- protected abstract void startNetStatPoll();
-
- protected abstract void stopNetStatPoll();
-
- protected abstract void restartRadio();
-
- protected abstract void log(String s);
-
- protected abstract void loge(String s);
-
protected int apnTypeToId(String type) {
if (TextUtils.equals(type, Phone.APN_TYPE_DEFAULT)) {
return APN_DEFAULT_ID;
@@ -602,12 +605,6 @@ public abstract class DataConnectionTracker extends Handler {
}
}
- protected abstract boolean isApnTypeAvailable(String type);
-
- protected abstract void setState(State s);
-
- protected abstract void gotoIdleAndNotifyDataConnection(String reason);
-
protected LinkProperties getLinkProperties(String apnType) {
int id = apnTypeToId(apnType);
if (isApnIdEnabled(id)) {
@@ -728,13 +725,12 @@ public abstract class DataConnectionTracker extends Handler {
return possible;
}
- protected abstract boolean isDataAllowed();
-
public boolean isApnTypeEnabled(String apnType) {
if (apnType == null) {
- apnType = getActiveApnType();
+ return false;
+ } else {
+ return isApnIdEnabled(apnTypeToId(apnType));
}
- return isApnIdEnabled(apnTypeToId(apnType));
}
protected synchronized boolean isApnIdEnabled(int id) {
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
index 89d7174..8fd6de1 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
@@ -122,13 +122,7 @@ public class CDMALTEPhone extends CDMAPhone {
} else if (mDataConnection.isApnTypeEnabled(apnType) == false) {
ret = DataState.DISCONNECTED;
} else {
- DataConnectionTracker.State state;
- if (isCdmaDataConnectionTracker) {
- state = mDataConnection.getState();
- } else {
- state = ((GsmDataConnectionTracker)mDataConnection).getState(apnType);
- }
- switch (state) {
+ switch (mDataConnection.getState(apnType)) {
case FAILED:
case IDLE:
ret = DataState.DISCONNECTED;
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
index dd5091c..31abe34 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -633,7 +633,7 @@ public class CDMAPhone extends PhoneBase {
mDataConnection.isApnTypeActive(apnType) == false) {
ret = DataState.DISCONNECTED;
} else {
- switch (mDataConnection.getState()) {
+ switch (mDataConnection.getState(apnType)) {
case FAILED:
case IDLE:
ret = DataState.DISCONNECTED;
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index b24909f..01519a7 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -160,6 +160,11 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
}
@Override
+ public synchronized State getState(String apnType) {
+ return mState;
+ }
+
+ @Override
protected boolean isApnTypeAvailable(String type) {
for (String s : mSupportedApnTypes) {
if (TextUtils.equals(type, s)) {
diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
index 261a61a..36094a1 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -312,7 +312,7 @@ public class GSMPhone extends PhoneBase {
mDataConnection.isApnTypeActive(apnType) == false) {
ret = DataState.DISCONNECTED;
} else { /* mSST.gprsState == ServiceState.STATE_IN_SERVICE */
- switch (mDataConnection.getState()) {
+ switch (mDataConnection.getState(apnType)) {
case FAILED:
case IDLE:
ret = DataState.DISCONNECTED;
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index d8ff268..22c4640 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -102,26 +102,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
//useful for debugging
boolean mFailNextConnect = false;
- /**
- * allApns holds all apns for this sim spn, retrieved from
- * the Carrier DB.
- *
- * Create once after simcard info is loaded
- */
- private ArrayList<ApnSetting> mAllApns = null;
-
- private ApnSetting mPreferredApn = null;
-
- /** Convert an ApnType string to Id (TODO: Use "enumeration" instead of String for ApnType) */
- private HashMap<String, Integer> mApnToDataConnectionId =
- new HashMap<String, Integer>();
-
- /** Phone.APN_TYPE_* ===> ApnContext */
- private ConcurrentHashMap<String, ApnContext> mApnContexts;
-
- /** Is packet service restricted by network */
- private boolean mIsPsRestricted = false;
-
//***** Constants
private static final int POLL_PDP_MILLIS = 5 * 1000;
@@ -320,7 +300,13 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
return null;
}
+ @Override
+ protected void setState(State s) {
+ if (DBG) log("setState should not be used in GSM" + s);
+ }
+
// Return state of specific apn type
+ @Override
public synchronized State getState(String apnType) {
ApnContext apnContext = mApnContexts.get(apnType);
if (apnContext != null) {
@@ -613,11 +599,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
}
- @Override
- protected void setState(State s) {
- if (DBG) log("setState should not be used in GSM" + s);
- }
-
private boolean trySetupData(ApnContext apnContext) {
if (DBG)