Merge "Renamed toString to vecToString"
diff --git a/audio/effect/2.0/IEffect.hal b/audio/effect/2.0/IEffect.hal
index 615a460..9027c68 100644
--- a/audio/effect/2.0/IEffect.hal
+++ b/audio/effect/2.0/IEffect.hal
@@ -226,49 +226,47 @@
     getDescriptor() generates (Result retval, EffectDescriptor descriptor);
 
     /*
-     * Effect process function. Takes input samples as specified (count and
-     * location) in input buffer and returns processed samples as specified in
-     * output buffer. If the buffer descriptor is empty the function must use
-     * either the buffer or the buffer provider callback installed by the
-     * setConfig command.  The effect framework must call the 'process' function
-     * after the 'enable' command is received and until the 'disable' is
-     * received. When the engine receives the 'disable' command it should turn
-     * off the effect gracefully and when done indicate that it is OK to stop
-     * calling the 'process' function by returning the INVALID_STATE status.
+     * Set up required transports for passing audio buffers to the effect.
      *
-     * Output audio buffer must contain no more frames than the input audio
-     * buffer. Since the effect may transform input channels into a different
-     * amount of channels, the caller provides the output frame size.
+     * The transport consists of shared memory and a message queue for reporting
+     * effect processing operation status. The shared memory is set up
+     * separately using 'setProcessBuffers' method.
      *
-     * @param inBuffer input audio buffer.
-     * @param outFrameSize output frame size in bytes.
-     * @return retval operation completion status.
-     * @return outBuffer output audio buffer.
+     * Processing is requested by setting 'REQUEST_PROCESS' or
+     * 'REQUEST_PROCESS_REVERSE' EventFlags associated with the status message
+     * queue. The result of processing may be one of the following:
+     *   OK if there were no errors during processing;
+     *   INVALID_ARGUMENTS if audio buffers are invalid;
+     *   INVALID_STATE if the engine has finished the disable phase;
+     *   NOT_INITIALIZED if the audio buffers were not set;
+     *   NOT_SUPPORTED if the requested processing type is not supported by
+     *                 the effect.
+     *
+     * @return retval OK if both message queues were created successfully.
+     *                INVALID_STATE if the method was already called.
+     *                INVALID_ARGUMENTS if there was a problem setting up
+     *                                  the queue.
+     * @return statusMQ a message queue used for passing status from the effect.
      */
-    // TODO(mnaganov): replace with FMQ version.
-    @callflow(next={"*"})
-    process(AudioBuffer inBuffer, uint32_t outFrameSize)
-            generates (Result retval, AudioBuffer outBuffer);
+    prepareForProcessing() generates (Result retval, fmq_sync<Result> statusMQ);
 
     /*
-     * Process reverse stream function. This function is used to pass a
-     * reference stream to the effect engine. If the engine does not need a
-     * reference stream, this function MUST return NOT_SUPPORTED. For example,
-     * this function would typically implemented by an Echo Canceler.
+     * Set up input and output buffers for processing audio data. The effect
+     * may modify both the input and the output buffer during the operation.
+     * Buffers may be set multiple times during effect lifetime.
      *
-     * Output audio buffer must contain no more frames than the input audio
-     * buffer. Since the effect may transform input channels into a different
-     * amount of channels, the caller provides the output frame size.
+     * The input and the output buffer may be reused between different effects,
+     * and the input buffer may be used as an output buffer. Buffers are
+     * distinguished using 'AudioBuffer.id' field.
      *
      * @param inBuffer input audio buffer.
-     * @param outFrameSize output frame size in bytes.
-     * @return retval operation completion status.
-     * @return outBuffer output audio buffer.
+     * @param outBuffer output audio buffer.
+     * @return retval OK if both buffers were mapped successfully.
+     *                INVALID_ARGUMENTS if there was a problem with mapping
+     *                                  any of the buffers.
      */
-    // TODO(mnaganov): replace with FMQ version.
-    @callflow(next={"*"})
-    processReverse(AudioBuffer inBuffer, uint32_t outFrameSize)
-            generates (Result retval, AudioBuffer outBuffer);
+    setProcessBuffers(AudioBuffer inBuffer, AudioBuffer outBuffer) generates (
+            Result retval);
 
     /*
      * Execute a vendor specific command on the effect. The command code
@@ -406,4 +404,14 @@
      */
     setCurrentConfigForFeature(uint32_t featureId, vec<uint8_t> configData)
             generates (Result retval);
+
+    /*
+     * Called by the framework to deinitialize the effect and free up
+     * all the currently allocated resources. It is recommended to close
+     * the effect on the client side as soon as it is becomes unused.
+     *
+     * @return retval OK in case the success.
+     *                INVALID_STATE if the effect was already closed.
+     */
+    close() generates (Result retval);
 };
diff --git a/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp b/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp
index 341466f..f6e72bf 100644
--- a/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp
+++ b/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp
@@ -115,16 +115,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> AcousticEchoCancelerEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> AcousticEchoCancelerEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> AcousticEchoCancelerEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> AcousticEchoCancelerEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> AcousticEchoCancelerEffect::command(
@@ -167,6 +165,10 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> AcousticEchoCancelerEffect::close() {
+    return mEffect->close();
+}
+
 // Methods from ::android::hardware::audio::effect::V2_0::IAcousticEchoCancelerEffect follow.
 Return<Result> AcousticEchoCancelerEffect::setEchoDelay(uint32_t echoDelayMs)  {
     return mEffect->setParam(AEC_PARAM_ECHO_DELAY, echoDelayMs);
diff --git a/audio/effect/2.0/default/AcousticEchoCancelerEffect.h b/audio/effect/2.0/default/AcousticEchoCancelerEffect.h
index 71fcc97..c777b02 100644
--- a/audio/effect/2.0/default/AcousticEchoCancelerEffect.h
+++ b/audio/effect/2.0/default/AcousticEchoCancelerEffect.h
@@ -69,12 +69,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -97,6 +94,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::IAcousticEchoCancelerEffect follow.
     Return<Result> setEchoDelay(uint32_t echoDelayMs)  override;
diff --git a/audio/effect/2.0/default/Android.mk b/audio/effect/2.0/default/Android.mk
index 9b99737..18076ed 100644
--- a/audio/effect/2.0/default/Android.mk
+++ b/audio/effect/2.0/default/Android.mk
@@ -5,6 +5,7 @@
 LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_SRC_FILES := \
     AcousticEchoCancelerEffect.cpp \
+    AudioBufferManager.cpp \
     AutomaticGainControlEffect.cpp \
     BassBoostEffect.cpp \
     Conversions.cpp \
@@ -20,14 +21,19 @@
     VisualizerEffect.cpp \
 
 LOCAL_SHARED_LIBRARIES := \
+    libbase \
+    libcutils \
+    libeffects \
+    libfmq \
     libhidlbase \
+    libhidlmemory \
     libhidltransport \
     libhwbinder \
-    libutils \
-    libeffects \
     liblog \
+    libutils \
     android.hardware.audio.common@2.0 \
     android.hardware.audio.common@2.0-util \
     android.hardware.audio.effect@2.0 \
+    android.hidl.memory@1.0 \
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/audio/effect/2.0/default/AudioBufferManager.cpp b/audio/effect/2.0/default/AudioBufferManager.cpp
new file mode 100644
index 0000000..603dbb8
--- /dev/null
+++ b/audio/effect/2.0/default/AudioBufferManager.cpp
@@ -0,0 +1,88 @@
+/*
+ * 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 <atomic>
+
+#include <hidlmemory/mapping.h>
+
+#include "AudioBufferManager.h"
+
+namespace android {
+
+ANDROID_SINGLETON_STATIC_INSTANCE(AudioBufferManager);
+
+bool AudioBufferManager::wrap(const AudioBuffer& buffer, sp<AudioBufferWrapper>* wrapper) {
+    // Check if we have this buffer already
+    std::lock_guard<std::mutex> lock(mLock);
+    ssize_t idx = mBuffers.indexOfKey(buffer.id);
+    if (idx >= 0) {
+        *wrapper = mBuffers[idx].promote();
+        if (*wrapper != nullptr) return true;
+        mBuffers.removeItemsAt(idx);
+    }
+    // Need to create and init a new AudioBufferWrapper.
+    sp<AudioBufferWrapper> tempBuffer(new AudioBufferWrapper(buffer));
+    if (!tempBuffer->init()) return false;
+    *wrapper = tempBuffer;
+    mBuffers.add(buffer.id, *wrapper);
+    return true;
+}
+
+void AudioBufferManager::removeEntry(uint64_t id) {
+    std::lock_guard<std::mutex> lock(mLock);
+    ssize_t idx = mBuffers.indexOfKey(id);
+    if (idx >= 0) mBuffers.removeItemsAt(idx);
+}
+
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+AudioBufferWrapper::AudioBufferWrapper(const AudioBuffer& buffer) :
+        mHidlBuffer(buffer), mHalBuffer{ 0, { nullptr } } {
+}
+
+AudioBufferWrapper::~AudioBufferWrapper() {
+    AudioBufferManager::getInstance().removeEntry(mHidlBuffer.id);
+}
+
+bool AudioBufferWrapper::init() {
+    if (mHalBuffer.raw != nullptr) {
+        ALOGE("An attempt to init AudioBufferWrapper twice");
+        return false;
+    }
+    mHidlMemory = mapMemory(mHidlBuffer.data);
+    if (mHidlMemory == nullptr) {
+        ALOGE("Could not map HIDL memory to IMemory");
+        return false;
+    }
+    mHalBuffer.raw = static_cast<void*>(mHidlMemory->getPointer());
+    if (mHalBuffer.raw == nullptr) {
+        ALOGE("IMemory buffer pointer is null");
+        return false;
+    }
+    mHalBuffer.frameCount = mHidlBuffer.frameCount;
+    return true;
+}
+
+}  // namespace implementation
+}  // namespace V2_0
+}  // namespace effect
+}  // namespace audio
+}  // namespace hardware
+}  // namespace android
diff --git a/audio/effect/2.0/default/AudioBufferManager.h b/audio/effect/2.0/default/AudioBufferManager.h
new file mode 100644
index 0000000..6d65995
--- /dev/null
+++ b/audio/effect/2.0/default/AudioBufferManager.h
@@ -0,0 +1,82 @@
+/*
+ * 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 android_hardware_audio_effect_V2_0_AudioBufferManager_H_
+#define android_hardware_audio_effect_V2_0_AudioBufferManager_H_
+
+#include <mutex>
+
+#include <android/hardware/audio/effect/2.0/types.h>
+#include <android/hidl/memory/1.0/IMemory.h>
+#include <system/audio_effect.h>
+#include <utils/RefBase.h>
+#include <utils/KeyedVector.h>
+#include <utils/Singleton.h>
+
+using ::android::hardware::audio::effect::V2_0::AudioBuffer;
+using ::android::hidl::memory::V1_0::IMemory;
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+class AudioBufferWrapper : public RefBase {
+  public:
+    explicit AudioBufferWrapper(const AudioBuffer& buffer);
+    virtual ~AudioBufferWrapper();
+    bool init();
+    audio_buffer_t* getHalBuffer() { return &mHalBuffer; }
+  private:
+    AudioBufferWrapper(const AudioBufferWrapper&) = delete;
+    void operator=(AudioBufferWrapper) = delete;
+
+    AudioBuffer mHidlBuffer;
+    sp<IMemory> mHidlMemory;
+    audio_buffer_t mHalBuffer;
+};
+
+}  // namespace implementation
+}  // namespace V2_0
+}  // namespace effect
+}  // namespace audio
+}  // namespace hardware
+}  // namespace android
+
+using ::android::hardware::audio::effect::V2_0::implementation::AudioBufferWrapper;
+
+namespace android {
+
+// This class needs to be in 'android' ns because Singleton macros require that.
+class AudioBufferManager : public Singleton<AudioBufferManager> {
+  public:
+    bool wrap(const AudioBuffer& buffer, sp<AudioBufferWrapper>* wrapper);
+
+  private:
+    friend class hardware::audio::effect::V2_0::implementation::AudioBufferWrapper;
+
+    // Called by AudioBufferWrapper.
+    void removeEntry(uint64_t id);
+
+    std::mutex mLock;
+    KeyedVector<uint64_t, wp<AudioBufferWrapper>> mBuffers;
+};
+
+}  // namespace android
+
+#endif  // android_hardware_audio_effect_V2_0_AudioBufferManager_H_
diff --git a/audio/effect/2.0/default/AutomaticGainControlEffect.cpp b/audio/effect/2.0/default/AutomaticGainControlEffect.cpp
index 6ebfb3c..2c386d3 100644
--- a/audio/effect/2.0/default/AutomaticGainControlEffect.cpp
+++ b/audio/effect/2.0/default/AutomaticGainControlEffect.cpp
@@ -130,16 +130,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> AutomaticGainControlEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> AutomaticGainControlEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> AutomaticGainControlEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> AutomaticGainControlEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> AutomaticGainControlEffect::command(
@@ -182,6 +180,10 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> AutomaticGainControlEffect::close() {
+    return mEffect->close();
+}
+
 // Methods from ::android::hardware::audio::effect::V2_0::IAutomaticGainControlEffect follow.
 Return<Result> AutomaticGainControlEffect::setTargetLevel(int16_t targetLevelMb)  {
     return mEffect->setParam(AGC_PARAM_TARGET_LEVEL, targetLevelMb);
diff --git a/audio/effect/2.0/default/AutomaticGainControlEffect.h b/audio/effect/2.0/default/AutomaticGainControlEffect.h
index 1696d3c..73d94a5 100644
--- a/audio/effect/2.0/default/AutomaticGainControlEffect.h
+++ b/audio/effect/2.0/default/AutomaticGainControlEffect.h
@@ -71,12 +71,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -99,6 +96,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::IAutomaticGainControlEffect follow.
     Return<Result> setTargetLevel(int16_t targetLevelMb)  override;
diff --git a/audio/effect/2.0/default/BassBoostEffect.cpp b/audio/effect/2.0/default/BassBoostEffect.cpp
index 8a64806..4120e6e 100644
--- a/audio/effect/2.0/default/BassBoostEffect.cpp
+++ b/audio/effect/2.0/default/BassBoostEffect.cpp
@@ -115,16 +115,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> BassBoostEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> BassBoostEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> BassBoostEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> BassBoostEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> BassBoostEffect::command(
@@ -167,6 +165,10 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> BassBoostEffect::close() {
+    return mEffect->close();
+}
+
 // Methods from ::android::hardware::audio::effect::V2_0::IBassBoostEffect follow.
 Return<void> BassBoostEffect::isStrengthSupported(isStrengthSupported_cb _hidl_cb)  {
     return mEffect->getIntegerParam(BASSBOOST_PARAM_STRENGTH_SUPPORTED, _hidl_cb);
diff --git a/audio/effect/2.0/default/BassBoostEffect.h b/audio/effect/2.0/default/BassBoostEffect.h
index 6636717..1861937 100644
--- a/audio/effect/2.0/default/BassBoostEffect.h
+++ b/audio/effect/2.0/default/BassBoostEffect.h
@@ -69,12 +69,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -97,6 +94,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::IBassBoostEffect follow.
     Return<void> isStrengthSupported(isStrengthSupported_cb _hidl_cb)  override;
diff --git a/audio/effect/2.0/default/DownmixEffect.cpp b/audio/effect/2.0/default/DownmixEffect.cpp
index 40bb5ec..41497d0 100644
--- a/audio/effect/2.0/default/DownmixEffect.cpp
+++ b/audio/effect/2.0/default/DownmixEffect.cpp
@@ -115,16 +115,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> DownmixEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> DownmixEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> DownmixEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> DownmixEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> DownmixEffect::command(
@@ -167,6 +165,10 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> DownmixEffect::close() {
+    return mEffect->close();
+}
+
 // Methods from ::android::hardware::audio::effect::V2_0::IDownmixEffect follow.
 Return<Result> DownmixEffect::setType(IDownmixEffect::Type preset)  {
     return mEffect->setParam(DOWNMIX_PARAM_TYPE, static_cast<downmix_type_t>(preset));
diff --git a/audio/effect/2.0/default/DownmixEffect.h b/audio/effect/2.0/default/DownmixEffect.h
index c7e1b9b..1d4c3a9 100644
--- a/audio/effect/2.0/default/DownmixEffect.h
+++ b/audio/effect/2.0/default/DownmixEffect.h
@@ -69,12 +69,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -97,6 +94,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::IDownmixEffect follow.
     Return<Result> setType(IDownmixEffect::Type preset)  override;
diff --git a/audio/effect/2.0/default/Effect.cpp b/audio/effect/2.0/default/Effect.cpp
index 1a7ea9c..9ca5834 100644
--- a/audio/effect/2.0/default/Effect.cpp
+++ b/audio/effect/2.0/default/Effect.cpp
@@ -17,8 +17,8 @@
 #include <memory.h>
 
 #define LOG_TAG "EffectHAL"
-#include <media/EffectsFactoryApi.h>
 #include <android/log.h>
+#include <media/EffectsFactoryApi.h>
 
 #include "Conversions.h"
 #include "Effect.h"
@@ -33,20 +33,108 @@
 
 using ::android::hardware::audio::common::V2_0::AudioChannelMask;
 using ::android::hardware::audio::common::V2_0::AudioFormat;
+using ::android::hardware::audio::effect::V2_0::MessageQueueFlagBits;
+
+namespace {
+
+class ProcessThread : public Thread {
+  public:
+    // ProcessThread's lifespan never exceeds Effect's lifespan.
+    ProcessThread(std::atomic<bool>* stop,
+            effect_handle_t effect,
+            std::atomic<audio_buffer_t*>* inBuffer,
+            std::atomic<audio_buffer_t*>* outBuffer,
+            Effect::StatusMQ* statusMQ,
+            EventFlag* efGroup)
+            : Thread(false /*canCallJava*/),
+              mStop(stop),
+              mEffect(effect),
+              mHasProcessReverse((*mEffect)->process_reverse != NULL),
+              mInBuffer(inBuffer),
+              mOutBuffer(outBuffer),
+              mStatusMQ(statusMQ),
+              mEfGroup(efGroup) {
+    }
+    virtual ~ProcessThread() {}
+
+  private:
+    std::atomic<bool>* mStop;
+    effect_handle_t mEffect;
+    bool mHasProcessReverse;
+    std::atomic<audio_buffer_t*>* mInBuffer;
+    std::atomic<audio_buffer_t*>* mOutBuffer;
+    Effect::StatusMQ* mStatusMQ;
+    EventFlag* mEfGroup;
+
+    bool threadLoop() override;
+};
+
+bool ProcessThread::threadLoop() {
+    // This implementation doesn't return control back to the Thread until it decides to stop,
+    // as the Thread uses mutexes, and this can lead to priority inversion.
+    while(!std::atomic_load_explicit(mStop, std::memory_order_acquire)) {
+        uint32_t efState = 0;
+        mEfGroup->wait(
+                static_cast<uint32_t>(MessageQueueFlagBits::REQUEST_PROCESS_ALL),
+                &efState,
+                NS_PER_SEC);
+        if (!(efState & static_cast<uint32_t>(MessageQueueFlagBits::REQUEST_PROCESS_ALL))) {
+            continue;  // Nothing to do.
+        }
+        Result retval = Result::OK;
+        if (efState & static_cast<uint32_t>(MessageQueueFlagBits::REQUEST_PROCESS_REVERSE)
+                && !mHasProcessReverse) {
+            retval = Result::NOT_SUPPORTED;
+        }
+
+        if (retval == Result::OK) {
+            // affects both buffer pointers and their contents.
+            std::atomic_thread_fence(std::memory_order_acquire);
+            int32_t processResult;
+            audio_buffer_t* inBuffer =
+                    std::atomic_load_explicit(mInBuffer, std::memory_order_relaxed);
+            audio_buffer_t* outBuffer =
+                    std::atomic_load_explicit(mOutBuffer, std::memory_order_relaxed);
+            if (inBuffer != nullptr && outBuffer != nullptr) {
+                if (efState & static_cast<uint32_t>(MessageQueueFlagBits::REQUEST_PROCESS)) {
+                    processResult = (*mEffect)->process(mEffect, inBuffer, outBuffer);
+                } else {
+                    processResult = (*mEffect)->process_reverse(mEffect, inBuffer, outBuffer);
+                }
+                std::atomic_thread_fence(std::memory_order_release);
+            } else {
+                ALOGE("processing buffers were not set before calling 'process'");
+                processResult = -ENODEV;
+            }
+            switch(processResult) {
+                case 0: retval = Result::OK; break;
+                case -ENODATA: retval = Result::INVALID_STATE; break;
+                case -EINVAL: retval = Result::INVALID_ARGUMENTS; break;
+                default: retval = Result::NOT_INITIALIZED;
+            }
+        }
+        if (!mStatusMQ->write(&retval)) {
+            ALOGW("status message queue write failed");
+        }
+        mEfGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::DONE_PROCESSING));
+    }
+
+    return false;
+}
+
+}  // namespace
 
 // static
 const char *Effect::sContextResultOfCommand = "returned status";
 const char *Effect::sContextCallToCommand = "error";
 const char *Effect::sContextCallFunction = sContextCallToCommand;
 
-Effect::Effect(effect_handle_t handle) : mHandle(handle) {
+Effect::Effect(effect_handle_t handle)
+        : mIsClosed(false), mHandle(handle), mEfGroup(nullptr), mStopProcessThread(false) {
 }
 
 Effect::~Effect() {
-    int status = EffectRelease(mHandle);
-    ALOGW_IF(status, "Error releasing effect %p: %s", mHandle, strerror(-status));
-    EffectMap::getInstance().remove(mHandle);
-    mHandle = 0;
+    close();
 }
 
 // static
@@ -83,9 +171,6 @@
 // static
 void Effect::effectBufferConfigFromHal(
         const buffer_config_t& halConfig, EffectBufferConfig* config) {
-    // TODO(mnaganov): Use FMQ instead of AudioBuffer.
-    (void)halConfig.buffer.frameCount;
-    (void)halConfig.buffer.raw;
     config->samplingRateHz = halConfig.samplingRate;
     config->channels = AudioChannelMask(halConfig.channels);
     config->format = AudioFormat(halConfig.format);
@@ -95,12 +180,13 @@
 
 // static
 void Effect::effectBufferConfigToHal(const EffectBufferConfig& config, buffer_config_t* halConfig) {
-    // TODO(mnaganov): Use FMQ instead of AudioBuffer.
+    // Note: setting the buffers directly is considered obsolete. They need to be set
+    // using 'setProcessBuffers'.
     halConfig->buffer.frameCount = 0;
     halConfig->buffer.raw = NULL;
     halConfig->samplingRate = config.samplingRateHz;
     halConfig->channels = static_cast<uint32_t>(config.channels);
-    // TODO(mnaganov): As the calling code does not use BP for now, implement later.
+    // TODO(mnaganov): The framework code currently does not use BP, implement later.
     halConfig->bufferProvider.cookie = NULL;
     halConfig->bufferProvider.getBuffer = NULL;
     halConfig->bufferProvider.releaseBuffer = NULL;
@@ -250,31 +336,66 @@
             });
 }
 
-void Effect::processImpl(
-        ProcessFunction process,
-        const char* funcName,
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        ProcessCallback cb) {
-    audio_buffer_t halInBuffer;
-    halInBuffer.frameCount = inBuffer.frameCount;
-    halInBuffer.u8 = const_cast<uint8_t*>(&inBuffer.data[0]);
-    audio_buffer_t halOutBuffer;
-    halOutBuffer.frameCount = halInBuffer.frameCount;
-    // TODO(mnaganov): Consider stashing the buffer to avoid reallocating it every time.
-    std::unique_ptr<uint8_t[]> halOutBufferData(
-            new uint8_t[halOutBuffer.frameCount * outFrameSize]);
-    halOutBuffer.u8 = &halOutBufferData[0];
-    status_t status = process(mHandle, &halInBuffer, &halOutBuffer);
-    Result retval = analyzeStatus(funcName, "", sContextCallFunction, status);
-    AudioBuffer outBuffer;
-    if (status == OK) {
-        outBuffer.frameCount = halOutBuffer.frameCount;
-        outBuffer.data.setToExternal(halOutBuffer.u8, halOutBuffer.frameCount * outFrameSize);
-    } else {
-        outBuffer.frameCount = 0;
+Return<void> Effect::prepareForProcessing(prepareForProcessing_cb _hidl_cb) {
+    status_t status;
+    // Create message queue.
+    if (mStatusMQ) {
+        ALOGE("the client attempts to call prepareForProcessing_cb twice");
+        _hidl_cb(Result::INVALID_STATE, StatusMQ::Descriptor());
+        return Void();
     }
-    cb(retval, outBuffer);
+    std::unique_ptr<StatusMQ> tempStatusMQ(new StatusMQ(1, true /*EventFlag*/));
+    if (!tempStatusMQ->isValid()) {
+        ALOGE_IF(!tempStatusMQ->isValid(), "status MQ is invalid");
+        _hidl_cb(Result::INVALID_ARGUMENTS, StatusMQ::Descriptor());
+        return Void();
+    }
+    status = EventFlag::createEventFlag(tempStatusMQ->getEventFlagWord(), &mEfGroup);
+    if (status != OK || !mEfGroup) {
+        ALOGE("failed creating event flag for status MQ: %s", strerror(-status));
+        _hidl_cb(Result::INVALID_ARGUMENTS, StatusMQ::Descriptor());
+        return Void();
+    }
+
+    // Create and launch the thread.
+    mProcessThread = new ProcessThread(
+            &mStopProcessThread,
+            mHandle,
+            &mHalInBufferPtr,
+            &mHalOutBufferPtr,
+            tempStatusMQ.get(),
+            mEfGroup);
+    status = mProcessThread->run("effect", PRIORITY_URGENT_AUDIO);
+    if (status != OK) {
+        ALOGW("failed to start effect processing thread: %s", strerror(-status));
+        _hidl_cb(Result::INVALID_ARGUMENTS, MQDescriptorSync<Result>());
+        return Void();
+    }
+
+    mStatusMQ = std::move(tempStatusMQ);
+    _hidl_cb(Result::OK, *mStatusMQ->getDesc());
+    return Void();
+}
+
+Return<Result> Effect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    AudioBufferManager& manager = AudioBufferManager::getInstance();
+    sp<AudioBufferWrapper> tempInBuffer, tempOutBuffer;
+    if (!manager.wrap(inBuffer, &tempInBuffer)) {
+        ALOGE("Could not map memory of the input buffer");
+        return Result::INVALID_ARGUMENTS;
+    }
+    if (!manager.wrap(outBuffer, &tempOutBuffer)) {
+        ALOGE("Could not map memory of the output buffer");
+        return Result::INVALID_ARGUMENTS;
+    }
+    mInBuffer = tempInBuffer;
+    mOutBuffer = tempOutBuffer;
+    // The processing thread only reads these pointers after waking up by an event flag,
+    // so it's OK to update the pair non-atomically.
+    mHalInBufferPtr.store(mInBuffer->getHalBuffer(), std::memory_order_release);
+    mHalOutBufferPtr.store(mOutBuffer->getHalBuffer(), std::memory_order_release);
+    return Result::OK;
 }
 
 Result Effect::sendCommand(int commandCode, const char* commandName) {
@@ -510,23 +631,6 @@
     return Void();
 }
 
-Return<void> Effect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  {
-    processImpl((*mHandle)->process, "process", inBuffer, outFrameSize, _hidl_cb);
-    return Void();
-}
-
-Return<void> Effect::processReverse(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, processReverse_cb _hidl_cb)  {
-    if ((*mHandle)->process_reverse != NULL) {
-        processImpl(
-                (*mHandle)->process_reverse, "process_reverse", inBuffer, outFrameSize, _hidl_cb);
-    } else {
-        _hidl_cb(Result::NOT_SUPPORTED, AudioBuffer());
-    }
-    return Void();
-}
-
 Return<void> Effect::command(
         uint32_t commandId,
         const hidl_vec<uint8_t>& data,
@@ -611,6 +715,27 @@
             EFFECT_CMD_SET_FEATURE_CONFIG, "SET_FEATURE_CONFIG", sizeof(halCmd), halCmd);
 }
 
+Return<Result> Effect::close() {
+    if (mIsClosed) return Result::INVALID_STATE;
+    mIsClosed = true;
+    if (mProcessThread.get()) {
+        mStopProcessThread.store(true, std::memory_order_release);
+        status_t status = mProcessThread->requestExitAndWait();
+        ALOGE_IF(status, "processing thread exit error: %s", strerror(-status));
+    }
+    if (mEfGroup) {
+        status_t status = EventFlag::deleteEventFlag(&mEfGroup);
+        ALOGE_IF(status, "processing MQ event flag deletion error: %s", strerror(-status));
+    }
+    mInBuffer.clear();
+    mOutBuffer.clear();
+    int status = EffectRelease(mHandle);
+    ALOGW_IF(status, "Error releasing effect %p: %s", mHandle, strerror(-status));
+    EffectMap::getInstance().remove(mHandle);
+    mHandle = 0;
+    return Result::OK;
+}
+
 } // namespace implementation
 }  // namespace V2_0
 }  // namespace effect
diff --git a/audio/effect/2.0/default/Effect.h b/audio/effect/2.0/default/Effect.h
index 61d0121..8daffb8 100644
--- a/audio/effect/2.0/default/Effect.h
+++ b/audio/effect/2.0/default/Effect.h
@@ -17,16 +17,21 @@
 #ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECT_H
 #define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECT_H
 
+#include <atomic>
 #include <memory>
 #include <vector>
 
 #include <android/hardware/audio/effect/2.0/IEffect.h>
-#include <hidl/Status.h>
-
+#include <fmq/EventFlag.h>
+#include <fmq/MessageQueue.h>
 #include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+#include <utils/Thread.h>
 
 #include <hardware/audio_effect.h>
 
