Snap for 8055317 from 20004ffbf0624e71292c8db99b4199063eac48b4 to sc-v2-release

Change-Id: I97815ca1ae40f192dedb6eb7e6283ebbc8b499f2
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 06f2216..7c1bff0 100644
--- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
@@ -516,6 +516,57 @@
     }
 
     /**
+     * Get ScanFilter's device address type
+     *
+     * @param index the ScanFilter object to use
+     * @return the ScanFilter's device address type
+     * @throws Exception
+     */
+    @Rpc(description = "Get ScanFilter's device address type")
+    public Integer bleGetScanFilterAddressType(
+            @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).getAddressType();
+            } else {
+                throw new Exception("Invalid filterIndex input:" + filterIndex);
+            }
+        } else {
+            throw new Exception("Invalid index input:" + index);
+        }
+    }
+
+    /**
+     * Get ScanFilter's irk
+     *
+     * @param index the ScanFilter object to use
+     * @return the ScanFilter's irk
+     * @throws Exception
+     */
+    @Rpc(description = "Get ScanFilter's irk")
+    public byte[] bleGetScanFilterIrk(
+            @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).getIrk();
+            } else {
+                throw new Exception("Invalid filterIndex input:" + filterIndex);
+            }
+        } else {
+            throw new Exception("Invalid index input:" + index);
+        }
+    }
+
+    /**
      * Get ScanFilter's device name
      *
      * @param index the ScanFilter object to use
@@ -739,6 +790,39 @@
     }
 
     /**
+     * Add filter "macAddress", and "addressType" to existing ScanFilter
+     *
+     * @param macAddress the macAddress to filter against
+     * @param addressType the type of macAddress to filter against
+     * @throws Exception
+     */
+    @Rpc(description = "Add filter \"macAddress\" and \"addressType\" to existing ScanFilter")
+    public void bleSetScanFilterDeviceAddressAndType(
+            @RpcParameter(name = "macAddress") String macAddress,
+            @RpcParameter(name = "addressType") Integer addressType
+    ) {
+        mScanFilterBuilder.setDeviceAddress(macAddress, addressType);
+    }
+
+    /**
+     * Add filter "macAddress", "addressType", and "irk" to existing ScanFilter
+     *
+     * @param macAddress the macAddress to filter against
+     * @param addressType the type of macAddress to filter against
+     * @param irk IRK for address resolution
+     * @throws Exception
+     */
+    @Rpc(description =
+            "Add filter \"macAddress\", \"addressType\", and \"irk\" to existing ScanFilter")
+    public void bleSetScanFilterDeviceAddressTypeAndIrk(
+            @RpcParameter(name = "macAddress") String macAddress,
+            @RpcParameter(name = "addressType") Integer addressType,
+            @RpcParameter(name = "irk") byte[] irk
+    ) {
+        mScanFilterBuilder.setDeviceAddress(macAddress, addressType, irk);
+    }
+
+    /**
      * Add filter "manufacturereDataId and/or manufacturerData" to existing
      * ScanFilter
      * @param manufacturerDataId the manufacturer data id to filter against