Merge "Bluetooth: Make HciPacketizer reusable"
diff --git a/bluetooth/1.0/default/bluetooth_hci.cc b/bluetooth/1.0/default/bluetooth_hci.cc
index 6cea623..1d6e600 100644
--- a/bluetooth/1.0/default/bluetooth_hci.cc
+++ b/bluetooth/1.0/default/bluetooth_hci.cc
@@ -30,9 +30,13 @@
 static const uint8_t HCI_DATA_TYPE_ACL = 2;
 static const uint8_t HCI_DATA_TYPE_SCO = 3;
 
+BluetoothHci::BluetoothHci()
+    : deathRecipient(new BluetoothDeathRecipient(this)) {}
+
 Return<void> BluetoothHci::initialize(
     const ::android::sp<IBluetoothHciCallbacks>& cb) {
   ALOGW("BluetoothHci::initialize()");
+  cb->linkToDeath(deathRecipient, 0);
   event_cb_ = cb;
 
   bool rc = VendorInterface::Initialize(
@@ -62,6 +66,7 @@
 
 Return<void> BluetoothHci::close() {
   ALOGW("BluetoothHci::close()");
+  event_cb_->unlinkToDeath(deathRecipient);
   VendorInterface::Shutdown();
   return Void();
 }
diff --git a/bluetooth/1.0/default/bluetooth_hci.h b/bluetooth/1.0/default/bluetooth_hci.h
index da1b411..67d6c37 100644
--- a/bluetooth/1.0/default/bluetooth_hci.h
+++ b/bluetooth/1.0/default/bluetooth_hci.h
@@ -30,8 +30,20 @@
 using ::android::hardware::Return;
 using ::android::hardware::hidl_vec;
 
+struct BluetoothDeathRecipient : hidl_death_recipient {
+  BluetoothDeathRecipient(const sp<IBluetoothHci> hci) : mHci(hci) {}
+
+  virtual void serviceDied(
+      uint64_t /*cookie*/,
+      const wp<::android::hidl::base::V1_0::IBase>& /*who*/) {
+    mHci->close();
+  }
+  sp<IBluetoothHci> mHci;
+};
+
 class BluetoothHci : public IBluetoothHci {
  public:
+  BluetoothHci();
   Return<void> initialize(
       const ::android::sp<IBluetoothHciCallbacks>& cb) override;
   Return<void> sendHciCommand(const hidl_vec<uint8_t>& packet) override;
@@ -42,6 +54,7 @@
  private:
   void sendDataToController(const uint8_t type, const hidl_vec<uint8_t>& data);
   ::android::sp<IBluetoothHciCallbacks> event_cb_;
+  ::android::sp<BluetoothDeathRecipient> deathRecipient;
 };
 
 extern "C" IBluetoothHci* HIDL_FETCH_IBluetoothHci(const char* name);
diff --git a/nfc/1.0/default/Nfc.cpp b/nfc/1.0/default/Nfc.cpp
index 3bd5e41..c610406 100644
--- a/nfc/1.0/default/Nfc.cpp
+++ b/nfc/1.0/default/Nfc.cpp
@@ -14,12 +14,14 @@
 
 sp<INfcClientCallback> Nfc::mCallback = NULL;
 
-Nfc::Nfc(nfc_nci_device_t* device) : mDevice(device) {
+Nfc::Nfc(nfc_nci_device_t* device) : mDevice(device),
+    mDeathRecipient(new NfcDeathRecipient(this)) {
 }
 
 // Methods from ::android::hardware::nfc::V1_0::INfc follow.
 ::android::hardware::Return<NfcStatus> Nfc::open(const sp<INfcClientCallback>& clientCallback)  {
     mCallback = clientCallback;
+    mCallback->linkToDeath(mDeathRecipient, 0 /*cookie*/);
     int ret = mDevice->open(mDevice, eventCallback, dataCallback);
     return ret == 0 ? NfcStatus::OK : NfcStatus::FAILED;
 }
@@ -39,6 +41,7 @@
 }
 
 ::android::hardware::Return<NfcStatus> Nfc::close()  {
+    mCallback->unlinkToDeath(mDeathRecipient);
     return mDevice->close(mDevice) ? NfcStatus::FAILED : NfcStatus::OK;
 }
 
diff --git a/nfc/1.0/default/Nfc.h b/nfc/1.0/default/Nfc.h
index 13004a5..d8787fd 100644
--- a/nfc/1.0/default/Nfc.h
+++ b/nfc/1.0/default/Nfc.h
@@ -19,6 +19,16 @@
 using ::android::hardware::hidl_string;
 using ::android::sp;
 
+struct NfcDeathRecipient : hidl_death_recipient {
+    NfcDeathRecipient(const sp<INfc> nfc) : mNfc(nfc) {
+    }
+
+    virtual void serviceDied(uint64_t /*cookie*/, const wp<::android::hidl::base::V1_0::IBase>& /*who*/) {
+        mNfc->close();
+    }
+    sp<INfc> mNfc;
+};
+
 struct Nfc : public INfc {
   Nfc(nfc_nci_device_t* device);
   ::android::hardware::Return<NfcStatus> open(const sp<INfcClientCallback>& clientCallback)  override;
@@ -31,21 +41,28 @@
 
   static void eventCallback(uint8_t event, uint8_t status) {
       if (mCallback != nullptr) {
-          mCallback->sendEvent(
+          auto ret = mCallback->sendEvent(
                   (::android::hardware::nfc::V1_0::NfcEvent) event,
                   (::android::hardware::nfc::V1_0::NfcStatus) status);
+          if (!ret.isOk()) {
+              ALOGW("Failed to call back into NFC process.");
+          }
       }
   }
   static void dataCallback(uint16_t data_len, uint8_t* p_data) {
       hidl_vec<uint8_t> data;
       data.setToExternal(p_data, data_len);
       if (mCallback != nullptr) {
-          mCallback->sendData(data);
+          auto ret = mCallback->sendData(data);
+          if (!ret.isOk()) {
+              ALOGW("Failed to call back into NFC process.");
+          }
       }
   }
   private:
     static sp<INfcClientCallback> mCallback;
     const nfc_nci_device_t*       mDevice;
+    sp<NfcDeathRecipient>         mDeathRecipient;
 };
 
 extern "C" INfc* HIDL_FETCH_INfc(const char* name);
diff --git a/radio/1.0/IRadio.hal b/radio/1.0/IRadio.hal
index bda7d65..baa4df6 100644
--- a/radio/1.0/IRadio.hal
+++ b/radio/1.0/IRadio.hal
@@ -726,26 +726,6 @@
     oneway getDataCallList(int32_t serial);
 
     /*
-     * This request is reserved for OEM-specific uses. It passes raw byte arrays back and forth.
-     *
-     * @param serial Serial number of request.
-     * @param data data passed as raw bytes to oem
-     *
-     * Response function is IRadioResponse.sendOemRadioRequestRawResponse()
-     */
-    oneway sendOemRadioRequestRaw(int32_t serial, vec<uint8_t> data);
-
-    /*
-     * This request is reserved for OEM-specific uses. It passes strings back and forth.
-     *
-     * @param serial Serial number of request.
-     * @param data data passed as strings to oem
-     *
-     * Response function is IRadioResponse.sendOemRadioRequestStringsResponse()
-     */
-    oneway sendOemRadioRequestStrings(int32_t serial, vec<string> data);
-
-    /*
      * Indicates the current state of the screen. When the screen is off, the
      * Radio must notify the baseband to suppress certain notifications (eg,
      * signal strength and changes in LAC/CID or BID/SID/NID/latitude/longitude)
diff --git a/radio/1.0/IRadioIndication.hal b/radio/1.0/IRadioIndication.hal
index 81ac13a..0b95821 100644
--- a/radio/1.0/IRadioIndication.hal
+++ b/radio/1.0/IRadioIndication.hal
@@ -293,14 +293,6 @@
    oneway cdmaInfoRec(RadioIndicationType type, CdmaInformationRecords records);
 
    /*
-    * This is for OEM specific use.
-    *
-    * @param type Type of radio indication
-    * @param data data passed as raw bytes
-    */
-   oneway oemHookRaw(RadioIndicationType type, vec<uint8_t> data);
-
-   /*
     * Indicates that nework doesn't have in-band information, need to
     * play out-band tone.
     *
diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal
index 637f697..11a1d03 100644
--- a/radio/1.0/IRadioResponse.hal
+++ b/radio/1.0/IRadioResponse.hal
@@ -923,30 +923,6 @@
 
     /*
      * @param info Response info struct containing response type, serial no. and error
-     * @param data data returned by oem
-     *
-     * Valid errors returned:
-     *   RadioError:NONE
-     *   RadioError:RADIO_NOT_AVAILABLE
-     *   RadioError:INVALID_ARGUMENTS
-     *   RadioError:OEM_ERROR_X
-     */
-    oneway sendOemRilRequestRawResponse(RadioResponseInfo info, vec<uint8_t> data);
-
-    /*
-     * @param info Response info struct containing response type, serial no. and error
-     * @param data data returned by oem
-     *
-     * Valid errors returned:
-     *   RadioError:NONE
-     *   RadioError:RADIO_NOT_AVAILABLE
-     *   RadioError:INVALID_ARGUMENTS
-     *   RadioError:OEM_ERROR_X
-     */
-    oneway sendOemRilRequestStringsResponse(RadioResponseInfo info, vec<string> data);
-
-    /*
-     * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
      *   RadioError:NONE
diff --git a/radio/Android.bp b/radio/Android.bp
index 33f70eb..8bda000 100644
--- a/radio/Android.bp
+++ b/radio/Android.bp
@@ -2,4 +2,5 @@
 subdirs = [
     "1.0",
     "1.0/vts/functional",
+    "deprecated/1.0",
 ]
diff --git a/radio/deprecated/1.0/Android.bp b/radio/deprecated/1.0/Android.bp
new file mode 100644
index 0000000..f8a9c64
--- /dev/null
+++ b/radio/deprecated/1.0/Android.bp
@@ -0,0 +1,75 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.radio.deprecated@1.0_hal",
+    srcs: [
+        "IOemHook.hal",
+        "IOemHookIndication.hal",
+        "IOemHookResponse.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio.deprecated@1.0_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio.deprecated@1.0",
+    srcs: [
+        ":android.hardware.radio.deprecated@1.0_hal",
+    ],
+    out: [
+        "android/hardware/radio/deprecated/1.0/OemHookAll.cpp",
+        "android/hardware/radio/deprecated/1.0/OemHookIndicationAll.cpp",
+        "android/hardware/radio/deprecated/1.0/OemHookResponseAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio.deprecated@1.0_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio.deprecated@1.0",
+    srcs: [
+        ":android.hardware.radio.deprecated@1.0_hal",
+    ],
+    out: [
+        "android/hardware/radio/deprecated/1.0/IOemHook.h",
+        "android/hardware/radio/deprecated/1.0/IHwOemHook.h",
+        "android/hardware/radio/deprecated/1.0/BnHwOemHook.h",
+        "android/hardware/radio/deprecated/1.0/BpHwOemHook.h",
+        "android/hardware/radio/deprecated/1.0/BsOemHook.h",
+        "android/hardware/radio/deprecated/1.0/IOemHookIndication.h",
+        "android/hardware/radio/deprecated/1.0/IHwOemHookIndication.h",
+        "android/hardware/radio/deprecated/1.0/BnHwOemHookIndication.h",
+        "android/hardware/radio/deprecated/1.0/BpHwOemHookIndication.h",
+        "android/hardware/radio/deprecated/1.0/BsOemHookIndication.h",
+        "android/hardware/radio/deprecated/1.0/IOemHookResponse.h",
+        "android/hardware/radio/deprecated/1.0/IHwOemHookResponse.h",
+        "android/hardware/radio/deprecated/1.0/BnHwOemHookResponse.h",
+        "android/hardware/radio/deprecated/1.0/BpHwOemHookResponse.h",
+        "android/hardware/radio/deprecated/1.0/BsOemHookResponse.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.radio.deprecated@1.0",
+    generated_sources: ["android.hardware.radio.deprecated@1.0_genc++"],
+    generated_headers: ["android.hardware.radio.deprecated@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio.deprecated@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hardware.radio@1.0",
+        "android.hidl.base@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hardware.radio@1.0",
+        "android.hidl.base@1.0",
+    ],
+}
diff --git a/radio/deprecated/1.0/Android.mk b/radio/deprecated/1.0/Android.mk
new file mode 100644
index 0000000..4cce633
--- /dev/null
+++ b/radio/deprecated/1.0/Android.mk
@@ -0,0 +1,162 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.radio.deprecated@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_JAVA_LIBRARIES := \
+    android.hardware.radio@1.0-java \
+    android.hidl.base@1.0-java \
+
+
+#
+# Build IOemHook.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHook.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHook.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHook
+
+$(GEN): $(LOCAL_PATH)/IOemHook.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IOemHookIndication.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHookIndication.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHookIndication
+
+$(GEN): $(LOCAL_PATH)/IOemHookIndication.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IOemHookResponse.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHookResponse.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHookResponse
+
+$(GEN): $(LOCAL_PATH)/IOemHookResponse.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.radio.deprecated@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    android.hardware.radio@1.0-java-static \
+    android.hidl.base@1.0-java-static \
+
+
+#
+# Build IOemHook.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHook.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHook.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHook
+
+$(GEN): $(LOCAL_PATH)/IOemHook.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IOemHookIndication.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHookIndication.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHookIndication
+
+$(GEN): $(LOCAL_PATH)/IOemHookIndication.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IOemHookResponse.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHookResponse.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHookResponse
+
+$(GEN): $(LOCAL_PATH)/IOemHookResponse.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/radio/deprecated/1.0/IOemHook.hal b/radio/deprecated/1.0/IOemHook.hal
new file mode 100644
index 0000000..2b6db65
--- /dev/null
+++ b/radio/deprecated/1.0/IOemHook.hal
@@ -0,0 +1,57 @@
+/**
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.deprecated@1.0;
+
+import IOemHookResponse;
+import IOemHookIndication;
+
+/**
+ * This interface has APIs for OEM-specific use-cases.
+ * USE OF THIS INTERFACE IS DISCOURATED. IT IS PRESENT ONLY FOR BACKWARD COMPATIBILITY AND WILL BE
+ * REMOVED IN O (ATTEMPTING TO REMOVE IT IN O, BUT IF NOT IN O WILL BE REMOVED IN P).
+ * ALSO NOTE THAT FRAMEWORK EXPECTS THE SERVICE IMPLEMENTING THIS INTERFACE TO RESIDE
+ * IN THE SAME PROCESS AS IRADIO SERVICE.
+ */
+interface IOemHook {
+    /**
+     * Set response functions for oem hook requests & oem hook indications.
+     *
+     * @param oemHookResponse Object containing response functions
+     * @param oemHookIndication Object containing oem hook indications
+     */
+    setResponseFunctions(IOemHookResponse oemHookResponse, IOemHookIndication oemHookIndication);
+
+    /**
+     * This request passes raw byte arrays between framework and vendor code.
+     *
+     * @param serial Serial number of request.
+     * @param data data passed as raw bytes
+     *
+     * Response function is IOemHookResponse.sendRequestRawResponse()
+     */
+    oneway sendRequestRaw(int32_t serial, vec<uint8_t> data);
+
+    /**
+     * This request passes strings between framework and vendor code.
+     *
+     * @param serial Serial number of request.
+     * @param data data passed as strings
+     *
+     * Response function is IOemHookResponse.sendRequestStringsResponse()
+     */
+    oneway sendRequestStrings(int32_t serial, vec<string> data);
+};
\ No newline at end of file
diff --git a/radio/deprecated/1.0/IOemHookIndication.hal b/radio/deprecated/1.0/IOemHookIndication.hal
new file mode 100644
index 0000000..936779f
--- /dev/null
+++ b/radio/deprecated/1.0/IOemHookIndication.hal
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.deprecated@1.0;
+
+import android.hardware.radio@1.0::types;
+
+/*
+ * Interface declaring unsolicited oem hook indications.
+ */
+interface IOemHookIndication {
+   /*
+    * This is for OEM specific use.
+    *
+    * @param type Type of radio indication
+    * @param data data passed as raw bytes
+    */
+   oneway oemHookRaw(RadioIndicationType type, vec<uint8_t> data);
+};
\ No newline at end of file
diff --git a/radio/deprecated/1.0/IOemHookResponse.hal b/radio/deprecated/1.0/IOemHookResponse.hal
new file mode 100644
index 0000000..4e49acc
--- /dev/null
+++ b/radio/deprecated/1.0/IOemHookResponse.hal
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.deprecated@1.0;
+
+import android.hardware.radio@1.0::types;
+
+/*
+ * Interface declaring response functions to solicited oem hook requests.
+ * Response functions defined in this interface are as per following convention:
+ * <xyz>Response is response to IOemHook.<xyz>
+ */
+interface IOemHookResponse {
+    /*
+     * @param info Response info struct containing response type, serial no. and error
+     * @param data data returned by oem
+     *
+     * Valid errors returned:
+     *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:OEM_ERROR_X
+     */
+    oneway sendRequestRawResponse(RadioResponseInfo info, vec<uint8_t> data);
+
+    /*
+     * @param info Response info struct containing response type, serial no. and error
+     * @param data data returned by oem
+     *
+     * Valid errors returned:
+     *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:OEM_ERROR_X
+     */
+    oneway sendRequestStringsResponse(RadioResponseInfo info, vec<string> data);
+};
\ No newline at end of file
diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk
index 4476b14..fa6ef6c 100644
--- a/wifi/1.0/Android.mk
+++ b/wifi/1.0/Android.mk
@@ -796,25 +796,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (StaBackgroundScanBand)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/StaBackgroundScanBand.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.StaBackgroundScanBand
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (StaBackgroundScanBucketEventReportSchemeMask)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/StaBackgroundScanBucketEventReportSchemeMask.java
@@ -1081,6 +1062,25 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build types.hal (WifiBand)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/WifiBand.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.wifi@1.0::types.WifiBand
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build types.hal (WifiChannelInfo)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/WifiChannelInfo.java
@@ -2599,25 +2599,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (StaBackgroundScanBand)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/StaBackgroundScanBand.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.StaBackgroundScanBand
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (StaBackgroundScanBucketEventReportSchemeMask)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/StaBackgroundScanBucketEventReportSchemeMask.java
@@ -2884,6 +2865,25 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build types.hal (WifiBand)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/WifiBand.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.wifi@1.0::types.WifiBand
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build types.hal (WifiChannelInfo)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/WifiChannelInfo.java
diff --git a/wifi/1.0/IWifiApIface.hal b/wifi/1.0/IWifiApIface.hal
index aeca2cd..1f6ee7c 100644
--- a/wifi/1.0/IWifiApIface.hal
+++ b/wifi/1.0/IWifiApIface.hal
@@ -33,4 +33,21 @@
    *         |WifiStatusCode.FAILURE_IFACE_INVALID|
    */
   setCountryCode(int8_t[2] code) generates (WifiStatus status);
+
+  /**
+   * Used to query the list of valid frequencies (depending on country code set)
+   * for the provided band.
+   *
+   * @param band Band for which the frequency list is being generated.
+   * @return status WifiStatus of the operation.
+   *         Possible status codes:
+   *         |WifiStatusCode.SUCCESS|,
+   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
+   *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
+   *         |WifiStatusCode.ERROR_UNKNOWN|
+   * @return frequencies vector of valid frequencies for the provided band.
+   */
+  getValidFrequenciesForBand(WifiBand band)
+      generates (WifiStatus status, vec<WifiChannelInMhz> frequencies);
 };
diff --git a/wifi/1.0/IWifiStaIface.hal b/wifi/1.0/IWifiStaIface.hal
index 96dc54a..43c3126 100644
--- a/wifi/1.0/IWifiStaIface.hal
+++ b/wifi/1.0/IWifiStaIface.hal
@@ -180,7 +180,6 @@
    * for the provided band. These channels may be specifed in the
    * |BackgroundScanBucketParameters.frequenciesInMhz| for a background scan
    * request.
-   * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
    *
    * @param band Band for which the frequency list is being generated.
    * @return status WifiStatus of the operation.
@@ -192,7 +191,7 @@
    *         |WifiStatusCode.ERROR_UNKNOWN|
    * @return frequencies vector of valid frequencies for the provided band.
    */
-  getValidFrequenciesForBackgroundScan(StaBackgroundScanBand band)
+  getValidFrequenciesForBand(WifiBand band)
       generates (WifiStatus status, vec<WifiChannelInMhz> frequencies);
 
   /**
diff --git a/wifi/1.0/default/hidl_callback_util.h b/wifi/1.0/default/hidl_callback_util.h
index a1c6819..7136279 100644
--- a/wifi/1.0/default/hidl_callback_util.h
+++ b/wifi/1.0/default/hidl_callback_util.h
@@ -82,14 +82,12 @@
     return true;
   }
 
-  const std::set<android::sp<CallbackType>> getCallbacks() {
-    return cb_set_;
-  }
+  const std::set<android::sp<CallbackType>> getCallbacks() { return cb_set_; }
 
   // Death notification for callbacks.
   void onObjectDeath(uint64_t cookie) {
-    CallbackType *cb = reinterpret_cast<CallbackType*>(cookie);
-    const auto& iter =  cb_set_.find(cb);
+    CallbackType* cb = reinterpret_cast<CallbackType*>(cookie);
+    const auto& iter = cb_set_.find(cb);
     if (iter == cb_set_.end()) {
       LOG(ERROR) << "Unknown callback death notification received";
       return;
diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.0/default/hidl_struct_util.cpp
index 7dbc8eb..c7b8c41 100644
--- a/wifi/1.0/default/hidl_struct_util.cpp
+++ b/wifi/1.0/default/hidl_struct_util.cpp
@@ -306,21 +306,21 @@
   return true;
 }
 
-legacy_hal::wifi_band convertHidlGscanBandToLegacy(StaBackgroundScanBand band) {
+legacy_hal::wifi_band convertHidlWifiBandToLegacy(WifiBand band) {
   switch (band) {
-    case StaBackgroundScanBand::BAND_UNSPECIFIED:
+    case WifiBand::BAND_UNSPECIFIED:
       return legacy_hal::WIFI_BAND_UNSPECIFIED;
-    case StaBackgroundScanBand::BAND_24GHZ:
+    case WifiBand::BAND_24GHZ:
       return legacy_hal::WIFI_BAND_BG;
-    case StaBackgroundScanBand::BAND_5GHZ:
+    case WifiBand::BAND_5GHZ:
       return legacy_hal::WIFI_BAND_A;
-    case StaBackgroundScanBand::BAND_5GHZ_DFS:
+    case WifiBand::BAND_5GHZ_DFS:
       return legacy_hal::WIFI_BAND_A_DFS;
-    case StaBackgroundScanBand::BAND_5GHZ_WITH_DFS:
+    case WifiBand::BAND_5GHZ_WITH_DFS:
       return legacy_hal::WIFI_BAND_A_WITH_DFS;
-    case StaBackgroundScanBand::BAND_24GHZ_5GHZ:
+    case WifiBand::BAND_24GHZ_5GHZ:
       return legacy_hal::WIFI_BAND_ABG;
-    case StaBackgroundScanBand::BAND_24GHZ_5GHZ_WITH_DFS:
+    case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS:
       return legacy_hal::WIFI_BAND_ABG_WITH_DFS;
   };
   CHECK(false);
diff --git a/wifi/1.0/default/hidl_struct_util.h b/wifi/1.0/default/hidl_struct_util.h
index 490dcae..41e97b3 100644
--- a/wifi/1.0/default/hidl_struct_util.h
+++ b/wifi/1.0/default/hidl_struct_util.h
@@ -60,7 +60,7 @@
 bool convertLegacyGscanCapabilitiesToHidl(
     const legacy_hal::wifi_gscan_capabilities& legacy_caps,
     StaBackgroundScanCapabilities* hidl_caps);
-legacy_hal::wifi_band convertHidlGscanBandToLegacy(StaBackgroundScanBand band);
+legacy_hal::wifi_band convertHidlWifiBandToLegacy(WifiBand band);
 bool convertHidlGscanParamsToLegacy(
     const StaBackgroundScanParameters& hidl_scan_params,
     legacy_hal::wifi_scan_cmd_params* legacy_scan_params);
diff --git a/wifi/1.0/default/wifi_ap_iface.cpp b/wifi/1.0/default/wifi_ap_iface.cpp
index 1a8b31d..e2beec2 100644
--- a/wifi/1.0/default/wifi_ap_iface.cpp
+++ b/wifi/1.0/default/wifi_ap_iface.cpp
@@ -17,6 +17,7 @@
 #include <android-base/logging.h>
 
 #include "hidl_return_util.h"
+#include "hidl_struct_util.h"
 #include "wifi_ap_iface.h"
 #include "wifi_status_util.h"
 
@@ -64,6 +65,15 @@
                          code);
 }
 
+Return<void> WifiApIface::getValidFrequenciesForBand(
+    WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiApIface::getValidFrequenciesForBandInternal,
+                         hidl_status_cb,
+                         band);
+}
+
 std::pair<WifiStatus, std::string> WifiApIface::getNameInternal() {
   return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
 }
@@ -79,6 +89,16 @@
   return createWifiStatusFromLegacyError(legacy_status);
 }
 
+std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
+WifiApIface::getValidFrequenciesForBandInternal(WifiBand band) {
+  static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t), "Size mismatch");
+  legacy_hal::wifi_error legacy_status;
+  std::vector<uint32_t> valid_frequencies;
+  std::tie(legacy_status, valid_frequencies) =
+      legacy_hal_.lock()->getValidFrequenciesForBand(
+          hidl_struct_util::convertHidlWifiBandToLegacy(band));
+  return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies};
+}
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace wifi
diff --git a/wifi/1.0/default/wifi_ap_iface.h b/wifi/1.0/default/wifi_ap_iface.h
index 23d6435..efc168a 100644
--- a/wifi/1.0/default/wifi_ap_iface.h
+++ b/wifi/1.0/default/wifi_ap_iface.h
@@ -44,12 +44,16 @@
   Return<void> getType(getType_cb hidl_status_cb) override;
   Return<void> setCountryCode(const hidl_array<int8_t, 2>& code,
                               setCountryCode_cb hidl_status_cb) override;
+  Return<void> getValidFrequenciesForBand(
+      WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) override;
 
  private:
   // Corresponding worker functions for the HIDL methods.
   std::pair<WifiStatus, std::string> getNameInternal();
   std::pair<WifiStatus, IfaceType> getTypeInternal();
   WifiStatus setCountryCodeInternal(const std::array<int8_t, 2>& code);
+  std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
+  getValidFrequenciesForBandInternal(WifiBand band);
 
   std::string ifname_;
   std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index 7d58254..7390b65 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -562,7 +562,7 @@
 }
 
 std::pair<wifi_error, std::vector<uint32_t>>
-WifiLegacyHal::getValidFrequenciesForGscan(wifi_band band) {
+WifiLegacyHal::getValidFrequenciesForBand(wifi_band band) {
   static_assert(sizeof(uint32_t) >= sizeof(wifi_channel),
                 "Wifi Channel cannot be represented in output");
   std::vector<uint32_t> freqs;
diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.0/default/wifi_legacy_hal.h
index ed020b0..c8fd5bd 100644
--- a/wifi/1.0/default/wifi_legacy_hal.h
+++ b/wifi/1.0/default/wifi_legacy_hal.h
@@ -175,7 +175,7 @@
       const on_gscan_results_callback& on_results_callback,
       const on_gscan_full_result_callback& on_full_result_callback);
   wifi_error stopGscan(wifi_request_id id);
-  std::pair<wifi_error, std::vector<uint32_t>> getValidFrequenciesForGscan(
+  std::pair<wifi_error, std::vector<uint32_t>> getValidFrequenciesForBand(
       wifi_band band);
   // Link layer stats functions.
   wifi_error enableLinkLayerStats(bool debug);
diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.0/default/wifi_sta_iface.cpp
index 55c9cf7..0c84102 100644
--- a/wifi/1.0/default/wifi_sta_iface.cpp
+++ b/wifi/1.0/default/wifi_sta_iface.cpp
@@ -106,15 +106,13 @@
                          hidl_status_cb);
 }
 
-Return<void> WifiStaIface::getValidFrequenciesForBackgroundScan(
-    StaBackgroundScanBand band,
-    getValidFrequenciesForBackgroundScan_cb hidl_status_cb) {
-  return validateAndCall(
-      this,
-      WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-      &WifiStaIface::getValidFrequenciesForBackgroundScanInternal,
-      hidl_status_cb,
-      band);
+Return<void> WifiStaIface::getValidFrequenciesForBand(
+    WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiStaIface::getValidFrequenciesForBandInternal,
+                         hidl_status_cb,
+                         band);
 }
 
 Return<void> WifiStaIface::startBackgroundScan(
@@ -363,14 +361,13 @@
 }
 
 std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
-WifiStaIface::getValidFrequenciesForBackgroundScanInternal(
-    StaBackgroundScanBand band) {
+WifiStaIface::getValidFrequenciesForBandInternal(WifiBand band) {
   static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t), "Size mismatch");
   legacy_hal::wifi_error legacy_status;
   std::vector<uint32_t> valid_frequencies;
   std::tie(legacy_status, valid_frequencies) =
-      legacy_hal_.lock()->getValidFrequenciesForGscan(
-          hidl_struct_util::convertHidlGscanBandToLegacy(band));
+      legacy_hal_.lock()->getValidFrequenciesForBand(
+          hidl_struct_util::convertHidlWifiBandToLegacy(band));
   return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies};
 }
 
diff --git a/wifi/1.0/default/wifi_sta_iface.h b/wifi/1.0/default/wifi_sta_iface.h
index 5f0ffe9..08faa2f 100644
--- a/wifi/1.0/default/wifi_sta_iface.h
+++ b/wifi/1.0/default/wifi_sta_iface.h
@@ -57,9 +57,8 @@
       installApfPacketFilter_cb hidl_status_cb) override;
   Return<void> getBackgroundScanCapabilities(
       getBackgroundScanCapabilities_cb hidl_status_cb) override;
-  Return<void> getValidFrequenciesForBackgroundScan(
-      StaBackgroundScanBand band,
-      getValidFrequenciesForBackgroundScan_cb hidl_status_cb) override;
+  Return<void> getValidFrequenciesForBand(
+      WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) override;
   Return<void> startBackgroundScan(
       uint32_t cmd_id,
       const StaBackgroundScanParameters& params,
@@ -119,7 +118,7 @@
   std::pair<WifiStatus, StaBackgroundScanCapabilities>
   getBackgroundScanCapabilitiesInternal();
   std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
-  getValidFrequenciesForBackgroundScanInternal(StaBackgroundScanBand band);
+  getValidFrequenciesForBandInternal(WifiBand band);
   WifiStatus startBackgroundScanInternal(
       uint32_t cmd_id, const StaBackgroundScanParameters& params);
   WifiStatus stopBackgroundScanInternal(uint32_t cmd_id);
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 30e8943..a843ce8 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -210,6 +210,37 @@
 };
 
 /**
+ * Wifi bands defined in 80211 spec.
+ */
+enum WifiBand : uint32_t {
+  BAND_UNSPECIFIED = 0,
+  /**
+   * 2.4 GHz.
+   */
+  BAND_24GHZ = 1,
+  /**
+   * 5 GHz without DFS.
+   */
+  BAND_5GHZ = 2,
+  /**
+   * 5 GHz DFS only.
+   */
+  BAND_5GHZ_DFS = 4,
+  /**
+   * 5 GHz with DFS.
+   */
+  BAND_5GHZ_WITH_DFS = 6,
+  /**
+   * 2.4 GHz + 5 GHz; no DFS.
+   */
+  BAND_24GHZ_5GHZ = 3,
+  /**
+   * 2.4 GHz + 5 GHz with DFS
+   */
+  BAND_24GHZ_5GHZ_WITH_DFS = 7
+};
+
+/**
  * STA specific types.
  * TODO(b/32159498): Move to a separate sta_types.hal.
  */
@@ -251,37 +282,6 @@
 };
 
 /**
- * Bands that can be specified in Background scan requests.
- */
-enum StaBackgroundScanBand : uint32_t {
-  BAND_UNSPECIFIED = 0,
-  /**
-   * 2.4 GHz.
-   */
-  BAND_24GHZ = 1,
-  /**
-   * 5 GHz without DFS.
-   */
-  BAND_5GHZ = 2,
-  /**
-   * 5 GHz DFS only.
-   */
-  BAND_5GHZ_DFS = 4,
-  /**
-   * 5 GHz with DFS.
-   */
-  BAND_5GHZ_WITH_DFS = 6,
-  /**
-   * 2.4 GHz + 5 GHz; no DFS.
-   */
-  BAND_24GHZ_5GHZ = 3,
-  /**
-   * 2.4 GHz + 5 GHz with DFS
-   */
-  BAND_24GHZ_5GHZ_WITH_DFS = 7
-};
-
-/**
  * Mask of event reporting schemes that can be specified in background scan
  * requests.
  */
@@ -311,12 +311,13 @@
  */
 struct StaBackgroundScanBucketParameters {
   /**
-   * Bands to scan or 0 if frequencies list must be used instead.
+   * Bands to scan or |BAND_UNSPECIFIED| if frequencies list must be used
+   * instead.
    */
-  StaBackgroundScanBand band;
+  WifiBand band;
   /**
    * Channel frequencies (in Mhz) to scan if |band| is set to
-   * |UNSPECIFIED|.
+   * |BAND_UNSPECIFIED|.
    */
   vec<WifiChannelInMhz> frequencies;
   /**
@@ -1009,22 +1010,12 @@
   bool securityEnabledInNdp;
   /**
    * Specifies whether or not there is a ranging requirement in this discovery session.
-   * Ranging is only performed if all other match criteria with the peer are met.
+   * Ranging is only performed if all other match criteria with the peer are met. Ranging must
+   * be performed if both peers in the discovery session (publisher and subscriber) set this
+   * flag to true. Otherwise, if either peer sets this flag to false, ranging must not be performed
+   * and must not impact discovery decisions.
    * Note: specifying that ranging is required also implies that this device must automatically
    * accept ranging requests from peers.
-   *   Solicited Publisher + Passive Subscriber:
-   *     Publisher/Subscriber:
-   *     true/true: ranging performed.
-   *     true/false: subscriber doesn't require ranging (match if all other criteria met). I.e.
-   *                 publisher requiring range doesn't gate subscriber matching.
-   *     false/true: subscriber tries ranging but publisher refuses (no match).
-   *     false/false: ranging isn't attempted and doesn't impact match.
-   *   Unsolicited Publisher + Active Subscriber:
-   *     Publisher/Subscriber:
-   *     true/true: ranging performed.
-   *     true/false: publisher attempts ranging but subscriber doesn't allow - no match.
-   *     false/true: publisher doesn't attempt ranging, should not impact match.
-   *     false/false: ranging isn't attempted and doesn't impact match.
    * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Ranging Require.
    */
   bool rangingRequired;
diff --git a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
index b16fb39..37e8d3f 100644
--- a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
@@ -434,9 +434,11 @@
   setEapClientCert(string path) generates (SupplicantStatus status);
 
   /**
-   * Set EAP private key file path for this network.
+   * Set EAP private key Id for this network.
+   * This is used if private key operations for EAP-TLS are performed
+   * using a smartcard.
    *
-   * @param path value to set.
+   * @param id value to set.
    * @return status Status of the operation.
    *         Possible status codes:
    *         |SupplicantStatusCode.SUCCESS|,
@@ -444,7 +446,7 @@
    *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
    *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
    */
-  setEapPrivateKey(string path) generates (SupplicantStatus status);
+  setEapPrivateKeyId(string id) generates (SupplicantStatus status);
 
   /**
    * Set EAP subject match for this network.
@@ -810,16 +812,16 @@
   getEapClientCert() generates (SupplicantStatus status, string path);
 
   /**
-   * Get EAP private key file path set for this network.
+   * Get EAP private key Id set for this network.
    *
    * @return status Status of the operation.
    *         Possible status codes:
    *         |SupplicantStatusCode.SUCCESS|,
    *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
    *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
-   * @return path value set.
+   * @return id value set.
    */
-  getEapPrivateKey() generates (SupplicantStatus status, string path);
+  getEapPrivateKeyId() generates (SupplicantStatus status, string id);
 
   /**
    * Get EAP subject match set for this network.