+#include "AudioBufferManager.h"
+
 namespace android {
 namespace hardware {
 namespace audio {
@@ -54,6 +59,8 @@
 using ::android::sp;
 
 struct Effect : public IEffect {
+    typedef MessageQueue<Result, kSynchronizedReadWrite> StatusMQ;
+
     explicit Effect(effect_handle_t handle);
 
     // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
@@ -83,12 +90,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -111,6 +115,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Utility methods for extending interfaces.
     template<typename T> Return<void> getIntegerParam(
@@ -161,8 +166,6 @@
     friend struct VirtualizerEffect;  // for getParameterImpl
     friend struct VisualizerEffect;   // to allow executing commands
 
-    typedef int32_t (*ProcessFunction)(
-            effect_handle_t self, audio_buffer_t* inBuffer, audio_buffer_t* outBuffer);
     using CommandSuccessCallback = std::function<void()>;
     using GetConfigCallback = std::function<void(Result retval, const EffectConfig& config)>;
     using GetCurrentConfigSuccessCallback = std::function<void(void* configData)>;
@@ -170,13 +173,21 @@
             std::function<void(uint32_t valueSize, const void* valueData)>;
     using GetSupportedConfigsSuccessCallback =
             std::function<void(uint32_t supportedConfigs, void* configsData)>;
-    using ProcessCallback = std::function<void(Result retval, const AudioBuffer& outBuffer)>;
 
     static const char *sContextResultOfCommand;
     static const char *sContextCallToCommand;
     static const char *sContextCallFunction;
 
+    bool mIsClosed;
     effect_handle_t mHandle;
+    sp<AudioBufferWrapper> mInBuffer;
+    sp<AudioBufferWrapper> mOutBuffer;
+    std::atomic<audio_buffer_t*> mHalInBufferPtr;
+    std::atomic<audio_buffer_t*> mHalOutBufferPtr;
+    std::unique_ptr<StatusMQ> mStatusMQ;
+    EventFlag* mEfGroup;
+    std::atomic<bool> mStopProcessThread;
+    sp<Thread> mProcessThread;
 
     virtual ~Effect();
 
@@ -218,12 +229,6 @@
             uint32_t maxConfigs,
             uint32_t configSize,
             GetSupportedConfigsSuccessCallback onSuccess);
-    void processImpl(
-            ProcessFunction process,
-            const char* funcName,
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            ProcessCallback cb);
     Result sendCommand(int commandCode, const char* commandName);
     Result sendCommand(int commandCode, const char* commandName, uint32_t size, void* data);
     Result sendCommandReturningData(
diff --git a/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp b/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp
index db1ad51..2c1fd68 100644
--- a/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp
+++ b/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp
@@ -144,16 +144,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> EnvironmentalReverbEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> EnvironmentalReverbEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> EnvironmentalReverbEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> EnvironmentalReverbEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> EnvironmentalReverbEffect::command(
@@ -196,6 +194,9 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> EnvironmentalReverbEffect::close() {
+    return mEffect->close();
+}
 
 // Methods from ::android::hardware::audio::effect::V2_0::IEnvironmentalReverbEffect follow.
 Return<Result> EnvironmentalReverbEffect::setBypass(bool bypass)  {
diff --git a/audio/effect/2.0/default/EnvironmentalReverbEffect.h b/audio/effect/2.0/default/EnvironmentalReverbEffect.h
index edb5747..d0c8962 100644
--- a/audio/effect/2.0/default/EnvironmentalReverbEffect.h
+++ b/audio/effect/2.0/default/EnvironmentalReverbEffect.h
@@ -81,12 +81,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -109,6 +106,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::IEnvironmentalReverbEffect follow.
     Return<Result> setBypass(bool bypass)  override;
diff --git a/audio/effect/2.0/default/EqualizerEffect.cpp b/audio/effect/2.0/default/EqualizerEffect.cpp
index 490a300..833ea5b 100644
--- a/audio/effect/2.0/default/EqualizerEffect.cpp
+++ b/audio/effect/2.0/default/EqualizerEffect.cpp
@@ -135,16 +135,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> EqualizerEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> EqualizerEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> EqualizerEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> EqualizerEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> EqualizerEffect::command(
@@ -187,6 +185,9 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> EqualizerEffect::close() {
+    return mEffect->close();
+}
 
 // Methods from ::android::hardware::audio::effect::V2_0::IEqualizerEffect follow.
 Return<void> EqualizerEffect::getNumBands(getNumBands_cb _hidl_cb)  {
diff --git a/audio/effect/2.0/default/EqualizerEffect.h b/audio/effect/2.0/default/EqualizerEffect.h
index ba99e2b..200ca1a 100644
--- a/audio/effect/2.0/default/EqualizerEffect.h
+++ b/audio/effect/2.0/default/EqualizerEffect.h
@@ -83,12 +83,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -111,6 +108,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::IEqualizerEffect follow.
     Return<void> getNumBands(getNumBands_cb _hidl_cb)  override;
diff --git a/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp b/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp
index a49019c..1f7124b 100644
--- a/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp
+++ b/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp
@@ -117,16 +117,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> LoudnessEnhancerEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> LoudnessEnhancerEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> LoudnessEnhancerEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> LoudnessEnhancerEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> LoudnessEnhancerEffect::command(
@@ -169,6 +167,9 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> LoudnessEnhancerEffect::close() {
+    return mEffect->close();
+}
 
 // Methods from ::android::hardware::audio::effect::V2_0::ILoudnessEnhancerEffect follow.
 Return<Result> LoudnessEnhancerEffect::setTargetGain(int32_t targetGainMb)  {
diff --git a/audio/effect/2.0/default/LoudnessEnhancerEffect.h b/audio/effect/2.0/default/LoudnessEnhancerEffect.h
index 8ca6e94..308c47f 100644
--- a/audio/effect/2.0/default/LoudnessEnhancerEffect.h
+++ b/audio/effect/2.0/default/LoudnessEnhancerEffect.h
@@ -79,12 +79,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -107,6 +104,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::ILoudnessEnhancerEffect follow.
     Return<Result> setTargetGain(int32_t targetGainMb)  override;
diff --git a/audio/effect/2.0/default/NoiseSuppressionEffect.cpp b/audio/effect/2.0/default/NoiseSuppressionEffect.cpp
index 69a1226..b0b929f 100644
--- a/audio/effect/2.0/default/NoiseSuppressionEffect.cpp
+++ b/audio/effect/2.0/default/NoiseSuppressionEffect.cpp
@@ -128,16 +128,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> NoiseSuppressionEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> NoiseSuppressionEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> NoiseSuppressionEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> NoiseSuppressionEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> NoiseSuppressionEffect::command(
@@ -180,6 +178,9 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> NoiseSuppressionEffect::close() {
+    return mEffect->close();
+}
 
 // Methods from ::android::hardware::audio::effect::V2_0::INoiseSuppressionEffect follow.
 Return<Result> NoiseSuppressionEffect::setSuppressionLevel(INoiseSuppressionEffect::Level level)  {
diff --git a/audio/effect/2.0/default/NoiseSuppressionEffect.h b/audio/effect/2.0/default/NoiseSuppressionEffect.h
index b73727e..5e3a5c1 100644
--- a/audio/effect/2.0/default/NoiseSuppressionEffect.h
+++ b/audio/effect/2.0/default/NoiseSuppressionEffect.h
@@ -81,12 +81,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -109,6 +106,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::INoiseSuppressionEffect follow.
     Return<Result> setSuppressionLevel(INoiseSuppressionEffect::Level level)  override;
diff --git a/audio/effect/2.0/default/PresetReverbEffect.cpp b/audio/effect/2.0/default/PresetReverbEffect.cpp
index 0e6d1b8..803c9be 100644
--- a/audio/effect/2.0/default/PresetReverbEffect.cpp
+++ b/audio/effect/2.0/default/PresetReverbEffect.cpp
@@ -115,16 +115,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> PresetReverbEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> PresetReverbEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> PresetReverbEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> PresetReverbEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> PresetReverbEffect::command(
@@ -167,6 +165,9 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> PresetReverbEffect::close() {
+    return mEffect->close();
+}
 
 // Methods from ::android::hardware::audio::effect::V2_0::IPresetReverbEffect follow.
 Return<Result> PresetReverbEffect::setPreset(IPresetReverbEffect::Preset preset)  {
diff --git a/audio/effect/2.0/default/PresetReverbEffect.h b/audio/effect/2.0/default/PresetReverbEffect.h
index 4d39569..f6a900c 100644
--- a/audio/effect/2.0/default/PresetReverbEffect.h
+++ b/audio/effect/2.0/default/PresetReverbEffect.h
@@ -79,12 +79,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -107,6 +104,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::IPresetReverbEffect follow.
     Return<Result> setPreset(IPresetReverbEffect::Preset preset)  override;
diff --git a/audio/effect/2.0/default/VirtualizerEffect.cpp b/audio/effect/2.0/default/VirtualizerEffect.cpp
index 313674d..4f193e7 100644
--- a/audio/effect/2.0/default/VirtualizerEffect.cpp
+++ b/audio/effect/2.0/default/VirtualizerEffect.cpp
@@ -127,16 +127,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> VirtualizerEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> VirtualizerEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> VirtualizerEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> VirtualizerEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> VirtualizerEffect::command(
@@ -179,6 +177,9 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> VirtualizerEffect::close() {
+    return mEffect->close();
+}
 
 // Methods from ::android::hardware::audio::effect::V2_0::IVirtualizerEffect follow.
 Return<bool> VirtualizerEffect::isStrengthSupported()  {
diff --git a/audio/effect/2.0/default/VirtualizerEffect.h b/audio/effect/2.0/default/VirtualizerEffect.h
index ba89a61..5b0773d 100644
--- a/audio/effect/2.0/default/VirtualizerEffect.h
+++ b/audio/effect/2.0/default/VirtualizerEffect.h
@@ -80,12 +80,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -108,6 +105,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::IVirtualizerEffect follow.
     Return<bool> isStrengthSupported()  override;
diff --git a/audio/effect/2.0/default/VisualizerEffect.cpp b/audio/effect/2.0/default/VisualizerEffect.cpp
index a53eabc..141817b 100644
--- a/audio/effect/2.0/default/VisualizerEffect.cpp
+++ b/audio/effect/2.0/default/VisualizerEffect.cpp
@@ -115,16 +115,14 @@
     return mEffect->getDescriptor(_hidl_cb);
 }
 
-Return<void> VisualizerEffect::process(
-        const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
-    return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+Return<void> VisualizerEffect::prepareForProcessing(
+        prepareForProcessing_cb _hidl_cb) {
+    return mEffect->prepareForProcessing(_hidl_cb);
 }
 
-Return<void> VisualizerEffect::processReverse(
-        const AudioBuffer& inBuffer,
-        uint32_t outFrameSize,
-        processReverse_cb _hidl_cb) {
-    return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+Return<Result> VisualizerEffect::setProcessBuffers(
+        const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
+    return mEffect->setProcessBuffers(inBuffer, outBuffer);
 }
 
 Return<void> VisualizerEffect::command(
@@ -167,6 +165,9 @@
     return mEffect->setCurrentConfigForFeature(featureId, configData);
 }
 
+Return<Result> VisualizerEffect::close() {
+    return mEffect->close();
+}
 
 // Methods from ::android::hardware::audio::effect::V2_0::IVisualizerEffect follow.
 Return<Result> VisualizerEffect::setCaptureSize(uint16_t captureSize)  {
diff --git a/audio/effect/2.0/default/VisualizerEffect.h b/audio/effect/2.0/default/VisualizerEffect.h
index ae0b05c..b6dc768 100644
--- a/audio/effect/2.0/default/VisualizerEffect.h
+++ b/audio/effect/2.0/default/VisualizerEffect.h
@@ -79,12 +79,9 @@
     Return<Result> setAudioSource(AudioSource source)  override;
     Return<Result> offload(const EffectOffloadParameter& param)  override;
     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
-    Return<void> process(
-            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
-    Return<void> processReverse(
-            const AudioBuffer& inBuffer,
-            uint32_t outFrameSize,
-            processReverse_cb _hidl_cb)  override;
+    Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
+    Return<Result> setProcessBuffers(
+            const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     Return<void> command(
             uint32_t commandId,
             const hidl_vec<uint8_t>& data,
@@ -107,6 +104,7 @@
             getCurrentConfigForFeature_cb _hidl_cb)  override;
     Return<Result> setCurrentConfigForFeature(
             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::effect::V2_0::IVisualizerEffect follow.
     Return<Result> setCaptureSize(uint16_t captureSize)  override;
diff --git a/audio/effect/2.0/types.hal b/audio/effect/2.0/types.hal
index ad7f4ce..0cac59a 100644
--- a/audio/effect/2.0/types.hal
+++ b/audio/effect/2.0/types.hal
@@ -222,10 +222,10 @@
  * samples for all channels at a given time. Frame size for unspecified format
  * (AUDIO_FORMAT_OTHER) is 8 bit by definition.
  */
-// TODO(mnaganov): replace with FMQ version.
 struct AudioBuffer {
+    uint64_t id;
     uint32_t frameCount;
-    vec<uint8_t> data;
+    memory data;
 };
 
 @export(name="effect_buffer_access_e", value_prefix="EFFECT_BUFFER_")
@@ -284,3 +284,14 @@
     AudioIoHandle ioHandle;  // io handle of the playback thread
                              // the effect is attached to
 };
+
+/*
+ * The message queue flags used to synchronize reads and writes from
+ * the status message queue used by effects.
+ */
+enum MessageQueueFlagBits : uint32_t {
+    DONE_PROCESSING = 1 << 0,
+    REQUEST_PROCESS = 1 << 1,
+    REQUEST_PROCESS_REVERSE = 1 << 2,
+    REQUEST_PROCESS_ALL = REQUEST_PROCESS | REQUEST_PROCESS_REVERSE
+};
diff --git a/boot/1.0/default/BootControl.cpp b/boot/1.0/default/BootControl.cpp
index 54c1928..828da16 100644
--- a/boot/1.0/default/BootControl.cpp
+++ b/boot/1.0/default/BootControl.cpp
@@ -14,7 +14,8 @@
  * limitations under the License.
  */
 #define LOG_TAG "android.hardware.boot@1.0-impl"
-#include <android/log.h>
+
+#include <log/log.h>
 
 #include <hardware/hardware.h>
 #include <hardware/boot_control.h>
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index de61d83..201a3b4 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -97,6 +97,9 @@
 //TODO(b/34110242): make this hidl transport agnostic
 #ifdef BINDERIZED
             fd = dup(handle->data[0]);
+            // TODO(b/34169301)
+            // Camera service expect FD be closed by HAL process (in passthrough mode)
+            // close(handle->data[0]);
 #else
             fd = handle->data[0];
 #endif
@@ -695,14 +698,16 @@
         if (hasInputBuf) {
             int streamId = static_cast<Camera3Stream*>(hal_result->input_buffer->stream)->mId;
             auto key = std::make_pair(streamId, frameNumber);
-            sHandleImporter.closeFence(d->mInflightBuffers[key].acquire_fence);
+            // TODO (b/34169301): currently HAL closed the fence
+            //sHandleImporter.closeFence(d->mInflightBuffers[key].acquire_fence);
             d->mInflightBuffers.erase(key);
         }
 
         for (size_t i = 0; i < numOutputBufs; i++) {
             int streamId = static_cast<Camera3Stream*>(hal_result->output_buffers[i].stream)->mId;
             auto key = std::make_pair(streamId, frameNumber);
-            sHandleImporter.closeFence(d->mInflightBuffers[key].acquire_fence);
+            // TODO (b/34169301): currently HAL closed the fence
+            //sHandleImporter.closeFence(d->mInflightBuffers[key].acquire_fence);
             d->mInflightBuffers.erase(key);
         }
 
diff --git a/contexthub/1.0/IContexthub.hal b/contexthub/1.0/IContexthub.hal
index 8c792fd..1d136d3 100644
--- a/contexthub/1.0/IContexthub.hal
+++ b/contexthub/1.0/IContexthub.hal
@@ -62,6 +62,13 @@
      *
      * Loading a nanoapp must not take more than 30 seconds.
      *
+     * Depending on the implementation, nanoApps loaded via this API may or may
+     * not persist across reboots of the hub. If they do persist, the
+     * implementation must initially place nanoApps in the disabled state upon a
+     * reboot, and not start them until a call is made to enableNanoApp(). In
+     * this case, the app must also be unloaded upon a factory reset of the
+     * device.
+     *
      * @param hubId identifer of the contextHub
      *        appBinary serialized NanoApppBinary for the nanoApp
      *        transactionId transactionId for this call
@@ -154,18 +161,4 @@
      *
      */
     queryApps(uint32_t hubId) generates (Result result);
-
-    /**
-     * Reboots context hub OS, restarts all the nanoApps.
-     * No reboot notification is sent to nanoApps; reboot happens immediately
-     * and unconditionally; all volatile contexthub state and any data is lost
-     * as a result.
-     *
-     * @param hubId identifer of the contextHub
-     *
-     * @return result OK on success
-     *                BAD_VALUE if parameters are not sane
-     *
-     */
-    reboot(uint32_t hubId) generates (Result result);
 };
diff --git a/gnss/1.0/Android.bp b/gnss/1.0/Android.bp
index a69d30b..10ab932 100644
--- a/gnss/1.0/Android.bp
+++ b/gnss/1.0/Android.bp
@@ -11,6 +11,8 @@
         "IAGnssRil.hal",
         "IAGnssRilCallback.hal",
         "IGnss.hal",
+        "IGnssBatching.hal",
+        "IGnssBatchingCallback.hal",
         "IGnssCallback.hal",
         "IGnssConfiguration.hal",
         "IGnssDebug.hal",
@@ -32,6 +34,8 @@
         "android/hardware/gnss/1.0/AGnssRilAll.cpp",
         "android/hardware/gnss/1.0/AGnssRilCallbackAll.cpp",
         "android/hardware/gnss/1.0/GnssAll.cpp",
+        "android/hardware/gnss/1.0/GnssBatchingAll.cpp",
+        "android/hardware/gnss/1.0/GnssBatchingCallbackAll.cpp",
         "android/hardware/gnss/1.0/GnssCallbackAll.cpp",
         "android/hardware/gnss/1.0/GnssConfigurationAll.cpp",
         "android/hardware/gnss/1.0/GnssDebugAll.cpp",
@@ -59,6 +63,8 @@
         "IAGnssRil.hal",
         "IAGnssRilCallback.hal",
         "IGnss.hal",
+        "IGnssBatching.hal",
+        "IGnssBatchingCallback.hal",
         "IGnssCallback.hal",
         "IGnssConfiguration.hal",
         "IGnssDebug.hal",
@@ -100,6 +106,16 @@
         "android/hardware/gnss/1.0/BnGnss.h",
         "android/hardware/gnss/1.0/BpGnss.h",
         "android/hardware/gnss/1.0/BsGnss.h",
+        "android/hardware/gnss/1.0/IGnssBatching.h",
+        "android/hardware/gnss/1.0/IHwGnssBatching.h",
+        "android/hardware/gnss/1.0/BnGnssBatching.h",
+        "android/hardware/gnss/1.0/BpGnssBatching.h",
+        "android/hardware/gnss/1.0/BsGnssBatching.h",
+        "android/hardware/gnss/1.0/IGnssBatchingCallback.h",
+        "android/hardware/gnss/1.0/IHwGnssBatchingCallback.h",
+        "android/hardware/gnss/1.0/BnGnssBatchingCallback.h",
+        "android/hardware/gnss/1.0/BpGnssBatchingCallback.h",
+        "android/hardware/gnss/1.0/BsGnssBatchingCallback.h",
         "android/hardware/gnss/1.0/IGnssCallback.h",
         "android/hardware/gnss/1.0/IHwGnssCallback.h",
         "android/hardware/gnss/1.0/BnGnssCallback.h",
diff --git a/gnss/1.0/Android.mk b/gnss/1.0/Android.mk
index d2c7fcf..d72280f 100644
--- a/gnss/1.0/Android.mk
+++ b/gnss/1.0/Android.mk
@@ -164,6 +164,8 @@
 $(GEN): $(LOCAL_PATH)/IAGnss.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IAGnssRil.hal
 $(GEN): $(LOCAL_PATH)/IAGnssRil.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGnssBatching.hal
+$(GEN): $(LOCAL_PATH)/IGnssBatching.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGnssCallback.hal
 $(GEN): $(LOCAL_PATH)/IGnssCallback.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGnssConfiguration.hal
@@ -195,6 +197,48 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build IGnssBatching.hal
+#
+GEN := $(intermediates)/android/hardware/gnss/V1_0/IGnssBatching.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IGnssBatching.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGnssBatchingCallback.hal
+$(GEN): $(LOCAL_PATH)/IGnssBatchingCallback.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.gnss@1.0::IGnssBatching
+
+$(GEN): $(LOCAL_PATH)/IGnssBatching.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IGnssBatchingCallback.hal
+#
+GEN := $(intermediates)/android/hardware/gnss/V1_0/IGnssBatchingCallback.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IGnssBatchingCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.gnss@1.0::IGnssBatchingCallback
+
+$(GEN): $(LOCAL_PATH)/IGnssBatchingCallback.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build IGnssCallback.hal
 #
 GEN := $(intermediates)/android/hardware/gnss/V1_0/IGnssCallback.java
@@ -623,6 +667,8 @@
 $(GEN): $(LOCAL_PATH)/IAGnss.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IAGnssRil.hal
 $(GEN): $(LOCAL_PATH)/IAGnssRil.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGnssBatching.hal
+$(GEN): $(LOCAL_PATH)/IGnssBatching.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGnssCallback.hal
 $(GEN): $(LOCAL_PATH)/IGnssCallback.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGnssConfiguration.hal
@@ -654,6 +700,48 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build IGnssBatching.hal
+#
+GEN := $(intermediates)/android/hardware/gnss/V1_0/IGnssBatching.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IGnssBatching.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IGnssBatchingCallback.hal
+$(GEN): $(LOCAL_PATH)/IGnssBatchingCallback.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.gnss@1.0::IGnssBatching
+
+$(GEN): $(LOCAL_PATH)/IGnssBatching.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IGnssBatchingCallback.hal
+#
+GEN := $(intermediates)/android/hardware/gnss/V1_0/IGnssBatchingCallback.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IGnssBatchingCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.gnss@1.0::IGnssBatchingCallback
+
+$(GEN): $(LOCAL_PATH)/IGnssBatchingCallback.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build IGnssCallback.hal
 #
 GEN := $(intermediates)/android/hardware/gnss/V1_0/IGnssCallback.java
diff --git a/gnss/1.0/IAGnssRilCallback.hal b/gnss/1.0/IAGnssRilCallback.hal
index 17122b2..ba29bd0 100644
--- a/gnss/1.0/IAGnssRilCallback.hal
+++ b/gnss/1.0/IAGnssRilCallback.hal
@@ -32,7 +32,7 @@
      *
      * @param setIdflag Specifies the kind of SET ID that is required by the HAL.
      */
-    requestSetIdCb(ID setIdflag);
+    requestSetIdCb(bitfield<ID> setIdflag);
 
     /*
      * The Hal uses this API to request a reference location.
diff --git a/gnss/1.0/IGnss.hal b/gnss/1.0/IGnss.hal
index cc19ef8..24a5371 100644
--- a/gnss/1.0/IGnss.hal
+++ b/gnss/1.0/IGnss.hal
@@ -18,6 +18,7 @@
 
 import IAGnss;
 import IAGnssRil;
+import IGnssBatching;
 import IGnssCallback;
 import IGnssConfiguration;
 import IGnssDebug;
@@ -81,14 +82,19 @@
     setCallback(IGnssCallback callback) generates (bool success);
 
     /*
-     * Starts navigating.
+     * Starts a location output stream using the IGnssCallback
+     * gnssLocationCb(), following the settings from the most recent call to
+     * setPositionMode().
+     *
+     * This output must operate independently of any GNSS location batching
+     * operations, see the IGnssBatching.hal for details.
      *
      * @return success Returns true on success.
      */
     start() generates (bool success);
 
     /*
-     * Stops navigating.
+     * Stops the location output stream.
      *
      * @return success Returns true on success.
      */
@@ -218,4 +224,11 @@
      * @return debugIface Handle to the IGnssDebug interface.
      */
     getExtensionGnssDebug() generates (IGnssDebug debugIface);
+
+    /*
+     * This method returns the IGnssBatching interface.
+     *
+     * @return batchingIface Handle to the IGnssBatching interface.
+     */
+    getExtensionGnssBatching() generates (IGnssBatching batchingIface);
 };
diff --git a/gnss/1.0/IGnssBatching.hal b/gnss/1.0/IGnssBatching.hal
new file mode 100644
index 0000000..4f0695d
--- /dev/null
+++ b/gnss/1.0/IGnssBatching.hal
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IGnssBatchingCallback;
+
+/*
+ * Extended interface for GNSS Batching support.
+ *
+ * If this interface is supported, this batching request must be able to run in
+ * parallel with, or without, non-batched location requested by the
+ * IGnss start() & stop() - i.e. both requests must be handled independently,
+ * and not interfere with each other.
+ *
+ * For example, if a 1Hz continuous output is underway on the IGnssCallback,
+ * due to an IGnss start() operation,
+ * and then a IGnssBatching start() is called for a location every 10
+ * seconds, the newly added batching request must not disrupt the 1Hz
+ * continuous location output on the IGnssCallback.
+ *
+ * As with GNSS Location outputs, source of location must be GNSS satellite
+ * measurements, optionally using interial and baro sensors to improve
+ * relative motion filtering. No additional absolute positioning information,
+ * such as WiFi derived location, may be mixed with the GNSS information.
+ */
+
+interface IGnssBatching {
+    /*
+     * Enum which holds the bit masks for batching control.
+     */
+    enum Flag : uint8_t {
+        /*
+         * If this flag is set, the hardware implementation
+         * must wake up the application processor when the FIFO is full, and
+         * call IGnssBatchingCallback to return the locations.
+         *
+         * If the flag is not set, the hardware implementation must drop
+         * the oldest data when the FIFO is full.
+         */
+        WAKEUP_ON_FIFO_FULL = 0x01
+    };
+
+    struct Options {
+        /*
+         * Time interval between samples in the location batch, in nano
+         * seconds.
+         */
+        int64_t periodNanos;
+
+        /*
+         * Flags controlling how batching should behave.
+         */
+        bitfield<Flag> flags;
+    };
+
+    /*
+     * Opens the interface and provides the callback routines
+     * to the implementation of this interface.
+     *
+     * @param callback Callback interface for IGnssBatching.
+     *
+     * @return success Returns true on success.
+     */
+    init(IGnssBatchingCallback callback) generates (bool success);
+
+    /*
+     * Return the batch size (in number of GnssLocation objects)
+     * available in this hardware implementation.
+     *
+     * If the available size is variable, for example, based on other operations
+     * consuming memory, this is the minimum size guaranteed to be available
+     * for batching operations.
+     *
+     * This may, for example, be used by the upper layer, to decide on the
+     * batching interval and whether the AP should be woken up or not.
+     *
+     * @return batchSize number of location objects supported per batch
+     */
+    getBatchSize() generates (uint16_t batchSize);
+
+    /*
+     * Start batching locations. This API is primarily used when the AP is
+     * asleep and the device can batch locations in the hardware.
+     *
+     * IGnssBatchingCallback is used to return the locations.
+     *
+     * When the buffer is full and WAKEUP_ON_FIFO_FULL is used,
+     * IGnssBatchingCallback must be called to return the locations.
+     *
+     * When the buffer is full and WAKEUP_ON_FIFO_FULL is not set,
+     * the oldest location object is dropped. In this case the AP must not be
+     * woken up. The AP would then generally be responsible for using
+     * flushBatchedLocation to explicitly ask for the location as needed,
+     * to avoid it being dropped.
+     *
+     * @param options See struct Options definition.
+     *
+     * @return success Returns true on success.
+     */
+    start(Options options) generates (bool success);
+
+    /**
+     * Retrieve all batched locations currently stored.
+     *
+     * IGnssBatchingCallback is used to return the location.
+     *
+     * IGnssBatchingCallback must be called in response, even if there are
+     * no locations to flush (in which case the Location vector must be empty).
+     *
+     * Subsequent calls to flushBatchedLocation
+     * must not return any of the locations returned in this call.
+     */
+    flush();
+
+    /**
+     * Stop batching.
+     *
+     * @return success Returns true on success.
+     */
+    stop() generates (bool success);
+
+    /**
+     * Closes the interface. If any batch operations are in progress,
+     * they should be stopped.
+     *
+     * init() may be called again, after this, if the interface is to be restored
+     */
+    cleanup();
+
+};
diff --git a/gnss/1.0/IGnssBatchingCallback.hal b/gnss/1.0/IGnssBatchingCallback.hal
new file mode 100644
index 0000000..a8f4b88
--- /dev/null
+++ b/gnss/1.0/IGnssBatchingCallback.hal
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+/* The callback interface to report measurements from the HAL. */
+interface IGnssBatchingCallback {
+    /*
+     * Called when a batch of locations is output, by various means, including
+     * a flush request, as well as the buffer becoming full (if appropriate option
+     * is set.)
+     *
+     * All locations returned by this callback must be cleared from the hardware
+     * buffer, such the sequential calls of this callback do not return any
+     * redundant locations.  (Same lat/lon, at a new time, is acceptable.)
+     *
+     * @param locations GNSS Location information from HAL.
+     */
+    gnssLocationBatchCb(vec<GnssLocation> locations);
+};
diff --git a/gnss/1.0/IGnssCallback.hal b/gnss/1.0/IGnssCallback.hal
index 97a28e2..b072807 100644
--- a/gnss/1.0/IGnssCallback.hal
+++ b/gnss/1.0/IGnssCallback.hal
@@ -179,7 +179,7 @@
      * @param capabilities Capability parameter is a bit field of
      * the Capabilities enum.
      */
-    gnssSetCapabilitesCb(uint32_t capabilities);
+    gnssSetCapabilitesCb(bitfield<Capabilities> capabilities);
 
     /*
      * Callback utility for acquiring the GNSS wakelock. This can be used to prevent
diff --git a/gnss/1.0/IGnssConfiguration.hal b/gnss/1.0/IGnssConfiguration.hal
index f8856b0..2fb6e4e 100644
--- a/gnss/1.0/IGnssConfiguration.hal
+++ b/gnss/1.0/IGnssConfiguration.hal
@@ -106,7 +106,7 @@
       *
       * @return success True if operation was successful.
       */
-     setSuplMode(uint8_t mode) generates (bool success);
+     setSuplMode(bitfield<SuplMode> mode) generates (bool success);
 
      /*
       * This setting configures how GPS functionalities should be locked when
@@ -117,7 +117,7 @@
       *
       * @return success True if operation was successful.
       */
-     setGpsLock(uint8_t lock) generates (bool success);
+     setGpsLock(bitfield<GpsLock> lock) generates (bool success);
 
      /*
       * This method sets the LTE Positioning Profile configuration.
@@ -127,17 +127,17 @@
       *
       * @return success True if operation was successful.
       */
-     setLppProfile(uint8_t lppProfile) generates (bool success);
+     setLppProfile(bitfield<LppProfile> lppProfile) generates (bool success);
 
      /*
       * This method selects positioning protocol on A-Glonass system.
       *
       * @param protocol Bitmask that specifies the positioning protocol to be
-      * set as per GlonassPositioningProtocol enum.
+      * set as per GlonassPosProtocol enum.
       *
       * @return success True if operation was successful.
       */
-     setGlonassPositioningProtocol(uint8_t protocol) generates (bool success);
+     setGlonassPositioningProtocol(bitfield<GlonassPosProtocol> protocol) generates (bool success);
 
      /*
       * This method configures which PDN to use.
diff --git a/gnss/1.0/IGnssGeofencing.hal b/gnss/1.0/IGnssGeofencing.hal
index 8417333..b8348b3 100644
--- a/gnss/1.0/IGnssGeofencing.hal
+++ b/gnss/1.0/IGnssGeofencing.hal
@@ -54,9 +54,10 @@
      * must be triggered. This parameter is defined in milliseconds.
      */
     addGeofence(int32_t geofenceId, double latitudeDegrees, double longitudeDegrees,
-        double radiusMeters, GeofenceTransition lastTransition,
-        int32_t monitorTransitions, uint32_t notificationResponsivenessMs,
-        uint32_t unknownTimerMs);
+            double radiusMeters, GeofenceTransition lastTransition,
+            bitfield<IGnssGeofenceCallback.GeofenceTransition> monitorTransitions,
+            uint32_t notificationResponsivenessMs,
+            uint32_t unknownTimerMs);
 
     /*
      * Pause monitoring a particular geofence.
@@ -74,7 +75,8 @@
      * UNCERTAIN. This supersedes the value associated
      * provided in the addGeofenceArea call.
      */
-    resumeGeofence(int32_t geofenceId, int32_t monitorTransitions);
+    resumeGeofence(int32_t geofenceId,
+            bitfield<IGnssGeofenceCallback.GeofenceTransition> monitorTransitions);
 
     /*
      * Remove a geofence area. After the function returns, no notifications
diff --git a/gnss/1.0/IGnssMeasurementCallback.hal b/gnss/1.0/IGnssMeasurementCallback.hal
index cc34c91..9685942 100644
--- a/gnss/1.0/IGnssMeasurementCallback.hal
+++ b/gnss/1.0/IGnssMeasurementCallback.hal
@@ -116,7 +116,7 @@
          * A set of flags indicating the validity of the fields in this data
          * structure.
          */
-        GnssClockFlags gnssClockFlags;
+        bitfield<GnssClockFlags> gnssClockFlags;
 
         /*
          * Leap second data.
@@ -272,7 +272,7 @@
          * A set of flags indicating the validity of the fields in this data
          * structure.
          */
-        GnssMeasurementFlags flags;
+        bitfield<GnssMeasurementFlags> flags;
 
         /*
          * Satellite vehicle ID number, as defined in GnssSvInfo::svid
@@ -306,7 +306,7 @@
          *
          * This is a mandatory value.
          */
-        GnssMeasurementState state;
+        bitfield<GnssMeasurementState> state;
 
         /*
          * The received GNSS Time-of-Week at the measurement time, in nanoseconds.
@@ -430,7 +430,7 @@
          *
          * This is a mandatory value.
          */
-        GnssAccumulatedDeltaRangeState accumulatedDeltaRangeState;
+        bitfield<GnssAccumulatedDeltaRangeState> accumulatedDeltaRangeState;
 
         /*
          * Accumulated delta range since the last channel reset in meters.
diff --git a/gnss/1.0/IGnssNavigationMessageCallback.hal b/gnss/1.0/IGnssNavigationMessageCallback.hal
index 6988c9a..0cffa67 100644
--- a/gnss/1.0/IGnssNavigationMessageCallback.hal
+++ b/gnss/1.0/IGnssNavigationMessageCallback.hal
@@ -80,7 +80,7 @@
          * No need to send any navigation message that contains words with parity
          * error and cannot be corrected.
          */
-        NavigationMessageStatus status;
+        bitfield<NavigationMessageStatus> status;
 
         /*
          * Message identifier. It provides an index so the complete Navigation
diff --git a/gnss/1.0/IGnssNiCallback.hal b/gnss/1.0/IGnssNiCallback.hal
index f23b354..a7abad9 100644
--- a/gnss/1.0/IGnssNiCallback.hal
+++ b/gnss/1.0/IGnssNiCallback.hal
@@ -78,7 +78,7 @@
          * Notification/verification options, combinations of GnssNiNotifyFlags
          * constants.
          */
-        GnssNiNotifyFlags notifyFlags;
+        bitfield<GnssNiNotifyFlags> notifyFlags;
 
         /*
          * Timeout period to wait for user response.
diff --git a/gnss/1.0/default/AGnssRil.cpp b/gnss/1.0/default/AGnssRil.cpp
index 87abad7..480571d 100644
--- a/gnss/1.0/default/AGnssRil.cpp
+++ b/gnss/1.0/default/AGnssRil.cpp
@@ -50,7 +50,7 @@
         return;
     }
 
-    sAGnssRilCbIface->requestSetIdCb(static_cast<IAGnssRilCallback::ID>(flags));
+    sAGnssRilCbIface->requestSetIdCb(flags);
 }
 
 void AGnssRil::requestRefLoc(uint32_t /*flags*/) {
diff --git a/gnss/1.0/default/Android.mk b/gnss/1.0/default/Android.mk
index 6289491..a6f73f2 100644
--- a/gnss/1.0/default/Android.mk
+++ b/gnss/1.0/default/Android.mk
@@ -8,6 +8,7 @@
     AGnss.cpp \
     AGnssRil.cpp \
     Gnss.cpp \
+    GnssBatching.cpp \
     GnssDebug.cpp \
     GnssGeofencing.cpp \
     GnssMeasurement.cpp \
diff --git a/gnss/1.0/default/Gnss.cpp b/gnss/1.0/default/Gnss.cpp
index 5e6e65d..28a1950 100644
--- a/gnss/1.0/default/Gnss.cpp
+++ b/gnss/1.0/default/Gnss.cpp
@@ -534,6 +534,23 @@
     return mGnssDebug;
 }
 
+Return<sp<IGnssBatching>> Gnss::getExtensionGnssBatching()  {
+    if (mGnssIface == nullptr) {
+        ALOGE("%s: Gnss interface is unavailable", __func__);
+    } else {
+        // TODO(b/34133439): actually get an flpLocationIface
+        const FlpLocationInterface* flpLocationIface = nullptr;
+
+        if (flpLocationIface == nullptr) {
+            ALOGE("%s: GnssBatching interface is not implemented by HAL", __func__);
+        } else {
+            mGnssBatching = new GnssBatching(flpLocationIface);
+        }
+    }
+
+    return mGnssBatching;
+}
+
 IGnss* HIDL_FETCH_IGnss(const char* hal) {
     hw_module_t* module;
     IGnss* iface = nullptr;
diff --git a/gnss/1.0/default/Gnss.h b/gnss/1.0/default/Gnss.h
index e12ac12..36947c1 100644
--- a/gnss/1.0/default/Gnss.h
+++ b/gnss/1.0/default/Gnss.h
@@ -19,6 +19,7 @@
 
 #include <AGnss.h>
 #include <AGnssRil.h>
+#include <GnssBatching.h>
 #include <GnssConfiguration.h>
 #include <GnssDebug.h>
 #include <GnssGeofencing.h>
@@ -29,6 +30,7 @@
 
 #include <ThreadCreationWrapper.h>
 #include <android/hardware/gnss/1.0/IGnss.h>
+#include <hardware/fused_location.h>
 #include <hardware/gps.h>
 #include <hidl/Status.h>
 
@@ -51,6 +53,7 @@
  * IGnssCallback interface to be passed into the conventional implementation of the GNSS HAL.
  */
 struct Gnss : public IGnss {
+    // TODO: Add flp_device_t, either in ctor, or later attach?
     Gnss(gps_device_t* gnss_device);
     ~Gnss();
 
@@ -83,6 +86,7 @@
     Return<sp<IGnssXtra>> getExtensionXtra() override;
     Return<sp<IGnssConfiguration>> getExtensionGnssConfiguration() override;
     Return<sp<IGnssDebug>> getExtensionGnssDebug() override;
+    Return<sp<IGnssBatching>> getExtensionGnssBatching() override;
 
     /*
      * Callback methods to be passed into the conventional GNSS HAL by the default
@@ -119,6 +123,7 @@
     sp<GnssNavigationMessage> mGnssNavigationMessage = nullptr;
     sp<GnssDebug> mGnssDebug = nullptr;
     sp<GnssConfiguration> mGnssConfig = nullptr;
+    sp<GnssBatching> mGnssBatching = nullptr;
     const GpsInterface* mGnssIface = nullptr;
     static sp<IGnssCallback> sGnssCbIface;
     static std::vector<std::unique_ptr<ThreadFuncArgs>> sThreadFuncArgsList;
diff --git a/gnss/1.0/default/GnssBatching.cpp b/gnss/1.0/default/GnssBatching.cpp
new file mode 100644
index 0000000..404b5da
--- /dev/null
+++ b/gnss/1.0/default/GnssBatching.cpp
@@ -0,0 +1,48 @@
+#include "GnssBatching.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+GnssBatching::GnssBatching(const FlpLocationInterface* flpLocationIface) :
+    mFlpLocationIface(flpLocationIface) {}
+
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
+Return<bool> GnssBatching::init(const sp<IGnssBatchingCallback>& callback) {
+    // TODO(b/34133439) implement
+    return false;
+}
+
+Return<uint16_t> GnssBatching::getBatchSize() {
+    // TODO(b/34133439) implement
+    return 0;
+}
+
+Return<bool> GnssBatching::start(const IGnssBatching::Options& options) {
+    // TODO(b/34133439) implement
+    return false;
+}
+
+Return<void> GnssBatching::flush() {
+    // TODO(b/34133439) implement
+    return Void();
+}
+
+Return<bool> GnssBatching::stop() {
+    // TODO(b/34133439) implement
+    return false;
+}
+
+Return<void> GnssBatching::cleanup() {
+    // TODO(b/34133439) implement
+    return Void();
+}
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace gnss
+}  // namespace hardware
+}  // namespace android
diff --git a/gnss/1.0/default/GnssBatching.h b/gnss/1.0/default/GnssBatching.h
new file mode 100644
index 0000000..ac3aa99
--- /dev/null
+++ b/gnss/1.0/default/GnssBatching.h
@@ -0,0 +1,50 @@
+#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
+#define ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
+
+#include <android/hardware/gnss/1.0/IGnssBatching.h>
+#include <hardware/fused_location.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gnss::V1_0::IGnssBatching;
+using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
+using ::android::hidl::base::V1_0::IBase;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+struct GnssBatching : public IGnssBatching {
+    GnssBatching(const FlpLocationInterface* flpLocationIface);
+
+    // Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
+    Return<bool> init(const sp<IGnssBatchingCallback>& callback) override;
+    Return<uint16_t> getBatchSize() override;
+    Return<bool> start(const IGnssBatching::Options& options ) override;
+    Return<void> flush() override;
+    Return<bool> stop() override;
+    Return<void> cleanup() override;
+
+ private:
+    const FlpLocationInterface* mFlpLocationIface = nullptr;
+};
+
+extern "C" IGnssBatching* HIDL_FETCH_IGnssBatching(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace gnss
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
diff --git a/gnss/1.0/default/GnssMeasurement.cpp b/gnss/1.0/default/GnssMeasurement.cpp
index 9f8d7b5..0d11636 100644
--- a/gnss/1.0/default/GnssMeasurement.cpp
+++ b/gnss/1.0/default/GnssMeasurement.cpp
@@ -52,18 +52,17 @@
     for (size_t i = 0; i < gnssData.measurementCount; i++) {
         auto entry = legacyGnssData->measurements[i];
         gnssData.measurements[i] = {
-            .flags = static_cast<IGnssMeasurementCallback::GnssMeasurementFlags>(entry.flags),
+            .flags = entry.flags,
             .svid = entry.svid,
             .constellation = static_cast<GnssConstellationType>(entry.constellation),
             .timeOffsetNs = entry.time_offset_ns,
-            .state = static_cast<IGnssMeasurementCallback::GnssMeasurementState>(entry.state),
+            .state = entry.state,
             .receivedSvTimeInNs = entry.received_sv_time_in_ns,
             .receivedSvTimeUncertaintyInNs = entry.received_sv_time_uncertainty_in_ns,
             .cN0DbHz = entry.c_n0_dbhz,
             .pseudorangeRateMps = entry.pseudorange_rate_mps,
             .pseudorangeRateUncertaintyMps = entry.pseudorange_rate_uncertainty_mps,
-            .accumulatedDeltaRangeState = static_cast<IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState>(
-                    entry.accumulated_delta_range_state),
+            .accumulatedDeltaRangeState = entry.accumulated_delta_range_state,
             .accumulatedDeltaRangeM = entry.accumulated_delta_range_m,
             .accumulatedDeltaRangeUncertaintyM = entry.accumulated_delta_range_uncertainty_m,
             .carrierFrequencyHz = entry.carrier_frequency_hz,
@@ -78,7 +77,7 @@
 
     auto clockVal = legacyGnssData->clock;
     gnssData.clock = {
-        .gnssClockFlags = static_cast<IGnssMeasurementCallback::GnssClockFlags>(clockVal.flags),
+        .gnssClockFlags = clockVal.flags,
         .leapSecond = clockVal.leap_second,
         .timeNs = clockVal.time_ns,
         .timeUncertaintyNs = clockVal.time_uncertainty_ns,
@@ -117,9 +116,7 @@
 
     for (size_t i = 0; i < gnssData.measurementCount; i++) {
         auto entry = gpsData->measurements[i];
-        gnssData.measurements[i].flags =
-                static_cast<IGnssMeasurementCallback::GnssMeasurementFlags>(
-                        entry.flags);
+        gnssData.measurements[i].flags = entry.flags;
         gnssData.measurements[i].svid = static_cast<int32_t>(entry.prn);
         if (entry.prn >= 1 && entry.prn <= 32) {
             gnssData.measurements[i].constellation = GnssConstellationType::GPS;
@@ -129,9 +126,7 @@
         }
 
         gnssData.measurements[i].timeOffsetNs = entry.time_offset_ns;
-        gnssData.measurements[i].state =
-            static_cast<IGnssMeasurementCallback::GnssMeasurementState>(
-                entry.state);
+        gnssData.measurements[i].state = entry.state;
         gnssData.measurements[i].receivedSvTimeInNs = entry.received_gps_tow_ns;
         gnssData.measurements[i].receivedSvTimeUncertaintyInNs =
             entry.received_gps_tow_uncertainty_ns;
@@ -140,8 +135,7 @@
         gnssData.measurements[i].pseudorangeRateUncertaintyMps =
                 entry.pseudorange_rate_uncertainty_mps;
         gnssData.measurements[i].accumulatedDeltaRangeState =
-                static_cast<IGnssMeasurementCallback::GnssAccumulatedDeltaRangeState>(
-                entry.accumulated_delta_range_state);
+                entry.accumulated_delta_range_state;
         gnssData.measurements[i].accumulatedDeltaRangeM =
                 entry.accumulated_delta_range_m;
         gnssData.measurements[i].accumulatedDeltaRangeUncertaintyM =
@@ -220,8 +214,7 @@
     gnssData.clock.biasUncertaintyNs = clockVal.bias_uncertainty_ns;
     gnssData.clock.driftNsps = clockVal.drift_nsps;
     gnssData.clock.driftUncertaintyNsps = clockVal.drift_uncertainty_nsps;
-    gnssData.clock.gnssClockFlags =
-      static_cast<IGnssMeasurementCallback::GnssClockFlags>(clockVal.flags);
+    gnssData.clock.gnssClockFlags = clockVal.flags;
 
     sGnssMeasureCbIface->GnssMeasurementCb(gnssData);
 }
diff --git a/gnss/1.0/default/GnssNavigationMessage.cpp b/gnss/1.0/default/GnssNavigationMessage.cpp
index f2c69a7..ef78ff4 100644
--- a/gnss/1.0/default/GnssNavigationMessage.cpp
+++ b/gnss/1.0/default/GnssNavigationMessage.cpp
@@ -53,8 +53,7 @@
     navigationMsg.svid = message->svid;
     navigationMsg.type =
             static_cast<IGnssNavigationMessageCallback::GnssNavigationMessageType>(message->type);
-    navigationMsg.status =
-            static_cast<IGnssNavigationMessageCallback::NavigationMessageStatus>(message->status);
+    navigationMsg.status = message->status;
     navigationMsg.messageId = message->message_id;
     navigationMsg.submessageId = message->submessage_id;
     navigationMsg.data.setToExternal(message->data, message->data_length);
diff --git a/gnss/1.0/default/GnssNi.cpp b/gnss/1.0/default/GnssNi.cpp
index 10af1f4..ec57e8c 100644
--- a/gnss/1.0/default/GnssNi.cpp
+++ b/gnss/1.0/default/GnssNi.cpp
@@ -61,8 +61,7 @@
     IGnssNiCallback::GnssNiNotification notificationGnss = {
         .notificationId =  notification->notification_id,
         .niType = static_cast<IGnssNiCallback::GnssNiType>(notification->ni_type),
-        .notifyFlags =
-                static_cast<IGnssNiCallback::GnssNiNotifyFlags>(notification->notify_flags),
+        .notifyFlags = notification->notify_flags,
         .timeoutSec = static_cast<uint32_t>(notification->timeout),
         .defaultResponse =
                 static_cast<IGnssNiCallback::GnssUserResponseType>(notification->default_response),
diff --git a/gnss/1.0/types.hal b/gnss/1.0/types.hal
index ee35ca4..7d7b427 100644
--- a/gnss/1.0/types.hal
+++ b/gnss/1.0/types.hal
@@ -40,6 +40,7 @@
 /* Represents a location. */
 struct GnssLocation {
     /* Contains GnssLocationFlags bits. */
+    // TODO bitfield?
     uint16_t gnssLocationFlags;
 
     /* Represents latitude in degrees. */
diff --git a/ir/1.0/default/ConsumerIr.cpp b/ir/1.0/default/ConsumerIr.cpp
index 8cfb2e8..b96c695 100644
--- a/ir/1.0/default/ConsumerIr.cpp
+++ b/ir/1.0/default/ConsumerIr.cpp
@@ -15,10 +15,12 @@
  */
 
 #define LOG_TAG "ConsumerIrService"
-#include <android/log.h>
+
+#include <log/log.h>
 
 #include <hardware/hardware.h>
 #include <hardware/consumerir.h>
+
 #include "ConsumerIr.h"
 
 namespace android {
diff --git a/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target_profiling/Android.mk b/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target_profiling/Android.mk
new file mode 100644
index 0000000..939929d
--- /dev/null
+++ b/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target_profiling/Android.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := LightHidlTargetProfilingTest
+VTS_CONFIG_SRC_DIR := testcases/hal/light/hidl/target_profiling
+include test/vts/tools/build/Android.host_config.mk
diff --git a/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target_profiling/AndroidTest.xml b/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target_profiling/AndroidTest.xml
new file mode 100644
index 0000000..b800fba
--- /dev/null
+++ b/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target_profiling/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<configuration description="Config for VTS Light HIDL HAL's target-side test cases">
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HidlHalTest.push" />
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+        <option name="test-module-name" value="LightHidlTargetProfilingTest" />
+        <option name="binary-test-sources" value="
+            _32bit::DATA/nativetest/light_hidl_hal_test/light_hidl_hal_test,
+            _64bit::DATA/nativetest64/light_hidl_hal_test/light_hidl_hal_test,
+            "/>
+        <option name="test-config-path" value="vts/testcases/hal/light/hidl/target/HalLightHidlTargetBasicTest.config" />
+        <option name="binary-test-type" value="gtest" />
+        <option name="test-timeout" value="1m" />
+        <option name="enable-profiling" value="true" />
+    </test>
+</configuration>
+
diff --git a/memtrack/1.0/vts/functional/vts/testcases/hal/memtrack/hidl/target_profiling/Android.mk b/memtrack/1.0/vts/functional/vts/testcases/hal/memtrack/hidl/target_profiling/Android.mk
new file mode 100644
index 0000000..d397621
--- /dev/null
+++ b/memtrack/1.0/vts/functional/vts/testcases/hal/memtrack/hidl/target_profiling/Android.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := HalMemtrackHidlTargetProfilingTest
+VTS_CONFIG_SRC_DIR := testcases/hal/memtrack/hidl/target_profiling
+include test/vts/tools/build/Android.host_config.mk
diff --git a/memtrack/1.0/vts/functional/vts/testcases/hal/memtrack/hidl/target_profiling/AndroidTest.xml b/memtrack/1.0/vts/functional/vts/testcases/hal/memtrack/hidl/target_profiling/AndroidTest.xml
new file mode 100644
index 0000000..d813be1
--- /dev/null
+++ b/memtrack/1.0/vts/functional/vts/testcases/hal/memtrack/hidl/target_profiling/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<configuration description="Config for VTS Memtrack HIDL HAL's target-side test cases">
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HidlHalTest.push" />
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+        <option name="test-module-name" value="HalMemtrackHidlTargetProfilingTest"/>
+        <option name="binary-test-sources" value="
+            _32bit::DATA/nativetest/memtrack_hidl_hal_test/memtrack_hidl_hal_test,
+            _64bit::DATA/nativetest64/memtrack_hidl_hal_test/memtrack_hidl_hal_test,
+            "/>
+        <option name="binary-test-type" value="gtest" />
+        <option name="test-timeout" value="5m" />
+        <option name="enable-profiling" value="true" />
+    </test>
+</configuration>
diff --git a/nfc/1.0/default/Nfc.cpp b/nfc/1.0/default/Nfc.cpp
index 44c8e42..0759605 100644
--- a/nfc/1.0/default/Nfc.cpp
+++ b/nfc/1.0/default/Nfc.cpp
@@ -1,5 +1,6 @@
 #define LOG_TAG "android.hardware.nfc@1.0-impl"
-#include <android/log.h>
+
+#include <log/log.h>
 
 #include <hardware/hardware.h>
 #include <hardware/nfc.h>
diff --git a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml
index da6cf22..42c7e22 100644
--- a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml
+++ b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml
@@ -25,7 +25,7 @@
             _64bit::DATA/nativetest64/nfc_hidl_hal_test/nfc_hidl_hal_test,
             "/>
         <option name="binary-test-type" value="gtest" />
-        <option name="test-timeout" value="10m" />
+        <option name="test-timeout" value="20m" />
     <option name="enable-profiling" value="true" />
     </test>
 </configuration>
diff --git a/power/1.0/default/Power.cpp b/power/1.0/default/Power.cpp
index 6453f33..29594eb 100644
--- a/power/1.0/default/Power.cpp
+++ b/power/1.0/default/Power.cpp
@@ -44,8 +44,12 @@
 
 Return<void> Power::powerHint(PowerHint hint, int32_t data)  {
     int32_t param = data;
-    if (mModule->powerHint > 0)
-        mModule->powerHint(mModule, static_cast<power_hint_t>(hint), &param);
+    if (mModule->powerHint > 0) {
+        if (data)
+            mModule->powerHint(mModule, static_cast<power_hint_t>(hint), &param);
+        else
+            mModule->powerHint(mModule, static_cast<power_hint_t>(hint), NULL);
+    }
     return Void();
 }
 
diff --git a/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target_profiling/Android.mk b/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target_profiling/Android.mk
new file mode 100644
index 0000000..6f9e399
--- /dev/null
+++ b/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target_profiling/Android.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := HalPowerHidlTargetProfilingTest
+VTS_CONFIG_SRC_DIR := testcases/hal/power/hidl/target_profiling
+include test/vts/tools/build/Android.host_config.mk
+
diff --git a/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target_profiling/AndroidTest.xml b/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target_profiling/AndroidTest.xml
new file mode 100644
index 0000000..e8ef928
--- /dev/null
+++ b/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target_profiling/AndroidTest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<configuration description="Config for VTS Power HIDL HAL's target-side test cases">
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HidlHalTest.push" />
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+        <option name="test-module-name" value="HalPowerHidlTargetProfilingTest"/>
+        <option name="binary-test-sources" value="
+            _32bit::DATA/nativetest/power_hidl_hal_test/power_hidl_hal_test,
+            _64bit::DATA/nativetest64/power_hidl_hal_test/power_hidl_hal_test,
+            "/>
+        <option name="test-config-path" value="vts/testcases/hal/power/hidl/target/HalPowerHidlTargetTest.config" />
+        <option name="binary-test-type" value="gtest" />
+        <option name="test-timeout" value="1m" />
+        <option name="enable-profiling" value="true" />
+    </test>
+</configuration>
diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal
index 49ba30e..941a59e 100644
--- a/radio/1.0/types.hal
+++ b/radio/1.0/types.hal
@@ -821,11 +821,11 @@
 };
 
 enum CellInfoType : int32_t {
-    GSM,
-    CDMA,
-    LTE,
-    WCDMA,
-    TD_SCDMA
+    GSM = 1,
+    CDMA = 2,
+    LTE = 3,
+    WCDMA = 4,
+    TD_SCDMA = 5
 };
 
 enum TimeStampType : int32_t {
diff --git a/sensors/1.0/ISensors.hal b/sensors/1.0/ISensors.hal
index adacfe0..bb57f73 100644
--- a/sensors/1.0/ISensors.hal
+++ b/sensors/1.0/ISensors.hal
@@ -121,4 +121,60 @@
      *         BAD_VALUE if sensor event cannot be injected
      */
     injectSensorData(Event event) generates (Result result);
+
+    /*
+     * Register direct report channel.
+     *
+     * Register a direct channel with supplied shared memory information. Upon
+     * return, the sensor hardware is responsible for resetting the memory
+     * content to initial value (depending on memory format settings).
+     *
+     * @param   mem shared memory info data structure.
+     * @return  result OK on success; BAD_VALUE if shared memory information is
+     *          not consistent; NO_MEMORY if shared memory cannot be used by
+     *          sensor system; INVALID_OPERATION if functionality is not
+     *          supported.
+     * @return  channelHandle a positive integer used for referencing registered
+     *          direct channel (>0) in configureDirectReport and
+     *          unregisterDirectChannel if result is OK, -1 otherwise.
+     */
+    registerDirectChannel(SharedMemInfo mem)
+            generates (Result result, int32_t channelHandle);
+
+    /*
+     * Unregister direct report channel.
+     *
+     * Unregister a direct channel previously registered using
+     * registerDirectChannel. If there is still active sensor report configured
+     * in the direct channel, HAL should remove them.
+     *
+     * @param   channelHandle handle of direct channel to be unregistered.
+     * @return  result OK if direct report is supported; INVALID_OPERATION
+     *          otherwise.
+     */
+    unregisterDirectChannel(int32_t channelHandle) generates (Result result);
+
+    /*
+     * Configure direct sensor event report in direct channel.
+     *
+     * This function start, modify rate or stop direct report of a sensor in a
+     * certain direct channel.
+     *
+     * @param   sensorHandle handle of sensor to be configured. When combined
+     *          with STOP rate, sensorHandle can be -1 to denote all active
+     *          sensors in the direct channel specified by channel Handle.
+     * @param   channelHandle handle of direct channel to be configured.
+     * @param   rate rate level, see RateLevel enum.
+     *
+     * @return  result OK on success; BAD_VALUE if parameter is invalid (such as
+     *          rate level is not supported by sensor, channelHandle does not
+     *          exist, etc); INVALID_OPERATION if functionality is not
+     *          supported.
+     * @return  reportToken positive integer to identify multiple sensors of
+     *          the same type in a single direct channel. Ignored if rate is
+     *          STOP. See SharedMemFormat.
+     */
+    configDirectReport(
+            int32_t sensorHandle, int32_t channelHandle, RateLevel rate)
+            generates (Result result, int32_t reportToken);
 };
diff --git a/sensors/1.0/default/Sensors.cpp b/sensors/1.0/default/Sensors.cpp
index c76369f..d79f5c7 100644
--- a/sensors/1.0/default/Sensors.cpp
+++ b/sensors/1.0/default/Sensors.cpp
@@ -234,6 +234,32 @@
             mSensorDevice->inject_sensor_data(mSensorDevice, &out));
 }
 
+Return<void> Sensors::registerDirectChannel(
+        const SharedMemInfo& mem, registerDirectChannel_cb _aidl_cb) {
+    //TODO(b/30985702): finish implementation
+    (void) mem;
+    _aidl_cb(Result::INVALID_OPERATION, -1);
+    return Void();
+}
+
+Return<Result> Sensors::unregisterDirectChannel(int32_t channelHandle) {
+    //TODO(b/30985702): finish implementation
+    (void) channelHandle;
+    return Result::INVALID_OPERATION;
+}
+
+Return<void> Sensors::configDirectReport(
+        int32_t sensorHandle, int32_t channelHandle, RateLevel rate,
+        configDirectReport_cb _hidl_cb) {
+    //TODO(b/30985702): finish implementation
+    (void) sensorHandle;
+    (void) channelHandle;
+    (void) rate;
+
+    _hidl_cb(Result::INVALID_OPERATION, -1);
+    return Void();
+}
+
 // static
 void Sensors::convertFromSensorEvents(
         size_t count,
diff --git a/sensors/1.0/default/Sensors.h b/sensors/1.0/default/Sensors.h
index f9b837d..abe7f43 100644
--- a/sensors/1.0/default/Sensors.h
+++ b/sensors/1.0/default/Sensors.h
@@ -54,6 +54,15 @@
 
     Return<Result> injectSensorData(const Event& event) override;
 
+    Return<void> registerDirectChannel(
+            const SharedMemInfo& mem, registerDirectChannel_cb _aidl_cb) override;
+
+    Return<Result> unregisterDirectChannel(int32_t channelHandle) override;
+
+    Return<void> configDirectReport(
+            int32_t sensorHandle, int32_t channelHandle, RateLevel rate,
+            configDirectReport_cb _hidl_cb) override;
+
 private:
     status_t mInitCheck;
     sensors_module_t *mSensorModule;
diff --git a/sensors/1.0/types.hal b/sensors/1.0/types.hal
index 460cef5..6c72c39 100644
--- a/sensors/1.0/types.hal
+++ b/sensors/1.0/types.hal
@@ -25,9 +25,10 @@
 /* Type enumerating various result codes returned from ISensors methods */
 enum Result : int32_t {
     OK,
-    BAD_VALUE,
-    PERMISSION_DENIED,
-    INVALID_OPERATION,
+    PERMISSION_DENIED                   = -1,
+    NO_MEMORY                           = -12,
+    BAD_VALUE                           = -22,
+    INVALID_OPERATION                   = -38,
 };
 
 /*
@@ -748,6 +749,35 @@
      * See ADDITIONAL_INFO and AdditionalInfo for details.
      */
     SENSOR_FLAG_ADDITIONAL_INFO             = 0x40,
+
+    /*
+     * Set this flag if sensor suppor direct channel backed by ashmem.
+     * See SharedMemType and registerDirectChannel for more details.
+     */
+    SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM       = 0x400,
+
+    /*
+     * Set this flag if sensor suppor direct channel backed by gralloc HAL memory.
+     * See SharedMemType and registerDirectChannel for more details.
+     */
+    SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC      = 0x800,
+
+    /*
+     * Flags mask for reporting mode of sensor.
+     */
+    SENSOR_FLAG_MASK_REPORTING_MODE         = 0xE,
+
+    /*
+     * Flags mask for direct report maximum rate level support.
+     * See RateLevel.
+     */
+    SENSOR_FLAG_MASK_DIRECT_REPORT          = 0x380,
+
+    /*
+     * Flags mask for all direct channel support bits.
+     * See SharedMemType.
+     */
+    SENSOR_FLAG_MASK_DIRECT_CHANNEL         = 0xC00,
 };
 
 struct SensorInfo {
@@ -1085,3 +1115,66 @@
     /* Union discriminated on sensorType */
     EventPayload u;
 };
+
+/**
+ * Direct report rate level definition. Except for SENSOR_DIRECT_RATE_STOP, each
+ * rate level covers the range (55%, 220%] * nominal report rate. For example,
+ * if config direct report specify a rate level SENSOR_DIRECT_RATE_FAST, sensor
+ * hardware should report event at a rate greater than 110Hz, and less or equal
+ * to 440Hz.
+ */
+@export(name="direct_rate_level_t", value_prefix="SENSOR_DIRECT_RATE_")
+enum RateLevel : int32_t {
+    STOP,            // stop
+    NORMAL,          // nominal 50Hz
+    FAST,            // nominal 200Hz
+    VERY_FAST,       // nominal 800Hz
+};
+
+/**
+ * Direct channel shared memory types. See struct SharedMemInfo.
+ */
+@export(name="direct_mem_type_t", value_prefix="SENSOR_DIRECT_MEM_TYPE_")
+enum SharedMemType : int32_t {
+    // handle contains 1 fd (ashmem handle) and 0 int.
+    ASHMEM = 1,
+    // handle definition matches gralloc HAL.
+    GRALLOC
+};
+
+
+/**
+ * Direct channel lock-free queue format, this defines how the shared memory
+ * should be interpreted by both sensor hardware and application. See struct
+ * SharedMemInfo.
+ */
+@export(name="direct_format_t", value_prefix="SENSOR_DIRECT_FMT_")
+enum SharedMemFormat : int32_t {
+    SENSORS_EVENT = 1,  // shared memory is formated as an array of data
+                        // elements, each sized 104 bytes. Details of fields:
+                        //
+                        // offset   type        name
+                        //-----------------------------------
+                        // 0x0000   int32_t     size (always 104)
+                        // 0x0004   int32_t     sensor report token
+                        // 0x0008   int32_t     type (see SensorType)
+                        // 0x000C   int32_t     atomic counter
+                        // 0x0010   int64_t     timestamp (see Event)
+                        // 0x0014   float[16]/  data
+                        //          int64_t[8]
+                        // 0x0058   int32_t[4]  reserved
+                        //
+                        // Upon return of channel registration call, the
+                        // shared memory space must be formated to all 0 by HAL.
+};
+
+/**
+ * Shared memory information for a direct channel
+ */
+struct SharedMemInfo {
+    SharedMemType type;         // shared memory type
+    SharedMemFormat format;
+    uint32_t size;              // size of the memory region, in bytes
+    handle memoryHandle;        // shared memory handle, it is interpreted
+                                // depending on type field, see SharedMemType.
+};
diff --git a/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host_profiling/Android.mk b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host_profiling/Android.mk
new file mode 100644
index 0000000..6029cc0
--- /dev/null
+++ b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host_profiling/Android.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := SensorsHidlProfilingTest
+VTS_CONFIG_SRC_DIR := testcases/hal/sensors/hidl/host_profiling
+include test/vts/tools/build/Android.host_config.mk
diff --git a/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host_profiling/AndroidTest.xml b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host_profiling/AndroidTest.xml
new file mode 100644
index 0000000..c056d90
--- /dev/null
+++ b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host_profiling/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<configuration description="Config for VTS HAL sensors test cases">
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HidlHalTest.push" />
+        <option name="cleanup" value="true" />
+        <option name="push" value="spec/hardware/interfaces/sensors/1.0/vts/Sensors.vts->/data/local/tmp/spec/Sensors.vts" />
+        <option name="push" value="spec/hardware/interfaces/sensors/1.0/vts/types.vts->/data/local/tmp/spec/types.vts" />
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+        <option name="test-module-name" value="SensorsHidlProfilingTest" />
+        <option name="test-case-path" value="vts/testcases/hal/sensors/hidl/host/SensorsHidlTest" />
+        <option name="test-timeout" value="3m" />
+        <option name="enable-profiling" value="true" />
+    </test>
+</configuration>
diff --git a/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/target_profiling/Android.mk b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/target_profiling/Android.mk
new file mode 100644
index 0000000..1b81381
--- /dev/null
+++ b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/target_profiling/Android.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := SensorsHidlTargetProfilingTest
+VTS_CONFIG_SRC_DIR := testcases/hal/sensors/hidl/target_profiling
+include test/vts/tools/build/Android.host_config.mk
diff --git a/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/target_profiling/AndroidTest.xml b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/target_profiling/AndroidTest.xml
new file mode 100644
index 0000000..80e46b7
--- /dev/null
+++ b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/target_profiling/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<configuration description="Config for VTS sensors HIDL HAL's target-side test cases">
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HidlHalTest.push" />
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+        <option name="test-module-name" value="SensorsHidlTargetProfilingTest" />
+        <option name="binary-test-sources" value="
+            _32bit::DATA/nativetest/sensors_hidl_hal_test/sensors_hidl_hal_test,
+            _64bit::DATA/nativetest64/sensors_hidl_hal_test/sensors_hidl_hal_test,
+            "/>
+        <option name="binary-test-type" value="gtest" />
+        <option name="binary-test-disable-framework" value="true" />
+        <option name="test-timeout" value="10m" />
+        <option name="enable-profiling" value="true" />
+    </test>
+</configuration>
+
diff --git a/tests/bar/1.0/default/Bar.cpp b/tests/bar/1.0/default/Bar.cpp
index 16c0235..6a8a360 100644
--- a/tests/bar/1.0/default/Bar.cpp
+++ b/tests/bar/1.0/default/Bar.cpp
@@ -2,9 +2,11 @@
 #define LOG_TAG "hidl_test"
 
 #include "Bar.h"
-#include <android/log.h>
+
 #include <inttypes.h>
 
+#include <log/log.h>
+
 namespace android {
 namespace hardware {
 namespace tests {
diff --git a/tests/inheritance/1.0/default/Child.cpp b/tests/inheritance/1.0/default/Child.cpp
index fd6608c..d4e82c0 100644
--- a/tests/inheritance/1.0/default/Child.cpp
+++ b/tests/inheritance/1.0/default/Child.cpp
@@ -1,5 +1,6 @@
 #define LOG_TAG "hidl_test"
-#include <android/log.h>
+
+#include <log/log.h>
 
 #include "Child.h"
 
diff --git a/tests/inheritance/1.0/default/Parent.cpp b/tests/inheritance/1.0/default/Parent.cpp
index a6fd911..d3f1932 100644
--- a/tests/inheritance/1.0/default/Parent.cpp
+++ b/tests/inheritance/1.0/default/Parent.cpp
@@ -1,5 +1,6 @@
 #define LOG_TAG "hidl_test"
-#include <android/log.h>
+
+#include <log/log.h>
 
 #include "Parent.h"
 
diff --git a/tests/memory/1.0/default/MemoryTest.cpp b/tests/memory/1.0/default/MemoryTest.cpp
index 1f804ca..40bb2dc 100644
--- a/tests/memory/1.0/default/MemoryTest.cpp
+++ b/tests/memory/1.0/default/MemoryTest.cpp
@@ -18,12 +18,12 @@
 
 #include "MemoryTest.h"
 
+#include <log/log.h>
+
 #include <hidlmemory/mapping.h>
 
 #include <android/hidl/memory/1.0/IMemory.h>
 
-#include <android/log.h>
-
 using android::hidl::memory::V1_0::IMemory;
 
 namespace android {
diff --git a/tests/pointer/1.0/default/Graph.cpp b/tests/pointer/1.0/default/Graph.cpp
index 9852407..5c8098b 100644
--- a/tests/pointer/1.0/default/Graph.cpp
+++ b/tests/pointer/1.0/default/Graph.cpp
@@ -1,7 +1,9 @@
 #define LOG_TAG "hidl_test"
 
 #include "Graph.h"
-#include <android/log.h>
+
+#include <log/log.h>
+
 #include <hidl-test/PointerHelper.h>
 
 #define PUSH_ERROR_IF(__cond__) if(__cond__) { errors.push_back(std::to_string(__LINE__) + ": " + #__cond__); }
diff --git a/tests/pointer/1.0/default/Pointer.cpp b/tests/pointer/1.0/default/Pointer.cpp
index 2b4a323..52712d4 100644
--- a/tests/pointer/1.0/default/Pointer.cpp
+++ b/tests/pointer/1.0/default/Pointer.cpp
@@ -1,7 +1,8 @@
 #define LOG_TAG "hidl_test"
 
 #include "Pointer.h"
-#include <android/log.h>
+
+#include <log/log.h>
 
 namespace android {
 namespace hardware {
diff --git a/tests/pointer/1.0/default/lib/PointerHelper.cpp b/tests/pointer/1.0/default/lib/PointerHelper.cpp
index 3bc82c2..0a64cc3 100644
--- a/tests/pointer/1.0/default/lib/PointerHelper.cpp
+++ b/tests/pointer/1.0/default/lib/PointerHelper.cpp
@@ -1,6 +1,9 @@
 #define LOG_TAG "hidl_test"
-#include <android/log.h>
+
+#include <log/log.h>
+
 #include "PointerHelper.h"
+
 namespace android {
 
 void simpleGraph(IGraph::Graph& g) {
diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk
index bb8d144..1058cc7 100644
--- a/wifi/1.0/Android.mk
+++ b/wifi/1.0/Android.mk
@@ -36,9 +36,9 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanAvailDuration)
+# Build types.hal (NanBandIndex)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanAvailDuration.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanBandIndex.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -48,7 +48,26 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanAvailDuration
+        android.hardware.wifi@1.0::types.NanBandIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (NanBandSpecificConfig)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanBandSpecificConfig.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.wifi@1.0::types.NanBandSpecificConfig
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
@@ -74,25 +93,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanBeaconSdfPayloadReceive)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanBeaconSdfPayloadReceive.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanBeaconSdfPayloadReceive
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanBeaconSdfPayloadRequest)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanBeaconSdfPayloadRequest.java
@@ -112,9 +112,9 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanCapabilitiesResponse)
+# Build types.hal (NanCapabilities)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanCapabilitiesResponse.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanCapabilities.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -124,16 +124,16 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanCapabilitiesResponse
+        android.hardware.wifi@1.0::types.NanCapabilities
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanCapabilitiesResponseMsg)
+# Build types.hal (NanCipherSuiteType)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanCapabilitiesResponseMsg.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanCipherSuiteType.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -143,16 +143,16 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanCapabilitiesResponseMsg
+        android.hardware.wifi@1.0::types.NanCipherSuiteType
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanChannelIndex)
+# Build types.hal (NanClusterEventInd)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanChannelIndex.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanClusterEventInd.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -162,7 +162,26 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanChannelIndex
+        android.hardware.wifi@1.0::types.NanClusterEventInd
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (NanClusterEventType)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanClusterEventType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.wifi@1.0::types.NanClusterEventType
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
@@ -188,63 +207,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanConnectionType)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanConnectionType.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanConnectionType
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathAppInfo)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathAppInfo.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathAppInfo
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathCfg)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathCfg.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathCfg
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanDataPathChannelCfg)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathChannelCfg.java
@@ -283,82 +245,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanDataPathEndInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathEndInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathEndInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathEndRequest)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathEndRequest.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathEndRequest
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathIndicationResponse)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathIndicationResponse.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathIndicationResponse
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathInitiatorRequest)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathInitiatorRequest.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathInitiatorRequest
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanDataPathRequestInd)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathRequestInd.java
@@ -378,9 +264,9 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanDataPathResponse)
+# Build types.hal (NanDebugConfig)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathResponse.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDebugConfig.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -390,16 +276,16 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathResponse
+        android.hardware.wifi@1.0::types.NanDebugConfig
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanDataPathResponseCode)
+# Build types.hal (NanDiscoveryCommonConfig)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathResponseCode.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDiscoveryCommonConfig.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -409,102 +295,7 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathResponseCode
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathResponseMsg)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathResponseMsg.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathResponseMsg
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDeviceRole)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDeviceRole.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDeviceRole
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDisabledInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDisabledInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDisabledInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDiscEngEventInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDiscEngEventInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDiscEngEventInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDiscEngEventType)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDiscEngEventType.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDiscEngEventType
+        android.hardware.wifi@1.0::types.NanDiscoveryCommonConfig
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
@@ -530,9 +321,9 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanFollowupInd)
+# Build types.hal (NanFollowupReceivedInd)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanFollowupInd.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanFollowupReceivedInd.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -542,16 +333,16 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanFollowupInd
+        android.hardware.wifi@1.0::types.NanFollowupReceivedInd
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanFurtherAvailabilityChannel)
+# Build types.hal (NanInitiateDataPathRequest)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanFurtherAvailabilityChannel.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanInitiateDataPathRequest.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -561,7 +352,7 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanFurtherAvailabilityChannel
+        android.hardware.wifi@1.0::types.NanInitiateDataPathRequest
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
@@ -587,25 +378,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanMatchExpiredInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanMatchExpiredInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanMatchExpiredInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanMatchInd)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanMatchInd.java
@@ -625,44 +397,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanMaxSize)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanMaxSize.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanMaxSize
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanPublishCancelRequest)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishCancelRequest.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanPublishCancelRequest
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanPublishRequest)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishRequest.java
@@ -682,63 +416,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanPublishResponse)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishResponse.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanPublishResponse
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanPublishResponseMsg)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishResponseMsg.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanPublishResponseMsg
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanPublishTerminatedInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishTerminatedInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanPublishTerminatedInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanPublishType)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishType.java
@@ -758,9 +435,9 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanReceiveVendorSpecificAttribute)
+# Build types.hal (NanRangingIndication)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanReceiveVendorSpecificAttribute.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanRangingIndication.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -770,16 +447,16 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanReceiveVendorSpecificAttribute
+        android.hardware.wifi@1.0::types.NanRangingIndication
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanResponseMsgHeader)
+# Build types.hal (NanRespondToDataPathIndicationRequest)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanResponseMsgHeader.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanRespondToDataPathIndicationRequest.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -789,64 +466,7 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanResponseMsgHeader
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanResponseType)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanResponseType.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanResponseType
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanSocialChannelScanParams)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSocialChannelScanParams.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSocialChannelScanParams
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanSrfIncludeType)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSrfIncludeType.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSrfIncludeType
+        android.hardware.wifi@1.0::types.NanRespondToDataPathIndicationRequest
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
@@ -891,25 +511,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanSubscribeCancelRequest)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeCancelRequest.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSubscribeCancelRequest
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanSubscribeRequest)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeRequest.java
@@ -929,63 +530,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanSubscribeResponse)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeResponse.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSubscribeResponse
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanSubscribeResponseMsg)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeResponseMsg.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSubscribeResponseMsg
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanSubscribeTerminatedInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeTerminatedInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSubscribeTerminatedInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanSubscribeType)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeType.java
@@ -1005,25 +549,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanTransmitFollowupInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTransmitFollowupInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanTransmitFollowupInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanTransmitFollowupRequest)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTransmitFollowupRequest.java
@@ -1043,63 +568,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanTransmitVendorSpecificAttribute)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTransmitVendorSpecificAttribute.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanTransmitVendorSpecificAttribute
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanTransmitWindowType)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTransmitWindowType.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanTransmitWindowType
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanTxPriority)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTxPriority.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanTxPriority
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanTxType)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTxType.java
@@ -1974,6 +1442,25 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build types.hal (WifiNanStatus)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/WifiNanStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.wifi@1.0::types.WifiNanStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build types.hal (WifiRateInfo)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/WifiRateInfo.java
@@ -2407,9 +1894,9 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanAvailDuration)
+# Build types.hal (NanBandIndex)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanAvailDuration.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanBandIndex.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -2419,7 +1906,26 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanAvailDuration
+        android.hardware.wifi@1.0::types.NanBandIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (NanBandSpecificConfig)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanBandSpecificConfig.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.wifi@1.0::types.NanBandSpecificConfig
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
@@ -2445,25 +1951,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanBeaconSdfPayloadReceive)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanBeaconSdfPayloadReceive.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanBeaconSdfPayloadReceive
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanBeaconSdfPayloadRequest)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanBeaconSdfPayloadRequest.java
@@ -2483,9 +1970,9 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanCapabilitiesResponse)
+# Build types.hal (NanCapabilities)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanCapabilitiesResponse.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanCapabilities.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -2495,16 +1982,16 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanCapabilitiesResponse
+        android.hardware.wifi@1.0::types.NanCapabilities
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanCapabilitiesResponseMsg)
+# Build types.hal (NanCipherSuiteType)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanCapabilitiesResponseMsg.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanCipherSuiteType.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -2514,16 +2001,16 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanCapabilitiesResponseMsg
+        android.hardware.wifi@1.0::types.NanCipherSuiteType
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanChannelIndex)
+# Build types.hal (NanClusterEventInd)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanChannelIndex.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanClusterEventInd.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -2533,7 +2020,26 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanChannelIndex
+        android.hardware.wifi@1.0::types.NanClusterEventInd
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (NanClusterEventType)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanClusterEventType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.wifi@1.0::types.NanClusterEventType
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
@@ -2559,63 +2065,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanConnectionType)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanConnectionType.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanConnectionType
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathAppInfo)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathAppInfo.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathAppInfo
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathCfg)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathCfg.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathCfg
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanDataPathChannelCfg)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathChannelCfg.java
@@ -2654,82 +2103,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanDataPathEndInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathEndInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathEndInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathEndRequest)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathEndRequest.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathEndRequest
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathIndicationResponse)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathIndicationResponse.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathIndicationResponse
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathInitiatorRequest)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathInitiatorRequest.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathInitiatorRequest
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanDataPathRequestInd)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathRequestInd.java
@@ -2749,9 +2122,9 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanDataPathResponse)
+# Build types.hal (NanDebugConfig)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathResponse.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDebugConfig.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -2761,16 +2134,16 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathResponse
+        android.hardware.wifi@1.0::types.NanDebugConfig
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanDataPathResponseCode)
+# Build types.hal (NanDiscoveryCommonConfig)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathResponseCode.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDiscoveryCommonConfig.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -2780,102 +2153,7 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathResponseCode
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDataPathResponseMsg)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathResponseMsg.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDataPathResponseMsg
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDeviceRole)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDeviceRole.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDeviceRole
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDisabledInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDisabledInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDisabledInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDiscEngEventInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDiscEngEventInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDiscEngEventInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanDiscEngEventType)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDiscEngEventType.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanDiscEngEventType
+        android.hardware.wifi@1.0::types.NanDiscoveryCommonConfig
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
@@ -2901,9 +2179,9 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanFollowupInd)
+# Build types.hal (NanFollowupReceivedInd)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanFollowupInd.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanFollowupReceivedInd.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -2913,16 +2191,16 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanFollowupInd
+        android.hardware.wifi@1.0::types.NanFollowupReceivedInd
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanFurtherAvailabilityChannel)
+# Build types.hal (NanInitiateDataPathRequest)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanFurtherAvailabilityChannel.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanInitiateDataPathRequest.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -2932,7 +2210,7 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanFurtherAvailabilityChannel
+        android.hardware.wifi@1.0::types.NanInitiateDataPathRequest
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
@@ -2958,25 +2236,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanMatchExpiredInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanMatchExpiredInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanMatchExpiredInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanMatchInd)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanMatchInd.java
@@ -2996,44 +2255,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanMaxSize)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanMaxSize.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanMaxSize
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanPublishCancelRequest)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishCancelRequest.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanPublishCancelRequest
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanPublishRequest)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishRequest.java
@@ -3053,63 +2274,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanPublishResponse)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishResponse.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanPublishResponse
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanPublishResponseMsg)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishResponseMsg.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanPublishResponseMsg
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanPublishTerminatedInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishTerminatedInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanPublishTerminatedInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanPublishType)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishType.java
@@ -3129,9 +2293,9 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanReceiveVendorSpecificAttribute)
+# Build types.hal (NanRangingIndication)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanReceiveVendorSpecificAttribute.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanRangingIndication.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -3141,16 +2305,16 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanReceiveVendorSpecificAttribute
+        android.hardware.wifi@1.0::types.NanRangingIndication
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanResponseMsgHeader)
+# Build types.hal (NanRespondToDataPathIndicationRequest)
 #
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanResponseMsgHeader.java
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanRespondToDataPathIndicationRequest.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -3160,64 +2324,7 @@
         -Ljava \
         -randroid.hardware:hardware/interfaces \
         -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanResponseMsgHeader
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanResponseType)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanResponseType.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanResponseType
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanSocialChannelScanParams)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSocialChannelScanParams.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSocialChannelScanParams
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanSrfIncludeType)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSrfIncludeType.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSrfIncludeType
+        android.hardware.wifi@1.0::types.NanRespondToDataPathIndicationRequest
 
 $(GEN): $(LOCAL_PATH)/types.hal
 	$(transform-generated-source)
