From 24e2d2b0e502ce0975063276427e31a60379bcac Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Mon, 25 Jan 2010 16:14:00 -0800 Subject: [PATCH] Refine fix I53e91db7 to apply only to wifi network The original fix eliminated duplicate wifi connectivity changes stemming from location provder scan's for APs. These would generate two DISCONNECTED broadcasts every two minutes and many apps mis-interpreted them. The fix was to ignore notifications where the major state was the same as the previous one for each network. Unfortunately the state of per-apn notifications on cellular is hacky and so the wifi fix was breaking mms (mms when you're on cellular with a common default+mms apn does not generate a disconnect notification (apn still connected) so subsequent connect notifications get dropped as duplicates). This change refines the previous change so that it only applies to wifi networks. bug:2392061 Change-Id: I05d8a46a4b55f8d28df8af12e05284e5e68bfc02 drno: ryanpc --- .../java/com/android/server/ConnectivityService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index dfb6ff7a02..45eb672109 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -1269,9 +1269,16 @@ public class ConnectivityService extends IConnectivityManager.Stub { info = (NetworkInfo) msg.obj; int type = info.getType(); NetworkInfo.State state = info.getState(); - if (mNetAttributes[type].mLastState == state) { + // only do this optimization for wifi. It going into scan mode for location + // services generates alot of noise. Meanwhile the mms apn won't send out + // subsequent notifications when on default cellular because it never + // disconnects.. so only do this to wifi notifications. Fixed better when the + // APN notifications are standardized. + if (mNetAttributes[type].mLastState == state && + mNetAttributes[type].mRadio == ConnectivityManager.TYPE_WIFI) { if (DBG) { - // TODO - remove this after we validate the dropping doesn't break anything + // TODO - remove this after we validate the dropping doesn't break + // anything Log.d(TAG, "Dropping ConnectivityChange for " + info.getTypeName() + ": " + state + "/" + info.getDetailedState());