Merge changes from topic 'rs_hidl_impl'

* changes:
  Fix mips-related build breakage.
  RenderScript HIDL HAL definition and server-side implementation.
diff --git a/bluetooth/1.0/vts/functional/Android.bp b/bluetooth/1.0/vts/functional/Android.bp
index 086ac99..2012c20 100644
--- a/bluetooth/1.0/vts/functional/Android.bp
+++ b/bluetooth/1.0/vts/functional/Android.bp
@@ -15,9 +15,9 @@
 //
 
 cc_test {
-    name: "bluetooth_hidl_hal_test",
+    name: "VtsHalBluetoothV1_0TargetTest",
     gtest: true,
-    srcs: ["bluetooth_hidl_hal_test.cpp"],
+    srcs: ["VtsHalBluetoothV1_0TargetTest.cpp"],
     shared_libs: [
         "libbase",
         "liblog",
diff --git a/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
similarity index 100%
rename from bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp
rename to bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
diff --git a/ir/1.0/vts/functional/Android.bp b/ir/1.0/vts/functional/Android.bp
index 1acd2a0..5689474 100644
--- a/ir/1.0/vts/functional/Android.bp
+++ b/ir/1.0/vts/functional/Android.bp
@@ -15,9 +15,9 @@
 //
 
 cc_test {
-    name: "ir_hidl_hal_test",
+    name: "VtsHalIrV1_0TargetTest",
     gtest: true,
-    srcs: ["ir_hidl_hal_test.cpp"],
+    srcs: ["VtsHalIrV1_0TargetTest.cpp"],
     shared_libs: [
         "libbase",
         "liblog",
diff --git a/ir/1.0/vts/functional/ir_hidl_hal_test.cpp b/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
similarity index 100%
rename from ir/1.0/vts/functional/ir_hidl_hal_test.cpp
rename to ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
diff --git a/nfc/1.0/vts/functional/Android.bp b/nfc/1.0/vts/functional/Android.bp
index 0f9eb3d..080887f 100644
--- a/nfc/1.0/vts/functional/Android.bp
+++ b/nfc/1.0/vts/functional/Android.bp
@@ -15,9 +15,9 @@
 //
 
 cc_test {
-    name: "nfc_hidl_hal_test",
+    name: "VtsHalNfcV1_0TargetTest",
     gtest: true,
-    srcs: ["nfc_hidl_hal_test.cpp"],
+    srcs: ["VtsHalNfcV1_0TargetTest.cpp"],
     shared_libs: [
         "libbase",
         "liblog",
diff --git a/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
similarity index 100%
rename from nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
rename to nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
diff --git a/radio/1.0/IRadio.hal b/radio/1.0/IRadio.hal
index 04d93db..bda7d65 100644
--- a/radio/1.0/IRadio.hal
+++ b/radio/1.0/IRadio.hal
@@ -1572,6 +1572,20 @@
     oneway setIndicationFilter(int32_t serial, bitfield<IndicationFilter> indicationFilter);
 
     /*
+     * Set SIM card power state.
+     * Request is equivalent to inserting or removing the card.
+     *
+     * The radio modem must generate IRadioIndication.simStatusChanged() as if the SIM had been
+     * inserted or removed.
+     *
+     * @param serial Serial number of request
+     * @param powerUp True if powering up the sim card
+     *
+     * Response callback is IRadioResponse.setSimCardPowerResponse()
+     */
+    oneway setSimCardPower(int32_t serial, bool powerUp);
+
+    /*
      * When response type received from a radio indication or radio response is
      * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively,
      * acknowledge the receipt of those messages by sending responseAcknowledgement().
diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal
index dafd264..637f697 100644
--- a/radio/1.0/IRadioResponse.hal
+++ b/radio/1.0/IRadioResponse.hal
@@ -1968,6 +1968,18 @@
     oneway setIndicationFilterResponse(RadioResponseInfo info);
 
     /*
+     * @param info Response info struct containing response type, serial no. and error
+     *
+     * Valid errors returned:
+     *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:SIM_ABSENT
+     *   RadioError:INVALID_ARGUMENTS
+     */
+    oneway setSimCardPowerResponse(RadioResponseInfo info);
+
+    /*
      * Acknowledge the receipt of radio request sent to the vendor. This must be sent only for
      * radio request which take long time to respond.
      * For more details, refer https://source.android.com/devices/tech/connect/ril.html
diff --git a/radio/1.0/vts/Radio.vts b/radio/1.0/vts/Radio.vts
index 74bdb8d..68cf620 100644
--- a/radio/1.0/vts/Radio.vts
+++ b/radio/1.0/vts/Radio.vts
@@ -1503,6 +1503,18 @@
     }
 
     api: {
+        name: "setSimCardPower"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
         name: "responseAcknowledgement"
     }
 
diff --git a/radio/1.0/vts/RadioResponse.vts b/radio/1.0/vts/RadioResponse.vts
index 99c953c..915a053 100644
--- a/radio/1.0/vts/RadioResponse.vts
+++ b/radio/1.0/vts/RadioResponse.vts
@@ -1389,6 +1389,14 @@
     }
 
     api: {
+        name: "setSimCardPowerResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
         name: "acknowledgeRequest"
         arg: {
             type: TYPE_SCALAR
diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp
new file mode 100644
index 0000000..6615f03
--- /dev/null
+++ b/radio/1.0/vts/functional/Android.bp
@@ -0,0 +1,40 @@
+//
+// 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.
+//
+
+cc_test {
+    name: "VtsHalRadioV1_0TargetTest",
+    gtest: true,
+    srcs: ["radio_hidl_hal_test.cpp",
+           "radio_response.cpp",
+           "radio_hidl_hal_icc.cpp",
+           "VtsHalRadioV1_0TargetTest.cpp"],
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libcutils",
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libnativehelper",
+        "libutils",
+        "android.hardware.radio@1.0",
+    ],
+    static_libs: ["libgtest"],
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
\ No newline at end of file
diff --git a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
new file mode 100644
index 0000000..d01adf2
--- /dev/null
+++ b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+#include<radio_hidl_hal_utils.h>
+
+int main(int argc, char** argv) {
+    ::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment);
+    ::testing::InitGoogleTest(&argc, argv);
+
+    int status = RUN_ALL_TESTS();
+    LOG(INFO) << "Test result = " << status;
+
+    return status;
+}
\ No newline at end of file
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
new file mode 100644
index 0000000..9b540e8
--- /dev/null
+++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+
+ #include<radio_hidl_hal_utils.h>
+
+/*
+ * Test IRadio.getIccCardStatus() for the response returned.
+ */
+TEST_F(RadioHidlTest, getIccCardStatus) {
+    radio->getIccCardStatus(1);
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+    EXPECT_EQ(1, radioRsp->rspInfo.serial);
+    EXPECT_EQ(radioRsp->rspInfo.error, RadioError::NONE);
+
+    EXPECT_LE(radioRsp->cardStatus.applications.size(), (unsigned int) RadioConst::CARD_MAX_APPS);
+    EXPECT_LT(radioRsp->cardStatus.gsmUmtsSubscriptionAppIndex, (int) RadioConst::CARD_MAX_APPS);
+    EXPECT_LT(radioRsp->cardStatus.cdmaSubscriptionAppIndex, (int) RadioConst::CARD_MAX_APPS);
+    EXPECT_LT(radioRsp->cardStatus.imsSubscriptionAppIndex, (int) RadioConst::CARD_MAX_APPS);
+}
+
+/*
+ * Test IRadio.supplyIccPinForApp() for the response returned.
+ */
+TEST_F(RadioHidlTest, supplyIccPinForApp) {
+    radio->supplyIccPinForApp(2, hidl_string("test1"), hidl_string());
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+    EXPECT_EQ(2, radioRsp->rspInfo.serial);
+
+    EXPECT_EQ(radioRsp->rspInfo.error, RadioError::PASSWORD_INCORRECT);
+}
+
+/*
+ * Test IRadio.supplyIccPukForApp() for the response returned.
+ */
+TEST_F(RadioHidlTest, supplyIccPukForApp) {
+    radio->supplyIccPukForApp(3, hidl_string("test1"), hidl_string("test2"), hidl_string());
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+    EXPECT_EQ(3, radioRsp->rspInfo.serial);
+
+    EXPECT_EQ(radioRsp->rspInfo.error, RadioError::PASSWORD_INCORRECT);
+}
+
+/*
+ * Test IRadio.supplyIccPin2ForApp() for the response returned.
+ */
+TEST_F(RadioHidlTest, supplyIccPin2ForApp) {
+    radio->supplyIccPin2ForApp(4, hidl_string("test1"), hidl_string());
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+    EXPECT_EQ(4, radioRsp->rspInfo.serial);
+
+    EXPECT_EQ(radioRsp->rspInfo.error, RadioError::PASSWORD_INCORRECT);
+}
+
+/*
+ * Test IRadio.supplyIccPuk2ForApp() for the response returned.
+ */
+TEST_F(RadioHidlTest, supplyIccPuk2ForApp) {
+    radio->supplyIccPuk2ForApp(5, hidl_string("test1"), hidl_string("test2"), hidl_string());
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+    EXPECT_EQ(5, radioRsp->rspInfo.serial);
+
+    EXPECT_EQ(radioRsp->rspInfo.error, RadioError::PASSWORD_INCORRECT);
+}
+
+/*
+ * Test IRadio.changeIccPinForApp() for the response returned.
+ */
+TEST_F(RadioHidlTest, changeIccPinForApp) {
+    radio->changeIccPinForApp(6, hidl_string("test1"), hidl_string("test2"), hidl_string());
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+    EXPECT_EQ(6, radioRsp->rspInfo.serial);
+
+    EXPECT_EQ(radioRsp->rspInfo.error, RadioError::PASSWORD_INCORRECT);
+}
+
+/*
+ * Test IRadio.changeIccPin2ForApp() for the response returned.
+ */
+TEST_F(RadioHidlTest, changeIccPin2ForApp) {
+    radio->changeIccPin2ForApp(7, hidl_string("test1"), hidl_string("test2"), hidl_string());
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+    EXPECT_EQ(7, radioRsp->rspInfo.serial);
+
+    EXPECT_EQ(radioRsp->rspInfo.error, RadioError::PASSWORD_INCORRECT);
+}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
new file mode 100644
index 0000000..2a67954
--- /dev/null
+++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+#include<radio_hidl_hal_utils.h>
+
+void RadioHidlTest::SetUp() {
+    radio = IRadio::getService(hidl_string("rild"));
+    ASSERT_NE(radio, nullptr);
+
+    radioRsp = new RadioResponse(*this);
+    ASSERT_NE(radioRsp, nullptr);
+
+    count = 0;
+
+    radioInd = NULL;
+    radio->setResponseFunctions(radioRsp, radioInd);
+}
+
+void RadioHidlTest::TearDown() {
+}
+
+void RadioHidlTest::notify() {
+    std::unique_lock<std::mutex> lock(mtx);
+    count++;
+    cv.notify_one();
+}
+
+std::cv_status RadioHidlTest::wait() {
+    std::unique_lock<std::mutex> lock(mtx);
+
+    std::cv_status status = std::cv_status::no_timeout;
+    auto now = std::chrono::system_clock::now();
+    while (count == 0) {
+        status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
+        if (status == std::cv_status::timeout) {
+            return status;
+        }
+    }
+    count--;
+    return status;
+}
+
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils.h b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
new file mode 100644
index 0000000..23b6ffa
--- /dev/null
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
@@ -0,0 +1,453 @@
+/*
+ * 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.
+ */
+
+#include <android-base/logging.h>
+
+#include <gtest/gtest.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
+#include <android/hardware/radio/1.0/IRadio.h>
+#include <android/hardware/radio/1.0/IRadioResponse.h>
+#include <android/hardware/radio/1.0/IRadioIndication.h>
+#include <android/hardware/radio/1.0/types.h>
+
+using ::android::hardware::radio::V1_0::ActivityStatsInfo;
+using ::android::hardware::radio::V1_0::CardStatus;
+using ::android::hardware::radio::V1_0::Call;
+using ::android::hardware::radio::V1_0::CallForwardInfo;
+using ::android::hardware::radio::V1_0::CarrierRestrictions;
+using ::android::hardware::radio::V1_0::CdmaRoamingType;
+using ::android::hardware::radio::V1_0::CdmaBroadcastSmsConfigInfo;
+using ::android::hardware::radio::V1_0::CdmaSubscriptionSource;
+using ::android::hardware::radio::V1_0::CellInfo;
+using ::android::hardware::radio::V1_0::ClipStatus;
+using ::android::hardware::radio::V1_0::DataRegStateResult;
+using ::android::hardware::radio::V1_0::GsmBroadcastSmsConfigInfo;
+using ::android::hardware::radio::V1_0::HardwareConfig;
+using ::android::hardware::radio::V1_0::IccIoResult;
+using ::android::hardware::radio::V1_0::IRadio;
+using ::android::hardware::radio::V1_0::IRadioResponse;
+using ::android::hardware::radio::V1_0::IRadioIndication;
+using ::android::hardware::radio::V1_0::RadioConst;
+using ::android::hardware::radio::V1_0::RadioError;
+using ::android::hardware::radio::V1_0::RadioResponseInfo;
+using ::android::hardware::radio::V1_0::LastCallFailCauseInfo;
+using ::android::hardware::radio::V1_0::LceDataInfo;
+using ::android::hardware::radio::V1_0::LceStatusInfo;
+using ::android::hardware::radio::V1_0::NeighboringCell;
+using ::android::hardware::radio::V1_0::OperatorInfo;
+using ::android::hardware::radio::V1_0::PreferredNetworkType;
+using ::android::hardware::radio::V1_0::RadioBandMode;
+using ::android::hardware::radio::V1_0::RadioCapability;
+using ::android::hardware::radio::V1_0::RadioResponseType;
+using ::android::hardware::radio::V1_0::RadioTechnology;
+using ::android::hardware::radio::V1_0::RadioTechnologyFamily;
+using ::android::hardware::radio::V1_0::SendSmsResult;
+using ::android::hardware::radio::V1_0::SetupDataCallResult;
+using ::android::hardware::radio::V1_0::SignalStrength;
+using ::android::hardware::radio::V1_0::TtyMode;
+using ::android::hardware::radio::V1_0::VoiceRegStateResult;
+
+using ::android::hardware::hidl_string;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+#define TIMEOUT_PERIOD 20
+
+class RadioHidlTest;
+
+/* Callback class for radio response */
+class RadioResponse : public IRadioResponse {
+private:
+    RadioHidlTest& parent;
+
+public:
+    RadioResponseInfo rspInfo;
+    CardStatus cardStatus;
+
+    RadioResponse(RadioHidlTest& parent);
+
+    virtual ~RadioResponse() = default;
+
+    Return<void> getIccCardStatusResponse(const RadioResponseInfo& info,
+            const CardStatus& cardStatus);
+
+    Return<void> supplyIccPinForAppResponse(const RadioResponseInfo& info,
+            int32_t remainingRetries);
+
+    Return<void> supplyIccPukForAppResponse(const RadioResponseInfo& info,
+            int32_t remainingRetries);
+
+    Return<void> supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
+            int32_t remainingRetries);
+
+    Return<void> supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
+            int32_t remainingRetries);
+
+    Return<void> changeIccPinForAppResponse(const RadioResponseInfo& info,
+            int32_t remainingRetries);
+
+    Return<void> changeIccPin2ForAppResponse(const RadioResponseInfo& info,
+            int32_t remainingRetries);
+
+    Return<void> supplyNetworkDepersonalizationResponse(
+            const RadioResponseInfo& info, int32_t remainingRetries);
+
+    Return<void> getCurrentCallsResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<Call>& calls);
+
+    Return<void> dialResponse(const RadioResponseInfo& info);
+
+    Return<void> getIMSIForAppResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_string& imsi);
+
+    Return<void> hangupConnectionResponse(const RadioResponseInfo& info);
+
+    Return<void> hangupWaitingOrBackgroundResponse(
+            const RadioResponseInfo& info);
+
+    Return<void> hangupForegroundResumeBackgroundResponse(
+            const RadioResponseInfo& info);
+
+    Return<void> switchWaitingOrHoldingAndActiveResponse(
+            const RadioResponseInfo& info);
+
+    Return<void> conferenceResponse(const RadioResponseInfo& info);
+
+    Return<void> rejectCallResponse(const RadioResponseInfo& info);
+
+    Return<void> getLastCallFailCauseResponse(const RadioResponseInfo& info,
+            const LastCallFailCauseInfo& failCauseInfo);
+
+    Return<void> getSignalStrengthResponse(const RadioResponseInfo& info,
+            const SignalStrength& sigStrength);
+
+    Return<void> getVoiceRegistrationStateResponse(const RadioResponseInfo& info,
+            const VoiceRegStateResult& voiceRegResponse);
+
+    Return<void> getDataRegistrationStateResponse(const RadioResponseInfo& info,
+            const DataRegStateResult& dataRegResponse);
+
+    Return<void> getOperatorResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_string& longName,
+            const ::android::hardware::hidl_string& shortName,
+            const ::android::hardware::hidl_string& numeric);
+
+    Return<void> setRadioPowerResponse(const RadioResponseInfo& info);
+
+    Return<void> sendDtmfResponse(const RadioResponseInfo& info);
+
+    Return<void> sendSmsResponse(const RadioResponseInfo& info,
+            const SendSmsResult& sms);
+
+    Return<void> sendSMSExpectMoreResponse(const RadioResponseInfo& info,
+            const SendSmsResult& sms);
+
+    Return<void> setupDataCallResponse(const RadioResponseInfo& info,
+            const SetupDataCallResult& dcResponse);
+
+    Return<void> iccIOForAppResponse(const RadioResponseInfo& info,
+            const IccIoResult& iccIo);
+
+    Return<void> sendUssdResponse(const RadioResponseInfo& info);
+
+    Return<void> cancelPendingUssdResponse(const RadioResponseInfo& info);
+
+    Return<void> getClirResponse(const RadioResponseInfo& info, int32_t n, int32_t m);
+
+    Return<void> setClirResponse(const RadioResponseInfo& info);
+
+    Return<void> getCallForwardStatusResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<CallForwardInfo>& call_forwardInfos);
+
+    Return<void> setCallForwardResponse(const RadioResponseInfo& info);
+
+    Return<void> getCallWaitingResponse(const RadioResponseInfo& info,
+            bool enable, int32_t serviceClass);
+
+    Return<void> setCallWaitingResponse(const RadioResponseInfo& info);
+
+    Return<void> acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info);
+
+    Return<void> acceptCallResponse(const RadioResponseInfo& info);
+
+    Return<void> deactivateDataCallResponse(const RadioResponseInfo& info);
+
+    Return<void> getFacilityLockForAppResponse(const RadioResponseInfo& info,int32_t response);
+
+    Return<void> setFacilityLockForAppResponse(const RadioResponseInfo& info,int32_t retry);
+
+    Return<void> setBarringPasswordResponse(const RadioResponseInfo& info);
+
+    Return<void> getNetworkSelectionModeResponse(const RadioResponseInfo& info,bool manual);
+
+    Return<void> setNetworkSelectionModeAutomaticResponse(const RadioResponseInfo& info);
+
+    Return<void> setNetworkSelectionModeManualResponse(const RadioResponseInfo& info);
+
+    Return<void> getAvailableNetworksResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos);
+
+    Return<void> startDtmfResponse(const RadioResponseInfo& info);
+
+    Return<void> stopDtmfResponse(const RadioResponseInfo& info);
+
+    Return<void> getBasebandVersionResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_string& version);
+
+    Return<void> separateConnectionResponse(const RadioResponseInfo& info);
+
+    Return<void> setMuteResponse(const RadioResponseInfo& info);
+
+    Return<void> getMuteResponse(const RadioResponseInfo& info, bool enable);
+
+    Return<void> getClipResponse(const RadioResponseInfo& info,ClipStatus status);
+
+    Return<void> getDataCallListResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<SetupDataCallResult>& dcResponse);
+
+    Return<void> sendOemRilRequestRawResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<uint8_t>& data);
+
+    Return<void> sendOemRilRequestStringsResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data);
+
+    Return<void> sendScreenStateResponse(const RadioResponseInfo& info);
+
+    Return<void> setSuppServiceNotificationsResponse(
+            const RadioResponseInfo& info);
+
+    Return<void> writeSmsToSimResponse(const RadioResponseInfo& info,int32_t index);
+
+    Return<void> deleteSmsOnSimResponse(const RadioResponseInfo& info);
+
+    Return<void> setBandModeResponse(const RadioResponseInfo& info);
+
+    Return<void> getAvailableBandModesResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<RadioBandMode>& bandModes);
+
+    Return<void> sendEnvelopeResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_string& commandResponse);
+
+    Return<void> sendTerminalResponseToSimResponse(const RadioResponseInfo& info);
+
+    Return<void> handleStkCallSetupRequestFromSimResponse(
+            const RadioResponseInfo& info);
+
+    Return<void> explicitCallTransferResponse(const RadioResponseInfo& info);
+
+    Return<void> setPreferredNetworkTypeResponse(const RadioResponseInfo& info);
+
+    Return<void> getPreferredNetworkTypeResponse(const RadioResponseInfo& info,
+            PreferredNetworkType nwType);
+
+    Return<void> getNeighboringCidsResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<NeighboringCell>& cells);
+
+    Return<void> setLocationUpdatesResponse(const RadioResponseInfo& info);
+
+    Return<void> setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info);
+
+    Return<void> setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info);
+
+    Return<void> getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
+            CdmaRoamingType type);
+
+    Return<void> setTTYModeResponse(const RadioResponseInfo& info);
+
+    Return<void> getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode);
+
+    Return<void> setPreferredVoicePrivacyResponse(const RadioResponseInfo& info);
+
+    Return<void> getPreferredVoicePrivacyResponse(const RadioResponseInfo& info, bool enable);
+
+    Return<void> sendCDMAFeatureCodeResponse(const RadioResponseInfo& info);
+
+    Return<void> sendBurstDtmfResponse(const RadioResponseInfo& info);
+
+    Return<void> sendCdmaSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+
+    Return<void> acknowledgeLastIncomingCdmaSmsResponse(const RadioResponseInfo& info);
+
+    Return<void> getGsmBroadcastConfigResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs);
+
+    Return<void> setGsmBroadcastConfigResponse(const RadioResponseInfo& info);
+
+    Return<void> setGsmBroadcastActivationResponse(const RadioResponseInfo& info);
+
+    Return<void> getCdmaBroadcastConfigResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs);
+
+    Return<void> setCdmaBroadcastConfigResponse(const RadioResponseInfo& info);
+
+    Return<void> setCdmaBroadcastActivationResponse(const RadioResponseInfo& info);
+
+    Return<void> getCDMASubscriptionResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_string& mdn,
+            const ::android::hardware::hidl_string& hSid,
+            const ::android::hardware::hidl_string& hNid,
+            const ::android::hardware::hidl_string& min,
+            const ::android::hardware::hidl_string& prl);
+
+    Return<void> writeSmsToRuimResponse(const RadioResponseInfo& info, uint32_t index);
+
+    Return<void> deleteSmsOnRuimResponse(const RadioResponseInfo& info);
+
+    Return<void> getDeviceIdentityResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_string& imei,
+            const ::android::hardware::hidl_string& imeisv,
+            const ::android::hardware::hidl_string& esn,
+            const ::android::hardware::hidl_string& meid);
+
+    Return<void> exitEmergencyCallbackModeResponse(const RadioResponseInfo& info);
+
+    Return<void> getSmscAddressResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_string& smsc);
+
+    Return<void> setSmscAddressResponse(const RadioResponseInfo& info);
+
+    Return<void> reportSmsMemoryStatusResponse(const RadioResponseInfo& info);
+
+    Return<void> reportStkServiceIsRunningResponse(const RadioResponseInfo& info);
+
+    Return<void> getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info,
+            CdmaSubscriptionSource source);
+
+    Return<void> requestIsimAuthenticationResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_string& response);
+
+    Return<void> acknowledgeIncomingGsmSmsWithPduResponse(
+            const RadioResponseInfo& info);
+
+    Return<void> sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
+            const IccIoResult& iccIo);
+
+    Return<void> getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
+            RadioTechnology rat);
+
+    Return<void> getCellInfoListResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<CellInfo>& cellInfo);
+
+    Return<void> setCellInfoListRateResponse(const RadioResponseInfo& info);
+
+    Return<void> setInitialAttachApnResponse(const RadioResponseInfo& info);
+
+    Return<void> getImsRegistrationStateResponse(const RadioResponseInfo& info,
+            bool isRegistered, RadioTechnologyFamily ratFamily);
+
+    Return<void> sendImsSmsResponse(const RadioResponseInfo& info,
+            const SendSmsResult& sms);
+
+    Return<void> iccTransmitApduBasicChannelResponse(
+            const RadioResponseInfo& info, const IccIoResult& result);
+
+    Return<void> iccOpenLogicalChannelResponse(const RadioResponseInfo& info,
+            int32_t channelId, const ::android::hardware::hidl_vec<int8_t>& selectResponse);
+
+    Return<void> iccCloseLogicalChannelResponse(const RadioResponseInfo& info);
+
+    Return<void> iccTransmitApduLogicalChannelResponse(
+            const RadioResponseInfo& info, const IccIoResult& result);
+
+    Return<void> nvReadItemResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_string& result);
+
+    Return<void> nvWriteItemResponse(const RadioResponseInfo& info);
+
+    Return<void> nvWriteCdmaPrlResponse(const RadioResponseInfo& info);
+
+    Return<void> nvResetConfigResponse(const RadioResponseInfo& info);
+
+    Return<void> setUiccSubscriptionResponse(const RadioResponseInfo& info);
+
+    Return<void> setDataAllowedResponse(const RadioResponseInfo& info);
+
+    Return<void> getHardwareConfigResponse(const RadioResponseInfo& info,
+            const ::android::hardware::hidl_vec<HardwareConfig>& config);
+
+    Return<void> requestIccSimAuthenticationResponse(
+            const RadioResponseInfo& info, const IccIoResult& result);
+
+    Return<void> setDataProfileResponse(const RadioResponseInfo& info);
+
+    Return<void> requestShutdownResponse(const RadioResponseInfo& info);
+
+    Return<void> getRadioCapabilityResponse(const RadioResponseInfo& info,
+            const RadioCapability& rc);
+
+    Return<void> setRadioCapabilityResponse(const RadioResponseInfo& info,
+            const RadioCapability& rc);
+
+    Return<void> startLceServiceResponse(const RadioResponseInfo& info,
+            const LceStatusInfo& statusInfo);
+
+    Return<void> stopLceServiceResponse(const RadioResponseInfo& info,
+            const LceStatusInfo& statusInfo);
+
+    Return<void> pullLceDataResponse(const RadioResponseInfo& info,
+            const LceDataInfo& lceInfo);
+
+    Return<void> getModemActivityInfoResponse(const RadioResponseInfo& info,
+            const ActivityStatsInfo& activityInfo);
+
+    Return<void> setAllowedCarriersResponse(const RadioResponseInfo& info,
+            int32_t numAllowed);
+
+    Return<void> getAllowedCarriersResponse(const RadioResponseInfo& info,
+            bool allAllowed, const CarrierRestrictions& carriers);
+
+    Return<void> sendDeviceStateResponse(const RadioResponseInfo& info);
+
+    Return<void> setIndicationFilterResponse(const RadioResponseInfo& info);
+
+    Return<void> setSimCardPowerResponse(const RadioResponseInfo& info);
+
+    Return<void> acknowledgeRequest(int32_t serial);
+};
+
+// The main test class for Radio HIDL.
+class RadioHidlTest : public ::testing::Test {
+private:
+    std::mutex mtx;
+    std::condition_variable cv;
+    int count;
+
+public:
+    virtual void SetUp() override;
+
+    virtual void TearDown() override;
+
+    /* Used as a mechanism to inform the test about data/event callback */
+    void notify();
+
+    /* Test code calls this function to wait for response */
+    std::cv_status wait();
+
+    sp<IRadio> radio;
+    sp<RadioResponse> radioRsp;
+    sp<IRadioIndication> radioInd;
+};
+
+// A class for test environment setup
+class RadioHidlEnvironment : public ::testing::Environment {
+public:
+    virtual void SetUp() {}
+    virtual void TearDown() {}
+};
diff --git a/radio/1.0/vts/functional/radio_response.cpp b/radio/1.0/vts/functional/radio_response.cpp
new file mode 100644
index 0000000..b2a74f4
--- /dev/null
+++ b/radio/1.0/vts/functional/radio_response.cpp
@@ -0,0 +1,665 @@
+/*
+ * 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.
+ */
+
+#include<radio_hidl_hal_utils.h>
+
+RadioResponse::RadioResponse(RadioHidlTest& parent) : parent(parent) {
+}
+
+Return<void> RadioResponse::getIccCardStatusResponse(
+        const RadioResponseInfo& info, const CardStatus& card_status) {
+    rspInfo = info;
+    cardStatus = card_status;
+    parent.notify();
+    return Void();
+}
+
+Return<void> RadioResponse::supplyIccPinForAppResponse(
+        const RadioResponseInfo& info, int32_t remainingRetries) {
+    rspInfo = info;
+    parent.notify();
+    return Void();
+}
+
+Return<void> RadioResponse::supplyIccPukForAppResponse(
+        const RadioResponseInfo& info, int32_t remainingRetries) {
+    rspInfo = info;
+    parent.notify();
+    return Void();
+}
+
+Return<void> RadioResponse::supplyIccPin2ForAppResponse(
+        const RadioResponseInfo& info, int32_t remainingRetries) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
+}
+
+Return<void> RadioResponse::supplyIccPuk2ForAppResponse(
+        const RadioResponseInfo& info, int32_t remainingRetries) {
+    rspInfo = info;
+    parent.notify();
+    return Void();
+}
+
+Return<void> RadioResponse::changeIccPinForAppResponse(
+        const RadioResponseInfo& info, int32_t remainingRetries) {
+    rspInfo = info;
+    parent.notify();
+    return Void();
+}
+
+Return<void> RadioResponse::changeIccPin2ForAppResponse(
+        const RadioResponseInfo& info, int32_t remaining_retries) {
+    rspInfo = info;
+    parent.notify();
+    return Void();
+}
+
+Return<void> RadioResponse::supplyNetworkDepersonalizationResponse(
+        const RadioResponseInfo& info, int32_t remainingRetries) {
+    return Void();
+}
+
+Return<void> RadioResponse::getCurrentCallsResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_vec<Call>& calls) {
+    return Void();
+}
+
+Return<void> RadioResponse::dialResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getIMSIForAppResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_string& imsi) {
+    return Void();
+}
+
+Return<void> RadioResponse::hangupConnectionResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::hangupWaitingOrBackgroundResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::hangupForegroundResumeBackgroundResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::switchWaitingOrHoldingAndActiveResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::conferenceResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::rejectCallResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getLastCallFailCauseResponse(
+        const RadioResponseInfo& info, const LastCallFailCauseInfo& failCauseInfo) {
+    return Void();
+}
+
+Return<void> RadioResponse::getSignalStrengthResponse(
+        const RadioResponseInfo& info, const SignalStrength& sig_strength) {
+    return Void();
+}
+
+Return<void> RadioResponse::getVoiceRegistrationStateResponse(
+        const RadioResponseInfo& info, const VoiceRegStateResult& voiceRegResponse) {
+    return Void();
+}
+
+Return<void> RadioResponse::getDataRegistrationStateResponse(
+        const RadioResponseInfo& info, const DataRegStateResult& dataRegResponse) {
+    return Void();
+}
+
+Return<void> RadioResponse::getOperatorResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_string& longName,
+        const ::android::hardware::hidl_string& shortName,
+        const ::android::hardware::hidl_string& numeric) {
+    return Void();
+}
+
+Return<void> RadioResponse::setRadioPowerResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendDtmfResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendSmsResponse(const RadioResponseInfo& info,
+        const SendSmsResult& sms) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendSMSExpectMoreResponse(
+        const RadioResponseInfo& info, const SendSmsResult& sms) {
+    return Void();
+}
+
+Return<void> RadioResponse::setupDataCallResponse(
+        const RadioResponseInfo& info, const SetupDataCallResult& dcResponse) {
+    return Void();
+}
+
+Return<void> RadioResponse::iccIOForAppResponse(
+        const RadioResponseInfo& info, const IccIoResult& iccIo) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendUssdResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::cancelPendingUssdResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getClirResponse(const RadioResponseInfo& info, int32_t n, int32_t m) {
+    return Void();
+}
+
+Return<void> RadioResponse::setClirResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getCallForwardStatusResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_vec<CallForwardInfo>&
+        callForwardInfos) {
+    return Void();
+}
+
+Return<void> RadioResponse::setCallForwardResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getCallWaitingResponse(
+        const RadioResponseInfo& info, bool enable, int32_t serviceClass) {
+    return Void();
+}
+
+Return<void> RadioResponse::setCallWaitingResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::acceptCallResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::deactivateDataCallResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getFacilityLockForAppResponse(const RadioResponseInfo& info,
+        int32_t response) {
+    return Void();
+}
+
+Return<void> RadioResponse::setFacilityLockForAppResponse(const RadioResponseInfo& info,
+        int32_t retry) {
+    return Void();
+}
+
+Return<void> RadioResponse::setBarringPasswordResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getNetworkSelectionModeResponse(
+        const RadioResponseInfo& info, bool manual) {
+    return Void();
+}
+
+Return<void> RadioResponse::setNetworkSelectionModeAutomaticResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setNetworkSelectionModeManualResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getAvailableNetworksResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos) {
+    return Void();
+}
+
+Return<void> RadioResponse::startDtmfResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::stopDtmfResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getBasebandVersionResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_string& version) {
+    return Void();
+}
+
+Return<void> RadioResponse::separateConnectionResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setMuteResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getMuteResponse(const RadioResponseInfo& info, bool enable) {
+    return Void();
+}
+
+Return<void> RadioResponse::getClipResponse(const RadioResponseInfo& info, ClipStatus status) {
+    return Void();
+}
+
+Return<void> RadioResponse::getDataCallListResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<SetupDataCallResult>& dcResponse) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendOemRilRequestRawResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<uint8_t>& data) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendOemRilRequestStringsResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendScreenStateResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setSuppServiceNotificationsResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::writeSmsToSimResponse(
+        const RadioResponseInfo& info, int32_t index) {
+    return Void();
+}
+
+Return<void> RadioResponse::deleteSmsOnSimResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setBandModeResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getAvailableBandModesResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<RadioBandMode>& bandModes) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendEnvelopeResponse(const RadioResponseInfo& info,
+        const ::android::hardware::hidl_string& commandResponse) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendTerminalResponseToSimResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::handleStkCallSetupRequestFromSimResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::explicitCallTransferResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setPreferredNetworkTypeResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getPreferredNetworkTypeResponse(
+        const RadioResponseInfo& info, PreferredNetworkType nw_type) {
+    return Void();
+}
+
+Return<void> RadioResponse::getNeighboringCidsResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<NeighboringCell>& cells) {
+    return Void();
+}
+
+Return<void> RadioResponse::setLocationUpdatesResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getCdmaRoamingPreferenceResponse(
+        const RadioResponseInfo& info, CdmaRoamingType type) {
+    return Void();
+}
+
+Return<void> RadioResponse::setTTYModeResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode) {
+    return Void();
+}
+
+Return<void> RadioResponse::setPreferredVoicePrivacyResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getPreferredVoicePrivacyResponse(
+        const RadioResponseInfo& info, bool enable) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendCDMAFeatureCodeResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendBurstDtmfResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendCdmaSmsResponse(
+        const RadioResponseInfo& info, const SendSmsResult& sms) {
+    return Void();
+}
+
+Return<void> RadioResponse::acknowledgeLastIncomingCdmaSmsResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getGsmBroadcastConfigResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs) {
+    return Void();
+}
+
+Return<void> RadioResponse::setGsmBroadcastConfigResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setGsmBroadcastActivationResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getCdmaBroadcastConfigResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs) {
+    return Void();
+}
+
+Return<void> RadioResponse::setCdmaBroadcastConfigResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setCdmaBroadcastActivationResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getCDMASubscriptionResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_string& mdn,
+        const ::android::hardware::hidl_string& hSid, const ::android::hardware::hidl_string& hNid,
+        const ::android::hardware::hidl_string& min,
+        const ::android::hardware::hidl_string& prl) {
+    return Void();
+}
+
+Return<void> RadioResponse::writeSmsToRuimResponse(
+        const RadioResponseInfo& info, uint32_t index) {
+    return Void();
+}
+
+Return<void> RadioResponse::deleteSmsOnRuimResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getDeviceIdentityResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_string& imei,
+        const ::android::hardware::hidl_string& imeisv, const ::android::hardware::hidl_string& esn,
+        const ::android::hardware::hidl_string& meid) {
+    return Void();
+}
+
+Return<void> RadioResponse::exitEmergencyCallbackModeResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getSmscAddressResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_string& smsc) {
+    return Void();
+}
+
+Return<void> RadioResponse::setSmscAddressResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::reportSmsMemoryStatusResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::reportStkServiceIsRunningResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getCdmaSubscriptionSourceResponse(
+        const RadioResponseInfo& info, CdmaSubscriptionSource source) {
+    return Void();
+}
+
+Return<void> RadioResponse::requestIsimAuthenticationResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_string& response) {
+    return Void();
+}
+
+Return<void> RadioResponse::acknowledgeIncomingGsmSmsWithPduResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendEnvelopeWithStatusResponse(
+        const RadioResponseInfo& info, const IccIoResult& iccIo) {
+    return Void();
+}
+
+Return<void> RadioResponse::getVoiceRadioTechnologyResponse(
+        const RadioResponseInfo& info, RadioTechnology rat) {
+    return Void();
+}
+
+Return<void> RadioResponse::getCellInfoListResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_vec<CellInfo>& cellInfo) {
+    return Void();
+}
+
+Return<void> RadioResponse::setCellInfoListRateResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setInitialAttachApnResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getImsRegistrationStateResponse(
+        const RadioResponseInfo& info, bool isRegistered, RadioTechnologyFamily ratFamily) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendImsSmsResponse(
+        const RadioResponseInfo& info, const SendSmsResult& sms) {
+    return Void();
+}
+
+Return<void> RadioResponse::iccTransmitApduBasicChannelResponse(
+        const RadioResponseInfo& info, const IccIoResult& result) {
+    return Void();
+}
+
+Return<void> RadioResponse::iccOpenLogicalChannelResponse(
+        const RadioResponseInfo& info, int32_t channelId,
+        const ::android::hardware::hidl_vec<int8_t>& selectResponse) {
+    return Void();
+}
+
+Return<void> RadioResponse::iccCloseLogicalChannelResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::iccTransmitApduLogicalChannelResponse(
+        const RadioResponseInfo& info, const IccIoResult& result) {
+    return Void();
+}
+
+Return<void> RadioResponse::nvReadItemResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_string& result) {
+    return Void();
+}
+
+Return<void> RadioResponse::nvWriteItemResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::nvResetConfigResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setUiccSubscriptionResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setDataAllowedResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getHardwareConfigResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<HardwareConfig>& config) {
+    return Void();
+}
+
+Return<void> RadioResponse::requestIccSimAuthenticationResponse(
+        const RadioResponseInfo& info, const IccIoResult& result) {
+    return Void();
+}
+
+Return<void> RadioResponse::setDataProfileResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::requestShutdownResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::getRadioCapabilityResponse(
+        const RadioResponseInfo& info, const RadioCapability& rc) {
+    return Void();
+}
+
+Return<void> RadioResponse::setRadioCapabilityResponse(
+        const RadioResponseInfo& info, const RadioCapability& rc) {
+    return Void();
+}
+
+Return<void> RadioResponse::startLceServiceResponse(
+        const RadioResponseInfo& info, const LceStatusInfo& statusInfo) {
+    return Void();
+}
+
+Return<void> RadioResponse::stopLceServiceResponse(
+        const RadioResponseInfo& info, const LceStatusInfo& statusInfo) {
+    return Void();
+}
+
+Return<void> RadioResponse::pullLceDataResponse(
+        const RadioResponseInfo& info, const LceDataInfo& lceInfo) {
+    return Void();
+}
+
+Return<void> RadioResponse::getModemActivityInfoResponse(
+        const RadioResponseInfo& info, const ActivityStatsInfo& activityInfo) {
+    return Void();
+}
+
+Return<void> RadioResponse::setAllowedCarriersResponse(
+        const RadioResponseInfo& info, int32_t numAllowed) {
+    return Void();
+}
+
+Return<void> RadioResponse::getAllowedCarriersResponse(
+        const RadioResponseInfo& info, bool allAllowed, const CarrierRestrictions& carriers) {
+    return Void();
+}
+
+Return<void> RadioResponse::sendDeviceStateResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setIndicationFilterResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::setSimCardPowerResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> RadioResponse::acknowledgeRequest(int32_t serial) {
+    return Void();
+}
diff --git a/radio/Android.bp b/radio/Android.bp
index bbb3e4b..33f70eb 100644
--- a/radio/Android.bp
+++ b/radio/Android.bp
@@ -1,4 +1,5 @@
 // This is an autogenerated file, do not edit.
 subdirs = [
     "1.0",
+    "1.0/vts/functional",
 ]