@@ -3262,25 +2369,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanSubscribeCancelRequest)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeCancelRequest.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSubscribeCancelRequest
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanSubscribeRequest)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeRequest.java
@@ -3300,63 +2388,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanSubscribeResponse)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeResponse.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSubscribeResponse
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanSubscribeResponseMsg)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeResponseMsg.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSubscribeResponseMsg
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanSubscribeTerminatedInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeTerminatedInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanSubscribeTerminatedInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanSubscribeType)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanSubscribeType.java
@@ -3376,25 +2407,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanTransmitFollowupInd)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTransmitFollowupInd.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanTransmitFollowupInd
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanTransmitFollowupRequest)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTransmitFollowupRequest.java
@@ -3414,63 +2426,6 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
-# Build types.hal (NanTransmitVendorSpecificAttribute)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTransmitVendorSpecificAttribute.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanTransmitVendorSpecificAttribute
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanTransmitWindowType)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTransmitWindowType.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanTransmitWindowType
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (NanTxPriority)
-#
-GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTxPriority.java
-$(GEN): $(HIDL)
-$(GEN): PRIVATE_HIDL := $(HIDL)
-$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
-$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
-$(GEN): PRIVATE_CUSTOM_TOOL = \
-        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-        -Ljava \
-        -randroid.hardware:hardware/interfaces \
-        -randroid.hidl:system/libhidl/transport \
-        android.hardware.wifi@1.0::types.NanTxPriority
-
-$(GEN): $(LOCAL_PATH)/types.hal
-	$(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
 # Build types.hal (NanTxType)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/NanTxType.java
@@ -4345,6 +3300,25 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build types.hal (WifiNanStatus)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/WifiNanStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.wifi@1.0::types.WifiNanStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build types.hal (WifiRateInfo)
 #
 GEN := $(intermediates)/android/hardware/wifi/V1_0/WifiRateInfo.java
diff --git a/wifi/1.0/IWifiNanIface.hal b/wifi/1.0/IWifiNanIface.hal
index 2926c4f..3362339 100644
--- a/wifi/1.0/IWifiNanIface.hal
+++ b/wifi/1.0/IWifiNanIface.hal
@@ -39,7 +39,22 @@
       generates (WifiStatus status);
 
   /**
-   * Enable NAN functionality.
+   * Get NAN capabilities.
+   *
+   * @param cmdId command Id to use for this invocation.
+   * @return status WifiStatus of the operation.
+   *         Possible status codes:
+   *         |WifiStatusCode.SUCCESS|,
+   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+   *         |WifiStatusCode.ERROR_UNKNOWN|
+   */
+  getCapabilitiesRequest(CommandIdShort cmdId) generates (WifiStatus status);
+
+  /**
+   * Enable NAN: configures and activates NAN clustering (does not start
+   * a discovery session or set up data-interfaces or data-paths). Use the
+   * |configureRequest| method to change the configuration of an already enabled
+   * NAN interface.
    *
    * @param cmdId command Id to use for this invocation.
    * @param msg Instance of |NanEnableRequest|.
@@ -50,7 +65,23 @@
    *         |WifiStatusCode.ERROR_INVALID_ARGS|,
    *         |WifiStatusCode.ERROR_UNKNOWN|
    */
-  enableRequest(CommandId cmdId, NanEnableRequest msg)
+  enableRequest(CommandIdShort cmdId, NanEnableRequest msg)
+      generates (WifiStatus status);
+
+  /**
+   * Configure NAN: configures an existing NAN functionality (i.e. assumes
+   * |enableRequest| already submitted and succeeded).
+   *
+   * @param cmdId command Id to use for this invocation.
+   * @param msg Instance of |NanConfigRequest|.
+   * @return status WifiStatus of the operation.
+   *         Possible status codes:
+   *         |WifiStatusCode.SUCCESS|,
+   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
+   *         |WifiStatusCode.ERROR_UNKNOWN|
+   */
+  configRequest(CommandIdShort cmdId, NanConfigRequest msg)
       generates (WifiStatus status);
 
   /**
@@ -63,10 +94,10 @@
    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
    *         |WifiStatusCode.ERROR_UNKNOWN|
    */
-  disableRequest(CommandId cmdId) generates (WifiStatus status);
+  disableRequest(CommandIdShort cmdId) generates (WifiStatus status);
 
   /**
-   * Publish request to advertize a service.
+   * Publish request to start advertising a discovery service.
    *
    * @param cmdId command Id to use for this invocation.
    * @param msg Instance of |NanPublishRequest|.
@@ -77,26 +108,25 @@
    *         |WifiStatusCode.ERROR_INVALID_ARGS|,
    *         |WifiStatusCode.ERROR_UNKNOWN|
    */
-  publishRequest(CommandId cmdId, NanPublishRequest msg)
+  startPublishRequest(CommandIdShort cmdId, NanPublishRequest msg)
       generates (WifiStatus status);
 
   /**
-   * Cancel previous publish requests.
+   * Stop publishing a discovery service.
    *
    * @param cmdId command Id to use for this invocation.
-   * @param msg Instance of |NanPublishCancelRequest|.
+   * @param sessionId ID of the publish discovery session to be stopped.
    * @return status WifiStatus of the operation.
    *         Possible status codes:
    *         |WifiStatusCode.SUCCESS|,
    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
-   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
    *         |WifiStatusCode.ERROR_UNKNOWN|
    */
-  publishCancelRequest(CommandId cmdId, NanPublishCancelRequest msg)
+  stopPublishRequest(CommandIdShort cmdId, uint16_t sessionId)
       generates (WifiStatus status);
 
   /**
-   * Subscribe request to search for a service.
+   * Subscribe request to start searching for a discovery service.
    *
    * @param cmdId command Id to use for this invocation.
    * @param msg Instance of |NanSubscribeRequest|.
@@ -107,26 +137,25 @@
    *         |WifiStatusCode.ERROR_INVALID_ARGS|,
    *         |WifiStatusCode.ERROR_UNKNOWN|
    */
-  subscribeRequest(CommandId cmdId, NanSubscribeRequest msg)
+  startSubscribeRequest(CommandIdShort cmdId, NanSubscribeRequest msg)
       generates (WifiStatus status);
 
   /**
-   * Cancel previous subscribe requests.
+   * Stop subscribing to a discovery service.
    *
    * @param cmdId command Id to use for this invocation.
-   * @param msg Instance of |NanSubscribeCancelRequest|.
+   * @param sessionId ID of the subscribe discovery session to be stopped.
    * @return status WifiStatus of the operation.
    *         Possible status codes:
    *         |WifiStatusCode.SUCCESS|,
    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
-   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
    *         |WifiStatusCode.ERROR_UNKNOWN|
    */
-  subscribeCancelRequest(CommandId cmdId, NanSubscribeCancelRequest msg)
+  stopSubscribeRequest(CommandIdShort cmdId, uint16_t sessionId)
       generates (WifiStatus status);
 
   /**
-   * NAN transmit follow up request.
+   * NAN transmit follow up message request.
    *
    * @param cmdId command Id to use for this invocation.
    * @param msg Instance of |NanTransmitFollowupRequest|.
@@ -137,14 +166,40 @@
    *         |WifiStatusCode.ERROR_INVALID_ARGS|,
    *         |WifiStatusCode.ERROR_UNKNOWN|
    */
-  transmitFollowupRequest(CommandId cmdId, NanTransmitFollowupRequest msg)
+  transmitFollowupRequest(CommandIdShort cmdId, NanTransmitFollowupRequest msg)
       generates (WifiStatus status);
 
   /**
-   * NAN configuration request.
+   * Create a NAN Data Interface.
    *
    * @param cmdId command Id to use for this invocation.
-   * @param msg Instance of |NanConfigRequest|.
+   * @return status WifiStatus of the operation.
+   *         Possible status codes:
+   *         |WifiStatusCode.SUCCESS|,
+   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+   *         |WifiStatusCode.ERROR_UNKNOWN|
+   */
+  createDataInterfaceRequest(CommandIdShort cmdId, string ifaceName)
+      generates (WifiStatus status);
+
+  /**
+   * Delete a NAN Data Interface.
+   *
+   * @param cmdId command Id to use for this invocation.
+   * @return status WifiStatus of the operation.
+   *         Possible status codes:
+   *         |WifiStatusCode.SUCCESS|,
+   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+   *         |WifiStatusCode.ERROR_UNKNOWN|
+   */
+  deleteDataInterfaceRequest(CommandIdShort cmdId, string ifaceName)
+      generates (WifiStatus status);
+
+  /**
+   * Initiate a data-path (NDP) setup operation: Initiator.
+   *
+   * @param cmdId command Id to use for this invocation.
+   * @param msg Instance of |NanInitiateDataPathRequest|.
    * @return status WifiStatus of the operation.
    *         Possible status codes:
    *         |WifiStatusCode.SUCCESS|,
@@ -152,13 +207,42 @@
    *         |WifiStatusCode.ERROR_INVALID_ARGS|,
    *         |WifiStatusCode.ERROR_UNKNOWN|
    */
-  configRequest(CommandId cmdId, NanConfigRequest msg)
+  initiateDataPathRequest(CommandIdShort cmdId, NanInitiateDataPathRequest msg)
       generates (WifiStatus status);
 
   /**
-   * Set NAN Beacon or sdf payload to discovery engine.
-   * This instructs the Discovery Engine to begin publishing the
-   * received payload in any Beacon or Service Discovery Frame transmitted
+   * Respond to a received data indication as part of a data-path (NDP) setup operation. An
+   * indication is received by the Responder from the Initiator.
+   *
+   * @param cmdId command Id to use for this invocation.
+   * @param msg Instance of |NanRespondToDataPathIndicationRequest|.
+   * @return status WifiStatus of the operation.
+   *         Possible status codes:
+   *         |WifiStatusCode.SUCCESS|,
+   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
+   *         |WifiStatusCode.ERROR_UNKNOWN|
+   */
+  respondToDataPathIndicationRequest(CommandIdShort cmdId,
+                                     NanRespondToDataPathIndicationRequest msg)
+      generates (WifiStatus status);
+
+  /**
+   * Data-path (NDP) termination request: executed by either Initiator or Responder.
+   *
+   * @param cmdId command Id to use for this invocation.
+   * @param ndpInstanceId Data-path instance ID to be terminated.
+   * @return status WifiStatus of the operation.
+   *         Possible status codes:
+   *         |WifiStatusCode.SUCCESS|,
+   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
+   *         |WifiStatusCode.ERROR_UNKNOWN|
+   */
+  terminateDataPathRequest(CommandIdShort cmdId, uint32_t ndpInstanceId)
+      generates (WifiStatus status);
+
+  /**
+   * Configure NAN Beacon or SDF payload to include vendor-specific payload.
    *
    * @param cmdId command Id to use for this invocation.
    * @param msg Instance of |NanBeaconSdfPayloadRequest|.
@@ -169,107 +253,6 @@
    *         |WifiStatusCode.ERROR_INVALID_ARGS|,
    *         |WifiStatusCode.ERROR_UNKNOWN|
    */
-  beaconSdfPayloadRequest(CommandId cmdId, NanBeaconSdfPayloadRequest msg)
-      generates (WifiStatus status);
-
-  /**
-   * Get NAN HAL version.
-   *
-   * @param cmdId command Id to use for this invocation.
-   * @return version Instance of |NanVersion|.
-   * @return status WifiStatus of the operation.
-   *         Possible status codes:
-   *         |WifiStatusCode.SUCCESS|,
-   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
-   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
-   *         |WifiStatusCode.ERROR_UNKNOWN|
-   */
-  getVersion() generates (WifiStatus status, NanVersion version);
-
-  /**
-   * Get NAN capabilities.
-   *
-   * @param cmdId command Id to use for this invocation.
-   * @return status WifiStatus of the operation.
-   *         Possible status codes:
-   *         |WifiStatusCode.SUCCESS|,
-   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
-   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
-   *         |WifiStatusCode.ERROR_UNKNOWN|
-   */
-  getCapabilities(CommandId cmdId) generates (WifiStatus status);
-
-  /**
-   * Create NAN Data Interface
-   *
-   * @param cmdId command Id to use for this invocation.
-   * @return status WifiStatus of the operation.
-   *         Possible status codes:
-   *         |WifiStatusCode.SUCCESS|,
-   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
-   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
-   *         |WifiStatusCode.ERROR_UNKNOWN|
-   */
-  dataInterfaceCreate(CommandId cmdId, string ifaceName)
-      generates (WifiStatus status);
-
-  /**
-   * Delete NAN Data Interface.
-   *
-   * @param cmdId command Id to use for this invocation.
-   * @return status WifiStatus of the operation.
-   *         Possible status codes:
-   *         |WifiStatusCode.SUCCESS|,
-   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
-   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
-   *         |WifiStatusCode.ERROR_UNKNOWN|
-   */
-  dataInterfaceDelete(CommandId cmdId, string ifaceName)
-      generates (WifiStatus status);
-
-  /**
-   * Initiate a NDP session: Initiator
-   *
-   * @param cmdId command Id to use for this invocation.
-   * @param msg Instance of |NanDataPathInitiatorRequest|.
-   * @return status WifiStatus of the operation.
-   *         Possible status codes:
-   *         |WifiStatusCode.SUCCESS|,
-   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
-   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
-   *         |WifiStatusCode.ERROR_UNKNOWN|
-   */
-  dataRequestInitiator(CommandId cmdId, NanDataPathInitiatorRequest msg)
-      generates (WifiStatus status);
-
-  /**
-   * Response to a data indication received corresponding to a NDP session. An indication
-   * is received with a data request and the responder will send a data response.
-   *
-   * @param cmdId command Id to use for this invocation.
-   * @param msg Instance of |NanDataPathIndicationResponse|.
-   * @return status WifiStatus of the operation.
-   *         Possible status codes:
-   *         |WifiStatusCode.SUCCESS|,
-   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
-   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
-   *         |WifiStatusCode.ERROR_UNKNOWN|
-   */
-  dataIndicationResponse(CommandId cmdId, NanDataPathIndicationResponse msg)
-      generates (WifiStatus status);
-
-  /**
-   * NDL termination request: from either Initiator/Responder.
-   *
-   * @param cmdId command Id to use for this invocation.
-   * @param msg Instance of |NanDataPathEndRequest|.
-   * @return status WifiStatus of the operation.
-   *         Possible status codes:
-   *         |WifiStatusCode.SUCCESS|,
-   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
-   *         |WifiStatusCode.ERROR_INVALID_ARGS|,
-   *         |WifiStatusCode.ERROR_UNKNOWN|
-   */
-  dataEnd(CommandId cmdId, NanDataPathEndRequest msg)
+  beaconSdfPayloadRequest(CommandIdShort cmdId, NanBeaconSdfPayloadRequest msg)
       generates (WifiStatus status);
 };
