WifiStateMachine: Revert IpReachabilityMonitor handling changes

These changes are intended to get rid of unnecessary re-connections.
These appear to be mostly caused by WPA group rekeyings. Revert these
change, a different fix will be applied with a followup change.

This reverts commit b99f96ab10f18569ee00ac9cf300b77170032113
("Wifi: send CMD_IP_RECHABILITY_SESSION_END in L2ConnectedState")
and commit 644f2ae1fd0923cf902a3303cd27902249949c49
("Wifi: Handle IP_REACHABILITY_LOST only for roaming scenarios")

Change-Id: I8eba6529a8f9f09f0442e106a696608bd1a37ae2
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 826ba35..c0ff345 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -383,9 +383,6 @@
     // Whether the state machine goes thru the Disconnecting->Disconnected->ObtainingIpAddress
     private boolean mAutoRoaming = false;
 
-    private boolean mIsWiFiIpReachabilityEnabled = false;
-    private boolean mDriverRoaming = false;
-
     // Roaming failure count
     private int mRoamFailCount = 0;
 
@@ -860,8 +857,6 @@
     /* Enable/disable Neighbor Discovery offload functionality. */
     static final int CMD_CONFIG_ND_OFFLOAD                              = BASE + 204;
 
-    static final int CMD_IP_RECHABILITY_SESSION_END                     = BASE + 205;
-
     // For message logging.
     private static final Class[] sMessageClasses = {
             AsyncChannel.class, WifiStateMachine.class, DhcpClient.class };
@@ -1126,8 +1121,6 @@
 
         mBackgroundScanSupported = mContext.getResources().getBoolean(
                 R.bool.config_wifi_background_scan_support);
-        mIsWiFiIpReachabilityEnabled = mContext.getResources().getBoolean(
-                R.bool.config_wifi_ipreachability_monitor);
 
         mPrimaryDeviceType = mContext.getResources().getString(
                 R.string.config_wifi_p2p_device_type);
@@ -3079,11 +3072,6 @@
                     sb.append(Integer.toString(msg.arg1));
                 }
                 break;
-            case CMD_IP_RECHABILITY_SESSION_END:
-                if (msg.obj != null) {
-                    sb.append(" ").append((String) msg.obj);
-                }
-                break;
             default:
                 sb.append(" ");
                 sb.append(Integer.toString(msg.arg1));
@@ -4314,7 +4302,6 @@
                 case CMD_ROAM_WATCHDOG_TIMER:
                 case CMD_DISABLE_EPHEMERAL_NETWORK:
                 case CMD_UPDATE_ASSOCIATED_SCAN_PERMISSION:
-                case CMD_IP_RECHABILITY_SESSION_END:
                     messageHandlingStatus = MESSAGE_HANDLING_STATUS_DISCARD;
                     break;
                 case CMD_SET_SUSPEND_OPT_ENABLED:
@@ -6870,18 +6857,8 @@
                     break;
                 case CMD_IP_REACHABILITY_LOST:
                     if (DBG && message.obj != null) log((String) message.obj);
-                    if (!mIsWiFiIpReachabilityEnabled) {
-                        if (mDriverRoaming) {
-                            Log.e(TAG,"Roaming in progress, hence honur NUD failure");
-                            handleIpReachabilityLost();
-                            transitionTo(mDisconnectingState);
-                        } else {
-                            Log.e(TAG,"IPreachibility session is over, skip NUD failure");
-                        }
-                    } else {
-                        handleIpReachabilityLost();
-                        transitionTo(mDisconnectingState);
-                    }
+                    handleIpReachabilityLost();
+                    transitionTo(mDisconnectingState);
                     break;
                 case CMD_DISCONNECT:
                     mWifiNative.disconnect();
@@ -6921,9 +6898,6 @@
                         mLastBssid = (String) message.obj;
                         sendNetworkStateChangeBroadcast(mLastBssid);
                     }
-                    mDriverRoaming = true;
-                    sendMessageDelayed(obtainMessage(CMD_IP_RECHABILITY_SESSION_END,
-                                       0, 0), 10000);
                     break;
                 case CMD_RSSI_POLL:
                     if (message.arg1 == mRssiPollToken) {
@@ -7306,9 +7280,6 @@
                         //
                         // mIpManager.confirmConfiguration() is called within
                         // the handling of SupplicantState.COMPLETED.
-                        mDriverRoaming = true;
-                        sendMessageDelayed(obtainMessage(CMD_IP_RECHABILITY_SESSION_END,
-                                           0, 0), 10000);
                         transitionTo(mConnectedState);
                     } else {
                         messageHandlingStatus = MESSAGE_HANDLING_STATUS_DISCARD;
@@ -7674,8 +7645,10 @@
                         }
                     }
                     break;
-                case CMD_IP_RECHABILITY_SESSION_END:
-                    mDriverRoaming = false;
+                case CMD_IP_REACHABILITY_LOST:
+                    if (DBG && message.obj != null) log((String) message.obj);
+                    handleIpReachabilityLost();
+                    transitionTo(mDisconnectingState);
                     break;
                 default:
                     return NOT_HANDLED;
@@ -7773,7 +7746,6 @@
 
             /** clear the roaming state, if we were roaming, we failed */
             mAutoRoaming = false;
-            mDriverRoaming = false;
 
             if (mWifiConnectivityManager != null) {
                 mWifiConnectivityManager.handleConnectionStateChanged(