diff --git a/wifi/1.0/IWifiNanIfaceEventCallback.hal b/wifi/1.0/IWifiNanIfaceEventCallback.hal
index 80d67ce..dd956d6 100644
--- a/wifi/1.0/IWifiNanIfaceEventCallback.hal
+++ b/wifi/1.0/IWifiNanIfaceEventCallback.hal
@@ -141,6 +141,7 @@
    *        |NanStatusType.INTERNAL_FAILURE|
    *        |NanStatusType.INVALID_SESSION_ID|
    *        |NanStatusType.INVALID_PEER_ID|
+   *        |NanStatusType.FOLLOWUP_TX_QUEUE_FULL|
    */
   oneway notifyTransmitFollowupResponse(CommandIdShort id, WifiNanStatus status);
 
@@ -281,8 +282,9 @@
    *
    * @param cmdId command Id corresponding to the original |transmitFollowupRequest| request.
    * @param status WifiNanStatus of the operation.  Possible status codes are:
+   *               |NanStatusType.SUCCESS|
    *               |NanStatusType.NO_OTA_ACK|
-   *               |NanStatusType.FOLLOWUP_TX_QUEUE_FULL|
+   *               |NanStatusType.PROTOCOL_FAILURE|
    */
   oneway eventTransmitFollowup(CommandIdShort id, WifiNanStatus status);
 