diff --git a/wifi/1.0/IWifiNanIfaceEventCallback.hal b/wifi/1.0/IWifiNanIfaceEventCallback.hal
index 2b90cba..906d673 100644
--- a/wifi/1.0/IWifiNanIfaceEventCallback.hal
+++ b/wifi/1.0/IWifiNanIfaceEventCallback.hal
@@ -17,65 +17,297 @@
 package android.hardware.wifi@1.0;
 
 /**
- * NAN Response and Event Callbacks.
+ * NAN Response and Asynchronous Event Callbacks.
  */
 interface IWifiNanIfaceEventCallback {
   /**
-   * Callback invoked to notify the status of the Publish Request.
+   * Callback invoked in response to a capability request |getCapabilitiesRequest|.
    *
    * @param cmdId command Id corresponding to the original request.
-   * @param rspData Message Data.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   * @param capabilities Capability data.
    */
-  oneway notifyPublishResponse(CommandId id, NanPublishResponseMsg rspData);
+  oneway notifyCapabilitiesResponse(CommandIdShort id, WifiNanStatus status,
+                                    NanCapabilities capabilities);
 
   /**
-   * Callback invoked to notify the status of the Subscribe Request.
+   * Callback invoked in response to an enable request |enableRequest|.
    *
    * @param cmdId command Id corresponding to the original request.
-   * @param rspData Message Data.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.ALREADY_ENABLED|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   *        |NanStatusType.PROTOCOL_FAILURE|
+   *        |NanStatusType.NAN_NOT_ALLOWED|
    */
-  oneway notifySubscribeResponse(CommandId id, NanSubscribeResponseMsg rspData);
+  oneway notifyEnableResponse(CommandIdShort id, WifiNanStatus status);
 
   /**
-   * Callback invoked to notify the status of the Data Path Request.
+   * Callback invoked in response to a config request |configRequest|.
    *
    * @param cmdId command Id corresponding to the original request.
-   * @param rspData Message Data.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   *        |NanStatusType.PROTOCOL_FAILURE|
    */
-  oneway notifyDataPathResponse(CommandId id, NanDataPathResponseMsg rspData);
+  oneway notifyConfigResponse(CommandIdShort id, WifiNanStatus status);
 
   /**
-   * Callback invoked to notify the status of the Capability Request.
+   * Callback invoked in response to a disable request |disableRequest|.
    *
    * @param cmdId command Id corresponding to the original request.
-   * @param rspData Message Data.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.PROTOCOL_FAILURE|
    */
-  oneway notifyCapabilitiesResponse(CommandId id, NanCapabilitiesResponseMsg rspData);
+  oneway notifyDisableResponse(CommandIdShort id, WifiNanStatus status);
+
+  /**
+   * Callback invoked to notify the status of the start publish request |startPublishRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.PROTOCOL_FAILURE|
+   *        |NanStatusType.NO_RESOURCES_AVAILABLE|
+   *        |NanStatusType.INVALID_SESSION_ID|
+   * @param sessionId ID of the new publish session (if successfully created).
+   */
+  oneway notifyStartPublishResponse(CommandIdShort id, WifiNanStatus status, uint16_t sessionId);
+
+  /**
+   * Callback invoked in response to a stop publish request |stopPublishRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_SESSION_ID|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   */
+  oneway notifyStopPublishResponse(CommandIdShort id, WifiNanStatus status);
+
+  /**
+   * Callback invoked to notify the status of the start subscribe request |startSubscribeRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.PROTOCOL_FAILURE|
+   *        |NanStatusType.NO_RESOURCES_AVAILABLE|
+   *        |NanStatusType.INVALID_SESSION_ID|
+   * @param sessionId ID of the new subscribe session (if successfully created).
+   */
+  oneway notifyStartSubscribeResponse(CommandIdShort id, WifiNanStatus status, uint16_t sessionId);
+
+  /**
+   * Callback invoked in response to a stop subscribe request |stopSubscribeRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_SESSION_ID|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   */
+  oneway notifyStopSubscribeResponse(CommandIdShort id, WifiNanStatus status);
+
+  /**
+   * Callback invoked in response to a transmit followup request |transmitFollowupRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   *        |NanStatusType.INVALID_SESSION_ID|
+   *        |NanStatusType.INVALID_PEER_ID|
+   */
+  oneway notifyTransmitFollowupResponse(CommandIdShort id, WifiNanStatus status);
+
+  /**
+   * Callback invoked in response to a create data interface request |createDataInterfaceRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   */
+  oneway notifyCreateDataInterfaceResponse(CommandIdShort id, WifiNanStatus status);
+
+  /**
+   * Callback invoked in response to a delete data interface request |deleteDataInterfaceRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   */
+  oneway notifyDeleteDataInterfaceResponse(CommandIdShort id, WifiNanStatus status);
+
+  /**
+   * Callback invoked in response to an initiate data path request |initiateDataPathRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   *        |NanStatusType.PROTOCOL_FAILURE|
+   *        |NanStatusType.INVALID_PEER_ID|
+   */
+  oneway notifyInitiateDataPathResponse(CommandIdShort id, WifiNanStatus status);
+
+  /**
+   * Callback invoked in response to a respond to data path indication request
+   * |respondToDataPathIndicationRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   *        |NanStatusType.PROTOCOL_FAILURE|
+   *        |NanStatusType.INVALID_NDP_ID|
+   * @param ndpInstanceId ID of the new data path being negotiated (on successful status).
+   */
+  oneway notifyRespondToDataPathIndicationResponse(CommandIdShort id, WifiNanStatus status,
+                                                   uint32_t ndpInstanceId);
+
+  /**
+   * Callback invoked in response to a terminate data path request |terminateDataPathRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   *        |NanStatusType.PROTOCOL_FAILURE|
+   *        |NanStatusType.INVALID_NDP_ID|
+   */
+  oneway notifyTerminateDataPathResponse(CommandIdShort id, WifiNanStatus status);
+
+  /**
+   * Callback invoked in response to a request to include vendor-specific payload in beacon or SDF
+   * frames |beaconSdfPayloadRequest|.
+   *
+   * @param cmdId command Id corresponding to the original request.
+   * @param status WifiNanStatus of the operation. Possible status codes are:
+   *        |NanStatusType.SUCCESS|
+   *        |NanStatusType.INVALID_ARGS|
+   *        |NanStatusType.INTERNAL_FAILURE|
+   */
+  oneway notifyBeaconSdfPayloadResponse(CommandIdShort id, WifiNanStatus status);
 
   /**
    * Callbacks for the various asynchornous NAN Events.
    */
-  oneway eventPublishTerminated(NanPublishTerminatedInd event);
 
+  /**
+   * Asynchronous callback indicating that a cluster event has been received.
+   *
+   * @param event: NanClusterEventInd containing event details.
+   */
+  oneway eventClusterEvent(NanClusterEventInd event);
+
+  /**
+   * Asynchronous callback indicating that a NAN has been disabled.
+   *
+   * @param status: WifiNanStatus describing the reason for the disable event.
+   *                Possible status codes are:
+   *                |NanStatusType.SUCCESS|
+   *                |NanStatusType.UNSUPPORTED_CONCURRENCY_NAN_DISABLED|
+   */
+  oneway eventDisabled(WifiNanStatus status);
+
+  /**
+   * Asynchronous callback indicating that an active publish session has terminated.
+   *
+   * @param sessionId: The discovery session ID of the terminated session.
+   * @param status: WifiNanStatus describing the reason for the session termination.
+   *                Possible status codes are:
+   *                |NanStatusType.SUCCESS|
+   */
+  oneway eventPublishTerminated(uint16_t sessionId, WifiNanStatus status);
+
+  /**
+   * Asynchronous callback indicating that an active subscribe session has terminated.
+   *
+   * @param sessionId: The discovery session ID of the terminated session.
+   * @param status: WifiNanStatus describing the reason for the session termination.
+   *                 Possible status codes are:
+   *                |NanStatusType.SUCCESS|
+   */
+  oneway eventSubscribeTerminated(uint16_t sessionId, WifiNanStatus status);
+
+  /**
+   * Asynchronous callback indicating that a match has occurred: i.e. a service has been
+   * discovered.
+   *
+   * @param event: NanMatchInd containing event details.
+   */
   oneway eventMatch(NanMatchInd event);
 
-  oneway eventMatchExpired(NanMatchExpiredInd event);
+  /**
+   * Asynchronous callback indicating that a previously discovered match (service) has expired.
+   *
+   * @param discoverySessionId: The discovery session ID of the expired match.
+   * @param peerId: The peer ID of the expired match.
+   */
+  oneway eventMatchExpired(uint16_t discoverySessionId, uint32_t peerId);
 
-  oneway eventSubscribeTerminated(NanSubscribeTerminatedInd event);
+  /**
+   * Asynchronous callback indicating that a followup message has been received from a peer.
+   *
+   * @param event: NanFollowupReceivedInd containing event details.
+   */
+  oneway eventFollowupReceived(NanFollowupReceivedInd event);
 
-  oneway eventFollowup(NanFollowupInd event);
+  /**
+   * Asynchronous callback providing status on a completed followup message transmit operation.
+   *
+   * @param cmdId command Id corresponding to the original |transmitFollowupRequest| request.
+   * @param status WifiNanStatus of the operation.  Possible status codes are:
+   *               |NanStatusType.NO_OTA_ACK|
+   *               |NanStatusType.FOLLOWUP_TX_QUEUE_FULL|
+   */
+  oneway eventTransmitFollowup(CommandIdShort id, WifiNanStatus status);
 
-  oneway eventDiscEngEvent(NanDiscEngEventInd event);
+  /**
+   * Asynchronous callback indicating a data-path (NDP) setup has been requested by an Initiator
+   * peer (received by the intended Respodner).
+   *
+   * @param event: NanDataPathRequestInd containing event details.
+   */
+  oneway eventDataPathRequest(NanDataPathRequestInd event);
 
-  oneway eventDisabled(NanDisabledInd event);
+  /**
+   * Asynchronous callback indicating a data-path (NDP) setup has been completed: received by
+   * both Initiator and Responder.
+   *
+   * @param event: NanDataPathConfirmInd containing event details.
+   */
+  oneway eventDataPathConfirm(NanDataPathConfirmInd event);
 
+  /**
+   * Asynchronous callback indicating a list of data-paths (NDP) have been terminated: received by
+   * both Initiator and Responder.
+   *
+   * @param ndpInstanceId: data-path ID of the terminated data-path.
+   */
+  oneway eventDataPathTerminated(uint32_t ndpInstanceId);
+
+  /**
+   * Asynchronous callback indicating vendor-specific payload received in NAN beacon or SDF frame.
+   *
+   * @param event: NanBeaconSdfPayloadInd containing event details.
+   */
   oneway eventBeaconSdfPayload(NanBeaconSdfPayloadInd event);
-
-  oneway eventDataRequest(NanDataPathRequestInd event);
-
-  oneway eventDataConfirm(NanDataPathConfirmInd event);
-
-  oneway eventDataEnd(NanDataPathEndInd event);
-
-  oneway eventTransmitFollowup(NanTransmitFollowupInd event);
 };
diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.0/default/hidl_struct_util.cpp
index a94d812..9cc57bb 100644
--- a/wifi/1.0/default/hidl_struct_util.cpp
+++ b/wifi/1.0/default/hidl_struct_util.cpp
@@ -743,123 +743,10 @@
   CHECK(false);
 }
 
-legacy_hal::NanPublishType convertHidlNanPublishTypeToLegacy(
-    NanPublishType type) {
-  switch (type) {
-    case NanPublishType::UNSOLICITED:
-      return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED;
-    case NanPublishType::SOLICITED:
-      return legacy_hal::NAN_PUBLISH_TYPE_SOLICITED;
-    case NanPublishType::UNSOLICITED_SOLICITED:
-      return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED;
-  };
-  CHECK(false);
-}
-
-legacy_hal::NanTxType convertHidlNanTxTypeToLegacy(NanTxType type) {
-  switch (type) {
-    case NanTxType::BROADCAST:
-      return legacy_hal::NAN_TX_TYPE_BROADCAST;
-    case NanTxType::UNICAST:
-      return legacy_hal::NAN_TX_TYPE_UNICAST;
-  };
-  CHECK(false);
-}
-
-legacy_hal::NanMatchAlg convertHidlNanMatchAlgToLegacy(NanMatchAlg type) {
-  switch (type) {
-    case NanMatchAlg::MATCH_ONCE:
-      return legacy_hal::NAN_MATCH_ALG_MATCH_ONCE;
-    case NanMatchAlg::MATCH_CONTINUOUS:
-      return legacy_hal::NAN_MATCH_ALG_MATCH_CONTINUOUS;
-    case NanMatchAlg::MATCH_NEVER:
-      return legacy_hal::NAN_MATCH_ALG_MATCH_NEVER;
-  };
-  CHECK(false);
-}
-
-legacy_hal::NanSubscribeType convertHidlNanSubscribeTypeToLegacy(
-    NanSubscribeType type) {
-  switch (type) {
-    case NanSubscribeType::ACTIVE:
-      return legacy_hal::NAN_SUBSCRIBE_TYPE_ACTIVE;
-    case NanSubscribeType::PASSIVE:
-      return legacy_hal::NAN_SUBSCRIBE_TYPE_PASSIVE;
-  };
-  CHECK(false);
-}
-
-legacy_hal::NanSRFType convertHidlNanSrfTypeToLegacy(NanSrfType type) {
-  switch (type) {
-    case NanSrfType::BLOOM_FILTER:
-      return legacy_hal::NAN_SRF_ATTR_BLOOM_FILTER;
-    case NanSrfType::PARTIAL_MAC_ADDR:
-      return legacy_hal::NAN_SRF_ATTR_PARTIAL_MAC_ADDR;
-  };
-  CHECK(false);
-}
-
-legacy_hal::NanSRFIncludeType convertHidlNanSrfIncludeTypeToLegacy(
-    NanSrfIncludeType type) {
-  switch (type) {
-    case NanSrfIncludeType::DO_NOT_RESPOND:
-      return legacy_hal::NAN_SRF_INCLUDE_DO_NOT_RESPOND;
-    case NanSrfIncludeType::RESPOND:
-      return legacy_hal::NAN_SRF_INCLUDE_RESPOND;
-  };
-  CHECK(false);
-}
-
 NanStatusType convertLegacyNanStatusTypeToHidl(
-    legacy_hal::NanStatusType /* type */) {
-  // TODO: The |NanStatusType| has changed in legacy HAL and no longer in sync
-  // with the HIDL interface.
-  return NanStatusType::SUCCESS;
-}
-
-NanResponseType convertLegacyNanResponseTypeToHidl(
-    legacy_hal::NanResponseType type) {
-  switch (type) {
-    case legacy_hal::NAN_RESPONSE_ENABLED:
-      return NanResponseType::ENABLED;
-    case legacy_hal::NAN_RESPONSE_DISABLED:
-      return NanResponseType::DISABLED;
-    case legacy_hal::NAN_RESPONSE_PUBLISH:
-      return NanResponseType::PUBLISH;
-    case legacy_hal::NAN_RESPONSE_PUBLISH_CANCEL:
-      return NanResponseType::PUBLISH_CANCEL;
-    case legacy_hal::NAN_RESPONSE_TRANSMIT_FOLLOWUP:
-      return NanResponseType::TRANSMIT_FOLLOWUP;
-    case legacy_hal::NAN_RESPONSE_SUBSCRIBE:
-      return NanResponseType::SUBSCRIBE;
-    case legacy_hal::NAN_RESPONSE_SUBSCRIBE_CANCEL:
-      return NanResponseType::SUBSCRIBE_CANCEL;
-    case legacy_hal::NAN_RESPONSE_STATS:
-      // Not present in HIDL. Is going to be deprecated in legacy HAL as well.
-      CHECK(0);
-    case legacy_hal::NAN_RESPONSE_CONFIG:
-      return NanResponseType::CONFIG;
-    case legacy_hal::NAN_RESPONSE_TCA:
-      // Not present in HIDL. Is going to be deprecated in legacy HAL as well.
-      CHECK(0);
-    case legacy_hal::NAN_RESPONSE_ERROR:
-      return NanResponseType::ERROR;
-    case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD:
-      return NanResponseType::BEACON_SDF_PAYLOAD;
-    case legacy_hal::NAN_GET_CAPABILITIES:
-      return NanResponseType::GET_CAPABILITIES;
-    case legacy_hal::NAN_DP_INTERFACE_CREATE:
-      return NanResponseType::DP_INTERFACE_CREATE;
-    case legacy_hal::NAN_DP_INTERFACE_DELETE:
-      return NanResponseType::DP_INTERFACE_DELETE;
-    case legacy_hal::NAN_DP_INITIATOR_RESPONSE:
-      return NanResponseType::DP_INITIATOR_RESPONSE;
-    case legacy_hal::NAN_DP_RESPONDER_RESPONSE:
-      return NanResponseType::DP_RESPONDER_RESPONSE;
-    case legacy_hal::NAN_DP_END:
-      return NanResponseType::DP_END;
-  };
-  CHECK(false) << "Unknown legacy type: " << type;
+    legacy_hal::NanStatusType type) {
+  // values are identical - may need to do a mapping if they diverge in the future
+  return (NanStatusType) type;
 }
 
 bool convertHidlNanEnableRequestToLegacy(
@@ -868,79 +755,123 @@
   if (!legacy_request) {
     return false;
   }
-  legacy_request->master_pref = hidl_request.masterPref;
-  legacy_request->cluster_low = hidl_request.clusterLow;
-  legacy_request->cluster_high = hidl_request.clusterHigh;
-  legacy_request->config_support_5g = hidl_request.validSupport5gVal;
-  legacy_request->support_5g_val = hidl_request.support5gVal;
-  legacy_request->config_sid_beacon = hidl_request.validSidBeaconVal;
-  legacy_request->sid_beacon_val = hidl_request.sidBeaconVal;
-  legacy_request->config_2dot4g_rssi_close =
-      hidl_request.valid2dot4gRssiCloseVal;
-  legacy_request->rssi_close_2dot4g_val = hidl_request.rssiClose2dot4gVal;
-  legacy_request->config_2dot4g_rssi_middle =
-      hidl_request.valid2dot4gRssiMiddleVal;
-  legacy_request->rssi_middle_2dot4g_val = hidl_request.rssiMiddle2dot4gVal;
-  legacy_request->config_2dot4g_rssi_proximity =
-      hidl_request.valid2dot4gRssiProximityVal;
+  memset(legacy_request, 0, sizeof(legacy_hal::NanEnableRequest));
+
+  // TODO: b/34059183 tracks missing configurations in legacy HAL or uknown defaults
+  legacy_request->config_2dot4g_support = 1;
+  legacy_request->support_2dot4g_val = hidl_request.operateInBand[
+        (size_t) NanBandIndex::NAN_BAND_24GHZ];
+  legacy_request->config_support_5g = 1;
+  legacy_request->support_5g_val = hidl_request.operateInBand[(size_t) NanBandIndex::NAN_BAND_5GHZ];
+  legacy_request->config_hop_count_limit = 0; // TODO: don't know default yet
+  legacy_request->hop_count_limit_val = hidl_request.hopCountMax;
+  legacy_request->master_pref = hidl_request.configParams.masterPref;
+  legacy_request->discovery_indication_cfg = 0;
+  legacy_request->discovery_indication_cfg |=
+        hidl_request.configParams.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0;
+  legacy_request->discovery_indication_cfg |=
+        hidl_request.configParams.disableStartedClusterIndication ? 0x2 : 0x0;
+  legacy_request->discovery_indication_cfg |=
+        hidl_request.configParams.disableJoinedClusterIndication ? 0x4 : 0x0;
+  legacy_request->config_sid_beacon = 1;
+  if (hidl_request.configParams.numberOfServiceIdsInBeacon > 127) {
+    return false;
+  }
+  legacy_request->sid_beacon_val = (hidl_request.configParams.includeServiceIdsInBeacon ? 0x1 : 0x0)
+        | (hidl_request.configParams.numberOfServiceIdsInBeacon << 1);
+  legacy_request->config_rssi_window_size = 0; // TODO: don't know default yet
+  legacy_request->rssi_window_size_val = hidl_request.configParams.rssiWindowSize;
+  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 = 0; // TODO: don't know default yet
+  legacy_request->rssi_close_2dot4g_val =
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiClose;
+  legacy_request->config_2dot4g_rssi_middle = 0; // TODO: don't know default yet
+  legacy_request->rssi_middle_2dot4g_val =
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiMiddle;
+  legacy_request->config_2dot4g_rssi_proximity = 0; // TODO: don't know default yet
   legacy_request->rssi_proximity_2dot4g_val =
-      hidl_request.rssiProximity2dot4gVal;
-  legacy_request->config_hop_count_limit = hidl_request.validHopCountLimitVal;
-  legacy_request->hop_count_limit_val = hidl_request.hopCountLimitVal;
-  legacy_request->config_2dot4g_support = hidl_request.valid2dot4gSupportVal;
-  legacy_request->support_2dot4g_val = hidl_request.support2dot4gVal;
-  legacy_request->config_2dot4g_beacons = hidl_request.valid2dot4gBeaconsVal;
-  legacy_request->beacon_2dot4g_val = hidl_request.beacon2dot4gVal;
-  legacy_request->config_2dot4g_sdf = hidl_request.valid2dot4gSdfVal;
-  legacy_request->sdf_2dot4g_val = hidl_request.sdf2dot4gVal;
-  legacy_request->config_5g_beacons = hidl_request.valid5gBeaconsVal;
-  legacy_request->beacon_5g_val = hidl_request.beacon5gVal;
-  legacy_request->config_5g_sdf = hidl_request.valid5gSdfVal;
-  legacy_request->sdf_5g_val = hidl_request.sdf5gVal;
-  legacy_request->config_5g_rssi_close = hidl_request.valid5gRssiCloseVal;
-  legacy_request->rssi_close_5g_val = hidl_request.rssiClose5gVal;
-  legacy_request->config_5g_rssi_middle = hidl_request.valid5gRssiMiddleVal;
-  legacy_request->rssi_middle_5g_val = hidl_request.rssiMiddle5gVal;
-  legacy_request->config_5g_rssi_close_proximity =
-      hidl_request.valid5gRssiCloseProximityVal;
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiProximity;
+  legacy_request->config_scan_params = 0; // TODO: don't know default yet
+  legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] =
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_24GHZ].dwellTimeMs;
+  legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] =
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_24GHZ].scanPeriodSec;
+  legacy_request->config_dw.config_2dot4g_dw_band = hidl_request.configParams
+        .bandSpecificConfig[(size_t) NanBandIndex::NAN_BAND_24GHZ].validDiscoveryWindowIntervalVal;
+  legacy_request->config_dw.dw_2dot4g_interval_val = hidl_request.configParams
+        .bandSpecificConfig[(size_t) NanBandIndex::NAN_BAND_24GHZ].discoveryWindowIntervalVal;
+  legacy_request->config_5g_rssi_close = 0; // TODO: don't know default yet
+  legacy_request->rssi_close_5g_val =
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiClose;
+  legacy_request->config_5g_rssi_middle = 0; // TODO: don't know default yet
+  legacy_request->rssi_middle_5g_val =
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiMiddle;
+  legacy_request->config_5g_rssi_close_proximity = 0; // TODO: don't know default yet
   legacy_request->rssi_close_proximity_5g_val =
-      hidl_request.rssiCloseProximity5gVal;
-  legacy_request->config_rssi_window_size = hidl_request.validRssiWindowSizeVal;
-  legacy_request->rssi_window_size_val = hidl_request.rssiWindowSizeVal;
-  legacy_request->config_oui = hidl_request.validOuiVal;
-  legacy_request->oui_val = hidl_request.ouiVal;
-  legacy_request->config_intf_addr = hidl_request.validIntfAddrVal;
-  CHECK(hidl_request.intfAddrVal.size() ==
-        sizeof(legacy_request->intf_addr_val));
-  memcpy(legacy_request->intf_addr_val,
-         hidl_request.intfAddrVal.data(),
-         hidl_request.intfAddrVal.size());
-  legacy_request->config_cluster_attribute_val =
-      hidl_request.configClusterAttributeVal;
-  legacy_request->config_scan_params = hidl_request.validScanParamsVal;
-  if (hidl_request.scanParamsVal.dwellTime.size() >
-      sizeof(legacy_request->scan_params_val.dwell_time)) {
-    return false;
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiProximity;
+  legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] =
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs;
+  legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] =
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec;
+  legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] =
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs;
+  legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] =
+        hidl_request.configParams.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec;
+  legacy_request->config_dw.config_5g_dw_band = hidl_request.configParams
+        .bandSpecificConfig[(size_t) NanBandIndex::NAN_BAND_5GHZ].validDiscoveryWindowIntervalVal;
+  legacy_request->config_dw.dw_5g_interval_val = hidl_request.configParams
+        .bandSpecificConfig[(size_t) NanBandIndex::NAN_BAND_5GHZ].discoveryWindowIntervalVal;
+  if (hidl_request.debugConfigs.validClusterIdVals) {
+    legacy_request->cluster_low = hidl_request.debugConfigs.clusterIdLowVal;
+    legacy_request->cluster_high = hidl_request.debugConfigs.clusterIdHighVal;
+  } else { // need 'else' since not configurable in legacy HAL
+    legacy_request->cluster_low = 0x0000;
+    legacy_request->cluster_high = 0xFFFF;
   }
