WifiManagerFacade: remove extra disconnect call

When calling connect in the WifiManagerFacade, there is an extra
disconnect call.  Remove this call to avoid inserting logic in the
facade class.  Further evaluation needs to be done on the other calls in
the method.

BUG: 30439726
(cherry picked from commit Ic7544d63436b0e5db92fd98e014b61f68f7e8e61)

Add Error Checks in wifiConnect and wifiEnterpriseConnect

Bug: 31404763
(cherry picked from commit I5faafdcf47a80064d1ef8e1d6531cb9b5e79def1)

Change-Id: I391b58a0c427f219e0bef25e6add7c6ecd637d71
diff --git a/Common/src/com/googlecode/android_scripting/facade/wifi/WifiManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/wifi/WifiManagerFacade.java
index 96947e7..4a686cf 100755
--- a/Common/src/com/googlecode/android_scripting/facade/wifi/WifiManagerFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/wifi/WifiManagerFacade.java
@@ -523,8 +523,10 @@
             Log.e("Got negative network Id.");
             return false;
         }
-        mWifi.disconnect();
-        mWifi.enableNetwork(nId, true);
+        if (!mWifi.enableNetwork(nId, true)) {
+            Log.e("Failed to enable wifi network.");
+            return false;
+        }
         return mWifi.reconnect();
     }
 
@@ -550,18 +552,22 @@
     }
 
     @Rpc(description = "Connect to a wifi network that uses Enterprise authentication methods.")
-    public void wifiEnterpriseConnect(@RpcParameter(name = "config") JSONObject config)
+    public Boolean wifiEnterpriseConnect(@RpcParameter(name = "config") JSONObject config)
             throws JSONException, GeneralSecurityException {
         // Create Certificate
         WifiActionListener listener = new WifiActionListener(mEventFacade, "EnterpriseConnect");
         WifiConfiguration wifiConfig = genWifiEnterpriseConfig(config);
         if (wifiConfig.isPasspoint()) {
             Log.d("Got a passpoint config, add it and save config.");
-            mWifi.addNetwork(wifiConfig);
-            mWifi.saveConfiguration();
+            if (mWifi.addNetwork(wifiConfig) == -1) {
+                Log.e("Failed to add a wifi network");
+                return false;
+            }
+            return mWifi.saveConfiguration();
         } else {
             Log.d("Got a non-passpoint enterprise config, connect directly.");
             mWifi.connect(wifiConfig, listener);
+            return true;
         }
     }