Fix sl4a build due to API changes.

API change id : Ibbe07183b1293835c4a84728d1cd2d61e5d627d3

Change-Id: I1b46d3b3d9274d2456428a2dc9e7812581b20e55
diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeAdvertiseFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeAdvertiseFacade.java
index 936044f..b952494 100644
--- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeAdvertiseFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeAdvertiseFacade.java
@@ -493,11 +493,9 @@
             @RpcParameter(name = "uuidList")
             String[] uuidList
             ) {
-        ArrayList<ParcelUuid> mUuids = new ArrayList<ParcelUuid>();
         for (String uuid : uuidList) {
-            mUuids.add(ParcelUuid.fromString(uuid));
+            mAdvertiseDataBuilder.addServiceUuid(ParcelUuid.fromString(uuid));
         }
-        mAdvertiseDataBuilder.setServiceUuids(mUuids);
     }
 
     /**
diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
index 4f75126..3c7f89f 100644
--- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
@@ -372,8 +372,8 @@
     public void setScanSettings(
             @RpcParameter(name = "callbackType")
             Integer callbackType,
-            @RpcParameter(name = "reportDelaySeconds")
-            Integer reportDelaySeconds,
+            @RpcParameter(name = "reportDelayMillis")
+            Integer reportDelayMillis,
             @RpcParameter(name = "scanMode")
             Integer scanMode,
             @RpcParameter(name = "scanResultType")
@@ -381,7 +381,7 @@
         mScanSettingsBuilder.setCallbackType(callbackType);
         mScanSettingsBuilder.setScanMode(scanMode);
         mScanSettingsBuilder.setScanResultType(scanResultType);
-        mScanSettingsBuilder.setReportDelaySeconds(reportDelaySeconds);
+        mScanSettingsBuilder.setReportDelayMillis(reportDelayMillis);
     }
 
     /**
@@ -408,16 +408,16 @@
      * Get ScanSetting's report delay Seconds
      *
      * @param index the ScanSetting object to use
-     * @return the ScanSetting's report delay in seconds
+     * @return the ScanSetting's report delay in milliseconds
      * @throws Exception
      */
-    @Rpc(description = "Get ScanSetting's report delay seconds")
+    @Rpc(description = "Get ScanSetting's report delay milliseconds")
     public Long getScanSettingsReportDelaySeconds(
             @RpcParameter(name = "index")
             Integer index) throws Exception {
         if (mScanSettingsList.get(index) != null) {
             ScanSettings mScanSettings = mScanSettingsList.get(index);
-            return mScanSettings.getReportDelaySeconds();
+            return mScanSettings.getReportDelayMillis();
         } else {
             throw new Exception("Invalid index input:" + Integer.toString(index));
         }
@@ -590,57 +590,6 @@
     }
 
     /**
-     * Get ScanFilter's max rssi
-     *
-     * @param index the ScanFilter object to use
-     * @return the ScanFilter's max rssi
-     * @throws Exception
-     */
-    @Rpc(description = "Get ScanSetting's scan result type")
-    public Integer getScanFilterMaxRssi(
-            @RpcParameter(name = "index")
-            Integer index,
-            @RpcParameter(name = "filterIndex")
-            Integer filterIndex)
-            throws Exception {
-        if (mScanFilterList.get(index) != null) {
-            if (mScanFilterList.get(index).get(filterIndex) != null) {
-                return mScanFilterList.get(index)
-                        .get(filterIndex).getMaxRssi();
-            } else {
-                throw new Exception("Invalid filterIndex input:" + Integer.toString(filterIndex));
-            }
-        } else {
-            throw new Exception("Invalid index input:" + Integer.toString(index));
-        }
-    }
-
-    /**
-     * Get ScanFilter's min rssi
-     *
-     * @param index the ScanFilter object to use
-     * @return the ScanFilter's mix rssi
-     * @throws Exception
-     */
-    @Rpc(description = "Get ScanFilter's min rssi")
-    public Integer getScanFilterMinRssi(
-            @RpcParameter(name = "index")
-            Integer index,
-            @RpcParameter(name = "filterIndex")
-            Integer filterIndex)
-            throws Exception {
-        if (mScanFilterList.get(index) != null) {
-            if (mScanFilterList.get(index).get(filterIndex) != null) {
-                return mScanFilterList.get(index).get(filterIndex).getMinRssi();
-            } else {
-                throw new Exception("Invalid filterIndex input:" + Integer.toString(filterIndex));
-            }
-        } else {
-            throw new Exception("Invalid index input:" + Integer.toString(index));
-        }
-    }
-
-    /**
      * Get ScanFilter's service data
      *
      * @param index the ScanFilter object to use
@@ -795,23 +744,6 @@
     }
 
     /**
-     * Add filter "minRssi and maxRssi" to existing ScanFilter
-     *
-     * @param minRssi the min rssi to filter against
-     * @param maxRssi the max rssi to filter against
-     * @throws Exception
-     */
-    @Rpc(description = "Add filter \"minRssi and maxRssi\" to existing ScanFilter")
-    public void setScanFilterRssiRange(
-            @RpcParameter(name = "minRssi")
-            Integer minRssi,
-            @RpcParameter(name = "maxRssi")
-            Integer maxRssi
-            ) {
-            mScanFilterBuilder.setRssiRange(minRssi, maxRssi);
-    }
-
-    /**
      * Add filter "serviceData and serviceDataMask" to existing ScanFilter
      *
      * @param serviceData the service data to filter against
@@ -828,10 +760,13 @@
             ) {
         if (serviceDataMask != null) {
             mScanFilterBuilder
-                    .setServiceData(ConvertUtils.convertStringToByteArray(serviceData),
+                    .setServiceData(
+                            new ParcelUuid(UUID.randomUUID()),
+                            ConvertUtils.convertStringToByteArray(serviceData),
                             ConvertUtils.convertStringToByteArray(serviceDataMask));
         } else {
-            mScanFilterBuilder.setServiceData(ConvertUtils.convertStringToByteArray(serviceData));
+            mScanFilterBuilder.setServiceData(new ParcelUuid(UUID.randomUUID()),
+                    ConvertUtils.convertStringToByteArray(serviceData));
         }
     }
 
diff --git a/Common/src/com/googlecode/android_scripting/jsonrpc/JsonBuilder.java b/Common/src/com/googlecode/android_scripting/jsonrpc/JsonBuilder.java
index ebc6feb..7f469b5 100644
--- a/Common/src/com/googlecode/android_scripting/jsonrpc/JsonBuilder.java
+++ b/Common/src/com/googlecode/android_scripting/jsonrpc/JsonBuilder.java
@@ -308,7 +308,7 @@
         result.put("rssi", scanResult.getRssi());
         result.put("timestampSeconds", scanResult.getTimestampNanos());
         result.put("scanRecord", build(ConvertUtils.convertByteArrayToString(
-                scanResult.getScanRecord())));
+                scanResult.getScanRecord().getBytes())));
         result.put("deviceInfo", build(scanResult.getDevice()));
         return result;
     }