-  memcpy(legacy_request->scan_params_val.dwell_time,
-         hidl_request.scanParamsVal.dwellTime.data(),
-         hidl_request.scanParamsVal.dwellTime.size());
-  if (hidl_request.scanParamsVal.scanPeriod.size() >
-      sizeof(legacy_request->scan_params_val.scan_period)) {
-    return false;
-  }
-  memcpy(legacy_request->scan_params_val.scan_period,
-         hidl_request.scanParamsVal.scanPeriod.data(),
-         hidl_request.scanParamsVal.scanPeriod.size());
-  legacy_request->config_random_factor_force =
-      hidl_request.validRandomFactorForceVal;
-  legacy_request->random_factor_force_val = hidl_request.randomFactorForceVal;
-  legacy_request->config_hop_count_force = hidl_request.validHopCountLimitVal;
-  legacy_request->hop_count_force_val = hidl_request.hopCountLimitVal;
-  legacy_request->config_24g_channel = hidl_request.valid24gChannelVal;
-  legacy_request->channel_24g_val = hidl_request.channel24gVal;
-  legacy_request->config_5g_channel = hidl_request.valid5gChannelVal;
-  legacy_request->channel_5g_val = hidl_request.channel5gVal;
+  legacy_request->config_intf_addr = hidl_request.debugConfigs.validIntfAddrVal;
+  memcpy(legacy_request->intf_addr_val, hidl_request.debugConfigs.intfAddrVal.data(), 6);
+  legacy_request->config_oui = hidl_request.debugConfigs.validOuiVal;
+  legacy_request->oui_val = hidl_request.debugConfigs.ouiVal;
+  legacy_request->config_random_factor_force = hidl_request.debugConfigs.validRandomFactorForceVal;
+  legacy_request->random_factor_force_val = hidl_request.debugConfigs.randomFactorForceVal;
+  legacy_request->config_hop_count_force = hidl_request.debugConfigs.validHopCountForceVal;
+  legacy_request->hop_count_force_val = hidl_request.debugConfigs.hopCountForceVal;
+  legacy_request->config_24g_channel = hidl_request.debugConfigs.validDiscoveryChannelVal;
+  legacy_request->channel_24g_val =
+        hidl_request.debugConfigs.discoveryChannelMhzVal[(size_t) NanBandIndex::NAN_BAND_24GHZ];
+  legacy_request->config_5g_channel = hidl_request.debugConfigs.validDiscoveryChannelVal;
+  legacy_request->channel_5g_val = hidl_request.debugConfigs
+        .discoveryChannelMhzVal[(size_t) NanBandIndex::NAN_BAND_5GHZ];
+  legacy_request->config_2dot4g_beacons = hidl_request.debugConfigs.validUseBeaconsInBandVal;
+  legacy_request->beacon_2dot4g_val = hidl_request.debugConfigs
+        .useBeaconsInBandVal[(size_t) NanBandIndex::NAN_BAND_24GHZ];
+  legacy_request->config_5g_beacons = hidl_request.debugConfigs.validUseBeaconsInBandVal;
+  legacy_request->beacon_5g_val = hidl_request.debugConfigs
+        .useBeaconsInBandVal[(size_t) NanBandIndex::NAN_BAND_5GHZ];
+  legacy_request->config_2dot4g_sdf = hidl_request.debugConfigs.validUseSdfInBandVal;
+  legacy_request->sdf_2dot4g_val = hidl_request.debugConfigs
+        .useSdfInBandVal[(size_t) NanBandIndex::NAN_BAND_24GHZ];
+  legacy_request->config_5g_sdf = hidl_request.debugConfigs.validUseSdfInBandVal;
+  legacy_request->sdf_5g_val = hidl_request.debugConfigs
+        .useSdfInBandVal[(size_t) NanBandIndex::NAN_BAND_5GHZ];
+
   return true;
 }
 
@@ -950,57 +881,69 @@
   if (!legacy_request) {
     return false;
   }
-  legacy_request->publish_id = hidl_request.publishId;
-  legacy_request->ttl = hidl_request.ttl;
-  legacy_request->period = hidl_request.period;
-  legacy_request->publish_type =
-      convertHidlNanPublishTypeToLegacy(hidl_request.publishType);
-  legacy_request->tx_type = convertHidlNanTxTypeToLegacy(hidl_request.txType);
-  legacy_request->publish_count = hidl_request.publishCount;
-  if (hidl_request.serviceName.size() > sizeof(legacy_request->service_name)) {
-    return false;
-  }
-  legacy_request->service_name_len = hidl_request.serviceName.size();
-  memcpy(legacy_request->service_name,
-         hidl_request.serviceName.c_str(),
-         hidl_request.serviceName.size());
-  legacy_request->publish_match_indicator =
-      convertHidlNanMatchAlgToLegacy(hidl_request.publishMatchIndicator);
-  if (hidl_request.serviceSpecificInfo.size() >
-      sizeof(legacy_request->service_specific_info)) {
-    return false;
-  }
-  legacy_request->service_specific_info_len =
-      hidl_request.serviceSpecificInfo.size();
-  memcpy(legacy_request->service_specific_info,
-         hidl_request.serviceSpecificInfo.data(),
-         hidl_request.serviceSpecificInfo.size());
-  if (hidl_request.rxMatchFilter.size() >
-      sizeof(legacy_request->rx_match_filter)) {
-    return false;
-  }
-  legacy_request->rx_match_filter_len = hidl_request.rxMatchFilter.size();
-  memcpy(legacy_request->rx_match_filter,
-         hidl_request.rxMatchFilter.data(),
-         hidl_request.rxMatchFilter.size());
-  if (hidl_request.txMatchFilter.size() >
-      sizeof(legacy_request->tx_match_filter)) {
-    return false;
-  }
-  legacy_request->tx_match_filter_len = hidl_request.txMatchFilter.size();
-  memcpy(legacy_request->tx_match_filter,
-         hidl_request.txMatchFilter.data(),
-         hidl_request.txMatchFilter.size());
-  legacy_request->rssi_threshold_flag = hidl_request.useRssiThreshold;
-  legacy_request->connmap = hidl_request.connmap;
-  legacy_request->recv_indication_cfg = hidl_request.recvIndicationCfg;
-  return true;
-}
+  memset(&legacy_request, 0, sizeof(legacy_hal::NanPublishRequest));
 
-bool convertHidlNanPublishCancelRequestToLegacy(
-    const NanPublishCancelRequest& hidl_request,
-    legacy_hal::NanPublishCancelRequest* legacy_request) {
-  legacy_request->publish_id = hidl_request.publishId;
+  legacy_request->publish_id = hidl_request.baseConfigs.sessionId;
+  legacy_request->ttl = hidl_request.baseConfigs.ttlSec;
+  legacy_request->period = hidl_request.baseConfigs.discoveryWindowPeriod;
+  legacy_request->publish_count = hidl_request.baseConfigs.discoveryCount;
+  legacy_request->service_name_len = hidl_request.baseConfigs.serviceName.size();
+  if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->service_name, hidl_request.baseConfigs.serviceName.c_str(),
+        legacy_request->service_name_len);
+  legacy_request->publish_match_indicator =
+        (legacy_hal::NanMatchAlg) hidl_request.baseConfigs.discoveryMatchIndicator;
+  legacy_request->service_specific_info_len = hidl_request.baseConfigs.serviceSpecificInfo.size();
+  if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->service_specific_info,
+        hidl_request.baseConfigs.serviceSpecificInfo.data(),
+        legacy_request->service_specific_info_len);
+  legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size();
+  if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->rx_match_filter,
+        hidl_request.baseConfigs.rxMatchFilter.data(),
+        legacy_request->rx_match_filter_len);
+  legacy_request->tx_match_filter_len = hidl_request.baseConfigs.txMatchFilter.size();
+  if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->tx_match_filter,
+        hidl_request.baseConfigs.txMatchFilter.data(),
+        legacy_request->tx_match_filter_len);
+  legacy_request->rssi_threshold_flag = hidl_request.baseConfigs.useRssiThreshold;
+  legacy_request->recv_indication_cfg = 0;
+  legacy_request->recv_indication_cfg |=
+        hidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0;
+  legacy_request->recv_indication_cfg |=
+        hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0;
+  legacy_request->recv_indication_cfg |=
+        hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0;
+  legacy_request->cipher_type = hidl_request.baseConfigs.supportedCipherTypes;
+  legacy_request->pmk_len = hidl_request.baseConfigs.pmk.size();
+  if (legacy_request->pmk_len > NAN_PMK_INFO_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->pmk,
+        hidl_request.baseConfigs.pmk.data(),
+        legacy_request->pmk_len);
+  legacy_request->sdea_params.security_cfg = hidl_request.baseConfigs.securityEnabledInNdp ?
+        legacy_hal::NAN_DP_CONFIG_SECURITY : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
+  legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired ?
+        legacy_hal::NAN_RANGING_ENABLE : legacy_hal::NAN_RANGING_DISABLE;
+  legacy_request->ranging_cfg.ranging_interval_msec = hidl_request.baseConfigs.rangingIntervalMsec;
+  legacy_request->ranging_cfg.config_ranging_indications =
+        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->publish_type = (legacy_hal::NanPublishType) hidl_request.publishType;
+  legacy_request->tx_type = (legacy_hal::NanTxType) hidl_request.txType;
+
   return true;
 }
 
@@ -1010,225 +953,417 @@
   if (!legacy_request) {
     return false;
   }
-  legacy_request->subscribe_id = hidl_request.subscribeId;
-  legacy_request->ttl = hidl_request.ttl;
-  legacy_request->period = hidl_request.period;
-  legacy_request->subscribe_type =
-      convertHidlNanSubscribeTypeToLegacy(hidl_request.subscribeType);
-  legacy_request->serviceResponseFilter =
-      convertHidlNanSrfTypeToLegacy(hidl_request.serviceResponseFilter);
-  legacy_request->serviceResponseInclude =
-      convertHidlNanSrfIncludeTypeToLegacy(hidl_request.serviceResponseInclude);
-  legacy_request->useServiceResponseFilter =
-      hidl_request.shouldUseServiceResponseFilter
-          ? legacy_hal::NAN_USE_SRF
-          : legacy_hal::NAN_DO_NOT_USE_SRF;
-  legacy_request->ssiRequiredForMatchIndication =
-      hidl_request.isSsiRequiredForMatchIndication
-          ? legacy_hal::NAN_SSI_REQUIRED_IN_MATCH_IND
-          : legacy_hal::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND;
+  memset(&legacy_request, 0, sizeof(legacy_hal::NanSubscribeRequest));
+
+  legacy_request->subscribe_id = hidl_request.baseConfigs.sessionId;
+  legacy_request->ttl = hidl_request.baseConfigs.ttlSec;
+  legacy_request->period = hidl_request.baseConfigs.discoveryWindowPeriod;
+  legacy_request->subscribe_count = hidl_request.baseConfigs.discoveryCount;
+  legacy_request->service_name_len = hidl_request.baseConfigs.serviceName.size();
+  if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->service_name, hidl_request.baseConfigs.serviceName.c_str(),
+        legacy_request->service_name_len);
   legacy_request->subscribe_match_indicator =
-      convertHidlNanMatchAlgToLegacy(hidl_request.subscribeMatchIndicator);
-  legacy_request->subscribe_count = hidl_request.subscribeCount;
-  if (hidl_request.serviceName.size() > sizeof(legacy_request->service_name)) {
+        (legacy_hal::NanMatchAlg) hidl_request.baseConfigs.discoveryMatchIndicator;
+  legacy_request->service_specific_info_len = hidl_request.baseConfigs.serviceSpecificInfo.size();
+  if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) {
     return false;
   }
-  legacy_request->service_name_len = hidl_request.serviceName.size();
-  memcpy(legacy_request->service_name,
-         hidl_request.serviceName.c_str(),
-         hidl_request.serviceName.size());
-  if (hidl_request.serviceSpecificInfo.size() >
-      sizeof(legacy_request->service_specific_info)) {
-    return false;
-  }
-  legacy_request->service_specific_info_len =
-      hidl_request.serviceSpecificInfo.size();
   memcpy(legacy_request->service_specific_info,
-         hidl_request.serviceSpecificInfo.data(),
-         hidl_request.serviceSpecificInfo.size());
-  if (hidl_request.rxMatchFilter.size() >
-      sizeof(legacy_request->rx_match_filter)) {
+        hidl_request.baseConfigs.serviceSpecificInfo.data(),
+        legacy_request->service_specific_info_len);
+  legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size();
+  if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) {
     return false;
   }
-  legacy_request->rx_match_filter_len = hidl_request.rxMatchFilter.size();
   memcpy(legacy_request->rx_match_filter,
-         hidl_request.rxMatchFilter.data(),
-         hidl_request.rxMatchFilter.size());
-  if (hidl_request.txMatchFilter.size() >
-      sizeof(legacy_request->tx_match_filter)) {
+        hidl_request.baseConfigs.rxMatchFilter.data(),
+        legacy_request->rx_match_filter_len);
+  legacy_request->tx_match_filter_len = hidl_request.baseConfigs.txMatchFilter.size();
+  if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) {
     return false;
   }
-  legacy_request->tx_match_filter_len = hidl_request.txMatchFilter.size();
   memcpy(legacy_request->tx_match_filter,
-         hidl_request.txMatchFilter.data(),
-         hidl_request.txMatchFilter.size());
-  legacy_request->rssi_threshold_flag = hidl_request.useRssiThreshold;
-  legacy_request->connmap = hidl_request.connmap;
-  if (hidl_request.intfAddr.size() > NAN_MAX_SUBSCRIBE_MAX_ADDRESS) {
+        hidl_request.baseConfigs.txMatchFilter.data(),
+        legacy_request->tx_match_filter_len);
+  legacy_request->rssi_threshold_flag = hidl_request.baseConfigs.useRssiThreshold;
+  legacy_request->recv_indication_cfg = 0;
+  legacy_request->recv_indication_cfg |=
+        hidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0;
+  legacy_request->recv_indication_cfg |=
+        hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0;
+  legacy_request->recv_indication_cfg |=
+        hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0;
+  legacy_request->cipher_type = hidl_request.baseConfigs.supportedCipherTypes;
+  legacy_request->pmk_len = hidl_request.baseConfigs.pmk.size();
+  if (legacy_request->pmk_len > NAN_PMK_INFO_LEN) {
     return false;
   }
+  memcpy(legacy_request->pmk,
+        hidl_request.baseConfigs.pmk.data(),
+        legacy_request->pmk_len);
+  legacy_request->sdea_params.security_cfg = hidl_request.baseConfigs.securityEnabledInNdp ?
+        legacy_hal::NAN_DP_CONFIG_SECURITY : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
+  legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired ?
+        legacy_hal::NAN_RANGING_ENABLE : legacy_hal::NAN_RANGING_DISABLE;
+  legacy_request->ranging_cfg.ranging_interval_msec = hidl_request.baseConfigs.rangingIntervalMsec;
+  legacy_request->ranging_cfg.config_ranging_indications =
+        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->subscribe_type = (legacy_hal::NanSubscribeType) hidl_request.subscribeType;
+  legacy_request->serviceResponseFilter = (legacy_hal::NanSRFType) hidl_request.srfType;
+  legacy_request->serviceResponseInclude = hidl_request.srfRespondIfInAddressSet ?
+        legacy_hal::NAN_SRF_INCLUDE_RESPOND : legacy_hal::NAN_SRF_INCLUDE_DO_NOT_RESPOND;
+  legacy_request->useServiceResponseFilter = hidl_request.shouldUseSrf ?
+        legacy_hal::NAN_USE_SRF : legacy_hal::NAN_DO_NOT_USE_SRF;
+  legacy_request->ssiRequiredForMatchIndication = hidl_request.isSsiRequiredForMatch ?
+        legacy_hal::NAN_SSI_REQUIRED_IN_MATCH_IND : legacy_hal::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND;
   legacy_request->num_intf_addr_present = hidl_request.intfAddr.size();
-  for (uint32_t i = 0; i < hidl_request.intfAddr.size(); i++) {
-    CHECK(hidl_request.intfAddr[i].size() ==
-          sizeof(legacy_request->intf_addr[i]));
-    memcpy(legacy_request->intf_addr[i],
-           hidl_request.intfAddr[i].data(),
-           hidl_request.intfAddr[i].size());
+  if (legacy_request->num_intf_addr_present > NAN_MAX_SUBSCRIBE_MAX_ADDRESS) {
+    return false;
   }
-  legacy_request->recv_indication_cfg = hidl_request.recvIndicationCfg;
+  for (int i = 0; i < legacy_request->num_intf_addr_present; i++) {
+    memcpy(legacy_request->intf_addr[i], hidl_request.intfAddr[i].data(), 6);
+  }
+
   return true;
 }
 
-bool convertHidlNanSubscribeCancelRequestToLegacy(
-    const NanSubscribeCancelRequest& /* hidl_request */,
-    legacy_hal::NanSubscribeCancelRequest* /* legacy_request */) {
-  return false;
-}
-
 bool convertHidlNanTransmitFollowupRequestToLegacy(
-    const NanTransmitFollowupRequest& /* hidl_request */,
-    legacy_hal::NanTransmitFollowupRequest* /* legacy_request */) {
-  return false;
+    const NanTransmitFollowupRequest& hidl_request,
+    legacy_hal::NanTransmitFollowupRequest* legacy_request) {
+  if (!legacy_request) {
+    return false;
+  }
+  memset(&legacy_request, 0, sizeof(legacy_hal::NanTransmitFollowupRequest));
+
+  legacy_request->publish_subscribe_id = hidl_request.discoverySessionId;
+  legacy_request->requestor_instance_id = hidl_request.peerId;
+  memcpy(legacy_request->addr, hidl_request.addr.data(), 6);
+  legacy_request->priority = hidl_request.isHighPriority ?
+        legacy_hal::NAN_TX_PRIORITY_HIGH : legacy_hal::NAN_TX_PRIORITY_NORMAL;
+  legacy_request->dw_or_faw = hidl_request.shouldUseDiscoveryWindow ?
+        legacy_hal::NAN_TRANSMIT_IN_DW : legacy_hal::NAN_TRANSMIT_IN_FAW;
+  legacy_request->service_specific_info_len = hidl_request.message.size();
+  if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->service_specific_info,
+        hidl_request.message.data(),
+        legacy_request->service_specific_info_len);
+  legacy_request->recv_indication_cfg = hidl_request.disableFollowupResultIndication ? 0x1 : 0x0;
+
+  return true;
 }
 
 bool convertHidlNanConfigRequestToLegacy(
-    const NanConfigRequest& /* hidl_request */,
-    legacy_hal::NanConfigRequest* /* legacy_request */) {
-  return false;
+    const NanConfigRequest& hidl_request,
+    legacy_hal::NanConfigRequest* legacy_request) {
+  if (!legacy_request) {
+    return false;
+  }
+  memset(&legacy_request, 0, sizeof(legacy_hal::NanConfigRequest));
+
+  // TODO: b/34059183 tracks missing configurations in legacy HAL or uknown defaults
+  legacy_request->master_pref = hidl_request.masterPref;
+  legacy_request->discovery_indication_cfg = 0;
+  legacy_request->discovery_indication_cfg |=
+        hidl_request.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0;
+  legacy_request->discovery_indication_cfg |=
+        hidl_request.disableStartedClusterIndication ? 0x2 : 0x0;
+  legacy_request->discovery_indication_cfg |=
+        hidl_request.disableJoinedClusterIndication ? 0x4 : 0x0;
+  legacy_request->config_sid_beacon = 1;
+  if (hidl_request.numberOfServiceIdsInBeacon > 127) {
+    return false;
+  }
+  legacy_request->sid_beacon = (hidl_request.includeServiceIdsInBeacon ? 0x1 : 0x0)
+        | (hidl_request.numberOfServiceIdsInBeacon << 1);
+  legacy_request->config_rssi_window_size = 0; // TODO: don't know default yet
+  legacy_request->rssi_window_size_val = hidl_request.rssiWindowSize;
+  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 = 0; // TODO: don't know default yet
+  legacy_request->rssi_close_2dot4g_val =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiClose;
+  legacy_request->config_2dot4g_rssi_middle = 0; // TODO: don't know default yet
+  legacy_request->rssi_middle_2dot4g_val =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiMiddle;
+  legacy_request->config_2dot4g_rssi_proximity = 0; // TODO: don't know default yet
+  legacy_request->rssi_proximity_2dot4g_val =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiProximity;
+  */
+  legacy_request->config_scan_params = 0; // TODO: don't know default yet
+  legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_24GHZ].dwellTimeMs;
+  legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_24GHZ].scanPeriodSec;
+  legacy_request->config_dw.config_2dot4g_dw_band = hidl_request
+        .bandSpecificConfig[(size_t) NanBandIndex::NAN_BAND_24GHZ].validDiscoveryWindowIntervalVal;
+  legacy_request->config_dw.dw_2dot4g_interval_val = hidl_request
+        .bandSpecificConfig[(size_t) NanBandIndex::NAN_BAND_24GHZ].discoveryWindowIntervalVal;
+  /* TODO: missing
+  legacy_request->config_5g_rssi_close = 0; // TODO: don't know default yet
+  legacy_request->rssi_close_5g_val =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiClose;
+  legacy_request->config_5g_rssi_middle = 0; // TODO: don't know default yet
+  legacy_request->rssi_middle_5g_val =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiMiddle;
+  */
+  legacy_request->config_5g_rssi_close_proximity = 0; // TODO: don't know default yet
+  legacy_request->rssi_close_proximity_5g_val =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiProximity;
+  legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs;
+  legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec;
+  legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs;
+  legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] =
+        hidl_request.bandSpecificConfig[
+            (size_t) NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec;
+  legacy_request->config_dw.config_5g_dw_band = hidl_request
+        .bandSpecificConfig[(size_t) NanBandIndex::NAN_BAND_5GHZ].validDiscoveryWindowIntervalVal;
+  legacy_request->config_dw.dw_5g_interval_val = hidl_request
+        .bandSpecificConfig[(size_t) NanBandIndex::NAN_BAND_5GHZ].discoveryWindowIntervalVal;
+
+  return true;
 }
 
 bool convertHidlNanBeaconSdfPayloadRequestToLegacy(
-    const NanBeaconSdfPayloadRequest& /* hidl_request */,
-    legacy_hal::NanBeaconSdfPayloadRequest* /* legacy_request */) {
-  return false;
+    const NanBeaconSdfPayloadRequest& hidl_request,
+    legacy_hal::NanBeaconSdfPayloadRequest* legacy_request) {
+  if (!legacy_request) {
+    return false;
+  }
+  memset(&legacy_request, 0, sizeof(legacy_hal::NanBeaconSdfPayloadRequest));
+
+  legacy_request->vsa.payload_transmit_flag = hidl_request.transmitInNext16dws ? 1 : 0;
+  legacy_request->vsa.tx_in_discovery_beacon = hidl_request.transmitInDiscoveryBeacon;
+  legacy_request->vsa.tx_in_sync_beacon = hidl_request.transmitInSyncBeacon;
+  legacy_request->vsa.tx_in_service_discovery = hidl_request.transmitInServiceDiscoveryFrame;
+  legacy_request->vsa.vendor_oui = hidl_request.vendorOui;
+  legacy_request->vsa.vsa_len = hidl_request.vsa.size();
+  if (legacy_request->vsa.vsa_len > NAN_MAX_VSA_DATA_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->vsa.vsa, hidl_request.vsa.data(), legacy_request->vsa.vsa_len);
+
+  return true;
 }
 
 bool convertHidlNanDataPathInitiatorRequestToLegacy(
-    const NanDataPathInitiatorRequest& /* hidl_request */,
-    legacy_hal::NanDataPathInitiatorRequest* /* legacy_request */) {
-  return false;
+    const NanInitiateDataPathRequest& hidl_request,
+    legacy_hal::NanDataPathInitiatorRequest* legacy_request) {
+  if (!legacy_request) {
+    return false;
+  }
+  memset(&legacy_request, 0, sizeof(legacy_hal::NanDataPathInitiatorRequest));
+
+  legacy_request->requestor_instance_id = hidl_request.peerId;
+  memcpy(legacy_request->peer_disc_mac_addr, hidl_request.peerDiscMacAddr.data(), 6);
+  legacy_request->channel_request_type =
+        (legacy_hal::NanDataPathChannelCfg) hidl_request.channelRequestType;
+  legacy_request->channel = hidl_request.channel;
+  strcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str());
+  legacy_request->ndp_cfg.security_cfg = hidl_request.securityRequired ?
+        legacy_hal::NAN_DP_CONFIG_SECURITY : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
+  legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size();
+  if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(),
+        legacy_request->app_info.ndp_app_info_len);
+  legacy_request->cipher_type = hidl_request.supportedCipherTypes;
+  legacy_request->pmk_len = hidl_request.pmk.size();
+  if (legacy_request->pmk_len > NAN_PMK_INFO_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->pmk, hidl_request.pmk.data(), legacy_request->pmk_len);
+
+  return true;
 }
 
 bool convertHidlNanDataPathIndicationResponseToLegacy(
-    const NanDataPathIndicationResponse& /* hidl_response */,
-    legacy_hal::NanDataPathIndicationResponse* /* legacy_response */) {
-  return false;
-}
+    const NanRespondToDataPathIndicationRequest& hidl_request,
+    legacy_hal::NanDataPathIndicationResponse* legacy_request) {
+  if (!legacy_request) {
+    return false;
+  }
+  memset(&legacy_request, 0, sizeof(legacy_hal::NanDataPathIndicationResponse));
 
-bool convertHidlNanDataPathEndRequestToLegacy(
-    const NanDataPathEndRequest& /* hidl_request */,
-    legacy_hal::NanDataPathEndRequest* /* legacy_request */) {
-  return false;
+  legacy_request->rsp_code = hidl_request.acceptRequest ?
+        legacy_hal::NAN_DP_REQUEST_ACCEPT : legacy_hal::NAN_DP_REQUEST_REJECT;
+  legacy_request->ndp_instance_id = hidl_request.ndpInstanceId;
+  strcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str());
+  legacy_request->ndp_cfg.security_cfg = hidl_request.securityRequired ?
+        legacy_hal::NAN_DP_CONFIG_SECURITY : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
+  legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size();
+  if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(),
+        legacy_request->app_info.ndp_app_info_len);
+  legacy_request->cipher_type = hidl_request.supportedCipherTypes;
+  legacy_request->pmk_len = hidl_request.pmk.size();
+  if (legacy_request->pmk_len > NAN_PMK_INFO_LEN) {
+    return false;
+  }
+  memcpy(legacy_request->pmk, hidl_request.pmk.data(), legacy_request->pmk_len);
+
+  return true;
 }
 
 bool convertLegacyNanResponseHeaderToHidl(
     const legacy_hal::NanResponseMsg& legacy_response,
-    NanResponseMsgHeader* hidl_response) {
-  if (!hidl_response) {
+    WifiNanStatus* wifiNanStatus) {
+  if (!wifiNanStatus) {
     return false;
   }
-  hidl_response->status =
-      convertLegacyNanStatusTypeToHidl(legacy_response.status);
-  hidl_response->value = legacy_response.value;
-  hidl_response->responseType =
-      convertLegacyNanResponseTypeToHidl(legacy_response.response_type);
+  wifiNanStatus->status = convertLegacyNanStatusTypeToHidl(legacy_response.status);
+  wifiNanStatus->description = legacy_response.nan_error;
+
   return true;
 }
 
-bool convertLegacyNanPublishResponseToHidl(
-    const legacy_hal::NanPublishResponse& /* legacy_response */,
-    NanPublishResponse* /* hidl_response */) {
-  return false;
-}
-
-bool convertLegacyNanSubscribeResponseToHidl(
-    const legacy_hal::NanSubscribeResponse& /* legacy_response */,
-    NanSubscribeResponse* /* hidl_response */) {
-  return false;
-}
-
-bool convertLegacyNanDataPathResponseToHidl(
-    const legacy_hal::NanDataPathRequestResponse& /* legacy_response */,
-    NanDataPathResponse* /* hidl_response */) {
-  return false;
-}
-
 bool convertLegacyNanCapabilitiesResponseToHidl(
-    const legacy_hal::NanCapabilities& /* legacy_response */,
-    NanCapabilitiesResponse* /* hidl_response */) {
-  return false;
-}
+    const legacy_hal::NanCapabilities& legacy_response,
+    NanCapabilities* hidl_response) {
+  if (!hidl_response) {
+    return false;
+  }
+  hidl_response->maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters;
+  hidl_response->maxPublishes = legacy_response.max_publishes;
+  hidl_response->maxSubscribes = legacy_response.max_subscribes;
+  hidl_response->maxServiceNameLen = legacy_response.max_service_name_len;
+  hidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len;
+  hidl_response->maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len;
+  hidl_response->maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len;
+  hidl_response->maxVsaDataLen = legacy_response.max_vsa_data_len;
+  hidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces;
+  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->supportedCipherSuites = legacy_response.cipher_suites_supported;
 
-bool convertLegacyNanPublishTerminatedIndToHidl(
-    const legacy_hal::NanPublishTerminatedInd& /* legacy_ind */,
-    NanPublishTerminatedInd* /* hidl_ind */) {
-  return false;
+  return true;
 }
 
 bool convertLegacyNanMatchIndToHidl(
-    const legacy_hal::NanMatchInd& /* legacy_ind */,
-    NanMatchInd* /* hidl_ind */) {
-  return false;
-}
+    const legacy_hal::NanMatchInd& legacy_ind,
+    NanMatchInd* hidl_ind) {
+  if (!hidl_ind) {
+    return false;
+  }
+  hidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id;
+  hidl_ind->peerId = legacy_ind.requestor_instance_id;
+  hidl_ind->addr = hidl_array<uint8_t, 6>(legacy_ind.addr);
+  hidl_ind->serviceSpecificInfo = std::vector<uint8_t>(legacy_ind.service_specific_info,
+        legacy_ind.service_specific_info + legacy_ind.service_specific_info_len);
+  hidl_ind->matchFilter = std::vector<uint8_t>(legacy_ind.sdf_match_filter,
+        legacy_ind.sdf_match_filter + legacy_ind.sdf_match_filter_len);
+  hidl_ind->matchOccuredInBeaconFlag = legacy_ind.match_occured_flag == 1;
+  hidl_ind->outOfResourceFlag = legacy_ind.out_of_resource_flag == 1;
+  hidl_ind->rssiValue = legacy_ind.rssi_value;
+  hidl_ind->peerSupportedCipherTypes = legacy_ind.peer_cipher_type;
+  hidl_ind->peerRequiresSecurityEnabledInNdp =
+        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;
 
-bool convertLegacyNanMatchExpiredIndToHidl(
-    const legacy_hal::NanMatchExpiredInd& /* legacy_ind */,
-    NanMatchExpiredInd* /* hidl_ind */) {
-  return false;
-}
-
-bool convertLegacyNanSubscribeTerminatedIndToHidl(
-    const legacy_hal::NanSubscribeTerminatedInd& /* legacy_ind */,
-    NanSubscribeTerminatedInd* /* hidl_ind */) {
-  return false;
+  return true;
 }
 
 bool convertLegacyNanFollowupIndToHidl(
-    const legacy_hal::NanFollowupInd& /* legacy_ind */,
-    NanFollowupInd* /* hidl_ind */) {
-  return false;
-}
+    const legacy_hal::NanFollowupInd& legacy_ind,
+    NanFollowupReceivedInd* hidl_ind) {
+  if (!hidl_ind) {
+    return false;
+  }
+  hidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id;
+  hidl_ind->peerId = legacy_ind.requestor_instance_id;
+  hidl_ind->addr = hidl_array<uint8_t, 6>(legacy_ind.addr);
+  hidl_ind->receivedInFaw = legacy_ind.dw_or_faw == 1;
+  hidl_ind->message = std::vector<uint8_t>(legacy_ind.service_specific_info,
+        legacy_ind.service_specific_info + legacy_ind.service_specific_info_len);
 
-bool convertLegacyNanDiscEngEventIndToHidl(
-    const legacy_hal::NanDiscEngEventInd& /* legacy_ind */,
-    NanDiscEngEventInd* /* hidl_ind */) {
-  return false;
-}
-
-bool convertLegacyNanDisabledIndToHidl(
-    const legacy_hal::NanDisabledInd& /* legacy_ind */,
-    NanDisabledInd* /* hidl_ind */) {
-  return false;
+  return true;
 }
 
 bool convertLegacyNanBeaconSdfPayloadIndToHidl(
-    const legacy_hal::NanBeaconSdfPayloadInd& /* legacy_ind */,
-    NanBeaconSdfPayloadInd* /* hidl_ind */) {
-  return false;
+    const legacy_hal::NanBeaconSdfPayloadInd& legacy_ind,
+    NanBeaconSdfPayloadInd* hidl_ind) {
+  if (!hidl_ind) {
+    return false;
+  }
+  hidl_ind->addr = hidl_array<uint8_t, 6>(legacy_ind.addr);
+  hidl_ind->isVsaReceived = legacy_ind.is_vsa_received == 1;
+  hidl_ind->vsaReceivedOnFrames = legacy_ind.vsa.vsa_received_on;
+  hidl_ind->vsaVendorOui = legacy_ind.vsa.vendor_oui;
+  hidl_ind->vsa = std::vector<uint8_t>(legacy_ind.vsa.vsa,
+        legacy_ind.vsa.vsa + legacy_ind.vsa.attr_len);
+  hidl_ind->isBeaconSdfPayloadReceived = legacy_ind.is_beacon_sdf_payload_received == 1;
+  hidl_ind->beaconSdfPayloadData = std::vector<uint8_t>(legacy_ind.data.frame_data,
+        legacy_ind.data.frame_data + legacy_ind.data.frame_len);
+
+  return true;
 }
 
 bool convertLegacyNanDataPathRequestIndToHidl(
-    const legacy_hal::NanDataPathRequestInd& /* legacy_ind */,
-    NanDataPathRequestInd* /* hidl_ind */) {
-  return false;
+    const legacy_hal::NanDataPathRequestInd& legacy_ind,
+    NanDataPathRequestInd* hidl_ind) {
+  if (!hidl_ind) {
+    return false;
+  }
+  hidl_ind->discoverySessionId = legacy_ind.service_instance_id;
+  hidl_ind->peerDiscMacAddr = hidl_array<uint8_t, 6>(legacy_ind.peer_disc_mac_addr);
+  hidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id;
+  hidl_ind->securityRequired =
+        legacy_ind.ndp_cfg.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY;
+  hidl_ind->appInfo = std::vector<uint8_t>(legacy_ind.app_info.ndp_app_info,
+        legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len);
+
+  return true;
 }
 
 bool convertLegacyNanDataPathConfirmIndToHidl(
-    const legacy_hal::NanDataPathConfirmInd& /* legacy_ind */,
-    NanDataPathConfirmInd* /* hidl_ind */) {
-  return false;
-}
+    const legacy_hal::NanDataPathConfirmInd& legacy_ind,
+    NanDataPathConfirmInd* hidl_ind) {
+  if (!hidl_ind) {
+    return false;
+  }
+  hidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id;
+  hidl_ind->dataPathSetupSuccess = legacy_ind.rsp_code == legacy_hal::NAN_DP_REQUEST_ACCEPT;
+  hidl_ind->peerNdiMacAddr = hidl_array<uint8_t, 6>(legacy_ind.peer_ndi_mac_addr);
+  hidl_ind->appInfo = std::vector<uint8_t>(legacy_ind.app_info.ndp_app_info,
+          legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len);
+  hidl_ind->status.status = convertLegacyNanStatusTypeToHidl(legacy_ind.reason_code);
+  hidl_ind->status.description = ""; // TODO: b/34059183
 
-bool convertLegacyNanDataPathEndIndToHidl(
-    const legacy_hal::NanDataPathEndInd& /* legacy_ind */,
-    NanDataPathEndInd* /* hidl_ind */) {
-  return false;
-}
-
-bool convertLegacyNanTransmitFollowupIndToHidl(
-    const legacy_hal::NanTransmitFollowupInd& /* legacy_ind */,
-    NanTransmitFollowupInd* /* hidl_ind */) {
-  return false;
+  return true;
 }
 
 legacy_hal::wifi_rtt_type convertHidlRttTypeToLegacy(RttType type) {
diff --git a/wifi/1.0/default/hidl_struct_util.h b/wifi/1.0/default/hidl_struct_util.h
index 9086666..14bc77d 100644
--- a/wifi/1.0/default/hidl_struct_util.h
+++ b/wifi/1.0/default/hidl_struct_util.h
@@ -94,87 +94,50 @@
     std::vector<WifiDebugRxPacketFateReport>* hidl_fates);
 
 // NAN iface conversion methods.
+NanStatusType convertLegacyNanStatusTypeToHidl(legacy_hal::NanStatusType type);
 bool convertHidlNanEnableRequestToLegacy(
     const NanEnableRequest& hidl_request,
     legacy_hal::NanEnableRequest* legacy_request);
-bool convertHidlNanPublishRequestToLegacy(
-    const NanPublishRequest& hidl_request,
-    legacy_hal::NanPublishRequest* legacy_request);
-bool convertHidlNanPublishCancelRequestToLegacy(
-    const NanPublishCancelRequest& hidl_request,
-    legacy_hal::NanPublishCancelRequest* legacy_request);
-bool convertHidlNanSubscribeRequestToLegacy(
-    const NanSubscribeRequest& hidl_request,
-    legacy_hal::NanSubscribeRequest* legacy_request);
-bool convertHidlNanSubscribeCancelRequestToLegacy(
-    const NanSubscribeCancelRequest& hidl_request,
-    legacy_hal::NanSubscribeCancelRequest* legacy_request);
-bool convertHidlNanTransmitFollowupRequestToLegacy(
-    const NanTransmitFollowupRequest& hidl_request,
-    legacy_hal::NanTransmitFollowupRequest* legacy_request);
 bool convertHidlNanConfigRequestToLegacy(
     const NanConfigRequest& hidl_request,
     legacy_hal::NanConfigRequest* legacy_request);
+bool convertHidlNanPublishRequestToLegacy(
+    const NanPublishRequest& hidl_request,
+    legacy_hal::NanPublishRequest* legacy_request);
+bool convertHidlNanSubscribeRequestToLegacy(
+    const NanSubscribeRequest& hidl_request,
+    legacy_hal::NanSubscribeRequest* legacy_request);
+bool convertHidlNanTransmitFollowupRequestToLegacy(
+    const NanTransmitFollowupRequest& hidl_request,
+    legacy_hal::NanTransmitFollowupRequest* legacy_request);
 bool convertHidlNanBeaconSdfPayloadRequestToLegacy(
     const NanBeaconSdfPayloadRequest& hidl_request,
     legacy_hal::NanBeaconSdfPayloadRequest* legacy_request);
 bool convertHidlNanDataPathInitiatorRequestToLegacy(
-    const NanDataPathInitiatorRequest& hidl_request,
+    const NanInitiateDataPathRequest& hidl_request,
     legacy_hal::NanDataPathInitiatorRequest* legacy_request);
 bool convertHidlNanDataPathIndicationResponseToLegacy(
-    const NanDataPathIndicationResponse& hidl_response,
+    const NanRespondToDataPathIndicationRequest& hidl_response,
     legacy_hal::NanDataPathIndicationResponse* legacy_response);
-bool convertHidlNanDataPathEndRequestToLegacy(
-    const NanDataPathEndRequest& hidl_request,
-    legacy_hal::NanDataPathEndRequest* legacy_request);
 bool convertLegacyNanResponseHeaderToHidl(
     const legacy_hal::NanResponseMsg& legacy_response,
-    NanResponseMsgHeader* hidl_response);
-bool convertLegacyNanPublishResponseToHidl(
-    const legacy_hal::NanPublishResponse& legacy_response,
-    NanPublishResponse* hidl_response);
-bool convertLegacyNanSubscribeResponseToHidl(
-    const legacy_hal::NanSubscribeResponse& legacy_response,
-    NanSubscribeResponse* hidl_response);
-bool convertLegacyNanDataPathResponseToHidl(
-    const legacy_hal::NanDataPathRequestResponse& legacy_response,
-    NanDataPathResponse* hidl_response);
+    WifiNanStatus* wifiNanStatus);
 bool convertLegacyNanCapabilitiesResponseToHidl(
     const legacy_hal::NanCapabilities& legacy_response,
-    NanCapabilitiesResponse* hidl_response);
-bool convertLegacyNanPublishTerminatedIndToHidl(
-    const legacy_hal::NanPublishTerminatedInd& legacy_ind,
-    NanPublishTerminatedInd* hidl_ind);
+    NanCapabilities* hidl_response);
 bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind,
                                     NanMatchInd* hidl_ind);
