diff options
author | Robert Greenwalt <robdroid@android.com> | 2009-12-07 15:09:30 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-12-07 15:09:30 -0800 |
commit | 22de2aecab812c7e009b1f0e5f8ee09d97fd7474 (patch) | |
tree | 07976c2fe969c92e3e6e652e17f5219e9af5da0b | |
parent | 387488fb1f728b8986bd8d252130b2c46fb965ae (diff) | |
parent | 90d1b745ec4a7ccd15cdcc185420bf2000b4f7a3 (diff) | |
download | frameworks_base-22de2aecab812c7e009b1f0e5f8ee09d97fd7474.zip frameworks_base-22de2aecab812c7e009b1f0e5f8ee09d97fd7474.tar.gz frameworks_base-22de2aecab812c7e009b1f0e5f8ee09d97fd7474.tar.bz2 |
am 90d1b745: Merge change I53e91db7 into eclair
Merge commit '90d1b745ec4a7ccd15cdcc185420bf2000b4f7a3' into eclair-plus-aosp
* commit '90d1b745ec4a7ccd15cdcc185420bf2000b4f7a3':
Filter out minor Connectivity Notifications.
-rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 78215b0..9b41f83 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -103,7 +103,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { private boolean mSystemReady; private ArrayList<Intent> mDeferredBroadcasts; - private class NetworkAttributes { + private static class NetworkAttributes { /** * Class for holding settings read from resources. */ @@ -111,6 +111,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { public int mType; public int mRadio; public int mPriority; + public NetworkInfo.State mLastState; public NetworkAttributes(String init) { String fragments[] = init.split(","); mName = fragments[0].toLowerCase(); @@ -131,6 +132,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { mType = ConnectivityManager.TYPE_MOBILE_HIPRI; } mPriority = Integer.parseInt(fragments[2]); + mLastState = NetworkInfo.State.UNKNOWN; } public boolean isDefault() { return (mType == mRadio); @@ -138,7 +140,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { } NetworkAttributes[] mNetAttributes; - private class RadioAttributes { + private static class RadioAttributes { public String mName; public int mPriority; public int mSimultaneity; @@ -1214,9 +1216,22 @@ public class ConnectivityService extends IConnectivityManager.Stub { switch (msg.what) { case NetworkStateTracker.EVENT_STATE_CHANGED: info = (NetworkInfo) msg.obj; + int type = info.getType(); + NetworkInfo.State state = info.getState(); + if(mNetAttributes[type].mLastState == state) { + if (DBG) { + // TODO - remove this after we validate the dropping doesn't break anything + Log.d(TAG, "Dropping ConnectivityChange for " + + info.getTypeName() +": " + + state + "/" + info.getDetailedState()); + } + return; + } + mNetAttributes[type].mLastState = state; + if (DBG) Log.d(TAG, "ConnectivityChange for " + info.getTypeName() + ": " + - info.getState() + "/" + info.getDetailedState()); + state + "/" + info.getDetailedState()); // Connectivity state changed: // [31-13] Reserved for future use @@ -1234,10 +1249,9 @@ public class ConnectivityService extends IConnectivityManager.Stub { if (info.getDetailedState() == NetworkInfo.DetailedState.FAILED) { handleConnectionFailure(info); - } else if (info.getState() == - NetworkInfo.State.DISCONNECTED) { + } else if (state == NetworkInfo.State.DISCONNECTED) { handleDisconnect(info); - } else if (info.getState() == NetworkInfo.State.SUSPENDED) { + } else if (state == NetworkInfo.State.SUSPENDED) { // TODO: need to think this over. // the logic here is, handle SUSPENDED the same as // DISCONNECTED. The only difference being we are @@ -1246,7 +1260,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { // opportunity to handle DISCONNECTED and SUSPENDED // differently, or not. handleDisconnect(info); - } else if (info.getState() == NetworkInfo.State.CONNECTED) { + } else if (state == NetworkInfo.State.CONNECTED) { handleConnect(info); } break; |