diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 5aba7ec..2ccde3b 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -194,6 +194,7 @@
     private int mNetworkPreference;
     private int mActiveDefaultNetwork = -1;
     // 0 is full bad, 100 is full good
+    private int mDefaultInetCondition = 0;
     private int mDefaultInetConditionPublished = 0;
     private boolean mInetConditionChangeInFlight = false;
     private int mDefaultConnectionSequence = 0;
@@ -1727,10 +1728,6 @@
                 intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
             } else {
                 mDefaultInetConditionPublished = 0; // we're not connected anymore
-                if (DBG) {
-                    log("handleDisconnect: net=" + mActiveDefaultNetwork +
-                            ", published condition=" + mDefaultInetConditionPublished);
-                }
                 intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
             }
         }
@@ -1921,10 +1918,6 @@
                 intent.putExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO, switchTo);
             } else {
                 mDefaultInetConditionPublished = 0;
-                if (DBG) {
-                    log("handleConnectionFailure: net=" + mActiveDefaultNetwork +
-                            ", published condition=" + mDefaultInetConditionPublished);
-                }
                 intent.putExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, true);
             }
         }
@@ -2069,10 +2062,6 @@
             mDefaultInetConditionPublished = 0;
             mDefaultConnectionSequence++;
             mInetConditionChangeInFlight = false;
-            if (DBG) {
-                log("handleConnect: net=" + newNetType +
-                        ", published condition=" + mDefaultInetConditionPublished);
-            }
             // Don't do this - if we never sign in stay, grey
             //reportNetworkCondition(mActiveDefaultNetwork, 100);
         }
@@ -2723,8 +2712,7 @@
                 {
                     int netType = msg.arg1;
                     int sequence = msg.arg2;
-                    int condition = (Integer)msg.obj;
-                    handleInetConditionHoldEnd(netType, sequence, condition);
+                    handleInetConditionHoldEnd(netType, sequence);
                     break;
                 }
                 case EVENT_SET_NETWORK_PREFERENCE:
@@ -2937,13 +2925,14 @@
         if (VDBG) {
             log("handleInetConditionChange: net=" +
                     netType + ", condition=" + condition +
-                    " mActiveDefaultNetwork=" + mActiveDefaultNetwork);
+                    ",mActiveDefaultNetwork=" + mActiveDefaultNetwork);
         }
+        mDefaultInetCondition = condition;
         int delay;
         if (mInetConditionChangeInFlight == false) {
             if (VDBG) log("handleInetConditionChange: starting a change hold");
             // setup a new hold to debounce this
-            if (condition > 50) {
+            if (mDefaultInetCondition > 50) {
                 delay = Settings.Global.getInt(mContext.getContentResolver(),
                         Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY, 500);
             } else {
@@ -2952,16 +2941,18 @@
             }
             mInetConditionChangeInFlight = true;
             mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_INET_CONDITION_HOLD_END,
-                    mActiveDefaultNetwork, mDefaultConnectionSequence, new Integer(condition)), delay);
+                    mActiveDefaultNetwork, mDefaultConnectionSequence), delay);
         } else {
             // we've set the new condition, when this hold ends that will get picked up
             if (VDBG) log("handleInetConditionChange: currently in hold - not setting new end evt");
         }
     }
 
-    private void handleInetConditionHoldEnd(int netType, int sequence, int condition) {
+    private void handleInetConditionHoldEnd(int netType, int sequence) {
         if (DBG) {
-            log("handleInetConditionHoldEnd: net=" + netType + ", condition=" + condition);
+            log("handleInetConditionHoldEnd: net=" + netType +
+                    ", condition=" + mDefaultInetCondition +
+                    ", published condition=" + mDefaultInetConditionPublished);
         }
         mInetConditionChangeInFlight = false;
 
@@ -2973,13 +2964,19 @@
             if (DBG) log("handleInetConditionHoldEnd: event hold for obsolete network - ignoring");
             return;
         }
-
+        // TODO: Figure out why this optimization sometimes causes a
+        //       change in mDefaultInetCondition to be missed and the
+        //       UI to not be updated.
+        //if (mDefaultInetConditionPublished == mDefaultInetCondition) {
+        //    if (DBG) log("no change in condition - aborting");
+        //    return;
+        //}
         NetworkInfo networkInfo = mNetTrackers[mActiveDefaultNetwork].getNetworkInfo();
         if (networkInfo.isConnected() == false) {
             if (DBG) log("handleInetConditionHoldEnd: default network not connected - ignoring");
             return;
         }
-        mDefaultInetConditionPublished = condition;
+        mDefaultInetConditionPublished = mDefaultInetCondition;
         sendInetConditionBroadcast(networkInfo);
         return;
     }