-bool convertLegacyNanMatchExpiredIndToHidl(
-    const legacy_hal::NanMatchExpiredInd& legacy_ind,
-    NanMatchExpiredInd* hidl_ind);
-bool convertLegacyNanSubscribeTerminatedIndToHidl(
-    const legacy_hal::NanSubscribeTerminatedInd& legacy_ind,
-    NanSubscribeTerminatedInd* hidl_ind);
 bool convertLegacyNanFollowupIndToHidl(
-    const legacy_hal::NanFollowupInd& legacy_ind, NanFollowupInd* hidl_ind);
-bool convertLegacyNanDiscEngEventIndToHidl(
-    const legacy_hal::NanDiscEngEventInd& legacy_ind,
-    NanDiscEngEventInd* hidl_ind);
-bool convertLegacyNanDisabledIndToHidl(
-    const legacy_hal::NanDisabledInd& legacy_ind, NanDisabledInd* hidl_ind);
-bool convertLegacyNanBeaconSdfPayloadIndToHidl(
-    const legacy_hal::NanBeaconSdfPayloadInd& legacy_ind,
-    NanBeaconSdfPayloadInd* hidl_ind);
+    const legacy_hal::NanFollowupInd& legacy_ind, NanFollowupReceivedInd* hidl_ind);
 bool convertLegacyNanDataPathRequestIndToHidl(
     const legacy_hal::NanDataPathRequestInd& legacy_ind,
     NanDataPathRequestInd* hidl_ind);
 bool convertLegacyNanDataPathConfirmIndToHidl(
     const legacy_hal::NanDataPathConfirmInd& legacy_ind,
     NanDataPathConfirmInd* hidl_ind);
-bool convertLegacyNanDataPathEndIndToHidl(
-    const legacy_hal::NanDataPathEndInd& legacy_ind,
-    NanDataPathEndInd* hidl_ind);
-bool convertLegacyNanTransmitFollowupIndToHidl(
-    const legacy_hal::NanTransmitFollowupInd& legacy_ind,
-    NanTransmitFollowupInd* hidl_ind);
+bool convertLegacyNanBeaconSdfPayloadIndToHidl(
+    const legacy_hal::NanBeaconSdfPayloadInd& legacy_ind,
+    NanBeaconSdfPayloadInd* hidl_ind);
 
 // RTT controller conversion methods.
 bool convertHidlVectorOfRttConfigToLegacy(
diff --git a/wifi/1.0/default/wifi_nan_iface.cpp b/wifi/1.0/default/wifi_nan_iface.cpp
index 8d5cbc9..5ac6fa8 100644
--- a/wifi/1.0/default/wifi_nan_iface.cpp
+++ b/wifi/1.0/default/wifi_nan_iface.cpp
@@ -36,35 +36,378 @@
   // of the object. Whenever the mode changes legacy HAL will remove
   // all of these callbacks.
   legacy_hal::NanCallbackHandlers callback_handlers;
+  android::wp<WifiNanIface> weak_ptr_this(this);
 
   // Callback for response.
-  callback_handlers.on_notify_response = [&](
+  callback_handlers.on_notify_response = [weak_ptr_this](
       legacy_hal::transaction_id id, const legacy_hal::NanResponseMsg& msg) {
-    NanResponseMsgHeader hidl_header;
+    const auto shared_ptr_this = weak_ptr_this.promote();
+    if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+      LOG(ERROR) << "Callback invoked on an invalid object";
+      return;
+    }
+    WifiNanStatus wifiNanStatus;
     if (!hidl_struct_util::convertLegacyNanResponseHeaderToHidl(msg,
-                                                                &hidl_header)) {
+                                                                &wifiNanStatus)) {
       LOG(ERROR) << "Failed to convert nan response header";
       return;
     }
-    // TODO: This is a union in the legacy HAL. Need to convert to appropriate
-    // callback based on type.
-    // Assuming |NanPublishResponseMsg| type here.
-    NanPublishResponse hidl_body;
-    if (!hidl_struct_util::convertLegacyNanPublishResponseToHidl(
-            msg.body.publish_response, &hidl_body)) {
-      LOG(ERROR) << "Failed to convert nan publish response";
-      return;
+
+    switch (msg.response_type) {
+    case legacy_hal::NAN_RESPONSE_ENABLED: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyEnableResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
     }
-    NanPublishResponseMsg hidl_msg;
-    hidl_msg.header = hidl_header;
-    hidl_msg.body = hidl_body;
-    for (const auto& callback : event_callbacks_) {
-      if (!callback->notifyPublishResponse(id, hidl_msg).isOk()) {
-        LOG(ERROR) << "Failed to invoke the callback";
-      }
+    case legacy_hal::NAN_RESPONSE_DISABLED: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyDisableResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_RESPONSE_PUBLISH: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyStartPublishResponse(id, wifiNanStatus,
+                        msg.body.publish_response.publish_id).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_RESPONSE_PUBLISH_CANCEL: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyStopPublishResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_RESPONSE_TRANSMIT_FOLLOWUP: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyTransmitFollowupResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_RESPONSE_SUBSCRIBE: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyStartSubscribeResponse(id, wifiNanStatus,
+                        msg.body.subscribe_response.subscribe_id).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_RESPONSE_SUBSCRIBE_CANCEL: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyStopSubscribeResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_RESPONSE_CONFIG: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyConfigResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+     }
+    case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyBeaconSdfPayloadResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+     }
+    case legacy_hal::NAN_GET_CAPABILITIES: {
+        NanCapabilities hidl_struct;
+        if (!hidl_struct_util::convertLegacyNanCapabilitiesResponseToHidl(
+                msg.body.nan_capabilities, &hidl_struct)) {
+            LOG(ERROR) << "Failed to convert nan capabilities response";
+            return;
+        }
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyCapabilitiesResponse(id, wifiNanStatus,
+                                                    hidl_struct).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_DP_INTERFACE_CREATE: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyCreateDataInterfaceResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_DP_INTERFACE_DELETE: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyDeleteDataInterfaceResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_DP_INITIATOR_RESPONSE: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyInitiateDataPathResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_DP_RESPONDER_RESPONSE: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyRespondToDataPathIndicationResponse(id, wifiNanStatus,
+                    msg.body.data_request_response.ndp_instance_id).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_DP_END: {
+        for (const auto& callback : shared_ptr_this->event_callbacks_) {
+          if (!callback->notifyTerminateDataPathResponse(id, wifiNanStatus).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+          }
+        }
+    }
+    case legacy_hal::NAN_RESPONSE_TCA:
+        /* fall through */
+    case legacy_hal::NAN_RESPONSE_STATS:
+        /* fall through */
+    case legacy_hal::NAN_RESPONSE_ERROR:
+        /* fall through */
+    default:
+        LOG(ERROR) << "Unknown or unhandled response type: " << msg.response_type;
+        return;
     }
   };
-  // TODO: Register the remaining callbacks.
+
+  callback_handlers.on_event_disc_eng_event = [weak_ptr_this](
+        const legacy_hal::NanDiscEngEventInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      NanClusterEventInd hidl_struct;
+      // event types defined identically - hence can be cast
+      hidl_struct.eventType = (NanClusterEventType) msg.event_type;
+      hidl_struct.addr = msg.data.mac_addr.addr;
+
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventClusterEvent(hidl_struct).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
+  callback_handlers.on_event_disabled = [weak_ptr_this](
+        const legacy_hal::NanDisabledInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      WifiNanStatus status;
+      status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
+      status.description = msg.nan_reason;
+
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventDisabled(status).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
+  callback_handlers.on_event_publish_terminated = [weak_ptr_this](
+        const legacy_hal::NanPublishTerminatedInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      WifiNanStatus status;
+      status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
+      status.description = msg.nan_reason;
+
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventPublishTerminated(msg.publish_id, status).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
+  callback_handlers.on_event_subscribe_terminated = [weak_ptr_this](
+        const legacy_hal::NanSubscribeTerminatedInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      WifiNanStatus status;
+      status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
+      status.description = msg.nan_reason;
+
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventSubscribeTerminated(msg.subscribe_id, status).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
+  callback_handlers.on_event_match = [weak_ptr_this](
+        const legacy_hal::NanMatchInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      NanMatchInd hidl_struct;
+      if (!hidl_struct_util::convertLegacyNanMatchIndToHidl(
+            msg, &hidl_struct)) {
+          LOG(ERROR) << "Failed to convert nan capabilities response";
+          return;
+      }
+
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventMatch(hidl_struct).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
+  callback_handlers.on_event_match_expired = [weak_ptr_this](
+        const legacy_hal::NanMatchExpiredInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventMatchExpired(msg.publish_subscribe_id,
+                msg.requestor_instance_id).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
+  callback_handlers.on_event_followup = [weak_ptr_this](
+        const legacy_hal::NanFollowupInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      NanFollowupReceivedInd hidl_struct;
+      if (!hidl_struct_util::convertLegacyNanFollowupIndToHidl(
+            msg, &hidl_struct)) {
+          LOG(ERROR) << "Failed to convert nan capabilities response";
+          return;
+      }
+
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventFollowupReceived(hidl_struct).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
+  callback_handlers.on_event_transmit_follow_up = [weak_ptr_this](
+        const legacy_hal::NanTransmitFollowupInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      WifiNanStatus status;
+      status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
+      status.description = msg.nan_reason;
+
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventTransmitFollowup(msg.id, status).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
+  callback_handlers.on_event_data_path_request = [weak_ptr_this](
+        const legacy_hal::NanDataPathRequestInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      NanDataPathRequestInd hidl_struct;
+      if (!hidl_struct_util::convertLegacyNanDataPathRequestIndToHidl(
+            msg, &hidl_struct)) {
+          LOG(ERROR) << "Failed to convert nan capabilities response";
+          return;
+      }
+
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventDataPathRequest(hidl_struct).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
+  callback_handlers.on_event_data_path_confirm = [weak_ptr_this](
+        const legacy_hal::NanDataPathConfirmInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      NanDataPathConfirmInd hidl_struct;
+      if (!hidl_struct_util::convertLegacyNanDataPathConfirmIndToHidl(
+            msg, &hidl_struct)) {
+          LOG(ERROR) << "Failed to convert nan capabilities response";
+          return;
+      }
+
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventDataPathConfirm(hidl_struct).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
+  callback_handlers.on_event_data_path_end = [weak_ptr_this](
+        const legacy_hal::NanDataPathEndInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        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";
+            }
+        }
+      }
+  };
+
+  callback_handlers.on_event_beacon_sdf_payload = [weak_ptr_this](
+        const legacy_hal::NanBeaconSdfPayloadInd& msg) {
+      const auto shared_ptr_this = weak_ptr_this.promote();
+      if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
+        LOG(ERROR) << "Callback invoked on an invalid object";
+        return;
+      }
+      NanBeaconSdfPayloadInd hidl_struct;
+      if (!hidl_struct_util::convertLegacyNanBeaconSdfPayloadIndToHidl(
+            msg, &hidl_struct)) {
+          LOG(ERROR) << "Failed to convert nan capabilities response";
+          return;
+      }
+
+      for (const auto& callback : shared_ptr_this->event_callbacks_) {
+        if (!callback->eventBeaconSdfPayload(hidl_struct).isOk()) {
+            LOG(ERROR) << "Failed to invoke the callback";
+        }
+      }
+  };
+
   legacy_hal::wifi_error legacy_status =
       legacy_hal_.lock()->nanRegisterCallbackHandlers(callback_handlers);
   if (legacy_status != legacy_hal::WIFI_SUCCESS) {
@@ -90,6 +433,13 @@
                          hidl_status_cb);
 }
 
+Return<void> WifiNanIface::getType(getType_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::getTypeInternal,
+                         hidl_status_cb);
+}
+
 Return<void> WifiNanIface::registerEventCallback(
     const sp<IWifiNanIfaceEventCallback>& callback,
     registerEventCallback_cb hidl_status_cb) {
@@ -100,7 +450,16 @@
                          callback);
 }
 
-Return<void> WifiNanIface::enableRequest(uint32_t cmd_id,
+Return<void> WifiNanIface::getCapabilitiesRequest(uint16_t cmd_id,
+                                                  getCapabilitiesRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::getCapabilitiesRequestInternal,
+                         hidl_status_cb,
+                         cmd_id);
+}
+
+Return<void> WifiNanIface::enableRequest(uint16_t cmd_id,
                                          const NanEnableRequest& msg,
                                          enableRequest_cb hidl_status_cb) {
   return validateAndCall(this,
@@ -111,75 +470,7 @@
                          msg);
 }
 
-Return<void> WifiNanIface::disableRequest(uint32_t cmd_id,
-                                          disableRequest_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::disableRequestInternal,
-                         hidl_status_cb,
-                         cmd_id);
-}
-
-Return<void> WifiNanIface::publishRequest(uint32_t cmd_id,
-                                          const NanPublishRequest& msg,
-                                          publishRequest_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::publishRequestInternal,
-                         hidl_status_cb,
-                         cmd_id,
-                         msg);
-}
-
-Return<void> WifiNanIface::publishCancelRequest(
-    uint32_t cmd_id,
-    const NanPublishCancelRequest& msg,
-    publishCancelRequest_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::publishCancelRequestInternal,
-                         hidl_status_cb,
-                         cmd_id,
-                         msg);
-}
-
-Return<void> WifiNanIface::subscribeRequest(
-    uint32_t cmd_id,
-    const NanSubscribeRequest& msg,
-    subscribeRequest_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::subscribeRequestInternal,
-                         hidl_status_cb,
-                         cmd_id,
-                         msg);
-}
-
-Return<void> WifiNanIface::subscribeCancelRequest(
-    uint32_t cmd_id,
-    const NanSubscribeCancelRequest& msg,
-    subscribeCancelRequest_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::subscribeCancelRequestInternal,
-                         hidl_status_cb,
-                         cmd_id,
-                         msg);
-}
-
-Return<void> WifiNanIface::transmitFollowupRequest(
-    uint32_t cmd_id,
-    const NanTransmitFollowupRequest& msg,
-    transmitFollowupRequest_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::transmitFollowupRequestInternal,
-                         hidl_status_cb,
-                         cmd_id,
-                         msg);
-}
-
-Return<void> WifiNanIface::configRequest(uint32_t cmd_id,
+Return<void> WifiNanIface::configRequest(uint16_t cmd_id,
                                          const NanConfigRequest& msg,
                                          configRequest_cb hidl_status_cb) {
   return validateAndCall(this,
@@ -190,8 +481,134 @@
                          msg);
 }
 
+Return<void> WifiNanIface::disableRequest(uint16_t cmd_id,
+                                          disableRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::disableRequestInternal,
+                         hidl_status_cb,
+                         cmd_id);
+}
+
+Return<void> WifiNanIface::startPublishRequest(uint16_t cmd_id,
+                                               const NanPublishRequest& msg,
+                                               startPublishRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::startPublishRequestInternal,
+                         hidl_status_cb,
+                         cmd_id,
+                         msg);
+}
+
+Return<void> WifiNanIface::stopPublishRequest(
+    uint16_t cmd_id,
+    uint16_t sessionId,
+    stopPublishRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::stopPublishRequestInternal,
+                         hidl_status_cb,
+                         cmd_id,
+                         sessionId);
+}
+
+Return<void> WifiNanIface::startSubscribeRequest(
+    uint16_t cmd_id,
+    const NanSubscribeRequest& msg,
+    startSubscribeRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::startSubscribeRequestInternal,
+                         hidl_status_cb,
+                         cmd_id,
+                         msg);
+}
+
+Return<void> WifiNanIface::stopSubscribeRequest(
+    uint16_t cmd_id,
+    uint16_t sessionId,
+    stopSubscribeRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::stopSubscribeRequestInternal,
+                         hidl_status_cb,
+                         cmd_id,
+                         sessionId);
+}
+
+Return<void> WifiNanIface::transmitFollowupRequest(
+    uint16_t cmd_id,
+    const NanTransmitFollowupRequest& msg,
+    transmitFollowupRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::transmitFollowupRequestInternal,
+                         hidl_status_cb,
+                         cmd_id,
+                         msg);
+}
+
+Return<void> WifiNanIface::createDataInterfaceRequest(
+    uint16_t cmd_id,
+    const hidl_string& iface_name,
+    createDataInterfaceRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::createDataInterfaceRequestInternal,
+                         hidl_status_cb,
+                         cmd_id,
+                         iface_name);
+}
+
+Return<void> WifiNanIface::deleteDataInterfaceRequest(
+    uint16_t cmd_id,
+    const hidl_string& iface_name,
+    deleteDataInterfaceRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::deleteDataInterfaceRequestInternal,
+                         hidl_status_cb,
+                         cmd_id,
+                         iface_name);
+}
+
+Return<void> WifiNanIface::initiateDataPathRequest(
+    uint16_t cmd_id,
+    const NanInitiateDataPathRequest& msg,
+    initiateDataPathRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::initiateDataPathRequestInternal,
+                         hidl_status_cb,
+                         cmd_id,
+                         msg);
+}
+
+Return<void> WifiNanIface::respondToDataPathIndicationRequest(
+    uint16_t cmd_id,
+    const NanRespondToDataPathIndicationRequest& msg,
+    respondToDataPathIndicationRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::respondToDataPathIndicationRequestInternal,
+                         hidl_status_cb,
+                         cmd_id,
+                         msg);
+}
+
+Return<void> WifiNanIface::terminateDataPathRequest(uint16_t cmd_id, uint32_t ndpInstanceId,
+    terminateDataPathRequest_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+                         &WifiNanIface::terminateDataPathRequestInternal,
+                         hidl_status_cb,
+                         cmd_id,
+                         ndpInstanceId);
+}
+
 Return<void> WifiNanIface::beaconSdfPayloadRequest(
-    uint32_t cmd_id,
+    uint16_t cmd_id,
     const NanBeaconSdfPayloadRequest& msg,
     beaconSdfPayloadRequest_cb hidl_status_cb) {
   return validateAndCall(this,
@@ -202,88 +619,6 @@
                          msg);
 }
 
-Return<void> WifiNanIface::getVersion(getVersion_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::getVersionInternal,
-                         hidl_status_cb);
-}
-
-Return<void> WifiNanIface::getCapabilities(uint32_t cmd_id,
-                                           getCapabilities_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::getCapabilitiesInternal,
-                         hidl_status_cb,
-                         cmd_id);
-}
-
-Return<void> WifiNanIface::dataInterfaceCreate(
-    uint32_t cmd_id,
-    const hidl_string& iface_name,
-    dataInterfaceCreate_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::dataInterfaceCreateInternal,
-                         hidl_status_cb,
-                         cmd_id,
-                         iface_name);
-}
-
-Return<void> WifiNanIface::dataInterfaceDelete(
-    uint32_t cmd_id,
-    const hidl_string& iface_name,
-    dataInterfaceDelete_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::dataInterfaceDeleteInternal,
-                         hidl_status_cb,
-                         cmd_id,
-                         iface_name);
-}
-
-Return<void> WifiNanIface::dataRequestInitiator(
-    uint32_t cmd_id,
-    const NanDataPathInitiatorRequest& msg,
-    dataRequestInitiator_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::dataRequestInitiatorInternal,
-                         hidl_status_cb,
-                         cmd_id,
-                         msg);
-}
-
-Return<void> WifiNanIface::dataIndicationResponse(
-    uint32_t cmd_id,
-    const NanDataPathIndicationResponse& msg,
-    dataIndicationResponse_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::dataIndicationResponseInternal,
-                         hidl_status_cb,
-                         cmd_id,
-                         msg);
-}
-
-Return<void> WifiNanIface::dataEnd(uint32_t cmd_id,
-                                   const NanDataPathEndRequest& msg,
-                                   dataEnd_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::dataEndInternal,
-                         hidl_status_cb,
-                         cmd_id,
-                         msg);
-}
-
-Return<void> WifiNanIface::getType(getType_cb hidl_status_cb) {
-  return validateAndCall(this,
-                         WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
-                         &WifiNanIface::getTypeInternal,
-                         hidl_status_cb);
-}
-
 std::pair<WifiStatus, std::string> WifiNanIface::getNameInternal() {
   return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
 }
@@ -294,16 +629,24 @@
 
 WifiStatus WifiNanIface::registerEventCallbackInternal(
     const sp<IWifiNanIfaceEventCallback>& callback) {
-  // TODO(b/31632518): remove the callback when the client is destroyed
+  // 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);
   return createWifiStatus(WifiStatusCode::SUCCESS);
 }
 
