summaryrefslogtreecommitdiffstats
path: root/core/java/android/net
diff options
context:
space:
mode:
authorRobert Greenwalt <robdroid@android.com>2009-08-19 20:19:33 -0700
committerRobert Greenwalt <robdroid@android.com>2009-08-19 21:58:12 -0700
commita64bf834ffa677405af1c87c9f53eed0cd3853ce (patch)
tree6e92c9024b708aa8cf0e7e2839d20d071774cd45 /core/java/android/net
parentf5d493a54b2320efecfb47d9c8b51092a7fe171f (diff)
downloadframeworks_base-a64bf834ffa677405af1c87c9f53eed0cd3853ce.zip
frameworks_base-a64bf834ffa677405af1c87c9f53eed0cd3853ce.tar.gz
frameworks_base-a64bf834ffa677405af1c87c9f53eed0cd3853ce.tar.bz2
Fix various issues found when testing Mms.
Fix some race conditions (check isTeardownRequested). Fix the passing of mInterfaceName to subtypes (mms, etc). Fix the generation of CONNECTED message to already active subtypes. Fix the enabling of Data in DataConnectionTracker. bug: 2065037
Diffstat (limited to 'core/java/android/net')
-rw-r--r--core/java/android/net/MobileDataStateTracker.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index c5d6e11..f9effa2 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -143,8 +143,9 @@ public class MobileDataStateTracker extends NetworkStateTracker {
boolean unavailable = intent.getBooleanExtra(Phone.NETWORK_UNAVAILABLE_KEY,
false);
if (DBG) Log.d(TAG, mApnType + " Received " + intent.getAction() +
- " broadcast - state = " + state + ", unavailable = " + unavailable +
- ", reason = " + (reason == null ? "(unspecified)" : reason));
+ " broadcast - state = " + state + ", oldstate = " + mMobileDataState +
+ ", unavailable = " + unavailable + ", reason = " +
+ (reason == null ? "(unspecified)" : reason));
if (isApnTypeIncluded(apnTypeList)) {
if (mEnabled == false) {
@@ -152,10 +153,12 @@ public class MobileDataStateTracker extends NetworkStateTracker {
// we should record the interface name if one's provided. If the user
// turns on this network we will need the interfacename but won't get
// a fresh connected message - TODO fix this..
- if (mInterfaceName == null && state == Phone.DataState.CONNECTED) {
+ if (state == Phone.DataState.CONNECTED) {
+ if (DBG) Log.d(TAG, "replacing old mInterfaceName (" +
+ mInterfaceName + ") with " +
+ intent.getStringExtra(Phone.DATA_IFACE_NAME_KEY) +
+ " for " + mApnType);
mInterfaceName = intent.getStringExtra(Phone.DATA_IFACE_NAME_KEY);
- } else if (state == Phone.DataState.DISCONNECTED) {
- mInterfaceName = null;
}
if (DBG) Log.d(TAG, " dropped - mEnabled = false");
return;
@@ -179,6 +182,8 @@ public class MobileDataStateTracker extends NetworkStateTracker {
if (mInterfaceName != null) {
NetworkUtils.resetConnections(mInterfaceName);
}
+ if (DBG) Log.d(TAG, "clearing mInterfaceName for "+ mApnType +
+ " as it DISCONNECTED");
mInterfaceName = null;
mDefaultGatewayAddr = 0;
break;
@@ -301,6 +306,8 @@ public class MobileDataStateTracker extends NetworkStateTracker {
switch (setEnableApn(mApnType, true)) {
case Phone.APN_ALREADY_ACTIVE:
mEnabled = true;
+ // need to set self to CONNECTING so the below message is handled.
+ mMobileDataState = Phone.DataState.CONNECTING;
//send out a connected message
Intent intent = new Intent(TelephonyIntents.
ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
@@ -412,10 +419,11 @@ public class MobileDataStateTracker extends NetworkStateTracker {
*/
@Override
public boolean requestRouteToHost(int hostAddress) {
+ if (DBG) {
+ Log.d(TAG, "Requested host route to " + Integer.toHexString(hostAddress) +
+ " for " + mApnType + "(" + mInterfaceName + ")");
+ }
if (mInterfaceName != null && hostAddress != -1) {
- if (DBG) {
- Log.d(TAG, "Requested host route to " + Integer.toHexString(hostAddress));
- }
return NetworkUtils.addHostRoute(mInterfaceName, hostAddress) == 0;
} else {
return false;