diff --git a/wifi/1.0/default/hidl_callback_util.h b/wifi/1.0/default/hidl_callback_util.h
new file mode 100644
index 0000000..a1c6819
--- /dev/null
+++ b/wifi/1.0/default/hidl_callback_util.h
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+#ifndef HIDL_CALLBACK_UTIL_H_
+#define HIDL_CALLBACK_UTIL_H_
+
+#include <set>
+
+#include <hidl/HidlSupport.h>
+
+namespace {
+// Type of callback invoked by the death handler.
+using on_death_cb_function = std::function<void(uint64_t)>;
+
+// Private class used to keep track of death of individual
+// callbacks stored in HidlCallbackHandler.
+template <typename CallbackType>
+class HidlDeathHandler : public android::hardware::hidl_death_recipient {
+ public:
+  HidlDeathHandler(const on_death_cb_function& user_cb_function)
+      : cb_function_(user_cb_function) {}
+  ~HidlDeathHandler() = default;
+
+  // Death notification for callbacks.
+  void serviceDied(
+      uint64_t cookie,
+      const android::wp<android::hidl::base::V1_0::IBase>& /* who */) override {
+    cb_function_(cookie);
+  }
+
+ private:
+  on_death_cb_function cb_function_;
+
+  DISALLOW_COPY_AND_ASSIGN(HidlDeathHandler);
+};
+}  // namespace
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+namespace hidl_callback_util {
+template <typename CallbackType>
+// Provides a class to manage callbacks for the various HIDL interfaces and
+// handle the death of the process hosting each callback.
+class HidlCallbackHandler {
+ public:
+  HidlCallbackHandler()
+      : death_handler_(new HidlDeathHandler<CallbackType>(
+            std::bind(&HidlCallbackHandler::onObjectDeath,
+                      this,
+                      std::placeholders::_1))) {}
+  ~HidlCallbackHandler() = default;
+
+  bool addCallback(const sp<CallbackType>& cb) {
+    // TODO(b/33818800): Can't compare proxies yet. So, use the cookie
+    // (callback proxy's raw pointer) to track the death of individual clients.
+    uint64_t cookie = reinterpret_cast<uint64_t>(cb.get());
+    if (cb_set_.find(cb) != cb_set_.end()) {
+      LOG(WARNING) << "Duplicate death notification registration";
+      return true;
+    }
+    if (!cb->linkToDeath(death_handler_, cookie)) {
+      LOG(ERROR) << "Failed to register death notification";
+      return false;
+    }
+    cb_set_.insert(cb);
+    return true;
+  }
+
+  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);
+    if (iter == cb_set_.end()) {
+      LOG(ERROR) << "Unknown callback death notification received";
+      return;
+    }
+    cb_set_.erase(iter);
+    LOG(DEBUG) << "Dead callback removed from list";
+  }
+
+  void invalidate() {
+    for (const sp<CallbackType>& cb : cb_set_) {
+      if (!cb->unlinkToDeath(death_handler_)) {
+        LOG(ERROR) << "Failed to deregister death notification";
+      }
+    }
+    cb_set_.clear();
+  }
+
+ private:
+  std::set<sp<CallbackType>> cb_set_;
+  sp<HidlDeathHandler<CallbackType>> death_handler_;
+
+  DISALLOW_COPY_AND_ASSIGN(HidlCallbackHandler);
+};
+
+}  // namespace hidl_callback_util
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace wifi
+}  // namespace hardware
+}  // namespace android
+#endif  // HIDL_CALLBACK_UTIL_H_
diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.0/default/hidl_struct_util.cpp
index e57919d..0bf0d32 100644
--- a/wifi/1.0/default/hidl_struct_util.cpp
+++ b/wifi/1.0/default/hidl_struct_util.cpp
@@ -134,6 +134,7 @@
     return false;
   }
   hidl_status->ringName = reinterpret_cast<const char*>(legacy_status.name);
