Add autojoin knobs in WifiManager to SL4A.
b/22568568

Also fix some typos in wifi ent roaming tests.

Change-Id: I451e0685ef5c193c8ead678f7450e3b7a944ee31
diff --git a/Common/src/com/googlecode/android_scripting/facade/wifi/HttpFacade.java b/Common/src/com/googlecode/android_scripting/facade/wifi/HttpFacade.java
index 5ab0023..2fbebd7 100644
--- a/Common/src/com/googlecode/android_scripting/facade/wifi/HttpFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/wifi/HttpFacade.java
@@ -76,10 +76,9 @@
 
     /**
      * Send an http request and get the response.
-     * 
+     *
      * @param url The url to send request to.
      * @return The HttpURLConnection object.
-     * @throws IOException When request failed to go through with response code 200.
      */
     private HttpURLConnection httpRequest(String url) throws IOException {
         URL targetURL = new URL(url);
@@ -90,7 +89,6 @@
         } catch (IOException e) {
             Log.e("Failed to open a connection to " + url);
             Log.e(e.toString());
-            throw e;
         } finally {
             if (urlConnection != null) {
                 urlConnection.disconnect();
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 2675ceb..f233e0f 100755
--- a/Common/src/com/googlecode/android_scripting/facade/wifi/WifiManagerFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/wifi/WifiManagerFacade.java
@@ -541,6 +541,11 @@
         return mWifi.disconnect();
     }
 
+    @Rpc(description = "Enable/disable autojoin scan and switch network when connected.")
+    public Boolean wifiEnableAutoJoinWhenAssociated(@RpcParameter(name = "enable") Boolean enable) {
+        return mWifi.enableAutoJoinWhenAssociated(enable);
+    }
+
     @Rpc(description = "Enable a configured network. Initiate a connection if disableOthers is true",
             returns = "True if the operation succeeded.")
     public Boolean wifiEnableNetwork(@RpcParameter(name = "netId") Integer netId,
@@ -630,6 +635,16 @@
         return mWifi.getDhcpInfo();
     }
 
+    @Rpc(description = "Get setting for Framework layer autojoin enable status.")
+    public Boolean wifiGetEnableAutoJoinWhenAssociated() {
+        return mWifi.getEnableAutoJoinWhenAssociated();
+    }
+
+    @Rpc(description = "Returns 1 if autojoin offload thru Wifi HAL layer is enabled, 0 otherwise.")
+    public Integer wifiGetHalBasedAutojoinOffload() {
+        return mWifi.getHalBasedAutojoinOffload();
+    }
+
     @Rpc(description = "Get privileged configured networks.")
     public List<WifiConfiguration> wifiGetPrivilegedConfiguredNetworks() {
         return mWifi.getPrivilegedConfiguredNetworks();
@@ -820,6 +835,12 @@
         mWifi.setCountryCode(country, persist);
     }
 
+    @Rpc(description = "Enable/disable autojoin offload through Wifi HAL layer.")
+    public void wifiSetHalBasedAutojoinOffload(
+            @RpcParameter(name = "enable") Integer enable) {
+        mWifi.setHalBasedAutojoinOffload(enable);
+    }
+
     @Rpc(description = "Enable/disable tdls with a mac address.")
     public void wifiSetTdlsEnabledWithMacAddress(
             @RpcParameter(name = "remoteMacAddress") String remoteMacAddress,