Merge "Cleanup all functions overridden from DCT in GDCT" into honeycomb-LTE

This commit is contained in:
Wink Saville
2011-04-09 07:50:37 -07:00
committed by Android (Google) Code Review
2 changed files with 30 additions and 40 deletions

View File

@@ -949,10 +949,6 @@ public abstract class DataConnectionTracker extends Handler {
} }
} }
public synchronized boolean getDataEnabled() {
return mDataEnabled;
}
public void cleanUpAllConnections(String cause) { public void cleanUpAllConnections(String cause) {
Message msg = obtainMessage(EVENT_CLEAN_UP_ALL_CONNECTIONS); Message msg = obtainMessage(EVENT_CLEAN_UP_ALL_CONNECTIONS);
msg.obj = cause; msg.obj = cause;

View File

@@ -67,7 +67,6 @@ import java.net.InetSocketAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
@@ -296,26 +295,30 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
@Override @Override
protected LinkProperties getLinkProperties(String apnType) { protected LinkProperties getLinkProperties(String apnType) {
ApnContext apnContext = mApnContexts.get(apnType); ApnContext apnContext = mApnContexts.get(apnType);
if (apnContext != null && apnContext.getDataConnection() != null) { if (apnContext != null) {
DataConnection dataConnection = apnContext.getDataConnection();
if (dataConnection != null) {
if (DBG) log("get active pdp is not null, return link properites for " + apnType); if (DBG) log("get active pdp is not null, return link properites for " + apnType);
return apnContext.getDataConnection().getLinkProperties(); return dataConnection.getLinkProperties();
} else { }
}
if (DBG) log("return new LinkProperties"); if (DBG) log("return new LinkProperties");
return new LinkProperties(); return new LinkProperties();
} }
}
@Override @Override
protected LinkCapabilities getLinkCapabilities(String apnType) { protected LinkCapabilities getLinkCapabilities(String apnType) {
ApnContext apnContext = mApnContexts.get(apnType); ApnContext apnContext = mApnContexts.get(apnType);
if (apnContext!=null && apnContext.getDataConnection() != null) { if (apnContext!=null) {
DataConnection dataConnection = apnContext.getDataConnection();
if (dataConnection != null) {
if (DBG) log("get active pdp is not null, return link Capabilities for " + apnType); if (DBG) log("get active pdp is not null, return link Capabilities for " + apnType);
return apnContext.getDataConnection().getLinkCapabilities(); return dataConnection.getLinkCapabilities();
} else { }
}
if (DBG) log("return new LinkCapabilities"); if (DBG) log("return new LinkCapabilities");
return new LinkCapabilities(); return new LinkCapabilities();
} }
}
@Override @Override
// Return all active apn types // Return all active apn types
@@ -323,9 +326,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
if (DBG) log("get all active apn types"); if (DBG) log("get all active apn types");
ArrayList<String> result = new ArrayList<String>(); ArrayList<String> result = new ArrayList<String>();
Iterator<ApnContext> it = mApnContexts.values().iterator(); for (ApnContext apnContext : mApnContexts.values()) {
while (it.hasNext()) {
ApnContext apnContext = it.next();
if (apnContext.isReady()) { if (apnContext.isReady()) {
result.add(apnContext.getApnType()); result.add(apnContext.getApnType());
} }
@@ -351,11 +352,14 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
} }
// Return active apn of specific apn type // Return active apn of specific apn type
public synchronized String getActiveApnString(String apnType) { public String getActiveApnString(String apnType) {
if (DBG) log( "get active apn string for type:" + apnType); if (DBG) log( "get active apn string for type:" + apnType);
ApnContext apnContext = mApnContexts.get(apnType); ApnContext apnContext = mApnContexts.get(apnType);
if (apnContext != null && apnContext.getApnSetting() != null) { if (apnContext != null) {
return apnContext.getApnSetting().apn; ApnSetting apnSetting = apnContext.getApnSetting();
if (apnSetting != null) {
return apnSetting.apn;
}
} }
return null; return null;
} }
@@ -367,7 +371,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
// Return state of specific apn type // Return state of specific apn type
@Override @Override
public synchronized State getState(String apnType) { public State getState(String apnType) {
ApnContext apnContext = mApnContexts.get(apnType); ApnContext apnContext = mApnContexts.get(apnType);
if (apnContext != null) { if (apnContext != null) {
return apnContext.getState(); return apnContext.getState();
@@ -378,9 +382,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
// Return state of overall // Return state of overall
public State getOverallState() { public State getOverallState() {
boolean isConnecting = false; boolean isConnecting = false;
Iterator<ApnContext> it = mApnContexts.values().iterator(); for (ApnContext apnContext : mApnContexts.values()) {
while (it.hasNext()) {
ApnContext apnContext = it.next();
if (apnContext.getState() == State.CONNECTED || if (apnContext.getState() == State.CONNECTED ||
apnContext.getState() == State.DISCONNECTING) { apnContext.getState() == State.DISCONNECTING) {
if (DBG) log("overall state is CONNECTED"); if (DBG) log("overall state is CONNECTED");
@@ -713,9 +715,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
protected void cleanUpAllConnections(boolean tearDown, String reason) { protected void cleanUpAllConnections(boolean tearDown, String reason) {
if (DBG) log("Clean up all connections due to " + reason); if (DBG) log("Clean up all connections due to " + reason);
Iterator<ApnContext> it = mApnContexts.values().iterator(); for (ApnContext apnContext : mApnContexts.values()) {
while (it.hasNext()) {
ApnContext apnContext = it.next();
apnContext.setReason(reason); apnContext.setReason(reason);
cleanUpConnection(tearDown, apnContext); cleanUpConnection(tearDown, apnContext);
} }
@@ -970,9 +970,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
return; return;
} }
Iterator<ApnContext> it = mApnContexts.values().iterator(); for (ApnContext apnContext : mApnContexts.values()) {
while (it.hasNext()) {
ApnContext apnContext = it.next();
onDataStateChanged(dataCallStates, explicitPoll, apnContext); onDataStateChanged(dataCallStates, explicitPoll, apnContext);
} }
} }
@@ -1655,9 +1653,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
} }
protected boolean isConnected() { protected boolean isConnected() {
Iterator<ApnContext> it = mApnContexts.values().iterator(); for (ApnContext apnContext : mApnContexts.values()) {
while (it.hasNext()) {
ApnContext apnContext = it.next();
if (apnContext.getState() == State.CONNECTED) { if (apnContext.getState() == State.CONNECTED) {
return true; return true;
} }
@@ -1668,9 +1664,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
@Override @Override
protected void notifyDataConnection(String reason) { protected void notifyDataConnection(String reason) {
if (DBG) log("notify all enabled connection for:" + reason); if (DBG) log("notify all enabled connection for:" + reason);
Iterator<ApnContext> it = mApnContexts.values().iterator(); for (ApnContext apnContext : mApnContexts.values()) {
while (it.hasNext()) {
ApnContext apnContext = it.next();
if (apnContext.isReady()) { if (apnContext.isReady()) {
if (DBG) log("notify for type:"+apnContext.getApnType()); if (DBG) log("notify for type:"+apnContext.getApnType());
mPhone.notifyDataConnection(reason != null ? reason : apnContext.getReason(), mPhone.notifyDataConnection(reason != null ? reason : apnContext.getReason(),