+  hidl_status->flags = 0;
   for (const auto flag : {WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES,
                           WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES}) {
     if (flag & legacy_status.flags) {
@@ -457,6 +458,7 @@
   if (!hidl_scan_data) {
     return false;
   }
+  hidl_scan_data->flags = 0;
   for (const auto flag : {legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED}) {
     if (legacy_cached_scan_result.flags & flag) {
       hidl_scan_data->flags |=
@@ -793,9 +795,6 @@
   legacy_request->config_disc_mac_addr_randomization = 1;
   legacy_request->disc_mac_addr_rand_interval_sec =
         hidl_request.configParams.macAddressRandomizationIntervalSec;
-  legacy_request->config_responder_auto_response = 1;
-  legacy_request->ranging_auto_response_cfg = hidl_request.configParams.acceptRangingRequests ?
-       legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
   legacy_request->config_2dot4g_rssi_close = 1;
   if (hidl_request.configParams.bandSpecificConfig.size() != 2) {
     LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: bandSpecificConfig.size() != 2";
@@ -961,6 +960,9 @@
         hidl_request.baseConfigs.configRangingIndications;
   legacy_request->ranging_cfg.distance_ingress_cm = hidl_request.baseConfigs.distanceIngressCm;
   legacy_request->ranging_cfg.distance_egress_cm = hidl_request.baseConfigs.distanceEgressCm;
+  legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired ?
+        legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
+  legacy_request->range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT;
   legacy_request->publish_type = (legacy_hal::NanPublishType) hidl_request.publishType;
   legacy_request->tx_type = (legacy_hal::NanTxType) hidl_request.txType;
 
@@ -1040,6 +1042,9 @@
         hidl_request.baseConfigs.configRangingIndications;
   legacy_request->ranging_cfg.distance_ingress_cm = hidl_request.baseConfigs.distanceIngressCm;
   legacy_request->ranging_cfg.distance_egress_cm = hidl_request.baseConfigs.distanceEgressCm;
+  legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired ?
+        legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
+  legacy_request->range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT;
   legacy_request->subscribe_type = (legacy_hal::NanSubscribeType) hidl_request.subscribeType;
   legacy_request->serviceResponseFilter = (legacy_hal::NanSRFType) hidl_request.srfType;
   legacy_request->serviceResponseInclude = hidl_request.srfRespondIfInAddressSet ?
@@ -1121,9 +1126,6 @@
   legacy_request->config_disc_mac_addr_randomization = 1;
   legacy_request->disc_mac_addr_rand_interval_sec =
         hidl_request.macAddressRandomizationIntervalSec;
-  legacy_request->config_responder_auto_response = 1;
-  legacy_request->ranging_auto_response_cfg = hidl_request.acceptRangingRequests ?
-       legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
   /* TODO : missing
   legacy_request->config_2dot4g_rssi_close = 1;
   legacy_request->rssi_close_2dot4g_val =
@@ -1283,8 +1285,7 @@
   hidl_response->maxNdpSessions = legacy_response.max_ndp_sessions;
   hidl_response->maxAppInfoLen = legacy_response.max_app_info_len;
   hidl_response->maxQueuedTransmitFollowupMsgs = legacy_response.max_queued_transmit_followup_msgs;
-  // TODO: b/34059183 to add to underlying HAL
-  hidl_response->maxSubscribeInterfaceAddresses = NAN_MAX_SUBSCRIBE_MAX_ADDRESS;
+  hidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address;
   hidl_response->supportedCipherSuites = legacy_response.cipher_suites_supported;
 
   return true;
@@ -1313,8 +1314,8 @@
         legacy_ind.peer_sdea_params.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY;
   hidl_ind->peerRequiresRanging =
         legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE;
-  hidl_ind->rangingMeasurementInCm = legacy_ind.range_result.range_measurement_cm;
-  hidl_ind->rangingIndicationType = legacy_ind.range_result.ranging_event_type;
+  hidl_ind->rangingMeasurementInCm = legacy_ind.range_info.range_measurement_cm;
+  hidl_ind->rangingIndicationType = legacy_ind.range_info.ranging_event_type;
 
   return true;
 }
@@ -1749,6 +1750,7 @@
   hidl_capabilities->lcrSupported = legacy_capabilities.lcr_support;
   hidl_capabilities->responderSupported =
       legacy_capabilities.responder_supported;
+  hidl_capabilities->preambleSupport = 0;
   for (const auto flag : {legacy_hal::WIFI_RTT_PREAMBLE_LEGACY,
                           legacy_hal::WIFI_RTT_PREAMBLE_HT,
                           legacy_hal::WIFI_RTT_PREAMBLE_VHT}) {
@@ -1758,6 +1760,7 @@
               convertLegacyRttPreambleToHidl(flag));
     }
   }
+  hidl_capabilities->bwSupport = 0;
   for (const auto flag : {legacy_hal::WIFI_RTT_BW_5,
                           legacy_hal::WIFI_RTT_BW_10,
                           legacy_hal::WIFI_RTT_BW_20,
diff --git a/wifi/1.0/default/wifi.cpp b/wifi/1.0/default/wifi.cpp
index 8feb836..3d482b4 100644
--- a/wifi/1.0/default/wifi.cpp
+++ b/wifi/1.0/default/wifi.cpp
@@ -85,8 +85,9 @@
 
 WifiStatus Wifi::registerEventCallbackInternal(
     const sp<IWifiEventCallback>& event_callback) {
-  // TODO(b/31632518): remove the callback when the client is destroyed
-  event_callbacks_.emplace_back(event_callback);
+  if (!event_cb_handler_.addCallback(event_callback)) {
+    return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+  }
   return createWifiStatus(WifiStatusCode::SUCCESS);
 }
 
@@ -102,13 +103,13 @@
     // Create the chip instance once the HAL is started.
     chip_ = new WifiChip(kChipId, legacy_hal_, mode_controller_);
     run_state_ = RunState::STARTED;
-    for (const auto& callback : event_callbacks_) {
+    for (const auto& callback : event_cb_handler_.getCallbacks()) {
       if (!callback->onStart().isOk()) {
         LOG(ERROR) << "Failed to invoke onStart callback";
       };
     }
   } else {
-    for (const auto& callback : event_callbacks_) {
+    for (const auto& callback : event_cb_handler_.getCallbacks()) {
       if (!callback->onFailure(wifi_status).isOk()) {
         LOG(ERROR) << "Failed to invoke onFailure callback";
       }
@@ -126,13 +127,13 @@
   }
   WifiStatus wifi_status = stopLegacyHalAndDeinitializeModeController();
   if (wifi_status.code == WifiStatusCode::SUCCESS) {
-    for (const auto& callback : event_callbacks_) {
+    for (const auto& callback : event_cb_handler_.getCallbacks()) {
       if (!callback->onStop().isOk()) {
         LOG(ERROR) << "Failed to invoke onStop callback";
       };
     }
   } else {
-    for (const auto& callback : event_callbacks_) {
+    for (const auto& callback : event_cb_handler_.getCallbacks()) {
       if (!callback->onFailure(wifi_status).isOk()) {
         LOG(ERROR) << "Failed to invoke onFailure callback";
       }
diff --git a/wifi/1.0/default/wifi.h b/wifi/1.0/default/wifi.h
index 40d3552..c6fa84c 100644
--- a/wifi/1.0/default/wifi.h
+++ b/wifi/1.0/default/wifi.h
@@ -23,6 +23,7 @@
 #include <android/hardware/wifi/1.0/IWifi.h>
 #include <utils/Looper.h>
 
+#include "hidl_callback_util.h"
 #include "wifi_chip.h"
 #include "wifi_legacy_hal.h"
 #include "wifi_mode_controller.h"
@@ -71,8 +72,8 @@
   std::shared_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
   std::shared_ptr<mode_controller::WifiModeController> mode_controller_;
   RunState run_state_;
-  std::vector<sp<IWifiEventCallback>> event_callbacks_;
   sp<WifiChip> chip_;
+  hidl_callback_util::HidlCallbackHandler<IWifiEventCallback> event_cb_handler_;
 
   DISALLOW_COPY_AND_ASSIGN(Wifi);
 };
diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.0/default/wifi_chip.cpp
index 0e2d54e..6aeedf8 100644
--- a/wifi/1.0/default/wifi_chip.cpp
+++ b/wifi/1.0/default/wifi_chip.cpp
@@ -63,7 +63,7 @@
 void WifiChip::invalidate() {
   invalidateAndRemoveAllIfaces();
   legacy_hal_.reset();
-  event_callbacks_.clear();
+  event_cb_handler_.invalidate();
   is_valid_ = false;
 }
 
@@ -71,8 +71,8 @@
   return is_valid_;
 }
 
-std::vector<sp<IWifiChipEventCallback>> WifiChip::getEventCallbacks() {
-  return event_callbacks_;
+std::set<sp<IWifiChipEventCallback>> WifiChip::getEventCallbacks() {
+  return event_cb_handler_.getCallbacks();
 }
 
 Return<void> WifiChip::getId(getId_cb hidl_status_cb) {
@@ -353,8 +353,9 @@
 
 WifiStatus WifiChip::registerEventCallbackInternal(
     const sp<IWifiChipEventCallback>& event_callback) {
-  // TODO(b/31632518): remove the callback when the client is destroyed
-  event_callbacks_.emplace_back(event_callback);
+  if (!event_cb_handler_.addCallback(event_callback)) {
+    return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+  }
   return createWifiStatus(WifiStatusCode::SUCCESS);
 }
 
@@ -414,14 +415,14 @@
   }
   WifiStatus status = handleChipConfiguration(mode_id);
   if (status.code != WifiStatusCode::SUCCESS) {
-    for (const auto& callback : event_callbacks_) {
+    for (const auto& callback : event_cb_handler_.getCallbacks()) {
       if (!callback->onChipReconfigureFailure(status).isOk()) {
         LOG(ERROR) << "Failed to invoke onChipReconfigureFailure callback";
       }
     }
     return status;
   }
-  for (const auto& callback : event_callbacks_) {
+  for (const auto& callback : event_cb_handler_.getCallbacks()) {
     if (!callback->onChipReconfigured(mode_id).isOk()) {
       LOG(ERROR) << "Failed to invoke onChipReconfigured callback";
     }
@@ -503,7 +504,7 @@
   }
   std::string ifname = legacy_hal_.lock()->getApIfaceName();
   ap_iface_ = new WifiApIface(ifname, legacy_hal_);
-  for (const auto& callback : event_callbacks_) {
+  for (const auto& callback : event_cb_handler_.getCallbacks()) {
     if (!callback->onIfaceAdded(IfaceType::AP, ifname).isOk()) {
       LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
     }
@@ -533,7 +534,7 @@
     return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
   }
   invalidateAndClear(ap_iface_);
-  for (const auto& callback : event_callbacks_) {
+  for (const auto& callback : event_cb_handler_.getCallbacks()) {
     if (!callback->onIfaceRemoved(IfaceType::AP, ifname).isOk()) {
       LOG(ERROR) << "Failed to invoke onIfaceRemoved callback";
     }
@@ -549,7 +550,7 @@
   }
   std::string ifname = legacy_hal_.lock()->getNanIfaceName();
   nan_iface_ = new WifiNanIface(ifname, legacy_hal_);
-  for (const auto& callback : event_callbacks_) {
+  for (const auto& callback : event_cb_handler_.getCallbacks()) {
     if (!callback->onIfaceAdded(IfaceType::NAN, ifname).isOk()) {
       LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
     }
@@ -579,7 +580,7 @@
     return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
   }
   invalidateAndClear(nan_iface_);
-  for (const auto& callback : event_callbacks_) {
+  for (const auto& callback : event_cb_handler_.getCallbacks()) {
     if (!callback->onIfaceRemoved(IfaceType::NAN, ifname).isOk()) {
       LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
     }
@@ -595,7 +596,7 @@
   }
   std::string ifname = legacy_hal_.lock()->getP2pIfaceName();
   p2p_iface_ = new WifiP2pIface(ifname, legacy_hal_);
-  for (const auto& callback : event_callbacks_) {
+  for (const auto& callback : event_cb_handler_.getCallbacks()) {
     if (!callback->onIfaceAdded(IfaceType::P2P, ifname).isOk()) {
       LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
     }
@@ -625,7 +626,7 @@
     return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
   }
   invalidateAndClear(p2p_iface_);
-  for (const auto& callback : event_callbacks_) {
+  for (const auto& callback : event_cb_handler_.getCallbacks()) {
     if (!callback->onIfaceRemoved(IfaceType::P2P, ifname).isOk()) {
       LOG(ERROR) << "Failed to invoke onIfaceRemoved callback";
     }
@@ -639,7 +640,7 @@
   }
   std::string ifname = legacy_hal_.lock()->getStaIfaceName();
   sta_iface_ = new WifiStaIface(ifname, legacy_hal_);
-  for (const auto& callback : event_callbacks_) {
+  for (const auto& callback : event_cb_handler_.getCallbacks()) {
     if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) {
       LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
     }
@@ -669,7 +670,7 @@
     return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
   }
   invalidateAndClear(sta_iface_);
-  for (const auto& callback : event_callbacks_) {
+  for (const auto& callback : event_cb_handler_.getCallbacks()) {
     if (!callback->onIfaceRemoved(IfaceType::STA, ifname).isOk()) {
       LOG(ERROR) << "Failed to invoke onIfaceRemoved callback";
     }
diff --git a/wifi/1.0/default/wifi_chip.h b/wifi/1.0/default/wifi_chip.h
index 938b180..e1c2344 100644
--- a/wifi/1.0/default/wifi_chip.h
+++ b/wifi/1.0/default/wifi_chip.h
@@ -22,6 +22,7 @@
 #include <android-base/macros.h>
 #include <android/hardware/wifi/1.0/IWifiChip.h>
 
+#include "hidl_callback_util.h"
 #include "wifi_ap_iface.h"
 #include "wifi_legacy_hal.h"
 #include "wifi_mode_controller.h"
@@ -62,7 +63,7 @@
   // valid before processing them.
   void invalidate();
   bool isValid();
-  std::vector<sp<IWifiChipEventCallback>> getEventCallbacks();
+  std::set<sp<IWifiChipEventCallback>> getEventCallbacks();
 
   // HIDL methods exposed.
   Return<void> getId(getId_cb hidl_status_cb) override;
@@ -179,7 +180,6 @@
   ChipId chip_id_;
   std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
   std::weak_ptr<mode_controller::WifiModeController> mode_controller_;
-  std::vector<sp<IWifiChipEventCallback>> event_callbacks_;
   sp<WifiApIface> ap_iface_;
   sp<WifiNanIface> nan_iface_;
   sp<WifiP2pIface> p2p_iface_;
@@ -191,6 +191,8 @@
   // registration mechanism. Use this to check if we have already
   // registered a callback.
   bool debug_ring_buffer_cb_registered_;
+  hidl_callback_util::HidlCallbackHandler<IWifiChipEventCallback>
+      event_cb_handler_;
 
   DISALLOW_COPY_AND_ASSIGN(WifiChip);
 };
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index cd89acc..7d58254 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -289,6 +289,24 @@
     on_nan_event_transmit_follow_up_user_callback(*event);
   }
 }
+
+std::function<void(const NanRangeRequestInd&)>
+    on_nan_event_range_request_user_callback;
+void onAysncNanEventRangeRequest(NanRangeRequestInd* event) {
+  const auto lock = hidl_sync_util::acquireGlobalLock();
+  if (on_nan_event_range_request_user_callback && event) {
+    on_nan_event_range_request_user_callback(*event);
+  }
+}
+
+std::function<void(const NanRangeReportInd&)>
+    on_nan_event_range_report_user_callback;
+void onAysncNanEventRangeReport(NanRangeReportInd* event) {
+  const auto lock = hidl_sync_util::acquireGlobalLock();
+  if (on_nan_event_range_report_user_callback && event) {
+    on_nan_event_range_report_user_callback(*event);
+  }
+}
 // End of the free-standing "C" style callbacks.
 
 WifiLegacyHal::WifiLegacyHal()
@@ -1023,6 +1041,10 @@
       user_callbacks.on_event_data_path_end;
   on_nan_event_transmit_follow_up_user_callback =
       user_callbacks.on_event_transmit_follow_up;
+  on_nan_event_range_request_user_callback =
+      user_callbacks.on_event_range_request;
+  on_nan_event_range_report_user_callback =
+      user_callbacks.on_event_range_report;
 
   return global_func_table_.wifi_nan_register_handler(
       wlan_interface_handle_,
@@ -1039,7 +1061,9 @@
        onAysncNanEventDataPathRequest,
        onAysncNanEventDataPathConfirm,
        onAysncNanEventDataPathEnd,
-       onAysncNanEventTransmitFollowUp});
+       onAysncNanEventTransmitFollowUp,
+       onAysncNanEventRangeRequest,
+       onAysncNanEventRangeReport});
 }
 
 wifi_error WifiLegacyHal::nanEnableRequest(transaction_id id,
@@ -1261,6 +1285,8 @@
   on_nan_event_data_path_confirm_user_callback = nullptr;
   on_nan_event_data_path_end_user_callback = nullptr;
   on_nan_event_transmit_follow_up_user_callback = nullptr;
+  on_nan_event_range_request_user_callback = nullptr;
+  on_nan_event_range_report_user_callback = nullptr;
 }
 
 }  // namespace legacy_hal
diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.0/default/wifi_legacy_hal.h
index e65b79b..ed020b0 100644
--- a/wifi/1.0/default/wifi_legacy_hal.h
+++ b/wifi/1.0/default/wifi_legacy_hal.h
@@ -89,6 +89,10 @@
   std::function<void(const NanDataPathEndInd&)> on_event_data_path_end;
   std::function<void(const NanTransmitFollowupInd&)>
       on_event_transmit_follow_up;
+  std::function<void(const NanRangeRequestInd&)>
+      on_event_range_request;
+  std::function<void(const NanRangeReportInd&)>
+      on_event_range_report;
 };
 
 // Full scan results contain IE info and are hence passed by reference, to
diff --git a/wifi/1.0/default/wifi_nan_iface.cpp b/wifi/1.0/default/wifi_nan_iface.cpp
index 8d76f91..68be2a7 100644
--- a/wifi/1.0/default/wifi_nan_iface.cpp
+++ b/wifi/1.0/default/wifi_nan_iface.cpp
@@ -55,7 +55,7 @@
 
     switch (msg.response_type) {
     case legacy_hal::NAN_RESPONSE_ENABLED: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyEnableResponse(id, wifiNanStatus).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
           }
@@ -63,7 +63,7 @@
         break;
     }
     case legacy_hal::NAN_RESPONSE_DISABLED: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyDisableResponse(id, wifiNanStatus).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
           }
@@ -71,7 +71,7 @@
         break;
     }
     case legacy_hal::NAN_RESPONSE_PUBLISH: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyStartPublishResponse(id, wifiNanStatus,
                         msg.body.publish_response.publish_id).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
@@ -80,7 +80,7 @@
         break;
     }
     case legacy_hal::NAN_RESPONSE_PUBLISH_CANCEL: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyStopPublishResponse(id, wifiNanStatus).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
           }
@@ -88,7 +88,7 @@
         break;
     }
     case legacy_hal::NAN_RESPONSE_TRANSMIT_FOLLOWUP: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyTransmitFollowupResponse(id, wifiNanStatus).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
           }
@@ -96,7 +96,7 @@
         break;
     }
     case legacy_hal::NAN_RESPONSE_SUBSCRIBE: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyStartSubscribeResponse(id, wifiNanStatus,
                         msg.body.subscribe_response.subscribe_id).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
@@ -105,7 +105,7 @@
         break;
     }
     case legacy_hal::NAN_RESPONSE_SUBSCRIBE_CANCEL: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyStopSubscribeResponse(id, wifiNanStatus).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
           }
@@ -113,7 +113,7 @@
         break;
     }
     case legacy_hal::NAN_RESPONSE_CONFIG: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyConfigResponse(id, wifiNanStatus).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
           }
@@ -127,7 +127,7 @@
             LOG(ERROR) << "Failed to convert nan capabilities response";
             return;
         }
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyCapabilitiesResponse(id, wifiNanStatus,
                                                     hidl_struct).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
@@ -136,7 +136,7 @@
         break;
     }
     case legacy_hal::NAN_DP_INTERFACE_CREATE: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyCreateDataInterfaceResponse(id, wifiNanStatus).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
           }
@@ -144,7 +144,7 @@
         break;
     }
     case legacy_hal::NAN_DP_INTERFACE_DELETE: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyDeleteDataInterfaceResponse(id, wifiNanStatus).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
           }
@@ -152,7 +152,7 @@
         break;
     }
     case legacy_hal::NAN_DP_INITIATOR_RESPONSE: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyInitiateDataPathResponse(id, wifiNanStatus,
                 msg.body.data_request_response.ndp_instance_id).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
@@ -161,14 +161,14 @@
         break;
     }
     case legacy_hal::NAN_DP_RESPONDER_RESPONSE: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyRespondToDataPathIndicationResponse(id, wifiNanStatus).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
           }
         }
     }
     case legacy_hal::NAN_DP_END: {
-        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
           if (!callback->notifyTerminateDataPathResponse(id, wifiNanStatus).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
           }
@@ -201,7 +201,7 @@
       hidl_struct.eventType = (NanClusterEventType) msg.event_type;
       hidl_struct.addr = msg.data.mac_addr.addr;
 
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         if (!callback->eventClusterEvent(hidl_struct).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
         }
@@ -219,7 +219,7 @@
       status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
       status.description = msg.nan_reason;
 
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         if (!callback->eventDisabled(status).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
         }
@@ -237,7 +237,7 @@
       status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
       status.description = msg.nan_reason;
 
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         if (!callback->eventPublishTerminated(msg.publish_id, status).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
         }
@@ -255,7 +255,7 @@
       status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
       status.description = msg.nan_reason;
 
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         if (!callback->eventSubscribeTerminated(msg.subscribe_id, status).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
         }
@@ -276,7 +276,7 @@
           return;
       }
 
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         if (!callback->eventMatch(hidl_struct).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
         }
@@ -290,7 +290,7 @@
         LOG(ERROR) << "Callback invoked on an invalid object";
         return;
       }
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         if (!callback->eventMatchExpired(msg.publish_subscribe_id,
                 msg.requestor_instance_id).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
@@ -312,7 +312,7 @@
           return;
       }
 
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         if (!callback->eventFollowupReceived(hidl_struct).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
         }
@@ -330,7 +330,7 @@
       status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
       status.description = msg.nan_reason;
 
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         if (!callback->eventTransmitFollowup(msg.id, status).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
         }
@@ -351,7 +351,7 @@
           return;
       }
 
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         if (!callback->eventDataPathRequest(hidl_struct).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
         }
@@ -372,7 +372,7 @@
           return;
       }
 
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         if (!callback->eventDataPathConfirm(hidl_struct).isOk()) {
             LOG(ERROR) << "Failed to invoke the callback";
         }
@@ -386,7 +386,7 @@
         LOG(ERROR) << "Callback invoked on an invalid object";
         return;
       }
-      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+      for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
         for (int i = 0; i < msg.num_ndp_instances; ++i) {
             if (!callback->eventDataPathTerminated(msg.ndp_instance_id[i]).isOk()) {
                 LOG(ERROR) << "Failed to invoke the callback";
@@ -400,6 +400,16 @@
       LOG(ERROR) << "on_event_beacon_sdf_payload - should not be called";
   };
 
+  callback_handlers.on_event_range_request = [weak_ptr_this](
+        const legacy_hal::NanRangeRequestInd& /* msg */) {
+      LOG(ERROR) << "on_event_range_request - should not be called";
+  };
+
+  callback_handlers.on_event_range_report = [weak_ptr_this](
+        const legacy_hal::NanRangeReportInd& /* msg */) {
+      LOG(ERROR) << "on_event_range_report - should not be called";
+  };
+
   legacy_hal::wifi_error legacy_status =
       legacy_hal_.lock()->nanRegisterCallbackHandlers(callback_handlers);
   if (legacy_status != legacy_hal::WIFI_SUCCESS) {
@@ -410,7 +420,7 @@
 
 void WifiNanIface::invalidate() {
   legacy_hal_.reset();
-  event_callbacks_.clear();
+  event_cb_handler_.invalidate();
   is_valid_ = false;
 }
 
@@ -418,6 +428,10 @@
   return is_valid_;
 }
 
+std::set<sp<IWifiNanIfaceEventCallback>> WifiNanIface::getEventCallbacks() {
+  return event_cb_handler_.getCallbacks();
+}
+
 Return<void> WifiNanIface::getName(getName_cb hidl_status_cb) {
   return validateAndCall(this,
                          WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
@@ -609,11 +623,9 @@
 
 WifiStatus WifiNanIface::registerEventCallbackInternal(
     const sp<IWifiNanIfaceEventCallback>& callback) {
-  // TODO(b/31632518): remove the callback when the client is destroyed and/or
-  // make sure that the same callback is only registered once (i.e. detect duplicates)
-  // OR: consider having a single listener - not clear why multiple listeners (managers) are
-  // necessary, nor how they would coordinate (at least command IDs).
-  event_callbacks_.emplace_back(callback);
+  if (!event_cb_handler_.addCallback(callback)) {
+    return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+  }
   return createWifiStatus(WifiStatusCode::SUCCESS);
 }
 
diff --git a/wifi/1.0/default/wifi_nan_iface.h b/wifi/1.0/default/wifi_nan_iface.h
index d1da60e..e1edd29 100644
--- a/wifi/1.0/default/wifi_nan_iface.h
+++ b/wifi/1.0/default/wifi_nan_iface.h
@@ -21,6 +21,7 @@
 #include <android/hardware/wifi/1.0/IWifiNanIface.h>
 #include <android/hardware/wifi/1.0/IWifiNanIfaceEventCallback.h>
 
+#include "hidl_callback_util.h"
 #include "wifi_legacy_hal.h"
 
 namespace android {
@@ -119,10 +120,13 @@
   WifiStatus terminateDataPathRequestInternal(
       uint16_t cmd_id, uint32_t ndpInstanceId);
 
+  std::set<sp<IWifiNanIfaceEventCallback>> getEventCallbacks();
+
   std::string ifname_;
   std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
-  std::vector<sp<IWifiNanIfaceEventCallback>> event_callbacks_;
   bool is_valid_;
+  hidl_callback_util::HidlCallbackHandler<IWifiNanIfaceEventCallback>
+      event_cb_handler_;
 
   DISALLOW_COPY_AND_ASSIGN(WifiNanIface);
 };
diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.0/default/wifi_sta_iface.cpp
index 6100334..55c9cf7 100644
--- a/wifi/1.0/default/wifi_sta_iface.cpp
+++ b/wifi/1.0/default/wifi_sta_iface.cpp
@@ -35,7 +35,7 @@
 
 void WifiStaIface::invalidate() {
   legacy_hal_.reset();
-  event_callbacks_.clear();
+  event_cb_handler_.invalidate();
   is_valid_ = false;
 }
 
@@ -43,8 +43,8 @@
   return is_valid_;
 }
 
-std::vector<sp<IWifiStaIfaceEventCallback>> WifiStaIface::getEventCallbacks() {
-  return event_callbacks_;
+std::set<sp<IWifiStaIfaceEventCallback>> WifiStaIface::getEventCallbacks() {
+  return event_cb_handler_.getCallbacks();
 }
 
 Return<void> WifiStaIface::getName(getName_cb hidl_status_cb) {
@@ -293,8 +293,9 @@
 
 WifiStatus WifiStaIface::registerEventCallbackInternal(
     const sp<IWifiStaIfaceEventCallback>& callback) {
-  // TODO(b/31632518): remove the callback when the client is destroyed
-  event_callbacks_.emplace_back(callback);
+  if (!event_cb_handler_.addCallback(callback)) {
+    return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+  }
   return createWifiStatus(WifiStatusCode::SUCCESS);
 }
 
@@ -570,7 +571,8 @@
   return createWifiStatusFromLegacyError(legacy_status);
 }
 
-WifiStatus WifiStaIface::setScanningMacOuiInternal(const std::array<uint8_t, 3>& oui) {
+WifiStatus WifiStaIface::setScanningMacOuiInternal(
+    const std::array<uint8_t, 3>& oui) {
   legacy_hal::wifi_error legacy_status =
       legacy_hal_.lock()->setScanningMacOui(oui);
   return createWifiStatusFromLegacyError(legacy_status);
diff --git a/wifi/1.0/default/wifi_sta_iface.h b/wifi/1.0/default/wifi_sta_iface.h
index bc2d75f..5f0ffe9 100644
--- a/wifi/1.0/default/wifi_sta_iface.h
+++ b/wifi/1.0/default/wifi_sta_iface.h
@@ -21,6 +21,7 @@
 #include <android/hardware/wifi/1.0/IWifiStaIface.h>
 #include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h>
 
+#include "hidl_callback_util.h"
 #include "wifi_legacy_hal.h"
 
 namespace android {
@@ -39,7 +40,7 @@
   // Refer to |WifiChip::invalidate()|.
   void invalidate();
   bool isValid();
-  std::vector<sp<IWifiStaIfaceEventCallback>> getEventCallbacks();
+  std::set<sp<IWifiStaIfaceEventCallback>> getEventCallbacks();
 
   // HIDL methods exposed.
   Return<void> getName(getName_cb hidl_status_cb) override;
@@ -151,8 +152,9 @@
 
   std::string ifname_;
   std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
-  std::vector<sp<IWifiStaIfaceEventCallback>> event_callbacks_;
   bool is_valid_;
+  hidl_callback_util::HidlCallbackHandler<IWifiStaIfaceEventCallback>
+      event_cb_handler_;
 
   DISALLOW_COPY_AND_ASSIGN(WifiStaIface);
 };
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 1c6d0e0..30e8943 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -844,11 +844,6 @@
    */
   uint32_t macAddressRandomizationIntervalSec;
   /**
-   * Accept (if true) or not (if false) ranging requests from peers - whether in the context of
-   * discovery or otherwise.
-   */
-  bool acceptRangingRequests;
-  /**
    * Additional configuration provided per band: indexed by |NanBandIndex|.
    */
   NanBandSpecificConfig[2] bandSpecificConfig;
@@ -1014,7 +1009,22 @@
   bool securityEnabledInNdp;
   /**
    * Specifies whether or not there is a ranging requirement in this discovery session.
-   * Note that 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.
+   * 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/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp
index 8a5d7e0..01eeef5 100644
--- a/wifi/1.0/vts/functional/Android.bp
+++ b/wifi/1.0/vts/functional/Android.bp
@@ -15,10 +15,10 @@
 //
 
 cc_test {
-    name: "wifi_hidl_test",
+    name: "VtsHalWifiV1_0TargetTest",
     gtest: true,
     srcs: [
-        "main.cpp",
+        "VtsHalWifiV1_0TargetTest.cpp",
         "wifi_ap_iface_hidl_test.cpp",
         "wifi_chip_hidl_test.cpp",
         "wifi_hidl_call_util_selftest.cpp",
diff --git a/wifi/1.0/vts/functional/main.cpp b/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
similarity index 100%
rename from wifi/1.0/vts/functional/main.cpp
rename to wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
diff --git a/wifi/supplicant/1.0/ISupplicantP2pIface.hal b/wifi/supplicant/1.0/ISupplicantP2pIface.hal
index 45e90f3..dc1388a 100644
--- a/wifi/supplicant/1.0/ISupplicantP2pIface.hal
+++ b/wifi/supplicant/1.0/ISupplicantP2pIface.hal
@@ -612,4 +612,64 @@
    *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
    */
   setWfdDeviceInfo(uint8_t[8] info) generates (SupplicantStatus status);
+
+  /**
+   * Creates a NFC handover request message.
+   *
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
+   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+   * @return request Bytes representing the handover request as specified in
+   *         section 3.1.1 of NFC Connection Handover 1.2 Technical
+   *         Specification.
+   */
+  createNfcHandoverRequestMessage()
+      generates (SupplicantStatus status, vec<uint8_t> request);
+
+  /**
+   * Creates a NFC handover select message.
+   *
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
+   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+   * @return select Bytes representing the handover select as specified in
+   *         section 3.1.2 of NFC Connection Handover 1.2 Technical
+   *         Specification.
+   */
+  createNfcHandoverSelectMessage()
+      generates (SupplicantStatus status, vec<uint8_t> select);
+
+  /**
+   * Report the response of the NFC handover request.
+   *
+   * @param request Bytes representing the handover request as specified in
+   *        section 3.1.1 of NFC Connection Handover 1.2 Technical
+   *        Specification.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
+   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+   */
+  reportNfcHandoverResponse(vec<uint8_t> request)
+      generates (SupplicantStatus status);
+
+  /**
+   * Report the initiation of the NFC handover select.
+   *
+   * @param select Bytes representing the handover select as specified in
+   *        section 3.1.2 of NFC Connection Handover 1.2 Technical
+   *        Specification.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
+   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+   */
+  reportNfcHandoverInitiation(vec<uint8_t> select)
+      generates (SupplicantStatus status);
 };
diff --git a/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal b/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
index 34237f0..dd1d1c4 100644
--- a/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
@@ -214,45 +214,46 @@
    * Used to indicate the result of ANQP (either for IEEE 802.11u Interworking
    * or Hotspot 2.0) query.
    *
-   * @param macAddress MAC address of the access point.
+   * @param bssid BSSID of the access point.
    * @param data ANQP data fetched from the access point.
    *        All the fields in this struct must be empty if the query failed.
    * @param hs20Data ANQP data fetched from the Hotspot 2.0 access point.
    *        All the fields in this struct must be empty if the query failed.
    */
-  oneway onAnqpQueryDone(MacAddress macAddress,
-                         AnqpData data,
-                         Hs20AnqpData hs20Data);
+  oneway onAnqpQueryDone(Bssid bssid, AnqpData data, Hs20AnqpData hs20Data);
 
   /**
    * Used to indicate the result of Hotspot 2.0 Icon query.
    *
-   * @param macAddress MAC address of the access point.
+   * @param bssid BSSID of the access point.
    * @param fileName Name of the file that was requested.
    * @param data Icon data fetched from the access point.
    *        Must be empty if the query failed.
    */
-  oneway onHs20IconQueryDone(MacAddress macAddress,
-                             string fileName,
-                             vec<uint8_t> data);
+  oneway onHs20IconQueryDone(Bssid bssid, string fileName, vec<uint8_t> data);
 
   /**
    * Used to indicate a Hotspot 2.0 subscription remediation event.
    *
+   * @param bssid BSSID of the access point.
    * @param osuMethod OSU method.
    * @param url URL of the server.
    */
-  oneway onHs20SubscriptionRemediation(OsuMethod osuMethod, string url);
+  oneway onHs20SubscriptionRemediation(Bssid bssid,
+                                       OsuMethod osuMethod,
+                                       string url);
 
   /**
    * Used to indicate a Hotspot 2.0 imminent deauth notice.
    *
+   * @param bssid BSSID of the access point.
    * @param reasonCode Code to indicate the deauth reason.
    *        Refer to section 3.2.1.2 of the Hotspot 2.0 spec.
    * @param reAuthDelayInSec Delay before reauthenticating.
    * @param url URL of the server.
    */
-  oneway onHs20DeauthImminentNotice(uint32_t reasonCode,
+  oneway onHs20DeauthImminentNotice(Bssid bssid,
+                                    uint32_t reasonCode,
                                     uint32_t reAuthDelayInSec,
                                     string url);
 
diff --git a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
index deaad5d..b16fb39 100644
--- a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
@@ -106,7 +106,10 @@
     PAP = 1,
     MSPAP = 2,
     MSPAPV2 = 3,
-    GTC = 4
+    GTC = 4,
+    SIM = 5,
+    AKA = 6,
+    AKA_PRIME = 7
   };
 
   /** Params of |sendNetworkEapSimGsmAuthResponse| request. (Refer RFC 4186) */
@@ -896,6 +899,22 @@
   getIdStr() generates (SupplicantStatus status, string idStr);
 
   /**
+   * Retrieves a WPS-NFC configuration token for this network.
+   *
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
+   *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
+   * @return token Bytes representing WPS-NFC configuration token.
+   *         This is a dump of all the WPS atrributes of the AP configuration
+   *         as specified in the Wi-Fi Protected Setup Specification.
+   */
+  getWpsNfcConfigurationToken()
+      generates (SupplicantStatus status, vec<uint8_t> token);
+
+  /**
    * Enable the network for connection purposes.
    *
    * This must trigger a connection to the network if:
diff --git a/wifi/supplicant/1.0/vts/functional/Android.mk b/wifi/supplicant/1.0/vts/functional/Android.mk
index 8fa649f..52fecc2 100644
--- a/wifi/supplicant/1.0/vts/functional/Android.mk
+++ b/wifi/supplicant/1.0/vts/functional/Android.mk
@@ -16,10 +16,10 @@
 LOCAL_PATH := $(call my-dir)
 
 include $(CLEAR_VARS)
-LOCAL_MODULE := supplicant_hidl_test
+LOCAL_MODULE := VtsHalWifiSupplicantV1_0TargetTest
 LOCAL_CPPFLAGS := -Wall -Werror -Wextra
 LOCAL_SRC_FILES := \
-    main.cpp \
+    VtsHalWifiSupplicantV1_0TargetTest.cpp \
     supplicant_hidl_test.cpp \
     supplicant_hidl_test_utils.cpp \
     supplicant_p2p_iface_hidl_test.cpp \
diff --git a/wifi/supplicant/1.0/vts/functional/main.cpp b/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
similarity index 100%
rename from wifi/supplicant/1.0/vts/functional/main.cpp
rename to wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp