Merge "fix a memory leak."
diff --git a/include/hardware/ble_advertiser.h b/include/hardware/ble_advertiser.h
index f486ed8..a474ce1 100644
--- a/include/hardware/ble_advertiser.h
+++ b/include/hardware/ble_advertiser.h
@@ -23,43 +23,47 @@
 #include "bt_common_types.h"
 #include "bt_gatt_types.h"
 
-using std::vector;
-
-/** Callback invoked when multi-adv operation has completed */
-using BleAdvertiserCb = base::Callback<void(uint8_t /* status */)>;
+struct AdvertiseParameters {
+  uint16_t min_interval;
+  uint16_t max_interval;
+  uint8_t adv_type;
+  uint8_t channel_map;
+  uint8_t tx_power;
+};
 
 class BleAdvertiserInterface {
  public:
   virtual ~BleAdvertiserInterface() = default;
 
+  /** Callback invoked when multi-adv operation has completed */
+  using Callback = base::Callback<void(uint8_t /* status */)>;
+
   /** Registers an advertiser with the stack */
   virtual void RegisterAdvertiser(
-      base::Callback<void(uint8_t /* advertiser_id */, uint8_t /* status */)>) = 0;
-
-  /*  This function disable a Multi-ADV instance */
-  virtual void Unregister(uint8_t advertiser_id) = 0;
-
-  /** Set the advertising data or scan response data */
-  virtual void SetData(bool set_scan_rsp, vector<uint8_t> data) = 0;
-
-  /** Start or stop advertising */
-  virtual void Enable(bool start, BleAdvertiserCb cb) = 0;
+      base::Callback<void(uint8_t /* advertiser_id */,
+                          uint8_t /* status */)>) = 0;
 
   /* Set the parameters as per spec, user manual specified values */
-  virtual void MultiAdvSetParameters(int advertiser_id, int min_interval,
-                                     int max_interval, int adv_type,
-                                     int chnl_map, int tx_power,
-                                     BleAdvertiserCb cb) = 0;
+  virtual void SetParameters(int advertiser_id, int min_interval,
+                             int max_interval, int adv_type, int chnl_map,
+                             int tx_power, Callback cb) = 0;
 
-  /* Setup the data for the specified instance */
-  virtual void MultiAdvSetInstData(int advertiser_id, bool set_scan_rsp,
-                                   vector<uint8_t> data,
-                                   BleAdvertiserCb cb) = 0;
+  /* Setup the data */
+  virtual void SetData(int advertiser_id, bool set_scan_rsp,
+                       std::vector<uint8_t> data, Callback cb) = 0;
 
-  /* Enable the advertising instance as per spec */
-  virtual void MultiAdvEnable(uint8_t advertiser_id, bool enable,
-                              BleAdvertiserCb cb, int timeout_s,
-                              BleAdvertiserCb timeout_cb) = 0;
+  /* Enable the advertising instance */
+  virtual void Enable(uint8_t advertiser_id, bool enable, Callback cb,
+                      int timeout_s, Callback timeout_cb) = 0;
+
+  /*  Unregisters an advertiser */
+  virtual void Unregister(uint8_t advertiser_id) = 0;
+
+  virtual void StartAdvertising(uint8_t advertiser_id, Callback cb,
+                                AdvertiseParameters params,
+                                std::vector<uint8_t> advertise_data,
+                                std::vector<uint8_t> scan_response_data,
+                                int timeout_s, Callback timeout_cb) = 0;
 };
 
 #endif /* ANDROID_INCLUDE_BLE_ADVERTISER_H */
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index 1fe2596..125a95b 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -267,6 +267,7 @@
 /** Bluetooth Out Of Band data for bonding */
 typedef struct
 {
+   uint8_t le_bt_dev_addr[7]; /* LE Bluetooth Device Address */
    uint8_t c192[16]; /* Simple Pairing Hash C-192 */
    uint8_t r192[16]; /* Simple Pairing Randomizer R-192 */
    uint8_t c256[16]; /* Simple Pairing Hash C-256 */
diff --git a/include/hardware/hw_auth_token.h b/include/hardware/hw_auth_token.h
index f471d1a..d84ea48 100644
--- a/include/hardware/hw_auth_token.h
+++ b/include/hardware/hw_auth_token.h
@@ -23,7 +23,7 @@
 extern "C" {
 #endif  // __cplusplus
 
-const uint8_t HW_AUTH_TOKEN_VERSION = 0;
+static const uint8_t HW_AUTH_TOKEN_VERSION = 0;
 
 typedef enum {
     HW_AUTH_NONE = 0,
diff --git a/modules/thermal/thermal.c b/modules/thermal/thermal.c
index 6ba5845..7f4de3b 100644
--- a/modules/thermal/thermal.c
+++ b/modules/thermal/thermal.c
@@ -138,8 +138,9 @@
             fclose(file);
             fclose(cpu_file);
             return errno ? -errno : -EIO;
+        } else {
+            fclose(cpu_file);
         }
-        fclose(cpu_file);
 
         if (list != NULL) {
             list[size] = (cpu_usage_t) {