Merge commit '096871e7e1a1f8cdfbaa1acc4bc485b69ddf22a4' into eclair-mr2-plus-aosp * commit '096871e7e1a1f8cdfbaa1acc4bc485b69ddf22a4': Filter out minor Connectivity Notifications.
This commit is contained in:
@ -100,7 +100,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
private boolean mSystemReady;
|
private boolean mSystemReady;
|
||||||
private ArrayList<Intent> mDeferredBroadcasts;
|
private ArrayList<Intent> mDeferredBroadcasts;
|
||||||
|
|
||||||
private class NetworkAttributes {
|
private static class NetworkAttributes {
|
||||||
/**
|
/**
|
||||||
* Class for holding settings read from resources.
|
* Class for holding settings read from resources.
|
||||||
*/
|
*/
|
||||||
@ -108,6 +108,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
public int mType;
|
public int mType;
|
||||||
public int mRadio;
|
public int mRadio;
|
||||||
public int mPriority;
|
public int mPriority;
|
||||||
|
public NetworkInfo.State mLastState;
|
||||||
public NetworkAttributes(String init) {
|
public NetworkAttributes(String init) {
|
||||||
String fragments[] = init.split(",");
|
String fragments[] = init.split(",");
|
||||||
mName = fragments[0].toLowerCase();
|
mName = fragments[0].toLowerCase();
|
||||||
@ -128,6 +129,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
mType = ConnectivityManager.TYPE_MOBILE_HIPRI;
|
mType = ConnectivityManager.TYPE_MOBILE_HIPRI;
|
||||||
}
|
}
|
||||||
mPriority = Integer.parseInt(fragments[2]);
|
mPriority = Integer.parseInt(fragments[2]);
|
||||||
|
mLastState = NetworkInfo.State.UNKNOWN;
|
||||||
}
|
}
|
||||||
public boolean isDefault() {
|
public boolean isDefault() {
|
||||||
return (mType == mRadio);
|
return (mType == mRadio);
|
||||||
@ -135,7 +137,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
}
|
}
|
||||||
NetworkAttributes[] mNetAttributes;
|
NetworkAttributes[] mNetAttributes;
|
||||||
|
|
||||||
private class RadioAttributes {
|
private static class RadioAttributes {
|
||||||
public String mName;
|
public String mName;
|
||||||
public int mPriority;
|
public int mPriority;
|
||||||
public int mSimultaneity;
|
public int mSimultaneity;
|
||||||
@ -1213,9 +1215,22 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case NetworkStateTracker.EVENT_STATE_CHANGED:
|
case NetworkStateTracker.EVENT_STATE_CHANGED:
|
||||||
info = (NetworkInfo) msg.obj;
|
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 " +
|
if (DBG) Log.d(TAG, "ConnectivityChange for " +
|
||||||
info.getTypeName() + ": " +
|
info.getTypeName() + ": " +
|
||||||
info.getState() + "/" + info.getDetailedState());
|
state + "/" + info.getDetailedState());
|
||||||
|
|
||||||
// Connectivity state changed:
|
// Connectivity state changed:
|
||||||
// [31-13] Reserved for future use
|
// [31-13] Reserved for future use
|
||||||
@ -1233,10 +1248,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
if (info.getDetailedState() ==
|
if (info.getDetailedState() ==
|
||||||
NetworkInfo.DetailedState.FAILED) {
|
NetworkInfo.DetailedState.FAILED) {
|
||||||
handleConnectionFailure(info);
|
handleConnectionFailure(info);
|
||||||
} else if (info.getState() ==
|
} else if (state == NetworkInfo.State.DISCONNECTED) {
|
||||||
NetworkInfo.State.DISCONNECTED) {
|
|
||||||
handleDisconnect(info);
|
handleDisconnect(info);
|
||||||
} else if (info.getState() == NetworkInfo.State.SUSPENDED) {
|
} else if (state == NetworkInfo.State.SUSPENDED) {
|
||||||
// TODO: need to think this over.
|
// TODO: need to think this over.
|
||||||
// the logic here is, handle SUSPENDED the same as
|
// the logic here is, handle SUSPENDED the same as
|
||||||
// DISCONNECTED. The only difference being we are
|
// DISCONNECTED. The only difference being we are
|
||||||
@ -1245,7 +1259,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
// opportunity to handle DISCONNECTED and SUSPENDED
|
// opportunity to handle DISCONNECTED and SUSPENDED
|
||||||
// differently, or not.
|
// differently, or not.
|
||||||
handleDisconnect(info);
|
handleDisconnect(info);
|
||||||
} else if (info.getState() == NetworkInfo.State.CONNECTED) {
|
} else if (state == NetworkInfo.State.CONNECTED) {
|
||||||
handleConnect(info);
|
handleConnect(info);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user