Merge change Ifc9dd5c6 into eclair

* changes:
  Fix the reporting of ActiveApnTypes on CDMA
This commit is contained in:
Android (Google) Code Review
2009-09-29 16:25:55 -04:00
2 changed files with 27 additions and 13 deletions

View File

@@ -76,6 +76,9 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
/** Currently active CdmaDataConnection */ /** Currently active CdmaDataConnection */
private CdmaDataConnection mActiveDataConnection; private CdmaDataConnection mActiveDataConnection;
/** mimic of GSM's mActiveApn */
private boolean mIsApnActive = false;
private boolean mPendingRestartRadio = false; private boolean mPendingRestartRadio = false;
private static final int TIME_DELAYED_TO_RESTART_RADIO = private static final int TIME_DELAYED_TO_RESTART_RADIO =
SystemProperties.getInt("ro.cdma.timetoradiorestart", 20000); SystemProperties.getInt("ro.cdma.timetoradiorestart", 20000);
@@ -245,8 +248,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
@Override @Override
protected boolean isApnTypeActive(String type) { protected boolean isApnTypeActive(String type) {
return (isApnTypeAvailable(type) && return (mIsApnActive && isApnTypeAvailable(type));
(state != State.IDLE));
} }
@Override @Override
@@ -260,10 +262,15 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
} }
protected String[] getActiveApnTypes() { protected String[] getActiveApnTypes() {
if (state != State.IDLE) { String[] result;
return mSupportedApnTypes.clone(); if (mIsApnActive) {
result = mSupportedApnTypes.clone();
} else {
// TODO - should this return an empty array? See GSM too.
result = new String[1];
result[0] = Phone.APN_TYPE_DEFAULT;
} }
return new String[0]; return result;
} }
protected String getActiveApnString() { protected String getActiveApnString() {
@@ -386,6 +393,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
if (!tearDown) { if (!tearDown) {
setState(State.IDLE); setState(State.IDLE);
phone.notifyDataConnection(reason); phone.notifyDataConnection(reason);
mIsApnActive = false;
} }
} }
@@ -409,6 +417,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
} }
mActiveDataConnection = conn; mActiveDataConnection = conn;
mIsApnActive = true;
Message msg = obtainMessage(); Message msg = obtainMessage();
msg.what = EVENT_DATA_SETUP_COMPLETE; msg.what = EVENT_DATA_SETUP_COMPLETE;
@@ -742,6 +751,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
} }
phone.notifyDataConnection(reason); phone.notifyDataConnection(reason);
mIsApnActive = false;
if (retryAfterDisconnected(reason)) { if (retryAfterDisconnected(reason)) {
trySetupData(reason); trySetupData(reason);
} }

View File

@@ -596,32 +596,36 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
} }
protected String getInterfaceName(String apnType) { protected String getInterfaceName(String apnType) {
if (mActivePdp != null if (mActivePdp != null &&
&& (apnType == null || mActiveApn.canHandleType(apnType))) { (apnType == null ||
(mActiveApn != null && mActiveApn.canHandleType(apnType)))) {
return mActivePdp.getInterface(); return mActivePdp.getInterface();
} }
return null; return null;
} }
protected String getIpAddress(String apnType) { protected String getIpAddress(String apnType) {
if (mActivePdp != null if (mActivePdp != null &&
&& (apnType == null || mActiveApn.canHandleType(apnType))) { (apnType == null ||
(mActiveApn != null && mActiveApn.canHandleType(apnType)))) {
return mActivePdp.getIpAddress(); return mActivePdp.getIpAddress();
} }
return null; return null;
} }
public String getGateway(String apnType) { public String getGateway(String apnType) {
if (mActivePdp != null if (mActivePdp != null &&
&& (apnType == null || mActiveApn.canHandleType(apnType))) { (apnType == null ||
(mActiveApn != null && mActiveApn.canHandleType(apnType)))) {
return mActivePdp.getGatewayAddress(); return mActivePdp.getGatewayAddress();
} }
return null; return null;
} }
protected String[] getDnsServers(String apnType) { protected String[] getDnsServers(String apnType) {
if (mActivePdp != null if (mActivePdp != null &&
&& (apnType == null || mActiveApn.canHandleType(apnType))) { (apnType == null ||
(mActiveApn != null && mActiveApn.canHandleType(apnType)))) {
return mActivePdp.getDnsServers(); return mActivePdp.getDnsServers();
} }
return null; return null;