release-request-276f9f52-87fd-4915-bd79-9a2f0ee77433-for-git_oc-release-4090213 snap-temp-L31600000073091223

Change-Id: I535802fe191bfc28453485fa2b7ee062c84c3388
diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothFacade.java
index 9c0353e..c2c2cfc 100644
--- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothFacade.java
@@ -371,6 +371,57 @@
         return mBluetoothAdapter.isHardwareTrackingFiltersAvailable();
     }
 
+    /**
+     * Return true if LE 2M PHY feature is supported.
+     *
+     * @return true if chipset supports LE 2M PHY feature
+     */
+    @Rpc(description = "Return true if LE 2M PHY feature is supported")
+    public boolean bluetoothIsLe2MPhySupported() {
+        return mBluetoothAdapter.isLe2MPhySupported();
+    }
+
+    /**
+     * Return true if LE Coded PHY feature is supported.
+     *
+     * @return true if chipset supports LE Coded PHY feature
+     */
+    @Rpc(description = "Return true if LE Coded PHY feature is supported")
+    public boolean bluetoothIsLeCodedPhySupported() {
+        return mBluetoothAdapter.isLeCodedPhySupported();
+    }
+
+    /**
+     * Return true if LE Extended Advertising feature is supported.
+     *
+     * @return true if chipset supports LE Extended Advertising feature
+     */
+    @Rpc(description = "Return true if LE Extended Advertising is supported")
+    public boolean bluetoothIsLeExtendedAdvertisingSupported() {
+        return mBluetoothAdapter.isLeExtendedAdvertisingSupported();
+    }
+
+    /**
+     * Return true if LE Periodic Advertising feature is supported.
+     *
+     * @return true if chipset supports LE Periodic Advertising feature
+     */
+    @Rpc(description = "Return true if LE Periodic Advertising is supported")
+    public boolean bluetoothIsLePeriodicAdvertisingSupported() {
+        return mBluetoothAdapter.isLePeriodicAdvertisingSupported();
+    }
+
+    /**
+     * Return the maximum LE advertising data length,
+     * if LE Extended Advertising feature is supported.
+     *
+     * @return the maximum LE advertising data length.
+     */
+    @Rpc(description = "Return the maximum LE advertising data length")
+    public int bluetoothGetLeMaximumAdvertisingDataLength() {
+        return mBluetoothAdapter.getLeMaximumAdvertisingDataLength();
+    }
+
     @Rpc(description = "Gets the current state of LE.")
     public int bluetoothGetLeState() {
         return mBluetoothAdapter.getLeState();
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 6bb767c..ba92ab9 100644
--- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothLeScanFacade.java
@@ -16,19 +16,13 @@
 
 package com.googlecode.android_scripting.facade.bluetooth;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-
 import android.app.Service;
 import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothAdapter.LeScanCallback;
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.le.BluetoothLeScanner;
 import android.bluetooth.le.ScanCallback;
 import android.bluetooth.le.ScanFilter;
-import android.bluetooth.BluetoothAdapter.LeScanCallback;
 import android.bluetooth.le.ScanFilter.Builder;
 import android.bluetooth.le.ScanResult;
 import android.bluetooth.le.ScanSettings;
@@ -44,6 +38,12 @@
 import com.googlecode.android_scripting.rpc.RpcOptional;
 import com.googlecode.android_scripting.rpc.RpcParameter;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+
 /**
  * BluetoothLe Scan functions.
  */
@@ -348,6 +348,28 @@
     }
 
     /**
+     * Set the scan setting's legacy mode
+     * @param legacy Wether scan is legacy.
+     */
+    @Rpc(description = "Set the scan setting's legacy mode")
+    public void bleSetScanSettingsLegacy(
+            @RpcParameter(name = "legacy")
+            Boolean legacy) {
+        mScanSettingsBuilder.setLegacy(legacy);
+    }
+
+    /**
+     * Set the scan setting's phy mode
+     * @param phy
+     */
+    @Rpc(description = "Set the scan setting's phy mode")
+    public void bleSetScanSettingsPhy(
+            @RpcParameter(name = "phy")
+            Integer phy) {
+        mScanSettingsBuilder.setPhy(phy);
+    }
+
+    /**
      * Set the scan setting's scan result type
      * @param scanResultType Bluetooth LE scan result type
      */