diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2011-01-27 10:20:33 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-01-27 10:20:33 -0800 |
commit | b27ce984510ed287b87cb7498efb973fb651e8cb (patch) | |
tree | 965d909a7ec77650801b16c0d239d937cdbf51cf /core/java/android | |
parent | d1ca9aa561337dd294b8ae137f54b182372e69fb (diff) | |
parent | 89a544088fcfa849be0d8824a2ac0a545950847b (diff) | |
download | frameworks_base-b27ce984510ed287b87cb7498efb973fb651e8cb.zip frameworks_base-b27ce984510ed287b87cb7498efb973fb651e8cb.tar.gz frameworks_base-b27ce984510ed287b87cb7498efb973fb651e8cb.tar.bz2 |
am 89a54408: Merge "Update networktype before sending state change." into gingerbread
* commit '89a544088fcfa849be0d8824a2ac0a545950847b':
Update networktype before sending state change.
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/net/MobileDataStateTracker.java | 8 | ||||
-rw-r--r-- | core/java/android/net/NetworkStateTracker.java | 10 |
2 files changed, 10 insertions, 8 deletions
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java index 8d18eba..32c2d64 100644 --- a/core/java/android/net/MobileDataStateTracker.java +++ b/core/java/android/net/MobileDataStateTracker.java @@ -150,6 +150,11 @@ public class MobileDataStateTracker extends NetworkStateTracker { ConnectivityManager mConnectivityManager; public void onReceive(Context context, Intent intent) { synchronized(this) { + // update state and roaming before we set the state - only state changes are + // noticed + TelephonyManager tm = TelephonyManager.getDefault(); + setRoamingStatus(tm.isNetworkRoaming()); + setSubtype(tm.getNetworkType(), tm.getNetworkTypeName()); if (intent.getAction().equals(TelephonyIntents. ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) { Phone.DataState state = getMobileDataState(intent); @@ -255,9 +260,6 @@ public class MobileDataStateTracker extends NetworkStateTracker { reason == null ? "" : "(" + reason + ")"); setDetailedState(DetailedState.FAILED, reason, apnName); } - TelephonyManager tm = TelephonyManager.getDefault(); - setRoamingStatus(tm.isNetworkRoaming()); - setSubtype(tm.getNetworkType(), tm.getNetworkTypeName()); } } } diff --git a/core/java/android/net/NetworkStateTracker.java b/core/java/android/net/NetworkStateTracker.java index c161f3a..9140dc9 100644 --- a/core/java/android/net/NetworkStateTracker.java +++ b/core/java/android/net/NetworkStateTracker.java @@ -315,7 +315,7 @@ public abstract class NetworkStateTracker extends Handler { public boolean isTeardownRequested() { return mTeardownRequested; } - + /** * Send a notification that the results of a scan for network access * points has completed, and results are available. @@ -340,10 +340,10 @@ public abstract class NetworkStateTracker extends Handler { } protected void setSubtype(int subtype, String subtypeName) { - if (mNetworkInfo.isConnected()) { - int oldSubtype = mNetworkInfo.getSubtype(); - if (subtype != oldSubtype) { - mNetworkInfo.setSubtype(subtype, subtypeName); + int oldSubtype = mNetworkInfo.getSubtype(); + if (subtype != oldSubtype) { + mNetworkInfo.setSubtype(subtype, subtypeName); + if (mNetworkInfo.isConnected()) { Message msg = mTarget.obtainMessage( EVENT_NETWORK_SUBTYPE_CHANGED, oldSubtype, 0, mNetworkInfo); msg.sendToTarget(); |