-WifiStatus WifiNanIface::enableRequestInternal(uint32_t cmd_id,
+WifiStatus WifiNanIface::getCapabilitiesRequestInternal(uint16_t cmd_id) {
+  legacy_hal::wifi_error legacy_status =
+        legacy_hal_.lock()->nanGetCapabilities(cmd_id);
+  return createWifiStatusFromLegacyError(legacy_status);
+}
+
+WifiStatus WifiNanIface::enableRequestInternal(uint16_t cmd_id,
                                                const NanEnableRequest& msg) {
   legacy_hal::NanEnableRequest legacy_msg;
-  if (!hidl_struct_util::convertHidlNanEnableRequestToLegacy(msg,
-                                                             &legacy_msg)) {
+  if (!hidl_struct_util::convertHidlNanEnableRequestToLegacy(msg, &legacy_msg)) {
     return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
   }
   legacy_hal::wifi_error legacy_status =
@@ -311,14 +654,26 @@
   return createWifiStatusFromLegacyError(legacy_status);
 }
 
-WifiStatus WifiNanIface::disableRequestInternal(uint32_t cmd_id) {
+WifiStatus WifiNanIface::configRequestInternal(
+    uint16_t cmd_id, const NanConfigRequest& msg) {
+  legacy_hal::NanConfigRequest legacy_msg;
+  if (!hidl_struct_util::convertHidlNanConfigRequestToLegacy(msg,
+                                                             &legacy_msg)) {
+    return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+  }
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->nanConfigRequest(cmd_id, legacy_msg);
+  return createWifiStatusFromLegacyError(legacy_status);
+}
+
+WifiStatus WifiNanIface::disableRequestInternal(uint16_t cmd_id) {
   legacy_hal::wifi_error legacy_status =
       legacy_hal_.lock()->nanDisableRequest(cmd_id);
   return createWifiStatusFromLegacyError(legacy_status);
 }
 
-WifiStatus WifiNanIface::publishRequestInternal(uint32_t cmd_id,
-                                                const NanPublishRequest& msg) {
+WifiStatus WifiNanIface::startPublishRequestInternal(uint16_t cmd_id,
+                                                     const NanPublishRequest& msg) {
   legacy_hal::NanPublishRequest legacy_msg;
   if (!hidl_struct_util::convertHidlNanPublishRequestToLegacy(msg,
                                                               &legacy_msg)) {
@@ -329,20 +684,17 @@
   return createWifiStatusFromLegacyError(legacy_status);
 }
 
-WifiStatus WifiNanIface::publishCancelRequestInternal(
-    uint32_t cmd_id, const NanPublishCancelRequest& msg) {
+WifiStatus WifiNanIface::stopPublishRequestInternal(
+    uint16_t cmd_id, uint16_t sessionId) {
   legacy_hal::NanPublishCancelRequest legacy_msg;
-  if (!hidl_struct_util::convertHidlNanPublishCancelRequestToLegacy(
-          msg, &legacy_msg)) {
-    return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
-  }
+  legacy_msg.publish_id = sessionId;
   legacy_hal::wifi_error legacy_status =
       legacy_hal_.lock()->nanPublishCancelRequest(cmd_id, legacy_msg);
   return createWifiStatusFromLegacyError(legacy_status);
 }
 
-WifiStatus WifiNanIface::subscribeRequestInternal(
-    uint32_t cmd_id, const NanSubscribeRequest& msg) {
+WifiStatus WifiNanIface::startSubscribeRequestInternal(
+    uint16_t cmd_id, const NanSubscribeRequest& msg) {
   legacy_hal::NanSubscribeRequest legacy_msg;
   if (!hidl_struct_util::convertHidlNanSubscribeRequestToLegacy(msg,
                                                                 &legacy_msg)) {
@@ -353,59 +705,81 @@
   return createWifiStatusFromLegacyError(legacy_status);
 }
 
-WifiStatus WifiNanIface::subscribeCancelRequestInternal(
-    uint32_t /* cmd_id */, const NanSubscribeCancelRequest& /* msg */) {
-  // TODO implement
-  return createWifiStatus(WifiStatusCode::SUCCESS);
+WifiStatus WifiNanIface::stopSubscribeRequestInternal(
+    uint16_t cmd_id, uint16_t sessionId) {
+  legacy_hal::NanSubscribeCancelRequest legacy_msg;
+  legacy_msg.subscribe_id = sessionId;
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->nanSubscribeCancelRequest(cmd_id, legacy_msg);
+  return createWifiStatusFromLegacyError(legacy_status);
 }
+
 WifiStatus WifiNanIface::transmitFollowupRequestInternal(
-    uint32_t /* cmd_id */, const NanTransmitFollowupRequest& /* msg */) {
-  // TODO implement
-  return createWifiStatus(WifiStatusCode::SUCCESS);
+    uint16_t cmd_id, const NanTransmitFollowupRequest& msg) {
+  legacy_hal::NanTransmitFollowupRequest legacy_msg;
+  if (!hidl_struct_util::convertHidlNanTransmitFollowupRequestToLegacy(msg, &legacy_msg)) {
+    return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+  }
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->nanTransmitFollowupRequest(cmd_id, legacy_msg);
+  return createWifiStatusFromLegacyError(legacy_status);
 }
-WifiStatus WifiNanIface::configRequestInternal(
-    uint32_t /* cmd_id */, const NanConfigRequest& /* msg */) {
-  // TODO implement
-  return createWifiStatus(WifiStatusCode::SUCCESS);
+
+WifiStatus WifiNanIface::createDataInterfaceRequestInternal(
+    uint16_t cmd_id, const std::string& iface_name) {
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->nanDataInterfaceCreate(cmd_id, iface_name);
+  return createWifiStatusFromLegacyError(legacy_status);
+}
+WifiStatus WifiNanIface::deleteDataInterfaceRequestInternal(
+    uint16_t cmd_id, const std::string& iface_name) {
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->nanDataInterfaceDelete(cmd_id, iface_name);
+  return createWifiStatusFromLegacyError(legacy_status);
+}
+WifiStatus WifiNanIface::initiateDataPathRequestInternal(
+    uint16_t cmd_id, const NanInitiateDataPathRequest& msg) {
+  legacy_hal::NanDataPathInitiatorRequest legacy_msg;
+  if (!hidl_struct_util::convertHidlNanDataPathInitiatorRequestToLegacy(msg, &legacy_msg)) {
+    return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+  }
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->nanDataRequestInitiator(cmd_id, legacy_msg);
+  return createWifiStatusFromLegacyError(legacy_status);
+}
+WifiStatus WifiNanIface::respondToDataPathIndicationRequestInternal(
+    uint16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg) {
+  legacy_hal::NanDataPathIndicationResponse legacy_msg;
+  if (!hidl_struct_util::convertHidlNanDataPathIndicationResponseToLegacy(msg, &legacy_msg)) {
+    return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+  }
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->nanDataIndicationResponse(cmd_id, legacy_msg);
+  return createWifiStatusFromLegacyError(legacy_status);
+}
+WifiStatus WifiNanIface::terminateDataPathRequestInternal(
+    uint16_t cmd_id, uint32_t ndpInstanceId) {
+  legacy_hal::NanDataPathEndRequest* legacy_msg = (legacy_hal::NanDataPathEndRequest*)malloc(
+      sizeof(legacy_hal::NanDataPathEndRequest) + sizeof(uint32_t));
+  legacy_msg->num_ndp_instances = 1;
+  legacy_msg->ndp_instance_id[0] = ndpInstanceId;
+
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->nanDataEnd(cmd_id, *legacy_msg);
+  free(legacy_msg);
+  return createWifiStatusFromLegacyError(legacy_status);
 }
 WifiStatus WifiNanIface::beaconSdfPayloadRequestInternal(
-    uint32_t /* cmd_id */, const NanBeaconSdfPayloadRequest& /* msg */) {
-  // TODO implement
-  return createWifiStatus(WifiStatusCode::SUCCESS);
+    uint16_t cmd_id, const NanBeaconSdfPayloadRequest& msg) {
+  legacy_hal::NanBeaconSdfPayloadRequest legacy_msg;
+  if (!hidl_struct_util::convertHidlNanBeaconSdfPayloadRequestToLegacy(msg, &legacy_msg)) {
+    return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+  }
+  legacy_hal::wifi_error legacy_status =
+      legacy_hal_.lock()->nanBeaconSdfPayloadRequest(cmd_id, legacy_msg);
+  return createWifiStatusFromLegacyError(legacy_status);
 }
-std::pair<WifiStatus, NanVersion> WifiNanIface::getVersionInternal() {
-  // TODO implement
-  return {createWifiStatus(WifiStatusCode::SUCCESS), 0};
-}
-WifiStatus WifiNanIface::getCapabilitiesInternal(uint32_t /* cmd_id */) {
-  // TODO implement
-  return createWifiStatus(WifiStatusCode::SUCCESS);
-}
-WifiStatus WifiNanIface::dataInterfaceCreateInternal(
-    uint32_t /* cmd_id */, const std::string& /* iface_name */) {
-  // TODO implement
-  return createWifiStatus(WifiStatusCode::SUCCESS);
-}
-WifiStatus WifiNanIface::dataInterfaceDeleteInternal(
-    uint32_t /* cmd_id */, const std::string& /* iface_name */) {
-  // TODO implement
-  return createWifiStatus(WifiStatusCode::SUCCESS);
-}
-WifiStatus WifiNanIface::dataRequestInitiatorInternal(
-    uint32_t /* cmd_id */, const NanDataPathInitiatorRequest& /* msg */) {
-  // TODO implement
-  return createWifiStatus(WifiStatusCode::SUCCESS);
-}
-WifiStatus WifiNanIface::dataIndicationResponseInternal(
-    uint32_t /* cmd_id */, const NanDataPathIndicationResponse& /* msg */) {
-  // TODO implement
-  return createWifiStatus(WifiStatusCode::SUCCESS);
-}
-WifiStatus WifiNanIface::dataEndInternal(
-    uint32_t /* cmd_id */, const NanDataPathEndRequest& /* msg */) {
-  // TODO implement
-  return createWifiStatus(WifiStatusCode::SUCCESS);
-}
+
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace wifi
diff --git a/wifi/1.0/default/wifi_nan_iface.h b/wifi/1.0/default/wifi_nan_iface.h
index 4f89b31..4fae3df 100644
--- a/wifi/1.0/default/wifi_nan_iface.h
+++ b/wifi/1.0/default/wifi_nan_iface.h
@@ -46,58 +46,50 @@
   Return<void> registerEventCallback(
       const sp<IWifiNanIfaceEventCallback>& callback,
       registerEventCallback_cb hidl_status_cb) override;
-  Return<void> enableRequest(uint32_t cmd_id,
+  Return<void> getCapabilitiesRequest(uint16_t cmd_id,
+                                      getCapabilitiesRequest_cb hidl_status_cb) override;
+  Return<void> enableRequest(uint16_t cmd_id,
                              const NanEnableRequest& msg,
                              enableRequest_cb hidl_status_cb) override;
-  Return<void> disableRequest(uint32_t cmd_id,
-                              disableRequest_cb hidl_status_cb) override;
-  Return<void> publishRequest(uint32_t cmd_id,
-                              const NanPublishRequest& msg,
-                              publishRequest_cb hidl_status_cb) override;
-  Return<void> publishCancelRequest(
-      uint32_t cmd_id,
-      const NanPublishCancelRequest& msg,
-      publishCancelRequest_cb hidl_status_cb) override;
-  Return<void> subscribeRequest(uint32_t cmd_id,
-                                const NanSubscribeRequest& msg,
-                                subscribeRequest_cb hidl_status_cb) override;
-  Return<void> subscribeCancelRequest(
-      uint32_t cmd_id,
-      const NanSubscribeCancelRequest& msg,
-      subscribeCancelRequest_cb hidl_status_cb) override;
-  Return<void> transmitFollowupRequest(
-      uint32_t cmd_id,
-      const NanTransmitFollowupRequest& msg,
-      transmitFollowupRequest_cb hidl_status_cb) override;
-  Return<void> configRequest(uint32_t cmd_id,
+  Return<void> configRequest(uint16_t cmd_id,
                              const NanConfigRequest& msg,
                              configRequest_cb hidl_status_cb) override;
-  Return<void> beaconSdfPayloadRequest(
-      uint32_t cmd_id,
-      const NanBeaconSdfPayloadRequest& msg,
-      beaconSdfPayloadRequest_cb hidl_status_cb) override;
-  Return<void> getVersion(getVersion_cb hidl_status_cb) override;
-  Return<void> getCapabilities(uint32_t cmd_id,
-                               getCapabilities_cb hidl_status_cb) override;
-  Return<void> dataInterfaceCreate(
-      uint32_t cmd_id,
-      const hidl_string& iface_name,
-      dataInterfaceCreate_cb hidl_status_cb) override;
-  Return<void> dataInterfaceDelete(
-      uint32_t cmd_id,
-      const hidl_string& iface_name,
-      dataInterfaceDelete_cb hidl_status_cb) override;
-  Return<void> dataRequestInitiator(
-      uint32_t cmd_id,
-      const NanDataPathInitiatorRequest& msg,
-      dataRequestInitiator_cb hidl_status_cb) override;
-  Return<void> dataIndicationResponse(
-      uint32_t cmd_id,
-      const NanDataPathIndicationResponse& msg,
-      dataIndicationResponse_cb hidl_status_cb) override;
-  Return<void> dataEnd(uint32_t cmd_id,
-                       const NanDataPathEndRequest& msg,
-                       dataEnd_cb hidl_status_cb) override;
+  Return<void> disableRequest(uint16_t cmd_id,
+                              disableRequest_cb hidl_status_cb) override;
+  Return<void> startPublishRequest(uint16_t cmd_id,
+                                   const NanPublishRequest& msg,
+                                   startPublishRequest_cb hidl_status_cb) override;
+  Return<void> stopPublishRequest(uint16_t cmd_id,
+                                  uint16_t sessionId,
+                                  stopPublishRequest_cb hidl_status_cb) override;
+  Return<void> startSubscribeRequest(uint16_t cmd_id,
+                                     const NanSubscribeRequest& msg,
+                                    startSubscribeRequest_cb hidl_status_cb) override;
+  Return<void> stopSubscribeRequest(uint16_t cmd_id,
+                                    uint16_t sessionId,
+                                    stopSubscribeRequest_cb hidl_status_cb) override;
+  Return<void> transmitFollowupRequest(uint16_t cmd_id,
+                                       const NanTransmitFollowupRequest& msg,
+                                       transmitFollowupRequest_cb hidl_status_cb) override;
+  Return<void> createDataInterfaceRequest(uint16_t cmd_id,
+                                          const hidl_string& iface_name,
+                                          createDataInterfaceRequest_cb hidl_status_cb) override;
+  Return<void> deleteDataInterfaceRequest(uint16_t cmd_id,
+                                          const hidl_string& iface_name,
+                                          deleteDataInterfaceRequest_cb hidl_status_cb) override;
+  Return<void> initiateDataPathRequest(uint16_t cmd_id,
+                                       const NanInitiateDataPathRequest& msg,
+                                       initiateDataPathRequest_cb hidl_status_cb) override;
+  Return<void> respondToDataPathIndicationRequest(
+      uint16_t cmd_id,
+      const NanRespondToDataPathIndicationRequest& msg,
+      respondToDataPathIndicationRequest_cb hidl_status_cb) override;
+  Return<void> terminateDataPathRequest(uint16_t cmd_id,
+                                        uint32_t ndpInstanceId,
+                                        terminateDataPathRequest_cb hidl_status_cb) override;
+  Return<void> beaconSdfPayloadRequest(uint16_t cmd_id,
+                                       const NanBeaconSdfPayloadRequest& msg,
+                                       beaconSdfPayloadRequest_cb hidl_status_cb) override;
 
  private:
   // Corresponding worker functions for the HIDL methods.
@@ -105,34 +97,32 @@
   std::pair<WifiStatus, IfaceType> getTypeInternal();
   WifiStatus registerEventCallbackInternal(
       const sp<IWifiNanIfaceEventCallback>& callback);
-  WifiStatus enableRequestInternal(uint32_t cmd_id,
+  WifiStatus getCapabilitiesRequestInternal(uint16_t cmd_id);
+  WifiStatus enableRequestInternal(uint16_t cmd_id,
                                    const NanEnableRequest& msg);
-  WifiStatus disableRequestInternal(uint32_t cmd_id);
-  WifiStatus publishRequestInternal(uint32_t cmd_id,
-                                    const NanPublishRequest& msg);
-  WifiStatus publishCancelRequestInternal(uint32_t cmd_id,
-                                          const NanPublishCancelRequest& msg);
-  WifiStatus subscribeRequestInternal(uint32_t cmd_id,
-                                      const NanSubscribeRequest& msg);
-  WifiStatus subscribeCancelRequestInternal(
-      uint32_t cmd_id, const NanSubscribeCancelRequest& msg);
-  WifiStatus transmitFollowupRequestInternal(
-      uint32_t cmd_id, const NanTransmitFollowupRequest& msg);
-  WifiStatus configRequestInternal(uint32_t cmd_id,
+  WifiStatus configRequestInternal(uint16_t cmd_id,
                                    const NanConfigRequest& msg);
+  WifiStatus disableRequestInternal(uint16_t cmd_id);
+  WifiStatus startPublishRequestInternal(uint16_t cmd_id,
+                                         const NanPublishRequest& msg);
+  WifiStatus stopPublishRequestInternal(uint16_t cmd_id, uint16_t sessionId);
+  WifiStatus startSubscribeRequestInternal(uint16_t cmd_id,
+                                           const NanSubscribeRequest& msg);
+  WifiStatus stopSubscribeRequestInternal(uint16_t cmd_id, uint16_t sessionId);
+  WifiStatus transmitFollowupRequestInternal(
+      uint16_t cmd_id, const NanTransmitFollowupRequest& msg);
+  WifiStatus createDataInterfaceRequestInternal(uint16_t cmd_id,
+                                                const std::string& iface_name);
+  WifiStatus deleteDataInterfaceRequestInternal(uint16_t cmd_id,
+                                                const std::string& iface_name);
+  WifiStatus initiateDataPathRequestInternal(
+      uint16_t cmd_id, const NanInitiateDataPathRequest& msg);
+  WifiStatus respondToDataPathIndicationRequestInternal(
+      uint16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg);
+  WifiStatus terminateDataPathRequestInternal(
+      uint16_t cmd_id, uint32_t ndpInstanceId);
   WifiStatus beaconSdfPayloadRequestInternal(
-      uint32_t cmd_id, const NanBeaconSdfPayloadRequest& msg);
-  std::pair<WifiStatus, NanVersion> getVersionInternal();
-  WifiStatus getCapabilitiesInternal(uint32_t cmd_id);
-  WifiStatus dataInterfaceCreateInternal(uint32_t cmd_id,
-                                         const std::string& iface_name);
-  WifiStatus dataInterfaceDeleteInternal(uint32_t cmd_id,
-                                         const std::string& iface_name);
-  WifiStatus dataRequestInitiatorInternal(
-      uint32_t cmd_id, const NanDataPathInitiatorRequest& msg);
-  WifiStatus dataIndicationResponseInternal(
-      uint32_t cmd_id, const NanDataPathIndicationResponse& msg);
-  WifiStatus dataEndInternal(uint32_t cmd_id, const NanDataPathEndRequest& msg);
+      uint16_t cmd_id, const NanBeaconSdfPayloadRequest& msg);
 
   std::string ifname_;
   std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 76c89e3..1e86be4 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -563,148 +563,77 @@
  * NAN specific types.
  * TODO(b/32159498): Move to a separate nan_types.hal.
  */
+
 /**
- * Various max sizes used in the NAN interface.
+ * A unique short handle provided by the client to identify individual invocations of
+ * certain API's like |IWifiNanIface.*|.
  */
-enum NanMaxSize : uint32_t {
-  SOCIAL_CHANNELS = 3,
-  SERVICE_NAME_LEN = 255,
-  MATCH_FILTER_LEN = 255,
-  SERVICE_SPECIFIC_INFO_LEN = 1024,
-  VSA_DATA_LEN = 1024,
-  MESH_DATA_LEN = 32,
-  INFRA_DATA_LEN = 32,
-  CLUSTER_ATTRIBUTE_LEN = 255,
-  SUBSCRIBE_MAX_ADDRESS = 42,
-  FAM_CHANNELS = 32,
-  POSTDISCOVERY_LEN = 5,
-  FRAME_DATA_LEN = 504,
-  DP_APP_INFO_LEN = 512,
+typedef uint16_t CommandIdShort;
+
+/**
+ * NAN API response codes used in request notifications and events.
+ */
+enum NanStatusType : uint32_t {
+  SUCCESS = 0,
+  /* NAN Discovery Engine/Host driver failures */
+  INTERNAL_FAILURE = 1,
+  /* NAN OTA failures */
+  PROTOCOL_FAILURE = 2,
+  /* The publish/subscribe discovery session id is invalid */
+  INVALID_SESSION_ID = 3,
+  /* Out of resources to fufill request */
+  NO_RESOURCES_AVAILABLE = 4,
+  /* Invalid arguments passed */
+  INVALID_ARGS = 5,
+  /* Invalid peer id */
+  INVALID_PEER_ID = 6,
+  /* Invalid NAN data-path (ndp) id */
+  INVALID_NDP_ID = 7,
+  /* Attempting to enable NAN when not available, e.g. wifi is disabled */
+  NAN_NOT_ALLOWED = 8,
+  /* Over the air ACK not received */
+  NO_OTA_ACK = 9,
+  /* Attempting to enable NAN when already enabled */
+  ALREADY_ENABLED = 10,
+  /* Can't queue tx followup message foor transmission */
+  FOLLOWUP_TX_QUEUE_FULL = 11,
+  /* Unsupported concurrency of NAN and another feature - NAN disabled */
+  UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12
 };
 
 /**
- * NAN protocol Version info.
+ * The discovery bands supported by NAN.
  */
-typedef int32_t NanVersion;
-
-/**
- * NAN data path identifiers.
- */
-typedef uint32_t NanDataPathId;
-
-/**
- * Data request Initiator/Responder app/service related info.
- */
-struct NanDataPathAppInfo {
-  /**
-   * Max length: |MAX_DP_APP_INFO_LEN|.
-   */
-  vec<uint8_t> ndpAppInfo;
+enum NanBandIndex : uint32_t {
+  NAN_BAND_24GHZ = 0,
+  NAN_BAND_5GHZ
 };
 
 /**
- * Configuration params of Data request Initiator/Responder.
+ * The status information returned in NAN notifications.
  */
-struct NanDataPathCfg {
+struct WifiNanStatus {
   /**
-   * Indicates whether to use Security/No Security.
+   * Status of the command request.
    */
-  bool useSecurity;
+  NanStatusType status;
   /**
-   * Indicating whether to use QOS/No QOS.
+   * Further description of the issue causing a failure.
    */
-  bool useQos;
+  string description;
 };
 
 /**
- * Indicates the availability interval duration associated with the
- * Availability Intervals Bitmap field
+ * NAN Match indication type.
  */
-enum NanAvailDuration : uint32_t {
-  DURATION_16MS = 0,
-  DURATION_32MS = 1,
-  DURATION_64MS = 2,
+enum NanMatchAlg : uint32_t {
+  MATCH_ONCE = 0,
+  MATCH_CONTINUOUS,
+  MATCH_NEVER,
 };
 
 /**
- * Possible connection types in Post NAN Discovery attributes.
- */
-enum NanConnectionType : uint32_t {
-  WLAN_INFRA = 0,
-  P2P_OPER = 1,
-  WLAN_IBSS = 2,
-  WLAN_MESH = 3,
-  FURTHER_SERVICE_AVAILABILITY = 4,
-  WLAN_RANGING = 5,
-};
-
-/**
- * Possible device roles in Post NAN Discovery attributes.
- */
-enum NanDeviceRole : uint32_t {
-  WLAN_INFRA_AP = 0,
-  WLAN_INFRA_STA = 1,
-  P2P_OPER_GO = 2,
-  P2P_OPER_DEV = 3,
-  P2P_OPER_CLI = 4,
-};
-
-/**
- * Data request Responder's response.
- */
-enum NanDataPathResponseCode : uint32_t {
-  ACCEPT = 0,
-  REJECT,
-};
-
-/**
- * Further availability per channel information.
- */
-struct NanFurtherAvailabilityChannel {
-  /**
-   * Defined above.
-   */
-  NanAvailDuration entryControl;
-  /**
-   * 1 byte field indicating the frequency band the NAN Device
-   * must be available as defined in IEEE Std. 802.11-2012
-   * Annex E Table E-4 Global Operating Classes
-   */
-  uint8_t classVal;
-  /**
-   * 1 byte field indicating the channel the NAN Device
-   * must be available.
-   */
-  uint8_t channel;
-  /**
-   * Map Id - 4 bit field which identifies the Further
-   * availability map attribute.
-   */
-  uint8_t mapid;
-  /**
-   * Divides the time between the beginnings of consecutive "Discovery
-   * Windows" of a given NAN cluster into consecutive time intervals
-   * of equal durations. The time interval duration is specified by
-   * the |entryControl| field.
-   * A  device that sets the i-th bit of the Availability
-   * Intervals Bitmap to 1 shall be present during the corresponding
-   * i-th time interval in the operation channel indicated by the
-   * Operating Class and Channel Number fields in the same Availability Entry.
-   * A  device that sets the i-th bit of the Availability Intervals Bitmap to
-   * 0 may be present during the corresponding i-th time interval in the operation
-   * channel indicated by the Operating Class and Channel Number fields in the same
-   * Availability Entry.
-   * The size of the Bitmap is dependent upon the Availability Interval Duration
-   * Chosen in the Entry Control Field.  The size can be either 1, 2 or 4 bytes long
-   * - Duration field is equal to 0, only AIB[0] is valid
-   * - Duration field is equal to 1, only AIB [0] and AIB [1] is valid
-   * - Duration field is equal to 2, AIB [0], AIB [1], AIB [2] and AIB [3] are valid
-   */
-  uint32_t availIntervalBitmap;
-};
-
-/**
- * NAN Publish Types.
+ * NAN publish discovery session types.
  */
 enum NanPublishType : uint32_t {
   UNSOLICITED = 0,
@@ -713,15 +642,8 @@
 };
 
 /**
- * NAN Transmit Priorities.
- */
-enum NanTxPriority : uint32_t {
-  NORMAL = 0,
-  HIGH,
-};
-
-/**
- * NAN Transmit Types.
+ * NAN transmit type used in |NanPublishType.SOLICITED| or |NanPublishType.UNSOLICITED_SOLICITED|
+ * publish discovery sessions.
  */
 enum NanTxType : uint32_t {
   BROADCAST = 0,
@@ -729,7 +651,7 @@
 };
 
 /**
- * NAN Subscribe Type.
+ * NAN subscribe discovery session ypes.
  */
 enum NanSubscribeType : uint32_t {
   PASSIVE = 0,
@@ -745,31 +667,6 @@
 };
 
 /**
- * NAN Service Response Filter Include Bit.
- */
-enum NanSrfIncludeType : uint32_t {
-  DO_NOT_RESPOND = 0,
-  RESPOND,
-};
-
-/**
- * NAN Match indication type.
- */
-enum NanMatchAlg : uint32_t {
-  MATCH_ONCE = 0,
-  MATCH_CONTINUOUS,
-  MATCH_NEVER,
-};
-
-/**
- * NAN Transmit Window Type.
- */
-enum NanTransmitWindowType : uint32_t {
-  DW = 0,
-  FAW,
-};
-
-/**
  * NAN DP channel config options.
  */
 enum NanDataPathChannelCfg : uint32_t {
@@ -779,575 +676,415 @@
 };
 
 /**
- * Host can send Vendor specific attributes which the Discovery Engine can
- * enclose in Beacons and/or Service Discovery frames transmitted.
- * Below structure is used to populate that.
- * TODO(b/32207606): This can be moved to vendor extension.
+ * NAN band-specific configuration.
  */
-struct NanTransmitVendorSpecificAttribute {
+struct NanBandSpecificConfig {
   /**
-   * 0 = transmit only in the next discovery window
-   * 1 = transmit in next 16 discovery window
+   * RSSI values controlling clustering behavior per spec.
    */
-  uint8_t payloadTransmitFlag;
+  uint8_t rssiClose;
+  uint8_t rssiMiddle;
   /**
-   * Below flags must determine in which all frames
-   * the vendor specific attributes must be included
+   * RSSI value determining whether discovery is near (used if enabled in discovery).
    */
-  uint8_t txInDiscoveryBeacon;
-  uint8_t txInSyncBeacon;
-  uint8_t txInServiceDiscovery;
+  uint8_t rssiProximity;
   /**
-   * Organizationally Unique Identifier.
-   */
-  uint32_t vendorOui;
-  /**
-   * Vendor specific attribute to be transmitted.
-   * Max length: |MAX_VSA_DATA_LEN|.
-   */
-  vec<uint8_t> vsa;
-};
-
-/**
- * Host can set the Periodic scan parameters for each of the
- * 3(6, 44, 149) Social channels. Only these channels are allowed
- * any other channels are rejected
- */
- enum NanChannelIndex : uint32_t {
-  CHANNEL_24G_BAND = 0,
-  CHANNEL_5G_BAND_LOW,
-  CHANNEL_5G_BAND_HIGH,
-};
-
-/**
- * Structure to set the Social Channel Scan parameters
- * passed as part of EnableRequest/ConfigRequest.
- */
-struct NanSocialChannelScanParams {
-  /**
-   * Dwell time of each social channel in milliseconds
-   * ChannelIndex corresponds to the respective channel
+   * Dwell time of each discovery channel in milliseconds.
    * If time set to 0 then the FW default time must be used.
-   * Max length: |MAX_SOCIAL_CHANNELS|.
-   * dwellTime[i] refers to the dwell time of the i'th social channel.
    */
-  vec<uint8_t> dwellTime;
+  uint8_t dwellTimeMs;
   /**
-   * Scan period of each social channel in seconds
-   * ChannelIndex corresponds to the respective channel
+   * Scan period of each discovery channel in seconds.
    * If time set to 0 then the FW default time must be used.
-   * Max length: |MAX_SOCIAL_CHANNELS|.
-   * scanPeriod[i] refers to the scan period of the i'th social channel.
    */
-  vec<uint16_t> scanPeriod;
+  uint16_t scanPeriodSec;
+   /**
+    * Specifies the interval for Sync beacons and SDF's.
+    * Valid values of DW Interval are: 1, 2, 3, 4 and 5 corresponding to 1, 2, 4, 8, and 16 DWs.
+    * Value of 0:
+    *  - reserved in 2.4GHz band
+    *  - no wakeup at all in 5GHz band
+    * The publish/subscribe period values don't override the device level configurations if
+    * specified (if 'valid' is true).
+    */
+  bool validDiscoveryWindowIntervalVal;
+  uint8_t discoveryWindowIntervalVal;
 };
 
 /**
- * Enable Request Message Structure
- * The EnableReq message in  structs the Discovery Engine to enter an operational state
+ * Configuration parameters
  */
-struct NanEnableRequest {
+struct NanDebugConfig {
   /**
-   * Mandatory parameters below.
+   * The low and high values of the cluster ID: standard values are 0x0000 - 0xFFFF.
+   * A clusterLow == clusterHigh indicates a request to join or create a cluster with that ID.
+   * Used if 'valid' is true.
    */
-  uint8_t masterPref;
+  bool validClusterIdVals;
+  uint16_t clusterIdLowVal;
+  uint16_t clusterIdHighVal;
   /**
-   * A cluster_low value matching cluster_high indicates a request to join
-   * a cluster with that value. If the requested cluster is not found the
-   * device must start its own cluster.
-   */
-  uint16_t clusterLow;
-  uint16_t clusterHigh;
-  /**
-   * Optional configuration of Enable request.
-   * Each of the optional parameters have configure flag which
-   * determine whether configuration is to be passed or not.
-   */
-  bool validSupport5gVal;
-  uint8_t support5gVal;
-  /**
-   * BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons
-   * 0 - Do not include SIDs in any beacons
-   * 1 - Include SIDs in all beacons.
-   * Rest 7 bits are count field which allows control over the number of SIDs
-   * included in the Beacon.  0 means to include as many SIDs that fit into
-   * the maximum allow Beacon frame size
-   */
-  bool validSidBeaconVal;
-  uint8_t sidBeaconVal;
-  /**
-   * The rssi values below must be specified without sign.
-   * For eg: -70dBm must be specified as 70.
-   */
-  bool valid2dot4gRssiCloseVal;
-  uint8_t rssiClose2dot4gVal;
-  bool valid2dot4gRssiMiddleVal;
-  uint8_t rssiMiddle2dot4gVal;
-  bool valid2dot4gRssiProximityVal;
-  uint8_t rssiProximity2dot4gVal;
-  bool validHopCountLimitVal;
-  uint8_t hopCountLimitVal;
-  /**
-   * Defines 2.4G channel access support
-   */
-  bool valid2dot4gSupportVal;
-  bool support2dot4gVal;
-  /**
-   * Defines 2.4G channels must be used for sync/discovery beacons
-   */
-  bool valid2dot4gBeaconsVal;
-  bool beacon2dot4gVal;
-  /**
-   * Defines 2.4G channels must be used for Service Discovery frames
-   */
-  bool valid2dot4gSdfVal;
-  bool sdf2dot4gVal;
-  /**
-   * Defines 5G channels must be used for sync/discovery beacons
-   */
-  bool valid5gBeaconsVal;
-  bool beacon5gVal;
-  /**
-   * Defines 5G channels must be used for Service Discovery frames
-   */
-  bool valid5gSdfVal;
-  bool sdf5gVal;
-  /**
-   * 1 byte value which defines the RSSI in
-   * dBm for a close by Peer in 5 Ghz channels.
-   * The rssi values must be specified without sign.
-   * For eg: -70dBm must be specified as 70.
-   */
-  bool valid5gRssiCloseVal;
-  uint8_t rssiClose5gVal;
-  /**
-   * 1 byte value which defines the RSSI value in
-   * dBm for a close by Peer in 5 Ghz channels.
-   * The rssi values must be specified without sign.
-   * For eg: -70dBm must be specified as 70.
-   */
-  bool valid5gRssiMiddleVal;
-  uint8_t rssiMiddle5gVal;
-  /**
-   * 1 byte value which defines the RSSI filter
-   * threshold.  Any Service Descriptors received above this
-   * value that are configured for RSSI filtering must be dropped.
-   * The rssi values must be specified without sign.
-   * For eg: -70dBm must be specified as 70.
-   */
-  bool valid5gRssiCloseProximityVal;
-  uint8_t rssiCloseProximity5gVal;
-  /**
-   * 1 byte quantity which defines the window size over
-   * which the “average RSSI” must be calculated over.
-   */
-  bool validRssiWindowSizeVal;
-  uint8_t rssiWindowSizeVal;
-  /**
-   * The 24 bit Organizationally Unique ID + the 8 bit Network Id.
-   */
-  uint8_t validOuiVal;
-  uint32_t ouiVal;
-  /**
-   * NAN Interface Address, If not configured the Discovery Engine
-   * must generate a 6 byte Random MAC.
+   * NAN management interface address, If specified ('valid' is true) then overrides any other
+   * configuration (specifically the default randomization).
    */
   bool validIntfAddrVal;
   MacAddress intfAddrVal;
   /**
-   * If set to true, the Discovery Engine must enclose the Cluster
-   * Attribute only sent in Beacons in a Vendor Specific Attribute
-   * and transmit in a Service Descriptor Frame.
+   * The 24 bit Organizationally Unique ID + the 8 bit Network Id. Used if 'valid' is true.
    */
-  bool configClusterAttributeVal;
+  bool validOuiVal;
+  uint32_t ouiVal;
   /**
-   * The periodicity in seconds between full scan’s to find any new
-   * clusters available in the area. A Full scan must not be done
-   * more than every 10 seconds and must not be done less than every
-   * 30 seconds.
-   */
-  bool validScanParamsVal;
-  NanSocialChannelScanParams scanParamsVal;
-  /**
-   * 1 byte quantity which forces the Random Factor to a particular
-   * value for all transmitted Sync/Discovery beacons
+   * Force the Random Factor to the specified value for all transmitted Sync/Discovery beacons
+   * if the 'valid' flag is true.
    */
   bool validRandomFactorForceVal;
   uint8_t randomFactorForceVal;
   /**
-   * 1 byte quantity which forces the HC for all transmitted Sync and
-   * Discovery Beacon NO matter the real HC being received over the
-   * air.
+   * Forces the hop-count for all transmitted Sync and Discovery Beacons NO matter the real
+   * hop-count being received over the air. Used if the 'valid' flag is true.
    */
   bool validHopCountForceVal;
   uint8_t hopCountForceVal;
   /**
-   * Channel frequency in MHz to enable  on.
+   * Frequency in MHz to of the discovery channel in the specified band. Indexed by |NanBandIndex|.
    */
-  bool valid24gChannelVal;
-  WifiChannelInMhz channel24gVal;
-  bool valid5gChannelVal;
-  WifiChannelInMhz channel5gVal;
+  bool validDiscoveryChannelVal;
+  vec<WifiChannelInMhz> discoveryChannelMhzVal;
+  /**
+   * Specifies whether sync/discovery beacons are transmitted in the specified band. Indexed by
+   * |NanBandIndex|.
+   */
+  bool validUseBeaconsInBandVal;
+  vec<bool> useBeaconsInBandVal;
+  /**
+   * Specified whether SDF (service discovery frames) are transmitted in the specified band. Indexed
+   * by |NanBandIndex|.
+   */
+  bool validUseSdfInBandVal;
+  vec<bool> useSdfInBandVal;
 };
 
+/**
+ * Configuration parameters of NAN: used when enabling and re-configuring a NAN cluster.
+ */
+struct NanConfigRequest {
+  /**
+   * Master preference of this device.
+   */
+  uint8_t masterPref;
+  /**
+   * Controls whether or not the |IWifiNanIfaceEventCallback.eventClusterEvent| will be delivered
+   * for DISCOVERY_MAC_ADDRESS_CHANGED.
+   */
+  bool disableDiscoveryAddressChangeIndication;
+  /**
+   * Controls whether or not the |IWifiNanIfaceEventCallback.eventClusterEvent| will be delivered
+   * for STARTED_CLUSTER.
+   */
+  bool disableStartedClusterIndication;
+  /**
+   * Controls whether or not the |IWifiNanIfaceEventCallback.eventClusterEvent| will be delivered
+   * for JOINED_CLUSTER.
+   */
+  bool disableJoinedClusterIndication;
+  /**
+   * Control whether service IDs are included in Sync/Discovery beacons.
+   */
+  bool includeServiceIdsInBeacon;
+  /**
+   * If |includeServiceIdInBeacon| is true then specifies the number of service IDs to include
+   * in the Sync/Discovery beacons:
+   *  Value = 0: include as many service IDs as will fit into the maximum allowed beacon frame size.
+   *  Value must fit within 7 bits - i.e. <= 127.
+   */
+  uint8_t numberOfServiceIdsInBeacon;
+  /**
+   * Number of samples used to calculate RSSI.
+   */
+  uint16_t rssiWindowSize;
+  /**
+   * Specifies the interval in seconds that the NAN management interface MAC address is randomized.
+   * A value of 0 is used to disable the MAC address randomization
+   */
+  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|.
+   */
+  vec<NanBandSpecificConfig> bandSpecificConfig;
+};
 
 /**
- * Publish Msg Structure
- * Message is used to request the DE to publish the Service Name
- * using the parameters passed into the "Discovery Window".
+ * Enable requests for NAN: start-up configuration.
+ */
+struct NanEnableRequest {
+  /**
+   * Enable operation in a specific band: indexed by |NanBandIndex|.
+   */
+  vec<bool> operateInBand;
+  /**
+   * Specify extent of cluster by specifying the max hop count.
+   */
+  uint8_t hopCountMax;
+  /**
+   * Configurations of NAN cluster operation. Can also be modified at run-time using
+   * |configRequest|.
+   */
+  NanConfigRequest configParams;
+  /**
+   * Non-standard configurations of NAN cluster operation - useful for debugging opeations.
+   */
+  NanDebugConfig debugConfigs;
+};
+
+/**
+ * Configurations of NAN discovery sessions: common to publish and subscribe discovery.
+ */
+struct NanDiscoveryCommonConfig {
+  /**
+   * The ID of the discovery session being configured. A value of 0 specifies a request to create
+   * a new discovery session.
+   */
+  uint16_t sessionId;
+  /**
+   * The lifetime of the discovery session in seconds. A value of 0 means run forever or until
+   * canceled.
+   */
+  uint16_t ttlSec;
+  /**
+   * Indicates the interval between two Discovery Windows in which the device supporting the
+   * service is awake to transmit or receive the Service Discovery frames.
+   * Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16. A value of 0 will default to 1.
+   */
+  uint16_t discoveryWindowPeriod;
+  /**
+   * Number of other-air-air operations (i.e. active transmissions), 0 means forever or until
+   * canceled.
+   */
+  uint8_t discoveryCount;
+  /**
+   * UTF-8 encoded string identifying the service.
+   * Max length: |NanCapabilities.maxServiceNameLen|.
+   */
+  string serviceName;
+  /**
+   * Specifies the matching indication to host: once, continuous, or never.
+   */
+  NanMatchAlg discoveryMatchIndicator;
+  /**
+   * Arbitrary information communicated as part of discovery.
+   * Max length: |NanCapabilities.maxServiceSpecificInfoLen|.
+   */
+  vec<uint8_t> serviceSpecificInfo;
+  /**
+   * Ordered sequence of <length, value> pairs (length uses 1 byte) which specify further match
+   * criteria (beyond the service name).
+   * Publisher: used in SOLICITED or SOLICITED_UNSOLICITED sessions.
+   * Subscriber: used in ACTIVE or PASSIVE sessions.
+   * Max length: |NanCapabilities.maxMatchFilterLen|.
+   */
+  vec<uint8_t> rxMatchFilter;
+  /**
+   * Ordered sequence of <length, value> pairs (length uses 1 byte) which specify further match
+   * criteria (beyond the service name).
+   * Publisher: used if provided.
+   * Subscriber: used in ACTIVE sessions.
+   * Max length: |NanCapabilities.maxMatchFilterLen|.
+   */
+  vec<uint8_t> txMatchFilter;
+  /**
+   * Specifies whether or not the discovery session uses the |rssiProximity| value (configured
+   * in enable/configure requests) to filter out matched discovered peers.
+   */
+  bool useRssiThreshold;
+  /**
+   * Controls whether or not the |IWifiNanIfaceEventCallback.eventPublishTerminated| (for publish
+   * discovery sessions) or |IWifiNanIfaceEventCallback.eventSubscribeTerminated| (for subscribe
+   * discovery sessions) will be delivered.
+   */
+  bool disableDiscoveryTerminationIndication;
+  /**
+   * Controls whether or not the |IWifiNanIfaceEventCallback.eventMatchExpired| will be delivered.
+   */
+  bool disableMatchExpirationIndication;
+  /**
+   * Controls whether or not the |IWifiNanIfaceEventCallback.eventFollowupReceived| will be
+   * delivered.
+   */
+  bool disableFollowupReceivedIndication;
+  /**
+   * Cipher types supported in data-paths constructed in the context of this discovery session. The
+   * |NanCipherSuiteType| bit fields are used to set this value.
+   */
+  uint32_t supportedCipherTypes;
+  /**
+   * Optional PMK for data-paths constructed in the context of this discovery session. A PMK could
+   * also be provided during the actual construction of the data-path (which allows unique PMKs for
+   * each data-path).
+   * Max length: 32
+   */
+  vec<uint8_t> pmk;
+  /**
+   * Specifies whether or not security is enabled in any data-path (NDP) constructed in the context
+   * of this discovery session.
+   */
+  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.
+   */
+  bool rangingRequired;
+   /**
+    * Interval in msec between two ranging measurements.
+    * If the Awake DW interval in Enable/Config is larger than the ranging interval - priority is
+    * given to Awake DW interval.
+    */
+  uint32_t rangingIntervalMsec;
+  /**
+   * The type of ranging indication feedback to be provided by discovery session matches. Use
+   * bit-fields from |NanRangingIndication|.
+   */
+   uint32_t configRangingIndications;
+   /**
+    * The ingress and egress distance in cm. If ranging is eanbled (|rangingEnabled| is true) then
+    * \configRangingIndications\ is used to determine whether ingress and/or egress (or neither)
+    * are used to determine whether a match has occurred.
+    */
+   uint32_t distanceIngressCm;
+   uint32_t distanceEgressCm;
+};
+
+/**
+ * Cipher suite flags - to be used as a bitmask.
+ */
+enum NanCipherSuiteType : uint32_t {
+  SHARED_KEY_128_MASK = 1 << 0,
+  SHARED_KEY_256_MASK = 1 << 1
+};
+
+/**
+ * Ranging in the context of discovery sessions indication controls - to be used as a bitmask.
+ */
+enum NanRangingIndication : uint32_t {
+  CONTINUOUS_INDICATION_MASK = 1 << 0,
+  INGRESS_MET_MASK = 1 << 1,
+  EGRESS_MET_MASK = 1 << 2
+};
+
+/**
+ * Publish request: specifies a publish discovery operation.
  */
 struct NanPublishRequest {
   /**
-   * Id  0 means new publish, any other id is existing publish.
+   * Common configuration of discovery sessions.
    */
-  uint16_t publishId;
+  NanDiscoveryCommonConfig baseConfigs;
   /**
-   * How many seconds to run for. 0 means forever until canceled.
-   */
-  uint16_t ttl;
-  /**
-   * Periodicity of OTA unsolicited publish. Specified in increments of 500 ms.
-   */
-  uint16_t period;
-  /**
-   * 0= unsolicited, solicited = 1, 2= both.
+   * The type of the publish discovery session.
    */
   NanPublishType publishType;
   /**
-   * 0 = broadcast, 1= unicast  if solicited publish.
+   * For publishType of |NanPublishType.SOLICITED| or |NanPublishType.UNSOLICITED_SOLICITED|
+   * specifies the type of transmission used for responding to the probing subscribe discovery
+   * peer.
    */
   NanTxType txType;
-  /**
-   * Number of OTA Publish, 0 means forever until canceled.
-   */
-  uint8_t publishCount;
-  /**
-   * UTF-8 encoded string identifying the service.
-   * Max length: |MAX_SERVICE_NAME_LEN|.
-   */
-  string serviceName;
-  /**
-   * Field which specifies how the matching indication to host is controlled.
-   * 0 - Match and Indicate Once
-   * 1 - Match and Indicate continuous
-   * 2 - Match and Indicate never. This means don't indicate the match to
-   *     the host.
-   * 3 - Reserved
-   */
-  NanMatchAlg publishMatchIndicator;
-  /**
-   * Sequence of values NAN Device that has invoked a Subscribe method
-   * corresponding to this Publish method.
-   * Max length: |MAX_SERVICE_SPECIFIC_INFO_LEN|.
-   */
-  vec<uint8_t> serviceSpecificInfo;
-  /**
-   * Ordered sequence of <length, value> pairs which specify further response conditions
-   * beyond the service name used to filter subscribe messages to respond to.
-   * This is only needed when the PT is set to SOLICITED or SOLICITED_UNSOLICITED.
-   * Max length: |MAX_MATCH_FILTER_LEN|.
-   */
-  vec<uint8_t> rxMatchFilter;
-  /**
-   * Ordered sequence of <length, value> pairs to be included in the Discovery Frame.
-   * If present it is always sent in a Discovery Frame
-   * Max length: |MAX_MATCH_FILTER_LEN|.
-   */
-  vec<uint8_t> txMatchFilter;
-  /**
-   * Flag which specifies that the Publish must use the configured RSSI
-   * threshold and the received RSSI in order to filter requests
-   * false – ignore the configured RSSI threshold when running a Service
-   * Descriptor attribute or Service ID List Attribute through the DE matching logic.
-   * true – use the configured RSSI threshold when running a Service
-   * Descriptor attribute or Service ID List Attribute through the DE matching logic.
-   */
-  bool useRssiThreshold;
-  /**
-   * 8-bit bitmap which allows the Host to associate this publish
-   * with a particular Post-NAN Connectivity attribute
-   * which has been sent down in a ConfigureRequest/EnableRequest
-   * message.  If the DE fails to find a configured Post-NAN
-   * connectivity attributes referenced by the bitmap,
-   * the DE must return an error code to the Host.
-   * If the Publish is configured to use a Post-NAN Connectivity
-   * attribute and the Host does not refresh the Post-NAN Connectivity
-   * attribute the Publish must be canceled and the Host must be sent
-   * a PublishTerminatedIndication message.
-   */
-  uint8_t connmap;
-  /**
-   * Set/Enable corresponding bits to disable any indications that follow a publish.
-   * BIT0 - Disable publish termination indication.
-   * BIT1 - Disable match expired indication.
-   * BIT2 - Disable followUp indication received (OTA).
-   */
-  uint8_t recvIndicationCfg;
 };
 
 /**
- * Publish Cancel Msg Structure.
- * The PublishServiceCancelReq Message is used to request the DE to stop publishing
- * the Service Name identified by the Publish Id in the message.
- */
-struct NanPublishCancelRequest {
-  uint16_t publishId;
-};
-
-/**
- * NAN Subscribe Structure.
- * The SubscribeServiceReq message is sent to the Discovery Engine
- * whenever the Upper layers would like to listen for a Service Name
+ * Subscribe request: specifies a subscribe discovery operation.
  */
 struct NanSubscribeRequest {
   /**
-   * Id 0 means new subscribe, non zero is existing subscribe.
+   * Common configuration of discovery sessions.
    */
-  uint16_t subscribeId;
+  NanDiscoveryCommonConfig baseConfigs;
   /**
-   * How many seconds to run for. 0 means forever until canceled.
-   */
-  uint16_t ttl;
-  /**
-   * Periodicity of OTA Active Subscribe. Units in increments of 500 ms,
-   * 0 = attempt every DW.
-   */
-  uint16_t period;
-  /**
-   * Flag which specifies how the Subscribe request shall be processed.
-   * 0 - PASSIVE , 1- ACTIVE.
+   * The type of the subscribe discovery session.
    */
   NanSubscribeType subscribeType;
   /**
-   * Flag which specifies on Active Subscribes how the Service Response Filter
+   * For Active subscribe discovery sessions specify how the Service Response Filter (SRF)
    * attribute is populated.
-   * 0 - Bloom Filter, 1 - MAC Addr.
    */
-  NanSrfType serviceResponseFilter;
+  NanSrfType srfType;
   /**
-   * Flag which specifies how the Service Response Filter Include bit is
-   * populated.
-   * 0=Do not respond if in the Address Set, 1= Respond.
+   * Configure the requested response of the Service Response Filter (SRF).
    */
-  NanSrfIncludeType serviceResponseInclude;
+  bool srfRespondIfInAddressSet;
   /**
-   * Flag which specifies if the Service Response Filter must be used when
-   * creating Subscribes.
-   * 0=Do not send the Service Response Filter,1= send.
+   * Control whether the Service Response Filter (SRF) is transmitted OTA.
    */
-  bool shouldUseServiceResponseFilter;
+  bool shouldUseSrf;
   /**
-   * Flag which specifies if the Service Specific Info is needed in
-   * the Publish message before creating the MatchIndication.
-   * 0=Not needed, 1= Required.
+   * Control whether the Service Specific Info (SSI) is needed in the Publish message to trigger
+   * service discovery (a match).
    */
-  bool isSsiRequiredForMatchIndication;
-  /**
-   * Field which specifies how the matching indication to host is controlled.
-   * 0 - Match and Indicate Once
-   * 1 - Match and Indicate continuous
-   * 2 - Match and Indicate never. This means don't indicate the match to the
-   *     host.
-   * 3 - Reserved
-   */
-  NanMatchAlg subscribeMatchIndicator;
-  /**
-   * The number of Subscribe Matches which must occur
-   * before the Subscribe request is automatically terminated.
-   * If this value is 0 this field is not used by the DE.
-   */
-  uint8_t subscribeCount;
-  /**
-   * UTF-8 encoded string identifying the service.
-   * Max length: |MAX_SERVICE_NAME_LEN|.
-   */
-  string serviceName;
-  /**
-   * Sequence of values which further specify the published service beyond the
-   * service name.
-   * Max length: |MAX_SERVICE_SPECIFIC_INFO_LEN|.
-   */
-  vec<uint8_t> serviceSpecificInfo;
-  /**
-   * Ordered sequence of <length, value> pairs used to filter out received
-   * publish discovery messages.
-   * This can be sent both for a Passive or an Active Subscribe
-   * Max length: |MAX_MATCH_FILTER_LEN|.
-   */
-  vec<uint8_t> rxMatchFilter;
-  /**
-   * Ordered sequence of <length, value> pairs  included in the
-   * Discovery Frame when an Active Subscribe is used.
-   * Max length: |MAX_MATCH_FILTER_LEN|.
-   */
-  vec<uint8_t> txMatchFilter;
-  /**
-   * Flag which specifies that the Publish must use the configured RSSI
-   * threshold and the received RSSI in order to filter requests
-   * false – ignore the configured RSSI threshold when running a Service
-   * Descriptor attribute or Service ID List Attribute through the DE matching logic.
-   * true – use the configured RSSI threshold when running a Service
-   * Descriptor attribute or Service ID List Attribute through the DE matching logic.
-   */
-  bool useRssiThreshold;
-  /**
-   * 8-bit bitmap which allows the Host to associate this Active
-   * Subscribe with a particular Post-NAN Connectivity attribute
-   * which has been sent down in a ConfigureRequest/EnableRequest
-   * message.  If the DE fails to find a configured Post-NAN
-   * connectivity attributes referenced by the bitmap,
-   * the DE must return an error code to the Host.
-   * If the Subscribe is configured to use a Post-NAN Connectivity
-   * attribute and the Host does not refresh the Post-NAN Connectivity
-   * attribute the Subscribe must be canceled and the Host must be sent
-   * a SubscribeTerminatedIndication message.
-   */
-  uint8_t connmap;
+  bool isSsiRequiredForMatch;
   /**
    * NAN Interface Address, conforming to the format as described in
    * 8.2.4.3.2 of IEEE Std. 802.11-2012.
-   * Max length: |MAX_SUBSCRIBE_MAX_ADDRESS|.
+   * Max length: |NanCapabilities.maxSubscribeInterfaceAddresses|.
    */
   vec<MacAddress> intfAddr;
-  /**
-   * Set/Enable corresponding bits to disable indications that follow a
-   * subscribe.
-   * BIT0 - Disable subscribe termination indication.
-   * BIT1 - Disable match expired indication.
-   * BIT2 - Disable followUp indication received (OTA).
-   */
-  uint8_t recvIndicationCfg;
 };
 
 /**
- * NAN Subscribe Cancel Structure
- * The SubscribeCancelReq Message is used to request the DE to stop looking
- * for the Service Name.
- */
-struct NanSubscribeCancelRequest {
-  uint16_t subscribeId;
-};
-
-/**
- * Transmit follow up Structure.
- * The TransmitFollowupReq message is sent to the DE to allow the sending of
- * the Service_Specific_Info to a particular MAC address.
+ * Transmit follow up message request.
  */
 struct NanTransmitFollowupRequest {
   /**
-   * Publish or Subscribe Id of an earlier Publish/Subscribe.
+   * ID of an active publish or subscribe discovery session. Follow-up message is transmitted in the
+   * context of the discovery session.
    */
-  uint16_t publishSubscribeId;
+  uint16_t discoverySessionId;
   /**
-   * This Id is the Requestor Instance that is passed as
-   * part of earlier MatchInd/FollowupInd message.
+   * ID of the peer. Obtained as part of an earlier |eventMatch| or |eventFollowupReceived|.
    */
-  uint32_t requestorInstanceId;
+  uint32_t peerId;
   /**
-   * Unicast address.
+   * MAC address of the peer. Obtained as part of an earlier |eventMatch| or
+   * |eventFollowupReceived|.
    */
   MacAddress addr;
   /**
-   * Priority of the request 2=high.
+   * Should the follow-up message be transmitted with a high priority.
    */
-  NanTxPriority priority;
+  bool isHighPriority;
   /**
-   * Flag which the DE uses to decide if received in a DW or a FAW
-   * 0= send in a DW, 1=send in FAW.
+   * Should the follow-up message be transmitted in a discovery window (true) or a further
+   * availability window (false).
    */
-  NanTransmitWindowType dwOrFaw;
+  bool shouldUseDiscoveryWindow;
   /**
-   * Sequence of values which further specify the published service beyond
-   * the service name.
-   * Max length: |MAX_SERVICE_SPECIFIC_INFO_LEN|.
+   * Message as a byte sequence.
+   * Max length: |NanCapabilities.maxServiceSpecificInfoLen|.
    */
-  vec<uint8_t> serviceSpecificInfo;
+  vec<uint8_t> message;
   /**
-   * Set/Enable corresponding bits to disable responses after followUp.
-   * BIT0 - Disable followUp response from FW.
+   * Disable |eventTransmitFollowup| - i.e. do not get indication on whether the follow-up
+   * was transmitted and received successfully.
    */
-  uint8_t recvIndicationCfg;
+  bool disableFollowupResultIndication;
 };
 
 /**
- * Config Structure.
- * The ConfigurationReq message is sent by the Host to the
- * Discovery Engine in order to configure the Discovery Engine during runtime.
+ *  Data Path Initiator requesting a data-path.
  */
-struct NanConfigRequest {
-  bool validSidBeaconVal;
-  uint8_t sidBeacon;
-  bool validRssiProximityVal;
-  uint8_t rssiProximity;
-  bool validMasterPrefVal;
-  uint8_t masterPref;
+struct NanInitiateDataPathRequest {
   /**
-   * 1 byte value which defines the RSSI filter threshold.
-   * Any Service Descriptors received above this value
-   * that are configured for RSSI filtering must be dropped.
-   * The rssi values must be specified without sign.
-   * For eg: -70dBm must be specified as 70.
+   * ID of the peer. Obtained as part of an earlier |eventMatch| or |eventFollowupReceived|.
    */
-  bool valid5gRssiCloseProximityVal;
-  uint8_t rssiCloseProximity5gVal;
+  uint32_t peerId;
   /**
-   * 2 byte quantity which defines the window size over
-   * which the “average RSSI” must be calculated over.
+   * NAN management interface MAC address of the peer.
    */
-  bool validRssiWindowSizeVal;
-  uint16_t rssiWindowSizeVal;
-  /**
-   * If set to 1, the Discovery Engine must enclose the Cluster
-   * Attribute only sent in Beacons in a Vendor Specific Attribute
-   * and transmit in a Service Descriptor Frame.
-   */
-  bool configClusterAttributeVal;
-  /**
-   * The periodicity in seconds between full scan’s to find any new
-   * clusters available in the area.  A Full scan must not be done
-   * more than every 10 seconds and must not be done less than every
-   * 30 seconds.
-   */
-  bool validScanParamsVal;
-  NanSocialChannelScanParams scanParamsVal;
-  /**
-   * 1 byte quantity which forces the Random Factor to a particular
-   * value for all transmitted Sync/Discovery beacons
-   */
-  bool validRandomFactorForceVal;
-  uint8_t randomFactorForceVal;
-  /**
-   * 1 byte quantity which forces the HC for all transmitted Sync and
-   * Discovery Beacon NO matter the real HC being received over the
-   * air.
-   */
-  bool validHopCountForceVal;
-  uint8_t hopCountForceVal;
-};
-
-/**
- * Beacon Sdf Payload Structure
- * The Discovery Engine can be configured to publish vendor specific attributes as part of
- * beacon or service discovery frame transmitted as part of this request..
- */
-struct NanBeaconSdfPayloadRequest {
-  /**
-   * VendorAttribute must have the Vendor Specific Attribute which the
-   * vendor wants to publish as part of Discovery or Sync or Service discovery frame
-   */
-  NanTransmitVendorSpecificAttribute vsa;
-};
-
-/**
- *  Data Path Initiator requesting a data session.
- */
-struct NanDataPathInitiatorRequest {
-  /**
-   * Unique Instance Id identifying the Responder's service.
-   * This is same as publish_id notified on the subscribe side
-   * in a publish/subscribe scenario
-   */
-  uint32_t serviceInstanceId;
+  MacAddress peerDiscMacAddr;
   /**
    * Config flag for channel request.
    */
@@ -1357,486 +1094,312 @@
    */
   WifiChannelInMhz channel;
   /**
-   * Discovery MAC addr of the publisher/peer.
+   * NAN data interface name on which this data-path session is to be started.
+   * This must be an interface created using |createDataInterfaceRequest|.
    */
-  MacAddress peerDiscMacAddr;
+  string ifaceName;
   /**
-   * Interface name on which this NDP session is to be started.
-   * This must be the same interface name provided during interface
-   * create.
+   * Specifies whether or not security is required for the data-path being created.
    */
-  string ndpIface;
+  bool securityRequired;
   /**
-   * Initiator/Responder Security/QoS configuration.
+   * Arbitrary token transmitted as part of the data-path negotiation (not encrypted).
+   * Max length: |NanCapabilities.maxAppInfoLen|.
    */
-  NanDataPathCfg ndpCfg;
+  vec<uint8_t> appInfo;
   /**
-   * App/Service information of the Initiator.
+   * Cipher types supported in data-paths constructed in the context of this discovery session. The
+   * |NanCipherSuiteType| bit fields are used to set this value.
    */
-  NanDataPathAppInfo appInfo;
+  uint32_t supportedCipherTypes;
+  /**
+   * PMK of the data-path being requested (if |securityRequired| is true).
+   * Max length: 32
+   */
+  vec<uint8_t> pmk;
 };
 
 /**
- * Data struct Nanto initiate a data response on the responder side
- * for an indication received with a data request.
+ * Response to a data-path request from a peer.
  */
-struct NanDataPathIndicationResponse {
+struct NanRespondToDataPathIndicationRequest {
   /**
-   * Unique token Id generated on the initiator/responder
-   * side used for a NDP session between two NAN devices.
+   * Accept (true) or reject (false) the request.
    */
-  NanDataPathId ndpInstanceId;
+  bool acceptRequest;
   /**
-   * Interface name on which this NDP session is to be started.
-   * This must be the same interface name provided during interface
-   * create.
+   * ID of the data-path (NDP) for which we're responding - obtained as part of the request in
+   * |NanDataPathRequestInd|.
    */
-  string ndpIface;
+  uint32_t ndpInstanceId;
   /**
-   * Initiator/Responder Security/QoS configuration.
+   * NAN data interface name on which this data-path session is to be started.
+   * This must be an interface created using |createDataInterfaceRequest|.
    */
-  NanDataPathCfg ndpCfg;
+  string ifaceName;
   /**
-   * App/Service information of the responder.
+   * Specifies whether or not security is required for the data-path being created.
    */
-  NanDataPathAppInfo appInfo;
+  bool securityRequired;
   /**
-   * Response Code indicating ACCEPT/REJECT/DEFER
+   * Arbitrary token transmitted as part of the data-path negotiation (not encrypted).
+   * Max length: |NanCapabilities.maxAppInfoLen|.
    */
-  NanDataPathResponseCode rspCode;
+  vec<uint8_t> appInfo;
+  /**
+   * Cipher types supported in data-paths constructed in the context of this discovery session. The
+   * |NanCipherSuiteType| bit fields are used to set this value.
+   */
+  uint32_t supportedCipherTypes;
+  /**
+   * PMK of the data-path being requested (if |securityRequired| is true).
+   * Max length: 32
+   */
+  vec<uint8_t> pmk;
 };
 
 /**
- * NDP termination info.
+ * Specifies vendor-specific information fields to be included in NAN management frames.
  */
-struct NanDataPathEndRequest {
-  uint8_t numNdpInstances;
+struct NanBeaconSdfPayloadRequest {
   /**
-   * Unique token Id generated on the initiator/responder side
-   * used for a NDP session between two NAN devices
+   * If true information is transmitted in next 16 DWs, else only in the next (1) DW.
    */
-  vec<NanDataPathId> ndpInstanceIds;
-};
-
-/**
- * Definition of various ResponseType
- */
-enum NanResponseType : uint32_t  {
-  ENABLED = 0,
-  DISABLED = 1,
-  PUBLISH = 2,
-  PUBLISH_CANCEL = 3,
-  TRANSMIT_FOLLOWUP = 4,
-  SUBSCRIBE = 5,
-  SUBSCRIBE_CANCEL = 6,
-  CONFIG = 8,
-  ERROR = 10,
-  BEACON_SDF_PAYLOAD = 11,
-  GET_CAPABILITIES = 12,
-  DP_INTERFACE_CREATE = 13,
-  DP_INTERFACE_DELETE = 14,
-  DP_INITIATOR_RESPONSE = 15,
-  DP_RESPONDER_RESPONSE = 16,
-  DP_END = 17,
-};
-
-/**
- * Various NAN Protocol Response code
- */
-enum NanStatusType : uint32_t {
-  /* NAN Protocol Response Codes */
-  SUCCESS = 0,
-  TIMEOUT = 1,
-  DE_FAILURE = 2,
-  INVALID_MSG_VERSION = 3,
-  INVALID_MSG_LEN = 4,
-  INVALID_MSG_ID = 5,
-  INVALID_HANDLE = 6,
-  NO_SPACE_AVAILABLE = 7,
-  INVALID_PUBLISH_TYPE = 8,
-  INVALID_TX_TYPE = 9,
-  INVALID_MATCH_ALGORITHM = 10,
-  DISABLE_IN_PROGRESS = 11,
-  INVALID_TLV_LEN = 12,
-  INVALID_TLV_TYPE = 13,
-  MISSING_TLV_TYPE = 14,
-  INVALID_TOTAL_TLVS_LEN = 15,
-  INVALID_MATCH_HANDLE = 16,
-  INVALID_TLV_VALUE = 17,
-  INVALID_TX_PRIORITY = 18,
-  INVALID_CONNECTION_MAP = 19,
-  NOT_ALLOWED = 22,
-  NO_OTA_ACK = 23,
-  TX_FAIL = 24,
-  ALREADY_ENABLED = 25,
-  FOLLOWUP_QUEUE_FULL = 26,
-
-  /* NAN Configuration Response codes */
-  INVALID_RSSI_CLOSE_VALUE = 4096,
-  INVALID_RSSI_MIDDLE_VALUE = 4097,
-  INVALID_HOP_COUNT_LIMIT = 4098,
-  INVALID_MASTER_PREFERENCE_VALUE = 4099,
-  INVALID_LOW_CLUSTER_ID_VALUE = 4100,
-  INVALID_HIGH_CLUSTER_ID_VALUE = 4101,
-  INVALID_BACKGROUND_SCAN_PERIOD = 4102,
-  INVALID_RSSI_PROXIMITY_VALUE = 4103,
-  INVALID_SCAN_CHANNEL = 4104,
-  INVALID_POST_CONNECTIVITY_CAPABILITIES_BITMAP = 4105,
-  INVALID_FURTHER_AVAILABILITY_MAP_NUMCHAN_VALUE = 4106,
-  INVALID_FURTHER_AVAILABILITY_MAP_DURATION_VALUE = 4107,
-  INVALID_FURTHER_AVAILABILITY_MAP_CLASS_VALUE = 4108,
-  INVALID_FURTHER_AVAILABILITY_MAP_CHANNEL_VALUE = 4109,
-  INVALID_FURTHER_AVAILABILITY_MAP_AVAILABILITY_INTERVAL_BITMAP_VALUE = 4110,
-  INVALID_FURTHER_AVAILABILITY_MAP_MAP_ID = 4111,
-  INVALID_POST_DISCOVERY_CONN_TYPE_VALUE = 4112,
-  INVALID_POST_DISCOVERY_DEVICE_ROLE_VALUE = 4113,
-  INVALID_POST_DISCOVERY_DURATION_VALUE = 4114,
-  INVALID_POST_DISCOVERY_BITMAP_VALUE = 4115,
-  MISSING_FUTHER_AVAILABILITY_MAP = 4116,
-  INVALID_BAND_CONFIG_FLAGS = 4117,
-  INVALID_RANDOM_FACTOR_UPDATE_TIME_VALUE = 4118,
-  INVALID_ONGOING_SCAN_PERIOD = 4119,
-  INVALID_DW_INTERVAL_VALUE = 4120,
-  INVALID_DB_INTERVAL_VALUE = 4121,
-
-  /* 4122-8191 RESERVED */
-  TERMINATED_REASON_INVALID = 8192,
-  TERMINATED_REASON_TIMEOUT = 8193,
-  TERMINATED_REASON_USER_REQUEST = 8194,
-  TERMINATED_REASON_FAILURE = 8195,
-  TERMINATED_REASON_COUNT_REACHED = 8196,
-  TERMINATED_REASON_DE_SHUTDOWN = 8197,
-  TERMINATED_REASON_DISABLE_IN_PROGRESS = 8198,
-  TERMINATED_REASON_POST_DISC_ATTR_EXPIRED = 8199,
-  TERMINATED_REASON_POST_DISC_LEN_EXCEEDED = 8200,
-  TERMINATED_REASON_FURTHER_AVAIL_MAP_EMPTY = 8201,
-
-  /* 9000-9500 NDP Status type */
-  NDP_UNSUPPORTED_CONCURRENCY = 9000,
-  NDP_DATA_IFACE_CREATE_FAILED = 9001,
-  NDP_DATA_IFACE_DELETE_FAILED = 9002,
-  NDP_DATA_INITIATOR_REQUEST_FAILED = 9003,
-  NDP_DATA_RESPONDER_REQUEST_FAILED = 9004,
-  NDP_INVALID_SERVICE_INSTANCE_ID = 9005,
-  NDP_INVALID_NDP_INSTANCE_ID = 9006,
-  NDP_INVALID_RESPONSE_CODE = 9007,
-  NDP_INVALID_APP_INFO_LEN = 9008,
-
-  /* OTA failures and timeouts during negotiation */
-  NDP_MGMT_FRAME_REQUEST_FAILED = 9009,
-  NDP_MGMT_FRAME_RESPONSE_FAILED = 9010,
-  NDP_MGMT_FRAME_CONFIRM_FAILED = 9011,
-  NDP_END_FAILED = 9012,
-  NDP_MGMT_FRAME_END_REQUEST_FAILED = 9013,
-
-  /* 9500 onwards vendor specific error codes */
-  NDP_VENDOR_SPECIFIC_ERROR = 9500,
-};
-
-/**
- * NAN Response message header
- */
-struct NanResponseMsgHeader {
+  bool transmitInNext16dws;
   /**
-   * Contains the result code.
+   * Specify the management frames in which the vendor-specific information is included.
    */
-  NanStatusType status;
+  bool transmitInDiscoveryBeacon;
+  bool transmitInSyncBeacon;
+  bool transmitInServiceDiscoveryFrame;
   /**
-   * For error returns the value is returned which was in error.
-   * TODO(b/32207606): Find all the error values.
-   */
-  uint32_t value;
-  /**
-   * ResponseType Definitions.
-   */
-  NanResponseType responseType;
-};
-
-/**
- * Publish Response Message structure.
- */
-struct NanPublishResponse {
-  uint16_t publishId;
-};
-
-/**
- * NAN Publish Response Messages.
- */
-struct NanPublishResponseMsg {
-  NanResponseMsgHeader header;
-  NanPublishResponse body;
-};
-
-
-/**
- * Subscribe Response Message structure.
- */
-struct NanSubscribeResponse {
-  uint16_t subscribeId;
-};
-
-/**
- * NAN Subscribe Response Messages.
- */
-struct NanSubscribeResponseMsg {
-  NanResponseMsgHeader header;
-  NanSubscribeResponse body;
-};
-
-/**
- * Response returned for Initiators Data request.
- */
-struct NanDataPathResponse {
-  /**
-   * Unique token Id generated on the initiator
-   * side used for a NDP session between two NAN devices
-   */
-  NanDataPathId ndpInstanceId;
-};
-
-/**
- * NAN Data Path Response Messages.
- */
-struct NanDataPathResponseMsg {
-  NanResponseMsgHeader header;
-  NanDataPathResponse body;
-};
-
-/**
- * NDP Capabilites response.
- */
-struct NanCapabilitiesResponse {
-  uint32_t maxConcurrentClusters;
-  uint32_t maxPublishes;
-  uint32_t maxSubscribes;
-  uint32_t maxServiceNameLen;
-  uint32_t maxMatchFilterLen;
-  uint32_t maxTotalMatchFilterLen;
-  uint32_t maxServiceSpecificInfoLen;
-  uint32_t maxVsaDataLen;
-  uint32_t maxMeshDataLen;
-  uint32_t maxNdiInterfaces;
-  uint32_t maxNdpSessions;
-  uint32_t maxAppInfoLen;
-  uint32_t maxQueuedTransmitFollowupMsgs;
-};
-
-/**
- * NAN Capabilities Response Messages.
- */
-struct NanCapabilitiesResponseMsg {
-  NanResponseMsgHeader header;
-  NanCapabilitiesResponse body;
-};
-
-/**
- * Publish Terminated Message structure.
- * The PublishTerminatedInd message is sent by the DE whenever a Publish
- * terminates from a user-specified timeout or a unrecoverable error in the DE.
- */
-struct NanPublishTerminatedInd {
-  /**
-   * Id returned during the initial Publish.
-   */
-  uint16_t publishId;
-  NanStatusType reason;
-};
-
-/**
- * Match Indication Message structure.
- * The MatchInd message is sent once per responding MAC address whenever
- * the Discovery Engine detects a match for a previous SubscribeServiceReq
- * or PublishServiceReq.
- */
-struct NanMatchInd {
-  /**
-   * Publish or Subscribe Id of an earlier Publish/Subscribe.
-   */
-  uint16_t publishSubscribeId;
-  /**
-   * A 32 bit Requestor Instance Id which is sent to the Application.
-   * This Id must be sent in any subsequent UnmatchInd/FollowupInd
-   * messages.
-   */
-  uint32_t requestorInstanceId;
-  MacAddress addr;
-  /**
-   * Sequence of octets which were received in a Discovery Frame matching the
-   * Subscribe Request.
-   * Max length: |MAX_SERVICE_SPECIFIC_INFO_LEN|.
-   */
-  vec<uint8_t> serviceSpecificInfo;
-  /**
-   * Ordered sequence of <length, value> pairs received in the Discovery Frame
-   * matching the Subscribe Request.
-   * Max length: |MAX_MATCH_FILTER_LEN|.
-   */
-  vec<uint8_t> sdfMatchFilter;
-  /**
-   * Flag to indicate if the Match occurred in a Beacon Frame or in a
-   * Service Discovery Frame.
-   */
-  bool matchOccuredFlag;
-  /**
-   * Flag to indicate FW is out of resource and that it can no longer
-   * track this Service Name. The Host still need to send the received
-   * Match_Handle but duplicate MatchInd messages may be received on
-   * this Handle until the resource frees up.
-   */
-  bool outOfResourceFlag;
-  /**
-   * If RSSI filtering was configured in SubscribeRequest then this
-   * field must contain the received RSSI value. 0 if not.
-   * All rssi values must be specified without sign.
-   * For eg: -70dBm must be specified as 70.
-   */
-  uint8_t rssiValue;
-};
-
-/**
- * MatchExpired Indication Message structure.
- * The MatchExpiredInd message is sent whenever the Discovery Engine detects that
- * a previously Matched Service has been gone for too long. If the previous
- * MatchInd message for this Publish/Subscribe Id had the out_of_resource_flag
- * set then this message must not be received
- */
-struct NanMatchExpiredInd {
-  /**
-   * Publish or Subscribe Id of an earlier Publish/Subscribe.
-   */
-  uint16_t publishSubscribeId;
-  /**
-   * 32 bit value sent by the DE in a previous
-   * MatchInd/FollowupInd to the application.
-   */
-  uint32_t requestorInstanceId;
-};
-
-/**
- * Subscribe Terminated Message structure.
- * The SubscribeTerminatedInd message is sent by the DE whenever a
- * Subscribe terminates from a user-specified timeout or a unrecoverable error in the DE.
- */
-struct NanSubscribeTerminatedInd {
-  /**
-   * Id returned during initial Subscribe.
-   */
-  uint16_t subscribeId;
-  NanStatusType reason;
-};
-
-/**
- * Followup Indication Message structure.
- * The FollowupInd message is sent by the DE to the Host whenever it receives a
- * Followup message from another peer.
- */
-struct NanFollowupInd {
-  /**
-   * Publish or Subscribe Id of an earlier Publish/Subscribe.
-   */
-  uint16_t publishSubscribeId;
-  /**
-   * A 32 bit Requestor instance Id which is sent to the Application.
-   * This Id must be used in subsequent UnmatchInd/FollowupInd messages.
-   */
-  uint32_t requestorInstanceId;
-  MacAddress addr;
-  /**
-   * Flag which the DE uses to decide if received in a DW or a FAW
-   * 0= send in a DW, 1=send in FAW.
-   */
-  NanTransmitWindowType dwOrFaw;
-  /**
-   * Sequence of values which further specify the published service beyond
-   * the service name
-   * Max length: |MAX_SERVICE_SPECIFIC_INFO_LEN|.
-   */
-  vec<uint8_t> serviceSpecificInfo;
-};
-
-/**
- * NAN Protocol Event ID Codes.
- */
-enum NanDiscEngEventType : uint32_t {
-  /**
-   * Event data notifying the Mac address of the Discovery engine.
-   * which is reported as one of the Discovery engine event
-   */
-  DISC_MAC_ADDR = 0,
-  /**
-   * Event data notifying the Cluster address of the cluster
-   * which is reported as one of the Discovery engine events.
-   */
-  STARTED_CLUSTER,
-  JOINED_CLUSTER,
-};
-
-/**
- * Discovery Engine Event Indication Message structure.
- * The Discovery Engine can inform the Host when significant events occur
- * The data following the EventId is dependent upon the EventId type.
- * In other words, each new event defined must carry a different
- * structure of information back to the host.
- */
-struct NanDiscEngEventInd {
-  /**
-   * NAN Protocol Event Codes.
-   */
-  NanDiscEngEventType eventType;
-  /**
-   * Mac Address associated with the corresponding event.
-   */
-  MacAddress addr;
-};
-
-/**
- * NAN Disabled Indication Message structure.
- * The DisableInd message indicates to the upper layers that the Discovery
- * Engine has flushed all state and has been shutdown.  When this message is
- * received the DE is guaranteed to have left the NAN cluster it was part of
- * and must have terminated any in progress Publishes or Subscribes.
- */
-struct NanDisabledInd {
-  NanStatusType reason;
-};
-
-/**
- * Mask to determine on which frames attribute was received.
- */
-enum NanVsaRxFrameMask: uint32_t {
-  DISCOVERY_BEACON_MASK = 1 << 0,
-  SYNC_BEACON_MASK = 1 << 1,
-  SERVICE_DISCOVERY_MASK = 1 << 2
-};
-
-struct NanReceiveVendorSpecificAttribute {
-  /**
-   * Frames on which this vendor specific attribute
-   * was received. Mask |NanVsaRxFrameMask| defined above.
-   */
-  uint8_t vsaReceivedOn;
-  /**
-   * Organizationally Unique Identifier.
+   * Organizationally Unique Identifier (OUI).
    */
   uint32_t vendorOui;
   /**
-   * Vendor specific attribute.
-   * Max length: |MAX_VSA_DATA_LEN|.
+   * Vendor specific attribute to be transmitted.
+   * Max length: |NanCapabilities.maxVsaDataLen|.
    */
   vec<uint8_t> vsa;
 };
 
 /**
- * NAN Beacon SDF Payload Received Message structure.
- * Discovery engine sends the details of received Beacon or
- * Service Discovery Frames as part of this structure.
+ * NDP Capabilities response.
  */
-struct NanBeaconSdfPayloadReceive {
+struct NanCapabilities {
   /**
-   * Frame data.
-   * Max length: |MAX_FRAME_DATA_LEN|.
+   * Maximum number of clusters which the device can join concurrently.
    */
-  vec<uint8_t> frameData;
+  uint32_t maxConcurrentClusters;
+  /**
+   * Maximum number of concurrent publish discovery sessions.
+   */
+  uint32_t maxPublishes;
+  /**
+   * Maximum number of concurrent subscribe discovery sessions.
+   */
+  uint32_t maxSubscribes;
+  /**
+   * Maximum length (in bytes) of service name.
+   */
+  uint32_t maxServiceNameLen;
+  /**
+   * Maximum length (in bytes) of individual match filters.
+   */
+  uint32_t maxMatchFilterLen;
+  /**
+   * Maximum length (in bytes) of aggregate match filters.
+   */
+  uint32_t maxTotalMatchFilterLen;
+  /**
+   * Maximum length (in bytes) of the service specific info length or message length in follow-ups.
+   */
+  uint32_t maxServiceSpecificInfoLen;
+  /**
+   * Maximum length (in bytes) of vendor-specific (VSA) data.
+   */
+  uint32_t maxVsaDataLen;
+  /**
+   * Maximum number of data interfaces which can be created concurrently on the device.
+   */
+  uint32_t maxNdiInterfaces;
+  /**
+   * Maximum number of data paths which can be created concurrently on each individual
+   * data interface.
+   */
+  uint32_t maxNdpSessions;
+  /**
+   * Maximum length (in bytes) of application info field (used in data-path negotiations).
+   */
+  uint32_t maxAppInfoLen;
+  /**
+   * Maximum number of transmitted followup messages which can be queued by the firmware.
+   */
+  uint32_t maxQueuedTransmitFollowupMsgs;
+  /**
+   * Maximum number MAC interface addresses which can be specified to a subscribe discovery session.
+   */
+  uint32_t maxSubscribeInterfaceAddresses; // TODO: (hard-code to 42) get from HAL
+  /**
+   * The set of supported Cipher suites. The |NanCipherSuiteType| bit fields are used.
+   */
+  uint32_t supportedCipherSuites;
+};
+
+/**
+ * Match indication structure
+ */
+struct NanMatchInd {
+  /**
+   * Publish or subscribe discovery session ID of an existing discovery session.
+   */
+  uint16_t discoverySessionId;
+  /**
+   * A unique ID of the peer. Can be subsequently used in |transmitFollowupRequest|.
+   */
+  uint32_t peerId;
+  /**
+   * The NAN Discovery (management) MAC address of the peer.
+   */
+  MacAddress addr;
+  /**
+   * The arbitrary information contained in the |serviceSpecificInfo| of the peer's discovery
+   * session.
+   * Max length: |NanCapabilities.maxServiceSpecificInfoLen|.
+   */
+  vec<uint8_t> serviceSpecificInfo;
+  /**
+   * Ordered sequence of <length, value> pairs (length uses 1 byte) of the peer's discovery session
+   * match filter.
+   * Max length: |NanCapabilities.maxMatchFilterLen|.
+   */
+  vec<uint8_t> matchFilter;
+  /**
+   * Indicates the type of discovery: Beacon if true, Service Discovery Frames (SDF) if false.
+   */
+  bool matchOccuredInBeaconFlag;
+  /**
+   * Flag to indicate FW is out of resource and that it can no longer
+   * track this Service Name.
+   */
+  bool outOfResourceFlag;
+  /**
+   * If RSSI filtering was configured in discovery session setup then this
+   * field must contain the received RSSI value. It will contain 0 if RSSI filtering was not
+   * configured.
+   * RSSI values are returned without sign, e.g. -70dBm will be returned as 70.
+   */
+  uint8_t rssiValue;
+  /**
+   * Cipher types supported by the peer for data-paths constructed in the context of this discovery
+   * session. The |NanCipherSuiteType| bit fields are used to set this value.
+   */
+  uint32_t peerSupportedCipherTypes;
+  /**
+   * Indicates whether or not the peer requires security enabled in any data-path (NDP) constructed
+   * in the context of this discovery session.
+   */
+  bool peerRequiresSecurityEnabledInNdp;
+  /**
+   * Indicates whether or not the peer requires (and hence allows) ranging in this discovery
+   * session.
+   * Note that ranging is only performed if all other match criteria with the peer are met.
+   */
+  bool peerRequiresRanging;
+  /**
+   * Ranging indication supersedes the NanMatchAlg specification.
+   * Ex: If NanMatchAlg is MATCH_ONCE, but ranging indications is continuous then continuous
+   * match notifications will be received (with ranging information).
+   * Ranging indication data is provided if Ranging required is enabled in the discovery
+   * specification and:
+   *   1) continuous ranging specified.
+   *   2) ingress/egress specified and:
+   *       - notify once for ingress >= ingress_distance and egress <= egress_distance,
+   *       - same for ingress_egress_both
+   * If the Awake DW intervals are larger than the ranging intervals then priority is given to the
+   * device DW intervals.
+   *
+   * If ranging was required and executed contains the distance to the peer in CM. The
+   * |rangingIndicationType| field specifies the event which triggered ranging.
+   */
+  uint32_t rangingMeasurementInCm;
+  /**
+   * The ranging event(s) which triggered the ranging. Uses bit-fields from |NanRangingIndication|.
+   * E.g. can indicate that continuous ranging is required, or else that an ingress event occurred.
+   */
+   uint32_t rangingIndicationType;
+};
+
+/**
+ * Followup message received from peer indication structure.
+ */
+struct NanFollowupReceivedInd {
+  /**
+   * Discovery session (publish or subscribe) ID of a previously created discovery session. The
+   * message is received in the context of this discovery session.
+   */
+  uint16_t discoverySessionId;
+  /**
+   * A unique ID of the peer. Can be subsequently used in |transmitFollowupRequest|.
+   */
+  uint32_t peerId;
+  /**
+   * The NAN Discovery (management) MAC address of the peer.
+   */
+  MacAddress addr;
+  /**
+   * Indicates whether received in a further availability window (FAW) if true, or in a discovery
+   * window (DW) if false.
+   */
+  bool receivedInFaw;
+  /**
+   * Received message as a byte sequence.
+   * Max length: |NanCapabilities.maxServiceSpecificInfoLen|.
+   */
+  vec<uint8_t> message;
+};
+
+/**
+ * Event types for a cluster event indication.
+ */
+enum NanClusterEventType : uint32_t {
+  /**
+   * Management/discovery interface MAC address has changed (e.g. due to randomization or at
+   * startup).
+   */
+  DISCOVERY_MAC_ADDRESS_CHANGED = 0,
+  /**
+   * A new cluster has been formed by this device.
+   */
+  STARTED_CLUSTER,
+  /**
+   * This device has joined an existing cluster.
+   */
+  JOINED_CLUSTER,
+};
+
+/**
+ * Cluster event indication structure: triggered on events impacting how this device is
+ * visible to peers - cluster forming, joining a new cluster, or changing of the MAC address.
+ */
+struct NanClusterEventInd {
+  /**
+   * Event type causing the cluster event indication to be triggered.
+   */
+  NanClusterEventType eventType;
+  /**
+   * MAC Address associated with the corresponding event.
+   */
+  MacAddress addr;
+};
+
+/**
+ * Mask to determine on which frames the vendor-specific attribute (VSA) was received on.
+ */
+enum NanVsaRxFrameMask: uint32_t {
+  DISCOVERY_BEACON_MASK = 1 << 0,
+  SYNC_BEACON_MASK = 1 << 1,
+  SERVICE_DISCOVERY_MASK = 1 << 2
 };
 
 /**
@@ -1851,98 +1414,91 @@
    */
   MacAddress addr;
   /**
-   * NAN Receive Vendor Specific Attribute.
+   * A flag indicating whether a vendor-specific attribute (VSA) has been received.
    */
   bool isVsaReceived;
-  NanReceiveVendorSpecificAttribute vsa;
   /**
-   * NAN Beacon or SDF Payload Received.
+   * Frames on which this vendor specific attribute was received.
+   * Mask |NanVsaRxFrameMask| defined above.
+   */
+  uint8_t vsaReceivedOnFrames;
+  /**
+   * Organizationally Unique Identifier (OUI) of the vendor-specific attribute.
+   */
+  uint32_t vsaVendorOui;
+  /**
+   * Contents of the vendor specific attribute.
+   * Max length: |NanCapabilities.maxVsaDataLen|.
+   */
+  vec<uint8_t> vsa;
+  /**
+   * A flag indicating whether a NAN beacon or SDF payload has been received.
    */
   bool isBeaconSdfPayloadReceived;
-  NanBeaconSdfPayloadReceive data;
+  /**
+   * The contents of the NAN beacon or SDF payload.
+   */
+  vec<uint8_t> beaconSdfPayloadData;
 };
 
 /**
  * NAN Data path request Indication Message structure.
- * Event indication received on the responder side when a Nan Data request or
- * NDP session is initiated on the Initiator side.
+ * Event indication received by an intended Responder when a Nan Data request initiated by an
+ * Initiator.
  */
 struct NanDataPathRequestInd {
   /**
-   * Unique Instance Id corresponding to a service/session.
-   * This is similar to the publish_id generated on the
-   * publisher side.
+   * ID of an active publish or subscribe discovery session - the data-path request is in the
+   * context of this discovery session.
    */
-  uint16_t serviceInstanceId;
+  uint16_t discoverySessionId;
   /**
-   * Discovery MAC addr of the peer/initiator.
+   * MAC address of the Initiator peer. This is the MAC address of the peer's management/discovery
+   * NAN interface.
    */
   MacAddress peerDiscMacAddr;
   /**
-   * Unique token Id generated on the initiator/responder side
-   * used for a NDP session between two NAN devices.
+   * ID of the data-path - used to identify the data-path in further negotiation/APIs.
    */
-  NanDataPathId ndpInstanceId;
+  uint32_t ndpInstanceId;
   /**
-   * Initiator/Responder Security/QoS configuration.
+   * Specifies whether or not security is required by the peer for the data-path being created.
    */
-  NanDataPathCfg ndpCfg;
+  bool securityRequired;
   /**
-   * App/Service information of the initiator.
+   * Arbitrary token transmitted by the peer as part of the data-path negotiation (not encrypted).
+   * Max length: |NanCapabilities.maxAppInfoLen|.
    */
-  NanDataPathAppInfo appInfo;
+  vec<uint8_t> appInfo;
 };
 
 /**
- * NAN Data path confirmation Indication Message structure.
- * Event indication of data confirm is received on both
- * initiator and responder side confirming a NDP session.
+ * NAN Data path confirmation Indication structure.
+ * Event indication is received on both initiator and responder side when negotiation for a
+ * data-path finish: on success or failure.
  */
 struct NanDataPathConfirmInd {
   /**
-   * Unique token Id generated on the initiator/responder side
-   * used for a NDP session between two NAN devices
+   * ID of the data-path.
    */
-  NanDataPathId ndpInstanceId;
+  uint32_t ndpInstanceId;
   /**
-   * NDI mac address of the peer.
-   * (required to derive target ipv6 address)
+   * Indicates whether the data-path setup succeeded (true) or failed (false).
+   */
+  bool dataPathSetupSuccess;
+  /**
+   * MAC address of the peer's data-interface (not it's management/discovery interface).
    */
   MacAddress peerNdiMacAddr;
   /**
-   * App/Service information of Initiator/Responder.
+   * Arbitrary token transmitted by the peer as part of the data-path negotiation (not encrypted).
+   * Max length: |NanCapabilities.maxAppInfoLen|.
    */
-  NanDataPathAppInfo appInfo;
+  vec<uint8_t> appInfo;
   /**
-   * Response code indicating ACCEPT/REJECT/DEFER.
+   * Failure reason if |dataPathSetupSuccess| is false.
    */
-  NanDataPathResponseCode rspCode;
-  /**
-   * Reason code indicating the cause for REJECT.
-   */
-  NanStatusType reasonCode;
-};
-
-/**
- * NAN Data path end Indication Message structure.
- * Event indication received on the initiator/responder side terminating
- * a NDP session
- */
-struct NanDataPathEndInd {
-  /**
-   * Unique token Id generated on the initiator/responder side
-   * used for a NDP session between two NAN devices
-   */
-  vec<NanDataPathId> ndpInstanceIds;
-};
-
-/**
- * NAN Transmit followup Indication Message structure.
- * Event Indication notifying the transmit followup in progress.
- */
-struct NanTransmitFollowupInd {
-  CommandId cmdId;
-  NanStatusType reason;
+  WifiNanStatus status;
 };
 
 /**