Merge "Fix powerhint for NULL parameter"
diff --git a/audio/2.0/IStream.hal b/audio/2.0/IStream.hal
index 5c88a69..8de7851 100644
--- a/audio/2.0/IStream.hal
+++ b/audio/2.0/IStream.hal
@@ -279,4 +279,16 @@
      */
     getMmapPosition()
             generates (Result retval, MmapPosition position);
+
+    /*
+     * Called by the framework to deinitialize the stream and free up
+     * all the currently allocated resources. It is recommended to close
+     * the stream on the client side as soon as it is becomes unused.
+     *
+     * @return retval OK in case the success.
+     *                NOT_SUPPORTED if called on IStream instead of input or
+     *                              output stream interface.
+     *                INVALID_STATE if the stream was already closed.
+     */
+    close() generates (Result retval);
 };
diff --git a/audio/2.0/IStreamIn.hal b/audio/2.0/IStreamIn.hal
index 6cf7425..9a96f71 100644
--- a/audio/2.0/IStreamIn.hal
+++ b/audio/2.0/IStreamIn.hal
@@ -41,16 +41,45 @@
     setGain(float gain) generates (Result retval);
 
     /*
-     * Read audio buffer in from driver. If at least one frame was read prior to
-     * the error, 'read' must return that byte count and then return an error
-     * in the subsequent call.
+     * Data structure passed back to the client via status message queue
+     * of 'read' operation.
      *
-     * @param size maximum amount of bytes to read.
-     * @return retval operation completion status.
-     * @return data audio data.
+     * Possible values of 'retval' field:
+     *  - OK, read operation was successful;
+     *  - INVALID_ARGUMENTS, stream was not configured properly;
+     *  - INVALID_STATE, stream is in a state that doesn't allow reads.
      */
-    // TODO(mnaganov): Replace with FMQ version.
-    read(uint64_t size) generates (Result retval, vec<uint8_t> data);
+    struct ReadStatus {
+        Result retval;
+        uint64_t read;
+    };
+
+    /*
+     * Set up required transports for receiving audio buffers from the driver.
+     *
+     * The transport consists of two message queues: one is used for passing
+     * audio data from the driver to the client, another is used for reporting
+     * read operation status (amount of bytes actually read or error code),
+     * see ReadStatus structure definition.
+     *
+     * @param frameSize the size of a single frame, in bytes.
+     * @param framesCount the number of frames in a buffer.
+     * @param threadPriority priority of the thread that performs reads.
+     * @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 queues.
+     * @return dataMQ a message queue used for passing audio data in the format
+     *                specified at the stream opening.
+     * @return statusMQ a message queue used for passing status from the driver
+     *                  using ReadStatus structures.
+     */
+    prepareForReading(
+            uint32_t frameSize, uint32_t framesCount,
+            ThreadPriority threadPriority)
+    generates (
+            Result retval,
+            fmq_sync<uint8_t> dataMQ, fmq_sync<ReadStatus> statusMQ);
 
     /*
      * Return the amount of input frames lost in the audio driver since the last
diff --git a/audio/2.0/IStreamOut.hal b/audio/2.0/IStreamOut.hal
index 4ba3b2f..155e329 100644
--- a/audio/2.0/IStreamOut.hal
+++ b/audio/2.0/IStreamOut.hal
@@ -44,25 +44,48 @@
     setVolume(float left, float right) generates (Result retval);
 
     /*
-     * Write audio buffer to driver. On success, sets 'retval' to 'OK', and
-     * returns number of bytes written. If at least one frame was written
-     * successfully prior to the error, it is suggested that the driver return
-     * that successful (short) byte count and then return an error in the
-     * subsequent call.
+     * Data structure passed back to the client via status message queue
+     * of 'write' operation.
      *
-     * If 'setCallback' has previously been called to enable non-blocking mode
-     * then 'write' is not allowed to block. It must write only the number of
-     * bytes that currently fit in the driver/hardware buffer and then return
-     * this byte count. If this is less than the requested write size the
-     * callback function must be called when more space is available in the
-     * driver/hardware buffer.
-     *
-     * @param data audio data.
-     * @return retval operation completion status.
-     * @return written number of bytes written.
+     * Possible values of 'retval' field:
+     *  - OK, write operation was successful;
+     *  - INVALID_ARGUMENTS, stream was not configured properly;
+     *  - INVALID_STATE, stream is in a state that doesn't allow writes.
      */
-    // TODO(mnaganov): Replace with FMQ version.
-    write(vec<uint8_t> data) generates (Result retval, uint64_t written);
+    struct WriteStatus {
+        Result retval;
+        uint64_t written;
+        uint64_t frames;    // presentation position
+        TimeSpec timeStamp; // presentation position
+    };
+
+    /*
+     * Set up required transports for passing audio buffers to the driver.
+     *
+     * The transport consists of two message queues: one is used for passing
+     * audio data from the client to the driver, another is used for reporting
+     * write operation status (amount of bytes actually written or error code),
+     * and the presentation position immediately after the write, see
+     * WriteStatus structure definition.
+     *
+     * @param frameSize the size of a single frame, in bytes.
+     * @param framesCount the number of frames in a buffer.
+     * @param threadPriority priority of the thread that performs writes.
+     * @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 queues.
+     * @return dataMQ a message queue used for passing audio data in the format
+     *                specified at the stream opening.
+     * @return statusMQ a message queue used for passing status from the driver
+     *                  using WriteStatus structures.
+     */
+    prepareForWriting(
+            uint32_t frameSize, uint32_t framesCount,
+            ThreadPriority threadPriority)
+    generates (
+            Result retval,
+            fmq_sync<uint8_t> dataMQ, fmq_sync<WriteStatus> statusMQ);
 
     /*
      * Return the number of audio frames written by the audio DSP to DAC since
diff --git a/audio/2.0/default/Android.mk b/audio/2.0/default/Android.mk
index c3cfd69..eeea92c 100644
--- a/audio/2.0/default/Android.mk
+++ b/audio/2.0/default/Android.mk
@@ -30,13 +30,16 @@
     StreamOut.cpp \
 
 LOCAL_SHARED_LIBRARIES := \
+    libbase \
+    libcutils \
+    libfmq \
+    libhardware \
     libhidlbase \
     libhidltransport \
     libhwbinder \
-    libcutils \
-    libutils \
-    libhardware \
     liblog \
+    libmediautils \
+    libutils \
     android.hardware.audio@2.0 \
     android.hardware.audio.common@2.0 \
     android.hardware.audio.common@2.0-util \
diff --git a/audio/2.0/default/Stream.cpp b/audio/2.0/default/Stream.cpp
index f214eed..62b34a3 100644
--- a/audio/2.0/default/Stream.cpp
+++ b/audio/2.0/default/Stream.cpp
@@ -253,6 +253,10 @@
     return Void();
 }
 
+Return<Result> Stream::close()  {
+    return Result::NOT_SUPPORTED;
+}
+
 } // namespace implementation
 }  // namespace V2_0
 }  // namespace audio
diff --git a/audio/2.0/default/Stream.h b/audio/2.0/default/Stream.h
index 819bbf7..0bbd803 100644
--- a/audio/2.0/default/Stream.h
+++ b/audio/2.0/default/Stream.h
@@ -76,6 +76,7 @@
     Return<Result> stop() override;
     Return<void> createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) override;
     Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) override;
+    Return<Result> close()  override;
 
     // Utility methods for extending interfaces.
     static Result analyzeStatus(const char* funcName, int status, int ignoreError = OK);
diff --git a/audio/2.0/default/StreamIn.cpp b/audio/2.0/default/StreamIn.cpp
index 1441e74..51c2cc7 100644
--- a/audio/2.0/default/StreamIn.cpp
+++ b/audio/2.0/default/StreamIn.cpp
@@ -15,26 +15,112 @@
  */
 
 #define LOG_TAG "StreamInHAL"
+//#define LOG_NDEBUG 0
 
-#include <hardware/audio.h>
 #include <android/log.h>
+#include <hardware/audio.h>
+#include <mediautils/SchedulingPolicyService.h>
 
 #include "StreamIn.h"
 
+using ::android::hardware::audio::V2_0::MessageQueueFlagBits;
+
 namespace android {
 namespace hardware {
 namespace audio {
 namespace V2_0 {
 namespace implementation {
 
+namespace {
+
+class ReadThread : public Thread {
+  public:
+    // ReadThread's lifespan never exceeds StreamIn's lifespan.
+    ReadThread(std::atomic<bool>* stop,
+            audio_stream_in_t* stream,
+            StreamIn::DataMQ* dataMQ,
+            StreamIn::StatusMQ* statusMQ,
+            EventFlag* efGroup,
+            ThreadPriority threadPriority)
+            : Thread(false /*canCallJava*/),
+              mStop(stop),
+              mStream(stream),
+              mDataMQ(dataMQ),
+              mStatusMQ(statusMQ),
+              mEfGroup(efGroup),
+              mThreadPriority(threadPriority),
+              mBuffer(new uint8_t[dataMQ->getQuantumCount()]) {
+    }
+    virtual ~ReadThread() {}
+
+    status_t readyToRun() override;
+
+  private:
+    std::atomic<bool>* mStop;
+    audio_stream_in_t* mStream;
+    StreamIn::DataMQ* mDataMQ;
+    StreamIn::StatusMQ* mStatusMQ;
+    EventFlag* mEfGroup;
+    ThreadPriority mThreadPriority;
+    std::unique_ptr<uint8_t[]> mBuffer;
+
+    bool threadLoop() override;
+};
+
+status_t ReadThread::readyToRun() {
+    if (mThreadPriority != ThreadPriority::NORMAL) {
+        int err = requestPriority(
+                getpid(), getTid(), static_cast<int>(mThreadPriority), true /*asynchronous*/);
+        ALOGW_IF(err, "failed to set priority %d for pid %d tid %d; error %d",
+                static_cast<int>(mThreadPriority), getpid(), getTid(), err);
+    }
+    return OK;
+}
+
+bool ReadThread::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)) {
+        // TODO: Remove manual event flag handling once blocking MQ is implemented. b/33815422
+        uint32_t efState = 0;
+        mEfGroup->wait(static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL), &efState, NS_PER_SEC);
+        if (!(efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL))) {
+            continue;  // Nothing to do.
+        }
+
+        const size_t availToWrite = mDataMQ->availableToWrite();
+        ssize_t readResult = mStream->read(mStream, &mBuffer[0], availToWrite);
+        Result retval = Result::OK;
+        uint64_t read = 0;
+        if (readResult >= 0) {
+            read = readResult;
+            if (!mDataMQ->write(&mBuffer[0], readResult)) {
+                ALOGW("data message queue write failed");
+            }
+        } else {
+            retval = Stream::analyzeStatus("read", readResult);
+        }
+        IStreamIn::ReadStatus status = { retval, read };
+        if (!mStatusMQ->write(&status)) {
+            ALOGW("status message queue write failed");
+        }
+        mEfGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY));
+    }
+
+    return false;
+}
+
+}  // namespace
+
 StreamIn::StreamIn(audio_hw_device_t* device, audio_stream_in_t* stream)
-        : mDevice(device), mStream(stream),
+        : mIsClosed(false), mDevice(device), mStream(stream),
           mStreamCommon(new Stream(&stream->common)),
-          mStreamMmap(new StreamMmap<audio_stream_in_t>(stream)) {
+          mStreamMmap(new StreamMmap<audio_stream_in_t>(stream)),
+          mEfGroup(nullptr), mStopReadThread(false) {
 }
 
 StreamIn::~StreamIn() {
-    mDevice->close_input_stream(mDevice, mStream);
+    close();
     mStream = nullptr;
     mDevice = nullptr;
 }
@@ -149,6 +235,22 @@
     return mStreamMmap->getMmapPosition(_hidl_cb);
 }
 
+Return<Result> StreamIn::close()  {
+    if (mIsClosed) return Result::INVALID_STATE;
+    mIsClosed = true;
+    if (mReadThread.get()) {
+        mStopReadThread.store(true, std::memory_order_release);
+        status_t status = mReadThread->requestExitAndWait();
+        ALOGE_IF(status, "read thread exit error: %s", strerror(-status));
+    }
+    if (mEfGroup) {
+        status_t status = EventFlag::deleteEventFlag(&mEfGroup);
+        ALOGE_IF(status, "read MQ event flag deletion error: %s", strerror(-status));
+    }
+    mDevice->close_input_stream(mDevice, mStream);
+    return Result::OK;
+}
+
 // Methods from ::android::hardware::audio::V2_0::IStreamIn follow.
 Return<void> StreamIn::getAudioSource(getAudioSource_cb _hidl_cb)  {
     int halSource;
@@ -165,19 +267,55 @@
     return Stream::analyzeStatus("set_gain", mStream->set_gain(mStream, gain));
 }
 
-Return<void> StreamIn::read(uint64_t size, read_cb _hidl_cb)  {
-    // TODO(mnaganov): Replace with FMQ version.
-    hidl_vec<uint8_t> data;
-    data.resize(size);
-    Result retval(Result::OK);
-    ssize_t readResult = mStream->read(mStream, &data[0], data.size());
-    if (readResult >= 0 && static_cast<size_t>(readResult) != data.size()) {
-        data.resize(readResult);
-    } else if (readResult < 0) {
-        data.resize(0);
-        retval = Stream::analyzeStatus("read", readResult);
+Return<void> StreamIn::prepareForReading(
+        uint32_t frameSize, uint32_t framesCount, ThreadPriority threadPriority,
+        prepareForReading_cb _hidl_cb)  {
+    status_t status;
+    // Create message queues.
+    if (mDataMQ) {
+        ALOGE("the client attempts to call prepareForReading twice");
+        _hidl_cb(Result::INVALID_STATE,
+                MQDescriptorSync<uint8_t>(), MQDescriptorSync<ReadStatus>());
+        return Void();
     }
-    _hidl_cb(retval, data);
+    std::unique_ptr<DataMQ> tempDataMQ(
+            new DataMQ(frameSize * framesCount, true /* EventFlag */));
+    std::unique_ptr<StatusMQ> tempStatusMQ(new StatusMQ(1));
+    if (!tempDataMQ->isValid() || !tempStatusMQ->isValid()) {
+        ALOGE_IF(!tempDataMQ->isValid(), "data MQ is invalid");
+        ALOGE_IF(!tempStatusMQ->isValid(), "status MQ is invalid");
+        _hidl_cb(Result::INVALID_ARGUMENTS,
+                MQDescriptorSync<uint8_t>(), MQDescriptorSync<ReadStatus>());
+        return Void();
+    }
+    // TODO: Remove event flag management once blocking MQ is implemented. b/33815422
+    status = EventFlag::createEventFlag(tempDataMQ->getEventFlagWord(), &mEfGroup);
+    if (status != OK || !mEfGroup) {
+        ALOGE("failed creating event flag for data MQ: %s", strerror(-status));
+        _hidl_cb(Result::INVALID_ARGUMENTS,
+                MQDescriptorSync<uint8_t>(), MQDescriptorSync<ReadStatus>());
+        return Void();
+    }
+
+    // Create and launch the thread.
+    mReadThread = new ReadThread(
+            &mStopReadThread,
+            mStream,
+            tempDataMQ.get(),
+            tempStatusMQ.get(),
+            mEfGroup,
+            threadPriority);
+    status = mReadThread->run("reader", PRIORITY_URGENT_AUDIO);
+    if (status != OK) {
+        ALOGW("failed to start reader thread: %s", strerror(-status));
+        _hidl_cb(Result::INVALID_ARGUMENTS,
+                MQDescriptorSync<uint8_t>(), MQDescriptorSync<ReadStatus>());
+        return Void();
+    }
+
+    mDataMQ = std::move(tempDataMQ);
+    mStatusMQ = std::move(tempStatusMQ);
+    _hidl_cb(Result::OK, *mDataMQ->getDesc(), *mStatusMQ->getDesc());
     return Void();
 }
 
diff --git a/audio/2.0/default/StreamIn.h b/audio/2.0/default/StreamIn.h
index 65e94bb..fc813d9 100644
--- a/audio/2.0/default/StreamIn.h
+++ b/audio/2.0/default/StreamIn.h
@@ -17,10 +17,15 @@
 #ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
 #define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
 
-#include <android/hardware/audio/2.0/IStreamIn.h>
-#include <hidl/Status.h>
+#include <atomic>
+#include <memory>
 
+#include <android/hardware/audio/2.0/IStreamIn.h>
 #include <hidl/MQDescriptor.h>
+#include <fmq/EventFlag.h>
+#include <fmq/MessageQueue.h>
+#include <hidl/Status.h>
+#include <utils/Thread.h>
 
 #include "Stream.h"
 
@@ -39,6 +44,7 @@
 using ::android::hardware::audio::V2_0::IStreamIn;
 using ::android::hardware::audio::V2_0::ParameterValue;
 using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::audio::V2_0::ThreadPriority;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
 using ::android::hardware::hidl_vec;
@@ -46,6 +52,9 @@
 using ::android::sp;
 
 struct StreamIn : public IStreamIn {
+    typedef MessageQueue<uint8_t, kSynchronizedReadWrite> DataMQ;
+    typedef MessageQueue<ReadStatus, kSynchronizedReadWrite> StatusMQ;
+
     StreamIn(audio_hw_device_t* device, audio_stream_in_t* stream);
 
     // Methods from ::android::hardware::audio::V2_0::IStream follow.
@@ -73,11 +82,14 @@
             const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb)  override;
     Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters)  override;
     Return<void> debugDump(const hidl_handle& fd)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::V2_0::IStreamIn follow.
     Return<void> getAudioSource(getAudioSource_cb _hidl_cb)  override;
     Return<Result> setGain(float gain)  override;
-    Return<void> read(uint64_t size, read_cb _hidl_cb)  override;
+    Return<void> prepareForReading(
+            uint32_t frameSize, uint32_t framesCount, ThreadPriority threadPriority,
+            prepareForReading_cb _hidl_cb)  override;
     Return<uint32_t> getInputFramesLost()  override;
     Return<void> getCapturePosition(getCapturePosition_cb _hidl_cb)  override;
     Return<Result> start() override;
@@ -86,11 +98,16 @@
     Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) override;
 
   private:
+    bool mIsClosed;
     audio_hw_device_t *mDevice;
     audio_stream_in_t *mStream;
     sp<Stream> mStreamCommon;
     sp<StreamMmap<audio_stream_in_t>> mStreamMmap;
-
+    std::unique_ptr<DataMQ> mDataMQ;
+    std::unique_ptr<StatusMQ> mStatusMQ;
+    EventFlag* mEfGroup;
+    std::atomic<bool> mStopReadThread;
+    sp<Thread> mReadThread;
 
     virtual ~StreamIn();
 };
diff --git a/audio/2.0/default/StreamOut.cpp b/audio/2.0/default/StreamOut.cpp
index 3d20d11..4bb2274 100644
--- a/audio/2.0/default/StreamOut.cpp
+++ b/audio/2.0/default/StreamOut.cpp
@@ -17,8 +17,9 @@
 #define LOG_TAG "StreamOutHAL"
 //#define LOG_NDEBUG 0
 
-#include <hardware/audio.h>
 #include <android/log.h>
+#include <hardware/audio.h>
+#include <mediautils/SchedulingPolicyService.h>
 
 #include "StreamOut.h"
 
@@ -28,15 +29,103 @@
 namespace V2_0 {
 namespace implementation {
 
+namespace {
+
+class WriteThread : public Thread {
+  public:
+    // WriteThread's lifespan never exceeds StreamOut's lifespan.
+    WriteThread(std::atomic<bool>* stop,
+            audio_stream_out_t* stream,
+            StreamOut::DataMQ* dataMQ,
+            StreamOut::StatusMQ* statusMQ,
+            EventFlag* efGroup,
+            ThreadPriority threadPriority)
+            : Thread(false /*canCallJava*/),
+              mStop(stop),
+              mStream(stream),
+              mDataMQ(dataMQ),
+              mStatusMQ(statusMQ),
+              mEfGroup(efGroup),
+              mThreadPriority(threadPriority),
+              mBuffer(new uint8_t[dataMQ->getQuantumCount()]) {
+    }
+    virtual ~WriteThread() {}
+
+    status_t readyToRun() override;
+
+  private:
+    std::atomic<bool>* mStop;
+    audio_stream_out_t* mStream;
+    StreamOut::DataMQ* mDataMQ;
+    StreamOut::StatusMQ* mStatusMQ;
+    EventFlag* mEfGroup;
+    ThreadPriority mThreadPriority;
+    std::unique_ptr<uint8_t[]> mBuffer;
+
+    bool threadLoop() override;
+};
+
+status_t WriteThread::readyToRun() {
+    if (mThreadPriority != ThreadPriority::NORMAL) {
+        int err = requestPriority(
+                getpid(), getTid(), static_cast<int>(mThreadPriority), true /*asynchronous*/);
+        ALOGW_IF(err, "failed to set priority %d for pid %d tid %d; error %d",
+                static_cast<int>(mThreadPriority), getpid(), getTid(), err);
+    }
+    return OK;
+}
+
+bool WriteThread::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)) {
+        // TODO: Remove manual event flag handling once blocking MQ is implemented. b/33815422
+        uint32_t efState = 0;
+        mEfGroup->wait(
+                static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY), &efState, NS_PER_SEC);
+        if (!(efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY))) {
+            continue;  // Nothing to do.
+        }
+
+        const size_t availToRead = mDataMQ->availableToRead();
+        Result retval = Result::OK;
+        uint64_t written = 0;
+        if (mDataMQ->read(&mBuffer[0], availToRead)) {
+            ssize_t writeResult = mStream->write(mStream, &mBuffer[0], availToRead);
+            if (writeResult >= 0) {
+                written = writeResult;
+            } else {
+                retval = Stream::analyzeStatus("write", writeResult);
+            }
+        }
+        uint64_t frames = 0;
+        struct timespec halTimeStamp = { 0, 0 };
+        if (retval == Result::OK && mStream->get_presentation_position != NULL) {
+            mStream->get_presentation_position(mStream, &frames, &halTimeStamp);
+        }
+        IStreamOut::WriteStatus status = { retval, written, frames,
+                                           { static_cast<uint64_t>(halTimeStamp.tv_sec),
+                                             static_cast<uint64_t>(halTimeStamp.tv_nsec) } };
+        if (!mStatusMQ->write(&status)) {
+            ALOGW("status message queue write failed");
+        }
+        mEfGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL));
+    }
+
+    return false;
+}
+
+}  // namespace
+
 StreamOut::StreamOut(audio_hw_device_t* device, audio_stream_out_t* stream)
-        : mDevice(device), mStream(stream),
+        : mIsClosed(false), mDevice(device), mStream(stream),
           mStreamCommon(new Stream(&stream->common)),
-          mStreamMmap(new StreamMmap<audio_stream_out_t>(stream)) {
+          mStreamMmap(new StreamMmap<audio_stream_out_t>(stream)),
+          mEfGroup(nullptr), mStopWriteThread(false) {
 }
 
 StreamOut::~StreamOut() {
-    mCallback.clear();
-    mDevice->close_output_stream(mDevice, mStream);
+    close();
     mStream = nullptr;
     mDevice = nullptr;
 }
@@ -135,6 +224,23 @@
     return mStreamCommon->debugDump(fd);
 }
 
+Return<Result> StreamOut::close()  {
+    if (mIsClosed) return Result::INVALID_STATE;
+    mIsClosed = true;
+    if (mWriteThread.get()) {
+        mStopWriteThread.store(true, std::memory_order_release);
+        status_t status = mWriteThread->requestExitAndWait();
+        ALOGE_IF(status, "write thread exit error: %s", strerror(-status));
+    }
+    if (mEfGroup) {
+        status_t status = EventFlag::deleteEventFlag(&mEfGroup);
+        ALOGE_IF(status, "write MQ event flag deletion error: %s", strerror(-status));
+    }
+    mCallback.clear();
+    mDevice->close_output_stream(mDevice, mStream);
+    return Result::OK;
+}
+
 // Methods from ::android::hardware::audio::V2_0::IStreamOut follow.
 Return<uint32_t> StreamOut::getLatency()  {
     return mStream->get_latency(mStream);
@@ -149,18 +255,55 @@
     return retval;
 }
 
-Return<void> StreamOut::write(const hidl_vec<uint8_t>& data, write_cb _hidl_cb)  {
-    // TODO(mnaganov): Replace with FMQ version.
-    Result retval(Result::OK);
-    uint64_t written = 0;
-    ssize_t writeResult = mStream->write(mStream, &data[0], data.size());
-    if (writeResult >= 0) {
-        written = writeResult;
-    } else {
-        retval = Stream::analyzeStatus("write", writeResult);
-        written = 0;
+Return<void> StreamOut::prepareForWriting(
+        uint32_t frameSize, uint32_t framesCount, ThreadPriority threadPriority,
+        prepareForWriting_cb _hidl_cb)  {
+    status_t status;
+    // Create message queues.
+    if (mDataMQ) {
+        ALOGE("the client attempts to call prepareForWriting twice");
+        _hidl_cb(Result::INVALID_STATE,
+                MQDescriptorSync<uint8_t>(), MQDescriptorSync<WriteStatus>());
+        return Void();
     }
-    _hidl_cb(retval, written);
+    std::unique_ptr<DataMQ> tempDataMQ(
+            new DataMQ(frameSize * framesCount, true /* EventFlag */));
+    std::unique_ptr<StatusMQ> tempStatusMQ(new StatusMQ(1));
+    if (!tempDataMQ->isValid() || !tempStatusMQ->isValid()) {
+        ALOGE_IF(!tempDataMQ->isValid(), "data MQ is invalid");
+        ALOGE_IF(!tempStatusMQ->isValid(), "status MQ is invalid");
+        _hidl_cb(Result::INVALID_ARGUMENTS,
+                MQDescriptorSync<uint8_t>(), MQDescriptorSync<WriteStatus>());
+        return Void();
+    }
+    // TODO: Remove event flag management once blocking MQ is implemented. b/33815422
+    status = EventFlag::createEventFlag(tempDataMQ->getEventFlagWord(), &mEfGroup);
+    if (status != OK || !mEfGroup) {
+        ALOGE("failed creating event flag for data MQ: %s", strerror(-status));
+        _hidl_cb(Result::INVALID_ARGUMENTS,
+                MQDescriptorSync<uint8_t>(), MQDescriptorSync<WriteStatus>());
+        return Void();
+    }
+
+    // Create and launch the thread.
+    mWriteThread = new WriteThread(
+            &mStopWriteThread,
+            mStream,
+            tempDataMQ.get(),
+            tempStatusMQ.get(),
+            mEfGroup,
+            threadPriority);
+    status = mWriteThread->run("writer", PRIORITY_URGENT_AUDIO);
+    if (status != OK) {
+        ALOGW("failed to start writer thread: %s", strerror(-status));
+        _hidl_cb(Result::INVALID_ARGUMENTS,
+                MQDescriptorSync<uint8_t>(), MQDescriptorSync<WriteStatus>());
+        return Void();
+    }
+
+    mDataMQ = std::move(tempDataMQ);
+    mStatusMQ = std::move(tempStatusMQ);
+    _hidl_cb(Result::OK, *mDataMQ->getDesc(), *mStatusMQ->getDesc());
     return Void();
 }
 
diff --git a/audio/2.0/default/StreamOut.h b/audio/2.0/default/StreamOut.h
index 9b7f9f8..83f4447 100644
--- a/audio/2.0/default/StreamOut.h
+++ b/audio/2.0/default/StreamOut.h
@@ -17,10 +17,15 @@
 #ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
 #define ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
 
-#include <android/hardware/audio/2.0/IStreamOut.h>
-#include <hidl/Status.h>
+#include <atomic>
+#include <memory>
 
+#include <android/hardware/audio/2.0/IStreamOut.h>
 #include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+#include <fmq/EventFlag.h>
+#include <fmq/MessageQueue.h>
+#include <utils/Thread.h>
 
 #include "Stream.h"
 
@@ -40,6 +45,7 @@
 using ::android::hardware::audio::V2_0::IStreamOutCallback;
 using ::android::hardware::audio::V2_0::ParameterValue;
 using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::audio::V2_0::ThreadPriority;
 using ::android::hardware::audio::V2_0::TimeSpec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
@@ -48,6 +54,9 @@
 using ::android::sp;
 
 struct StreamOut : public IStreamOut {
+    typedef MessageQueue<uint8_t, kSynchronizedReadWrite> DataMQ;
+    typedef MessageQueue<WriteStatus, kSynchronizedReadWrite> StatusMQ;
+
     StreamOut(audio_hw_device_t* device, audio_stream_out_t* stream);
 
     // Methods from ::android::hardware::audio::V2_0::IStream follow.
@@ -75,11 +84,14 @@
             const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb)  override;
     Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters)  override;
     Return<void> debugDump(const hidl_handle& fd)  override;
+    Return<Result> close()  override;
 
     // Methods from ::android::hardware::audio::V2_0::IStreamOut follow.
     Return<uint32_t> getLatency()  override;
     Return<Result> setVolume(float left, float right)  override;
-    Return<void> write(const hidl_vec<uint8_t>& data, write_cb _hidl_cb)  override;
+    Return<void> prepareForWriting(
+            uint32_t frameSize, uint32_t framesCount, ThreadPriority threadPriority,
+            prepareForWriting_cb _hidl_cb)  override;
     Return<void> getRenderPosition(getRenderPosition_cb _hidl_cb)  override;
     Return<void> getNextWriteTimestamp(getNextWriteTimestamp_cb _hidl_cb)  override;
     Return<Result> setCallback(const sp<IStreamOutCallback>& callback)  override;
@@ -97,11 +109,17 @@
     Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) override;
 
   private:
+    bool mIsClosed;
     audio_hw_device_t *mDevice;
     audio_stream_out_t *mStream;
     sp<Stream> mStreamCommon;
     sp<StreamMmap<audio_stream_out_t>> mStreamMmap;
     sp<IStreamOutCallback> mCallback;
+    std::unique_ptr<DataMQ> mDataMQ;
+    std::unique_ptr<StatusMQ> mStatusMQ;
+    EventFlag* mEfGroup;
+    std::atomic<bool> mStopWriteThread;
+    sp<Thread> mWriteThread;
 
     virtual ~StreamOut();
 
diff --git a/audio/2.0/types.hal b/audio/2.0/types.hal
index 37c39e4..8fc4314 100644
--- a/audio/2.0/types.hal
+++ b/audio/2.0/types.hal
@@ -89,3 +89,21 @@
     int64_t  timeNanoseconds; // time stamp in ns, CLOCK_MONOTONIC
     int32_t  positionFrames;  // increasing 32 bit frame count reset when IStream.stop() is called
 };
+
+/*
+ * The message queue flags used to synchronize reads and writes from
+ * message queues used by StreamIn and StreamOut.
+ */
+enum MessageQueueFlagBits : uint32_t {
+    NOT_EMPTY = 1 << 0,
+    NOT_FULL = 1 << 1
+};
+
+/*
+ * The priority of threads executing reads and writes of audio data.
+ */
+enum ThreadPriority : int32_t {
+    NORMAL = 0,
+    FAST_CAPTURE = 3,
+    FAST_MIXER = 3
+};
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/audio/effect/2.0/vts/functional/audio_effect_hidl_hal_test.cpp b/audio/effect/2.0/vts/functional/audio_effect_hidl_hal_test.cpp
index 1e0ab32..9b7d0cf 100644
--- a/audio/effect/2.0/vts/functional/audio_effect_hidl_hal_test.cpp
+++ b/audio/effect/2.0/vts/functional/audio_effect_hidl_hal_test.cpp
@@ -65,7 +65,7 @@
         retval = r;
         effectCount = result.size();
       });
-  EXPECT_EQ(ret.getStatus().exceptionCode(), Status::EX_NONE);
+  EXPECT_TRUE(ret.isOk());
   EXPECT_EQ(retval, Result::OK);
   EXPECT_GT(effectCount, 0u);
 }
@@ -80,7 +80,7 @@
           effectUuid = result[0].uuid;
         }
       });
-  ASSERT_EQ(ret.getStatus().exceptionCode(), Status::EX_NONE);
+  ASSERT_TRUE(ret.isOk());
   ASSERT_TRUE(gotEffect);
   Result retval = Result::NOT_INITIALIZED;
   sp<IEffect> effect;
@@ -92,7 +92,7 @@
           effect = result;
         }
       });
-  EXPECT_EQ(ret.getStatus().exceptionCode(), Status::EX_NONE);
+  EXPECT_TRUE(ret.isOk());
   EXPECT_EQ(retval, Result::OK);
   EXPECT_NE(effect, nullptr);
 }
@@ -105,7 +105,7 @@
           allDescriptors = result;
         }
       });
-  ASSERT_EQ(ret.getStatus().exceptionCode(), Status::EX_NONE);
+  ASSERT_TRUE(ret.isOk());
   ASSERT_GT(allDescriptors.size(), 0u);
   for (size_t i = 0; i < allDescriptors.size(); ++i) {
     ret = effectsFactory->getDescriptor(
@@ -114,7 +114,7 @@
           EXPECT_EQ(result, allDescriptors[i]);
         });
   }
-  EXPECT_EQ(ret.getStatus().exceptionCode(), Status::EX_NONE);
+  EXPECT_TRUE(ret.isOk());
 }
 
 int main(int argc, char** argv) {
diff --git a/audio/effect/2.0/vts/functional/vts/testcases/hal/audio/effect/hidl/target/AndroidTest.xml b/audio/effect/2.0/vts/functional/vts/testcases/hal/audio/effect/hidl/target/AndroidTest.xml
index f0af67a..60a2cd0 100644
--- a/audio/effect/2.0/vts/functional/vts/testcases/hal/audio/effect/hidl/target/AndroidTest.xml
+++ b/audio/effect/2.0/vts/functional/vts/testcases/hal/audio/effect/hidl/target/AndroidTest.xml
@@ -24,6 +24,7 @@
             _32bit::DATA/nativetest/audio_effect_hidl_hal_test/audio_effect_hidl_hal_test,
             _64bit::DATA/nativetest64/audio_effect_hidl_hal_test/audio_effect_hidl_hal_test,
             "/>
+        <option name="test-config-path" value="vts/testcases/hal/audio/effect/hidl/target/HalAudioEffectHidlTargetBasicTest.config" />
         <option name="binary-test-type" value="gtest" />
         <option name="test-timeout" value="1m" />
     </test>
diff --git a/audio/effect/2.0/vts/functional/vts/testcases/hal/audio/effect/hidl/target/HalAudioEffectHidlTargetBasicTest.config b/audio/effect/2.0/vts/functional/vts/testcases/hal/audio/effect/hidl/target/HalAudioEffectHidlTargetBasicTest.config
new file mode 100644
index 0000000..495fda9
--- /dev/null
+++ b/audio/effect/2.0/vts/functional/vts/testcases/hal/audio/effect/hidl/target/HalAudioEffectHidlTargetBasicTest.config
@@ -0,0 +1,11 @@
+{
+    "use_gae_db": true,
+    "coverage": true,
+    "modules": [{
+                    "module_name": "system/lib64/hw/android.hardware.audio.effect@2.0-impl",
+                    "git_project": {
+                        "name": "platform/hardware/interfaces",
+                        "path": "hardware/interfaces"
+                    }
+                }]
+}
diff --git a/boot/1.0/vts/functional/boot_hidl_hal_test.cpp b/boot/1.0/vts/functional/boot_hidl_hal_test.cpp
index 7b002b9..cdca7e2 100644
--- a/boot/1.0/vts/functional/boot_hidl_hal_test.cpp
+++ b/boot/1.0/vts/functional/boot_hidl_hal_test.cpp
@@ -75,7 +75,7 @@
 TEST_F(BootHidlTest, MarkBootSuccessful) {
   CommandResult cr;
   Return<void> result = boot->markBootSuccessful(generate_callback(&cr));
-  ASSERT_TRUE(result.getStatus().isOk());
+  ASSERT_TRUE(result.isOk());
   if (cr.success) {
     Slot curSlot = boot->getCurrentSlot();
     BoolResult ret = boot->isSlotMarkedSuccessful(curSlot);
@@ -88,14 +88,14 @@
   for (Slot s = 0; s < 2; s++) {
     CommandResult cr;
     Return<void> result = boot->setActiveBootSlot(s, generate_callback(&cr));
-    EXPECT_TRUE(result.getStatus().isOk());
+    EXPECT_TRUE(result.isOk());
   }
   {
     CommandResult cr;
     uint32_t slots = boot->getNumberSlots();
     Return<void> result =
         boot->setActiveBootSlot(slots, generate_callback(&cr));
-    ASSERT_TRUE(result.getStatus().isOk());
+    ASSERT_TRUE(result.isOk());
     EXPECT_EQ(false, cr.success);
   }
 }
@@ -108,7 +108,7 @@
     Slot otherSlot = curSlot ? 0 : 1;
     Return<void> result =
         boot->setSlotAsUnbootable(otherSlot, generate_callback(&cr));
-    EXPECT_TRUE(result.getStatus().isOk());
+    EXPECT_TRUE(result.isOk());
     if (cr.success) {
       EXPECT_EQ(BoolResult::FALSE, boot->isSlotBootable(otherSlot));
       boot->setActiveBootSlot(otherSlot, generate_callback(&cr));
@@ -120,7 +120,7 @@
     uint32_t slots = boot->getNumberSlots();
     Return<void> result =
         boot->setSlotAsUnbootable(slots, generate_callback(&cr));
-    EXPECT_TRUE(result.getStatus().isOk());
+    EXPECT_TRUE(result.isOk());
     EXPECT_EQ(false, cr.success);
   }
 }
@@ -150,7 +150,7 @@
   for (Slot i = 0; i < 2; i++) {
     CommandResult cr;
     Return<void> result = boot->getSuffix(i, cb);
-    EXPECT_TRUE(result.getStatus().isOk());
+    EXPECT_TRUE(result.isOk());
     char correctSuffix[3];
     snprintf(correctSuffix, sizeof(correctSuffix), "_%c", 'a' + i);
     ASSERT_EQ(0, strcmp(suffixPtr, correctSuffix));
@@ -158,7 +158,7 @@
   {
     char emptySuffix[] = "";
     Return<void> result = boot->getSuffix(boot->getNumberSlots(), cb);
-    EXPECT_TRUE(result.getStatus().isOk());
+    EXPECT_TRUE(result.isOk());
     ASSERT_EQ(0, strcmp(emptySuffix, suffixPtr));
   }
 }
diff --git a/broadcastradio/1.0/ITuner.hal b/broadcastradio/1.0/ITuner.hal
index 5e2bffe..ae4b284 100644
--- a/broadcastradio/1.0/ITuner.hal
+++ b/broadcastradio/1.0/ITuner.hal
@@ -103,11 +103,9 @@
 
     /*
      * Retrieve current station information.
-     * @param withMetadata True if Metadata should be returned, false otherwise.
      * @return result OK if scan successfully started
      *                NOT_INITIALIZED if another error occurs
      * @return info Current program information.
      */
-    getProgramInformation(bool withMetadata)
-            generates(Result result, ProgramInfo info);
+    getProgramInformation() generates(Result result, ProgramInfo info);
 };
diff --git a/broadcastradio/1.0/default/Tuner.cpp b/broadcastradio/1.0/default/Tuner.cpp
index 27b298b..de63127 100644
--- a/broadcastradio/1.0/default/Tuner.cpp
+++ b/broadcastradio/1.0/default/Tuner.cpp
@@ -46,7 +46,7 @@
             mCallback->antennaStateChange(halEvent->on);
             break;
         case RADIO_EVENT_TUNED:
-            Utils::convertProgramInfoFromHal(&info, &halEvent->info, true);
+            Utils::convertProgramInfoFromHal(&info, &halEvent->info);
             mCallback->tuneComplete(Utils::convertHalResult(halEvent->status), info);
             break;
         case RADIO_EVENT_METADATA: {
@@ -61,7 +61,7 @@
             mCallback->trafficAnnouncement(halEvent->on);
             break;
         case RADIO_EVENT_AF_SWITCH:
-            Utils::convertProgramInfoFromHal(&info, &halEvent->info, true);
+            Utils::convertProgramInfoFromHal(&info, &halEvent->info);
             mCallback->afSwitch(info);
             break;
         case RADIO_EVENT_EA:
@@ -164,7 +164,7 @@
     return Utils::convertHalResult(rc);
 }
 
-Return<void> Tuner::getProgramInformation(bool withMetadata, getProgramInformation_cb _hidl_cb)  {
+Return<void> Tuner::getProgramInformation(getProgramInformation_cb _hidl_cb)  {
     int rc;
     radio_program_info_t halInfo;
     ProgramInfo info;
@@ -174,18 +174,13 @@
         rc = -ENODEV;
         goto exit;
     }
-    if (withMetadata) {
-        radio_metadata_allocate(&halInfo.metadata, 0, 0);
-    } else {
-        halInfo.metadata = NULL;
-    }
+
+    radio_metadata_allocate(&halInfo.metadata, 0, 0);
     rc = mHalTuner->get_program_information(mHalTuner, &halInfo);
     if (rc == 0) {
-        Utils::convertProgramInfoFromHal(&info, &halInfo, withMetadata);
+        Utils::convertProgramInfoFromHal(&info, &halInfo);
     }
-    if (withMetadata) {
-        radio_metadata_deallocate(halInfo.metadata);
-    }
+    radio_metadata_deallocate(halInfo.metadata);
 
 exit:
     _hidl_cb(Utils::convertHalResult(rc), info);
diff --git a/broadcastradio/1.0/default/Tuner.h b/broadcastradio/1.0/default/Tuner.h
index a621d97..bfdd4f4 100644
--- a/broadcastradio/1.0/default/Tuner.h
+++ b/broadcastradio/1.0/default/Tuner.h
@@ -40,8 +40,7 @@
     Return<Result> step(Direction direction, bool skipSubChannel)  override;
     Return<Result> tune(uint32_t channel, uint32_t subChannel)  override;
     Return<Result> cancel()  override;
-    Return<void> getProgramInformation(bool withMetadata,
-                                       getProgramInformation_cb _hidl_cb)  override;
+    Return<void> getProgramInformation(getProgramInformation_cb _hidl_cb)  override;
 
     static void callback(radio_hal_event_t *halEvent, void *cookie);
            void onCallback(radio_hal_event_t *halEvent);
diff --git a/broadcastradio/1.0/default/Utils.cpp b/broadcastradio/1.0/default/Utils.cpp
index c2c2ff3..aefeeb1 100644
--- a/broadcastradio/1.0/default/Utils.cpp
+++ b/broadcastradio/1.0/default/Utils.cpp
@@ -222,8 +222,7 @@
 
 //static
 void Utils::convertProgramInfoFromHal(ProgramInfo *info,
-                                      radio_program_info_t *halInfo,
-                                      bool withMetadata)
+                                      radio_program_info_t *halInfo)
 {
     info->channel = halInfo->channel;
     info->subChannel = halInfo->sub_channel;
@@ -231,9 +230,7 @@
     info->stereo = halInfo->stereo;
     info->digital = halInfo->digital;
     info->signalStrength = halInfo->signal_strength;
-    if (withMetadata && halInfo->metadata != NULL) {
-        convertMetaDataFromHal(info->metadata, halInfo->metadata);
-    }
+    convertMetaDataFromHal(info->metadata, halInfo->metadata);
 }
 
 //static
@@ -241,6 +238,7 @@
                                    radio_metadata_t *halMetadata)
 {
     if (halMetadata == NULL) {
+        ALOGE("Invalid argument: halMetadata is NULL");
         return 0;
     }
 
diff --git a/broadcastradio/1.0/default/Utils.h b/broadcastradio/1.0/default/Utils.h
index 25eb6ee..4ef22a5 100644
--- a/broadcastradio/1.0/default/Utils.h
+++ b/broadcastradio/1.0/default/Utils.h
@@ -36,8 +36,7 @@
     static void convertBandConfigToHal(radio_hal_band_config_t *halConfig,
             const BandConfig *config);
     static void convertProgramInfoFromHal(ProgramInfo *info,
-                                          radio_program_info_t *halInfo,
-                                          bool withMetadata);
+                                          radio_program_info_t *halInfo);
     static int convertMetaDataFromHal(hidl_vec<MetaData>& metadata,
                                        radio_metadata_t *halMetadata);
 private:
diff --git a/broadcastradio/1.0/vts/functional/broadcastradio_hidl_hal_test.cpp b/broadcastradio/1.0/vts/functional/broadcastradio_hidl_hal_test.cpp
index 6802c3c..bcbfbb7 100644
--- a/broadcastradio/1.0/vts/functional/broadcastradio_hidl_hal_test.cpp
+++ b/broadcastradio/1.0/vts/functional/broadcastradio_hidl_hal_test.cpp
@@ -241,7 +241,7 @@
                         }
                     });
 
-        EXPECT_EQ(Status::EX_NONE, hidlReturn.getStatus().exceptionCode());
+        EXPECT_TRUE(hidlReturn.isOk());
         EXPECT_EQ(Result::OK, halResult);
         EXPECT_EQ(Class::AM_FM, mHalProperties.classId);
         EXPECT_GT(mHalProperties.numTuners, 0u);
@@ -265,7 +265,7 @@
                             mTuner = tuner;
                         }
                     });
-        EXPECT_EQ(Status::EX_NONE, hidlReturn.getStatus().exceptionCode());
+        EXPECT_TRUE(hidlReturn.isOk());
         EXPECT_EQ(Result::OK, halResult);
         EXPECT_EQ(true, waitForCallback(kConfigCallbacktimeoutNs));
     }
@@ -328,7 +328,7 @@
     // test setConfiguration
     mCallbackCalled = false;
     Return<Result> hidlResult = mTuner->setConfiguration(mHalProperties.bands[0]);
-    EXPECT_EQ(Status::EX_NONE, hidlResult.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlResult.isOk());
     EXPECT_EQ(Result::OK, hidlResult);
     EXPECT_EQ(true, waitForCallback(kConfigCallbacktimeoutNs));
     EXPECT_EQ(Result::OK, mResultCallbackData);
@@ -343,7 +343,7 @@
                     halConfig = config;
                 }
             });
-    EXPECT_EQ(Status::EX_NONE, hidlReturn.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlReturn.isOk());
     EXPECT_EQ(Result::OK, halResult);
     EXPECT_EQ(mHalProperties.bands[0].type, halConfig.type);
 }
@@ -362,14 +362,14 @@
     // test scan UP
     mCallbackCalled = false;
     Return<Result> hidlResult = mTuner->scan(Direction::UP, true);
-    EXPECT_EQ(Status::EX_NONE, hidlResult.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlResult.isOk());
     EXPECT_EQ(Result::OK, hidlResult);
     EXPECT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
 
     // test scan DOWN
     mCallbackCalled = false;
     hidlResult = mTuner->scan(Direction::DOWN, true);
-    EXPECT_EQ(Status::EX_NONE, hidlResult.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlResult.isOk());
     EXPECT_EQ(Result::OK, hidlResult);
     EXPECT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
 }
@@ -388,14 +388,14 @@
     // test step UP
     mCallbackCalled = false;
     Return<Result> hidlResult = mTuner->step(Direction::UP, true);
-    EXPECT_EQ(Status::EX_NONE, hidlResult.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlResult.isOk());
     EXPECT_EQ(Result::OK, hidlResult);
     EXPECT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
 
     // test step DOWN
     mCallbackCalled = false;
     hidlResult = mTuner->step(Direction::DOWN, true);
-    EXPECT_EQ(Status::EX_NONE, hidlResult.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlResult.isOk());
     EXPECT_EQ(Result::OK, hidlResult);
     EXPECT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
 }
@@ -426,7 +426,7 @@
     mCallbackCalled = false;
     mResultCallbackData = Result::NOT_INITIALIZED;
     Return<Result> hidlResult = mTuner->tune(channel, 0);
-    EXPECT_EQ(Status::EX_NONE, hidlResult.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlResult.isOk());
     EXPECT_EQ(Result::OK, hidlResult);
     EXPECT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
 
@@ -434,13 +434,13 @@
     ProgramInfo halInfo;
     Result halResult = Result::NOT_INITIALIZED;
     Return<void> hidlReturn = mTuner->getProgramInformation(
-                    false, [&](Result result, const ProgramInfo& info) {
-                                halResult = result;
-                                if (result == Result::OK) {
-                                    halInfo = info;
-                                }
+        [&](Result result, const ProgramInfo& info) {
+            halResult = result;
+            if (result == Result::OK) {
+                halInfo = info;
+            }
         });
-    EXPECT_EQ(Status::EX_NONE, hidlReturn.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlReturn.isOk());
     EXPECT_EQ(Result::OK, halResult);
     if (mResultCallbackData == Result::OK) {
         EXPECT_EQ(true, halInfo.tuned);
@@ -453,7 +453,7 @@
     // test cancel
     mTuner->tune(lowerLimit, 0);
     hidlResult = mTuner->cancel();
-    EXPECT_EQ(Status::EX_NONE, hidlResult.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlResult.isOk());
     EXPECT_EQ(Result::OK, hidlResult);
 }
 
diff --git a/camera/Android.bp b/camera/Android.bp
index a373bf4..e379e49 100644
--- a/camera/Android.bp
+++ b/camera/Android.bp
@@ -1,8 +1,12 @@
 // This is an autogenerated file, do not edit.
 subdirs = [
     "common/1.0",
+    "common/1.0/default",
     "device/1.0",
     "device/3.2",
+    "device/3.2/default",
     "metadata/3.2",
     "provider/2.4",
+    "provider/2.4/default",
+    "provider/2.4/vts/functional",
 ]
diff --git a/camera/common/1.0/default/Android.bp b/camera/common/1.0/default/Android.bp
new file mode 100644
index 0000000..af0ff6e
--- /dev/null
+++ b/camera/common/1.0/default/Android.bp
@@ -0,0 +1,15 @@
+cc_library_static {
+    name: "android.hardware.camera.common@1.0-helper",
+    srcs: ["CameraModule.cpp", "CameraMetadata.cpp", "VendorTagDescriptor.cpp"],
+    cflags: [
+        "-Werror",
+        "-Wextra",
+        "-Wall",
+    ],
+    shared_libs: [
+        "liblog",
+        "libhardware",
+        "libcamera_metadata"],
+    include_dirs: ["system/media/private/camera/include"],
+    export_include_dirs : ["include"]
+}
diff --git a/camera/common/1.0/default/CameraMetadata.cpp b/camera/common/1.0/default/CameraMetadata.cpp
new file mode 100644
index 0000000..44c2040
--- /dev/null
+++ b/camera/common/1.0/default/CameraMetadata.cpp
@@ -0,0 +1,568 @@
+/*
+ * 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.
+ */
+
+// #define LOG_NDEBUG 0
+
+#define LOG_TAG "CamComm1.0-MD"
+#include <utils/Log.h>
+#include <utils/Errors.h>
+
+#include "CameraMetadata.h"
+#include "VendorTagDescriptor.h"
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
+
+#define ALIGN_TO(val, alignment) \
+    (((uintptr_t)(val) + ((alignment) - 1)) & ~((alignment) - 1))
+
+CameraMetadata::CameraMetadata() :
+        mBuffer(NULL), mLocked(false) {
+}
+
+CameraMetadata::CameraMetadata(size_t entryCapacity, size_t dataCapacity) :
+        mLocked(false)
+{
+    mBuffer = allocate_camera_metadata(entryCapacity, dataCapacity);
+}
+
+CameraMetadata::CameraMetadata(const CameraMetadata &other) :
+        mLocked(false) {
+    mBuffer = clone_camera_metadata(other.mBuffer);
+}
+
+CameraMetadata::CameraMetadata(camera_metadata_t *buffer) :
+        mBuffer(NULL), mLocked(false) {
+    acquire(buffer);
+}
+
+CameraMetadata &CameraMetadata::operator=(const CameraMetadata &other) {
+    return operator=(other.mBuffer);
+}
+
+CameraMetadata &CameraMetadata::operator=(const camera_metadata_t *buffer) {
+    if (mLocked) {
+        ALOGE("%s: Assignment to a locked CameraMetadata!", __FUNCTION__);
+        return *this;
+    }
+
+    if (CC_LIKELY(buffer != mBuffer)) {
+        camera_metadata_t *newBuffer = clone_camera_metadata(buffer);
+        clear();
+        mBuffer = newBuffer;
+    }
+    return *this;
+}
+
+CameraMetadata::~CameraMetadata() {
+    mLocked = false;
+    clear();
+}
+
+const camera_metadata_t* CameraMetadata::getAndLock() const {
+    mLocked = true;
+    return mBuffer;
+}
+
+status_t CameraMetadata::unlock(const camera_metadata_t *buffer) const {
+    if (!mLocked) {
+        ALOGE("%s: Can't unlock a non-locked CameraMetadata!", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    if (buffer != mBuffer) {
+        ALOGE("%s: Can't unlock CameraMetadata with wrong pointer!",
+                __FUNCTION__);
+        return BAD_VALUE;
+    }
+    mLocked = false;
+    return OK;
+}
+
+camera_metadata_t* CameraMetadata::release() {
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return NULL;
+    }
+    camera_metadata_t *released = mBuffer;
+    mBuffer = NULL;
+    return released;
+}
+
+void CameraMetadata::clear() {
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return;
+    }
+    if (mBuffer) {
+        free_camera_metadata(mBuffer);
+        mBuffer = NULL;
+    }
+}
+
+void CameraMetadata::acquire(camera_metadata_t *buffer) {
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return;
+    }
+    clear();
+    mBuffer = buffer;
+
+    ALOGE_IF(validate_camera_metadata_structure(mBuffer, /*size*/NULL) != OK,
+             "%s: Failed to validate metadata structure %p",
+             __FUNCTION__, buffer);
+}
+
+void CameraMetadata::acquire(CameraMetadata &other) {
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return;
+    }
+    acquire(other.release());
+}
+
+status_t CameraMetadata::append(const CameraMetadata &other) {
+    return append(other.mBuffer);
+}
+
+status_t CameraMetadata::append(const camera_metadata_t* other) {
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    size_t extraEntries = get_camera_metadata_entry_count(other);
+    size_t extraData = get_camera_metadata_data_count(other);
+    resizeIfNeeded(extraEntries, extraData);
+
+    return append_camera_metadata(mBuffer, other);
+}
+
+size_t CameraMetadata::entryCount() const {
+    return (mBuffer == NULL) ? 0 :
+            get_camera_metadata_entry_count(mBuffer);
+}
+
+bool CameraMetadata::isEmpty() const {
+    return entryCount() == 0;
+}
+
+status_t CameraMetadata::sort() {
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    return sort_camera_metadata(mBuffer);
+}
+
+status_t CameraMetadata::checkType(uint32_t tag, uint8_t expectedType) {
+    int tagType = get_camera_metadata_tag_type(tag);
+    if ( CC_UNLIKELY(tagType == -1)) {
+        ALOGE("Update metadata entry: Unknown tag %d", tag);
+        return INVALID_OPERATION;
+    }
+    if ( CC_UNLIKELY(tagType != expectedType) ) {
+        ALOGE("Mismatched tag type when updating entry %s (%d) of type %s; "
+                "got type %s data instead ",
+                get_camera_metadata_tag_name(tag), tag,
+                camera_metadata_type_names[tagType],
+                camera_metadata_type_names[expectedType]);
+        return INVALID_OPERATION;
+    }
+    return OK;
+}
+
+status_t CameraMetadata::update(uint32_t tag,
+        const int32_t *data, size_t data_count) {
+    status_t res;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    if ( (res = checkType(tag, TYPE_INT32)) != OK) {
+        return res;
+    }
+    return updateImpl(tag, (const void*)data, data_count);
+}
+
+status_t CameraMetadata::update(uint32_t tag,
+        const uint8_t *data, size_t data_count) {
+    status_t res;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    if ( (res = checkType(tag, TYPE_BYTE)) != OK) {
+        return res;
+    }
+    return updateImpl(tag, (const void*)data, data_count);
+}
+
+status_t CameraMetadata::update(uint32_t tag,
+        const float *data, size_t data_count) {
+    status_t res;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    if ( (res = checkType(tag, TYPE_FLOAT)) != OK) {
+        return res;
+    }
+    return updateImpl(tag, (const void*)data, data_count);
+}
+
+status_t CameraMetadata::update(uint32_t tag,
+        const int64_t *data, size_t data_count) {
+    status_t res;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    if ( (res = checkType(tag, TYPE_INT64)) != OK) {
+        return res;
+    }
+    return updateImpl(tag, (const void*)data, data_count);
+}
+
+status_t CameraMetadata::update(uint32_t tag,
+        const double *data, size_t data_count) {
+    status_t res;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    if ( (res = checkType(tag, TYPE_DOUBLE)) != OK) {
+        return res;
+    }
+    return updateImpl(tag, (const void*)data, data_count);
+}
+
+status_t CameraMetadata::update(uint32_t tag,
+        const camera_metadata_rational_t *data, size_t data_count) {
+    status_t res;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    if ( (res = checkType(tag, TYPE_RATIONAL)) != OK) {
+        return res;
+    }
+    return updateImpl(tag, (const void*)data, data_count);
+}
+
+status_t CameraMetadata::update(uint32_t tag,
+        const String8 &string) {
+    status_t res;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    if ( (res = checkType(tag, TYPE_BYTE)) != OK) {
+        return res;
+    }
+    // string.size() doesn't count the null termination character.
+    return updateImpl(tag, (const void*)string.string(), string.size() + 1);
+}
+
+status_t CameraMetadata::update(const camera_metadata_ro_entry &entry) {
+    status_t res;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    if ( (res = checkType(entry.tag, entry.type)) != OK) {
+        return res;
+    }
+    return updateImpl(entry.tag, (const void*)entry.data.u8, entry.count);
+}
+
+status_t CameraMetadata::updateImpl(uint32_t tag, const void *data,
+        size_t data_count) {
+    status_t res;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    int type = get_camera_metadata_tag_type(tag);
+    if (type == -1) {
+        ALOGE("%s: Tag %d not found", __FUNCTION__, tag);
+        return BAD_VALUE;
+    }
+    // Safety check - ensure that data isn't pointing to this metadata, since
+    // that would get invalidated if a resize is needed
+    size_t bufferSize = get_camera_metadata_size(mBuffer);
+    uintptr_t bufAddr = reinterpret_cast<uintptr_t>(mBuffer);
+    uintptr_t dataAddr = reinterpret_cast<uintptr_t>(data);
+    if (dataAddr > bufAddr && dataAddr < (bufAddr + bufferSize)) {
+        ALOGE("%s: Update attempted with data from the same metadata buffer!",
+                __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+
+    size_t data_size = calculate_camera_metadata_entry_data_size(type,
+            data_count);
+
+    res = resizeIfNeeded(1, data_size);
+
+    if (res == OK) {
+        camera_metadata_entry_t entry;
+        res = find_camera_metadata_entry(mBuffer, tag, &entry);
+        if (res == NAME_NOT_FOUND) {
+            res = add_camera_metadata_entry(mBuffer,
+                    tag, data, data_count);
+        } else if (res == OK) {
+            res = update_camera_metadata_entry(mBuffer,
+                    entry.index, data, data_count, NULL);
+        }
+    }
+
+    if (res != OK) {
+        ALOGE("%s: Unable to update metadata entry %s.%s (%x): %s (%d)",
+                __FUNCTION__, get_camera_metadata_section_name(tag),
+                get_camera_metadata_tag_name(tag), tag, strerror(-res), res);
+    }
+
+    IF_ALOGV() {
+        ALOGE_IF(validate_camera_metadata_structure(mBuffer, /*size*/NULL) !=
+                 OK,
+
+                 "%s: Failed to validate metadata structure after update %p",
+                 __FUNCTION__, mBuffer);
+    }
+
+    return res;
+}
+
+bool CameraMetadata::exists(uint32_t tag) const {
+    camera_metadata_ro_entry entry;
+    return find_camera_metadata_ro_entry(mBuffer, tag, &entry) == 0;
+}
+
+camera_metadata_entry_t CameraMetadata::find(uint32_t tag) {
+    status_t res;
+    camera_metadata_entry entry;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        entry.count = 0;
+        return entry;
+    }
+    res = find_camera_metadata_entry(mBuffer, tag, &entry);
+    if (CC_UNLIKELY( res != OK )) {
+        entry.count = 0;
+        entry.data.u8 = NULL;
+    }
+    return entry;
+}
+
+camera_metadata_ro_entry_t CameraMetadata::find(uint32_t tag) const {
+    status_t res;
+    camera_metadata_ro_entry entry;
+    res = find_camera_metadata_ro_entry(mBuffer, tag, &entry);
+    if (CC_UNLIKELY( res != OK )) {
+        entry.count = 0;
+        entry.data.u8 = NULL;
+    }
+    return entry;
+}
+
+status_t CameraMetadata::erase(uint32_t tag) {
+    camera_metadata_entry_t entry;
+    status_t res;
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return INVALID_OPERATION;
+    }
+    res = find_camera_metadata_entry(mBuffer, tag, &entry);
+    if (res == NAME_NOT_FOUND) {
+        return OK;
+    } else if (res != OK) {
+        ALOGE("%s: Error looking for entry %s.%s (%x): %s %d",
+                __FUNCTION__,
+                get_camera_metadata_section_name(tag),
+                get_camera_metadata_tag_name(tag), tag, strerror(-res), res);
+        return res;
+    }
+    res = delete_camera_metadata_entry(mBuffer, entry.index);
+    if (res != OK) {
+        ALOGE("%s: Error deleting entry %s.%s (%x): %s %d",
+                __FUNCTION__,
+                get_camera_metadata_section_name(tag),
+                get_camera_metadata_tag_name(tag), tag, strerror(-res), res);
+    }
+    return res;
+}
+
+void CameraMetadata::dump(int fd, int verbosity, int indentation) const {
+    dump_indented_camera_metadata(mBuffer, fd, verbosity, indentation);
+}
+
+status_t CameraMetadata::resizeIfNeeded(size_t extraEntries, size_t extraData) {
+    if (mBuffer == NULL) {
+        mBuffer = allocate_camera_metadata(extraEntries * 2, extraData * 2);
+        if (mBuffer == NULL) {
+            ALOGE("%s: Can't allocate larger metadata buffer", __FUNCTION__);
+            return NO_MEMORY;
+        }
+    } else {
+        size_t currentEntryCount = get_camera_metadata_entry_count(mBuffer);
+        size_t currentEntryCap = get_camera_metadata_entry_capacity(mBuffer);
+        size_t newEntryCount = currentEntryCount +
+                extraEntries;
+        newEntryCount = (newEntryCount > currentEntryCap) ?
+                newEntryCount * 2 : currentEntryCap;
+
+        size_t currentDataCount = get_camera_metadata_data_count(mBuffer);
+        size_t currentDataCap = get_camera_metadata_data_capacity(mBuffer);
+        size_t newDataCount = currentDataCount +
+                extraData;
+        newDataCount = (newDataCount > currentDataCap) ?
+                newDataCount * 2 : currentDataCap;
+
+        if (newEntryCount > currentEntryCap ||
+                newDataCount > currentDataCap) {
+            camera_metadata_t *oldBuffer = mBuffer;
+            mBuffer = allocate_camera_metadata(newEntryCount,
+                    newDataCount);
+            if (mBuffer == NULL) {
+                ALOGE("%s: Can't allocate larger metadata buffer", __FUNCTION__);
+                return NO_MEMORY;
+            }
+            append_camera_metadata(mBuffer, oldBuffer);
+            free_camera_metadata(oldBuffer);
+        }
+    }
+    return OK;
+}
+
+void CameraMetadata::swap(CameraMetadata& other) {
+    if (mLocked) {
+        ALOGE("%s: CameraMetadata is locked", __FUNCTION__);
+        return;
+    } else if (other.mLocked) {
+        ALOGE("%s: Other CameraMetadata is locked", __FUNCTION__);
+        return;
+    }
+
+    camera_metadata* thisBuf = mBuffer;
+    camera_metadata* otherBuf = other.mBuffer;
+
+    other.mBuffer = thisBuf;
+    mBuffer = otherBuf;
+}
+
+status_t CameraMetadata::getTagFromName(const char *name,
+        const VendorTagDescriptor* vTags, uint32_t *tag) {
+
+    if (name == nullptr || tag == nullptr) return BAD_VALUE;
+
+    size_t nameLength = strlen(name);
+
+    const SortedVector<String8> *vendorSections;
+    size_t vendorSectionCount = 0;
+
+    if (vTags != NULL) {
+        vendorSections = vTags->getAllSectionNames();
+        vendorSectionCount = vendorSections->size();
+    }
+
+    // First, find the section by the longest string match
+    const char *section = NULL;
+    size_t sectionIndex = 0;
+    size_t sectionLength = 0;
+    size_t totalSectionCount = ANDROID_SECTION_COUNT + vendorSectionCount;
+    for (size_t i = 0; i < totalSectionCount; ++i) {
+
+        const char *str = (i < ANDROID_SECTION_COUNT) ? camera_metadata_section_names[i] :
+                (*vendorSections)[i - ANDROID_SECTION_COUNT].string();
+
+        ALOGV("%s: Trying to match against section '%s'", __FUNCTION__, str);
+
+        if (strstr(name, str) == name) { // name begins with the section name
+            size_t strLength = strlen(str);
+
+            ALOGV("%s: Name begins with section name", __FUNCTION__);
+
+            // section name is the longest we've found so far
+            if (section == NULL || sectionLength < strLength) {
+                section = str;
+                sectionIndex = i;
+                sectionLength = strLength;
+
+                ALOGV("%s: Found new best section (%s)", __FUNCTION__, section);
+            }
+        }
+    }
+
+    // TODO: Make above get_camera_metadata_section_from_name ?
+
+    if (section == NULL) {
+        return NAME_NOT_FOUND;
+    } else {
+        ALOGV("%s: Found matched section '%s' (%zu)",
+              __FUNCTION__, section, sectionIndex);
+    }
+
+    // Get the tag name component of the name
+    const char *nameTagName = name + sectionLength + 1; // x.y.z -> z
+    if (sectionLength + 1 >= nameLength) {
+        return BAD_VALUE;
+    }
+
+    // Match rest of name against the tag names in that section only
+    uint32_t candidateTag = 0;
+    if (sectionIndex < ANDROID_SECTION_COUNT) {
+        // Match built-in tags (typically android.*)
+        uint32_t tagBegin, tagEnd; // [tagBegin, tagEnd)
+        tagBegin = camera_metadata_section_bounds[sectionIndex][0];
+        tagEnd = camera_metadata_section_bounds[sectionIndex][1];
+
+        for (candidateTag = tagBegin; candidateTag < tagEnd; ++candidateTag) {
+            const char *tagName = get_camera_metadata_tag_name(candidateTag);
+
+            if (strcmp(nameTagName, tagName) == 0) {
+                ALOGV("%s: Found matched tag '%s' (%d)",
+                      __FUNCTION__, tagName, candidateTag);
+                break;
+            }
+        }
+
+        if (candidateTag == tagEnd) {
+            return NAME_NOT_FOUND;
+        }
+    } else if (vTags != NULL) {
+        // Match vendor tags (typically com.*)
+        const String8 sectionName(section);
+        const String8 tagName(nameTagName);
+
+        status_t res = OK;
+        if ((res = vTags->lookupTag(tagName, sectionName, &candidateTag)) != OK) {
+            return NAME_NOT_FOUND;
+        }
+    }
+
+    *tag = candidateTag;
+    return OK;
+}
+
+
+} // namespace helper
+} // namespace V1_0
+} // namespace common
+} // namespace camera
+} // namespace hardware
+} // namespace android
diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp
new file mode 100644
index 0000000..5d9ae4d
--- /dev/null
+++ b/camera/common/1.0/default/CameraModule.cpp
@@ -0,0 +1,451 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "CamComm1.0-CamModule"
+#define ATRACE_TAG ATRACE_TAG_CAMERA
+//#define LOG_NDEBUG 0
+
+#include <utils/Trace.h>
+
+#include "CameraModule.h"
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
+
+void CameraModule::deriveCameraCharacteristicsKeys(
+        uint32_t deviceVersion, CameraMetadata &chars) {
+    ATRACE_CALL();
+
+    Vector<int32_t> derivedCharKeys;
+    Vector<int32_t> derivedRequestKeys;
+    Vector<int32_t> derivedResultKeys;
+    // Keys added in HAL3.3
+    if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_3) {
+        Vector<uint8_t> controlModes;
+        uint8_t data = ANDROID_CONTROL_AE_LOCK_AVAILABLE_TRUE;
+        chars.update(ANDROID_CONTROL_AE_LOCK_AVAILABLE, &data, /*count*/1);
+        data = ANDROID_CONTROL_AWB_LOCK_AVAILABLE_TRUE;
+        chars.update(ANDROID_CONTROL_AWB_LOCK_AVAILABLE, &data, /*count*/1);
+        controlModes.push(ANDROID_CONTROL_MODE_AUTO);
+        camera_metadata_entry entry = chars.find(ANDROID_CONTROL_AVAILABLE_SCENE_MODES);
+        if (entry.count > 1 || entry.data.u8[0] != ANDROID_CONTROL_SCENE_MODE_DISABLED) {
+            controlModes.push(ANDROID_CONTROL_MODE_USE_SCENE_MODE);
+        }
+
+        // Only advertise CONTROL_OFF mode if 3A manual controls are supported.
+        bool isManualAeSupported = false;
+        bool isManualAfSupported = false;
+        bool isManualAwbSupported = false;
+        entry = chars.find(ANDROID_CONTROL_AE_AVAILABLE_MODES);
+        if (entry.count > 0) {
+            for (size_t i = 0; i < entry.count; i++) {
+                if (entry.data.u8[i] == ANDROID_CONTROL_AE_MODE_OFF) {
+                    isManualAeSupported = true;
+                    break;
+                }
+            }
+        }
+        entry = chars.find(ANDROID_CONTROL_AF_AVAILABLE_MODES);
+        if (entry.count > 0) {
+            for (size_t i = 0; i < entry.count; i++) {
+                if (entry.data.u8[i] == ANDROID_CONTROL_AF_MODE_OFF) {
+                    isManualAfSupported = true;
+                    break;
+                }
+            }
+        }
+        entry = chars.find(ANDROID_CONTROL_AWB_AVAILABLE_MODES);
+        if (entry.count > 0) {
+            for (size_t i = 0; i < entry.count; i++) {
+                if (entry.data.u8[i] == ANDROID_CONTROL_AWB_MODE_OFF) {
+                    isManualAwbSupported = true;
+                    break;
+                }
+            }
+        }
+        if (isManualAeSupported && isManualAfSupported && isManualAwbSupported) {
+            controlModes.push(ANDROID_CONTROL_MODE_OFF);
+        }
+
+        chars.update(ANDROID_CONTROL_AVAILABLE_MODES, controlModes);
+
+        entry = chars.find(ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS);
+        // HAL3.2 devices passing existing CTS test should all support all LSC modes and LSC map
+        bool lensShadingModeSupported = false;
+        if (entry.count > 0) {
+            for (size_t i = 0; i < entry.count; i++) {
+                if (entry.data.i32[i] == ANDROID_SHADING_MODE) {
+                    lensShadingModeSupported = true;
+                    break;
+                }
+            }
+        }
+        Vector<uint8_t> lscModes;
+        Vector<uint8_t> lscMapModes;
+        lscModes.push(ANDROID_SHADING_MODE_FAST);
+        lscModes.push(ANDROID_SHADING_MODE_HIGH_QUALITY);
+        lscMapModes.push(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF);
+        if (lensShadingModeSupported) {
+            lscModes.push(ANDROID_SHADING_MODE_OFF);
+            lscMapModes.push(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_ON);
+        }
+        chars.update(ANDROID_SHADING_AVAILABLE_MODES, lscModes);
+        chars.update(ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES, lscMapModes);
+
+        derivedCharKeys.push(ANDROID_CONTROL_AE_LOCK_AVAILABLE);
+        derivedCharKeys.push(ANDROID_CONTROL_AWB_LOCK_AVAILABLE);
+        derivedCharKeys.push(ANDROID_CONTROL_AVAILABLE_MODES);
+        derivedCharKeys.push(ANDROID_SHADING_AVAILABLE_MODES);
+        derivedCharKeys.push(ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES);
+
+        // Need update android.control.availableHighSpeedVideoConfigurations since HAL3.3
+        // adds batch size to this array.
+        entry = chars.find(ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS);
+        if (entry.count > 0) {
+            Vector<int32_t> highSpeedConfig;
+            for (size_t i = 0; i < entry.count; i += 4) {
+                highSpeedConfig.add(entry.data.i32[i]); // width
+                highSpeedConfig.add(entry.data.i32[i + 1]); // height
+                highSpeedConfig.add(entry.data.i32[i + 2]); // fps_min
+                highSpeedConfig.add(entry.data.i32[i + 3]); // fps_max
+                highSpeedConfig.add(1); // batchSize_max. default to 1 for HAL3.2
+            }
+            chars.update(ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS,
+                    highSpeedConfig);
+        }
+    }
+
+    // Keys added in HAL3.4
+    if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_4) {
+        // Check if HAL supports RAW_OPAQUE output
+        camera_metadata_entry entry = chars.find(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS);
+        bool supportRawOpaque = false;
+        bool supportAnyRaw = false;
+        const int STREAM_CONFIGURATION_SIZE = 4;
+        const int STREAM_FORMAT_OFFSET = 0;
+        const int STREAM_WIDTH_OFFSET = 1;
+        const int STREAM_HEIGHT_OFFSET = 2;
+        const int STREAM_IS_INPUT_OFFSET = 3;
+        Vector<int32_t> rawOpaqueSizes;
+
+        for (size_t i=0; i < entry.count; i += STREAM_CONFIGURATION_SIZE) {
+            int32_t format = entry.data.i32[i + STREAM_FORMAT_OFFSET];
+            int32_t width = entry.data.i32[i + STREAM_WIDTH_OFFSET];
+            int32_t height = entry.data.i32[i + STREAM_HEIGHT_OFFSET];
+            int32_t isInput = entry.data.i32[i + STREAM_IS_INPUT_OFFSET];
+            if (isInput == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
+                    format == HAL_PIXEL_FORMAT_RAW_OPAQUE) {
+                supportRawOpaque = true;
+                rawOpaqueSizes.push(width);
+                rawOpaqueSizes.push(height);
+                // 2 bytes per pixel. This rough estimation is only used when
+                // HAL does not fill in the opaque raw size
+                rawOpaqueSizes.push(width * height *2);
+            }
+            if (isInput == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
+                    (format == HAL_PIXEL_FORMAT_RAW16 ||
+                     format == HAL_PIXEL_FORMAT_RAW10 ||
+                     format == HAL_PIXEL_FORMAT_RAW12 ||
+                     format == HAL_PIXEL_FORMAT_RAW_OPAQUE)) {
+                supportAnyRaw = true;
+            }
+        }
+
+        if (supportRawOpaque) {
+            entry = chars.find(ANDROID_SENSOR_OPAQUE_RAW_SIZE);
+            if (entry.count == 0) {
+                // Fill in estimated value if HAL does not list it
+                chars.update(ANDROID_SENSOR_OPAQUE_RAW_SIZE, rawOpaqueSizes);
+                derivedCharKeys.push(ANDROID_SENSOR_OPAQUE_RAW_SIZE);
+            }
+        }
+
+        // Check if HAL supports any RAW output, if so, fill in postRawSensitivityBoost range
+        if (supportAnyRaw) {
+            int32_t defaultRange[2] = {100, 100};
+            entry = chars.find(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE);
+            if (entry.count == 0) {
+                // Fill in default value (100, 100)
+                chars.update(
+                        ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE,
+                        defaultRange, 2);
+                derivedCharKeys.push(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE);
+                // Actual request/results will be derived by camera device.
+                derivedRequestKeys.push(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST);
+                derivedResultKeys.push(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST);
+            }
+        }
+    }
+
+    // Always add a default for the pre-correction active array if the vendor chooses to omit this
+    camera_metadata_entry entry = chars.find(ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE);
+    if (entry.count == 0) {
+        Vector<int32_t> preCorrectionArray;
+        entry = chars.find(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE);
+        preCorrectionArray.appendArray(entry.data.i32, entry.count);
+        chars.update(ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE, preCorrectionArray);
+        derivedCharKeys.push(ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE);
+    }
+
+    // Add those newly added keys to AVAILABLE_CHARACTERISTICS_KEYS
+    // This has to be done at this end of this function.
+    if (derivedCharKeys.size() > 0) {
+        appendAvailableKeys(
+                chars, ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, derivedCharKeys);
+    }
+    if (derivedRequestKeys.size() > 0) {
+        appendAvailableKeys(
+                chars, ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, derivedRequestKeys);
+    }
+    if (derivedResultKeys.size() > 0) {
+        appendAvailableKeys(
+                chars, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, derivedResultKeys);
+    }
+    return;
+}
+
+void CameraModule::appendAvailableKeys(CameraMetadata &chars,
+        int32_t keyTag, const Vector<int32_t>& appendKeys) {
+    camera_metadata_entry entry = chars.find(keyTag);
+    Vector<int32_t> availableKeys;
+    availableKeys.setCapacity(entry.count + appendKeys.size());
+    for (size_t i = 0; i < entry.count; i++) {
+        availableKeys.push(entry.data.i32[i]);
+    }
+    for (size_t i = 0; i < appendKeys.size(); i++) {
+        availableKeys.push(appendKeys[i]);
+    }
+    chars.update(keyTag, availableKeys);
+}
+
+CameraModule::CameraModule(camera_module_t *module) {
+    if (module == NULL) {
+        ALOGE("%s: camera hardware module must not be null", __FUNCTION__);
+        assert(0);
+    }
+    mModule = module;
+}
+
+CameraModule::~CameraModule()
+{
+    while (mCameraInfoMap.size() > 0) {
+        camera_info cameraInfo = mCameraInfoMap.editValueAt(0);
+        if (cameraInfo.static_camera_characteristics != NULL) {
+            free_camera_metadata(
+                    const_cast<camera_metadata_t*>(cameraInfo.static_camera_characteristics));
+        }
+        mCameraInfoMap.removeItemsAt(0);
+    }
+}
+
+int CameraModule::init() {
+    ATRACE_CALL();
+    int res = OK;
+    if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4 &&
+            mModule->init != NULL) {
+        ATRACE_BEGIN("camera_module->init");
+        res = mModule->init();
+        ATRACE_END();
+    }
+    mCameraInfoMap.setCapacity(getNumberOfCameras());
+    return res;
+}
+
+int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) {
+    ATRACE_CALL();
+    Mutex::Autolock lock(mCameraInfoLock);
+    if (cameraId < 0) {
+        ALOGE("%s: Invalid camera ID %d", __FUNCTION__, cameraId);
+        return -EINVAL;
+    }
+
+    // Only override static_camera_characteristics for API2 devices
+    int apiVersion = mModule->common.module_api_version;
+    if (apiVersion < CAMERA_MODULE_API_VERSION_2_0) {
+        int ret;
+        ATRACE_BEGIN("camera_module->get_camera_info");
+        ret = mModule->get_camera_info(cameraId, info);
+        // Fill in this so CameraService won't be confused by
+        // possibly 0 device_version
+        info->device_version = CAMERA_DEVICE_API_VERSION_1_0;
+        ATRACE_END();
+        return ret;
+    }
+
+    ssize_t index = mCameraInfoMap.indexOfKey(cameraId);
+    if (index == NAME_NOT_FOUND) {
+        // Get camera info from raw module and cache it
+        camera_info rawInfo, cameraInfo;
+        ATRACE_BEGIN("camera_module->get_camera_info");
+        int ret = mModule->get_camera_info(cameraId, &rawInfo);
+        ATRACE_END();
+        if (ret != 0) {
+            return ret;
+        }
+        int deviceVersion = rawInfo.device_version;
+        if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_0) {
+            // static_camera_characteristics is invalid
+            *info = rawInfo;
+            return ret;
+        }
+        CameraMetadata m;
+        m = rawInfo.static_camera_characteristics;
+        deriveCameraCharacteristicsKeys(rawInfo.device_version, m);
+        cameraInfo = rawInfo;
+        cameraInfo.static_camera_characteristics = m.release();
+        index = mCameraInfoMap.add(cameraId, cameraInfo);
+    }
+
+    assert(index != NAME_NOT_FOUND);
+    // return the cached camera info
+    *info = mCameraInfoMap[index];
+    return OK;
+}
+
+int CameraModule::getDeviceVersion(int cameraId) {
+    ssize_t index = mDeviceVersionMap.indexOfKey(cameraId);
+    if (index == NAME_NOT_FOUND) {
+        int deviceVersion;
+        if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_0) {
+            struct camera_info info;
+            getCameraInfo(cameraId, &info);
+            deviceVersion = info.device_version;
+        } else {
+            deviceVersion = CAMERA_DEVICE_API_VERSION_1_0;
+        }
+        index = mDeviceVersionMap.add(cameraId, deviceVersion);
+    }
+    assert(index != NAME_NOT_FOUND);
+    return mDeviceVersionMap[index];
+}
+
+int CameraModule::open(const char* id, struct hw_device_t** device) {
+    int res;
+    ATRACE_BEGIN("camera_module->open");
+    res = filterOpenErrorCode(mModule->common.methods->open(&mModule->common, id, device));
+    ATRACE_END();
+    return res;
+}
+
+bool CameraModule::isOpenLegacyDefined() const {
+    if (getModuleApiVersion() < CAMERA_MODULE_API_VERSION_2_3) {
+        return false;
+    }
+    return mModule->open_legacy != NULL;
+}
+
+int CameraModule::openLegacy(
+        const char* id, uint32_t halVersion, struct hw_device_t** device) {
+    int res;
+    ATRACE_BEGIN("camera_module->open_legacy");
+    res = mModule->open_legacy(&mModule->common, id, halVersion, device);
+    ATRACE_END();
+    return res;
+}
+
+int CameraModule::getNumberOfCameras() {
+    int numCameras;
+    ATRACE_BEGIN("camera_module->get_number_of_cameras");
+    numCameras = mModule->get_number_of_cameras();
+    ATRACE_END();
+    return numCameras;
+}
+
+int CameraModule::setCallbacks(const camera_module_callbacks_t *callbacks) {
+    int res;
+    ATRACE_BEGIN("camera_module->set_callbacks");
+    res = mModule->set_callbacks(callbacks);
+    ATRACE_END();
+    return res;
+}
+
+bool CameraModule::isVendorTagDefined() const {
+    return mModule->get_vendor_tag_ops != NULL;
+}
+
+void CameraModule::getVendorTagOps(vendor_tag_ops_t* ops) {
+    if (mModule->get_vendor_tag_ops) {
+        ATRACE_BEGIN("camera_module->get_vendor_tag_ops");
+        mModule->get_vendor_tag_ops(ops);
+        ATRACE_END();
+    }
+}
+
+bool CameraModule::isSetTorchModeSupported() const {
+    if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4) {
+        if (mModule->set_torch_mode == NULL) {
+            ALOGE("%s: Module 2.4 device must support set torch API!",
+                    __FUNCTION__);
+            return false;
+        }
+        return true;
+    }
+    return false;
+}
+
+int CameraModule::setTorchMode(const char* camera_id, bool enable) {
+    int res = INVALID_OPERATION;
+    if (mModule->set_torch_mode != NULL) {
+        ATRACE_BEGIN("camera_module->set_torch_mode");
+        res = mModule->set_torch_mode(camera_id, enable);
+        ATRACE_END();
+    }
+    return res;
+}
+
+status_t CameraModule::filterOpenErrorCode(status_t err) {
+    switch(err) {
+        case NO_ERROR:
+        case -EBUSY:
+        case -EINVAL:
+        case -EUSERS:
+            return err;
+        default:
+            break;
+    }
+    return -ENODEV;
+}
+
+uint16_t CameraModule::getModuleApiVersion() const {
+    return mModule->common.module_api_version;
+}
+
+const char* CameraModule::getModuleName() const {
+    return mModule->common.name;
+}
+
+uint16_t CameraModule::getHalApiVersion() const {
+    return mModule->common.hal_api_version;
+}
+
+const char* CameraModule::getModuleAuthor() const {
+    return mModule->common.author;
+}
+
+void* CameraModule::getDso() {
+    return mModule->common.dso;
+}
+
+} // namespace helper
+} // namespace V1_0
+} // namespace common
+} // namespace camera
+} // namespace hardware
+} // namespace android
diff --git a/camera/common/1.0/default/VendorTagDescriptor.cpp b/camera/common/1.0/default/VendorTagDescriptor.cpp
new file mode 100644
index 0000000..db884a8
--- /dev/null
+++ b/camera/common/1.0/default/VendorTagDescriptor.cpp
@@ -0,0 +1,367 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "CamComm1.0-VTDesc"
+
+#include <utils/Errors.h>
+#include <utils/Log.h>
+#include <utils/Mutex.h>
+#include <utils/Vector.h>
+#include <utils/SortedVector.h>
+#include <system/camera_metadata.h>
+#include <camera_metadata_hidden.h>
+
+#include "VendorTagDescriptor.h"
+
+#include <stdio.h>
+#include <string.h>
+
+namespace android {
+namespace hardware {
+namespace camera2 {
+namespace params {
+
+VendorTagDescriptor::~VendorTagDescriptor() {
+    size_t len = mReverseMapping.size();
+    for (size_t i = 0; i < len; ++i)  {
+        delete mReverseMapping[i];
+    }
+}
+
+VendorTagDescriptor::VendorTagDescriptor() :
+        mTagCount(0),
+        mVendorOps() {
+}
+
+VendorTagDescriptor::VendorTagDescriptor(const VendorTagDescriptor& src) {
+    copyFrom(src);
+}
+
+VendorTagDescriptor& VendorTagDescriptor::operator=(const VendorTagDescriptor& rhs) {
+    copyFrom(rhs);
+    return *this;
+}
+
+void VendorTagDescriptor::copyFrom(const VendorTagDescriptor& src) {
+    if (this == &src) return;
+
+    size_t len = mReverseMapping.size();
+    for (size_t i = 0; i < len; ++i) {
+        delete mReverseMapping[i];
+    }
+    mReverseMapping.clear();
+
+    len = src.mReverseMapping.size();
+    // Have to copy KeyedVectors inside mReverseMapping
+    for (size_t i = 0; i < len; ++i) {
+        KeyedVector<String8, uint32_t>* nameMapper = new KeyedVector<String8, uint32_t>();
+        *nameMapper = *(src.mReverseMapping.valueAt(i));
+        mReverseMapping.add(src.mReverseMapping.keyAt(i), nameMapper);
+    }
+    // Everything else is simple
+    mTagToNameMap = src.mTagToNameMap;
+    mTagToSectionMap = src.mTagToSectionMap;
+    mTagToTypeMap = src.mTagToTypeMap;
+    mSections = src.mSections;
+    mTagCount = src.mTagCount;
+    mVendorOps = src.mVendorOps;
+}
+
+int VendorTagDescriptor::getTagCount() const {
+    size_t size = mTagToNameMap.size();
+    if (size == 0) {
+        return VENDOR_TAG_COUNT_ERR;
+    }
+    return size;
+}
+
+void VendorTagDescriptor::getTagArray(uint32_t* tagArray) const {
+    size_t size = mTagToNameMap.size();
+    for (size_t i = 0; i < size; ++i) {
+        tagArray[i] = mTagToNameMap.keyAt(i);
+    }
+}
+
+const char* VendorTagDescriptor::getSectionName(uint32_t tag) const {
+    ssize_t index = mTagToSectionMap.indexOfKey(tag);
+    if (index < 0) {
+        return VENDOR_SECTION_NAME_ERR;
+    }
+    return mSections[mTagToSectionMap.valueAt(index)].string();
+}
+
+ssize_t VendorTagDescriptor::getSectionIndex(uint32_t tag) const {
+    return mTagToSectionMap.valueFor(tag);
+}
+
+const char* VendorTagDescriptor::getTagName(uint32_t tag) const {
+    ssize_t index = mTagToNameMap.indexOfKey(tag);
+    if (index < 0) {
+        return VENDOR_TAG_NAME_ERR;
+    }
+    return mTagToNameMap.valueAt(index).string();
+}
+
+int VendorTagDescriptor::getTagType(uint32_t tag) const {
+    ssize_t index = mTagToNameMap.indexOfKey(tag);
+    if (index < 0) {
+        return VENDOR_TAG_TYPE_ERR;
+    }
+    return mTagToTypeMap.valueFor(tag);
+}
+
+const SortedVector<String8>* VendorTagDescriptor::getAllSectionNames() const {
+    return &mSections;
+}
+
+status_t VendorTagDescriptor::lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const {
+    ssize_t index = mReverseMapping.indexOfKey(section);
+    if (index < 0) {
+        ALOGE("%s: Section '%s' does not exist.", __FUNCTION__, section.string());
+        return BAD_VALUE;
+    }
+
+    ssize_t nameIndex = mReverseMapping[index]->indexOfKey(name);
+    if (nameIndex < 0) {
+        ALOGE("%s: Tag name '%s' does not exist.", __FUNCTION__, name.string());
+        return BAD_VALUE;
+    }
+
+    if (tag != NULL) {
+        *tag = mReverseMapping[index]->valueAt(nameIndex);
+    }
+    return OK;
+}
+
+void VendorTagDescriptor::dump(int fd, int verbosity, int indentation) const {
+
+    size_t size = mTagToNameMap.size();
+    if (size == 0) {
+        dprintf(fd, "%*sDumping configured vendor tag descriptors: None set\n",
+                indentation, "");
+        return;
+    }
+
+    dprintf(fd, "%*sDumping configured vendor tag descriptors: %zu entries\n",
+            indentation, "", size);
+    for (size_t i = 0; i < size; ++i) {
+        uint32_t tag =  mTagToNameMap.keyAt(i);
+
+        if (verbosity < 1) {
+            dprintf(fd, "%*s0x%x\n", indentation + 2, "", tag);
+            continue;
+        }
+        String8 name = mTagToNameMap.valueAt(i);
+        uint32_t sectionId = mTagToSectionMap.valueFor(tag);
+        String8 sectionName = mSections[sectionId];
+        int type = mTagToTypeMap.valueFor(tag);
+        const char* typeName = (type >= 0 && type < NUM_TYPES) ?
+                camera_metadata_type_names[type] : "UNKNOWN";
+        dprintf(fd, "%*s0x%x (%s) with type %d (%s) defined in section %s\n", indentation + 2,
+            "", tag, name.string(), type, typeName, sectionName.string());
+    }
+
+}
+
+} // namespace params
+} // namespace camera2
+
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
+
+extern "C" {
+
+static int vendor_tag_descriptor_get_tag_count(const vendor_tag_ops_t* v);
+static void vendor_tag_descriptor_get_all_tags(const vendor_tag_ops_t* v, uint32_t* tagArray);
+static const char* vendor_tag_descriptor_get_section_name(const vendor_tag_ops_t* v, uint32_t tag);
+static const char* vendor_tag_descriptor_get_tag_name(const vendor_tag_ops_t* v, uint32_t tag);
+static int vendor_tag_descriptor_get_tag_type(const vendor_tag_ops_t* v, uint32_t tag);
+
+} /* extern "C" */
+
+static Mutex sLock;
+static sp<VendorTagDescriptor> sGlobalVendorTagDescriptor;
+
+status_t VendorTagDescriptor::createDescriptorFromOps(const vendor_tag_ops_t* vOps,
+            /*out*/
+            sp<VendorTagDescriptor>& descriptor) {
+    if (vOps == NULL) {
+        ALOGE("%s: vendor_tag_ops argument was NULL.", __FUNCTION__);
+        return BAD_VALUE;
+    }
+
+    int tagCount = vOps->get_tag_count(vOps);
+    if (tagCount < 0 || tagCount > INT32_MAX) {
+        ALOGE("%s: tag count %d from vendor ops is invalid.", __FUNCTION__, tagCount);
+        return BAD_VALUE;
+    }
+
+    Vector<uint32_t> tagArray;
+    LOG_ALWAYS_FATAL_IF(tagArray.resize(tagCount) != tagCount,
+            "%s: too many (%u) vendor tags defined.", __FUNCTION__, tagCount);
+
+    vOps->get_all_tags(vOps, /*out*/tagArray.editArray());
+
+    sp<VendorTagDescriptor> desc = new VendorTagDescriptor();
+    desc->mTagCount = tagCount;
+
+    SortedVector<String8> sections;
+    KeyedVector<uint32_t, String8> tagToSectionMap;
+
+    for (size_t i = 0; i < static_cast<size_t>(tagCount); ++i) {
+        uint32_t tag = tagArray[i];
+        if (tag < CAMERA_METADATA_VENDOR_TAG_BOUNDARY) {
+            ALOGE("%s: vendor tag %d not in vendor tag section.", __FUNCTION__, tag);
+            return BAD_VALUE;
+        }
+        const char *tagName = vOps->get_tag_name(vOps, tag);
+        if (tagName == NULL) {
+            ALOGE("%s: no tag name defined for vendor tag %d.", __FUNCTION__, tag);
+            return BAD_VALUE;
+        }
+        desc->mTagToNameMap.add(tag, String8(tagName));
+        const char *sectionName = vOps->get_section_name(vOps, tag);
+        if (sectionName == NULL) {
+            ALOGE("%s: no section name defined for vendor tag %d.", __FUNCTION__, tag);
+            return BAD_VALUE;
+        }
+
+        String8 sectionString(sectionName);
+
+        sections.add(sectionString);
+        tagToSectionMap.add(tag, sectionString);
+
+        int tagType = vOps->get_tag_type(vOps, tag);
+        if (tagType < 0 || tagType >= NUM_TYPES) {
+            ALOGE("%s: tag type %d from vendor ops does not exist.", __FUNCTION__, tagType);
+            return BAD_VALUE;
+        }
+        desc->mTagToTypeMap.add(tag, tagType);
+    }
+
+    desc->mSections = sections;
+
+    for (size_t i = 0; i < static_cast<size_t>(tagCount); ++i) {
+        uint32_t tag = tagArray[i];
+        String8 sectionString = tagToSectionMap.valueFor(tag);
+
+        // Set up tag to section index map
+        ssize_t index = sections.indexOf(sectionString);
+        LOG_ALWAYS_FATAL_IF(index < 0, "index %zd must be non-negative", index);
+        desc->mTagToSectionMap.add(tag, static_cast<uint32_t>(index));
+
+        // Set up reverse mapping
+        ssize_t reverseIndex = -1;
+        if ((reverseIndex = desc->mReverseMapping.indexOfKey(sectionString)) < 0) {
+            KeyedVector<String8, uint32_t>* nameMapper = new KeyedVector<String8, uint32_t>();
+            reverseIndex = desc->mReverseMapping.add(sectionString, nameMapper);
+        }
+        desc->mReverseMapping[reverseIndex]->add(desc->mTagToNameMap.valueFor(tag), tag);
+    }
+
+    descriptor = desc;
+    return OK;
+}
+
+status_t VendorTagDescriptor::setAsGlobalVendorTagDescriptor(const sp<VendorTagDescriptor>& desc) {
+    status_t res = OK;
+    Mutex::Autolock al(sLock);
+    sGlobalVendorTagDescriptor = desc;
+
+    vendor_tag_ops_t* opsPtr = NULL;
+    if (desc != NULL) {
+        opsPtr = &(desc->mVendorOps);
+        opsPtr->get_tag_count = vendor_tag_descriptor_get_tag_count;
+        opsPtr->get_all_tags = vendor_tag_descriptor_get_all_tags;
+        opsPtr->get_section_name = vendor_tag_descriptor_get_section_name;
+        opsPtr->get_tag_name = vendor_tag_descriptor_get_tag_name;
+        opsPtr->get_tag_type = vendor_tag_descriptor_get_tag_type;
+    }
+    if((res = set_camera_metadata_vendor_ops(opsPtr)) != OK) {
+        ALOGE("%s: Could not set vendor tag descriptor, received error %s (%d)."
+                , __FUNCTION__, strerror(-res), res);
+    }
+    return res;
+}
+
+void VendorTagDescriptor::clearGlobalVendorTagDescriptor() {
+    Mutex::Autolock al(sLock);
+    set_camera_metadata_vendor_ops(NULL);
+    sGlobalVendorTagDescriptor.clear();
+}
+
+sp<VendorTagDescriptor> VendorTagDescriptor::getGlobalVendorTagDescriptor() {
+    Mutex::Autolock al(sLock);
+    return sGlobalVendorTagDescriptor;
+}
+
+extern "C" {
+
+int vendor_tag_descriptor_get_tag_count(const vendor_tag_ops_t* /*v*/) {
+    Mutex::Autolock al(sLock);
+    if (sGlobalVendorTagDescriptor == NULL) {
+        ALOGE("%s: Vendor tag descriptor not initialized.", __FUNCTION__);
+        return VENDOR_TAG_COUNT_ERR;
+    }
+    return sGlobalVendorTagDescriptor->getTagCount();
+}
+
+void vendor_tag_descriptor_get_all_tags(const vendor_tag_ops_t* /*v*/, uint32_t* tagArray) {
+    Mutex::Autolock al(sLock);
+    if (sGlobalVendorTagDescriptor == NULL) {
+        ALOGE("%s: Vendor tag descriptor not initialized.", __FUNCTION__);
+        return;
+    }
+    sGlobalVendorTagDescriptor->getTagArray(tagArray);
+}
+
+const char* vendor_tag_descriptor_get_section_name(const vendor_tag_ops_t* /*v*/, uint32_t tag) {
+    Mutex::Autolock al(sLock);
+    if (sGlobalVendorTagDescriptor == NULL) {
+        ALOGE("%s: Vendor tag descriptor not initialized.", __FUNCTION__);
+        return VENDOR_SECTION_NAME_ERR;
+    }
+    return sGlobalVendorTagDescriptor->getSectionName(tag);
+}
+
+const char* vendor_tag_descriptor_get_tag_name(const vendor_tag_ops_t* /*v*/, uint32_t tag) {
+    Mutex::Autolock al(sLock);
+    if (sGlobalVendorTagDescriptor == NULL) {
+        ALOGE("%s: Vendor tag descriptor not initialized.", __FUNCTION__);
+        return VENDOR_TAG_NAME_ERR;
+    }
+    return sGlobalVendorTagDescriptor->getTagName(tag);
+}
+
+int vendor_tag_descriptor_get_tag_type(const vendor_tag_ops_t* /*v*/, uint32_t tag) {
+    Mutex::Autolock al(sLock);
+    if (sGlobalVendorTagDescriptor == NULL) {
+        ALOGE("%s: Vendor tag descriptor not initialized.", __FUNCTION__);
+        return VENDOR_TAG_TYPE_ERR;
+    }
+    return sGlobalVendorTagDescriptor->getTagType(tag);
+}
+
+} /* extern "C" */
+
+} // namespace helper
+} // namespace V1_0
+} // namespace common
+} // namespace camera
+} // namespace hardware
+} // namespace android
diff --git a/camera/common/1.0/default/include/CameraMetadata.h b/camera/common/1.0/default/include/CameraMetadata.h
new file mode 100644
index 0000000..d5e4d56
--- /dev/null
+++ b/camera/common/1.0/default/include/CameraMetadata.h
@@ -0,0 +1,230 @@
+/*
+ * 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.
+ */
+
+#ifndef CAMERA_COMMON_1_0_CAMERAMETADATA_H
+#define CAMERA_COMMON_1_0_CAMERAMETADATA_H
+
+#include "system/camera_metadata.h"
+
+#include <utils/String8.h>
+#include <utils/Vector.h>
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
+
+class VendorTagDescriptor;
+
+/**
+ * A convenience wrapper around the C-based camera_metadata_t library.
+ */
+class CameraMetadata {
+  public:
+    /** Creates an empty object; best used when expecting to acquire contents
+     * from elsewhere */
+    CameraMetadata();
+    /** Creates an object with space for entryCapacity entries, with
+     * dataCapacity extra storage */
+    CameraMetadata(size_t entryCapacity, size_t dataCapacity = 10);
+
+    ~CameraMetadata();
+
+    /** Takes ownership of passed-in buffer */
+    CameraMetadata(camera_metadata_t *buffer);
+    /** Clones the metadata */
+    CameraMetadata(const CameraMetadata &other);
+
+    /**
+     * Assignment clones metadata buffer.
+     */
+    CameraMetadata &operator=(const CameraMetadata &other);
+    CameraMetadata &operator=(const camera_metadata_t *buffer);
+
+    /**
+     * Get reference to the underlying metadata buffer. Ownership remains with
+     * the CameraMetadata object, but non-const CameraMetadata methods will not
+     * work until unlock() is called. Note that the lock has nothing to do with
+     * thread-safety, it simply prevents the camera_metadata_t pointer returned
+     * here from being accidentally invalidated by CameraMetadata operations.
+     */
+    const camera_metadata_t* getAndLock() const;
+
+    /**
+     * Unlock the CameraMetadata for use again. After this unlock, the pointer
+     * given from getAndLock() may no longer be used. The pointer passed out
+     * from getAndLock must be provided to guarantee that the right object is
+     * being unlocked.
+     */
+    status_t unlock(const camera_metadata_t *buffer) const;
+
+    /**
+     * Release a raw metadata buffer to the caller. After this call,
+     * CameraMetadata no longer references the buffer, and the caller takes
+     * responsibility for freeing the raw metadata buffer (using
+     * free_camera_metadata()), or for handing it to another CameraMetadata
+     * instance.
+     */
+    camera_metadata_t* release();
+
+    /**
+     * Clear the metadata buffer and free all storage used by it
+     */
+    void clear();
+
+    /**
+     * Acquire a raw metadata buffer from the caller. After this call,
+     * the caller no longer owns the raw buffer, and must not free or manipulate it.
+     * If CameraMetadata already contains metadata, it is freed.
+     */
+    void acquire(camera_metadata_t* buffer);
+
+    /**
+     * Acquires raw buffer from other CameraMetadata object. After the call, the argument
+     * object no longer has any metadata.
+     */
+    void acquire(CameraMetadata &other);
+
+    /**
+     * Append metadata from another CameraMetadata object.
+     */
+    status_t append(const CameraMetadata &other);
+
+    /**
+     * Append metadata from a raw camera_metadata buffer
+     */
+    status_t append(const camera_metadata* other);
+
+    /**
+     * Number of metadata entries.
+     */
+    size_t entryCount() const;
+
+    /**
+     * Is the buffer empty (no entires)
+     */
+    bool isEmpty() const;
+
+    /**
+     * Sort metadata buffer for faster find
+     */
+    status_t sort();
+
+    /**
+     * Update metadata entry. Will create entry if it doesn't exist already, and
+     * will reallocate the buffer if insufficient space exists. Overloaded for
+     * the various types of valid data.
+     */
+    status_t update(uint32_t tag,
+            const uint8_t *data, size_t data_count);
+    status_t update(uint32_t tag,
+            const int32_t *data, size_t data_count);
+    status_t update(uint32_t tag,
+            const float *data, size_t data_count);
+    status_t update(uint32_t tag,
+            const int64_t *data, size_t data_count);
+    status_t update(uint32_t tag,
+            const double *data, size_t data_count);
+    status_t update(uint32_t tag,
+            const camera_metadata_rational_t *data, size_t data_count);
+    status_t update(uint32_t tag,
+            const String8 &string);
+    status_t update(const camera_metadata_ro_entry &entry);
+
+
+    template<typename T>
+    status_t update(uint32_t tag, Vector<T> data) {
+        return update(tag, data.array(), data.size());
+    }
+
+    /**
+     * Check if a metadata entry exists for a given tag id
+     *
+     */
+    bool exists(uint32_t tag) const;
+
+    /**
+     * Get metadata entry by tag id
+     */
+    camera_metadata_entry find(uint32_t tag);
+
+    /**
+     * Get metadata entry by tag id, with no editing
+     */
+    camera_metadata_ro_entry find(uint32_t tag) const;
+
+    /**
+     * Delete metadata entry by tag
+     */
+    status_t erase(uint32_t tag);
+
+    /**
+     * Swap the underlying camera metadata between this and the other
+     * metadata object.
+     */
+    void swap(CameraMetadata &other);
+
+    /**
+     * Dump contents into FD for debugging. The verbosity levels are
+     * 0: Tag entry information only, no data values
+     * 1: Level 0 plus at most 16 data values per entry
+     * 2: All information
+     *
+     * The indentation parameter sets the number of spaces to add to the start
+     * each line of output.
+     */
+    void dump(int fd, int verbosity = 1, int indentation = 0) const;
+
+    /**
+     * Find tag id for a given tag name, also checking vendor tags if available.
+     * On success, returns OK and writes the tag id into tag.
+     *
+     * This is a slow method.
+     */
+    static status_t getTagFromName(const char *name,
+            const VendorTagDescriptor* vTags, uint32_t *tag);
+
+  private:
+    camera_metadata_t *mBuffer;
+    mutable bool       mLocked;
+
+    /**
+     * Check if tag has a given type
+     */
+    status_t checkType(uint32_t tag, uint8_t expectedType);
+
+    /**
+     * Base update entry method
+     */
+    status_t updateImpl(uint32_t tag, const void *data, size_t data_count);
+
+    /**
+     * Resize metadata buffer if needed by reallocating it and copying it over.
+     */
+    status_t resizeIfNeeded(size_t extraEntries, size_t extraData);
+
+};
+
+} // namespace helper
+} // namespace V1_0
+} // namespace common
+} // namespace camera
+} // namespace hardware
+} // namespace android
+
+#endif
diff --git a/camera/common/1.0/default/include/CameraModule.h b/camera/common/1.0/default/include/CameraModule.h
new file mode 100644
index 0000000..68d4f90
--- /dev/null
+++ b/camera/common/1.0/default/include/CameraModule.h
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+#ifndef CAMERA_COMMON_1_0_CAMERAMODULE_H
+#define CAMERA_COMMON_1_0_CAMERAMODULE_H
+
+#include <hardware/camera.h>
+#include <utils/Mutex.h>
+#include <utils/KeyedVector.h>
+
+#include "CameraMetadata.h"
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
+/**
+ * A wrapper class for HAL camera module.
+ *
+ * This class wraps camera_module_t returned from HAL to provide a wrapped
+ * get_camera_info implementation which CameraService generates some
+ * camera characteristics keys defined in newer HAL version on an older HAL.
+ */
+class CameraModule : public RefBase {
+public:
+    explicit CameraModule(camera_module_t *module);
+    virtual ~CameraModule();
+
+    // Must be called after construction
+    // Returns OK on success, NO_INIT on failure
+    int init();
+
+    int getCameraInfo(int cameraId, struct camera_info *info);
+    int getDeviceVersion(int cameraId);
+    int getNumberOfCameras(void);
+    int open(const char* id, struct hw_device_t** device);
+    bool isOpenLegacyDefined() const;
+    int openLegacy(const char* id, uint32_t halVersion, struct hw_device_t** device);
+    int setCallbacks(const camera_module_callbacks_t *callbacks);
+    bool isVendorTagDefined() const;
+    void getVendorTagOps(vendor_tag_ops_t* ops);
+    bool isSetTorchModeSupported() const;
+    int setTorchMode(const char* camera_id, bool enable);
+    uint16_t getModuleApiVersion() const;
+    const char* getModuleName() const;
+    uint16_t getHalApiVersion() const;
+    const char* getModuleAuthor() const;
+    // Only used by CameraModuleFixture native test. Do NOT use elsewhere.
+    void *getDso();
+
+private:
+    // Derive camera characteristics keys defined after HAL device version
+    static void deriveCameraCharacteristicsKeys(uint32_t deviceVersion, CameraMetadata &chars);
+    // Helper function to append available[request|result|chars]Keys
+    static void appendAvailableKeys(CameraMetadata &chars,
+            int32_t keyTag, const Vector<int32_t>& appendKeys);
+    status_t filterOpenErrorCode(status_t err);
+    camera_module_t *mModule;
+    KeyedVector<int, camera_info> mCameraInfoMap;
+    KeyedVector<int, int> mDeviceVersionMap;
+    Mutex mCameraInfoLock;
+};
+
+} // namespace helper
+} // namespace V1_0
+} // namespace common
+} // namespace camera
+} // namespace hardware
+} // namespace android
+
+#endif
diff --git a/camera/common/1.0/default/include/VendorTagDescriptor.h b/camera/common/1.0/default/include/VendorTagDescriptor.h
new file mode 100644
index 0000000..8d8ded9
--- /dev/null
+++ b/camera/common/1.0/default/include/VendorTagDescriptor.h
@@ -0,0 +1,165 @@
+/*
+ * 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.
+ */
+
+#ifndef CAMERA_COMMON_1_0_VENDORTAGDESCRIPTOR_H
+#define CAMERA_COMMON_1_0_VENDORTAGDESCRIPTOR_H
+
+#include <utils/Vector.h>
+#include <utils/KeyedVector.h>
+#include <utils/String8.h>
+#include <utils/RefBase.h>
+#include <system/camera_vendor_tags.h>
+
+#include <stdint.h>
+
+namespace android {
+namespace hardware {
+namespace camera2 {
+namespace params {
+
+/**
+ * VendorTagDescriptor objects are containers for the vendor tag
+ * definitions provided, and are typically used to pass the vendor tag
+ * information enumerated by the HAL to clients of the camera service.
+ */
+class VendorTagDescriptor {
+    public:
+        virtual ~VendorTagDescriptor();
+
+        VendorTagDescriptor();
+        VendorTagDescriptor(const VendorTagDescriptor& src);
+        VendorTagDescriptor& operator=(const VendorTagDescriptor& rhs);
+
+        void copyFrom(const VendorTagDescriptor& src);
+
+        /**
+         * The following 'get*' methods implement the corresponding
+         * functions defined in
+         * system/media/camera/include/system/camera_vendor_tags.h
+         */
+
+        // Returns the number of vendor tags defined.
+        int getTagCount() const;
+
+        // Returns an array containing the id's of vendor tags defined.
+        void getTagArray(uint32_t* tagArray) const;
+
+        // Returns the section name string for a given vendor tag id.
+        const char* getSectionName(uint32_t tag) const;
+
+        // Returns the index in section vectors returned in getAllSectionNames()
+        // for a given vendor tag id. -1 if input tag does not exist.
+        ssize_t getSectionIndex(uint32_t tag) const;
+
+        // Returns the tag name string for a given vendor tag id.
+        const char* getTagName(uint32_t tag) const;
+
+        // Returns the tag type for a given vendor tag id.
+        int getTagType(uint32_t tag) const;
+
+        /**
+         * Convenience method to get a vector containing all vendor tag
+         * sections, or an empty vector if none are defined.
+         * The pointer is valid for the lifetime of the VendorTagDescriptor,
+         * or until copyFrom is invoked.
+         */
+        const SortedVector<String8>* getAllSectionNames() const;
+
+        /**
+         * Lookup the tag id for a given tag name and section.
+         *
+         * Returns OK on success, or a negative error code.
+         */
+        status_t lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const;
+
+        /**
+         * Dump the currently configured vendor tags to a file descriptor.
+         */
+        void dump(int fd, int verbosity, int indentation) const;
+
+    protected:
+        KeyedVector<String8, KeyedVector<String8, uint32_t>*> mReverseMapping;
+        KeyedVector<uint32_t, String8> mTagToNameMap;
+        KeyedVector<uint32_t, uint32_t> mTagToSectionMap; // Value is offset in mSections
+        KeyedVector<uint32_t, int32_t> mTagToTypeMap;
+        SortedVector<String8> mSections;
+        // must be int32_t to be compatible with Parcel::writeInt32
+        int32_t mTagCount;
+
+        vendor_tag_ops mVendorOps;
+};
+} /* namespace params */
+} /* namespace camera2 */
+
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
+
+/**
+ * This version of VendorTagDescriptor must be stored in Android sp<>, and adds support for using it
+ * as a global tag descriptor.
+ *
+ * It's a child class of the basic hardware::camera2::params::VendorTagDescriptor since basic
+ * Parcelable objects cannot require being kept in an sp<> and still work with auto-generated AIDL
+ * interface implementations.
+ */
+class VendorTagDescriptor :
+            public ::android::hardware::camera2::params::VendorTagDescriptor,
+            public LightRefBase<VendorTagDescriptor> {
+
+  public:
+
+    /**
+     * Create a VendorTagDescriptor object from the given vendor_tag_ops_t
+     * struct.
+     *
+     * Returns OK on success, or a negative error code.
+     */
+    static status_t createDescriptorFromOps(const vendor_tag_ops_t* vOps,
+            /*out*/
+            sp<VendorTagDescriptor>& descriptor);
+
+    /**
+     * Sets the global vendor tag descriptor to use for this process.
+     * Camera metadata operations that access vendor tags will use the
+     * vendor tag definitions set this way.
+     *
+     * Returns OK on success, or a negative error code.
+     */
+    static status_t setAsGlobalVendorTagDescriptor(const sp<VendorTagDescriptor>& desc);
+
+    /**
+     * Returns the global vendor tag descriptor used by this process.
+     * This will contain NULL if no vendor tags are defined.
+     */
+    static sp<VendorTagDescriptor> getGlobalVendorTagDescriptor();
+
+    /**
+     * Clears the global vendor tag descriptor used by this process.
+     */
+    static void clearGlobalVendorTagDescriptor();
+
+};
+
+} // namespace helper
+} // namespace V1_0
+} // namespace common
+} // namespace camera
+} // namespace hardware
+} // namespace android
+
+#endif /* CAMERA_COMMON_1_0_VENDORTAGDESCRIPTOR_H */
diff --git a/camera/device/3.2/ICameraDeviceSession.hal b/camera/device/3.2/ICameraDeviceSession.hal
index c8cc246..e92d756 100644
--- a/camera/device/3.2/ICameraDeviceSession.hal
+++ b/camera/device/3.2/ICameraDeviceSession.hal
@@ -48,6 +48,8 @@
      *     INTERNAL_ERROR:
      *         An unexpected internal error occurred, and the default settings
      *         are not available.
+     *     ILLEGAL_ARGUMENT:
+     *         The camera HAL does not support the input template type
      *     CAMERA_DISCONNECTED:
      *         An external camera device has been disconnected, and is no longer
      *         available. This camera device interface is now stale, and a new
diff --git a/camera/device/3.2/default/Android.bp b/camera/device/3.2/default/Android.bp
new file mode 100644
index 0000000..9820220
--- /dev/null
+++ b/camera/device/3.2/default/Android.bp
@@ -0,0 +1,22 @@
+cc_library_shared {
+    name: "android.hardware.camera.device@3.2-impl",
+    srcs: ["CameraDevice.cpp",
+           "CameraDeviceSession.cpp",
+           "convert.cpp"],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "libcutils",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.camera.provider@2.4",
+        "liblog",
+        "libhardware",
+        "libcamera_metadata"
+    ],
+    static_libs: [
+        "android.hardware.camera.common@1.0-helper"
+    ],
+    export_include_dirs: ["."]
+}
diff --git a/camera/device/3.2/default/CameraDevice.cpp b/camera/device/3.2/default/CameraDevice.cpp
new file mode 100644
index 0000000..18e0e7b
--- /dev/null
+++ b/camera/device/3.2/default/CameraDevice.cpp
@@ -0,0 +1,285 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "CamDev@3.2-impl"
+#include <android/log.h>
+
+#include <utils/Vector.h>
+#include <utils/Trace.h>
+#include "CameraDevice.h"
+#include <include/convert.h>
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace device {
+namespace V3_2 {
+namespace implementation {
+
+using ::android::hardware::camera::common::V1_0::Status;
+
+CameraDevice::CameraDevice(
+    sp<CameraModule> module, const std::string& cameraId,
+    const SortedVector<std::pair<std::string, std::string>>& cameraDeviceNames) :
+        mModule(module),
+        mCameraId(cameraId),
+        mDisconnected(false),
+        mCameraDeviceNames(cameraDeviceNames) {
+    mCameraIdInt = atoi(mCameraId.c_str());
+    // Should not reach here as provider also validate ID
+    if (mCameraIdInt < 0 || mCameraIdInt >= module->getNumberOfCameras()) {
+        ALOGE("%s: Invalid camera id: %s", __FUNCTION__, mCameraId.c_str());
+        mInitFail = true;
+    }
+
+    mDeviceVersion = mModule->getDeviceVersion(mCameraIdInt);
+    if (mDeviceVersion < CAMERA_DEVICE_API_VERSION_3_2) {
+        ALOGE("%s: Camera id %s does not support HAL3.2+",
+                __FUNCTION__, mCameraId.c_str());
+        mInitFail = true;
+    }
+}
+
+CameraDevice::~CameraDevice() {}
+
+Status CameraDevice::initStatus() const {
+    Mutex::Autolock _l(mLock);
+    Status status = Status::OK;
+    if (mInitFail) {
+        status = Status::INTERNAL_ERROR;
+    } else if (mDisconnected) {
+        status = Status::CAMERA_DISCONNECTED;
+    }
+    return status;
+}
+
+void CameraDevice::setConnectionStatus(bool connected) {
+    Mutex::Autolock _l(mLock);
+    mDisconnected = !connected;
+    if (mSession == nullptr) {
+        return;
+    }
+    sp<CameraDeviceSession> session = mSession.promote();
+    if (session == nullptr) {
+        return;
+    }
+    // Only notify active session disconnect events.
+    // Users will need to re-open camera after disconnect event
+    if (!connected) {
+        session->disconnect();
+    }
+    return;
+}
+
+Status CameraDevice::getHidlStatus(int status) {
+    switch (status) {
+        case 0: return Status::OK;
+        case -ENOSYS: return Status::OPERATION_NOT_SUPPORTED;
+        case -EBUSY : return Status::CAMERA_IN_USE;
+        case -EUSERS: return Status::MAX_CAMERAS_IN_USE;
+        case -ENODEV: return Status::INTERNAL_ERROR;
+        case -EINVAL: return Status::ILLEGAL_ARGUMENT;
+        default:
+            ALOGE("%s: unknown HAL status code %d", __FUNCTION__, status);
+            return Status::INTERNAL_ERROR;
+    }
+}
+
+// Methods from ::android::hardware::camera::device::V3_2::ICameraDevice follow.
+Return<void> CameraDevice::getResourceCost(getResourceCost_cb _hidl_cb)  {
+    Status status = initStatus();
+    CameraResourceCost resCost;
+    if (status == Status::OK) {
+        int cost = 100;
+        std::vector<std::string> conflicting_devices;
+        struct camera_info info;
+
+        // If using post-2.4 module version, query the cost + conflicting devices from the HAL
+        if (mModule->getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4) {
+            int ret = mModule->getCameraInfo(mCameraIdInt, &info);
+            if (ret == OK) {
+                cost = info.resource_cost;
+                for (size_t i = 0; i < info.conflicting_devices_length; i++) {
+                    std::string cameraId(info.conflicting_devices[i]);
+                    for (const auto& pair : mCameraDeviceNames) {
+                        if (cameraId == pair.first) {
+                            conflicting_devices.push_back(pair.second);
+                        }
+                    }
+                }
+            } else {
+                status = Status::INTERNAL_ERROR;
+            }
+        }
+
+        if (status == Status::OK) {
+            resCost.resourceCost = cost;
+            resCost.conflictingDevices.resize(conflicting_devices.size());
+            for (size_t i = 0; i < conflicting_devices.size(); i++) {
+                resCost.conflictingDevices[i] = conflicting_devices[i];
+                ALOGV("CamDevice %s is conflicting with camDevice %s",
+                        mCameraId.c_str(), resCost.conflictingDevices[i].c_str());
+            }
+        }
+    }
+    _hidl_cb(status, resCost);
+    return Void();
+}
+
+Return<void> CameraDevice::getCameraCharacteristics(getCameraCharacteristics_cb _hidl_cb)  {
+    Status status = initStatus();
+    CameraMetadata cameraCharacteristics;
+    if (status == Status::OK) {
+        //Module 2.1+ codepath.
+        struct camera_info info;
+        int ret = mModule->getCameraInfo(mCameraIdInt, &info);
+        if (ret == OK) {
+            convertToHidl(info.static_camera_characteristics, &cameraCharacteristics);
+        } else {
+            ALOGE("%s: get camera info failed!", __FUNCTION__);
+            status = Status::INTERNAL_ERROR;
+        }
+    }
+    _hidl_cb(status, cameraCharacteristics);
+    return Void();
+}
+
+Return<Status> CameraDevice::setTorchMode(TorchMode mode)  {
+    if (!mModule->isSetTorchModeSupported()) {
+        return Status::METHOD_NOT_SUPPORTED;
+    }
+
+    Status status = initStatus();
+    if (status == Status::OK) {
+        bool enable = (mode == TorchMode::ON) ? true : false;
+        status = getHidlStatus(mModule->setTorchMode(mCameraId.c_str(), enable));
+    }
+    return status;
+}
+
+Return<void> CameraDevice::open(const sp<ICameraDeviceCallback>& callback, open_cb _hidl_cb)  {
+    Status status = initStatus();
+    sp<CameraDeviceSession> session = nullptr;
+
+    if (callback == nullptr) {
+        ALOGE("%s: cannot open camera %s. callback is null!",
+                __FUNCTION__, mCameraId.c_str());
+        _hidl_cb(Status::ILLEGAL_ARGUMENT, session);
+        return Void();
+    }
+
+    if (status != Status::OK) {
+        // Provider will never pass initFailed device to client, so
+        // this must be a disconnected camera
+        ALOGE("%s: cannot open camera %s. camera is disconnected!",
+                __FUNCTION__, mCameraId.c_str());
+        _hidl_cb(Status::CAMERA_DISCONNECTED, session);
+        return Void();
+    } else {
+        mLock.lock();
+
+        ALOGV("%s: Initializing device for camera %d", __FUNCTION__, mCameraIdInt);
+        session = mSession.promote();
+        if (session != nullptr && !session->isClosed()) {
+            ALOGE("%s: cannot open an already opened camera!", __FUNCTION__);
+            mLock.unlock();
+            _hidl_cb(Status::CAMERA_IN_USE, nullptr);
+            return Void();
+        }
+
+        /** Open HAL device */
+        status_t res;
+        camera3_device_t *device;
+
+        ATRACE_BEGIN("camera3->open");
+        res = mModule->open(mCameraId.c_str(),
+                reinterpret_cast<hw_device_t**>(&device));
+        ATRACE_END();
+
+        if (res != OK) {
+            ALOGE("%s: cannot open camera %s!", __FUNCTION__, mCameraId.c_str());
+            mLock.unlock();
+            _hidl_cb(getHidlStatus(res), nullptr);
+            return Void();
+        }
+
+        /** Cross-check device version */
+        if (device->common.version < CAMERA_DEVICE_API_VERSION_3_2) {
+            ALOGE("%s: Could not open camera: "
+                    "Camera device should be at least %x, reports %x instead",
+                    __FUNCTION__,
+                    CAMERA_DEVICE_API_VERSION_3_2,
+                    device->common.version);
+            device->common.close(&device->common);
+            mLock.unlock();
+            _hidl_cb(Status::ILLEGAL_ARGUMENT, nullptr);
+            return Void();
+        }
+
+        session = new CameraDeviceSession(device, callback);
+        if (session == nullptr) {
+            ALOGE("%s: camera device session allocation failed", __FUNCTION__);
+            mLock.unlock();
+            _hidl_cb(Status::INTERNAL_ERROR, nullptr);
+            return Void();
+        }
+        if (session->isInitFailed()) {
+            ALOGE("%s: camera device session init failed", __FUNCTION__);
+            session = nullptr;
+            mLock.unlock();
+            _hidl_cb(Status::INTERNAL_ERROR, nullptr);
+            return Void();
+        }
+        mSession = session;
+        mLock.unlock();
+    }
+    _hidl_cb(status, session);
+    return Void();
+}
+
+Return<void> CameraDevice::dumpState(const ::android::hardware::hidl_handle& handle)  {
+    Mutex::Autolock _l(mLock);
+    if (handle.getNativeHandle() == nullptr) {
+        ALOGE("%s: handle must not be null", __FUNCTION__);
+        return Void();
+    }
+    if (handle->numFds != 1 || handle->numInts != 0) {
+        ALOGE("%s: handle must contain 1 FD and 0 integers! Got %d FDs and %d ints",
+                __FUNCTION__, handle->numFds, handle->numInts);
+        return Void();
+    }
+    int fd = handle->data[0];
+    if (mSession == nullptr) {
+        dprintf(fd, "No active camera device session instance\n");
+        return Void();
+    }
+    sp<CameraDeviceSession> session = mSession.promote();
+    if (session == nullptr) {
+        dprintf(fd, "No active camera device session instance\n");
+        return Void();
+    }
+    // Call into active session to dump states
+    session->dumpState(handle);
+    return Void();
+}
+// End of methods from ::android::hardware::camera::device::V3_2::ICameraDevice.
+
+} // namespace implementation
+}  // namespace V3_2
+}  // namespace device
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
diff --git a/camera/device/3.2/default/CameraDevice.h b/camera/device/3.2/default/CameraDevice.h
new file mode 100644
index 0000000..317eea5
--- /dev/null
+++ b/camera/device/3.2/default/CameraDevice.h
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_HARDWARE_CAMERA_DEVICE_V3_2_CAMERADEVICE_H
+#define ANDROID_HARDWARE_CAMERA_DEVICE_V3_2_CAMERADEVICE_H
+
+#include "utils/Mutex.h"
+#include "CameraModule.h"
+#include "CameraMetadata.h"
+#include "CameraDeviceSession.h"
+
+#include <android/hardware/camera/device/3.2/ICameraDevice.h>
+#include <hidl/Status.h>
+#include <hidl/MQDescriptor.h>
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace device {
+namespace V3_2 {
+namespace implementation {
+
+using ::android::hardware::camera::device::V3_2::RequestTemplate;
+using ::android::hardware::camera::device::V3_2::ICameraDevice;
+using ::android::hardware::camera::device::V3_2::ICameraDeviceCallback;
+using ::android::hardware::camera::device::V3_2::ICameraDeviceSession;
+using ::android::hardware::camera::common::V1_0::CameraResourceCost;
+using ::android::hardware::camera::common::V1_0::Status;
+using ::android::hardware::camera::common::V1_0::TorchMode;
+using ::android::hardware::camera::common::V1_0::helper::CameraModule;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+using ::android::Mutex;
+
+/*
+ * The camera device HAL implementation is opened lazily (via the open call)
+ */
+struct CameraDevice : public ICameraDevice {
+    // Called by provider HAL. Provider HAL must ensure the uniqueness of
+    // CameraDevice object per cameraId, or there could be multiple CameraDevice
+    // trying to access the same physical camera.
+    // Also, provider will have to keep track of all CameraDevice object in
+    // order to notify CameraDevice when the underlying camera is detached
+    CameraDevice(sp<CameraModule> module,
+                 const std::string& cameraId,
+                 const SortedVector<std::pair<std::string, std::string>>& cameraDeviceNames);
+    ~CameraDevice();
+    // Caller must use this method to check if CameraDevice ctor failed
+    bool isInitFailed() { return mInitFail; }
+    // Used by provider HAL to signal external camera disconnected
+    void setConnectionStatus(bool connected);
+
+    /* Methods from ::android::hardware::camera::device::V3_2::ICameraDevice follow. */
+    // The following method can be called without opening the actual camera device
+    Return<void> getResourceCost(getResourceCost_cb _hidl_cb) override;
+    Return<void> getCameraCharacteristics(getCameraCharacteristics_cb _hidl_cb) override;
+    Return<Status> setTorchMode(TorchMode mode) override;
+
+    // Open the device HAL and also return a default capture session
+    Return<void> open(const sp<ICameraDeviceCallback>& callback, open_cb _hidl_cb) override;
+
+
+    // Forward the dump call to the opened session, or do nothing
+    Return<void> dumpState(const ::android::hardware::hidl_handle& fd) override;
+    /* End of Methods from ::android::hardware::camera::device::V3_2::ICameraDevice */
+
+private:
+    // Passed from provider HAL. Should not change.
+    sp<CameraModule> mModule;
+    const std::string mCameraId;
+    // const after ctor
+    int   mCameraIdInt;
+    int   mDeviceVersion;
+    bool  mInitFail = false;
+    // Set by provider (when external camera is connected/disconnected)
+    bool  mDisconnected;
+    wp<CameraDeviceSession> mSession = nullptr;
+
+    const SortedVector<std::pair<std::string, std::string>>& mCameraDeviceNames;
+
+    // gating access to mSession and mDisconnected
+    mutable Mutex mLock;
+
+    // convert conventional HAL status to HIDL Status
+    static Status getHidlStatus(int);
+
+    Status initStatus() const;
+};
+
+}  // namespace implementation
+}  // namespace V3_2
+}  // namespace device
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_CAMERA_DEVICE_V3_2_CAMERADEVICE_H
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
new file mode 100644
index 0000000..201a3b4
--- /dev/null
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -0,0 +1,750 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "CamDevSession@3.2-impl"
+#include <android/log.h>
+
+#include <utils/Trace.h>
+#include <hardware/gralloc.h>
+#include <hardware/gralloc1.h>
+#include "CameraDeviceSession.h"
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace device {
+namespace V3_2 {
+namespace implementation {
+
+namespace {
+
+// Copy pasted from Hwc.cpp. Use this until gralloc mapper HAL is working
+class HandleImporter {
+public:
+    HandleImporter() : mInitialized(false) {}
+
+    bool initialize()
+    {
+        // allow only one client
+        if (mInitialized) {
+            return false;
+        }
+
+        if (!openGralloc()) {
+            return false;
+        }
+
+        mInitialized = true;
+        return true;
+    }
+
+    void cleanup()
+    {
+        if (!mInitialized) {
+            return;
+        }
+
+        closeGralloc();
+        mInitialized = false;
+    }
+
+    // In IComposer, any buffer_handle_t is owned by the caller and we need to
+    // make a clone for hwcomposer2.  We also need to translate empty handle
+    // to nullptr.  This function does that, in-place.
+    bool importBuffer(buffer_handle_t& handle)
+    {
+        if (!handle->numFds && !handle->numInts) {
+            handle = nullptr;
+            return true;
+        }
+
+        buffer_handle_t clone = cloneBuffer(handle);
+        if (!clone) {
+            return false;
+        }
+
+        handle = clone;
+        return true;
+    }
+
+    void freeBuffer(buffer_handle_t handle)
+    {
+        if (!handle) {
+            return;
+        }
+
+        releaseBuffer(handle);
+    }
+
+    bool importFence(const native_handle_t* handle, int& fd)
+    {
+        if (handle == nullptr || handle->numFds == 0) {
+            fd = -1;
+        } else if (handle->numFds == 1) {
+//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
+            if (fd < 0) {
+                ALOGE("failed to dup fence fd %d", handle->data[0]);
+                return false;
+            }
+        } else {
+            ALOGE("invalid fence handle with %d file descriptors",
+                    handle->numFds);
+            return false;
+        }
+
+        return true;
+    }
+
+    void closeFence(int fd)
+    {
+#ifdef BINDERIZED
+        if (fd >= 0) {
+            close(fd);
+        }
+#else
+        (void) fd;
+#endif
+    }
+
+private:
+    bool mInitialized;
+
+    // Some existing gralloc drivers do not support retaining more than once,
+    // when we are in passthrough mode.
+#ifdef BINDERIZED
+    bool openGralloc()
+    {
+        const hw_module_t* module;
+        int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
+        if (err) {
+            ALOGE("failed to get gralloc module");
+            return false;
+        }
+
+        uint8_t major = (module->module_api_version >> 8) & 0xff;
+        if (major > 1) {
+            ALOGE("unknown gralloc module major version %d", major);
+            return false;
+        }
+
+        if (major == 1) {
+            err = gralloc1_open(module, &mDevice);
+            if (err) {
+                ALOGE("failed to open gralloc1 device");
+                return false;
+            }
+
+            mRetain = reinterpret_cast<GRALLOC1_PFN_RETAIN>(
+                    mDevice->getFunction(mDevice, GRALLOC1_FUNCTION_RETAIN));
+            mRelease = reinterpret_cast<GRALLOC1_PFN_RELEASE>(
+                    mDevice->getFunction(mDevice, GRALLOC1_FUNCTION_RELEASE));
+            if (!mRetain || !mRelease) {
+                ALOGE("invalid gralloc1 device");
+                gralloc1_close(mDevice);
+                return false;
+            }
+        } else {
+            mModule = reinterpret_cast<const gralloc_module_t*>(module);
+        }
+
+        return true;
+    }
+
+    void closeGralloc()
+    {
+        if (mDevice) {
+            gralloc1_close(mDevice);
+        }
+    }
+
+    buffer_handle_t cloneBuffer(buffer_handle_t handle)
+    {
+        native_handle_t* clone = native_handle_clone(handle);
+        if (!clone) {
+            ALOGE("failed to clone buffer %p", handle);
+            return nullptr;
+        }
+
+        bool err;
+        if (mDevice) {
+            err = (mRetain(mDevice, clone) != GRALLOC1_ERROR_NONE);
+        } else {
+            err = (mModule->registerBuffer(mModule, clone) != 0);
+        }
+
+        if (err) {
+            ALOGE("failed to retain/register buffer %p", clone);
+            native_handle_close(clone);
+            native_handle_delete(clone);
+            return nullptr;
+        }
+
+        return clone;
+    }
+
+    void releaseBuffer(buffer_handle_t handle)
+    {
+        if (mDevice) {
+            mRelease(mDevice, handle);
+        } else {
+            mModule->unregisterBuffer(mModule, handle);
+            native_handle_close(handle);
+            native_handle_delete(const_cast<native_handle_t*>(handle));
+        }
+    }
+
+    // gralloc1
+    gralloc1_device_t* mDevice;
+    GRALLOC1_PFN_RETAIN mRetain;
+    GRALLOC1_PFN_RELEASE mRelease;
+
+    // gralloc0
+    const gralloc_module_t* mModule;
+#else
+    bool openGralloc() { return true; }
+    void closeGralloc() {}
+    buffer_handle_t cloneBuffer(buffer_handle_t handle) { return handle; }
+    void releaseBuffer(buffer_handle_t) {}
+#endif
+};
+
+HandleImporter sHandleImporter;
+
+} // Anonymous namespace
+
+CameraDeviceSession::CameraDeviceSession(
+    camera3_device_t* device, const sp<ICameraDeviceCallback>& callback) :
+        camera3_callback_ops({&sProcessCaptureResult, &sNotify}),
+        mDevice(device),
+        mCallback(callback) {
+    // For now, we init sHandleImporter but do not cleanup (keep it alive until
+    // HAL process ends)
+    sHandleImporter.initialize();
+
+    mInitFail = initialize();
+}
+
+bool CameraDeviceSession::initialize() {
+    /** Initialize device with callback functions */
+    ATRACE_BEGIN("camera3->initialize");
+    status_t res = mDevice->ops->initialize(mDevice, this);
+    ATRACE_END();
+
+    if (res != OK) {
+        ALOGE("%s: Unable to initialize HAL device: %s (%d)",
+                __FUNCTION__, strerror(-res), res);
+        mDevice->common.close(&mDevice->common);
+        mClosed = true;
+        return true;
+    }
+    return false;
+}
+
+CameraDeviceSession::~CameraDeviceSession() {
+    if (!isClosed()) {
+        ALOGE("CameraDeviceSession deleted before close!");
+        close();
+    }
+}
+
+bool CameraDeviceSession::isClosed() {
+    Mutex::Autolock _l(mStateLock);
+    return mClosed;
+}
+
+Status CameraDeviceSession::initStatus() const {
+    Mutex::Autolock _l(mStateLock);
+    Status status = Status::OK;
+    if (mInitFail) {
+        status = Status::INTERNAL_ERROR;
+    } else if (mDisconnected) {
+        status = Status::CAMERA_DISCONNECTED;
+    } else if (mClosed) {
+        status = Status::INTERNAL_ERROR;
+    }
+    return status;
+}
+
+void CameraDeviceSession::disconnect() {
+    Mutex::Autolock _l(mStateLock);
+    mDisconnected = true;
+    ALOGW("%s: Camera device is disconnected. Closing.", __FUNCTION__);
+    if (!mClosed) {
+        mDevice->common.close(&mDevice->common);
+        mClosed = true;
+    }
+}
+
+void CameraDeviceSession::dumpState(const native_handle_t* fd) {
+    if (!isClosed()) {
+        mDevice->ops->dump(mDevice, fd->data[0]);
+    }
+}
+
+Status CameraDeviceSession::importRequest(
+        const CaptureRequest& request,
+        hidl_vec<buffer_handle_t*>& allBufPtrs,
+        hidl_vec<int>& allFences) {
+    bool hasInputBuf = (request.inputBuffer.streamId != -1 &&
+            request.inputBuffer.buffer.getNativeHandle() != nullptr);
+    size_t numOutputBufs = request.outputBuffers.size();
+    size_t numBufs = numOutputBufs + (hasInputBuf ? 1 : 0);
+    // Validate all I/O buffers
+    hidl_vec<buffer_handle_t> allBufs;
+    allBufs.resize(numBufs);
+    allBufPtrs.resize(numBufs);
+    allFences.resize(numBufs);
+    std::vector<int32_t> streamIds(numBufs);
+
+    for (size_t i = 0; i < numOutputBufs; i++) {
+        allBufs[i] = request.outputBuffers[i].buffer.getNativeHandle();
+        allBufPtrs[i] = &allBufs[i];
+        streamIds[i] = request.outputBuffers[i].streamId;
+    }
+    if (hasInputBuf) {
+        allBufs[numOutputBufs] = request.inputBuffer.buffer.getNativeHandle();
+        allBufPtrs[numOutputBufs] = &allBufs[numOutputBufs];
+        streamIds[numOutputBufs] = request.inputBuffer.streamId;
+    }
+
+    for (size_t i = 0; i < numBufs; i++) {
+        buffer_handle_t buf = allBufs[i];
+        CirculatingBuffers& cbs = mCirculatingBuffers[streamIds[i]];
+        if (cbs.count(buf) == 0) {
+            // Register a newly seen buffer
+            buffer_handle_t importedBuf = buf;
+            sHandleImporter.importBuffer(importedBuf);
+            if (importedBuf == nullptr) {
+                ALOGE("%s: output buffer %zu is invalid!", __FUNCTION__, i);
+                return Status::INTERNAL_ERROR;
+            } else {
+                cbs[buf] = importedBuf;
+            }
+        }
+        allBufPtrs[i] = &cbs[buf];
+    }
+
+    // All buffers are imported. Now validate output buffer acquire fences
+    for (size_t i = 0; i < numOutputBufs; i++) {
+        if (!sHandleImporter.importFence(
+                request.outputBuffers[i].acquireFence, allFences[i])) {
+            ALOGE("%s: output buffer %zu acquire fence is invalid", __FUNCTION__, i);
+            cleanupInflightFences(allFences, i);
+            return Status::INTERNAL_ERROR;
+        }
+    }
+
+    // Validate input buffer acquire fences
+    if (hasInputBuf) {
+        if (!sHandleImporter.importFence(
+                request.inputBuffer.acquireFence, allFences[numOutputBufs])) {
+            ALOGE("%s: input buffer acquire fence is invalid", __FUNCTION__);
+            cleanupInflightFences(allFences, numOutputBufs);
+            return Status::INTERNAL_ERROR;
+        }
+    }
+    return Status::OK;
+}
+
+void CameraDeviceSession::cleanupInflightFences(
+        hidl_vec<int>& allFences, size_t numFences) {
+    for (size_t j = 0; j < numFences; j++) {
+        sHandleImporter.closeFence(allFences[j]);
+    }
+}
+
+// Methods from ::android::hardware::camera::device::V3_2::ICameraDeviceSession follow.
+Return<void> CameraDeviceSession::constructDefaultRequestSettings(
+        RequestTemplate type, constructDefaultRequestSettings_cb _hidl_cb)  {
+    Status status = initStatus();
+    CameraMetadata outMetadata;
+    const camera_metadata_t *rawRequest;
+    if (status == Status::OK) {
+        ATRACE_BEGIN("camera3->construct_default_request_settings");
+        rawRequest = mDevice->ops->construct_default_request_settings(mDevice, (int) type);
+        ATRACE_END();
+        if (rawRequest == nullptr) {
+            ALOGI("%s: template %d is not supported on this camera device",
+                  __FUNCTION__, type);
+            status = Status::ILLEGAL_ARGUMENT;
+        } else {
+            convertToHidl(rawRequest, &outMetadata);
+        }
+    }
+    _hidl_cb(status, outMetadata);
+    return Void();
+}
+
+Return<void> CameraDeviceSession::configureStreams(
+        const StreamConfiguration& requestedConfiguration, configureStreams_cb _hidl_cb)  {
+    Status status = initStatus();
+    HalStreamConfiguration outStreams;
+
+    // hold the inflight lock for entire configureStreams scope since there must not be any
+    // inflight request/results during stream configuration.
+    Mutex::Autolock _l(mInflightLock);
+    if (!mInflightBuffers.empty()) {
+        ALOGE("%s: trying to configureStreams while there are still %zu inflight buffers!",
+                __FUNCTION__, mInflightBuffers.size());
+        _hidl_cb(Status::INTERNAL_ERROR, outStreams);
+        return Void();
+    }
+
+
+
+    if (status == Status::OK) {
+        camera3_stream_configuration_t stream_list;
+        hidl_vec<camera3_stream_t*> streams;
+
+        stream_list.operation_mode = (uint32_t) requestedConfiguration.operationMode;
+        stream_list.num_streams = requestedConfiguration.streams.size();
+        streams.resize(stream_list.num_streams);
+        stream_list.streams = streams.data();
+
+        for (uint32_t i = 0; i < stream_list.num_streams; i++) {
+            int id = requestedConfiguration.streams[i].id;
+
+            if (mStreamMap.count(id) == 0) {
+                Camera3Stream stream;
+                convertFromHidl(requestedConfiguration.streams[i], &stream);
+                mStreamMap[id] = stream;
+                mCirculatingBuffers.emplace(stream.mId, CirculatingBuffers{});
+            } else {
+                // width/height/format must not change, but usage/rotation might need to change
+                if (mStreamMap[id].stream_type !=
+                        (int) requestedConfiguration.streams[i].streamType ||
+                        mStreamMap[id].width != requestedConfiguration.streams[i].width ||
+                        mStreamMap[id].height != requestedConfiguration.streams[i].height ||
+                        mStreamMap[id].format != (int) requestedConfiguration.streams[i].format ||
+                        mStreamMap[id].data_space != (android_dataspace_t)
+                                requestedConfiguration.streams[i].dataSpace) {
+                    ALOGE("%s: stream %d configuration changed!", __FUNCTION__, id);
+                    _hidl_cb(Status::INTERNAL_ERROR, outStreams);
+                    return Void();
+                }
+                mStreamMap[id].rotation = (int) requestedConfiguration.streams[i].rotation;
+                mStreamMap[id].usage = (uint32_t) requestedConfiguration.streams[i].usage;
+            }
+            streams[i] = &mStreamMap[id];
+        }
+
+        ATRACE_BEGIN("camera3->configure_streams");
+        status_t ret = mDevice->ops->configure_streams(mDevice, &stream_list);
+        ATRACE_END();
+
+        // delete unused streams, note we do this after adding new streams to ensure new stream
+        // will not have the same address as deleted stream, and HAL has a chance to reference
+        // the to be deleted stream in configure_streams call
+        for(auto it = mStreamMap.begin(); it != mStreamMap.end();) {
+            int id = it->first;
+            bool found = false;
+            for (const auto& stream : requestedConfiguration.streams) {
+                if (id == stream.id) {
+                    found = true;
+                    break;
+                }
+            }
+            if (!found) {
+                // Unmap all buffers of deleted stream
+                for (auto& pair : mCirculatingBuffers.at(id)) {
+                    sHandleImporter.freeBuffer(pair.second);
+                }
+                mCirculatingBuffers[id].clear();
+                mCirculatingBuffers.erase(id);
+                it = mStreamMap.erase(it);
+            } else {
+                ++it;
+            }
+        }
+
+        if (ret == -EINVAL) {
+            status = Status::ILLEGAL_ARGUMENT;
+        } else if (ret != OK) {
+            status = Status::INTERNAL_ERROR;
+        } else {
+            convertToHidl(stream_list, &outStreams);
+        }
+
+    }
+    _hidl_cb(status, outStreams);
+    return Void();
+}
+
+Return<Status> CameraDeviceSession::processCaptureRequest(const CaptureRequest& request)  {
+    Status status = initStatus();
+    if (status != Status::OK) {
+        ALOGE("%s: camera init failed or disconnected", __FUNCTION__);
+        return status;
+    }
+
+    camera3_capture_request_t halRequest;
+    halRequest.frame_number = request.frameNumber;
+    bool converted = convertFromHidl(request.settings, &halRequest.settings);
+    if (!converted) {
+        ALOGE("%s: capture request settings metadata is corrupt!", __FUNCTION__);
+        return Status::INTERNAL_ERROR;
+    }
+
+    hidl_vec<buffer_handle_t*> allBufPtrs;
+    hidl_vec<int> allFences;
+    bool hasInputBuf = (request.inputBuffer.streamId != -1 &&
+            request.inputBuffer.buffer.getNativeHandle() != nullptr);
+    size_t numOutputBufs = request.outputBuffers.size();
+    size_t numBufs = numOutputBufs + (hasInputBuf ? 1 : 0);
+    status = importRequest(request, allBufPtrs, allFences);
+    if (status != Status::OK) {
+        return status;
+    }
+
+    hidl_vec<camera3_stream_buffer_t> outHalBufs;
+    outHalBufs.resize(numOutputBufs);
+    {
+        Mutex::Autolock _l(mInflightLock);
+        if (hasInputBuf) {
+            auto key = std::make_pair(request.inputBuffer.streamId, request.frameNumber);
+            auto& bufCache = mInflightBuffers[key] = camera3_stream_buffer_t{};
+            convertFromHidl(
+                    allBufPtrs[numOutputBufs], request.inputBuffer.status,
+                    &mStreamMap[request.inputBuffer.streamId], allFences[numOutputBufs],
+                    &bufCache);
+            halRequest.input_buffer = &bufCache;
+        } else {
+            halRequest.input_buffer = nullptr;
+        }
+
+        halRequest.num_output_buffers = numOutputBufs;
+        for (size_t i = 0; i < numOutputBufs; i++) {
+            auto key = std::make_pair(request.outputBuffers[i].streamId, request.frameNumber);
+            auto& bufCache = mInflightBuffers[key] = camera3_stream_buffer_t{};
+            convertFromHidl(
+                    allBufPtrs[i], request.outputBuffers[i].status,
+                    &mStreamMap[request.outputBuffers[i].streamId], allFences[i],
+                    &bufCache);
+            outHalBufs[i] = bufCache;
+        }
+        halRequest.output_buffers = outHalBufs.data();
+    }
+
+    ATRACE_ASYNC_BEGIN("frame capture", request.frameNumber);
+    ATRACE_BEGIN("camera3->process_capture_request");
+    status_t ret = mDevice->ops->process_capture_request(mDevice, &halRequest);
+    ATRACE_END();
+    if (ret != OK) {
+        Mutex::Autolock _l(mInflightLock);
+        ALOGE("%s: HAL process_capture_request call failed!", __FUNCTION__);
+
+        cleanupInflightFences(allFences, numBufs);
+        if (hasInputBuf) {
+            auto key = std::make_pair(request.inputBuffer.streamId, request.frameNumber);
+            mInflightBuffers.erase(key);
+        }
+        for (size_t i = 0; i < numOutputBufs; i++) {
+            auto key = std::make_pair(request.outputBuffers[i].streamId, request.frameNumber);
+            mInflightBuffers.erase(key);
+        }
+        return Status::INTERNAL_ERROR;
+    }
+
+    return Status::OK;
+}
+
+Return<Status> CameraDeviceSession::flush()  {
+    Status status = initStatus();
+    if (status == Status::OK) {
+        // Flush is always supported on device 3.1 or later
+        status_t ret = mDevice->ops->flush(mDevice);
+        if (ret != OK) {
+            status = Status::INTERNAL_ERROR;
+        }
+    }
+    return status;
+}
+
+Return<void> CameraDeviceSession::close()  {
+    Mutex::Autolock _l(mStateLock);
+    if (!mClosed) {
+        {
+            Mutex::Autolock _l(mInflightLock);
+            if (!mInflightBuffers.empty()) {
+                ALOGE("%s: trying to close while there are still %zu inflight buffers!",
+                        __FUNCTION__, mInflightBuffers.size());
+            }
+        }
+
+        ATRACE_BEGIN("camera3->close");
+        mDevice->common.close(&mDevice->common);
+        ATRACE_END();
+
+        // free all imported buffers
+        for(auto& pair : mCirculatingBuffers) {
+            CirculatingBuffers& buffers = pair.second;
+            for (auto& p2 : buffers) {
+                sHandleImporter.freeBuffer(p2.second);
+            }
+        }
+
+        mClosed = true;
+    }
+    return Void();
+}
+
+/**
+ * Static callback forwarding methods from HAL to instance
+ */
+void CameraDeviceSession::sProcessCaptureResult(
+        const camera3_callback_ops *cb,
+        const camera3_capture_result *hal_result) {
+    CameraDeviceSession *d =
+            const_cast<CameraDeviceSession*>(static_cast<const CameraDeviceSession*>(cb));
+
+    uint32_t frameNumber = hal_result->frame_number;
+    bool hasInputBuf = (hal_result->input_buffer != nullptr);
+    size_t numOutputBufs = hal_result->num_output_buffers;
+    size_t numBufs = numOutputBufs + (hasInputBuf ? 1 : 0);
+    Status status = Status::OK;
+    {
+        Mutex::Autolock _l(d->mInflightLock);
+        if (hasInputBuf) {
+            int streamId = static_cast<Camera3Stream*>(hal_result->input_buffer->stream)->mId;
+            // validate if buffer is inflight
+            auto key = std::make_pair(streamId, frameNumber);
+            if (d->mInflightBuffers.count(key) != 1) {
+                ALOGE("%s: input buffer for stream %d frame %d is not inflight!",
+                        __FUNCTION__, streamId, frameNumber);
+                return;
+            }
+        }
+
+        for (size_t i = 0; i < numOutputBufs; i++) {
+            int streamId = static_cast<Camera3Stream*>(hal_result->output_buffers[i].stream)->mId;
+            // validate if buffer is inflight
+            auto key = std::make_pair(streamId, frameNumber);
+            if (d->mInflightBuffers.count(key) != 1) {
+                ALOGE("%s: output buffer for stream %d frame %d is not inflight!",
+                        __FUNCTION__, streamId, frameNumber);
+                return;
+            }
+        }
+    }
+    // We don't need to validate/import fences here since we will be passing them to camera service
+    // within the scope of this function
+
+    CaptureResult result;
+    hidl_vec<native_handle_t*> releaseFences;
+    releaseFences.resize(numBufs);
+    result.frameNumber = frameNumber;
+    result.partialResult = hal_result->partial_result;
+    convertToHidl(hal_result->result, &result.result);
+    if (hasInputBuf) {
+        result.inputBuffer.streamId =
+                static_cast<Camera3Stream*>(hal_result->input_buffer->stream)->mId;
+        result.inputBuffer.buffer = nullptr;
+        result.inputBuffer.status = (BufferStatus) hal_result->input_buffer->status;
+        // skip acquire fence since it's no use to camera service
+        if (hal_result->input_buffer->release_fence != -1) {
+            releaseFences[numOutputBufs] = native_handle_create(/*numFds*/1, /*numInts*/0);
+            releaseFences[numOutputBufs]->data[0] = hal_result->input_buffer->release_fence;
+            result.inputBuffer.releaseFence = releaseFences[numOutputBufs];
+        } else {
+            releaseFences[numOutputBufs] = nullptr;
+        }
+    } else {
+        result.inputBuffer.streamId = -1;
+    }
+
+    result.outputBuffers.resize(numOutputBufs);
+    for (size_t i = 0; i < numOutputBufs; i++) {
+        result.outputBuffers[i].streamId =
+                static_cast<Camera3Stream*>(hal_result->output_buffers[i].stream)->mId;
+        result.outputBuffers[i].buffer = nullptr;
+        result.outputBuffers[i].status = (BufferStatus) hal_result->output_buffers[i].status;
+        // skip acquire fence since it's of no use to camera service
+        if (hal_result->output_buffers[i].release_fence != -1) {
+            releaseFences[i] = native_handle_create(/*numFds*/1, /*numInts*/0);
+            releaseFences[i]->data[0] = hal_result->output_buffers[i].release_fence;
+            result.outputBuffers[i].releaseFence = releaseFences[i];
+        } else {
+            releaseFences[i] = nullptr;
+        }
+    }
+
+    // Free inflight record/fences.
+    // Do this before call back to camera service because camera service might jump to
+    // configure_streams right after the processCaptureResult call so we need to finish
+    // updating inflight queues first
+    {
+        Mutex::Autolock _l(d->mInflightLock);
+        if (hasInputBuf) {
+            int streamId = static_cast<Camera3Stream*>(hal_result->input_buffer->stream)->mId;
+            auto key = std::make_pair(streamId, frameNumber);
+            // 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);
+            // TODO (b/34169301): currently HAL closed the fence
+            //sHandleImporter.closeFence(d->mInflightBuffers[key].acquire_fence);
+            d->mInflightBuffers.erase(key);
+        }
+
+        if (d->mInflightBuffers.empty()) {
+            ALOGV("%s: inflight buffer queue is now empty!", __FUNCTION__);
+        }
+    }
+
+    d->mCallback->processCaptureResult(result);
+
+    for (size_t i = 0; i < releaseFences.size(); i++) {
+        // We don't close the FD here as HAL needs to signal it later.
+        native_handle_delete(releaseFences[i]);
+    }
+}
+
+void CameraDeviceSession::sNotify(
+        const camera3_callback_ops *cb,
+        const camera3_notify_msg *msg) {
+    CameraDeviceSession *d =
+            const_cast<CameraDeviceSession*>(static_cast<const CameraDeviceSession*>(cb));
+    NotifyMsg hidlMsg;
+    convertToHidl(msg, &hidlMsg);
+    if (hidlMsg.type == (MsgType) CAMERA3_MSG_ERROR &&
+            hidlMsg.msg.error.errorStreamId != -1) {
+        if (d->mStreamMap.count(hidlMsg.msg.error.errorStreamId) != 1) {
+            ALOGE("%s: unknown stream ID %d reports an error!",
+                    __FUNCTION__, hidlMsg.msg.error.errorStreamId);
+        }
+        return;
+    }
+    d->mCallback->notify(hidlMsg);
+}
+
+} // namespace implementation
+}  // namespace V3_2
+}  // namespace device
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
diff --git a/camera/device/3.2/default/CameraDeviceSession.h b/camera/device/3.2/default/CameraDeviceSession.h
new file mode 100644
index 0000000..498617e
--- /dev/null
+++ b/camera/device/3.2/default/CameraDeviceSession.h
@@ -0,0 +1,172 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_HARDWARE_CAMERA_DEVICE_V3_2_CAMERADEVICE3SESSION_H
+#define ANDROID_HARDWARE_CAMERA_DEVICE_V3_2_CAMERADEVICE3SESSION_H
+
+#include <unordered_map>
+#include "hardware/camera_common.h"
+#include "hardware/camera3.h"
+#include "utils/Mutex.h"
+#include <android/hardware/camera/device/3.2/ICameraDevice.h>
+#include <android/hardware/camera/device/3.2/ICameraDeviceSession.h>
+#include <hidl/Status.h>
+#include <hidl/MQDescriptor.h>
+#include <include/convert.h>
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace device {
+namespace V3_2 {
+namespace implementation {
+
+using ::android::hardware::camera::device::V3_2::CaptureRequest;
+using ::android::hardware::camera::device::V3_2::HalStreamConfiguration;
+using ::android::hardware::camera::device::V3_2::StreamConfiguration;
+using ::android::hardware::camera::device::V3_2::ICameraDeviceSession;
+using ::android::hardware::camera::common::V1_0::Status;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+using ::android::Mutex;
+
+/**
+ * Function pointer types with C calling convention to
+ * use for HAL callback functions.
+ */
+extern "C" {
+    typedef void (callbacks_process_capture_result_t)(
+        const struct camera3_callback_ops *,
+        const camera3_capture_result_t *);
+
+    typedef void (callbacks_notify_t)(
+        const struct camera3_callback_ops *,
+        const camera3_notify_msg_t *);
+}
+
+struct CameraDeviceSession : public ICameraDeviceSession, private camera3_callback_ops  {
+
+    CameraDeviceSession(camera3_device_t*, const sp<ICameraDeviceCallback>&);
+    ~CameraDeviceSession();
+    // Call by CameraDevice to dump active device states
+    void dumpState(const native_handle_t* fd);
+    // Caller must use this method to check if CameraDeviceSession ctor failed
+    bool isInitFailed() { return mInitFail; }
+    // Used by CameraDevice to signal external camera disconnected
+    void disconnect();
+    bool isClosed();
+
+    // Methods from ::android::hardware::camera::device::V3_2::ICameraDeviceSession follow.
+    Return<void> constructDefaultRequestSettings(RequestTemplate type, constructDefaultRequestSettings_cb _hidl_cb) override;
+    Return<void> configureStreams(const StreamConfiguration& requestedConfiguration, configureStreams_cb _hidl_cb) override;
+    Return<Status> processCaptureRequest(const CaptureRequest& request) override;
+    Return<Status> flush() override;
+    Return<void> close() override;
+
+private:
+    // protecting mClosed/mDisconnected/mInitFail
+    mutable Mutex mStateLock;
+    // device is closed either
+    //    - closed by user
+    //    - init failed
+    //    - camera disconnected
+    bool mClosed = false;
+
+    // Set by CameraDevice (when external camera is disconnected)
+    bool mDisconnected = false;
+
+    camera3_device_t* mDevice;
+    const sp<ICameraDeviceCallback> mCallback;
+    // Stream ID -> Camera3Stream cache
+    std::map<int, Camera3Stream> mStreamMap;
+
+    mutable Mutex mInflightLock; // protecting mInflightBuffers and mCirculatingBuffers
+    // (streamID, frameNumber) -> inflight buffer cache
+    std::map<std::pair<int, uint32_t>, camera3_stream_buffer_t>  mInflightBuffers;
+
+    struct BufferHasher {
+        size_t operator()(const buffer_handle_t& buf) const {
+            if (buf == nullptr)
+                return 0;
+
+            size_t result = 1;
+            result = 31 * result + buf->numFds;
+            result = 31 * result + buf->numInts;
+            int length = buf->numFds + buf->numInts;
+            for (int i = 0; i < length; i++) {
+                result = 31 * result + buf->data[i];
+            }
+            return result;
+        }
+    };
+
+    struct BufferComparator {
+        bool operator()(const buffer_handle_t& buf1, const buffer_handle_t& buf2) const {
+            if (buf1->numFds == buf2->numFds && buf1->numInts == buf2->numInts) {
+                int length = buf1->numFds + buf1->numInts;
+                for (int i = 0; i < length; i++) {
+                    if (buf1->data[i] != buf2->data[i]) {
+                        return false;
+                    }
+                }
+                return true;
+            }
+            return false;
+        }
+    };
+
+    // buffers currently ciculating between HAL and camera service
+    // key: buffer_handle_t sent via HIDL interface
+    // value: imported buffer_handle_t
+    // Buffer will be imported during process_capture_request and will be freed
+    // when the its stream is deleted or camera device session is closed
+    typedef std::unordered_map<buffer_handle_t, buffer_handle_t,
+            BufferHasher, BufferComparator> CirculatingBuffers;
+    // Stream ID -> circulating buffers map
+    std::map<int, CirculatingBuffers> mCirculatingBuffers;
+
+    bool mInitFail;
+    bool initialize();
+
+    Status initStatus() const;
+
+    // Validate and import request's input buffer and acquire fence
+    Status importRequest(
+            const CaptureRequest& request,
+            hidl_vec<buffer_handle_t*>& allBufPtrs,
+            hidl_vec<int>& allFences);
+
+    static void cleanupInflightFences(
+            hidl_vec<int>& allFences, size_t numFences);
+
+    /**
+     * Static callback forwarding methods from HAL to instance
+     */
+    static callbacks_process_capture_result_t sProcessCaptureResult;
+    static callbacks_notify_t sNotify;
+};
+
+}  // namespace implementation
+}  // namespace V3_2
+}  // namespace device
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_CAMERA_DEVICE_V3_2_CAMERADEVICE3SESSION_H
diff --git a/camera/device/3.2/default/convert.cpp b/camera/device/3.2/default/convert.cpp
new file mode 100644
index 0000000..35676df
--- /dev/null
+++ b/camera/device/3.2/default/convert.cpp
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "android.hardware.camera.device@3.2-convert-impl"
+#include <android/log.h>
+
+#include "include/convert.h"
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace device {
+namespace V3_2 {
+namespace implementation {
+
+using ::android::hardware::graphics::common::V1_0::Dataspace;
+using ::android::hardware::graphics::common::V1_0::PixelFormat;
+using ::android::hardware::camera::device::V3_2::ConsumerUsageFlags;
+using ::android::hardware::camera::device::V3_2::ProducerUsageFlags;
+
+bool convertFromHidl(const CameraMetadata &src, const camera_metadata_t** dst) {
+    if (src.size() == 0) {
+        // Special case for null metadata
+        *dst = nullptr;
+        return true;
+    }
+
+    const uint8_t* data = src.data();
+    // sanity check the size of CameraMetadata match underlying camera_metadata_t
+    if (get_camera_metadata_size((camera_metadata_t*)data) != src.size()) {
+        ALOGE("%s: input CameraMetadata is corrupt!", __FUNCTION__);
+        return false;
+    }
+    *dst = (camera_metadata_t*) data;
+    return true;
+}
+
+// Note: existing data in dst will be gone. Caller still owns the memory of src
+void convertToHidl(const camera_metadata_t *src, CameraMetadata* dst) {
+    if (src == nullptr) {
+        return;
+    }
+    size_t size = get_camera_metadata_size(src);
+    dst->setToExternal((uint8_t *) src, size);
+    return;
+}
+
+void convertFromHidl(const Stream &src, Camera3Stream* dst) {
+    dst->mId = src.id;
+    dst->stream_type = (int) src.streamType;
+    dst->width = src.width;
+    dst->height = src.height;
+    dst->format = (int) src.format;
+    dst->data_space = (android_dataspace_t) src.dataSpace;
+    dst->rotation = (int) src.rotation;
+    dst->usage = (uint32_t) src.usage;
+    // Fields to be filled by HAL (max_buffers, priv) are initialized to 0
+    dst->max_buffers = 0;
+    dst->priv = 0;
+    return;
+}
+
+void convertToHidl(const Camera3Stream* src, HalStream* dst) {
+    dst->id = src->mId;
+    dst->overrideFormat = (PixelFormat) src->format;
+    dst->maxBuffers = src->max_buffers;
+    if (src->stream_type == CAMERA3_STREAM_OUTPUT) {
+        dst->consumerUsage = (ConsumerUsageFlags) 0;
+        dst->producerUsage = (ProducerUsageFlags) src->usage;
+    } else if (src->stream_type == CAMERA3_STREAM_INPUT) {
+        dst->producerUsage = (ProducerUsageFlags) 0;
+        dst->consumerUsage = (ConsumerUsageFlags) src->usage;
+    } else {
+        //Should not reach here per current HIDL spec, but we might end up adding
+        // bi-directional stream to HIDL.
+        ALOGW("%s: Stream type %d is not currently supported!",
+                __FUNCTION__, src->stream_type);
+    }
+}
+
+void convertToHidl(const camera3_stream_configuration_t& src, HalStreamConfiguration* dst) {
+    dst->streams.resize(src.num_streams);
+    for (uint32_t i = 0; i < src.num_streams; i++) {
+        convertToHidl(static_cast<Camera3Stream*>(src.streams[i]), &dst->streams[i]);
+    }
+    return;
+}
+
+void convertFromHidl(
+        buffer_handle_t* bufPtr, BufferStatus status, camera3_stream_t* stream, int acquireFence,
+        camera3_stream_buffer_t* dst) {
+    dst->stream = stream;
+    dst->buffer = bufPtr;
+    dst->status = (int) status;
+    dst->acquire_fence = acquireFence;
+    dst->release_fence = -1; // meant for HAL to fill in
+}
+
+void convertToHidl(const camera3_notify_msg* src, NotifyMsg* dst) {
+    dst->type = (MsgType) src->type;
+    switch (src->type) {
+        case CAMERA3_MSG_ERROR:
+            {
+                // The camera3_stream_t* must be the same as what wrapper HAL passed to conventional
+                // HAL, or the ID lookup will return garbage. Caller should validate the ID here is
+                // indeed one of active stream IDs
+                Camera3Stream* stream = static_cast<Camera3Stream*>(
+                        src->message.error.error_stream);
+                dst->msg.error.frameNumber = src->message.error.frame_number;
+                dst->msg.error.errorStreamId = (stream != nullptr) ? stream->mId : -1;
+                dst->msg.error.errorCode = (ErrorCode) src->message.error.error_code;
+            }
+            break;
+        case CAMERA3_MSG_SHUTTER:
+            dst->msg.shutter.frameNumber = src->message.shutter.frame_number;
+            dst->msg.shutter.timestamp = src->message.shutter.timestamp;
+            break;
+        default:
+            ALOGE("%s: HIDL type converion failed. Unknown msg type 0x%x",
+                    __FUNCTION__, src->type);
+    }
+    return;
+}
+
+}  // namespace implementation
+}  // namespace V3_2
+}  // namespace device
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
diff --git a/camera/device/3.2/default/include/convert.h b/camera/device/3.2/default/include/convert.h
new file mode 100644
index 0000000..96891f0
--- /dev/null
+++ b/camera/device/3.2/default/include/convert.h
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+#ifndef HARDWARE_INTERFACES_CAMERA_DEVICE_V3_2_DEFAULT_INCLUDE_CONVERT_H_
+
+#define HARDWARE_INTERFACES_CAMERA_DEVICE_V3_2_DEFAULT_INCLUDE_CONVERT_H_
+
+#include <set>
+
+
+#include <android/hardware/graphics/common/1.0/types.h>
+#include <android/hardware/camera/device/3.2/types.h>
+#include "hardware/camera3.h"
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace device {
+namespace V3_2 {
+namespace implementation {
+
+// The camera3_stream_t sent to conventional HAL. Added mId fields to enable stream ID lookup
+// fromt a downcasted camera3_stream
+struct Camera3Stream : public camera3_stream {
+    int mId;
+};
+
+// *dst will point to the data owned by src, but src still owns the data after this call returns.
+bool convertFromHidl(const CameraMetadata &src, const camera_metadata_t** dst);
+void convertToHidl(const camera_metadata_t* src, CameraMetadata* dst);
+
+void convertFromHidl(const Stream &src, Camera3Stream* dst);
+void convertToHidl(const Camera3Stream* src, HalStream* dst);
+
+void convertFromHidl(
+        buffer_handle_t*, BufferStatus, camera3_stream_t*, int acquireFence, // inputs
+        camera3_stream_buffer_t* dst);
+
+void convertToHidl(const camera3_stream_configuration_t& src, HalStreamConfiguration* dst);
+
+// The camera3_stream_t* in src must be the same as what wrapper HAL passed to conventional
+// HAL, or the ID lookup will return garbage. Caller should validate the ID in ErrorMsg is
+// indeed one of active stream IDs
+void convertToHidl(const camera3_notify_msg* src, NotifyMsg* dst);
+
+}  // namespace implementation
+}  // namespace V3_2
+}  // namespace device
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HARDWARE_INTERFACES_CAMERA_DEVICE_V3_2_DEFAULT_INCLUDE_CONVERT_H_
diff --git a/camera/device/3.2/types.hal b/camera/device/3.2/types.hal
index a7ab4ab..1e0924c 100644
--- a/camera/device/3.2/types.hal
+++ b/camera/device/3.2/types.hal
@@ -403,7 +403,9 @@
  */
 struct StreamBuffer {
     /**
-     * The ID of the stream this buffer is associated with
+     * The ID of the stream this buffer is associated with. -1 indicates an
+     * invalid (empty) StreamBuffer, in which case buffer must also point to
+     * null.
      */
     int32_t streamId;
 
@@ -605,7 +607,7 @@
 };
 
 /**
- * MotifyMsg:
+ * NotifyMsg:
  *
  * The message structure sent to ICameraDevice3Callback::notify()
  */
diff --git a/camera/provider/2.4/ICameraProvider.hal b/camera/provider/2.4/ICameraProvider.hal
index 564167b..3015b7d 100644
--- a/camera/provider/2.4/ICameraProvider.hal
+++ b/camera/provider/2.4/ICameraProvider.hal
@@ -120,6 +120,30 @@
             generates (Status status, vec<string> cameraDeviceNames);
 
     /**
+     * isSetTorchModeSupported:
+     *
+     * Returns if the camera devices known to this camera provider support
+     * setTorchMode API or not. If the provider does not support setTorchMode
+     * API, calling to setTorchMode will return METHOD_NOT_SUPPORTED.
+     *
+     * Note that not every camera device has a flash unit, so even this API
+     * returns true, setTorchMode call might still fail due to the camera device
+     * does not have a flash unit. In such case, the returned status will be
+     * OPERATION_NOT_SUPPORTED.
+     *
+     * @return status Status code for the operation, one of:
+     *     OK:
+     *         On a succesful call
+     *     INTERNAL_ERROR:
+     *         Torch API support cannot be queried. This may be due to
+     *         a failure to initialize the camera subsystem, for example.
+     * @return support Whether the camera devices known to this provider
+     *     supports setTorchMode API or not.
+     *
+     */
+    isSetTorchModeSupported() generates (Status status, bool support);
+
+    /**
      * getCameraDeviceInterface_VN_x:
      *
      * Return a android.hardware.camera.device@N.x/ICameraDevice interface for
diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp
new file mode 100644
index 0000000..f28c9cd
--- /dev/null
+++ b/camera/provider/2.4/default/Android.bp
@@ -0,0 +1,23 @@
+cc_library_shared {
+    name: "android.hardware.camera.provider@2.4-impl",
+    relative_install_path: "hw",
+    srcs: ["CameraProvider.cpp"],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "libcutils",
+        "android.hardware.camera.device@1.0",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.camera.device@3.2-impl",
+        "android.hardware.camera.provider@2.4",
+        "android.hardware.camera.common@1.0",
+        "liblog",
+        "libhardware",
+        "libcamera_metadata"
+    ],
+    static_libs: [
+        "android.hardware.camera.common@1.0-helper"
+    ]
+}
diff --git a/camera/provider/2.4/default/CameraProvider.cpp b/camera/provider/2.4/default/CameraProvider.cpp
new file mode 100644
index 0000000..9617d8d
--- /dev/null
+++ b/camera/provider/2.4/default/CameraProvider.cpp
@@ -0,0 +1,411 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "CamProvider@2.4-impl"
+#include <android/log.h>
+
+#include <regex>
+
+#include "CameraProvider.h"
+#include "CameraDevice.h"
+#include <string.h>
+#include <utils/Trace.h>
+
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace provider {
+namespace V2_4 {
+namespace implementation {
+
+namespace {
+const char *kLegacyProviderName = "legacy/0";
+// "device@<version>/legacy/<id>"
+const std::regex kDeviceNameRE("device@([0-9]+\\.[0-9]+)/legacy/(.+)");
+const char *kHAL3_2 = "3.2";
+const char *kHAL1_0 = "1.0";
+const int kMaxCameraDeviceNameLen = 128;
+const int kMaxCameraIdLen = 16;
+
+} // anonymous namespace
+
+using ::android::hardware::camera::common::V1_0::CameraMetadataType;
+using ::android::hardware::camera::common::V1_0::Status;
+
+/**
+ * static callback forwarding methods from HAL to instance
+ */
+void CameraProvider::sCameraDeviceStatusChange(
+        const struct camera_module_callbacks* callbacks,
+        int camera_id,
+        int new_status) {
+    ALOGI("%s++", __FUNCTION__);
+    sp<CameraProvider> cp = const_cast<CameraProvider*>(
+            static_cast<const CameraProvider*>(callbacks));
+
+    if (cp == nullptr) {
+        ALOGE("%s: callback ops is null", __FUNCTION__);
+        return;
+    }
+
+    ALOGI("%s resolved provider %p", __FUNCTION__, cp.get());
+
+    Mutex::Autolock _l(cp->mCbLock);
+    char cameraId[kMaxCameraIdLen];
+    snprintf(cameraId, sizeof(cameraId), "%d", camera_id);
+    std::string cameraIdStr(cameraId);
+    cp->mCameraStatusMap[cameraIdStr] = (camera_device_status_t) new_status;
+    if (cp->mCallbacks != nullptr) {
+        CameraDeviceStatus status = (CameraDeviceStatus) new_status;
+        for (auto const& deviceNamePair : cp->mCameraDeviceNames) {
+            if (cameraIdStr.compare(deviceNamePair.first) == 0) {
+                cp->mCallbacks->cameraDeviceStatusChange(
+                        deviceNamePair.second, status);
+            }
+        }
+    }
+    ALOGI("%s--", __FUNCTION__);
+}
+
+void CameraProvider::sTorchModeStatusChange(
+        const struct camera_module_callbacks* callbacks,
+        const char* camera_id,
+        int new_status) {
+    ALOGI("%s++", __FUNCTION__);
+    sp<CameraProvider> cp = const_cast<CameraProvider*>(
+            static_cast<const CameraProvider*>(callbacks));
+
+    if (cp == nullptr) {
+        ALOGE("%s: callback ops is null", __FUNCTION__);
+        return;
+    }
+
+    ALOGI("%s resolved provider %p", __FUNCTION__, cp.get());
+
+    Mutex::Autolock _l(cp->mCbLock);
+    if (cp->mCallbacks != nullptr) {
+        std::string cameraIdStr(camera_id);
+        TorchModeStatus status = (TorchModeStatus) new_status;
+        for (auto const& deviceNamePair : cp->mCameraDeviceNames) {
+            if (cameraIdStr.compare(deviceNamePair.first) == 0) {
+                cp->mCallbacks->torchModeStatusChange(
+                        deviceNamePair.second, status);
+            }
+        }
+    }
+    ALOGI("%s--", __FUNCTION__);
+}
+
+Status CameraProvider::getHidlStatus(int status) {
+    switch (status) {
+        case 0: return Status::OK;
+        case -ENODEV: return Status::INTERNAL_ERROR;
+        case -EINVAL: return Status::ILLEGAL_ARGUMENT;
+        default:
+            ALOGE("%s: unknown HAL status code %d", __FUNCTION__, status);
+            return Status::INTERNAL_ERROR;
+    }
+}
+
+bool CameraProvider::matchDeviceName(const hidl_string& deviceName, std::smatch& sm) {
+    std::string deviceNameStd(deviceName.c_str());
+    return std::regex_match(deviceNameStd, sm, kDeviceNameRE);
+}
+
+std::string CameraProvider::getLegacyCameraId(const hidl_string& deviceName) {
+    std::smatch sm;
+    bool match = matchDeviceName(deviceName, sm);
+    if (!match) {
+        return std::string("");
+    }
+    return sm[2];
+}
+
+int CameraProvider::getCameraDeviceVersion(const hidl_string& deviceName) {
+    std::smatch sm;
+    bool match = matchDeviceName(deviceName, sm);
+    if (!match) {
+        return -1;
+    }
+    if (sm[1].compare(kHAL3_2) == 0) {
+        // maybe switched to 3.4 or define the hidl version enum later
+        return CAMERA_DEVICE_API_VERSION_3_2;
+    } else if (sm[1].compare(kHAL1_0) == 0) {
+        return CAMERA_DEVICE_API_VERSION_1_0;
+    }
+    return 0;
+}
+
+std::string CameraProvider::getHidlDeviceName(
+        std::string cameraId, int deviceVersion) {
+    // Maybe consider create a version check method and SortedVec to speed up?
+    if (deviceVersion != CAMERA_DEVICE_API_VERSION_1_0 &&
+            deviceVersion != CAMERA_DEVICE_API_VERSION_3_2 &&
+            deviceVersion != CAMERA_DEVICE_API_VERSION_3_3 &&
+            deviceVersion != CAMERA_DEVICE_API_VERSION_3_4 ) {
+        return hidl_string("");
+    }
+    const char* versionStr = (deviceVersion == CAMERA_DEVICE_API_VERSION_1_0) ? kHAL1_0 : kHAL3_2;
+    char deviceName[kMaxCameraDeviceNameLen];
+    snprintf(deviceName, sizeof(deviceName), "device@%s/legacy/%s",
+            versionStr, cameraId.c_str());
+    return deviceName;
+}
+
+CameraProvider::CameraProvider() :
+        camera_module_callbacks_t({sCameraDeviceStatusChange,
+                                   sTorchModeStatusChange}) {
+    mInitFailed = initialize();
+}
+
+CameraProvider::~CameraProvider() {}
+
+bool CameraProvider::initialize() {
+    camera_module_t *rawModule;
+    int err = hw_get_module(CAMERA_HARDWARE_MODULE_ID,
+            (const hw_module_t **)&rawModule);
+    if (err < 0) {
+        ALOGE("Could not load camera HAL module: %d (%s)", err, strerror(-err));
+        return true;
+    }
+
+    mModule = new CameraModule(rawModule);
+    err = mModule->init();
+    if (err != OK) {
+        ALOGE("Could not initialize camera HAL module: %d (%s)", err,
+            strerror(-err));
+        mModule.clear();
+        return true;
+    }
+    ALOGI("Loaded \"%s\" camera module", mModule->getModuleName());
+
+    mNumberOfLegacyCameras = mModule->getNumberOfCameras();
+    for (int i = 0; i < mNumberOfLegacyCameras; i++) {
+        char cameraId[kMaxCameraIdLen];
+        snprintf(cameraId, sizeof(cameraId), "%d", i);
+        std::string cameraIdStr(cameraId);
+        mCameraStatusMap[cameraIdStr] = CAMERA_DEVICE_STATUS_PRESENT;
+        mCameraIds.add(cameraIdStr);
+
+        // initialize mCameraDeviceNames and mOpenLegacySupported
+        mOpenLegacySupported[cameraIdStr] = false;
+        int deviceVersion = mModule->getDeviceVersion(i);
+        mCameraDeviceNames.add(
+                std::make_pair(cameraIdStr,
+                               getHidlDeviceName(cameraIdStr, deviceVersion)));
+        if (deviceVersion >= CAMERA_DEVICE_API_VERSION_3_2 &&
+                mModule->isOpenLegacyDefined()) {
+            // try open_legacy to see if it actually works
+            struct hw_device_t* halDev = nullptr;
+            int ret = mModule->openLegacy(cameraId, CAMERA_DEVICE_API_VERSION_1_0, &halDev);
+            if (ret == 0) {
+                mOpenLegacySupported[cameraIdStr] = true;
+                halDev->close(halDev);
+                mCameraDeviceNames.add(
+                        std::make_pair(cameraIdStr,
+                                getHidlDeviceName(cameraIdStr, CAMERA_DEVICE_API_VERSION_1_0)));
+            } else if (ret == -EBUSY || ret == -EUSERS) {
+                // Looks like this provider instance is not initialized during
+                // system startup and there are other camera users already.
+                // Not a good sign but not fatal.
+                ALOGW("%s: open_legacy try failed!", __FUNCTION__);
+            }
+        }
+    }
+
+    // Setup vendor tags here so HAL can setup vendor keys in camera characteristics
+    VendorTagDescriptor::clearGlobalVendorTagDescriptor();
+    bool setupSucceed = setUpVendorTags();
+    return !setupSucceed; // return flag here is mInitFailed
+}
+
+bool CameraProvider::setUpVendorTags() {
+    ATRACE_CALL();
+    vendor_tag_ops_t vOps = vendor_tag_ops_t();
+
+    // Check if vendor operations have been implemented
+    if (!mModule->isVendorTagDefined()) {
+        ALOGI("%s: No vendor tags defined for this device.", __FUNCTION__);
+        return false;
+    }
+
+    mModule->getVendorTagOps(&vOps);
+
+    // Ensure all vendor operations are present
+    if (vOps.get_tag_count == nullptr || vOps.get_all_tags == nullptr ||
+            vOps.get_section_name == nullptr || vOps.get_tag_name == nullptr ||
+            vOps.get_tag_type == nullptr) {
+        ALOGE("%s: Vendor tag operations not fully defined. Ignoring definitions."
+               , __FUNCTION__);
+        return false;
+    }
+
+    // Read all vendor tag definitions into a descriptor
+    sp<VendorTagDescriptor> desc;
+    status_t res;
+    if ((res = VendorTagDescriptor::createDescriptorFromOps(&vOps, /*out*/desc))
+            != OK) {
+        ALOGE("%s: Could not generate descriptor from vendor tag operations,"
+              "received error %s (%d). Camera clients will not be able to use"
+              "vendor tags", __FUNCTION__, strerror(res), res);
+        return false;
+    }
+
+    // Set the global descriptor to use with camera metadata
+    VendorTagDescriptor::setAsGlobalVendorTagDescriptor(desc);
+    const SortedVector<String8>* sectionNames = desc->getAllSectionNames();
+    size_t numSections = sectionNames->size();
+    std::vector<std::vector<VendorTag>> tagsBySection(numSections);
+    int tagCount = desc->getTagCount();
+    std::vector<uint32_t> tags(tagCount);
+    desc->getTagArray(tags.data());
+    for (int i = 0; i < tagCount; i++) {
+        VendorTag vt;
+        vt.tagId = tags[i];
+        vt.tagName = desc->getTagName(tags[i]);
+        vt.tagType = (CameraMetadataType) desc->getTagType(tags[i]);
+        ssize_t sectionIdx = desc->getSectionIndex(tags[i]);
+        tagsBySection[sectionIdx].push_back(vt);
+    }
+    mVendorTagSections.resize(numSections);
+    for (size_t s = 0; s < numSections; s++) {
+        mVendorTagSections[s].sectionName = (*sectionNames)[s].string();
+        mVendorTagSections[s].tags = tagsBySection[s];
+    }
+    return true;
+}
+
+// Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow.
+Return<Status> CameraProvider::setCallback(const sp<ICameraProviderCallback>& callback)  {
+    {
+        Mutex::Autolock _l(mCbLock);
+        mCallbacks = callback;
+    } // release lock here because HAL might send callbacks in setCallbacks call
+    return getHidlStatus(mModule->setCallbacks(this));
+}
+
+Return<void> CameraProvider::getVendorTags(getVendorTags_cb _hidl_cb)  {
+    _hidl_cb(Status::OK, mVendorTagSections);
+    return Void();
+}
+
+Return<void> CameraProvider::getCameraIdList(getCameraIdList_cb _hidl_cb)  {
+    std::vector<hidl_string> deviceNameList;
+    for (auto const& deviceNamePair : mCameraDeviceNames) {
+        if (mCameraStatusMap[deviceNamePair.first] == CAMERA_DEVICE_STATUS_PRESENT) {
+            deviceNameList.push_back(deviceNamePair.second);
+        }
+    }
+    hidl_vec<hidl_string> hidlDeviceNameList(deviceNameList);
+    _hidl_cb(Status::OK, hidlDeviceNameList);
+    return Void();
+}
+
+Return<void> CameraProvider::isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) {
+    bool support = mModule->isSetTorchModeSupported();
+    _hidl_cb (Status::OK, support);
+    return Void();
+}
+
+Return<void> CameraProvider::getCameraDeviceInterface_V1_x(
+        const hidl_string& /*cameraDeviceName*/, getCameraDeviceInterface_V1_x_cb /*_hidl_cb*/)  {
+    // TODO implement after device 1.0 is implemented
+    return Void();
+}
+
+Return<void> CameraProvider::getCameraDeviceInterface_V3_x(
+        const hidl_string& cameraDeviceName, getCameraDeviceInterface_V3_x_cb _hidl_cb)  {
+    std::smatch sm;
+    bool match = matchDeviceName(cameraDeviceName, sm);
+    if (!match) {
+        _hidl_cb(Status::ILLEGAL_ARGUMENT, nullptr);
+        return Void();
+    }
+
+    std::string cameraId = sm[2];
+    std::string deviceVersion = sm[1];
+    std::string deviceName(cameraDeviceName.c_str());
+    ssize_t index = mCameraDeviceNames.indexOf(std::make_pair(cameraId, deviceName));
+    if (index == NAME_NOT_FOUND) { // Either an illegal name or a device version mismatch
+        Status status = Status::OK;
+        ssize_t idx = mCameraIds.indexOf(cameraId);
+        if (idx == NAME_NOT_FOUND) {
+            ALOGE("%s: cannot find camera %s!", __FUNCTION__, cameraId.c_str());
+            status = Status::ILLEGAL_ARGUMENT;
+        } else { // invalid version
+            ALOGE("%s: camera device %s does not support version %s!",
+                    __FUNCTION__, cameraId.c_str(), deviceVersion.c_str());
+            status = Status::OPERATION_NOT_SUPPORTED;
+        }
+        _hidl_cb(status, nullptr);
+        return Void();
+    }
+
+    if (mCameraStatusMap.count(cameraId) == 0 ||
+            mCameraStatusMap[cameraId] != CAMERA_DEVICE_STATUS_PRESENT) {
+        _hidl_cb(Status::ILLEGAL_ARGUMENT, nullptr);
+        return Void();
+    }
+
+    // TODO: we also need to keep a wp list of all generated devices to notify
+    //       devices of device present status change, but then each device might
+    //       need a sp<provider> to keep provider alive until all device closed?
+    //       Problem: do we have external camera products to test this?
+    sp<android::hardware::camera::device::V3_2::implementation::CameraDevice> device =
+            new android::hardware::camera::device::V3_2::implementation::CameraDevice(
+                    mModule, cameraId, mCameraDeviceNames);
+
+    if (device == nullptr) {
+        ALOGE("%s: cannot allocate camera device for id %s", __FUNCTION__, cameraId.c_str());
+        _hidl_cb(Status::INTERNAL_ERROR, nullptr);
+        return Void();
+    }
+
+    if (device->isInitFailed()) {
+        ALOGE("%s: camera device %s init failed!", __FUNCTION__, cameraId.c_str());
+        device = nullptr;
+        _hidl_cb(Status::INTERNAL_ERROR, nullptr);
+        return Void();
+    }
+
+    _hidl_cb (Status::OK, device);
+    return Void();
+}
+
+ICameraProvider* HIDL_FETCH_ICameraProvider(const char* name) {
+    if (strcmp(name, kLegacyProviderName) != 0) {
+        return nullptr;
+    }
+    CameraProvider* provider = new CameraProvider();
+    if (provider == nullptr) {
+        ALOGE("%s: cannot allocate camera provider!", __FUNCTION__);
+        return nullptr;
+    }
+    if (provider->isInitFailed()) {
+        ALOGE("%s: camera provider init failed!", __FUNCTION__);
+        delete provider;
+        return nullptr;
+    }
+    return provider;
+}
+
+} // namespace implementation
+}  // namespace V2_4
+}  // namespace provider
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
diff --git a/camera/provider/2.4/default/CameraProvider.h b/camera/provider/2.4/default/CameraProvider.h
new file mode 100644
index 0000000..8497ff3
--- /dev/null
+++ b/camera/provider/2.4/default/CameraProvider.h
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
+#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
+
+#include "hardware/camera_common.h"
+#include "utils/Mutex.h"
+#include "utils/SortedVector.h"
+#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
+#include <hidl/Status.h>
+#include <hidl/MQDescriptor.h>
+#include "CameraModule.h"
+#include "VendorTagDescriptor.h"
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace provider {
+namespace V2_4 {
+namespace implementation {
+
+using ::android::hardware::camera::common::V1_0::CameraDeviceStatus;
+using ::android::hardware::camera::common::V1_0::Status;
+using ::android::hardware::camera::common::V1_0::TorchModeStatus;
+using ::android::hardware::camera::common::V1_0::VendorTag;
+using ::android::hardware::camera::common::V1_0::VendorTagSection;
+using ::android::hardware::camera::common::V1_0::helper::CameraModule;
+using ::android::hardware::camera::common::V1_0::helper::VendorTagDescriptor;
+using ::android::hardware::camera::provider::V2_4::ICameraProvider;
+using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+using ::android::Mutex;
+
+struct CameraProvider : public ICameraProvider, public camera_module_callbacks_t {
+    CameraProvider();
+    ~CameraProvider();
+
+    // Caller must use this method to check if CameraProvider ctor failed
+    bool isInitFailed() { return mInitFailed; }
+
+    // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow.
+    Return<Status> setCallback(const sp<ICameraProviderCallback>& callback) override;
+    Return<void> getVendorTags(getVendorTags_cb _hidl_cb) override;
+    Return<void> getCameraIdList(getCameraIdList_cb _hidl_cb) override;
+    Return<void> isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) override;
+    Return<void> getCameraDeviceInterface_V1_x(
+            const hidl_string& cameraDeviceName,
+            getCameraDeviceInterface_V1_x_cb _hidl_cb) override;
+    Return<void> getCameraDeviceInterface_V3_x(
+            const hidl_string& cameraDeviceName,
+            getCameraDeviceInterface_V3_x_cb _hidl_cb) override;
+
+private:
+    Mutex mCbLock;
+    sp<ICameraProviderCallback> mCallbacks = nullptr;
+
+    sp<CameraModule> mModule;
+
+    int mNumberOfLegacyCameras;
+    std::map<std::string, camera_device_status_t> mCameraStatusMap; // camera id -> status
+    std::map<std::string, bool> mOpenLegacySupported; // camera id -> open_legacy HAL1.0 supported
+    SortedVector<std::string> mCameraIds; // the "0"/"1" legacy camera Ids
+    // (cameraId string, hidl device name) pairs
+    SortedVector<std::pair<std::string, std::string>> mCameraDeviceNames;
+
+    // Must be queried before using any APIs.
+    // APIs will only work when this returns true
+    bool mInitFailed;
+    bool initialize();
+
+    hidl_vec<VendorTagSection> mVendorTagSections;
+    bool setUpVendorTags();
+
+    // extract legacy camera ID/device version from a HIDL device name
+    static bool matchDeviceName(const hidl_string& deviceName, std::smatch& sm);
+    static std::string getLegacyCameraId(const hidl_string& deviceName);
+    static int getCameraDeviceVersion(const hidl_string& deviceName);
+
+    // create HIDL device name from camera ID and device version
+    static std::string getHidlDeviceName(std::string cameraId, int deviceVersion);
+
+    // convert conventional HAL status to HIDL Status
+    static Status getHidlStatus(int);
+
+    // static callback forwarding methods
+    static void sCameraDeviceStatusChange(
+        const struct camera_module_callbacks* callbacks,
+        int camera_id,
+        int new_status);
+    static void sTorchModeStatusChange(
+        const struct camera_module_callbacks* callbacks,
+        const char* camera_id,
+        int new_status);
+};
+
+extern "C" ICameraProvider* HIDL_FETCH_ICameraProvider(const char* name);
+
+}  // namespace implementation
+}  // namespace V2_4
+}  // namespace provider
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
new file mode 100644
index 0000000..4947c17
--- /dev/null
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -0,0 +1,36 @@
+//
+// 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.
+//
+
+cc_test {
+    name: "camera_hidl_hal_test",
+    gtest: true,
+    srcs: ["camera_hidl_hal_test.cpp"],
+    shared_libs: [
+        "liblog",
+        "libhidlbase",
+        "libhidltransport",
+        "libcutils",
+        "libutils",
+        "android.hardware.camera.provider@2.4",
+        "android.hardware.camera.device@3.2",
+        "libcamera_metadata"
+    ],
+    static_libs: ["libgtest"],
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
diff --git a/camera/provider/2.4/vts/functional/camera_hidl_hal_test.cpp b/camera/provider/2.4/vts/functional/camera_hidl_hal_test.cpp
new file mode 100644
index 0000000..0eb291c
--- /dev/null
+++ b/camera/provider/2.4/vts/functional/camera_hidl_hal_test.cpp
@@ -0,0 +1,515 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "camera_hidl_hal_test"
+#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
+#include <android/hardware/camera/device/3.2/ICameraDevice.h>
+#include <android/log.h>
+#include <gtest/gtest.h>
+#include <regex>
+#include "system/camera_metadata.h"
+
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_handle;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::sp;
+using ::android::hardware::camera::common::V1_0::Status;
+using ::android::hardware::camera::common::V1_0::CameraDeviceStatus;
+using ::android::hardware::camera::common::V1_0::TorchMode;
+using ::android::hardware::camera::common::V1_0::TorchModeStatus;
+using ::android::hardware::camera::provider::V2_4::ICameraProvider;
+using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback;
+using ::android::hardware::camera::device::V3_2::CaptureRequest;
+using ::android::hardware::camera::device::V3_2::CaptureResult;
+using ::android::hardware::camera::device::V3_2::ICameraDeviceCallback;
+using ::android::hardware::camera::device::V3_2::ICameraDeviceSession;
+using ::android::hardware::camera::device::V3_2::NotifyMsg;
+using ::android::hardware::camera::device::V3_2::RequestTemplate;
+
+#define CAMERA_PASSTHROUGH_SERVICE_NAME "legacy/0"
+
+namespace {
+    // "device@<version>/legacy/<id>"
+    const char *kDeviceNameRE = "device@([0-9]+\\.[0-9]+)/legacy/(.+)";
+    const int CAMERA_DEVICE_API_VERSION_3_2 = 0x302;
+    const int CAMERA_DEVICE_API_VERSION_1_0 = 0x100;
+    const char *kHAL3_2 = "3.2";
+    const char *kHAL1_0 = "1.0";
+
+    bool matchDeviceName(const hidl_string& deviceName, std::smatch& sm) {
+        std::regex e(kDeviceNameRE);
+        std::string deviceNameStd(deviceName.c_str());
+        return std::regex_match(deviceNameStd, sm, e);
+    }
+
+    int getCameraDeviceVersion(const hidl_string& deviceName) {
+        std::smatch sm;
+        bool match = matchDeviceName(deviceName, sm);
+        if (!match) {
+            return -1;
+        }
+        if (sm[1].compare(kHAL3_2) == 0) {
+            // maybe switched to 3.4 or define the hidl version enumlater
+            return CAMERA_DEVICE_API_VERSION_3_2;
+        } else if (sm[1].compare(kHAL1_0) == 0) {
+            return CAMERA_DEVICE_API_VERSION_1_0;
+        }
+        return 0;
+    }
+}
+
+// Test environment for camera
+class CameraHidlEnvironment : public ::testing::Environment {
+public:
+    // get the test environment singleton
+    static CameraHidlEnvironment* Instance() {
+        static CameraHidlEnvironment* instance = new CameraHidlEnvironment;
+        return instance;
+    }
+
+    virtual void SetUp() override;
+    virtual void TearDown() override;
+
+    sp<ICameraProvider> mProvider;
+
+private:
+    CameraHidlEnvironment() {}
+
+    GTEST_DISALLOW_COPY_AND_ASSIGN_(CameraHidlEnvironment);
+};
+
+void CameraHidlEnvironment::SetUp() {
+    // TODO: test the binderized mode
+    mProvider = ICameraProvider::getService(CAMERA_PASSTHROUGH_SERVICE_NAME, true);
+    // TODO: handle the device doesn't have any camera case
+    ALOGI_IF(mProvider, "provider is not nullptr, %p", mProvider.get());
+    ASSERT_NE(mProvider, nullptr);
+}
+
+void CameraHidlEnvironment::TearDown() {
+    ALOGI("TearDown CameraHidlEnvironment");
+}
+
+// The main test class for camera HIDL HAL.
+class CameraHidlTest : public ::testing::Test {
+public:
+    virtual void SetUp() override {}
+    virtual void TearDown() override {}
+
+    hidl_vec<hidl_string> getCameraDeviceNames();
+
+    struct EmptyDeviceCb : public ICameraDeviceCallback {
+        virtual Return<void> processCaptureResult(const CaptureResult& /*result*/) override {
+            ALOGI("processCaptureResult callback");
+            ADD_FAILURE(); // Empty callback should not reach here
+            return Void();
+        }
+
+        virtual Return<void> notify(const NotifyMsg& /*msg*/) override {
+            ALOGI("notify callback");
+            ADD_FAILURE(); // Empty callback should not reach here
+            return Void();
+        }
+    };
+};
+
+hidl_vec<hidl_string> CameraHidlTest::getCameraDeviceNames() {
+    CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+    hidl_vec<hidl_string> cameraDeviceNames;
+    env->mProvider->getCameraIdList(
+        [&](auto status, const auto& idList) {
+            ALOGI("getCameraIdList returns status:%d", (int)status);
+            for (size_t i = 0; i < idList.size(); i++) {
+                ALOGI("Camera Id[%zu] is %s", i, idList[i].c_str());
+            }
+            ASSERT_EQ(Status::OK, status);
+            cameraDeviceNames = idList;
+        });
+    return cameraDeviceNames;
+}
+
+// Test if ICameraProvider::isTorchModeSupported returns Status::OK
+TEST_F(CameraHidlTest, isTorchModeSupported) {
+    CameraHidlEnvironment::Instance()->mProvider->isSetTorchModeSupported(
+        [&](auto status, bool support) {
+            ALOGI("isSetTorchModeSupported returns status:%d supported:%d",
+                    (int)status, support);
+            ASSERT_EQ(Status::OK, status);
+        });
+}
+
+// TODO: consider removing this test if getCameraDeviceNames() has the same coverage
+TEST_F(CameraHidlTest, getCameraIdList) {
+    CameraHidlEnvironment::Instance()->mProvider->getCameraIdList(
+        [&](auto status, const auto& idList) {
+            ALOGI("getCameraIdList returns status:%d", (int)status);
+            for (size_t i = 0; i < idList.size(); i++) {
+                ALOGI("Camera Id[%zu] is %s", i, idList[i].c_str());
+            }
+            ASSERT_EQ(Status::OK, status);
+            // This is true for internal camera provider.
+            // Not necessary hold for external cameras providers
+            ASSERT_GT(idList.size(), 0u);
+        });
+}
+
+// Test if ICameraProvider::getVendorTags returns Status::OK
+TEST_F(CameraHidlTest, getVendorTags) {
+    CameraHidlEnvironment::Instance()->mProvider->getVendorTags(
+        [&](auto status, const auto& vendorTagSecs) {
+            ALOGI("getVendorTags returns status:%d numSections %zu",
+                    (int)status, vendorTagSecs.size());
+            for (size_t i = 0; i < vendorTagSecs.size(); i++) {
+                ALOGI("Vendor tag section %zu name %s",
+                        i, vendorTagSecs[i].sectionName.c_str());
+                for (size_t j = 0; j < vendorTagSecs[i].tags.size(); j++) {
+                    const auto& tag = vendorTagSecs[i].tags[j];
+                    ALOGI("Vendor tag id %u name %s type %d",
+                            tag.tagId,
+                            tag.tagName.c_str(),
+                            (int) tag.tagType);
+                }
+            }
+            ASSERT_EQ(Status::OK, status);
+        });
+}
+
+// Test if ICameraProvider::setCallback returns Status::OK
+TEST_F(CameraHidlTest, setCallback) {
+    CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+    struct ProviderCb : public ICameraProviderCallback {
+        virtual Return<void> cameraDeviceStatusChange(
+                const hidl_string& cameraDeviceName,
+                CameraDeviceStatus newStatus) override {
+            ALOGI("camera device status callback name %s, status %d",
+                    cameraDeviceName.c_str(), (int) newStatus);
+            return Void();
+        }
+
+        virtual Return<void> torchModeStatusChange(
+                const hidl_string& cameraDeviceName,
+                TorchModeStatus newStatus) override {
+            ALOGI("Torch mode status callback name %s, status %d",
+                    cameraDeviceName.c_str(), (int) newStatus);
+            return Void();
+        }
+    };
+    sp<ProviderCb> cb = new ProviderCb;
+    auto status = env->mProvider->setCallback(cb);
+    ASSERT_EQ(Status::OK, status);
+    // TODO: right now no callbacks are fired because there is no external camera
+    //       or torch mode change. Need to test torch API in CameraDevice test later.
+}
+
+// Test if ICameraProvider::getCameraDeviceInterface_V3_x returns Status::OK and non-null device
+TEST_F(CameraHidlTest, getCameraDeviceInterface_V3_x) {
+    CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
+            env->mProvider->getCameraDeviceInterface_V3_x(
+                name,
+                [&](auto status, const auto& device3_2) {
+                    ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device3_2, nullptr);
+                });
+        }
+    }
+}
+
+TEST_F(CameraHidlTest, getResourceCost) {
+    CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
+            ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+            ALOGI("getResourceCost: Testing camera device %s", name.c_str());
+            env->mProvider->getCameraDeviceInterface_V3_x(
+                name,
+                [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device3_2 = device;
+                });
+
+            device3_2->getResourceCost(
+                [&](auto status, const auto& resourceCost) {
+                    ALOGI("getResourceCost returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ALOGI("    Resource cost is %d", resourceCost.resourceCost);
+                    ASSERT_LE(resourceCost.resourceCost, 100u);
+                    for (const auto& name : resourceCost.conflictingDevices) {
+                        ALOGI("    Conflicting device: %s", name.c_str());
+                    }
+                });
+        }
+    }
+}
+
+TEST_F(CameraHidlTest, getCameraCharacteristics) {
+    CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
+            ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+            ALOGI("getCameraCharacteristics: Testing camera device %s", name.c_str());
+            env->mProvider->getCameraDeviceInterface_V3_x(
+                name,
+                [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device3_2 = device;
+                });
+
+            device3_2->getCameraCharacteristics(
+                [&](auto status, const auto& chars) {
+                    ALOGI("getCameraCharacteristics returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    const camera_metadata_t* metadata = (camera_metadata_t*) chars.data();
+                    size_t expectedSize = chars.size();
+                    ASSERT_EQ(0, validate_camera_metadata_structure(metadata, &expectedSize));
+                    size_t entryCount = get_camera_metadata_entry_count(metadata);
+                    // TODO: we can do better than 0 here. Need to check how many required
+                    // characteristics keys we've defined.
+                    ASSERT_GT(entryCount, 0u);
+                    ALOGI("getCameraCharacteristics metadata entry count is %zu", entryCount);
+                });
+        }
+    }
+}
+
+TEST_F(CameraHidlTest, setTorchMode) {
+    CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+    bool torchControlSupported = false;
+
+    CameraHidlEnvironment::Instance()->mProvider->isSetTorchModeSupported(
+        [&](auto status, bool support) {
+            ALOGI("isSetTorchModeSupported returns status:%d supported:%d",
+                    (int)status, support);
+            ASSERT_EQ(Status::OK, status);
+            torchControlSupported = support;
+        });
+
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
+            ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+            ALOGI("setTorchMode: Testing camera device %s", name.c_str());
+            env->mProvider->getCameraDeviceInterface_V3_x(
+                name,
+                [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device3_2 = device;
+                });
+
+            Status status = device3_2->setTorchMode(TorchMode::ON);
+            ALOGI("setTorchMode return status %d", (int)status);
+            if (!torchControlSupported) {
+                ASSERT_EQ(Status::METHOD_NOT_SUPPORTED, status);
+            } else {
+                ASSERT_TRUE(status == Status::OK || status == Status::OPERATION_NOT_SUPPORTED);
+                if (status == Status::OK) {
+                    status = device3_2->setTorchMode(TorchMode::OFF);
+                    ASSERT_EQ(Status::OK, status);
+                }
+            }
+        }
+    }
+}
+
+TEST_F(CameraHidlTest, dumpState) {
+    CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
+            ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+            ALOGI("dumpState: Testing camera device %s", name.c_str());
+            env->mProvider->getCameraDeviceInterface_V3_x(
+                name,
+                [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device3_2 = device;
+                });
+
+            native_handle_t* raw_handle = native_handle_create(1, 0);
+            raw_handle->data[0] = 1; // std out
+            hidl_handle handle = raw_handle;
+            device3_2->dumpState(handle);
+            native_handle_delete(raw_handle);
+        }
+    }
+}
+
+// Open, dumpStates, then close
+TEST_F(CameraHidlTest, openClose) {
+    CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
+            ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+            ALOGI("openClose: Testing camera device %s", name.c_str());
+            env->mProvider->getCameraDeviceInterface_V3_x(
+                name,
+                [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device3_2 = device;
+                });
+
+            sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
+            sp<ICameraDeviceSession> session;
+            device3_2->open(
+                cb,
+                [&](auto status, const auto& newSession) {
+                    ALOGI("device::open returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(newSession, nullptr);
+                    session = newSession;
+                });
+
+            native_handle_t* raw_handle = native_handle_create(1, 0);
+            raw_handle->data[0] = 1; // std out
+            hidl_handle handle = raw_handle;
+            device3_2->dumpState(handle);
+            native_handle_delete(raw_handle);
+
+            session->close();
+            // TODO: test all session API calls return INTERNAL_ERROR after close
+            // TODO: keep a wp copy here and verify session cannot be promoted out of this scope
+        }
+    }
+}
+
+TEST_F(CameraHidlTest, constructDefaultRequestSettings) {
+    CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
+            ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+            ALOGI("constructDefaultRequestSettings: Testing camera device %s", name.c_str());
+            env->mProvider->getCameraDeviceInterface_V3_x(
+                name,
+                [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device3_2 = device;
+                });
+
+            sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
+            sp<ICameraDeviceSession> session;
+            device3_2->open(
+                cb,
+                [&](auto status, const auto& newSession) {
+                    ALOGI("device::open returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(newSession, nullptr);
+                    session = newSession;
+                });
+
+            for (uint32_t t = (uint32_t) RequestTemplate::PREVIEW;
+                    t <= (uint32_t) RequestTemplate::MANUAL; t++) {
+                RequestTemplate reqTemplate = (RequestTemplate) t;
+                session->constructDefaultRequestSettings(
+                    reqTemplate,
+                    [&](auto status, const auto& req) {
+                        ALOGI("constructDefaultRequestSettings returns status:%d", (int)status);
+                        if (reqTemplate == RequestTemplate::ZERO_SHUTTER_LAG ||
+                                reqTemplate == RequestTemplate::MANUAL) {
+                            // optional templates
+                            ASSERT_TRUE(status == Status::OK || status == Status::ILLEGAL_ARGUMENT);
+                        } else {
+                            ASSERT_EQ(Status::OK, status);
+                        }
+
+                        if (status == Status::OK) {
+                            const camera_metadata_t* metadata =
+                                (camera_metadata_t*) req.data();
+                            size_t expectedSize = req.size();
+                            ASSERT_EQ(0, validate_camera_metadata_structure(
+                                    metadata, &expectedSize));
+                            size_t entryCount = get_camera_metadata_entry_count(metadata);
+                            // TODO: we can do better than 0 here. Need to check how many required
+                            // request keys we've defined for each template
+                            ASSERT_GT(entryCount, 0u);
+                            ALOGI("template %u metadata entry count is %zu", t, entryCount);
+                        } else {
+                            ASSERT_EQ(0u, req.size());
+                        }
+                    });
+            }
+            session->close();
+        }
+    }
+}
+
+TEST_F(CameraHidlTest, configureStreams) {
+    CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
+            ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+            ALOGI("configureStreams: Testing camera device %s", name.c_str());
+            env->mProvider->getCameraDeviceInterface_V3_x(
+                name,
+                [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device3_2 = device;
+                });
+
+            sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
+            sp<ICameraDeviceSession> session;
+            device3_2->open(
+                cb,
+                [&](auto status, const auto& newSession) {
+                    ALOGI("device::open returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(newSession, nullptr);
+                    session = newSession;
+                });
+
+
+            session->close();
+        }
+    }
+}
+
+int main(int argc, char **argv) {
+  ::testing::AddGlobalTestEnvironment(CameraHidlEnvironment::Instance());
+  ::testing::InitGoogleTest(&argc, argv);
+  int status = RUN_ALL_TESTS();
+  ALOGI("Test result = %d", status);
+  return status;
+}
diff --git a/contexthub/1.0/types.hal b/contexthub/1.0/types.hal
index 043bb39..c8ea623 100644
--- a/contexthub/1.0/types.hal
+++ b/contexthub/1.0/types.hal
@@ -20,12 +20,11 @@
     OK,                  // Success
     UNKNOWN_FAILURE,     // Failure, unknown reason
     BAD_PARAMS,          // Parameters not sane
-    NOT_INIT,            // not initialized
-    TRANSACTION_FAILED,  // transaction failed
+    NOT_INIT,            // Not initialized
+    TRANSACTION_FAILED,  // Transaction failed
     TRANSACTION_PENDING, // Pending transaction, cannot accept a new request
 };
 
-
 enum NanoAppFlags : uint32_t {
     SIGNED = (1<<0),   // Signed nanoapp
     ENCRYPTED = (1<<1),// Encrypted nanoapp
@@ -34,11 +33,12 @@
 struct NanoAppBinary {
     uint32_t headerVersion;    // 0x1 for this version
     uint32_t magic;            // "NANO"
-    uint64_t appId;            // App Id contains vendor id
+    uint64_t appId;            // App ID (contains vendor ID in most significant
+                               // 5 bytes)
     uint32_t appVersion;       // Version of the app
-    uint32_t flags;            // mask of NanoAppFlags
-    uint64_t hwHubType;        // which hub type is this compiled for
-                               // a unique UUID for each h/w + toolchain
+    uint32_t flags;            // Mask of NanoAppFlags
+    uint64_t hwHubType;        // Which hub type is this app is compiled for. A
+                               // unique ID for each h/w + toolchain
                                // combination.
     vec<uint8_t> customBinary; // start of custom binary data
 };
@@ -82,38 +82,38 @@
                                  // definition may be different from say the
                                  // number advertised in the sensors HAL
                                  // which allows for batching in a hub.
-    uint32_t fifoMaxCount;       // maximum number of batchable events.
-    uint64_t minDelayMs;         // in milliseconds, corresponding to highest
+    uint32_t fifoMaxCount;       // Maximum number of batchable events.
+    uint64_t minDelayMs;         // In milliseconds, corresponding to highest
                                  // sampling freq.
-    uint64_t maxDelayMs;         // in milliseconds, corresponds to minimum
+    uint64_t maxDelayMs;         // In milliseconds, corresponds to minimum
                                  // sampling frequency
     float peakPowerMw;           // At max frequency & no batching, power
                                  // in milliwatts
 };
 
 struct ContextHub {
-    string name;                // descriptive name eg: "Awesome Hub #1"
-    string vendor;              // hub hardware vendor eg: "Qualcomm"
-    string toolchain;           // toolchain to make binaries eg: "gcc ARM"
+    string name;                // Descriptive name eg: "Awesome Hub #1"
+    string vendor;              // Hub hardware vendor eg: "Qualcomm"
+    string toolchain;           // Toolchain to make binaries eg: "gcc ARM"
     uint32_t platformVersion;   // Version of the hardware : eg 0x20
     uint32_t toolchainVersion;  // Version of the toolchain : eg: 0x484
-    uint32_t hubId;             // a device unique id for this hub
+    uint32_t hubId;             // A device unique ID for this hub
 
     float peakMips;             // Peak MIPS platform can deliver
-    float stoppedPowerDrawMw;   // if stopped, retention power, milliwatts
-    float sleepPowerDrawMw;     // if sleeping, retention power, milliwatts
-    float peakPowerDrawMw;      // for a busy CPUm power in milliwatts
+    float stoppedPowerDrawMw;   // If stopped, retention power, milliwatts
+    float sleepPowerDrawMw;     // If sleeping, retention power, milliwatts
+    float peakPowerDrawMw;      // For a busy CPU, power in milliwatts
 
-    vec<PhysicalSensor> connectedSensors; // array of connected sensors
+    vec<PhysicalSensor> connectedSensors; // Array of connected sensors
 
     uint32_t maxSupportedMsgLen;// This is the maximum size of the message that can
                                 // be sent to the hub in one chunk (in bytes)
 };
 
 struct ContextHubMsg {
-    uint64_t appName; // intended recipient
-    uint32_t msgType; // identifier for message
-    vec<uint8_t> msg; // message body
+    uint64_t appName; // Intended recipient (appId)
+    uint32_t msgType; // Identifier for message
+    vec<uint8_t> msg; // Message body
 };
 
 enum HubMemoryType : uint32_t {
@@ -129,24 +129,26 @@
 };
 
 struct MemRange {
-    uint32_t totalBytes; // total capacity in bytes
-    uint32_t freeBytes;  // free capacity in bytes
-    HubMemoryType type;  // type of memory, see HubMemoryType
-    uint32_t flags;      // mask of HubMemoryFlag
+    uint32_t totalBytes; // Total capacity in bytes
+    uint32_t freeBytes;  // Free capacity in bytes
+    HubMemoryType type;  // Type of memory, see HubMemoryType
+    uint32_t flags;      // Mask of HubMemoryFlag
 };
 
 enum AsyncEventType : uint32_t {
-    RESTARTED = 1, // Hub restarted unexpectedly
+    RESTARTED = 1,   // Hub restarted unexpectedly
 };
 
 enum TransactionResult : int32_t {
-    SUCCESS,      // successful completion of transaction
-    FAILURE,      // failed transaction
+    SUCCESS,      // Successful completion of transaction
+    FAILURE,      // Failed transaction
 };
 
 struct HubAppInfo {
     uint64_t appId;         // Identifier of the app
-    uint32_t version;       // version of the app
+    uint32_t version;       // Version of the app
     vec<MemRange> memUsage; // Memory used by this app
+    bool enabled;           // true if the app is currently enabled and running,
+                            // or false if in the loaded but disabled state
 };
 
diff --git a/evs/1.0/default/EvsCamera.cpp b/evs/1.0/default/EvsCamera.cpp
index 32d4ed7..6715a2e 100644
--- a/evs/1.0/default/EvsCamera.cpp
+++ b/evs/1.0/default/EvsCamera.cpp
@@ -48,14 +48,14 @@
 
     // Set up dummy data for testing
     if (mDescription.cameraId == kCameraName_Backup) {
-        mDescription.hints                  = UsageHint::USAGE_HINT_REVERSE;
+        mDescription.hints                  = static_cast<uint32_t>(UsageHint::USAGE_HINT_REVERSE);
         mDescription.vendorFlags            = 0xFFFFFFFF;   // Arbitrary value
         mDescription.defaultHorResolution   = 320;          // 1/2 NTSC/VGA
         mDescription.defaultVerResolution   = 240;          // 1/2 NTSC/VGA
     }
     else if (mDescription.cameraId == kCameraName_RightTurn) {
         // Nothing but the name and the usage hint
-        mDescription.hints                  = UsageHint::USAGE_HINT_RIGHT_TURN;
+        mDescription.hints                  = static_cast<uint32_t>(UsageHint::USAGE_HINT_RIGHT_TURN);
     }
     else {
         // Leave empty for a minimalist camera description without even a hint
@@ -149,7 +149,7 @@
     return EvsResult::OK;
 }
 
-Return<EvsResult> EvsCamera::doneWithFrame(uint32_t frameId, const hidl_handle& bufferHandle)  {
+Return<EvsResult> EvsCamera::doneWithFrame(uint32_t /* frameId */, const hidl_handle& bufferHandle)  {
     ALOGD("doneWithFrame");
     std::lock_guard<std::mutex> lock(mAccessLock);
 
diff --git a/evs/1.0/default/EvsEnumerator.cpp b/evs/1.0/default/EvsEnumerator.cpp
index 9f38041..ba8da00 100644
--- a/evs/1.0/default/EvsEnumerator.cpp
+++ b/evs/1.0/default/EvsEnumerator.cpp
@@ -62,8 +62,7 @@
     return Void();
 }
 
-Return<void> EvsEnumerator::openCamera(const hidl_string& cameraId,
-                                             openCamera_cb callback) {
+Return<sp<IEvsCamera>> EvsEnumerator::openCamera(const hidl_string& cameraId) {
     ALOGD("openCamera");
 
     // Find the named camera
@@ -78,20 +77,18 @@
 
     if (!pRecord) {
         ALOGE("Requested camera %s not found", cameraId.c_str());
-        callback(nullptr);
+        return nullptr;
     }
     else if (pRecord->inUse) {
         ALOGE("Cannot open camera %s which is already in use", cameraId.c_str());
-        callback(nullptr);
+        return nullptr;
     }
     else {
         /* TODO(b/33492405):  Do this, When HIDL can give us back a recognizable pointer
         pRecord->inUse = true;
          */
-        callback(pRecord->pCamera);
+        return(pRecord->pCamera);
     }
-
-    return Void();
 }
 
 Return<void> EvsEnumerator::closeCamera(const ::android::sp<IEvsCamera>& camera) {
@@ -112,22 +109,20 @@
     return Void();
 }
 
-Return<void> EvsEnumerator::openDisplay(openDisplay_cb callback) {
+Return<sp<IEvsDisplay>> EvsEnumerator::openDisplay() {
     ALOGD("openDisplay");
 
     // If we already have a display active, then this request must be denied
     if (mActiveDisplay != nullptr) {
         ALOGW("Rejecting openDisplay request the display is already in use.");
-        callback(nullptr);
+        return nullptr;
     }
     else {
         // Create a new display interface and return it
         mActiveDisplay = new EvsDisplay();
         ALOGD("Returning new EvsDisplay object %p", mActiveDisplay.get());
-        callback(mActiveDisplay);
+        return mActiveDisplay;
     }
-
-    return Void();
 }
 
 Return<void> EvsEnumerator::closeDisplay(const ::android::sp<IEvsDisplay>& display) {
diff --git a/evs/1.0/default/EvsEnumerator.h b/evs/1.0/default/EvsEnumerator.h
index 69caa17..90df837 100644
--- a/evs/1.0/default/EvsEnumerator.h
+++ b/evs/1.0/default/EvsEnumerator.h
@@ -34,9 +34,9 @@
 public:
     // Methods from ::android::hardware::evs::V1_0::IEvsEnumerator follow.
     Return<void> getCameraList(getCameraList_cb _hidl_cb)  override;
-    Return<void> openCamera(const hidl_string& cameraId, openCamera_cb callback)  override;
+    Return<sp<IEvsCamera>> openCamera(const hidl_string& cameraId) override;
     Return<void> closeCamera(const ::android::sp<IEvsCamera>& carCamera)  override;
-    Return<void> openDisplay(openDisplay_cb callback)  override;
+    Return<sp<IEvsDisplay>> openDisplay()  override;
     Return<void> closeDisplay(const ::android::sp<IEvsDisplay>& display)  override;
 
     // Implementation details
diff --git a/evs/1.0/types.hal b/evs/1.0/types.hal
index e0051e1..fd9dcdc 100644
--- a/evs/1.0/types.hal
+++ b/evs/1.0/types.hal
@@ -32,7 +32,6 @@
     USAGE_HINT_REVERSE      = 0x00000001,
     USAGE_HINT_LEFT_TURN    = 0x00000002,
     USAGE_HINT_RIGHT_TURN   = 0x00000004,
-    // remaining bits are reserved for future use
 };
 
 
@@ -48,11 +47,11 @@
  * should be set to ZERO.
  */
 struct CameraDesc {
-    string      cameraId;
-    UsageHint   hints;                  // Bit flags (legal to | values together) (TODO: b/31702236)
-    uint32_t    vendorFlags;            // Opaque value from driver
-    uint32_t    defaultHorResolution;   // Units of pixels
-    uint32_t    defaultVerResolution;   // Units of pixels
+    string              cameraId;
+    bitfield<UsageHint> hints;                  // Mask of usage hints
+    uint32_t            vendorFlags;            // Opaque value from driver
+    uint32_t            defaultHorResolution;   // Units of pixels
+    uint32_t            defaultVerResolution;   // Units of pixels
 };
 
 
@@ -90,7 +89,6 @@
 
 
 /* Error codes used in EVS HAL interface. */
-/* TODO:  Adopt a common set of function return codes */
 enum EvsResult : uint32_t {
     OK = 0,
     INVALID_ARG,
diff --git a/gatekeeper/1.0/vts/functional/gatekeeper_hidl_hal_test.cpp b/gatekeeper/1.0/vts/functional/gatekeeper_hidl_hal_test.cpp
index e919b48..09690f8 100644
--- a/gatekeeper/1.0/vts/functional/gatekeeper_hidl_hal_test.cpp
+++ b/gatekeeper/1.0/vts/functional/gatekeeper_hidl_hal_test.cpp
@@ -85,7 +85,7 @@
       auto ret = gatekeeper_->enroll(
           uid_, req.curPwdHandle, req.curPwd, req.newPwd,
           [&rsp](const GatekeeperResponse &cbRsp) { rsp = cbRsp; });
-      ASSERT_TRUE(ret.getStatus().isOk());
+      ASSERT_TRUE(ret.isOk());
       if (rsp.code != GatekeeperStatusCode::ERROR_RETRY_TIMEOUT) break;
       ALOGI("%s: got retry code; retrying in 1 sec", __func__);
       sleep(1);
@@ -97,7 +97,7 @@
       auto ret = gatekeeper_->verify(
           uid_, req.challenge, req.curPwdHandle, req.newPwd,
           [&rsp](const GatekeeperResponse &cb_rsp) { rsp = cb_rsp; });
-      ASSERT_TRUE(ret.getStatus().isOk());
+      ASSERT_TRUE(ret.isOk());
       if (rsp.code != GatekeeperStatusCode::ERROR_RETRY_TIMEOUT) break;
       ALOGI("%s: got retry code; retrying in 1 sec", __func__);
       sleep(1);
@@ -108,7 +108,7 @@
     while (true) {
       auto ret = gatekeeper_->deleteUser(
           uid_, [&rsp](const GatekeeperResponse &cb_rsp) { rsp = cb_rsp; });
-      ASSERT_TRUE(ret.getStatus().isOk());
+      ASSERT_TRUE(ret.isOk());
       if (rsp.code != GatekeeperStatusCode::ERROR_RETRY_TIMEOUT) break;
       ALOGI("%s: got retry code; retrying in 1 sec", __func__);
       sleep(1);
@@ -119,7 +119,7 @@
     while (true) {
       auto ret = gatekeeper_->deleteAllUsers(
           [&rsp](const GatekeeperResponse &cb_rsp) { rsp = cb_rsp; });
-      ASSERT_TRUE(ret.getStatus().isOk());
+      ASSERT_TRUE(ret.isOk());
       if (rsp.code != GatekeeperStatusCode::ERROR_RETRY_TIMEOUT) break;
       ALOGI("%s: got retry code; retrying in 1 sec", __func__);
       sleep(1);
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/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/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 66be37e..28a1950 100644
--- a/gnss/1.0/default/Gnss.cpp
+++ b/gnss/1.0/default/Gnss.cpp
@@ -385,7 +385,7 @@
                                           preferredTimeMs) == 0);
 }
 
-Return<void> Gnss::getExtensionAGnssRil(getExtensionAGnssRil_cb _hidl_cb)  {
+Return<sp<IAGnssRil>> Gnss::getExtensionAGnssRil()  {
     if (mGnssIface == nullptr) {
         ALOGE("%s: Gnss interface is unavailable", __func__);
     } else {
@@ -397,11 +397,10 @@
             mGnssRil = new AGnssRil(agpsRilIface);
         }
     }
-    _hidl_cb(mGnssRil);
-    return Void();
+    return mGnssRil;
 }
 
-Return<void> Gnss::getExtensionGnssConfiguration(getExtensionGnssConfiguration_cb _hidl_cb)  {
+Return<sp<IGnssConfiguration>> Gnss::getExtensionGnssConfiguration()  {
     if (mGnssIface == nullptr) {
         ALOGE("%s: Gnss interface is unavailable", __func__);
     } else {
@@ -415,10 +414,9 @@
             mGnssConfig = new GnssConfiguration(gnssConfigIface);
         }
     }
-    _hidl_cb(mGnssConfig);
-    return Void();
+    return mGnssConfig;
 }
-Return<void> Gnss::getExtensionGnssGeofencing(getExtensionGnssGeofencing_cb _hidl_cb)  {
+Return<sp<IGnssGeofencing>> Gnss::getExtensionGnssGeofencing()  {
     if (mGnssIface == nullptr) {
         ALOGE("%s: Gnss interface is unavailable", __func__);
     } else {
@@ -433,11 +431,10 @@
         }
     }
 
-    _hidl_cb(mGnssGeofencingIface);
-    return Void();
+    return mGnssGeofencingIface;
 }
 
-Return<void> Gnss::getExtensionAGnss(getExtensionAGnss_cb _hidl_cb)  {
+Return<sp<IAGnss>> Gnss::getExtensionAGnss()  {
     if (mGnssIface == nullptr) {
         ALOGE("%s: Gnss interface is unavailable", __func__);
     } else {
@@ -449,11 +446,10 @@
             mAGnssIface = new AGnss(agpsIface);
         }
     }
-    _hidl_cb(mAGnssIface);
-    return Void();
+    return mAGnssIface;
 }
 
-Return<void> Gnss::getExtensionGnssNi(getExtensionGnssNi_cb _hidl_cb)  {
+Return<sp<IGnssNi>> Gnss::getExtensionGnssNi()  {
     if (mGnssIface == nullptr) {
         ALOGE("%s: Gnss interface is unavailable", __func__);
     } else {
@@ -465,11 +461,10 @@
             mGnssNi = new GnssNi(gpsNiIface);
         }
     }
-    _hidl_cb(mGnssNi);
-    return Void();
+    return mGnssNi;
 }
 
-Return<void> Gnss::getExtensionGnssMeasurement(getExtensionGnssMeasurement_cb _hidl_cb) {
+Return<sp<IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
     if (mGnssIface == nullptr) {
         ALOGE("%s: Gnss interface is unavailable", __func__);
     } else {
@@ -483,12 +478,10 @@
             mGnssMeasurement = new GnssMeasurement(gpsMeasurementIface);
         }
     }
-    _hidl_cb(mGnssMeasurement);
-    return Void();
+    return mGnssMeasurement;
 }
 
-Return<void> Gnss::getExtensionGnssNavigationMessage(
-        getExtensionGnssNavigationMessage_cb _hidl_cb) {
+Return<sp<IGnssNavigationMessage>> Gnss::getExtensionGnssNavigationMessage() {
     if (mGnssIface == nullptr) {
         ALOGE("%s: Gnss interface is unavailable", __func__);
     } else {
@@ -504,11 +497,10 @@
         }
     }
 
-    _hidl_cb(mGnssNavigationMessage);
-    return Void();
+    return mGnssNavigationMessage;
 }
 
-Return<void> Gnss::getExtensionXtra(getExtensionXtra_cb _hidl_cb)  {
+Return<sp<IGnssXtra>> Gnss::getExtensionXtra()  {
     if (mGnssIface == nullptr) {
         ALOGE("%s: Gnss interface is unavailable", __func__);
     } else {
@@ -522,11 +514,10 @@
         }
     }
 
-    _hidl_cb(mGnssXtraIface);
-    return Void();
+    return mGnssXtraIface;
 }
 
-Return<void> Gnss::getExtensionGnssDebug(getExtensionGnssDebug_cb _hidl_cb)  {
+Return<sp<IGnssDebug>> Gnss::getExtensionGnssDebug()  {
     if (mGnssIface == nullptr) {
         ALOGE("%s: Gnss interface is unavailable", __func__);
     } else {
@@ -540,8 +531,24 @@
         }
     }
 
-    _hidl_cb(mGnssDebug);
-    return Void();
+    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) {
diff --git a/gnss/1.0/default/Gnss.h b/gnss/1.0/default/Gnss.h
index a2c8676..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();
 
@@ -74,16 +77,16 @@
                                  uint32_t minIntervalMs,
                                  uint32_t preferredAccuracyMeters,
                                  uint32_t preferredTimeMs)  override;
-    Return<void> getExtensionAGnssRil(getExtensionAGnssRil_cb _hidl_cb) override;
-    Return<void> getExtensionGnssGeofencing(getExtensionGnssGeofencing_cb _hidl_cb)  override;
-    Return<void> getExtensionAGnss(getExtensionAGnss_cb _hidl_cb)  override;
-    Return<void> getExtensionGnssNi(getExtensionGnssNi_cb _hidl_cb)  override;
-    Return<void> getExtensionGnssMeasurement(getExtensionGnssMeasurement_cb _hidl_cb)  override;
-    Return<void> getExtensionGnssNavigationMessage(
-        getExtensionGnssNavigationMessage_cb _hidl_cb)  override;
-    Return<void> getExtensionXtra(getExtensionXtra_cb _hidl_cb)  override;
-    Return<void> getExtensionGnssDebug(getExtensionGnssDebug_cb _hidl_cb)  override;
-    Return<void> getExtensionGnssConfiguration(getExtensionGnssConfiguration_cb _hidl_cb) override;
+    Return<sp<IAGnssRil>> getExtensionAGnssRil() override;
+    Return<sp<IGnssGeofencing>> getExtensionGnssGeofencing() override;
+    Return<sp<IAGnss>> getExtensionAGnss() override;
+    Return<sp<IGnssNi>> getExtensionGnssNi() override;
+    Return<sp<IGnssMeasurement>> getExtensionGnssMeasurement() override;
+    Return<sp<IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override;
+    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
@@ -120,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/graphics/Android.bp b/graphics/Android.bp
index 796ef41..6d55dd1 100644
--- a/graphics/Android.bp
+++ b/graphics/Android.bp
@@ -8,4 +8,5 @@
     "composer/2.1/default",
     "mapper/2.0",
     "mapper/2.0/default",
+    "mapper/2.0/vts/functional",
 ]
diff --git a/graphics/Android.mk b/graphics/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/graphics/Android.mk
@@ -0,0 +1,19 @@
+#
+# 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)
diff --git a/graphics/allocator/2.0/Android.mk b/graphics/allocator/2.0/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/graphics/allocator/2.0/Android.mk
@@ -0,0 +1,19 @@
+#
+# 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)
diff --git a/graphics/allocator/2.0/default/Android.bp b/graphics/allocator/2.0/default/Android.bp
index 994feb3..f0c736c 100644
--- a/graphics/allocator/2.0/default/Android.bp
+++ b/graphics/allocator/2.0/default/Android.bp
@@ -34,7 +34,7 @@
 
 cc_library_static {
     name: "libgralloc1-adapter",
-    srcs: ["gralloc1-adapter.c"],
+    srcs: ["gralloc1-adapter.cpp", "Gralloc1On0Adapter.cpp"],
     include_dirs: ["system/core/libsync/include"],
     cflags: ["-Wall", "-Wextra", "-Wno-unused-parameter"],
     export_include_dirs: ["."],
diff --git a/graphics/allocator/2.0/default/Gralloc1On0Adapter.cpp b/graphics/allocator/2.0/default/Gralloc1On0Adapter.cpp
new file mode 100644
index 0000000..4b9c9e1
--- /dev/null
+++ b/graphics/allocator/2.0/default/Gralloc1On0Adapter.cpp
@@ -0,0 +1,560 @@
+/*
+ * Copyright 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.
+ */
+
+#undef LOG_TAG
+#define LOG_TAG "Gralloc1On0Adapter"
+//#define LOG_NDEBUG 0
+
+#include "Gralloc1On0Adapter.h"
+#include "gralloc1-adapter.h"
+
+#include <hardware/gralloc.h>
+
+#include <utils/Log.h>
+#include <sync/sync.h>
+
+#include <inttypes.h>
+
+template <typename PFN, typename T>
+static gralloc1_function_pointer_t asFP(T function)
+{
+    static_assert(std::is_same<PFN, T>::value, "Incompatible function pointer");
+    return reinterpret_cast<gralloc1_function_pointer_t>(function);
+}
+
+namespace android {
+namespace hardware {
+
+Gralloc1On0Adapter::Gralloc1On0Adapter(const hw_module_t* module)
+  : gralloc1_device_t(),
+    mModule(reinterpret_cast<const gralloc_module_t*>(module)),
+    mDevice(nullptr)
+{
+    ALOGV("Constructing");
+
+    int minor = 0;
+    mModule->perform(mModule,
+            GRALLOC1_ADAPTER_PERFORM_GET_REAL_MODULE_API_VERSION_MINOR,
+            &minor);
+    mMinorVersion = minor;
+
+    common.tag = HARDWARE_DEVICE_TAG,
+    common.version = HARDWARE_DEVICE_API_VERSION(0, 0),
+    common.module = const_cast<struct hw_module_t*>(module),
+    common.close = closeHook,
+
+    getCapabilities = getCapabilitiesHook;
+    getFunction = getFunctionHook;
+    int error = ::gralloc_open(&(mModule->common), &mDevice);
+    if (error) {
+        ALOGE("Failed to open gralloc0 module: %d", error);
+    }
+    ALOGV("Opened gralloc0 device %p", mDevice);
+}
+
+Gralloc1On0Adapter::~Gralloc1On0Adapter()
+{
+    ALOGV("Destructing");
+    if (mDevice) {
+        ALOGV("Closing gralloc0 device %p", mDevice);
+        ::gralloc_close(mDevice);
+    }
+}
+
+void Gralloc1On0Adapter::doGetCapabilities(uint32_t* outCount,
+        int32_t* outCapabilities)
+{
+    *outCount = 0;
+}
+
+gralloc1_function_pointer_t Gralloc1On0Adapter::doGetFunction(
+        int32_t intDescriptor)
+{
+    constexpr auto lastDescriptor =
+            static_cast<int32_t>(GRALLOC1_LAST_FUNCTION);
+    if (intDescriptor < 0 || intDescriptor > lastDescriptor) {
+        ALOGE("Invalid function descriptor");
+        return nullptr;
+    }
+
+    auto descriptor =
+            static_cast<gralloc1_function_descriptor_t>(intDescriptor);
+    switch (descriptor) {
+        case GRALLOC1_FUNCTION_DUMP:
+            return asFP<GRALLOC1_PFN_DUMP>(dumpHook);
+        case GRALLOC1_FUNCTION_CREATE_DESCRIPTOR:
+            return asFP<GRALLOC1_PFN_CREATE_DESCRIPTOR>(createDescriptorHook);
+        case GRALLOC1_FUNCTION_DESTROY_DESCRIPTOR:
+            return asFP<GRALLOC1_PFN_DESTROY_DESCRIPTOR>(destroyDescriptorHook);
+        case GRALLOC1_FUNCTION_SET_CONSUMER_USAGE:
+            return asFP<GRALLOC1_PFN_SET_CONSUMER_USAGE>(setConsumerUsageHook);
+        case GRALLOC1_FUNCTION_SET_DIMENSIONS:
+            return asFP<GRALLOC1_PFN_SET_DIMENSIONS>(setDimensionsHook);
+        case GRALLOC1_FUNCTION_SET_FORMAT:
+            return asFP<GRALLOC1_PFN_SET_FORMAT>(setFormatHook);
+        case GRALLOC1_FUNCTION_SET_LAYER_COUNT:
+            return asFP<GRALLOC1_PFN_SET_LAYER_COUNT>(setLayerCountHook);
+        case GRALLOC1_FUNCTION_SET_PRODUCER_USAGE:
+            return asFP<GRALLOC1_PFN_SET_PRODUCER_USAGE>(setProducerUsageHook);
+        case GRALLOC1_FUNCTION_GET_BACKING_STORE:
+            return asFP<GRALLOC1_PFN_GET_BACKING_STORE>(
+                    bufferHook<decltype(&Buffer::getBackingStore),
+                    &Buffer::getBackingStore, gralloc1_backing_store_t*>);
+        case GRALLOC1_FUNCTION_GET_CONSUMER_USAGE:
+            return asFP<GRALLOC1_PFN_GET_CONSUMER_USAGE>(getConsumerUsageHook);
+        case GRALLOC1_FUNCTION_GET_DIMENSIONS:
+            return asFP<GRALLOC1_PFN_GET_DIMENSIONS>(
+                    bufferHook<decltype(&Buffer::getDimensions),
+                    &Buffer::getDimensions, uint32_t*, uint32_t*>);
+        case GRALLOC1_FUNCTION_GET_FORMAT:
+            return asFP<GRALLOC1_PFN_GET_FORMAT>(
+                    bufferHook<decltype(&Buffer::getFormat),
+                    &Buffer::getFormat, int32_t*>);
+        case GRALLOC1_FUNCTION_GET_LAYER_COUNT:
+            return asFP<GRALLOC1_PFN_GET_LAYER_COUNT>(
+                    bufferHook<decltype(&Buffer::getLayerCount),
+                    &Buffer::getLayerCount, uint32_t*>);
+        case GRALLOC1_FUNCTION_GET_PRODUCER_USAGE:
+            return asFP<GRALLOC1_PFN_GET_PRODUCER_USAGE>(getProducerUsageHook);
+        case GRALLOC1_FUNCTION_GET_STRIDE:
+            return asFP<GRALLOC1_PFN_GET_STRIDE>(
+                    bufferHook<decltype(&Buffer::getStride),
+                    &Buffer::getStride, uint32_t*>);
+        case GRALLOC1_FUNCTION_ALLOCATE:
+            if (mDevice != nullptr) {
+                return asFP<GRALLOC1_PFN_ALLOCATE>(allocateHook);
+            } else {
+                return nullptr;
+            }
+        case GRALLOC1_FUNCTION_RETAIN:
+            return asFP<GRALLOC1_PFN_RETAIN>(retainHook);
+        case GRALLOC1_FUNCTION_RELEASE:
+            return asFP<GRALLOC1_PFN_RELEASE>(releaseHook);
+        case GRALLOC1_FUNCTION_GET_NUM_FLEX_PLANES:
+            return asFP<GRALLOC1_PFN_GET_NUM_FLEX_PLANES>(
+                    bufferHook<decltype(&Buffer::getNumFlexPlanes),
+                    &Buffer::getNumFlexPlanes, uint32_t*>);
+        case GRALLOC1_FUNCTION_LOCK:
+            return asFP<GRALLOC1_PFN_LOCK>(
+                    lockHook<void*, &Gralloc1On0Adapter::lock>);
+        case GRALLOC1_FUNCTION_LOCK_FLEX:
+            return asFP<GRALLOC1_PFN_LOCK_FLEX>(
+                    lockHook<struct android_flex_layout,
+                    &Gralloc1On0Adapter::lockFlex>);
+        case GRALLOC1_FUNCTION_UNLOCK:
+            return asFP<GRALLOC1_PFN_UNLOCK>(unlockHook);
+        case GRALLOC1_FUNCTION_INVALID:
+            ALOGE("Invalid function descriptor");
+            return nullptr;
+    }
+
+    ALOGE("Unknown function descriptor: %d", intDescriptor);
+    return nullptr;
+}
+
+void Gralloc1On0Adapter::dump(uint32_t* outSize, char* outBuffer)
+{
+    ALOGV("dump(%u (%p), %p", outSize ? *outSize : 0, outSize, outBuffer);
+
+    if (!mDevice->dump) {
+        // dump is optional on gralloc0 implementations
+        *outSize = 0;
+        return;
+    }
+
+    if (!outBuffer) {
+        constexpr int32_t BUFFER_LENGTH = 4096;
+        char buffer[BUFFER_LENGTH] = {};
+        mDevice->dump(mDevice, buffer, BUFFER_LENGTH);
+        buffer[BUFFER_LENGTH - 1] = 0; // Ensure the buffer is null-terminated
+        size_t actualLength = std::strlen(buffer);
+        mCachedDump.resize(actualLength);
+        std::copy_n(buffer, actualLength, mCachedDump.begin());
+        *outSize = static_cast<uint32_t>(actualLength);
+    } else {
+        *outSize = std::min(*outSize,
+                static_cast<uint32_t>(mCachedDump.size()));
+        outBuffer = std::copy_n(mCachedDump.cbegin(), *outSize, outBuffer);
+    }
+}
+
+gralloc1_error_t Gralloc1On0Adapter::createDescriptor(
+        gralloc1_buffer_descriptor_t* outDescriptor)
+{
+    auto descriptorId = sNextBufferDescriptorId++;
+    std::lock_guard<std::mutex> lock(mDescriptorMutex);
+    mDescriptors.emplace(descriptorId, std::make_shared<Descriptor>());
+
+    ALOGV("Created descriptor %" PRIu64, descriptorId);
+
+    *outDescriptor = descriptorId;
+    return GRALLOC1_ERROR_NONE;
+}
+
+gralloc1_error_t Gralloc1On0Adapter::destroyDescriptor(
+        gralloc1_buffer_descriptor_t descriptor)
+{
+    ALOGV("Destroying descriptor %" PRIu64, descriptor);
+
+    std::lock_guard<std::mutex> lock(mDescriptorMutex);
+    if (mDescriptors.count(descriptor) == 0) {
+        return GRALLOC1_ERROR_BAD_DESCRIPTOR;
+    }
+
+    mDescriptors.erase(descriptor);
+    return GRALLOC1_ERROR_NONE;
+}
+
+Gralloc1On0Adapter::Buffer::Buffer(buffer_handle_t handle,
+        gralloc1_backing_store_t store, const Descriptor& descriptor,
+        uint32_t stride, uint32_t numFlexPlanes, bool wasAllocated)
+  : mHandle(handle),
+    mReferenceCount(1),
+    mStore(store),
+    mDescriptor(descriptor),
+    mStride(stride),
+    mNumFlexPlanes(numFlexPlanes),
+    mWasAllocated(wasAllocated) {}
+
+gralloc1_error_t Gralloc1On0Adapter::allocate(
+        gralloc1_buffer_descriptor_t id,
+        const std::shared_ptr<Descriptor>& descriptor,
+        buffer_handle_t* outBufferHandle)
+{
+    ALOGV("allocate(%" PRIu64 ")", id);
+
+    // If this function is being called, it's because we handed out its function
+    // pointer, which only occurs when mDevice has been loaded successfully and
+    // we are permitted to allocate
+
+    int usage = static_cast<int>(descriptor->producerUsage) |
+            static_cast<int>(descriptor->consumerUsage);
+    buffer_handle_t handle = nullptr;
+    int stride = 0;
+    ALOGV("Calling alloc(%p, %u, %u, %i, %u)", mDevice, descriptor->width,
+            descriptor->height, descriptor->format, usage);
+    auto error = mDevice->alloc(mDevice,
+            static_cast<int>(descriptor->width),
+            static_cast<int>(descriptor->height), descriptor->format,
+            usage, &handle, &stride);
+    if (error != 0) {
+        ALOGE("gralloc0 allocation failed: %d (%s)", error,
+                strerror(-error));
+        return GRALLOC1_ERROR_NO_RESOURCES;
+    }
+
+    mModule->perform(mModule, GRALLOC1_ADAPTER_PERFORM_SET_USAGES,
+            handle,
+            static_cast<int>(descriptor->producerUsage),
+            static_cast<int>(descriptor->consumerUsage));
+
+    uint64_t backingStore = 0;
+    mModule->perform(mModule, GRALLOC1_ADAPTER_PERFORM_GET_BACKING_STORE,
+            handle, &backingStore);
+    int numFlexPlanes = 0;
+    mModule->perform(mModule, GRALLOC1_ADAPTER_PERFORM_GET_NUM_FLEX_PLANES,
+            handle, &numFlexPlanes);
+
+    *outBufferHandle = handle;
+    auto buffer = std::make_shared<Buffer>(handle, backingStore,
+            *descriptor, stride, numFlexPlanes, true);
+
+    std::lock_guard<std::mutex> lock(mBufferMutex);
+    mBuffers.emplace(handle, std::move(buffer));
+
+    return GRALLOC1_ERROR_NONE;
+}
+
+int32_t Gralloc1On0Adapter::allocateHook(gralloc1_device* device,
+        uint32_t numDescriptors,
+        const gralloc1_buffer_descriptor_t* descriptors,
+        buffer_handle_t* outBuffers)
+{
+    if (!outBuffers) {
+        return GRALLOC1_ERROR_UNDEFINED;
+    }
+
+    auto adapter = getAdapter(device);
+
+    gralloc1_error_t error = GRALLOC1_ERROR_NONE;
+    uint32_t i;
+    for (i = 0; i < numDescriptors; i++) {
+        auto descriptor = adapter->getDescriptor(descriptors[i]);
+        if (!descriptor) {
+            error = GRALLOC1_ERROR_BAD_DESCRIPTOR;
+            break;
+        }
+
+        buffer_handle_t bufferHandle = nullptr;
+        error = adapter->allocate(descriptors[i], descriptor, &bufferHandle);
+        if (error != GRALLOC1_ERROR_NONE) {
+            break;
+        }
+
+        outBuffers[i] = bufferHandle;
+    }
+
+    if (error == GRALLOC1_ERROR_NONE) {
+        if (numDescriptors > 1) {
+            error = GRALLOC1_ERROR_NOT_SHARED;
+        }
+    } else {
+        for (uint32_t j = 0; j < i; j++) {
+            adapter->release(adapter->getBuffer(outBuffers[j]));
+            outBuffers[j] = nullptr;
+        }
+    }
+
+    return error;
+}
+
+gralloc1_error_t Gralloc1On0Adapter::retain(
+        const std::shared_ptr<Buffer>& buffer)
+{
+    std::lock_guard<std::mutex> lock(mBufferMutex);
+    buffer->retain();
+    return GRALLOC1_ERROR_NONE;
+}
+
+gralloc1_error_t Gralloc1On0Adapter::release(
+        const std::shared_ptr<Buffer>& buffer)
+{
+    std::lock_guard<std::mutex> lock(mBufferMutex);
+    if (!buffer->release()) {
+        return GRALLOC1_ERROR_NONE;
+    }
+
+    buffer_handle_t handle = buffer->getHandle();
+    if (buffer->wasAllocated()) {
+        ALOGV("Calling free(%p)", handle);
+        int result = mDevice->free(mDevice, handle);
+        if (result != 0) {
+            ALOGE("gralloc0 free failed: %d", result);
+        }
+    } else {
+        ALOGV("Calling unregisterBuffer(%p)", handle);
+        int result = mModule->unregisterBuffer(mModule, handle);
+        if (result != 0) {
+            ALOGE("gralloc0 unregister failed: %d", result);
+        }
+    }
+
+    mBuffers.erase(handle);
+    return GRALLOC1_ERROR_NONE;
+}
+
+gralloc1_error_t Gralloc1On0Adapter::retain(buffer_handle_t bufferHandle)
+{
+    ALOGV("retain(%p)", bufferHandle);
+
+    std::lock_guard<std::mutex> lock(mBufferMutex);
+
+    if (mBuffers.count(bufferHandle) != 0) {
+        mBuffers[bufferHandle]->retain();
+        return GRALLOC1_ERROR_NONE;
+    }
+
+    ALOGV("Calling registerBuffer(%p)", bufferHandle);
+    int result = mModule->registerBuffer(mModule, bufferHandle);
+    if (result != 0) {
+        ALOGE("gralloc0 register failed: %d", result);
+        return GRALLOC1_ERROR_NO_RESOURCES;
+    }
+
+    uint64_t backingStore = 0;
+    mModule->perform(mModule, GRALLOC1_ADAPTER_PERFORM_GET_BACKING_STORE,
+            bufferHandle, &backingStore);
+
+    int numFlexPlanes = 0;
+    mModule->perform(mModule, GRALLOC1_ADAPTER_PERFORM_GET_NUM_FLEX_PLANES,
+            bufferHandle, &numFlexPlanes);
+
+    int stride = 0;
+    mModule->perform(mModule, GRALLOC1_ADAPTER_PERFORM_GET_STRIDE,
+            bufferHandle, &stride);
+
+    int width = 0;
+    int height = 0;
+    int format = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED;
+    int producerUsage = 0;
+    int consumerUsage = 0;
+    mModule->perform(mModule, GRALLOC1_ADAPTER_PERFORM_GET_DIMENSIONS,
+            bufferHandle, &width, &height);
+    mModule->perform(mModule, GRALLOC1_ADAPTER_PERFORM_GET_FORMAT,
+            bufferHandle, &format);
+    mModule->perform(mModule, GRALLOC1_ADAPTER_PERFORM_GET_PRODUCER_USAGE,
+            bufferHandle, &producerUsage);
+    mModule->perform(mModule, GRALLOC1_ADAPTER_PERFORM_GET_CONSUMER_USAGE,
+            bufferHandle, &consumerUsage);
+
+    Descriptor descriptor;
+    descriptor.setDimensions(width, height);
+    descriptor.setFormat(format);
+    descriptor.setProducerUsage(
+            static_cast<gralloc1_producer_usage_t>(producerUsage));
+    descriptor.setConsumerUsage(
+            static_cast<gralloc1_consumer_usage_t>(consumerUsage));
+
+    auto buffer = std::make_shared<Buffer>(bufferHandle, backingStore,
+            descriptor, stride, numFlexPlanes, false);
+    mBuffers.emplace(bufferHandle, std::move(buffer));
+    return GRALLOC1_ERROR_NONE;
+}
+
+static void syncWaitForever(int fd, const char* logname)
+{
+    if (fd < 0) {
+        return;
+    }
+
+    const int warningTimeout = 3500;
+    const int error = sync_wait(fd, warningTimeout);
+    if (error < 0 && errno == ETIME) {
+        ALOGE("%s: fence %d didn't signal in %u ms", logname, fd,
+                warningTimeout);
+        sync_wait(fd, -1);
+    }
+}
+
+gralloc1_error_t Gralloc1On0Adapter::lock(
+        const std::shared_ptr<Buffer>& buffer,
+        gralloc1_producer_usage_t producerUsage,
+        gralloc1_consumer_usage_t consumerUsage,
+        const gralloc1_rect_t& accessRegion, void** outData,
+        int acquireFence)
+{
+    if (mMinorVersion >= 3) {
+        int result = mModule->lockAsync(mModule, buffer->getHandle(),
+                static_cast<int32_t>(producerUsage | consumerUsage),
+                accessRegion.left, accessRegion.top, accessRegion.width,
+                accessRegion.height, outData, acquireFence);
+        if (result != 0) {
+            return GRALLOC1_ERROR_UNSUPPORTED;
+        }
+    } else {
+        syncWaitForever(acquireFence, "Gralloc1On0Adapter::lock");
+
+        int result = mModule->lock(mModule, buffer->getHandle(),
+                static_cast<int32_t>(producerUsage | consumerUsage),
+                accessRegion.left, accessRegion.top, accessRegion.width,
+                accessRegion.height, outData);
+        ALOGV("gralloc0 lock returned %d", result);
+        if (result != 0) {
+            return GRALLOC1_ERROR_UNSUPPORTED;
+        } else if (acquireFence >= 0) {
+            close(acquireFence);
+        }
+    }
+    return GRALLOC1_ERROR_NONE;
+}
+
+gralloc1_error_t Gralloc1On0Adapter::lockFlex(
+        const std::shared_ptr<Buffer>& buffer,
+        gralloc1_producer_usage_t producerUsage,
+        gralloc1_consumer_usage_t consumerUsage,
+        const gralloc1_rect_t& accessRegion,
+        struct android_flex_layout* outFlex,
+        int acquireFence)
+{
+    if (mMinorVersion >= 3) {
+        int result = mModule->perform(mModule,
+                GRALLOC1_ADAPTER_PERFORM_LOCK_FLEX,
+                buffer->getHandle(),
+                static_cast<int>(producerUsage),
+                static_cast<int>(consumerUsage),
+                accessRegion.left,
+                accessRegion.top,
+                accessRegion.width,
+                accessRegion.height,
+                outFlex, acquireFence);
+        if (result != 0) {
+            return GRALLOC1_ERROR_UNSUPPORTED;
+        }
+    } else {
+        syncWaitForever(acquireFence, "Gralloc1On0Adapter::lockFlex");
+
+        int result = mModule->perform(mModule,
+                GRALLOC1_ADAPTER_PERFORM_LOCK_FLEX,
+                buffer->getHandle(),
+                static_cast<int>(producerUsage),
+                static_cast<int>(consumerUsage),
+                accessRegion.left,
+                accessRegion.top,
+                accessRegion.width,
+                accessRegion.height,
+                outFlex, -1);
+        if (result != 0) {
+            return GRALLOC1_ERROR_UNSUPPORTED;
+        } else if (acquireFence >= 0) {
+            close(acquireFence);
+        }
+    }
+
+    return GRALLOC1_ERROR_NONE;
+}
+
+gralloc1_error_t Gralloc1On0Adapter::unlock(
+        const std::shared_ptr<Buffer>& buffer,
+        int* outReleaseFence)
+{
+    if (mMinorVersion >= 3) {
+        int fenceFd = -1;
+        int result = mModule->unlockAsync(mModule, buffer->getHandle(),
+                &fenceFd);
+        if (result != 0) {
+            close(fenceFd);
+            ALOGE("gralloc0 unlockAsync failed: %d", result);
+        } else {
+            *outReleaseFence = fenceFd;
+        }
+    } else {
+        int result = mModule->unlock(mModule, buffer->getHandle());
+        if (result != 0) {
+            ALOGE("gralloc0 unlock failed: %d", result);
+        } else {
+            *outReleaseFence = -1;
+        }
+    }
+    return GRALLOC1_ERROR_NONE;
+}
+
+std::shared_ptr<Gralloc1On0Adapter::Descriptor>
+Gralloc1On0Adapter::getDescriptor(gralloc1_buffer_descriptor_t descriptorId)
+{
+    std::lock_guard<std::mutex> lock(mDescriptorMutex);
+    if (mDescriptors.count(descriptorId) == 0) {
+        return nullptr;
+    }
+
+    return mDescriptors[descriptorId];
+}
+
+std::shared_ptr<Gralloc1On0Adapter::Buffer> Gralloc1On0Adapter::getBuffer(
+        buffer_handle_t bufferHandle)
+{
+    std::lock_guard<std::mutex> lock(mBufferMutex);
+    if (mBuffers.count(bufferHandle) == 0) {
+        return nullptr;
+    }
+
+    return mBuffers[bufferHandle];
+}
+
+std::atomic<gralloc1_buffer_descriptor_t>
+        Gralloc1On0Adapter::sNextBufferDescriptorId(1);
+
+} // namespace hardware
+} // namespace android
diff --git a/graphics/allocator/2.0/default/Gralloc1On0Adapter.h b/graphics/allocator/2.0/default/Gralloc1On0Adapter.h
new file mode 100644
index 0000000..180015d
--- /dev/null
+++ b/graphics/allocator/2.0/default/Gralloc1On0Adapter.h
@@ -0,0 +1,458 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef ANDROID_HARDWARE_GRALLOC_1_ON_0_ADAPTER_H
+#define ANDROID_HARDWARE_GRALLOC_1_ON_0_ADAPTER_H
+
+#include <hardware/gralloc1.h>
+#include <log/log.h>
+
+#include <atomic>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <unordered_map>
+#include <utility>
+
+struct gralloc_module_t;
+struct alloc_device_t;
+
+namespace android {
+namespace hardware {
+
+class Gralloc1On0Adapter : public gralloc1_device_t
+{
+public:
+    Gralloc1On0Adapter(const hw_module_t* module);
+    ~Gralloc1On0Adapter();
+
+    gralloc1_device_t* getDevice() {
+        return static_cast<gralloc1_device_t*>(this);
+    }
+
+private:
+    static inline Gralloc1On0Adapter* getAdapter(gralloc1_device_t* device) {
+        return static_cast<Gralloc1On0Adapter*>(device);
+    }
+
+    static int closeHook(struct hw_device_t* device) {
+        delete getAdapter(reinterpret_cast<gralloc1_device_t*>(device));
+        return 0;
+    }
+
+    // getCapabilities
+
+    void doGetCapabilities(uint32_t* outCount,
+            int32_t* /*gralloc1_capability_t*/ outCapabilities);
+    static void getCapabilitiesHook(gralloc1_device_t* device,
+            uint32_t* outCount,
+            int32_t* /*gralloc1_capability_t*/ outCapabilities) {
+        getAdapter(device)->doGetCapabilities(outCount, outCapabilities);
+    }
+
+    // getFunction
+
+    gralloc1_function_pointer_t doGetFunction(
+            int32_t /*gralloc1_function_descriptor_t*/ descriptor);
+    static gralloc1_function_pointer_t getFunctionHook(
+            gralloc1_device_t* device,
+            int32_t /*gralloc1_function_descriptor_t*/ descriptor) {
+        return getAdapter(device)->doGetFunction(descriptor);
+    }
+
+    // dump
+
+    void dump(uint32_t* outSize, char* outBuffer);
+    static void dumpHook(gralloc1_device_t* device, uint32_t* outSize,
+            char* outBuffer) {
+        return getAdapter(device)->dump(outSize, outBuffer);
+    }
+    std::string mCachedDump;
+
+    // Buffer descriptor lifecycle functions
+
+    struct Descriptor;
+
+    gralloc1_error_t createDescriptor(
+            gralloc1_buffer_descriptor_t* outDescriptor);
+    static int32_t createDescriptorHook(gralloc1_device_t* device,
+            gralloc1_buffer_descriptor_t* outDescriptor) {
+        auto error = getAdapter(device)->createDescriptor(outDescriptor);
+        return static_cast<int32_t>(error);
+    }
+
+    gralloc1_error_t destroyDescriptor(gralloc1_buffer_descriptor_t descriptor);
+    static int32_t destroyDescriptorHook(gralloc1_device_t* device,
+            gralloc1_buffer_descriptor_t descriptor) {
+        auto error = getAdapter(device)->destroyDescriptor(descriptor);
+        return static_cast<int32_t>(error);
+    }
+
+    // Buffer descriptor modification functions
+
+    struct Descriptor : public std::enable_shared_from_this<Descriptor> {
+        Descriptor()
+          : width(0),
+            height(0),
+            format(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED),
+            layerCount(1),
+            producerUsage(GRALLOC1_PRODUCER_USAGE_NONE),
+            consumerUsage(GRALLOC1_CONSUMER_USAGE_NONE) {}
+
+        gralloc1_error_t setDimensions(uint32_t w, uint32_t h) {
+            width = w;
+            height = h;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t setFormat(int32_t f) {
+            format = f;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t setLayerCount(uint32_t lc) {
+            layerCount = lc;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t setProducerUsage(gralloc1_producer_usage_t usage) {
+            producerUsage = usage;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t setConsumerUsage(gralloc1_consumer_usage_t usage) {
+            consumerUsage = usage;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        uint32_t width;
+        uint32_t height;
+        int32_t format;
+        uint32_t layerCount;
+        gralloc1_producer_usage_t producerUsage;
+        gralloc1_consumer_usage_t consumerUsage;
+    };
+
+    template <typename ...Args>
+    static int32_t callDescriptorFunction(gralloc1_device_t* device,
+            gralloc1_buffer_descriptor_t descriptorId,
+            gralloc1_error_t (Descriptor::*member)(Args...), Args... args) {
+        auto descriptor = getAdapter(device)->getDescriptor(descriptorId);
+        if (!descriptor) {
+            return static_cast<int32_t>(GRALLOC1_ERROR_BAD_DESCRIPTOR);
+        }
+        auto error = ((*descriptor).*member)(std::forward<Args>(args)...);
+        return static_cast<int32_t>(error);
+    }
+
+    static int32_t setConsumerUsageHook(gralloc1_device_t* device,
+            gralloc1_buffer_descriptor_t descriptorId, uint64_t intUsage) {
+        auto usage = static_cast<gralloc1_consumer_usage_t>(intUsage);
+        return callDescriptorFunction(device, descriptorId,
+                &Descriptor::setConsumerUsage, usage);
+    }
+
+    static int32_t setDimensionsHook(gralloc1_device_t* device,
+            gralloc1_buffer_descriptor_t descriptorId, uint32_t width,
+            uint32_t height) {
+        return callDescriptorFunction(device, descriptorId,
+                &Descriptor::setDimensions, width, height);
+    }
+
+    static int32_t setFormatHook(gralloc1_device_t* device,
+            gralloc1_buffer_descriptor_t descriptorId, int32_t format) {
+        return callDescriptorFunction(device, descriptorId,
+                &Descriptor::setFormat, format);
+    }
+
+    static int32_t setLayerCountHook(gralloc1_device_t* device,
+            gralloc1_buffer_descriptor_t descriptorId, uint32_t layerCount) {
+        return callDescriptorFunction(device, descriptorId,
+                &Descriptor::setLayerCount, layerCount);
+    }
+
+    static int32_t setProducerUsageHook(gralloc1_device_t* device,
+            gralloc1_buffer_descriptor_t descriptorId, uint64_t intUsage) {
+        auto usage = static_cast<gralloc1_producer_usage_t>(intUsage);
+        return callDescriptorFunction(device, descriptorId,
+                &Descriptor::setProducerUsage, usage);
+    }
+
+    // Buffer handle query functions
+
+    class Buffer {
+    public:
+        Buffer(buffer_handle_t handle, gralloc1_backing_store_t store,
+                const Descriptor& descriptor, uint32_t stride,
+                uint32_t numFlexPlanes, bool wasAllocated);
+
+        buffer_handle_t getHandle() const { return mHandle; }
+
+        void retain() { ++mReferenceCount; }
+
+        // Returns true if the reference count has dropped to 0, indicating that
+        // the buffer needs to be released
+        bool release() { return --mReferenceCount == 0; }
+
+        bool wasAllocated() const { return mWasAllocated; }
+
+        gralloc1_error_t getBackingStore(
+                gralloc1_backing_store_t* outStore) const {
+            *outStore = mStore;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t getConsumerUsage(
+                gralloc1_consumer_usage_t* outUsage) const {
+            *outUsage = mDescriptor.consumerUsage;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t getDimensions(uint32_t* outWidth,
+                uint32_t* outHeight) const {
+            *outWidth = mDescriptor.width;
+            *outHeight = mDescriptor.height;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t getFormat(int32_t* outFormat) const {
+            *outFormat = mDescriptor.format;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t getLayerCount(uint32_t* outLayerCount) const {
+            *outLayerCount = mDescriptor.layerCount;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t getNumFlexPlanes(uint32_t* outNumPlanes) const {
+            *outNumPlanes = mNumFlexPlanes;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t getProducerUsage(
+                gralloc1_producer_usage_t* outUsage) const {
+            *outUsage = mDescriptor.producerUsage;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+        gralloc1_error_t getStride(uint32_t* outStride) const {
+            *outStride = mStride;
+            return GRALLOC1_ERROR_NONE;
+        }
+
+    private:
+
+        const buffer_handle_t mHandle;
+        size_t mReferenceCount;
+
+        const gralloc1_backing_store_t mStore;
+        const Descriptor mDescriptor;
+        const uint32_t mStride;
+        const uint32_t mNumFlexPlanes;
+
+        // Whether this buffer allocated in this process (as opposed to just
+        // being retained here), which determines whether to free or unregister
+        // the buffer when this Buffer is released
+        const bool mWasAllocated;
+    };
+
+    template <typename ...Args>
+    static int32_t callBufferFunction(gralloc1_device_t* device,
+            buffer_handle_t bufferHandle,
+            gralloc1_error_t (Buffer::*member)(Args...) const, Args... args) {
+        auto buffer = getAdapter(device)->getBuffer(bufferHandle);
+        if (!buffer) {
+            return static_cast<int32_t>(GRALLOC1_ERROR_BAD_HANDLE);
+        }
+        auto error = ((*buffer).*member)(std::forward<Args>(args)...);
+        return static_cast<int32_t>(error);
+    }
+
+    template <typename MF, MF memFunc, typename ...Args>
+    static int32_t bufferHook(gralloc1_device_t* device,
+            buffer_handle_t bufferHandle, Args... args) {
+        return Gralloc1On0Adapter::callBufferFunction(device, bufferHandle,
+                memFunc, std::forward<Args>(args)...);
+    }
+
+    static int32_t getConsumerUsageHook(gralloc1_device_t* device,
+            buffer_handle_t bufferHandle, uint64_t* outUsage) {
+        auto usage = GRALLOC1_CONSUMER_USAGE_NONE;
+        auto error = callBufferFunction(device, bufferHandle,
+                &Buffer::getConsumerUsage, &usage);
+        if (error == GRALLOC1_ERROR_NONE) {
+            *outUsage = static_cast<uint64_t>(usage);
+        }
+        return error;
+    }
+
+    static int32_t getProducerUsageHook(gralloc1_device_t* device,
+            buffer_handle_t bufferHandle, uint64_t* outUsage) {
+        auto usage = GRALLOC1_PRODUCER_USAGE_NONE;
+        auto error = callBufferFunction(device, bufferHandle,
+                &Buffer::getProducerUsage, &usage);
+        if (error == GRALLOC1_ERROR_NONE) {
+            *outUsage = static_cast<uint64_t>(usage);
+        }
+        return error;
+    }
+
+    // Buffer management functions
+
+    gralloc1_error_t allocate(
+            gralloc1_buffer_descriptor_t id,
+            const std::shared_ptr<Descriptor>& descriptor,
+            buffer_handle_t* outBufferHandle);
+    static int32_t allocateHook(gralloc1_device* device,
+            uint32_t numDescriptors,
+            const gralloc1_buffer_descriptor_t* descriptors,
+            buffer_handle_t* outBuffers);
+
+    gralloc1_error_t retain(const std::shared_ptr<Buffer>& buffer);
+    gralloc1_error_t retain(buffer_handle_t bufferHandle);
+    static int32_t retainHook(gralloc1_device_t* device,
+            buffer_handle_t bufferHandle)
+    {
+        auto adapter = getAdapter(device);
+        return adapter->retain(bufferHandle);
+    }
+
+    gralloc1_error_t release(const std::shared_ptr<Buffer>& buffer);
+    static int32_t releaseHook(gralloc1_device_t* device,
+            buffer_handle_t bufferHandle) {
+        auto adapter = getAdapter(device);
+
+        auto buffer = adapter->getBuffer(bufferHandle);
+        if (!buffer) {
+            return static_cast<int32_t>(GRALLOC1_ERROR_BAD_HANDLE);
+        }
+
+        auto error = adapter->release(buffer);
+        return static_cast<int32_t>(error);
+    }
+
+    // Buffer access functions
+
+    gralloc1_error_t lock(const std::shared_ptr<Buffer>& buffer,
+            gralloc1_producer_usage_t producerUsage,
+            gralloc1_consumer_usage_t consumerUsage,
+            const gralloc1_rect_t& accessRegion, void** outData,
+            int acquireFence);
+    gralloc1_error_t lockFlex(const std::shared_ptr<Buffer>& buffer,
+            gralloc1_producer_usage_t producerUsage,
+            gralloc1_consumer_usage_t consumerUsage,
+            const gralloc1_rect_t& accessRegion,
+            struct android_flex_layout* outFlex,
+            int acquireFence);
+
+    template <typename OUT, gralloc1_error_t (Gralloc1On0Adapter::*member)(
+            const std::shared_ptr<Buffer>&, gralloc1_producer_usage_t,
+            gralloc1_consumer_usage_t, const gralloc1_rect_t&, OUT*,
+            int)>
+    static int32_t lockHook(gralloc1_device_t* device,
+            buffer_handle_t bufferHandle,
+            uint64_t /*gralloc1_producer_usage_t*/ uintProducerUsage,
+            uint64_t /*gralloc1_consumer_usage_t*/ uintConsumerUsage,
+            const gralloc1_rect_t* accessRegion, OUT* outData,
+            int32_t acquireFenceFd) {
+        auto adapter = getAdapter(device);
+
+        // Exactly one of producer and consumer usage must be *_USAGE_NONE,
+        // but we can't check this until the upper levels of the framework
+        // correctly distinguish between producer and consumer usage
+        /*
+        bool hasProducerUsage =
+                uintProducerUsage != GRALLOC1_PRODUCER_USAGE_NONE;
+        bool hasConsumerUsage =
+                uintConsumerUsage != GRALLOC1_CONSUMER_USAGE_NONE;
+        if (hasProducerUsage && hasConsumerUsage ||
+                !hasProducerUsage && !hasConsumerUsage) {
+            return static_cast<int32_t>(GRALLOC1_ERROR_BAD_VALUE);
+        }
+        */
+
+        auto producerUsage =
+                static_cast<gralloc1_producer_usage_t>(uintProducerUsage);
+        auto consumerUsage =
+                static_cast<gralloc1_consumer_usage_t>(uintConsumerUsage);
+
+        if (!outData) {
+            const auto producerCpuUsage = GRALLOC1_PRODUCER_USAGE_CPU_READ |
+                    GRALLOC1_PRODUCER_USAGE_CPU_WRITE;
+            if ((producerUsage & producerCpuUsage) != 0) {
+                return static_cast<int32_t>(GRALLOC1_ERROR_BAD_VALUE);
+            }
+            if ((consumerUsage & GRALLOC1_CONSUMER_USAGE_CPU_READ) != 0) {
+                return static_cast<int32_t>(GRALLOC1_ERROR_BAD_VALUE);
+            }
+        }
+
+        auto buffer = adapter->getBuffer(bufferHandle);
+        if (!buffer) {
+            return static_cast<int32_t>(GRALLOC1_ERROR_BAD_HANDLE);
+        }
+
+        if (!accessRegion) {
+            ALOGE("accessRegion is null");
+            return static_cast<int32_t>(GRALLOC1_ERROR_BAD_VALUE);
+        }
+
+        auto error = ((*adapter).*member)(buffer, producerUsage, consumerUsage,
+                *accessRegion, outData, acquireFenceFd);
+        return static_cast<int32_t>(error);
+    }
+
+    gralloc1_error_t unlock(const std::shared_ptr<Buffer>& buffer,
+            int* outReleaseFence);
+    static int32_t unlockHook(gralloc1_device_t* device,
+            buffer_handle_t bufferHandle, int32_t* outReleaseFenceFd) {
+        auto adapter = getAdapter(device);
+
+        auto buffer = adapter->getBuffer(bufferHandle);
+        if (!buffer) {
+            return static_cast<int32_t>(GRALLOC1_ERROR_BAD_HANDLE);
+        }
+
+        int releaseFence = -1;
+        auto error = adapter->unlock(buffer, &releaseFence);
+        if (error == GRALLOC1_ERROR_NONE) {
+            *outReleaseFenceFd = releaseFence;
+        }
+        return static_cast<int32_t>(error);
+    }
+
+    // Adapter internals
+    const gralloc_module_t* mModule;
+    uint8_t mMinorVersion;
+    alloc_device_t* mDevice;
+
+    std::shared_ptr<Descriptor> getDescriptor(
+            gralloc1_buffer_descriptor_t descriptorId);
+    std::shared_ptr<Buffer> getBuffer(buffer_handle_t bufferHandle);
+
+    static std::atomic<gralloc1_buffer_descriptor_t> sNextBufferDescriptorId;
+    std::mutex mDescriptorMutex;
+    std::unordered_map<gralloc1_buffer_descriptor_t,
+            std::shared_ptr<Descriptor>> mDescriptors;
+    std::mutex mBufferMutex;
+    std::unordered_map<buffer_handle_t, std::shared_ptr<Buffer>> mBuffers;
+};
+
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GRALLOC_1_ON_0_ADAPTER_H
diff --git a/graphics/allocator/2.0/default/gralloc1-adapter.c b/graphics/allocator/2.0/default/gralloc1-adapter.c
deleted file mode 100644
index 724cd47..0000000
--- a/graphics/allocator/2.0/default/gralloc1-adapter.c
+++ /dev/null
@@ -1,660 +0,0 @@
-/*
- * Copyright 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.
- */
-
-#define LOG_TAG "Gralloc1Adapter"
-
-#include <stdatomic.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <pthread.h>
-
-#include <cutils/native_handle.h>
-#include <hardware/gralloc1.h>
-#include <sync/sync.h>
-#include <log/log.h>
-
-#include "gralloc1-adapter.h"
-
-struct gralloc1_adapter_module {
-    struct gralloc_module_t base;
-    struct gralloc1_adapter adapter;
-};
-
-struct gralloc1_adapter_device {
-    struct gralloc1_device base;
-
-    struct alloc_device_t* alloc_dev;
-
-    /* fixed size for thread safety */
-    char saved_dump[4096];
-    size_t saved_dump_size;
-};
-
-/* additional data associated with registered buffer_handle_t */
-struct gralloc1_adapter_buffer_data {
-    struct gralloc1_adapter_buffer_info info;
-
-    atomic_int refcount;
-    bool owned;
-};
-
-struct gralloc1_adapter_buffer_descriptor {
-    int width;
-    int height;
-    int format;
-    int producer_usage;
-    int consumer_usage;
-};
-
-static const struct gralloc1_adapter_module* gralloc1_adapter_module(
-        struct gralloc1_device* dev)
-{
-    return (const struct gralloc1_adapter_module*) dev->common.module;
-}
-
-static struct gralloc1_adapter_device* gralloc1_adapter_device(
-        struct gralloc1_device* dev)
-{
-    return (struct gralloc1_adapter_device*) dev;
-}
-
-static struct gralloc1_adapter_buffer_data* lookup_buffer_data(
-        struct gralloc1_device* dev, buffer_handle_t buffer)
-{
-    const struct gralloc1_adapter_module* mod = gralloc1_adapter_module(dev);
-    if (!mod->adapter.is_registered(&mod->base, buffer))
-        return NULL;
-
-    return mod->adapter.get_data(&mod->base, buffer);
-}
-
-static struct gralloc1_adapter_buffer_descriptor* lookup_buffer_descriptor(
-        struct gralloc1_device* dev, gralloc1_buffer_descriptor_t id)
-{
-    /* do we want to validate? */
-    return (struct gralloc1_adapter_buffer_descriptor*) ((uintptr_t) id);
-}
-
-static void device_dump(struct gralloc1_device* device,
-        uint32_t* outSize, char* outBuffer)
-{
-    struct gralloc1_adapter_device* dev = gralloc1_adapter_device(device);
-
-    if (outBuffer) {
-        uint32_t copy = (uint32_t) dev->saved_dump_size;
-        if (*outSize < copy) {
-            copy = *outSize;
-        } else {
-            *outSize = copy;
-        }
-
-        memcpy(outBuffer, dev->saved_dump, copy);
-    } else {
-        /* dump is optional and may not null-terminate */
-        if (dev->alloc_dev->dump) {
-            dev->alloc_dev->dump(dev->alloc_dev, dev->saved_dump,
-                    sizeof(dev->saved_dump) - 1);
-            dev->saved_dump_size = strlen(dev->saved_dump);
-        }
-
-        *outSize = (uint32_t) dev->saved_dump_size;
-    }
-}
-
-static int32_t device_create_descriptor(struct gralloc1_device* device,
-        gralloc1_buffer_descriptor_t* outDescriptor)
-{
-    struct gralloc1_adapter_buffer_descriptor* desc;
-
-    desc = calloc(1, sizeof(*desc));
-    if (!desc) {
-        return GRALLOC1_ERROR_NO_RESOURCES;
-    }
-
-    *outDescriptor = (gralloc1_buffer_descriptor_t) (uintptr_t) desc;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_destroy_descriptor(struct gralloc1_device* device,
-        gralloc1_buffer_descriptor_t descriptor)
-{
-    struct gralloc1_adapter_buffer_descriptor* desc =
-        lookup_buffer_descriptor(device, descriptor);
-    if (!desc) {
-        return GRALLOC1_ERROR_BAD_DESCRIPTOR;
-    }
-
-    free(desc);
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_set_consumer_usage(struct gralloc1_device* device,
-        gralloc1_buffer_descriptor_t descriptor, uint64_t usage)
-{
-    struct gralloc1_adapter_buffer_descriptor* desc =
-        lookup_buffer_descriptor(device, descriptor);
-    if (!desc) {
-        return GRALLOC1_ERROR_BAD_DESCRIPTOR;
-    }
-
-    desc->consumer_usage = (int) usage;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_set_dimensions(struct gralloc1_device* device,
-        gralloc1_buffer_descriptor_t descriptor,
-        uint32_t width, uint32_t height)
-{
-    struct gralloc1_adapter_buffer_descriptor* desc =
-        lookup_buffer_descriptor(device, descriptor);
-    if (!desc) {
-        return GRALLOC1_ERROR_BAD_DESCRIPTOR;
-    }
-
-    desc->width = (int) width;
-    desc->height = (int) height;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_set_format(struct gralloc1_device* device,
-        gralloc1_buffer_descriptor_t descriptor, int32_t format)
-{
-    struct gralloc1_adapter_buffer_descriptor* desc =
-        lookup_buffer_descriptor(device, descriptor);
-    if (!desc) {
-        return GRALLOC1_ERROR_BAD_DESCRIPTOR;
-    }
-
-    desc->format = format;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_set_producer_usage(struct gralloc1_device* device,
-        gralloc1_buffer_descriptor_t descriptor, uint64_t usage)
-{
-    struct gralloc1_adapter_buffer_descriptor* desc =
-        lookup_buffer_descriptor(device, descriptor);
-    if (!desc) {
-        return GRALLOC1_ERROR_BAD_DESCRIPTOR;
-    }
-
-    desc->producer_usage = (int) usage;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_get_backing_store(struct gralloc1_device* device,
-        buffer_handle_t buffer, gralloc1_backing_store_t* outStore)
-{
-    /* we never share backing store */
-    *outStore = (gralloc1_backing_store_t) (uintptr_t) buffer;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_get_consumer_usage(struct gralloc1_device* device,
-        buffer_handle_t buffer, uint64_t* outUsage)
-{
-    const struct gralloc1_adapter_buffer_data* data =
-        lookup_buffer_data(device, buffer);
-    if (!data) {
-        return GRALLOC1_ERROR_BAD_HANDLE;
-    }
-
-    *outUsage = data->info.usage;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_get_dimensions(struct gralloc1_device* device,
-        buffer_handle_t buffer, uint32_t* outWidth, uint32_t* outHeight)
-{
-    const struct gralloc1_adapter_buffer_data* data =
-        lookup_buffer_data(device, buffer);
-    if (!data) {
-        return GRALLOC1_ERROR_BAD_HANDLE;
-    }
-
-    *outWidth = data->info.width;
-    *outHeight = data->info.height;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_get_format(struct gralloc1_device* device,
-        buffer_handle_t buffer, int32_t* outFormat)
-{
-    const struct gralloc1_adapter_buffer_data* data =
-        lookup_buffer_data(device, buffer);
-    if (!data) {
-        return GRALLOC1_ERROR_BAD_HANDLE;
-    }
-
-    *outFormat = data->info.format;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_get_producer_usage(struct gralloc1_device* device,
-        buffer_handle_t buffer, uint64_t* outUsage)
-{
-    const struct gralloc1_adapter_buffer_data* data =
-        lookup_buffer_data(device, buffer);
-    if (!data) {
-        return GRALLOC1_ERROR_BAD_HANDLE;
-    }
-
-    *outUsage = data->info.usage;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_get_stride(struct gralloc1_device* device,
-        buffer_handle_t buffer, uint32_t* outStride)
-{
-    const struct gralloc1_adapter_buffer_data* data =
-        lookup_buffer_data(device, buffer);
-    if (!data) {
-        return GRALLOC1_ERROR_BAD_HANDLE;
-    }
-
-    *outStride = data->info.stride;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_allocate(struct gralloc1_device* device,
-        uint32_t numDescriptors,
-        const gralloc1_buffer_descriptor_t* descriptors,
-        buffer_handle_t* outBuffers)
-{
-    const struct gralloc1_adapter_module* mod =
-        gralloc1_adapter_module(device);
-    struct gralloc1_adapter_device* dev = gralloc1_adapter_device(device);
-    gralloc1_error_t err = GRALLOC1_ERROR_NONE;
-    uint32_t i;
-
-    for (i = 0; i < numDescriptors; i++) {
-        const struct gralloc1_adapter_buffer_descriptor* desc =
-            lookup_buffer_descriptor(device, descriptors[i]);
-        struct gralloc1_adapter_buffer_data* data;
-        buffer_handle_t buffer;
-        int dummy_stride;
-        int ret;
-
-        if (!desc) {
-            err = GRALLOC1_ERROR_BAD_DESCRIPTOR;
-            break;
-        }
-
-        data = calloc(1, sizeof(*data));
-        if (!data) {
-            err = GRALLOC1_ERROR_NO_RESOURCES;
-            break;
-        }
-
-        ret = dev->alloc_dev->alloc(dev->alloc_dev, desc->width, desc->height,
-                desc->format, desc->producer_usage | desc->consumer_usage,
-                &buffer, &dummy_stride);
-        if (ret) {
-            free(data);
-            err = GRALLOC1_ERROR_NO_RESOURCES;
-            break;
-        }
-
-        mod->adapter.get_info(&mod->base, buffer, &data->info);
-        data->refcount = 1;
-        data->owned = true;
-
-        mod->adapter.set_data(&mod->base, buffer, data);
-
-        outBuffers[i] = buffer;
-    }
-
-    if (err != GRALLOC1_ERROR_NONE) {
-        uint32_t j;
-        for (j = 0; j < i; j++) {
-            free(mod->adapter.get_data(&mod->base, outBuffers[i]));
-            dev->alloc_dev->free(dev->alloc_dev, outBuffers[i]);
-        }
-
-        return err;
-    }
-
-    return (numDescriptors > 1) ?
-        GRALLOC1_ERROR_NOT_SHARED : GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_retain(struct gralloc1_device* device,
-        buffer_handle_t buffer)
-{
-    static pthread_mutex_t register_mutex = PTHREAD_MUTEX_INITIALIZER;
-    const struct gralloc1_adapter_module* mod =
-        gralloc1_adapter_module(device);
-    struct gralloc1_adapter_buffer_data* data;
-
-    pthread_mutex_lock(&register_mutex);
-
-    if (mod->adapter.is_registered(&mod->base, buffer)) {
-        data = mod->adapter.get_data(&mod->base, buffer);
-        data->refcount++;
-    } else {
-        int ret;
-
-        data = calloc(1, sizeof(*data));
-        if (!data) {
-            pthread_mutex_unlock(&register_mutex);
-            return GRALLOC1_ERROR_NO_RESOURCES;
-        }
-
-        ret = mod->base.registerBuffer(&mod->base, buffer);
-        if (ret) {
-            pthread_mutex_unlock(&register_mutex);
-            free(data);
-
-            return GRALLOC1_ERROR_NO_RESOURCES;
-        }
-
-        mod->adapter.get_info(&mod->base, buffer, &data->info);
-        data->refcount = 1;
-        data->owned = false;
-
-        mod->adapter.set_data(&mod->base, buffer, data);
-    }
-
-    pthread_mutex_unlock(&register_mutex);
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_release(struct gralloc1_device* device,
-        buffer_handle_t buffer)
-{
-    struct gralloc1_adapter_buffer_data* data =
-        lookup_buffer_data(device, buffer);
-    if (!data) {
-        ALOGE("unable to release unregistered buffer %p", buffer);
-        return GRALLOC1_ERROR_BAD_HANDLE;
-    }
-
-    data->refcount--;
-    if (!data->refcount) {
-        if (data->owned) {
-            struct gralloc1_adapter_device* dev =
-                gralloc1_adapter_device(device);
-            dev->alloc_dev->free(dev->alloc_dev, buffer);
-        } else {
-            const struct gralloc1_adapter_module* mod =
-                gralloc1_adapter_module(device);
-            mod->base.unregisterBuffer(&mod->base, buffer);
-
-            native_handle_close(buffer);
-            native_handle_delete((native_handle_t*) buffer);
-        }
-
-        free(data);
-    }
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_get_num_flex_planes(struct gralloc1_device* device,
-        buffer_handle_t buffer, uint32_t* outNumPlanes)
-{
-    const struct gralloc1_adapter_buffer_data* data =
-        lookup_buffer_data(device, buffer);
-    if (!data) {
-        return GRALLOC1_ERROR_BAD_HANDLE;
-    }
-
-    *outNumPlanes = data->info.num_flex_planes;
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_lock(struct gralloc1_device* device,
-        buffer_handle_t buffer,
-        uint64_t producerUsage, uint64_t consumerUsage,
-        const gralloc1_rect_t* accessRegion, void** outData,
-        int32_t acquireFence)
-{
-    const struct gralloc1_adapter_module* mod =
-        gralloc1_adapter_module(device);
-    const int usage = (int) (producerUsage | consumerUsage);
-    const struct gralloc1_adapter_buffer_data* data =
-        lookup_buffer_data(device, buffer);
-    int ret;
-
-    if (!data) {
-        ALOGE("unable to lock unregistered buffer %p", buffer);
-        return GRALLOC1_ERROR_BAD_HANDLE;
-    }
-
-    if (mod->adapter.real_module_api_version >=
-            GRALLOC_MODULE_API_VERSION_0_3) {
-        ret = mod->base.lockAsync(&mod->base,
-                buffer, usage,
-                accessRegion->left,
-                accessRegion->top,
-                accessRegion->width,
-                accessRegion->height,
-                outData, acquireFence);
-    } else {
-        if (acquireFence >= 0) {
-            sync_wait(acquireFence, -1);
-        }
-
-        ret = mod->base.lock(&mod->base,
-                buffer, usage,
-                accessRegion->left,
-                accessRegion->top,
-                accessRegion->width,
-                accessRegion->height,
-                outData);
-
-        if (acquireFence >= 0 && !ret) {
-            close(acquireFence);
-        }
-    }
-
-    return (ret) ? GRALLOC1_ERROR_NO_RESOURCES : GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_lock_flex(struct gralloc1_device* device,
-        buffer_handle_t buffer,
-        uint64_t producerUsage, uint64_t consumerUsage,
-        const gralloc1_rect_t* accessRegion,
-        struct android_flex_layout* outFlexLayout,
-        int32_t acquireFence)
-{
-    const struct gralloc1_adapter_module* mod =
-        gralloc1_adapter_module(device);
-    const int usage = (int) (producerUsage | consumerUsage);
-    const struct gralloc1_adapter_buffer_data* data =
-        lookup_buffer_data(device, buffer);
-    struct android_ycbcr ycbcr;
-    int ret;
-
-    if (!data) {
-        ALOGE("unable to lockFlex unregistered buffer %p", buffer);
-        return GRALLOC1_ERROR_BAD_HANDLE;
-    }
-
-    if (outFlexLayout->num_planes < data->info.num_flex_planes) {
-        return GRALLOC1_ERROR_BAD_VALUE;
-    }
-
-    if (mod->adapter.real_module_api_version >=
-            GRALLOC_MODULE_API_VERSION_0_3 && mod->base.lockAsync_ycbcr) {
-        ret = mod->base.lockAsync_ycbcr(&mod->base,
-                buffer, usage,
-                accessRegion->left,
-                accessRegion->top,
-                accessRegion->width,
-                accessRegion->height,
-                &ycbcr, acquireFence);
-    } else if (mod->base.lock_ycbcr) {
-        if (acquireFence >= 0) {
-            sync_wait(acquireFence, -1);
-        }
-
-        ret = mod->base.lock_ycbcr(&mod->base,
-                buffer, usage,
-                accessRegion->left,
-                accessRegion->top,
-                accessRegion->width,
-                accessRegion->height,
-                &ycbcr);
-
-        if (acquireFence >= 0 && !ret) {
-            close(acquireFence);
-        }
-    } else {
-        return GRALLOC1_ERROR_UNSUPPORTED;
-    }
-
-    if (ret) {
-        return GRALLOC1_ERROR_NO_RESOURCES;
-    }
-
-    mod->adapter.get_flexible_layout(&mod->base, buffer,
-            &ycbcr, outFlexLayout);
-
-    return GRALLOC1_ERROR_NONE;
-}
-
-static int32_t device_unlock(struct gralloc1_device* device,
-        buffer_handle_t buffer, int32_t* outReleaseFence)
-{
-    const struct gralloc1_adapter_module* mod =
-        gralloc1_adapter_module(device);
-    int ret;
-
-    if (mod->adapter.real_module_api_version >=
-            GRALLOC_MODULE_API_VERSION_0_3) {
-        ret = mod->base.unlockAsync(&mod->base, buffer, outReleaseFence);
-    } else {
-        ret = mod->base.unlock(&mod->base, buffer);
-        if (!ret) {
-            *outReleaseFence = -1;
-        }
-    }
-
-    return (ret) ? GRALLOC1_ERROR_BAD_HANDLE : GRALLOC1_ERROR_NONE;
-}
-
-static gralloc1_function_pointer_t device_get_function(
-        struct gralloc1_device* device, int32_t descriptor)
-{
-    switch ((gralloc1_function_descriptor_t) descriptor) {
-#define CASE(id, ptr)              \
-    case GRALLOC1_FUNCTION_ ## id: \
-        return (gralloc1_function_pointer_t) device_ ## ptr
-    CASE(DUMP, dump);
-    CASE(CREATE_DESCRIPTOR, create_descriptor);
-    CASE(DESTROY_DESCRIPTOR, destroy_descriptor);
-    CASE(SET_CONSUMER_USAGE, set_consumer_usage);
-    CASE(SET_DIMENSIONS, set_dimensions);
-    CASE(SET_FORMAT, set_format);
-    CASE(SET_PRODUCER_USAGE, set_producer_usage);
-    CASE(GET_BACKING_STORE, get_backing_store);
-    CASE(GET_CONSUMER_USAGE, get_consumer_usage);
-    CASE(GET_DIMENSIONS, get_dimensions);
-    CASE(GET_FORMAT, get_format);
-    CASE(GET_PRODUCER_USAGE, get_producer_usage);
-    CASE(GET_STRIDE, get_stride);
-    CASE(ALLOCATE, allocate);
-    CASE(RETAIN, retain);
-    CASE(RELEASE, release);
-    CASE(GET_NUM_FLEX_PLANES, get_num_flex_planes);
-    CASE(LOCK, lock);
-    CASE(LOCK_FLEX, lock_flex);
-    CASE(UNLOCK, unlock);
-#undef CASE
-    default: return NULL;
-    }
-}
-
-static void device_get_capabilities(struct gralloc1_device* device,
-        uint32_t* outCount, int32_t* outCapabilities)
-{
-    *outCount = 0;
-}
-
-static int device_close(struct hw_device_t* device)
-{
-    struct gralloc1_adapter_device* dev =
-        (struct gralloc1_adapter_device*) device;
-    int ret;
-
-    ret = dev->alloc_dev->common.close(&dev->alloc_dev->common);
-    if (!ret) {
-        free(dev);
-    }
-
-    return ret;
-}
-
-int gralloc1_adapter_device_open(const struct hw_module_t* module,
-        const char* id, struct hw_device_t** device)
-{
-    const struct gralloc1_adapter_module* mod =
-        (const struct gralloc1_adapter_module*) module;
-    struct alloc_device_t* alloc_dev;
-    struct gralloc1_adapter_device* dev;
-    int ret;
-
-    if (strcmp(id, GRALLOC_HARDWARE_MODULE_ID) != 0) {
-        ALOGE("unknown gralloc1 device id: %s", id);
-        return -EINVAL;
-    }
-
-    ret = module->methods->open(module, GRALLOC_HARDWARE_GPU0,
-            (struct hw_device_t**) &alloc_dev);
-    if (ret) {
-        return ret;
-    }
-
-    dev = malloc(sizeof(*dev));
-    if (!dev) {
-        alloc_dev->common.close(&alloc_dev->common);
-        return -ENOMEM;
-    }
-
-    *dev = (struct gralloc1_adapter_device) {
-        .base = {
-            .common = {
-                .tag = HARDWARE_DEVICE_TAG,
-                .version = HARDWARE_DEVICE_API_VERSION(0, 0),
-                .module = (struct hw_module_t*) mod,
-                .close = device_close,
-            },
-            .getCapabilities = device_get_capabilities,
-            .getFunction = device_get_function,
-        },
-        .alloc_dev = alloc_dev,
-    };
-
-    *device = (struct hw_device_t*) dev;
-
-    return 0;
-}
diff --git a/graphics/allocator/2.0/default/gralloc1-adapter.cpp b/graphics/allocator/2.0/default/gralloc1-adapter.cpp
new file mode 100644
index 0000000..fcc59cd
--- /dev/null
+++ b/graphics/allocator/2.0/default/gralloc1-adapter.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright 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.
+ */
+
+#include "Gralloc1On0Adapter.h"
+#include "gralloc1-adapter.h"
+
+int gralloc1_adapter_device_open(const struct hw_module_t* module,
+        const char* id, struct hw_device_t** device)
+{
+    if (strcmp(id, GRALLOC_HARDWARE_MODULE_ID) != 0) {
+        ALOGE("unknown gralloc1 device id: %s", id);
+        return -EINVAL;
+    }
+
+    auto adapter_device = new android::hardware::Gralloc1On0Adapter(module);
+    *device = &adapter_device->common;
+
+    return 0;
+}
diff --git a/graphics/allocator/2.0/default/gralloc1-adapter.h b/graphics/allocator/2.0/default/gralloc1-adapter.h
index f48cd9e..b912ef6 100644
--- a/graphics/allocator/2.0/default/gralloc1-adapter.h
+++ b/graphics/allocator/2.0/default/gralloc1-adapter.h
@@ -16,52 +16,69 @@
 #ifndef ANDROID_HARDWARE_GRALLOC1_ADAPTER_H
 #define ANDROID_HARDWARE_GRALLOC1_ADAPTER_H
 
-#include <stdbool.h>
-#include <hardware/gralloc.h>
+#include <hardware/hardware.h>
 
 __BEGIN_DECLS
 
-struct gralloc1_adapter_buffer_info {
-    int width;
-    int height;
-    int format;
-    int usage;
+#define GRALLOC1_ADAPTER_MODULE_API_VERSION_1_0 \
+    HARDWARE_MODULE_API_VERSION(1, 0)
 
-    int stride;
-    uint32_t num_flex_planes;
-};
+enum {
+    GRALLOC1_ADAPTER_PERFORM_FIRST = 10000,
 
-/* This struct must be embedded in the HAL's HAL_MODULE_INFO_SYM and must
- * follow gralloc_module_t immediately. */
-struct gralloc1_adapter {
-    uint16_t real_module_api_version;
+    // void getRealModuleApiVersionMinor(..., int* outMinorVersion);
+    GRALLOC1_ADAPTER_PERFORM_GET_REAL_MODULE_API_VERSION_MINOR =
+        GRALLOC1_ADAPTER_PERFORM_FIRST,
 
-    /* Return true if the buffer is registered.  A locally allocated buffer is
-     * always registered.
-     *
-     * This function is called frequently.  It must be thread safe just like
-     * other functions are.
-     */
-    bool (*is_registered)(const struct gralloc_module_t* mod,
-            buffer_handle_t buffer);
+    // void setUsages(..., buffer_handle_t buffer,
+    //                     int producerUsage,
+    //                     int consumerUsage);
+    GRALLOC1_ADAPTER_PERFORM_SET_USAGES =
+        GRALLOC1_ADAPTER_PERFORM_FIRST + 1,
 
-    /* Set the adapter data for a registered buffer. */
-    void (*set_data)(const struct gralloc_module_t* mod,
-            buffer_handle_t buffer, void* data);
+    // void getDimensions(..., buffer_handle_t buffer,
+    //                         int* outWidth,
+    //                         int* outHeight);
+    GRALLOC1_ADAPTER_PERFORM_GET_DIMENSIONS =
+        GRALLOC1_ADAPTER_PERFORM_FIRST + 2,
 
-    /* Get the adapter data for a registered buffer. */
-    void* (*get_data)(const struct gralloc_module_t* mod,
-            buffer_handle_t buffer);
+    // void getFormat(..., buffer_handle_t buffer, int* outFormat);
+    GRALLOC1_ADAPTER_PERFORM_GET_FORMAT =
+        GRALLOC1_ADAPTER_PERFORM_FIRST + 3,
 
-    /* Get the buffer info, such as width, height, etc. */
-    void (*get_info)(const struct gralloc_module_t* mod,
-            buffer_handle_t buffer,
-            struct gralloc1_adapter_buffer_info* info);
+    // void getProducerUsage(..., buffer_handle_t buffer, int* outUsage);
+    GRALLOC1_ADAPTER_PERFORM_GET_PRODUCER_USAGE =
+        GRALLOC1_ADAPTER_PERFORM_FIRST + 4,
 
-    /* Get the flexilble layout matching ycbcr. */
-    void (*get_flexible_layout)(const struct gralloc_module_t* mod,
-            buffer_handle_t buffer, const struct android_ycbcr* ycbcr,
-            struct android_flex_layout* layout);
+    // void getConsumerUsage(..., buffer_handle_t buffer, int* outUsage);
+    GRALLOC1_ADAPTER_PERFORM_GET_CONSUMER_USAGE =
+        GRALLOC1_ADAPTER_PERFORM_FIRST + 5,
+
+    // void getBackingStore(..., buffer_handle_t buffer,
+    //                           uint64_t* outBackingStore);
+    GRALLOC1_ADAPTER_PERFORM_GET_BACKING_STORE =
+        GRALLOC1_ADAPTER_PERFORM_FIRST + 6,
+
+    // void getNumFlexPlanes(..., buffer_handle_t buffer,
+    //                            int* outNumFlexPlanes);
+    GRALLOC1_ADAPTER_PERFORM_GET_NUM_FLEX_PLANES =
+        GRALLOC1_ADAPTER_PERFORM_FIRST + 7,
+
+    // void getStride(..., buffer_handle_t buffer, int* outStride);
+    GRALLOC1_ADAPTER_PERFORM_GET_STRIDE =
+        GRALLOC1_ADAPTER_PERFORM_FIRST + 8,
+
+    // void lockFlex(..., buffer_handle_t buffer,
+    //                    int producerUsage,
+    //                    int consumerUsage,
+    //                    int left,
+    //                    int top,
+    //                    int width,
+    //                    int height,
+    //                    android_flex_layout* outLayout,
+    //                    int acquireFence);
+    GRALLOC1_ADAPTER_PERFORM_LOCK_FLEX =
+        GRALLOC1_ADAPTER_PERFORM_FIRST + 9,
 };
 
 int gralloc1_adapter_device_open(const struct hw_module_t* module,
diff --git a/graphics/allocator/2.0/vts/AllocatorClient.vts b/graphics/allocator/2.0/vts/AllocatorClient.vts
new file mode 100644
index 0000000..face060
--- /dev/null
+++ b/graphics/allocator/2.0/vts/AllocatorClient.vts
@@ -0,0 +1,169 @@
+component_class: HAL_HIDL
+component_type_version: 2.0
+component_name: "IAllocatorClient"
+
+package: "android.hardware.graphics.allocator"
+
+import: "android.hardware.graphics.allocator@2.0::types"
+import: "android.hardware.graphics.common@1.0::types"
+
+interface: {
+    attribute: {
+        name: "::android::hardware::graphics::allocator::V2_0::IAllocatorClient::BufferDescriptorInfo"
+        type: TYPE_STRUCT
+        struct_value: {
+            name: "width"
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        struct_value: {
+            name: "height"
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        struct_value: {
+            name: "layerCount"
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        struct_value: {
+            name: "format"
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::common::V1_0::PixelFormat"
+        }
+        struct_value: {
+            name: "producerUsageMask"
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        struct_value: {
+            name: "consumerUsageMask"
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+    }
+
+    api: {
+        name: "createDescriptor"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::IAllocatorClient::BufferDescriptorInfo"
+        }
+        callflow: {
+            entry: true
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "destroyDescriptor"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        callflow: {
+            exit: true
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "testAllocate"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint64_t"
+            }
+        }
+        callflow: {
+            next: "allocate"
+        }
+    }
+
+    api: {
+        name: "allocate"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint64_t"
+            }
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint64_t"
+            }
+        }
+        callflow: {
+            next: "exportHandle"
+        }
+    }
+
+    api: {
+        name: "free"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        callflow: {
+            exit: true
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "exportHandle"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_HANDLE
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        callflow: {
+            next: "free"
+        }
+    }
+
+}
diff --git a/graphics/allocator/2.0/vts/Android.mk b/graphics/allocator/2.0/vts/Android.mk
new file mode 100644
index 0000000..00fd344
--- /dev/null
+++ b/graphics/allocator/2.0/vts/Android.mk
@@ -0,0 +1,19 @@
+#
+# 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 $(LOCAL_PATH)/functional/vts/testcases/hal/graphics/allocator/hidl/target/Android.mk
diff --git a/graphics/allocator/2.0/vts/functional/Android.bp b/graphics/allocator/2.0/vts/functional/Android.bp
index e1966dc..194b228 100644
--- a/graphics/allocator/2.0/vts/functional/Android.bp
+++ b/graphics/allocator/2.0/vts/functional/Android.bp
@@ -31,7 +31,11 @@
     ],
     static_libs: ["libgtest"],
     cflags: [
+        "--coverage",
         "-O0",
         "-g",
     ],
+    ldflags: [
+        "--coverage",
+    ],
 }
diff --git a/graphics/allocator/2.0/vts/functional/graphics_allocator_hidl_hal_test.cpp b/graphics/allocator/2.0/vts/functional/graphics_allocator_hidl_hal_test.cpp
index 22131ee..a0443d6 100644
--- a/graphics/allocator/2.0/vts/functional/graphics_allocator_hidl_hal_test.cpp
+++ b/graphics/allocator/2.0/vts/functional/graphics_allocator_hidl_hal_test.cpp
@@ -129,7 +129,7 @@
     }
   });
 
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
 }
 
 TEST_F(GraphicsAllocatorHidlTest, DumpDebugInfo) {
@@ -137,7 +137,7 @@
     // nothing to do
   });
 
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
 }
 
 TEST_F(GraphicsAllocatorHidlTest, CreateDestroyDescriptor) {
@@ -150,11 +150,11 @@
         descriptor = tmpDescriptor;
       });
 
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
   ASSERT_EQ(Error::NONE, error);
 
   auto err_ret = mClient->destroyDescriptor(descriptor);
-  ASSERT_TRUE(err_ret.getStatus().isOk());
+  ASSERT_TRUE(err_ret.isOk());
   ASSERT_EQ(Error::NONE, static_cast<Error>(err_ret));
 }
 
@@ -172,7 +172,7 @@
   descriptors[0] = descriptor;
 
   auto ret = mClient->testAllocate(descriptors);
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
 
   auto error = static_cast<Error>(ret);
   ASSERT_TRUE(error == Error::NONE || error == Error::NOT_SHARED);
@@ -193,7 +193,7 @@
   descriptors[1] = descriptor;
 
   auto ret = mClient->testAllocate(descriptors);
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
 
   auto error = static_cast<Error>(ret);
   ASSERT_TRUE(error == Error::NONE || error == Error::NOT_SHARED);
@@ -218,13 +218,13 @@
         buffers = tmpBuffers;
       });
 
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
   ASSERT_TRUE(error == Error::NONE || error == Error::NOT_SHARED);
   EXPECT_EQ(1u, buffers.size());
 
   if (!buffers.empty()) {
     auto err_ret = mClient->free(buffers[0]);
-    EXPECT_TRUE(err_ret.getStatus().isOk());
+    EXPECT_TRUE(err_ret.isOk());
     EXPECT_EQ(Error::NONE, static_cast<Error>(err_ret));
   }
 }
@@ -253,13 +253,13 @@
         buffers = tmpBuffers;
       });
 
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
   ASSERT_TRUE(error == Error::NONE || error == Error::NOT_SHARED);
   EXPECT_EQ(descriptors.size(), buffers.size());
 
   for (auto buf : buffers) {
     auto err_ret = mClient->free(buf);
-    EXPECT_TRUE(err_ret.getStatus().isOk());
+    EXPECT_TRUE(err_ret.isOk());
     EXPECT_EQ(Error::NONE, static_cast<Error>(err_ret));
   }
 }
@@ -280,18 +280,18 @@
         buffers = tmpBuffers;
       });
 
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
   ASSERT_TRUE(error == Error::NONE || error == Error::NOT_SHARED);
   ASSERT_EQ(1u, buffers.size());
 
   ret = mClient->exportHandle(
       descriptors[0], buffers[0],
       [&](const auto& tmpError, const auto&) { error = tmpError; });
-  EXPECT_TRUE(ret.getStatus().isOk());
+  EXPECT_TRUE(ret.isOk());
   EXPECT_EQ(Error::NONE, error);
 
   auto err_ret = mClient->free(buffers[0]);
-  EXPECT_TRUE(err_ret.getStatus().isOk());
+  EXPECT_TRUE(err_ret.isOk());
   EXPECT_EQ(Error::NONE, static_cast<Error>(err_ret));
 }
 
diff --git a/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/Android.mk b/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/Android.mk
new file mode 100644
index 0000000..2c1617f
--- /dev/null
+++ b/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/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 := HalGraphicsAllocatorHidlTargetTest
+VTS_CONFIG_SRC_DIR := testcases/hal/graphics/allocator/hidl/target
+include test/vts/tools/build/Android.host_config.mk
diff --git a/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/AndroidTest.xml b/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/AndroidTest.xml
new file mode 100644
index 0000000..4ef2e95
--- /dev/null
+++ b/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/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 Graphics Allocator HIDL HAL's basic 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="HalGraphicsAllocatorHidlTargetTest" />
+        <option name="binary-test-sources" value="
+            _32bit::DATA/nativetest/graphics_allocator_hidl_hal_test/graphics_allocator_hidl_hal_test,
+            _64bit::DATA/nativetest64/graphics_allocator_hidl_hal_test/graphics_allocator_hidl_hal_test,
+	    " />
+        <option name="binary-test-type" value="gtest" />
+        <option name="test-timeout" value="1m" />
+    </test>
+</configuration>
diff --git a/graphics/allocator/Android.mk b/graphics/allocator/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/graphics/allocator/Android.mk
@@ -0,0 +1,19 @@
+#
+# 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)
diff --git a/graphics/common/1.0/types.hal b/graphics/common/1.0/types.hal
index e20fedc..ebdba77 100644
--- a/graphics/common/1.0/types.hal
+++ b/graphics/common/1.0/types.hal
@@ -928,10 +928,6 @@
      * A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits.
      * Values beyond the range [0.0 - 1.0] would correspond to other colors
      * spaces and/or HDR content.
-     *
-     * TODO (courtneygo): Will we actually use this? We intend to use FP16
-     * storage for data using scRGB so we can do all work in linear space
-     * and don't have to worry as much about limited precision.
      */
     V0_SCRGB = STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED,
 
@@ -1015,6 +1011,24 @@
 
 
     /*
+     * Display P3
+     *
+     * Display P3 uses same primaries and white-point as DCI-P3
+     * linear transfer function makes this the same as DCI_P3_LINEAR.
+     */
+    DISPLAY_P3_LINEAR = STANDARD_DCI_P3 | TRANSFER_LINEAR | RANGE_FULL,
+
+
+    /*
+     * Display P3
+     *
+     * Use same primaries and white-point as DCI-P3
+     * but sRGB transfer function.
+     */
+    DISPLAY_P3 = STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_FULL,
+
+
+    /*
      * Adobe RGB
      *
      * Use full range, gamma 2.2 transfer and Adobe RGB primaries
diff --git a/graphics/composer/2.1/default/HwcClient.cpp b/graphics/composer/2.1/default/HwcClient.cpp
index 8c2dd6d..54dfd89 100644
--- a/graphics/composer/2.1/default/HwcClient.cpp
+++ b/graphics/composer/2.1/default/HwcClient.cpp
@@ -176,9 +176,9 @@
             mRelease(mDevice, handle);
         } else {
             mModule->unregisterBuffer(mModule, handle);
-            native_handle_close(handle);
-            native_handle_delete(const_cast<native_handle_t*>(handle));
         }
+        native_handle_close(handle);
+        native_handle_delete(const_cast<native_handle_t*>(handle));
     }
 
     // gralloc1
diff --git a/graphics/mapper/2.0/Android.mk b/graphics/mapper/2.0/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/graphics/mapper/2.0/Android.mk
@@ -0,0 +1,19 @@
+#
+# 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)
diff --git a/graphics/mapper/2.0/default/Android.bp b/graphics/mapper/2.0/default/Android.bp
index 02ed877..c3d2281 100644
--- a/graphics/mapper/2.0/default/Android.bp
+++ b/graphics/mapper/2.0/default/Android.bp
@@ -19,6 +19,7 @@
     srcs: ["GrallocMapper.cpp"],
     cppflags: ["-Wall", "-Wextra"],
     shared_libs: [
+        "android.hardware.graphics.allocator@2.0",
         "android.hardware.graphics.mapper@2.0",
         "libbase",
         "libcutils",
diff --git a/graphics/mapper/2.0/default/GrallocMapper.cpp b/graphics/mapper/2.0/default/GrallocMapper.cpp
index cd9db38..3b6460a 100644
--- a/graphics/mapper/2.0/default/GrallocMapper.cpp
+++ b/graphics/mapper/2.0/default/GrallocMapper.cpp
@@ -17,7 +17,9 @@
 
 #include "GrallocMapper.h"
 
+#include <mutex>
 #include <vector>
+#include <unordered_map>
 
 #include <string.h>
 
@@ -100,6 +102,9 @@
         GRALLOC1_PFN_LOCK_FLEX lockFlex;
         GRALLOC1_PFN_UNLOCK unlock;
     } mDispatch;
+
+    std::mutex mMutex;
+    std::unordered_map<buffer_handle_t, size_t> mBufferReferenceCounts;
 };
 
 GrallocMapperHal::GrallocMapperHal(const hw_module_t* module)
@@ -201,12 +206,34 @@
 Return<Error> GrallocMapperHal::retain(const hidl_handle& bufferHandle)
 {
     int32_t err = mDispatch.retain(mDevice, bufferHandle);
+    if (err == GRALLOC1_ERROR_NONE) {
+        auto nativeHandle = bufferHandle.getNativeHandle();
+        std::lock_guard<std::mutex> lock(mMutex);
+
+        ++mBufferReferenceCounts[nativeHandle];
+    }
     return static_cast<Error>(err);
 }
 
 Return<Error> GrallocMapperHal::release(const hidl_handle& bufferHandle)
 {
     int32_t err = mDispatch.release(mDevice, bufferHandle);
+    if (err == GRALLOC1_ERROR_NONE) {
+        auto nativeHandle = bufferHandle.getNativeHandle();
+        std::lock_guard<std::mutex> lock(mMutex);
+
+        auto iter = mBufferReferenceCounts.find(bufferHandle);
+        if (iter == mBufferReferenceCounts.end()) {
+            // this should never happen
+            err = GRALLOC1_ERROR_BAD_HANDLE;
+        } else if (--iter->second == 0) {
+            native_handle_close(nativeHandle);
+            native_handle_delete(const_cast<native_handle_t*>(nativeHandle));
+
+            mBufferReferenceCounts.erase(iter);
+        }
+    }
+
     return static_cast<Error>(err);
 }
 
diff --git a/graphics/mapper/2.0/vts/Android.mk b/graphics/mapper/2.0/vts/Android.mk
new file mode 100644
index 0000000..6185ddc
--- /dev/null
+++ b/graphics/mapper/2.0/vts/Android.mk
@@ -0,0 +1,19 @@
+#
+# 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 $(LOCAL_PATH)/functional/vts/testcases/hal/graphics/mapper/hidl/target/Android.mk
diff --git a/graphics/mapper/2.0/vts/Mapper.vts b/graphics/mapper/2.0/vts/Mapper.vts
new file mode 100644
index 0000000..26e049f
--- /dev/null
+++ b/graphics/mapper/2.0/vts/Mapper.vts
@@ -0,0 +1,280 @@
+component_class: HAL_HIDL
+component_type_version: 2.0
+component_name: "IMapper"
+
+package: "android.hardware.graphics.mapper"
+
+import: "android.hardware.graphics.allocator@2.0::types"
+import: "android.hardware.graphics.common@1.0::types"
+import: "android.hardware.graphics.mapper@2.0::types"
+
+interface: {
+    attribute: {
+        name: "::android::hardware::graphics::mapper::V2_0::IMapper::Rect"
+        type: TYPE_STRUCT
+        struct_value: {
+            name: "left"
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        struct_value: {
+            name: "top"
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        struct_value: {
+            name: "width"
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        struct_value: {
+            name: "height"
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "retain"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            entry: true
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "release"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            exit: true
+        }
+    }
+
+    api: {
+        name: "getDimensions"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getFormat"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::common::V1_0::PixelFormat"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getLayerCount"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getProducerUsageMask"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getConsumerUsageMask"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getBackingStore"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getStride"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "lock"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_POINTER
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::graphics::mapper::V2_0::IMapper::Rect"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "unlock"
+        }
+    }
+
+    api: {
+        name: "lockFlex"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::graphics::mapper::V2_0::FlexLayout"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::graphics::mapper::V2_0::IMapper::Rect"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "unlock"
+        }
+    }
+
+    api: {
+        name: "unlock"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_HANDLE
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+}
diff --git a/graphics/mapper/2.0/vts/functional/Android.bp b/graphics/mapper/2.0/vts/functional/Android.bp
new file mode 100644
index 0000000..27ea350
--- /dev/null
+++ b/graphics/mapper/2.0/vts/functional/Android.bp
@@ -0,0 +1,44 @@
+//
+// 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.
+//
+
+cc_test {
+    name: "graphics_mapper_hidl_hal_test",
+    gtest: true,
+    srcs: ["graphics_mapper_hidl_hal_test.cpp"],
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libcutils",
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libnativehelper",
+        "libsync",
+        "libutils",
+        "android.hardware.graphics.allocator@2.0",
+        "android.hardware.graphics.mapper@2.0",
+        "android.hardware.graphics.common@1.0",
+    ],
+    static_libs: ["libgtest"],
+    cflags: [
+        "--coverage",
+        "-O0",
+        "-g",
+    ],
+    ldflags: [
+        "--coverage",
+    ],
+}
diff --git a/graphics/mapper/2.0/vts/functional/graphics_mapper_hidl_hal_test.cpp b/graphics/mapper/2.0/vts/functional/graphics_mapper_hidl_hal_test.cpp
new file mode 100644
index 0000000..840da1a
--- /dev/null
+++ b/graphics/mapper/2.0/vts/functional/graphics_mapper_hidl_hal_test.cpp
@@ -0,0 +1,315 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "graphics_mapper_hidl_hal_test"
+
+#include <android-base/logging.h>
+#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
+#include <android/hardware/graphics/mapper/2.0/IMapper.h>
+#include <gtest/gtest.h>
+#include <sync/sync.h>
+
+namespace android {
+namespace hardware {
+namespace graphics {
+namespace mapper {
+namespace V2_0 {
+namespace tests {
+namespace {
+
+using namespace android::hardware::graphics::allocator::V2_0;
+using namespace android::hardware::graphics::common::V1_0;
+
+class GraphicsMapperHidlTest : public ::testing::Test {
+ protected:
+  void SetUp() override {
+    mAllocator = IAllocator::getService("gralloc");
+    ASSERT_NE(mAllocator, nullptr);
+
+    mAllocator->createClient([this](const auto& error, const auto& client) {
+      if (error == Error::NONE) {
+        mAllocatorClient = client;
+      }
+    });
+    ASSERT_NE(mAllocatorClient, nullptr);
+
+    mMapper = IMapper::getService("gralloc-mapper");
+    ASSERT_NE(nullptr, mMapper.get());
+    ASSERT_FALSE(mMapper->isRemote());
+
+    mDummyDescriptorInfo.width = 64;
+    mDummyDescriptorInfo.height = 64;
+    mDummyDescriptorInfo.layerCount = 1;
+    mDummyDescriptorInfo.format = PixelFormat::RGBA_8888;
+    mDummyDescriptorInfo.producerUsageMask =
+        static_cast<uint64_t>(ProducerUsage::CPU_WRITE);
+    mDummyDescriptorInfo.consumerUsageMask =
+        static_cast<uint64_t>(ConsumerUsage::CPU_READ);
+  }
+
+  void TearDown() override {}
+
+  const native_handle_t* allocate(
+      const IAllocatorClient::BufferDescriptorInfo& info) {
+    // create descriptor
+    Error err = Error::NO_RESOURCES;
+    BufferDescriptor descriptor;
+    mAllocatorClient->createDescriptor(
+        info, [&](const auto& tmpError, const auto& tmpDescriptor) {
+          err = tmpError;
+          descriptor = tmpDescriptor;
+        });
+    if (err != Error::NONE) {
+      return nullptr;
+    }
+
+    // allocate buffer
+    hidl_vec<BufferDescriptor> descriptors;
+    hidl_vec<Buffer> buffers;
+    descriptors.setToExternal(&descriptor, 1);
+    err = Error::NO_RESOURCES;
+    mAllocatorClient->allocate(
+        descriptors, [&](const auto& tmpError, const auto& tmpBuffers) {
+          err = tmpError;
+          buffers = tmpBuffers;
+        });
+    if ((err != Error::NONE && err != Error::NOT_SHARED) ||
+        buffers.size() != 1) {
+      mAllocatorClient->destroyDescriptor(descriptors[0]);
+      return nullptr;
+    }
+
+    // export handle
+    err = Error::NO_RESOURCES;
+    const native_handle_t* handle = nullptr;
+    mAllocatorClient->exportHandle(
+        descriptors[0], buffers[0],
+        [&](const auto& tmpError, const auto& tmpHandle) {
+          err = tmpError;
+          if (err != Error::NONE) {
+            return;
+          }
+
+          handle = native_handle_clone(tmpHandle);
+          if (!handle) {
+            err = Error::NO_RESOURCES;
+            return;
+          }
+
+          err = mMapper->retain(handle);
+          if (err != Error::NONE) {
+            native_handle_close(handle);
+            native_handle_delete(const_cast<native_handle_t*>(handle));
+            handle = nullptr;
+          }
+        });
+
+    mAllocatorClient->destroyDescriptor(descriptors[0]);
+    mAllocatorClient->free(buffers[0]);
+
+    if (err != Error::NONE) {
+      return nullptr;
+    }
+
+    return handle;
+  }
+
+  sp<IMapper> mMapper;
+
+  IAllocatorClient::BufferDescriptorInfo mDummyDescriptorInfo{};
+
+ private:
+  sp<IAllocator> mAllocator;
+  sp<IAllocatorClient> mAllocatorClient;
+};
+
+/**
+ * Test IMapper::retain and IMapper::release.
+ */
+TEST_F(GraphicsMapperHidlTest, RetainRelease) {
+  const native_handle_t* buffer = allocate(mDummyDescriptorInfo);
+  ASSERT_NE(buffer, nullptr);
+
+  const int maxRefs = 10;
+  for (int i = 0; i < maxRefs; i++) {
+    auto err = mMapper->retain(buffer);
+    EXPECT_EQ(Error::NONE, err);
+  }
+  for (int i = 0; i < maxRefs; i++) {
+    auto err = mMapper->release(buffer);
+    EXPECT_EQ(Error::NONE, err);
+  }
+
+  auto err = mMapper->release(buffer);
+  EXPECT_EQ(Error::NONE, err);
+}
+
+/**
+ * Test IMapper::get* getters.
+ */
+TEST_F(GraphicsMapperHidlTest, Getters) {
+  const native_handle_t* buffer = allocate(mDummyDescriptorInfo);
+  ASSERT_NE(buffer, nullptr);
+
+  Error err = Error::NO_RESOURCES;
+  IAllocatorClient::BufferDescriptorInfo info{};
+  mMapper->getDimensions(buffer, [&](const auto& tmpError, const auto& tmpWidth,
+                                     const auto& tmpHeight) {
+    err = tmpError;
+    info.width = tmpWidth;
+    info.height = tmpHeight;
+  });
+  EXPECT_EQ(Error::NONE, err);
+  mMapper->getFormat(buffer, [&](const auto& tmpError, const auto& tmpFormat) {
+    err = tmpError;
+    info.format = tmpFormat;
+  });
+  EXPECT_EQ(Error::NONE, err);
+  mMapper->getProducerUsageMask(
+      buffer, [&](const auto& tmpError, const auto& tmpUsage) {
+        err = tmpError;
+        info.producerUsageMask = tmpUsage;
+      });
+  EXPECT_EQ(Error::NONE, err);
+  mMapper->getConsumerUsageMask(
+      buffer, [&](const auto& tmpError, const auto& tmpUsage) {
+        err = tmpError;
+        info.consumerUsageMask = tmpUsage;
+      });
+  EXPECT_EQ(Error::NONE, err);
+
+  EXPECT_EQ(mDummyDescriptorInfo.width, info.width);
+  EXPECT_EQ(mDummyDescriptorInfo.height, info.height);
+  EXPECT_EQ(mDummyDescriptorInfo.format, info.format);
+  EXPECT_EQ(mDummyDescriptorInfo.producerUsageMask, info.producerUsageMask);
+  EXPECT_EQ(mDummyDescriptorInfo.consumerUsageMask, info.consumerUsageMask);
+
+  BackingStore store = 0;
+  mMapper->getBackingStore(buffer,
+                           [&](const auto& tmpError, const auto& tmpStore) {
+                             err = tmpError;
+                             store = tmpStore;
+                           });
+  EXPECT_EQ(Error::NONE, err);
+
+  uint32_t stride = 0;
+  mMapper->getStride(buffer, [&](const auto& tmpError, const auto& tmpStride) {
+    err = tmpError;
+    stride = tmpStride;
+  });
+  EXPECT_EQ(Error::NONE, err);
+  EXPECT_LE(info.width, stride);
+
+  err = mMapper->release(buffer);
+  EXPECT_EQ(Error::NONE, err);
+}
+
+/**
+ * Test IMapper::lock and IMapper::unlock.
+ */
+TEST_F(GraphicsMapperHidlTest, LockBasic) {
+  const auto& info = mDummyDescriptorInfo;
+  const native_handle_t* buffer = allocate(info);
+  ASSERT_NE(buffer, nullptr);
+
+  Error err = Error::NO_RESOURCES;
+  uint32_t stride = 0;
+  mMapper->getStride(buffer, [&](const auto& tmpError, const auto& tmpStride) {
+    err = tmpError;
+    stride = tmpStride;
+  });
+  EXPECT_EQ(Error::NONE, err);
+
+  // lock buffer for writing
+  const IMapper::Rect region{0, 0, static_cast<int32_t>(info.width),
+                             static_cast<int32_t>(info.height)};
+  hidl_handle acquireFence(nullptr);
+  uint32_t* data;
+  err = Error::NO_RESOURCES;
+  mMapper->lock(buffer, info.producerUsageMask, 0, region, acquireFence,
+          [&](const auto& tmpError, const auto& tmpData) {
+            err = tmpError;
+            data = static_cast<uint32_t*>(tmpData);
+          });
+
+  if (err == Error::NONE) {
+    for (uint32_t y = 0; y < info.height; y++) {
+      for (uint32_t x = 0; x < info.width; x++) {
+        data[stride * y + x] = info.height * y + x;
+      }
+    }
+  } else {
+    EXPECT_EQ(Error::NONE, err);
+  }
+
+  err = Error::NO_RESOURCES;
+  mMapper->unlock(buffer, [&](const auto& tmpError, const auto& tmpReleaseFence) {
+            err = tmpError;
+            auto handle = tmpReleaseFence.getNativeHandle();
+            if (handle && handle->numFds == 1) {
+                sync_wait(handle->data[0], -1);
+                close(handle->data[0]);
+            }
+          });
+  EXPECT_EQ(Error::NONE, err);
+
+  // lock buffer for reading
+  mMapper->lock(buffer, 0, info.consumerUsageMask, region, acquireFence,
+          [&](const auto& tmpError, const auto& tmpData) {
+            err = tmpError;
+            data = static_cast<uint32_t*>(tmpData);
+          });
+  if (err == Error::NONE) {
+    for (uint32_t y = 0; y < info.height; y++) {
+      for (uint32_t x = 0; x < info.width; x++) {
+        EXPECT_EQ(info.height * y + x, data[stride * y + x]);
+      }
+    }
+  } else {
+    EXPECT_EQ(Error::NONE, err);
+  }
+
+  err = Error::NO_RESOURCES;
+  mMapper->unlock(buffer, [&](const auto& tmpError, const auto& tmpReleaseFence) {
+            err = tmpError;
+            auto handle = tmpReleaseFence.getNativeHandle();
+            if (handle && handle->numFds == 1) {
+                sync_wait(handle->data[0], -1);
+                close(handle->data[0]);
+            }
+          });
+  EXPECT_EQ(Error::NONE, err);
+
+  err = mMapper->release(buffer);
+  EXPECT_EQ(Error::NONE, err);
+}
+
+}  // namespace anonymous
+}  // namespace tests
+}  // namespace V2_0
+}  // namespace mapper
+}  // namespace graphics
+}  // namespace hardware
+}  // namespace android
+
+int main(int argc, char** argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+
+  int status = RUN_ALL_TESTS();
+  LOG(INFO) << "Test result = " << status;
+
+  return status;
+}
diff --git a/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/Android.mk b/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/Android.mk
new file mode 100644
index 0000000..5f7fae8
--- /dev/null
+++ b/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/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 := HalGraphicsMapperHidlTargetTest
+VTS_CONFIG_SRC_DIR := testcases/hal/graphics/mapper/hidl/target
+include test/vts/tools/build/Android.host_config.mk
diff --git a/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/AndroidTest.xml b/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/AndroidTest.xml
new file mode 100644
index 0000000..b602ec4
--- /dev/null
+++ b/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/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 Graphics Mapper HIDL HAL's basic 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="HalGraphicsMapperHidlTargetTest" />
+        <option name="binary-test-sources" value="
+            _32bit::DATA/nativetest/graphics_mapper_hidl_hal_test/graphics_mapper_hidl_hal_test,
+            _64bit::DATA/nativetest64/graphics_mapper_hidl_hal_test/graphics_mapper_hidl_hal_test,
+	    " />
+        <option name="binary-test-type" value="gtest" />
+        <option name="test-timeout" value="1m" />
+    </test>
+</configuration>
diff --git a/graphics/mapper/2.0/vts/types.vts b/graphics/mapper/2.0/vts/types.vts
new file mode 100644
index 0000000..fee8535
--- /dev/null
+++ b/graphics/mapper/2.0/vts/types.vts
@@ -0,0 +1,139 @@
+component_class: HAL_HIDL
+component_type_version: 2.0
+component_name: "types"
+
+package: "android.hardware.graphics.mapper"
+
+
+attribute: {
+    name: "::android::hardware::graphics::mapper::V2_0::FlexComponent"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "Y"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CB"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "CR"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "R"
+        scalar_value: {
+            int32_t: 1024
+        }
+        enumerator: "G"
+        scalar_value: {
+            int32_t: 2048
+        }
+        enumerator: "B"
+        scalar_value: {
+            int32_t: 4096
+        }
+        enumerator: "A"
+        scalar_value: {
+            int32_t: 1073741824
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::graphics::mapper::V2_0::FlexFormat"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "INVALID"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "Y"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "YCBCR"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "YCBCRA"
+        scalar_value: {
+            int32_t: 1073741831
+        }
+        enumerator: "RGB"
+        scalar_value: {
+            int32_t: 7168
+        }
+        enumerator: "RGBA"
+        scalar_value: {
+            int32_t: 1073748992
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::graphics::mapper::V2_0::FlexPlane"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "topLeft"
+        type: TYPE_POINTER
+    }
+    struct_value: {
+        name: "component"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::graphics::mapper::V2_0::FlexComponent"
+    }
+    struct_value: {
+        name: "bitsPerComponent"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "bitsUsed"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "hIncrement"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "vIncrement"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "hSubsampling"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "vSubsampling"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::graphics::mapper::V2_0::FlexLayout"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "format"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::graphics::mapper::V2_0::FlexFormat"
+    }
+    struct_value: {
+        name: "planes"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::graphics::mapper::V2_0::FlexPlane"
+        }
+    }
+}
+
diff --git a/graphics/mapper/Android.mk b/graphics/mapper/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/graphics/mapper/Android.mk
@@ -0,0 +1,19 @@
+#
+# 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)
diff --git a/light/2.0/vts/functional/light_hidl_hal_test.cpp b/light/2.0/vts/functional/light_hidl_hal_test.cpp
index 9912079..9b9f543 100644
--- a/light/2.0/vts/functional/light_hidl_hal_test.cpp
+++ b/light/2.0/vts/functional/light_hidl_hal_test.cpp
@@ -36,8 +36,8 @@
 
 #define LIGHT_SERVICE_NAME "light"
 
-#define ASSERT_OK(ret) ASSERT_TRUE(ret.getStatus().isOk())
-#define EXPECT_OK(ret) EXPECT_TRUE(ret.getStatus().isOk())
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
 
 class LightHidlTest : public ::testing::Test {
 public:
diff --git a/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target/AndroidTest.xml b/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target/AndroidTest.xml
index 240f1f0..94a942b 100644
--- a/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target/AndroidTest.xml
+++ b/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target/AndroidTest.xml
@@ -24,6 +24,7 @@
             _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" />
     </test>
diff --git a/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target/HalLightHidlTargetBasicTest.config b/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target/HalLightHidlTargetBasicTest.config
new file mode 100644
index 0000000..cb572aa
--- /dev/null
+++ b/light/2.0/vts/functional/vts/testcases/hal/light/hidl/target/HalLightHidlTargetBasicTest.config
@@ -0,0 +1,33 @@
+{
+    "coverage": true,
+    "modules": [
+        {
+            "module_name": "system/lib64/hw/lights.bullhead",
+            "git_project": {
+                "name": "device/lge/bullhead",
+                "path": "device/lge/bullhead"
+            }
+        },
+        {
+            "module_name": "system/lib64/hw/lights.marlin",
+            "git_project": {
+                "name": "device/google/marlin",
+                "path": "device/google/marlin"
+            }
+        },
+        {
+            "module_name": "system/lib64/hw/lights.sailfish",
+            "git_project": {
+                "name": "device/google/marlin",
+                "path": "device/google/marlin"
+            }
+        },
+        {
+            "module_name": "system/lib64/hw/android.hardware.light@2.0-impl",
+            "git_project": {
+                "name": "platform/hardware/interfaces",
+                "path": "hardware/interfaces"
+            }
+        }
+    ]
+}
diff --git a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/host/NfcHidlBasicTest.py b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/host/NfcHidlBasicTest.py
index 136704a..de01f43 100644
--- a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/host/NfcHidlBasicTest.py
+++ b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/host/NfcHidlBasicTest.py
@@ -47,13 +47,14 @@
             self.dut.shell.one.Execute(
                 "setprop vts.hal.vts.hidl.get_stub false")
 
-        self.dut.hal.InitHidlHal(target_type="nfc",
-                                 target_basepaths=["/system/lib64"],
-                                 target_version=1.0,
-                                 target_package="android.hardware.nfc",
-                                 target_component_name="INfc",
-                                 hw_binder_service_name="nfc_nci",
-                                 bits=64)
+        self.dut.hal.InitHidlHal(
+            target_type="nfc",
+            target_basepaths=self.dut.libPaths,
+            target_version=1.0,
+            target_package="android.hardware.nfc",
+            target_component_name="INfc",
+            hw_binder_service_name="nfc_nci",
+            bits=64 if self.dut.is64Bit else 32)
 
     def tearDownClass(self):
         """Turns off the framework-layer NFC service."""
diff --git a/power/1.0/vts/functional/power_hidl_hal_test.cpp b/power/1.0/vts/functional/power_hidl_hal_test.cpp
index 045a34b..36bdb0a 100644
--- a/power/1.0/vts/functional/power_hidl_hal_test.cpp
+++ b/power/1.0/vts/functional/power_hidl_hal_test.cpp
@@ -49,10 +49,10 @@
   Return<void> ret;
 
   ret = power->setInteractive(true);
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
 
   ret = power->setInteractive(false);
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
 }
 
 // Sanity check Power::powerHint on good and bad inputs.
@@ -66,10 +66,10 @@
   Return<void> ret;
   for (auto hint : hints) {
     ret = power->powerHint(hint, 1);
-    ASSERT_TRUE(ret.getStatus().isOk());
+    ASSERT_TRUE(ret.isOk());
 
     ret = power->powerHint(hint, 0);
-    ASSERT_TRUE(ret.getStatus().isOk());
+    ASSERT_TRUE(ret.isOk());
   }
 }
 
@@ -77,15 +77,15 @@
 TEST_F(PowerHidlTest, SetFeature) {
   Return<void> ret;
   ret = power->setFeature(Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE, true);
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
   ret = power->setFeature(Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE, false);
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
 
   Feature badFeature = static_cast<Feature>(0x2);
   ret = power->setFeature(badFeature, true);
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
   ret = power->setFeature(badFeature, false);
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
 }
 
 // Sanity check Power::getPlatformLowPowerStats().
@@ -98,7 +98,7 @@
     s = status;
   };
   Return<void> ret = power->getPlatformLowPowerStats(cb);
-  ASSERT_TRUE(ret.getStatus().isOk());
+  ASSERT_TRUE(ret.isOk());
   ASSERT_TRUE(s == Status::SUCCESS || s == Status::FILESYSTEM_ERROR);
 }
 
diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp
index 7f58452..a02a632 100644
--- a/radio/1.0/Android.bp
+++ b/radio/1.0/Android.bp
@@ -86,3 +86,302 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.radio.vts.driver@1.0_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mDRIVER -tSOURCE -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "types.hal",
+        "IRadio.hal",
+        "IRadioIndication.hal",
+        "IRadioResponse.hal",
+        "ISap.hal",
+        "ISapCallback.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/types.vts.cpp",
+        "android/hardware/radio/1.0/Radio.vts.cpp",
+        "android/hardware/radio/1.0/RadioIndication.vts.cpp",
+        "android/hardware/radio/1.0/RadioResponse.vts.cpp",
+        "android/hardware/radio/1.0/Sap.vts.cpp",
+        "android/hardware/radio/1.0/SapCallback.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio.vts.driver@1.0_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mDRIVER -tHEADER -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "types.hal",
+        "IRadio.hal",
+        "IRadioIndication.hal",
+        "IRadioResponse.hal",
+        "ISap.hal",
+        "ISapCallback.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/types.vts.h",
+        "android/hardware/radio/1.0/Radio.vts.h",
+        "android/hardware/radio/1.0/RadioIndication.vts.h",
+        "android/hardware/radio/1.0/RadioResponse.vts.h",
+        "android/hardware/radio/1.0/Sap.vts.h",
+        "android/hardware/radio/1.0/SapCallback.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.radio.vts.driver@1.0",
+    generated_sources: ["android.hardware.radio.vts.driver@1.0_genc++"],
+    generated_headers: ["android.hardware.radio.vts.driver@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio.vts.driver@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "libvts_common",
+        "libvts_datatype",
+        "libvts_measurement",
+        "libvts_multidevice_proto",
+        "libcamera_metadata",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.radio@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hidl.base@1.0",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.0-IRadio-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "IRadio.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/Radio.vts.cpp",
+        "android/hardware/radio/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.0-IRadio-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "IRadio.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/Radio.vts.h",
+        "android/hardware/radio/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.radio@1.0-IRadio-vts.profiler",
+    generated_sources: ["android.hardware.radio@1.0-IRadio-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.radio@1.0-IRadio-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio@1.0-IRadio-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.radio@1.0",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.0-IRadioIndication-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "IRadioIndication.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/RadioIndication.vts.cpp",
+        "android/hardware/radio/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.0-IRadioIndication-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "IRadioIndication.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/RadioIndication.vts.h",
+        "android/hardware/radio/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.radio@1.0-IRadioIndication-vts.profiler",
+    generated_sources: ["android.hardware.radio@1.0-IRadioIndication-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.radio@1.0-IRadioIndication-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio@1.0-IRadioIndication-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.radio@1.0",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.0-IRadioResponse-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "IRadioResponse.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/RadioResponse.vts.cpp",
+        "android/hardware/radio/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.0-IRadioResponse-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "IRadioResponse.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/RadioResponse.vts.h",
+        "android/hardware/radio/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.radio@1.0-IRadioResponse-vts.profiler",
+    generated_sources: ["android.hardware.radio@1.0-IRadioResponse-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.radio@1.0-IRadioResponse-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio@1.0-IRadioResponse-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.radio@1.0",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.0-ISap-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "ISap.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/Sap.vts.cpp",
+        "android/hardware/radio/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.0-ISap-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "ISap.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/Sap.vts.h",
+        "android/hardware/radio/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.radio@1.0-ISap-vts.profiler",
+    generated_sources: ["android.hardware.radio@1.0-ISap-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.radio@1.0-ISap-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio@1.0-ISap-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.radio@1.0",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.0-ISapCallback-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "ISapCallback.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/SapCallback.vts.cpp",
+        "android/hardware/radio/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.0-ISapCallback-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/radio/1.0/ $(genDir)/android/hardware/radio/1.0/",
+    srcs: [
+        "ISapCallback.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/radio/1.0/SapCallback.vts.h",
+        "android/hardware/radio/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.radio@1.0-ISapCallback-vts.profiler",
+    generated_sources: ["android.hardware.radio@1.0-ISapCallback-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.radio@1.0-ISapCallback-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio@1.0-ISapCallback-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hidl.base@1.0",
+        "android.hardware.radio@1.0",
+    ],
+}
diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal
index 6475b4f..49ba30e 100644
--- a/radio/1.0/types.hal
+++ b/radio/1.0/types.hal
@@ -1089,8 +1089,7 @@
     int32_t gsmUmtsSubscriptionAppIndex;  // value < RadioConst:CARD_MAX_APPS, -1 if none
     int32_t cdmaSubscriptionAppIndex;     // value < RadioConst:CARD_MAX_APPS, -1 if none
     int32_t imsSubscriptionAppIndex;      // value < RadioConst:CARD_MAX_APPS, -1 if none
-    int32_t numApplications;              // value <= RadioConst:CARD_MAX_APPS
-    AppStatus[RadioConst:CARD_MAX_APPS] applications;
+    vec<AppStatus> applications;          // size <= RadioConst:CARD_MAX_APPS
 };
 
 /*
diff --git a/radio/1.0/vts/Android.mk b/radio/1.0/vts/Android.mk
new file mode 100644
index 0000000..df5dac8
--- /dev/null
+++ b/radio/1.0/vts/Android.mk
@@ -0,0 +1,19 @@
+#
+# 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)
\ No newline at end of file
diff --git a/radio/1.0/vts/Radio.vts b/radio/1.0/vts/Radio.vts
new file mode 100644
index 0000000..c3d998a
--- /dev/null
+++ b/radio/1.0/vts/Radio.vts
@@ -0,0 +1,1497 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "IRadio"
+
+package: "android.hardware.radio"
+
+import: "android.hardware.radio@1.0::IRadioIndication"
+import: "android.hardware.radio@1.0::IRadioResponse"
+import: "android.hardware.radio@1.0::types"
+
+interface: {
+    api: {
+        name: "setResponseFunctions"
+        arg: {
+            type: TYPE_HIDL_INTERFACE
+            predefined_type: "IRadioResponse"
+            is_callback: false
+        }
+        arg: {
+            type: TYPE_HIDL_INTERFACE
+            predefined_type: "IRadioIndication"
+            is_callback: false
+        }
+    }
+
+    api: {
+        name: "getIccCardStatus"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "supplyIccPinForApp"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "supplyIccPukForApp"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "supplyIccPin2ForApp"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "supplyIccPuk2ForApp"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "changeIccPinForApp"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "changeIccPin2ForApp"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "supplyNetworkDepersonalization"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "getCurrentCalls"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "dial"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::Dial"
+        }
+    }
+
+    api: {
+        name: "getImsiForApp"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "hangup"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "hangupWaitingOrBackground"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "hangupForegroundResumeBackground"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "switchWaitingOrHoldingAndActive"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "conference"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "rejectCall"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getLastCallFailCause"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getSignalStrength"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getVoiceRegistrationState"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getDataRegistrationState"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getOperator"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setRadioPower"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "sendDtmf"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "sendSms"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::GsmSmsMessage"
+        }
+    }
+
+    api: {
+        name: "sendSMSExpectMore"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::GsmSmsMessage"
+        }
+    }
+
+    api: {
+        name: "setupDataCall"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::ApnAuthType"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "iccIOForApp"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::IccIo"
+        }
+    }
+
+    api: {
+        name: "sendUssd"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "cancelPendingUssd"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getClir"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setClir"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getCallForwardStatus"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CallForwardInfo"
+        }
+    }
+
+    api: {
+        name: "setCallForward"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CallForwardInfo"
+        }
+    }
+
+    api: {
+        name: "getCallWaiting"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setCallWaiting"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "acknowledgeLastIncomingGsmSms"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SmsAcknowledgeFailCause"
+        }
+    }
+
+    api: {
+        name: "acceptCall"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "deactivateDataCall"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "getFacilityLockForApp"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "setFacilityLockForApp"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "setBarringPassword"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "getNetworkSelectionMode"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setNetworkSelectionModeAutomatic"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setNetworkSelectionModeManual"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "getAvailableNetworks"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "startDtmf"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "stopDtmf"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getBasebandVersion"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "separateConnection"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setMute"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "getMute"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getClip"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getDataCallList"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "sendOemRadioRequestRaw"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "sendOemRadioRequestStrings"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRING
+            }
+        }
+    }
+
+    api: {
+        name: "sendScreenState"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "setSuppServiceNotifications"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "writeSmsToSim"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SmsWriteArgs"
+        }
+    }
+
+    api: {
+        name: "deleteSmsOnSim"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setBandMode"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioBandMode"
+        }
+    }
+
+    api: {
+        name: "getAvailableBandModes"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "sendEnvelope"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "sendTerminalResponseToSim"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "handleStkCallSetupRequestFromSim"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "explicitCallTransfer"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setPreferredNetworkType"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::PreferredNetworkType"
+        }
+    }
+
+    api: {
+        name: "getPreferredNetworkType"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getNeighboringCids"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setLocationUpdates"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "setCdmaSubscriptionSource"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::CdmaSubscriptionSource"
+        }
+    }
+
+    api: {
+        name: "setCdmaRoamingPreference"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::CdmaRoamingType"
+        }
+    }
+
+    api: {
+        name: "getCdmaRoamingPreference"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setTTYMode"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::TtyMode"
+        }
+    }
+
+    api: {
+        name: "getTTYMode"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setPreferredVoicePrivacy"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "getPreferredVoicePrivacy"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "sendCDMAFeatureCode"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "sendBurstDtmf"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "sendCdmaSms"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaSmsMessage"
+        }
+    }
+
+    api: {
+        name: "acknowledgeLastIncomingCdmaSms"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaSmsAck"
+        }
+    }
+
+    api: {
+        name: "getGsmBroadcastConfig"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setGsmBroadcastConfig"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::GsmBroadcastSmsConfigInfo"
+            }
+        }
+    }
+
+    api: {
+        name: "setGsmBroadcastActivation"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "getCdmaBroadcastConfig"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setCdmaBroadcastConfig"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::CdmaBroadcastSmsConfigInfo"
+            }
+        }
+    }
+
+    api: {
+        name: "setCdmaBroadcastActivation"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "getCDMASubscription"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "writeSmsToRuim"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaSmsWriteArgs"
+        }
+    }
+
+    api: {
+        name: "deleteSmsOnRuim"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getDeviceIdentity"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "exitEmergencyCallbackMode"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getSmscAddress"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setSmscAddress"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "reportSmsMemoryStatus"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "reportStkServiceIsRunning"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getCdmaSubscriptionSource"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "requestIsimAuthentication"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "acknowledgeIncomingGsmSmsWithPdu"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "sendEnvelopeWithStatus"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "getVoiceRadioTechnology"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getCellInfoList"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setCellInfoListRate"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setInitialAttachApn"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::ApnAuthType"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "getImsRegistrationState"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "sendImsSms"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::ImsSmsMessage"
+        }
+    }
+
+    api: {
+        name: "iccTransmitApduBasicChannel"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SimApdu"
+        }
+    }
+
+    api: {
+        name: "iccOpenLogicalChannel"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "iccCloseLogicalChannel"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "iccTransmitApduLogicalChannel"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SimApdu"
+        }
+    }
+
+    api: {
+        name: "nvReadItem"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::NvItem"
+        }
+    }
+
+    api: {
+        name: "nvWriteItem"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::NvWriteItem"
+        }
+    }
+
+    api: {
+        name: "nvWriteCdmaPrl"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "nvResetConfig"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::ResetNvType"
+        }
+    }
+
+    api: {
+        name: "setUiccSubscription"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SelectUiccSub"
+        }
+    }
+
+    api: {
+        name: "setDataAllowed"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "getHardwareConfig"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "requestIccSimAuthentication"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "setDataProfile"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::DataProfileInfo"
+            }
+        }
+    }
+
+    api: {
+        name: "requestShutdown"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getRadioCapability"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setRadioCapability"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioCapability"
+        }
+    }
+
+    api: {
+        name: "startLceService"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "stopLceService"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "pullLceData"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getModemActivityInfo"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setAllowedCarriers"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CarrierRestrictions"
+        }
+    }
+
+    api: {
+        name: "getAllowedCarriers"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "responseAcknowledgement"
+    }
+
+}
diff --git a/radio/1.0/vts/RadioIndication.vts b/radio/1.0/vts/RadioIndication.vts
new file mode 100644
index 0000000..fac73a9
--- /dev/null
+++ b/radio/1.0/vts/RadioIndication.vts
@@ -0,0 +1,545 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "IRadioIndication"
+
+package: "android.hardware.radio"
+
+import: "android.hardware.radio@1.0::types"
+
+interface: {
+    api: {
+        name: "radioStateChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioState"
+        }
+    }
+
+    api: {
+        name: "callStateChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "voiceNetworkStateChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "newSms"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "newSmsStatusReport"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "newSmsOnSim"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "onUssd"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::UssdModeType"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "nitzTimeReceived"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+    }
+
+    api: {
+        name: "currentSignalStrength"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SignalStrength"
+        }
+    }
+
+    api: {
+        name: "dataCallListChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::SetupDataCallResult"
+            }
+        }
+    }
+
+    api: {
+        name: "suppSvcNotify"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SuppSvcNotification"
+        }
+    }
+
+    api: {
+        name: "stkSessionEnd"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "stkProactiveCommand"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "stkEventNotify"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "stkCallSetup"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int64_t"
+        }
+    }
+
+    api: {
+        name: "simSmsStorageFull"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "simRefresh"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SimRefreshResult"
+        }
+    }
+
+    api: {
+        name: "callRing"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaSignalInfoRecord"
+        }
+    }
+
+    api: {
+        name: "simStatusChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "cdmaNewSms"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaSmsMessage"
+        }
+    }
+
+    api: {
+        name: "newBroadcastSms"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "cdmaRuimSmsStorageFull"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "restrictedStateChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::PhoneRestrictedState"
+        }
+    }
+
+    api: {
+        name: "enterEmergencyCallbackMode"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "cdmaCallWaiting"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaCallWaiting"
+        }
+    }
+
+    api: {
+        name: "cdmaOtaProvisionStatus"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::CdmaOtaProvisionStatus"
+        }
+    }
+
+    api: {
+        name: "cdmaInfoRec"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaInformationRecords"
+        }
+    }
+
+    api: {
+        name: "oemHookRaw"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "indicateRingbackTone"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "resendIncallMute"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "cdmaSubscriptionSourceChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::CdmaSubscriptionSource"
+        }
+    }
+
+    api: {
+        name: "cdmaPrlChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "exitEmergencyCallbackMode"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "rilConnected"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "voiceRadioTechChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioTechnology"
+        }
+    }
+
+    api: {
+        name: "cellInfoList"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::CellInfo"
+            }
+        }
+    }
+
+    api: {
+        name: "imsNetworkStateChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+    }
+
+    api: {
+        name: "subscriptionStatusChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "srvccStateNotify"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SrvccState"
+        }
+    }
+
+    api: {
+        name: "hardwareConfigChanged"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::HardwareConfig"
+            }
+        }
+    }
+
+    api: {
+        name: "radioCapabilityIndication"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioCapability"
+        }
+    }
+
+    api: {
+        name: "onSupplementaryServiceIndication"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::StkCcUnsolSsResult"
+        }
+    }
+
+    api: {
+        name: "stkCallControlAlphaNotify"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "lceData"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::LceDataInfo"
+        }
+    }
+
+    api: {
+        name: "pcoData"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::PcoDataInfo"
+        }
+    }
+
+    api: {
+        name: "modemReset"
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioIndicationType"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+}
diff --git a/radio/1.0/vts/RadioResponse.vts b/radio/1.0/vts/RadioResponse.vts
new file mode 100644
index 0000000..2884d30
--- /dev/null
+++ b/radio/1.0/vts/RadioResponse.vts
@@ -0,0 +1,1382 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "IRadioResponse"
+
+package: "android.hardware.radio"
+
+import: "android.hardware.radio@1.0::types"
+
+interface: {
+    api: {
+        name: "getIccCardStatusResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CardStatus"
+        }
+    }
+
+    api: {
+        name: "supplyIccPinForAppResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "supplyIccPukForAppResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "supplyIccPin2ForAppResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "supplyIccPuk2ForAppResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "changeIccPinForAppResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "changeIccPin2ForAppResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "supplyNetworkDepersonalizationResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getCurrentCallsResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::Call"
+            }
+        }
+    }
+
+    api: {
+        name: "dialResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getIMSIForAppResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "hangupConnectionResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "hangupWaitingOrBackgroundResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "hangupForegroundResumeBackgroundResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "switchWaitingOrHoldingAndActiveResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "conferenceResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "rejectCallResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getLastCallFailCauseResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::LastCallFailCauseInfo"
+        }
+    }
+
+    api: {
+        name: "getSignalStrengthResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SignalStrength"
+        }
+    }
+
+    api: {
+        name: "getVoiceRegistrationStateResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::VoiceRegStateResult"
+        }
+    }
+
+    api: {
+        name: "getDataRegistrationStateResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::DataRegStateResult"
+        }
+    }
+
+    api: {
+        name: "getOperatorResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "setRadioPowerResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "sendDtmfResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "sendSmsResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SendSmsResult"
+        }
+    }
+
+    api: {
+        name: "sendSMSExpectMoreResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SendSmsResult"
+        }
+    }
+
+    api: {
+        name: "setupDataCallResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SetupDataCallResult"
+        }
+    }
+
+    api: {
+        name: "iccIOForAppResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::IccIoResult"
+        }
+    }
+
+    api: {
+        name: "sendUssdResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "cancelPendingUssdResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getClirResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setClirResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getCallForwardStatusResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::CallForwardInfo"
+            }
+        }
+    }
+
+    api: {
+        name: "setCallForwardResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getCallWaitingResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setCallWaitingResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "acknowledgeLastIncomingGsmSmsResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "acceptCallResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "deactivateDataCallResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getFacilityLockForAppResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setFacilityLockForAppResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setBarringPasswordResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getNetworkSelectionModeResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "setNetworkSelectionModeAutomaticResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setNetworkSelectionModeManualResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getAvailableNetworksResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::OperatorInfo"
+            }
+        }
+    }
+
+    api: {
+        name: "startDtmfResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "stopDtmfResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getBasebandVersionResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "separateConnectionResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setMuteResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getMuteResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "getClipResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::ClipStatus"
+        }
+    }
+
+    api: {
+        name: "getDataCallListResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::SetupDataCallResult"
+            }
+        }
+    }
+
+    api: {
+        name: "sendOemRilRequestRawResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "sendOemRilRequestStringsResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRING
+            }
+        }
+    }
+
+    api: {
+        name: "sendScreenStateResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setSuppServiceNotificationsResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "writeSmsToSimResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "deleteSmsOnSimResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setBandModeResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getAvailableBandModesResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_ENUM
+                predefined_type: "::android::hardware::radio::V1_0::RadioBandMode"
+            }
+        }
+    }
+
+    api: {
+        name: "sendEnvelopeResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "sendTerminalResponseToSimResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "handleStkCallSetupRequestFromSimResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "explicitCallTransferResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setPreferredNetworkTypeResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getPreferredNetworkTypeResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::PreferredNetworkType"
+        }
+    }
+
+    api: {
+        name: "getNeighboringCidsResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::NeighboringCell"
+            }
+        }
+    }
+
+    api: {
+        name: "setLocationUpdatesResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setCdmaSubscriptionSourceResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setCdmaRoamingPreferenceResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getCdmaRoamingPreferenceResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::CdmaRoamingType"
+        }
+    }
+
+    api: {
+        name: "setTTYModeResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getTTYModeResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::TtyMode"
+        }
+    }
+
+    api: {
+        name: "setPreferredVoicePrivacyResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getPreferredVoicePrivacyResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "sendCDMAFeatureCodeResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "sendBurstDtmfResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "sendCdmaSmsResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SendSmsResult"
+        }
+    }
+
+    api: {
+        name: "acknowledgeLastIncomingCdmaSmsResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getGsmBroadcastConfigResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::GsmBroadcastSmsConfigInfo"
+            }
+        }
+    }
+
+    api: {
+        name: "setGsmBroadcastConfigResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setGsmBroadcastActivationResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getCdmaBroadcastConfigResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::CdmaBroadcastSmsConfigInfo"
+            }
+        }
+    }
+
+    api: {
+        name: "setCdmaBroadcastConfigResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setCdmaBroadcastActivationResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getCDMASubscriptionResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "writeSmsToRuimResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+    }
+
+    api: {
+        name: "deleteSmsOnRuimResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getDeviceIdentityResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "exitEmergencyCallbackModeResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getSmscAddressResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "setSmscAddressResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "reportSmsMemoryStatusResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getCdmaSubscriptionSourceResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::CdmaSubscriptionSource"
+        }
+    }
+
+    api: {
+        name: "requestIsimAuthenticationResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "acknowledgeIncomingGsmSmsWithPduResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "sendEnvelopeWithStatusResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::IccIoResult"
+        }
+    }
+
+    api: {
+        name: "getVoiceRadioTechnologyResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioTechnology"
+        }
+    }
+
+    api: {
+        name: "getCellInfoListResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::CellInfo"
+            }
+        }
+    }
+
+    api: {
+        name: "setCellInfoListRateResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setInitialAttachApnResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getImsRegistrationStateResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::RadioTechnologyFamily"
+        }
+    }
+
+    api: {
+        name: "sendImsSmsResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SendSmsResult"
+        }
+    }
+
+    api: {
+        name: "iccTransmitApduBasicChannelResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::IccIoResult"
+        }
+    }
+
+    api: {
+        name: "iccOpenLogicalChannelResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "int8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "iccCloseLogicalChannelResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "iccTransmitApduLogicalChannelResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::IccIoResult"
+        }
+    }
+
+    api: {
+        name: "nvReadItemResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRING
+        }
+    }
+
+    api: {
+        name: "nvWriteItemResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "nvWriteCdmaPrlResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "nvResetConfigResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setUiccSubscriptionResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "setDataAllowedResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getHardwareConfigResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_STRUCT
+                predefined_type: "::android::hardware::radio::V1_0::HardwareConfig"
+            }
+        }
+    }
+
+    api: {
+        name: "requestIccSimAuthenticationResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::IccIoResult"
+        }
+    }
+
+    api: {
+        name: "setDataProfileResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "requestShutdownResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+    }
+
+    api: {
+        name: "getRadioCapabilityResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioCapability"
+        }
+    }
+
+    api: {
+        name: "setRadioCapabilityResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioCapability"
+        }
+    }
+
+    api: {
+        name: "startLceServiceResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::LceStatusInfo"
+        }
+    }
+
+    api: {
+        name: "stopLceServiceResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::LceStatusInfo"
+        }
+    }
+
+    api: {
+        name: "pullLceDataResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::LceDataInfo"
+        }
+    }
+
+    api: {
+        name: "getModemActivityInfoResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::ActivityStatsInfo"
+        }
+    }
+
+    api: {
+        name: "setAllowedCarriersResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "getAllowedCarriersResponse"
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::RadioResponseInfo"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CarrierRestrictions"
+        }
+    }
+
+    api: {
+        name: "acknowledgeRequest"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+}
diff --git a/radio/1.0/vts/Sap.vts b/radio/1.0/vts/Sap.vts
new file mode 100644
index 0000000..23205d0
--- /dev/null
+++ b/radio/1.0/vts/Sap.vts
@@ -0,0 +1,107 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "ISap"
+
+package: "android.hardware.radio"
+
+import: "android.hardware.radio@1.0::ISapCallback"
+import: "android.hardware.radio@1.0::types"
+
+interface: {
+    api: {
+        name: "setCallback"
+        arg: {
+            type: TYPE_HIDL_CALLBACK
+            predefined_type: "ISapCallback"
+            is_callback: true
+        }
+    }
+
+    api: {
+        name: "connectReq"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "disconnectReq"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "apduReq"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapApduType"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "transferAtrReq"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "powerReq"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "bool_t"
+        }
+    }
+
+    api: {
+        name: "resetSimReq"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "transferCardReaderStatusReq"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "setTransferProtocolReq"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapTransferProtocol"
+        }
+    }
+
+}
diff --git a/radio/1.0/vts/SapCallback.vts b/radio/1.0/vts/SapCallback.vts
new file mode 100644
index 0000000..2e61ce6
--- /dev/null
+++ b/radio/1.0/vts/SapCallback.vts
@@ -0,0 +1,156 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "ISapCallback"
+
+package: "android.hardware.radio"
+
+import: "android.hardware.radio@1.0::types"
+
+interface: {
+    api: {
+        name: "connectResponse"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapConnectRsp"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "disconnectResponse"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "disconnectIndication"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapDisconnectType"
+        }
+    }
+
+    api: {
+        name: "apduResponse"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapResultCode"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "transferAtrResponse"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapResultCode"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint8_t"
+            }
+        }
+    }
+
+    api: {
+        name: "powerResponse"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapResultCode"
+        }
+    }
+
+    api: {
+        name: "resetSimResponse"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapResultCode"
+        }
+    }
+
+    api: {
+        name: "statusIndication"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapStatus"
+        }
+    }
+
+    api: {
+        name: "transferCardReaderStatusResponse"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapResultCode"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "errorResponse"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "transferProtocolResponse"
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        arg: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::radio::V1_0::SapResultCode"
+        }
+    }
+
+}
diff --git a/radio/1.0/vts/types.vts b/radio/1.0/vts/types.vts
new file mode 100644
index 0000000..cec9b6d
--- /dev/null
+++ b/radio/1.0/vts/types.vts
@@ -0,0 +1,5532 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "types"
+
+package: "android.hardware.radio"
+
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioConst"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "CDMA_ALPHA_INFO_BUFFER_LENGTH"
+        scalar_value: {
+            int32_t: 64
+        }
+        enumerator: "CDMA_NUMBER_INFO_BUFFER_LENGTH"
+        scalar_value: {
+            int32_t: 81
+        }
+        enumerator: "MAX_RILDS"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "MAX_SOCKET_NAME_LENGTH"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "MAX_CLIENT_ID_LENGTH"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "MAX_DEBUG_SOCKET_NAME_LENGTH"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "MAX_QEMU_PIPE_NAME_LENGTH"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "MAX_UUID_LENGTH"
+        scalar_value: {
+            int32_t: 64
+        }
+        enumerator: "CARD_MAX_APPS"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "CDMA_MAX_NUMBER_OF_INFO_RECS"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "SS_INFO_MAX"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "NUM_SERVICE_CLASSES"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "NUM_TX_POWER_LEVELS"
+        scalar_value: {
+            int32_t: 5
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioCdmaSmsConst"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "ADDRESS_MAX"
+        scalar_value: {
+            int32_t: 36
+        }
+        enumerator: "SUBADDRESS_MAX"
+        scalar_value: {
+            int32_t: 36
+        }
+        enumerator: "BEARER_DATA_MAX"
+        scalar_value: {
+            int32_t: 255
+        }
+        enumerator: "UDH_MAX_SND_SIZE"
+        scalar_value: {
+            int32_t: 128
+        }
+        enumerator: "UDH_EO_DATA_SEGMENT_MAX"
+        scalar_value: {
+            int32_t: 131
+        }
+        enumerator: "MAX_UD_HEADERS"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "USER_DATA_MAX"
+        scalar_value: {
+            int32_t: 229
+        }
+        enumerator: "UDH_LARGE_PIC_SIZE"
+        scalar_value: {
+            int32_t: 128
+        }
+        enumerator: "UDH_SMALL_PIC_SIZE"
+        scalar_value: {
+            int32_t: 32
+        }
+        enumerator: "UDH_VAR_PIC_SIZE"
+        scalar_value: {
+            int32_t: 134
+        }
+        enumerator: "UDH_ANIM_NUM_BITMAPS"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "UDH_LARGE_BITMAP_SIZE"
+        scalar_value: {
+            int32_t: 32
+        }
+        enumerator: "UDH_SMALL_BITMAP_SIZE"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "UDH_OTHER_SIZE"
+        scalar_value: {
+            int32_t: 226
+        }
+        enumerator: "IP_ADDRESS_SIZE"
+        scalar_value: {
+            int32_t: 4
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioError"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NONE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "RADIO_NOT_AVAILABLE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "GENERIC_FAILURE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "PASSWORD_INCORRECT"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "SIM_PIN2"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "SIM_PUK2"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "REQUEST_NOT_SUPPORTED"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "CANCELLED"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "OP_NOT_ALLOWED_DURING_VOICE_CALL"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "OP_NOT_ALLOWED_BEFORE_REG_TO_NW"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "SMS_SEND_FAIL_RETRY"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "SIM_ABSENT"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "SUBSCRIPTION_NOT_AVAILABLE"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "MODE_NOT_SUPPORTED"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "FDN_CHECK_FAILURE"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "ILLEGAL_SIM_OR_ME"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "MISSING_RESOURCE"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "NO_SUCH_ELEMENT"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "DIAL_MODIFIED_TO_USSD"
+        scalar_value: {
+            int32_t: 18
+        }
+        enumerator: "DIAL_MODIFIED_TO_SS"
+        scalar_value: {
+            int32_t: 19
+        }
+        enumerator: "DIAL_MODIFIED_TO_DIAL"
+        scalar_value: {
+            int32_t: 20
+        }
+        enumerator: "USSD_MODIFIED_TO_DIAL"
+        scalar_value: {
+            int32_t: 21
+        }
+        enumerator: "USSD_MODIFIED_TO_SS"
+        scalar_value: {
+            int32_t: 22
+        }
+        enumerator: "USSD_MODIFIED_TO_USSD"
+        scalar_value: {
+            int32_t: 23
+        }
+        enumerator: "SS_MODIFIED_TO_DIAL"
+        scalar_value: {
+            int32_t: 24
+        }
+        enumerator: "SS_MODIFIED_TO_USSD"
+        scalar_value: {
+            int32_t: 25
+        }
+        enumerator: "SUBSCRIPTION_NOT_SUPPORTED"
+        scalar_value: {
+            int32_t: 26
+        }
+        enumerator: "SS_MODIFIED_TO_SS"
+        scalar_value: {
+            int32_t: 27
+        }
+        enumerator: "LCE_NOT_SUPPORTED"
+        scalar_value: {
+            int32_t: 36
+        }
+        enumerator: "NO_MEMORY"
+        scalar_value: {
+            int32_t: 37
+        }
+        enumerator: "INTERNAL_ERR"
+        scalar_value: {
+            int32_t: 38
+        }
+        enumerator: "SYSTEM_ERR"
+        scalar_value: {
+            int32_t: 39
+        }
+        enumerator: "MODEM_ERR"
+        scalar_value: {
+            int32_t: 40
+        }
+        enumerator: "INVALID_STATE"
+        scalar_value: {
+            int32_t: 41
+        }
+        enumerator: "NO_RESOURCES"
+        scalar_value: {
+            int32_t: 42
+        }
+        enumerator: "SIM_ERR"
+        scalar_value: {
+            int32_t: 43
+        }
+        enumerator: "INVALID_ARGUMENTS"
+        scalar_value: {
+            int32_t: 44
+        }
+        enumerator: "INVALID_SIM_STATE"
+        scalar_value: {
+            int32_t: 45
+        }
+        enumerator: "INVALID_MODEM_STATE"
+        scalar_value: {
+            int32_t: 46
+        }
+        enumerator: "INVALID_CALL_ID"
+        scalar_value: {
+            int32_t: 47
+        }
+        enumerator: "NO_SMS_TO_ACK"
+        scalar_value: {
+            int32_t: 48
+        }
+        enumerator: "NETWORK_ERR"
+        scalar_value: {
+            int32_t: 49
+        }
+        enumerator: "REQUEST_RATE_LIMITED"
+        scalar_value: {
+            int32_t: 50
+        }
+        enumerator: "SIM_BUSY"
+        scalar_value: {
+            int32_t: 51
+        }
+        enumerator: "SIM_FULL"
+        scalar_value: {
+            int32_t: 52
+        }
+        enumerator: "NETWORK_REJECT"
+        scalar_value: {
+            int32_t: 53
+        }
+        enumerator: "OPERATION_NOT_ALLOWED"
+        scalar_value: {
+            int32_t: 54
+        }
+        enumerator: "EMPTY_RECORD"
+        scalar_value: {
+            int32_t: 55
+        }
+        enumerator: "INVALID_SMS_FORMAT"
+        scalar_value: {
+            int32_t: 56
+        }
+        enumerator: "ENCODING_ERR"
+        scalar_value: {
+            int32_t: 57
+        }
+        enumerator: "INVALID_SMSC_ADDRESS"
+        scalar_value: {
+            int32_t: 58
+        }
+        enumerator: "NO_SUCH_ENTRY"
+        scalar_value: {
+            int32_t: 59
+        }
+        enumerator: "NETWORK_NOT_READY"
+        scalar_value: {
+            int32_t: 60
+        }
+        enumerator: "NOT_PROVISIONED"
+        scalar_value: {
+            int32_t: 61
+        }
+        enumerator: "NO_SUBSCRIPTION"
+        scalar_value: {
+            int32_t: 62
+        }
+        enumerator: "NO_NETWORK_FOUND"
+        scalar_value: {
+            int32_t: 63
+        }
+        enumerator: "DEVICE_IN_USE"
+        scalar_value: {
+            int32_t: 64
+        }
+        enumerator: "ABORTED"
+        scalar_value: {
+            int32_t: 65
+        }
+        enumerator: "INVALID_RESPONSE"
+        scalar_value: {
+            int32_t: 66
+        }
+        enumerator: "OEM_ERROR_1"
+        scalar_value: {
+            int32_t: 501
+        }
+        enumerator: "OEM_ERROR_2"
+        scalar_value: {
+            int32_t: 502
+        }
+        enumerator: "OEM_ERROR_3"
+        scalar_value: {
+            int32_t: 503
+        }
+        enumerator: "OEM_ERROR_4"
+        scalar_value: {
+            int32_t: 504
+        }
+        enumerator: "OEM_ERROR_5"
+        scalar_value: {
+            int32_t: 505
+        }
+        enumerator: "OEM_ERROR_6"
+        scalar_value: {
+            int32_t: 506
+        }
+        enumerator: "OEM_ERROR_7"
+        scalar_value: {
+            int32_t: 507
+        }
+        enumerator: "OEM_ERROR_8"
+        scalar_value: {
+            int32_t: 508
+        }
+        enumerator: "OEM_ERROR_9"
+        scalar_value: {
+            int32_t: 509
+        }
+        enumerator: "OEM_ERROR_10"
+        scalar_value: {
+            int32_t: 510
+        }
+        enumerator: "OEM_ERROR_11"
+        scalar_value: {
+            int32_t: 511
+        }
+        enumerator: "OEM_ERROR_12"
+        scalar_value: {
+            int32_t: 512
+        }
+        enumerator: "OEM_ERROR_13"
+        scalar_value: {
+            int32_t: 513
+        }
+        enumerator: "OEM_ERROR_14"
+        scalar_value: {
+            int32_t: 514
+        }
+        enumerator: "OEM_ERROR_15"
+        scalar_value: {
+            int32_t: 515
+        }
+        enumerator: "OEM_ERROR_16"
+        scalar_value: {
+            int32_t: 516
+        }
+        enumerator: "OEM_ERROR_17"
+        scalar_value: {
+            int32_t: 517
+        }
+        enumerator: "OEM_ERROR_18"
+        scalar_value: {
+            int32_t: 518
+        }
+        enumerator: "OEM_ERROR_19"
+        scalar_value: {
+            int32_t: 519
+        }
+        enumerator: "OEM_ERROR_20"
+        scalar_value: {
+            int32_t: 520
+        }
+        enumerator: "OEM_ERROR_21"
+        scalar_value: {
+            int32_t: 521
+        }
+        enumerator: "OEM_ERROR_22"
+        scalar_value: {
+            int32_t: 522
+        }
+        enumerator: "OEM_ERROR_23"
+        scalar_value: {
+            int32_t: 523
+        }
+        enumerator: "OEM_ERROR_24"
+        scalar_value: {
+            int32_t: 524
+        }
+        enumerator: "OEM_ERROR_25"
+        scalar_value: {
+            int32_t: 525
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioResponseType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "SOLICITED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "SOLICITED_ACK"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "SOLICITED_ACK_EXP"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioIndicationType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNSOLICITED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "UNSOLICITED_ACK_EXP"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RestrictedState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NONE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "CS_EMERGENCY"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CS_NORMAL"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "CS_ALL"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "PS_ALL"
+        scalar_value: {
+            int32_t: 16
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CardState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "ABSENT"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "PRESENT"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "ERROR"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "RESTRICTED"
+        scalar_value: {
+            int32_t: 3
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::PinState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "ENABLED_NOT_VERIFIED"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "ENABLED_VERIFIED"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "DISABLED"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "ENABLED_BLOCKED"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "ENABLED_PERM_BLOCKED"
+        scalar_value: {
+            int32_t: 5
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::AppType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "SIM"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "USIM"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "RUIM"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "CSIM"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "ISIM"
+        scalar_value: {
+            int32_t: 5
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::AppState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "DETECTED"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "PIN"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "PUK"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "SUBSCRIPTION_PERSO"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "READY"
+        scalar_value: {
+            int32_t: 5
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::PersoSubstate"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "IN_PROGRESS"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "READY"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "SIM_NETWORK"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "SIM_NETWORK_SUBSET"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "SIM_CORPORATE"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "SIM_SERVICE_PROVIDER"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "SIM_SIM"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "SIM_NETWORK_PUK"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "SIM_NETWORK_SUBSET_PUK"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "SIM_CORPORATE_PUK"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "SIM_SERVICE_PROVIDER_PUK"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "SIM_SIM_PUK"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "RUIM_NETWORK1"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "RUIM_NETWORK2"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "RUIM_HRPD"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "RUIM_CORPORATE"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "RUIM_SERVICE_PROVIDER"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "RUIM_RUIM"
+        scalar_value: {
+            int32_t: 18
+        }
+        enumerator: "RUIM_NETWORK1_PUK"
+        scalar_value: {
+            int32_t: 19
+        }
+        enumerator: "RUIM_NETWORK2_PUK"
+        scalar_value: {
+            int32_t: 20
+        }
+        enumerator: "RUIM_HRPD_PUK"
+        scalar_value: {
+            int32_t: 21
+        }
+        enumerator: "RUIM_CORPORATE_PUK"
+        scalar_value: {
+            int32_t: 22
+        }
+        enumerator: "RUIM_SERVICE_PROVIDER_PUK"
+        scalar_value: {
+            int32_t: 23
+        }
+        enumerator: "RUIM_RUIM_PUK"
+        scalar_value: {
+            int32_t: 24
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "OFF"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "UNAVAILABLE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "ON"
+        scalar_value: {
+            int32_t: 10
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SapConnectRsp"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "SUCCESS"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "CONNECT_FAILURE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "MSG_SIZE_TOO_LARGE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "MSG_SIZE_TOO_SMALL"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "CONNECT_OK_CALL_ONGOING"
+        scalar_value: {
+            int32_t: 4
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SapDisconnectType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "GRACEFUL"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "IMMEDIATE"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SapApduType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "APDU"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "APDU7816"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SapResultCode"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "SUCCESS"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "GENERIC_FAILURE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CARD_NOT_ACCESSSIBLE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "CARD_ALREADY_POWERED_OFF"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "CARD_REMOVED"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "CARD_ALREADY_POWERED_ON"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "DATA_NOT_AVAILABLE"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "NOT_SUPPORTED"
+        scalar_value: {
+            int32_t: 7
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SapStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN_ERROR"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "CARD_RESET"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CARD_NOT_ACCESSIBLE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "CARD_REMOVED"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "CARD_INSERTED"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "RECOVERED"
+        scalar_value: {
+            int32_t: 5
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SapTransferProtocol"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "T0"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "T1"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CallState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "ACTIVE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "HOLDING"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "DIALING"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "ALERTING"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "INCOMING"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "WAITING"
+        scalar_value: {
+            int32_t: 5
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::UusType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "TYPE1_IMPLICIT"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "TYPE1_REQUIRED"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "TYPE1_NOT_REQUIRED"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "TYPE2_REQUIRED"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "TYPE2_NOT_REQUIRED"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "TYPE3_REQUIRED"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "TYPE3_NOT_REQUIRED"
+        scalar_value: {
+            int32_t: 6
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::UusDcs"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "USP"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "OSIHLP"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "X244"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "RMCF"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "IA5C"
+        scalar_value: {
+            int32_t: 4
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CallPresentation"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "ALLOWED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "RESTRICTED"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "PAYPHONE"
+        scalar_value: {
+            int32_t: 3
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::Clir"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "DEFAULT"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "INVOCATION"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "SUPPRESSION"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::LastCallFailCause"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNOBTAINABLE_NUMBER"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "NO_ROUTE_TO_DESTINATION"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "CHANNEL_UNACCEPTABLE"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "OPERATOR_DETERMINED_BARRING"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "NORMAL"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "BUSY"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "NO_USER_RESPONDING"
+        scalar_value: {
+            int32_t: 18
+        }
+        enumerator: "NO_ANSWER_FROM_USER"
+        scalar_value: {
+            int32_t: 19
+        }
+        enumerator: "CALL_REJECTED"
+        scalar_value: {
+            int32_t: 21
+        }
+        enumerator: "NUMBER_CHANGED"
+        scalar_value: {
+            int32_t: 22
+        }
+        enumerator: "PREEMPTION"
+        scalar_value: {
+            int32_t: 25
+        }
+        enumerator: "DESTINATION_OUT_OF_ORDER"
+        scalar_value: {
+            int32_t: 27
+        }
+        enumerator: "INVALID_NUMBER_FORMAT"
+        scalar_value: {
+            int32_t: 28
+        }
+        enumerator: "FACILITY_REJECTED"
+        scalar_value: {
+            int32_t: 29
+        }
+        enumerator: "RESP_TO_STATUS_ENQUIRY"
+        scalar_value: {
+            int32_t: 30
+        }
+        enumerator: "NORMAL_UNSPECIFIED"
+        scalar_value: {
+            int32_t: 31
+        }
+        enumerator: "CONGESTION"
+        scalar_value: {
+            int32_t: 34
+        }
+        enumerator: "NETWORK_OUT_OF_ORDER"
+        scalar_value: {
+            int32_t: 38
+        }
+        enumerator: "TEMPORARY_FAILURE"
+        scalar_value: {
+            int32_t: 41
+        }
+        enumerator: "SWITCHING_EQUIPMENT_CONGESTION"
+        scalar_value: {
+            int32_t: 42
+        }
+        enumerator: "ACCESS_INFORMATION_DISCARDED"
+        scalar_value: {
+            int32_t: 43
+        }
+        enumerator: "REQUESTED_CIRCUIT_OR_CHANNEL_NOT_AVAILABLE"
+        scalar_value: {
+            int32_t: 44
+        }
+        enumerator: "RESOURCES_UNAVAILABLE_OR_UNSPECIFIED"
+        scalar_value: {
+            int32_t: 47
+        }
+        enumerator: "QOS_UNAVAILABLE"
+        scalar_value: {
+            int32_t: 49
+        }
+        enumerator: "REQUESTED_FACILITY_NOT_SUBSCRIBED"
+        scalar_value: {
+            int32_t: 50
+        }
+        enumerator: "INCOMING_CALLS_BARRED_WITHIN_CUG"
+        scalar_value: {
+            int32_t: 55
+        }
+        enumerator: "BEARER_CAPABILITY_NOT_AUTHORIZED"
+        scalar_value: {
+            int32_t: 57
+        }
+        enumerator: "BEARER_CAPABILITY_UNAVAILABLE"
+        scalar_value: {
+            int32_t: 58
+        }
+        enumerator: "SERVICE_OPTION_NOT_AVAILABLE"
+        scalar_value: {
+            int32_t: 63
+        }
+        enumerator: "BEARER_SERVICE_NOT_IMPLEMENTED"
+        scalar_value: {
+            int32_t: 65
+        }
+        enumerator: "ACM_LIMIT_EXCEEDED"
+        scalar_value: {
+            int32_t: 68
+        }
+        enumerator: "REQUESTED_FACILITY_NOT_IMPLEMENTED"
+        scalar_value: {
+            int32_t: 69
+        }
+        enumerator: "ONLY_DIGITAL_INFORMATION_BEARER_AVAILABLE"
+        scalar_value: {
+            int32_t: 70
+        }
+        enumerator: "SERVICE_OR_OPTION_NOT_IMPLEMENTED"
+        scalar_value: {
+            int32_t: 79
+        }
+        enumerator: "INVALID_TRANSACTION_IDENTIFIER"
+        scalar_value: {
+            int32_t: 81
+        }
+        enumerator: "USER_NOT_MEMBER_OF_CUG"
+        scalar_value: {
+            int32_t: 87
+        }
+        enumerator: "INCOMPATIBLE_DESTINATION"
+        scalar_value: {
+            int32_t: 88
+        }
+        enumerator: "INVALID_TRANSIT_NW_SELECTION"
+        scalar_value: {
+            int32_t: 91
+        }
+        enumerator: "SEMANTICALLY_INCORRECT_MESSAGE"
+        scalar_value: {
+            int32_t: 95
+        }
+        enumerator: "INVALID_MANDATORY_INFORMATION"
+        scalar_value: {
+            int32_t: 96
+        }
+        enumerator: "MESSAGE_TYPE_NON_IMPLEMENTED"
+        scalar_value: {
+            int32_t: 97
+        }
+        enumerator: "MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE"
+        scalar_value: {
+            int32_t: 98
+        }
+        enumerator: "INFORMATION_ELEMENT_NON_EXISTENT"
+        scalar_value: {
+            int32_t: 99
+        }
+        enumerator: "CONDITIONAL_IE_ERROR"
+        scalar_value: {
+            int32_t: 100
+        }
+        enumerator: "MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE"
+        scalar_value: {
+            int32_t: 101
+        }
+        enumerator: "RECOVERY_ON_TIMER_EXPIRED"
+        scalar_value: {
+            int32_t: 102
+        }
+        enumerator: "PROTOCOL_ERROR_UNSPECIFIED"
+        scalar_value: {
+            int32_t: 111
+        }
+        enumerator: "INTERWORKING_UNSPECIFIED"
+        scalar_value: {
+            int32_t: 127
+        }
+        enumerator: "CALL_BARRED"
+        scalar_value: {
+            int32_t: 240
+        }
+        enumerator: "FDN_BLOCKED"
+        scalar_value: {
+            int32_t: 241
+        }
+        enumerator: "IMSI_UNKNOWN_IN_VLR"
+        scalar_value: {
+            int32_t: 242
+        }
+        enumerator: "IMEI_NOT_ACCEPTED"
+        scalar_value: {
+            int32_t: 243
+        }
+        enumerator: "DIAL_MODIFIED_TO_USSD"
+        scalar_value: {
+            int32_t: 244
+        }
+        enumerator: "DIAL_MODIFIED_TO_SS"
+        scalar_value: {
+            int32_t: 245
+        }
+        enumerator: "DIAL_MODIFIED_TO_DIAL"
+        scalar_value: {
+            int32_t: 246
+        }
+        enumerator: "CDMA_LOCKED_UNTIL_POWER_CYCLE"
+        scalar_value: {
+            int32_t: 1000
+        }
+        enumerator: "CDMA_DROP"
+        scalar_value: {
+            int32_t: 1001
+        }
+        enumerator: "CDMA_INTERCEPT"
+        scalar_value: {
+            int32_t: 1002
+        }
+        enumerator: "CDMA_REORDER"
+        scalar_value: {
+            int32_t: 1003
+        }
+        enumerator: "CDMA_SO_REJECT"
+        scalar_value: {
+            int32_t: 1004
+        }
+        enumerator: "CDMA_RETRY_ORDER"
+        scalar_value: {
+            int32_t: 1005
+        }
+        enumerator: "CDMA_ACCESS_FAILURE"
+        scalar_value: {
+            int32_t: 1006
+        }
+        enumerator: "CDMA_PREEMPTED"
+        scalar_value: {
+            int32_t: 1007
+        }
+        enumerator: "CDMA_NOT_EMERGENCY"
+        scalar_value: {
+            int32_t: 1008
+        }
+        enumerator: "CDMA_ACCESS_BLOCKED"
+        scalar_value: {
+            int32_t: 1009
+        }
+        enumerator: "ERROR_UNSPECIFIED"
+        scalar_value: {
+            int32_t: 65535
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::DataCallFailCause"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NONE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "OPERATOR_BARRED"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "NAS_SIGNALLING"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "INSUFFICIENT_RESOURCES"
+        scalar_value: {
+            int32_t: 26
+        }
+        enumerator: "MISSING_UKNOWN_APN"
+        scalar_value: {
+            int32_t: 27
+        }
+        enumerator: "UNKNOWN_PDP_ADDRESS_TYPE"
+        scalar_value: {
+            int32_t: 28
+        }
+        enumerator: "USER_AUTHENTICATION"
+        scalar_value: {
+            int32_t: 29
+        }
+        enumerator: "ACTIVATION_REJECT_GGSN"
+        scalar_value: {
+            int32_t: 30
+        }
+        enumerator: "ACTIVATION_REJECT_UNSPECIFIED"
+        scalar_value: {
+            int32_t: 31
+        }
+        enumerator: "SERVICE_OPTION_NOT_SUPPORTED"
+        scalar_value: {
+            int32_t: 32
+        }
+        enumerator: "SERVICE_OPTION_NOT_SUBSCRIBED"
+        scalar_value: {
+            int32_t: 33
+        }
+        enumerator: "SERVICE_OPTION_OUT_OF_ORDER"
+        scalar_value: {
+            int32_t: 34
+        }
+        enumerator: "NSAPI_IN_USE"
+        scalar_value: {
+            int32_t: 35
+        }
+        enumerator: "REGULAR_DEACTIVATION"
+        scalar_value: {
+            int32_t: 36
+        }
+        enumerator: "QOS_NOT_ACCEPTED"
+        scalar_value: {
+            int32_t: 37
+        }
+        enumerator: "NETWORK_FAILURE"
+        scalar_value: {
+            int32_t: 38
+        }
+        enumerator: "UMTS_REACTIVATION_REQ"
+        scalar_value: {
+            int32_t: 39
+        }
+        enumerator: "FEATURE_NOT_SUPP"
+        scalar_value: {
+            int32_t: 40
+        }
+        enumerator: "TFT_SEMANTIC_ERROR"
+        scalar_value: {
+            int32_t: 41
+        }
+        enumerator: "TFT_SYTAX_ERROR"
+        scalar_value: {
+            int32_t: 42
+        }
+        enumerator: "UNKNOWN_PDP_CONTEXT"
+        scalar_value: {
+            int32_t: 43
+        }
+        enumerator: "FILTER_SEMANTIC_ERROR"
+        scalar_value: {
+            int32_t: 44
+        }
+        enumerator: "FILTER_SYTAX_ERROR"
+        scalar_value: {
+            int32_t: 45
+        }
+        enumerator: "PDP_WITHOUT_ACTIVE_TFT"
+        scalar_value: {
+            int32_t: 46
+        }
+        enumerator: "ONLY_IPV4_ALLOWED"
+        scalar_value: {
+            int32_t: 50
+        }
+        enumerator: "ONLY_IPV6_ALLOWED"
+        scalar_value: {
+            int32_t: 51
+        }
+        enumerator: "ONLY_SINGLE_BEARER_ALLOWED"
+        scalar_value: {
+            int32_t: 52
+        }
+        enumerator: "ESM_INFO_NOT_RECEIVED"
+        scalar_value: {
+            int32_t: 53
+        }
+        enumerator: "PDN_CONN_DOES_NOT_EXIST"
+        scalar_value: {
+            int32_t: 54
+        }
+        enumerator: "MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED"
+        scalar_value: {
+            int32_t: 55
+        }
+        enumerator: "MAX_ACTIVE_PDP_CONTEXT_REACHED"
+        scalar_value: {
+            int32_t: 65
+        }
+        enumerator: "UNSUPPORTED_APN_IN_CURRENT_PLMN"
+        scalar_value: {
+            int32_t: 66
+        }
+        enumerator: "INVALID_TRANSACTION_ID"
+        scalar_value: {
+            int32_t: 81
+        }
+        enumerator: "MESSAGE_INCORRECT_SEMANTIC"
+        scalar_value: {
+            int32_t: 95
+        }
+        enumerator: "INVALID_MANDATORY_INFO"
+        scalar_value: {
+            int32_t: 96
+        }
+        enumerator: "MESSAGE_TYPE_UNSUPPORTED"
+        scalar_value: {
+            int32_t: 97
+        }
+        enumerator: "MSG_TYPE_NONCOMPATIBLE_STATE"
+        scalar_value: {
+            int32_t: 98
+        }
+        enumerator: "UNKNOWN_INFO_ELEMENT"
+        scalar_value: {
+            int32_t: 99
+        }
+        enumerator: "CONDITIONAL_IE_ERROR"
+        scalar_value: {
+            int32_t: 100
+        }
+        enumerator: "MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE"
+        scalar_value: {
+            int32_t: 101
+        }
+        enumerator: "PROTOCOL_ERRORS"
+        scalar_value: {
+            int32_t: 111
+        }
+        enumerator: "APN_TYPE_CONFLICT"
+        scalar_value: {
+            int32_t: 112
+        }
+        enumerator: "INVALID_PCSCF_ADDR"
+        scalar_value: {
+            int32_t: 113
+        }
+        enumerator: "INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN"
+        scalar_value: {
+            int32_t: 114
+        }
+        enumerator: "EMM_ACCESS_BARRED"
+        scalar_value: {
+            int32_t: 115
+        }
+        enumerator: "EMERGENCY_IFACE_ONLY"
+        scalar_value: {
+            int32_t: 116
+        }
+        enumerator: "IFACE_MISMATCH"
+        scalar_value: {
+            int32_t: 117
+        }
+        enumerator: "COMPANION_IFACE_IN_USE"
+        scalar_value: {
+            int32_t: 118
+        }
+        enumerator: "IP_ADDRESS_MISMATCH"
+        scalar_value: {
+            int32_t: 119
+        }
+        enumerator: "IFACE_AND_POL_FAMILY_MISMATCH"
+        scalar_value: {
+            int32_t: 120
+        }
+        enumerator: "EMM_ACCESS_BARRED_INFINITE_RETRY"
+        scalar_value: {
+            int32_t: 121
+        }
+        enumerator: "AUTH_FAILURE_ON_EMERGENCY_CALL"
+        scalar_value: {
+            int32_t: 122
+        }
+        enumerator: "OEM_DCFAILCAUSE_1"
+        scalar_value: {
+            int32_t: 4097
+        }
+        enumerator: "OEM_DCFAILCAUSE_2"
+        scalar_value: {
+            int32_t: 4098
+        }
+        enumerator: "OEM_DCFAILCAUSE_3"
+        scalar_value: {
+            int32_t: 4099
+        }
+        enumerator: "OEM_DCFAILCAUSE_4"
+        scalar_value: {
+            int32_t: 4100
+        }
+        enumerator: "OEM_DCFAILCAUSE_5"
+        scalar_value: {
+            int32_t: 4101
+        }
+        enumerator: "OEM_DCFAILCAUSE_6"
+        scalar_value: {
+            int32_t: 4102
+        }
+        enumerator: "OEM_DCFAILCAUSE_7"
+        scalar_value: {
+            int32_t: 4103
+        }
+        enumerator: "OEM_DCFAILCAUSE_8"
+        scalar_value: {
+            int32_t: 4104
+        }
+        enumerator: "OEM_DCFAILCAUSE_9"
+        scalar_value: {
+            int32_t: 4105
+        }
+        enumerator: "OEM_DCFAILCAUSE_10"
+        scalar_value: {
+            int32_t: 4106
+        }
+        enumerator: "OEM_DCFAILCAUSE_11"
+        scalar_value: {
+            int32_t: 4107
+        }
+        enumerator: "OEM_DCFAILCAUSE_12"
+        scalar_value: {
+            int32_t: 4108
+        }
+        enumerator: "OEM_DCFAILCAUSE_13"
+        scalar_value: {
+            int32_t: 4109
+        }
+        enumerator: "OEM_DCFAILCAUSE_14"
+        scalar_value: {
+            int32_t: 4110
+        }
+        enumerator: "OEM_DCFAILCAUSE_15"
+        scalar_value: {
+            int32_t: 4111
+        }
+        enumerator: "VOICE_REGISTRATION_FAIL"
+        scalar_value: {
+            int32_t: -1
+        }
+        enumerator: "DATA_REGISTRATION_FAIL"
+        scalar_value: {
+            int32_t: -2
+        }
+        enumerator: "SIGNAL_LOST"
+        scalar_value: {
+            int32_t: -3
+        }
+        enumerator: "PREF_RADIO_TECH_CHANGED"
+        scalar_value: {
+            int32_t: -4
+        }
+        enumerator: "RADIO_POWER_OFF"
+        scalar_value: {
+            int32_t: -5
+        }
+        enumerator: "TETHERED_CALL_ACTIVE"
+        scalar_value: {
+            int32_t: -6
+        }
+        enumerator: "ERROR_UNSPECIFIED"
+        scalar_value: {
+            int32_t: 65535
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RegState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NOT_REG_MT_NOT_SEARCHING_OP"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "REG_HOME"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "NOT_REG_MT_SEARCHING_OP"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "REG_DENIED"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "REG_ROAMING"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "NOT_REG_MT_NOT_SEARCHING_OP_EM"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "NOT_REG_MT_SEARCHING_OP_EM"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "REG_DENIED_EM"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "UNKNOWN_EM"
+        scalar_value: {
+            int32_t: 9
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioTechnology"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "GPRS"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "EDGE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "UMTS"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "IS95A"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "IS95B"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "ONE_X_RTT"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "EVDO_0"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "EVDO_A"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "HSDPA"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "HSUPA"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "HSPA"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "EVDO_B"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "EHRPD"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "LTE"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "HSPAP"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "GSM"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "TD_SCDMA"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "IWLAN"
+        scalar_value: {
+            int32_t: 18
+        }
+        enumerator: "LTE_CA"
+        scalar_value: {
+            int32_t: 19
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::DataProfile"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "DEFAULT"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "TETHERED"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "IMS"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "FOTA"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "CBS"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "OEM_BASE"
+        scalar_value: {
+            int32_t: 1000
+        }
+        enumerator: "INVALID"
+        scalar_value: {
+            int32_t: -1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SmsAcknowledgeFailCause"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "MEMORY_CAPAPCITY_EXCEEDED"
+        scalar_value: {
+            int32_t: 211
+        }
+        enumerator: "UNSPECIFIED_ERROR"
+        scalar_value: {
+            int32_t: 255
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CallForwardInfoStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "DISABLE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "ENABLE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "INTERROGATE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "REGISTRATION"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "ERASURE"
+        scalar_value: {
+            int32_t: 4
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::ClipStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "CLIP_PROVISIONED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "CLIP_UNPROVISIONED"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "UNKOWN"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SmsWriteArgsStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "REC_UNREAD"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "REC_READ"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "STO_UNSENT"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "STO_SENT"
+        scalar_value: {
+            int32_t: 3
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioBandMode"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "BAND_MODE_UNSPECIFIED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "BAND_MODE_EURO"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "BAND_MODE_USA"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "BAND_MODE_JPN"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "BAND_MODE_AUS"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "BAND_MODE_AUS_2"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "BAND_MODE_CELL_800"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "BAND_MODE_PCS"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "BAND_MODE_JTACS"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "BAND_MODE_KOREA_PCS"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "BAND_MODE_5_450M"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "BAND_MODE_IMT2000"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "BAND_MODE_7_700M_2"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "BAND_MODE_8_1800M"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "BAND_MODE_9_900M"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "BAND_MODE_10_800M_2"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "BAND_MODE_EURO_PAMR_400M"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "BAND_MODE_AWS"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "BAND_MODE_USA_2500M"
+        scalar_value: {
+            int32_t: 18
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::OperatorStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "AVAILABLE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CURRENT"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "FORBIDDEN"
+        scalar_value: {
+            int32_t: 3
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::PreferredNetworkType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "GSM_WCDMA"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "GSM_ONLY"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "WCDMA"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "GSM_WCDMA_AUTO"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "CDMA_EVDO_AUTO"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "CDMA_ONLY"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "EVDO_ONLY"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "GSM_WCDMA_CDMA_EVDO_AUTO"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "LTE_CDMA_EVDO"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "LTE_GSM_WCDMA"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "LTE_CMDA_EVDO_GSM_WCDMA"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "LTE_ONLY"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "LTE_WCDMA"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "TD_SCDMA_ONLY"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "TD_SCDMA_WCDMA"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "TD_SCDMA_LTE"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "TD_SCDMA_GSM"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "TD_SCDMA_GSM_LTE"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "TD_SCDMA_GSM_WCDMA"
+        scalar_value: {
+            int32_t: 18
+        }
+        enumerator: "TD_SCDMA_WCDMA_LTE"
+        scalar_value: {
+            int32_t: 19
+        }
+        enumerator: "TD_SCDMA_GSM_WCDMA_LTE"
+        scalar_value: {
+            int32_t: 20
+        }
+        enumerator: "TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO"
+        scalar_value: {
+            int32_t: 21
+        }
+        enumerator: "TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA"
+        scalar_value: {
+            int32_t: 22
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSubscriptionSource"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "RUIM_SIM"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "NV"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaRoamingType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "HOME_NETWORK"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "AFFILIATED_ROAM"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "ANY_ROAM"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::TtyMode"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "OFF"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "FULL"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "HCO"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "VCO"
+        scalar_value: {
+            int32_t: 3
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::NvItem"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "CDMA_MEID"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CDMA_MIN"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "CDMA_MDN"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "CDMA_ACCOLC"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "DEVICE_MSL"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "RTN_RECONDITIONED_STATUS"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "RTN_ACTIVATION_DATE"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "RTN_LIFE_TIMER"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "RTN_LIFE_CALLS"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "RTN_LIFE_DATA_TX"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "RTN_LIFE_DATA_RX"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "OMADM_HFA_LEVEL"
+        scalar_value: {
+            int32_t: 18
+        }
+        enumerator: "MIP_PROFILE_NAI"
+        scalar_value: {
+            int32_t: 31
+        }
+        enumerator: "MIP_PROFILE_HOME_ADDRESS"
+        scalar_value: {
+            int32_t: 32
+        }
+        enumerator: "MIP_PROFILE_AAA_AUTH"
+        scalar_value: {
+            int32_t: 33
+        }
+        enumerator: "MIP_PROFILE_HA_AUTH"
+        scalar_value: {
+            int32_t: 34
+        }
+        enumerator: "MIP_PROFILE_PRI_HA_ADDR"
+        scalar_value: {
+            int32_t: 35
+        }
+        enumerator: "MIP_PROFILE_SEC_HA_ADDR"
+        scalar_value: {
+            int32_t: 36
+        }
+        enumerator: "MIP_PROFILE_REV_TUN_PREF"
+        scalar_value: {
+            int32_t: 37
+        }
+        enumerator: "MIP_PROFILE_HA_SPI"
+        scalar_value: {
+            int32_t: 38
+        }
+        enumerator: "MIP_PROFILE_AAA_SPI"
+        scalar_value: {
+            int32_t: 39
+        }
+        enumerator: "MIP_PROFILE_MN_HA_SS"
+        scalar_value: {
+            int32_t: 40
+        }
+        enumerator: "MIP_PROFILE_MN_AAA_SS"
+        scalar_value: {
+            int32_t: 41
+        }
+        enumerator: "CDMA_PRL_VERSION"
+        scalar_value: {
+            int32_t: 51
+        }
+        enumerator: "CDMA_BC10"
+        scalar_value: {
+            int32_t: 52
+        }
+        enumerator: "CDMA_BC14"
+        scalar_value: {
+            int32_t: 53
+        }
+        enumerator: "CDMA_SO68"
+        scalar_value: {
+            int32_t: 54
+        }
+        enumerator: "CDMA_SO73_COP0"
+        scalar_value: {
+            int32_t: 55
+        }
+        enumerator: "CDMA_SO73_COP1TO7"
+        scalar_value: {
+            int32_t: 56
+        }
+        enumerator: "CDMA_1X_ADVANCED_ENABLED"
+        scalar_value: {
+            int32_t: 57
+        }
+        enumerator: "CDMA_EHRPD_ENABLED"
+        scalar_value: {
+            int32_t: 58
+        }
+        enumerator: "CDMA_EHRPD_FORCED"
+        scalar_value: {
+            int32_t: 59
+        }
+        enumerator: "LTE_BAND_ENABLE_25"
+        scalar_value: {
+            int32_t: 71
+        }
+        enumerator: "LTE_BAND_ENABLE_26"
+        scalar_value: {
+            int32_t: 72
+        }
+        enumerator: "LTE_BAND_ENABLE_41"
+        scalar_value: {
+            int32_t: 73
+        }
+        enumerator: "LTE_SCAN_PRIORITY_25"
+        scalar_value: {
+            int32_t: 74
+        }
+        enumerator: "LTE_SCAN_PRIORITY_26"
+        scalar_value: {
+            int32_t: 75
+        }
+        enumerator: "LTE_SCAN_PRIORITY_41"
+        scalar_value: {
+            int32_t: 76
+        }
+        enumerator: "LTE_HIDDEN_BAND_PRIORITY_25"
+        scalar_value: {
+            int32_t: 77
+        }
+        enumerator: "LTE_HIDDEN_BAND_PRIORITY_26"
+        scalar_value: {
+            int32_t: 78
+        }
+        enumerator: "LTE_HIDDEN_BAND_PRIORITY_41"
+        scalar_value: {
+            int32_t: 79
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::ResetNvType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "RELOAD"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "ERASE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "FACORY_RESET"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::HardwareConfigType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "MODEM"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "SIM"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::HardwareConfigState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "ENABLED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "STANDBY"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "DISABLED"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::LceStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NOT_SUPPORTED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "STOPPED"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "ACTIVE"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CarrierMatchType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "ALL"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "SPN"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "IMSI_PREFIX"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "GID1"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "GID2"
+        scalar_value: {
+            int32_t: 4
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::NeighboringCell"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cid"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "rssi"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsDigitMode"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "FOUR_BIT"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "EIGHT_BIT"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsNumberMode"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NOT_DATA_NETWORK"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "DATA_NETWORK"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsNumberType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "INTERNATIONAL_OR_DATA_IP"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "NATIONAL_OR_INTERNET_MAIL"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "NETWORK"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "SUBSCRIBER"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "ALPHANUMERIC"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "ABBREVIATED"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "RESERVED_7"
+        scalar_value: {
+            int32_t: 7
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsNumberPlan"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "TELEPHONY"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "RESERVED_2"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "DATA"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "TELEX"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "RESERVED_5"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "RESERVED_6"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "RESERVED_7"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "RESERVED_8"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "PRIVATE"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "RESERVED_10"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "RESERVED_11"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "RESERVED_12"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "RESERVED_13"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "RESERVED_14"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "RESERVED_15"
+        scalar_value: {
+            int32_t: 15
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsSubaddressType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NSAP"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "USER_SPECIFIED"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsErrorClass"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NO_ERROR"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "ERROR"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsWriteArgsStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "REC_UNREAD"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "REC_READ"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "STO_UNSENT"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "STO_SENT"
+        scalar_value: {
+            int32_t: 3
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellInfoType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "GSM"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "CDMA"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "LTE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "WCDMA"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "TD_SCDMA"
+        scalar_value: {
+            int32_t: 4
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::TimeStampType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "ANTENNA"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "MODEM"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "OEM_RIL"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "JAVA_RIL"
+        scalar_value: {
+            int32_t: 4
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::ApnAuthType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NO_PAP_NO_CHAP"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "PAP_NO_CHAP"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "NO_PAP_CHAP"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "PAP_CHAP"
+        scalar_value: {
+            int32_t: 3
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioTechnologyFamily"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "THREE_GPP"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "THREE_GPP2"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioCapabilityPhase"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "CONFIGURED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "START"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "APPLY"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "UNSOL_RSP"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "FINISH"
+        scalar_value: {
+            int32_t: 4
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioCapabilityStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NONE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "SUCCESS"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "FAIL"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioAccessFamily"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "GPRS"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "EDGE"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "UMTS"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "IS95A"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "IS95B"
+        scalar_value: {
+            int32_t: 32
+        }
+        enumerator: "ONE_X_RTT"
+        scalar_value: {
+            int32_t: 64
+        }
+        enumerator: "EVDO_0"
+        scalar_value: {
+            int32_t: 128
+        }
+        enumerator: "EVDO_A"
+        scalar_value: {
+            int32_t: 256
+        }
+        enumerator: "HSDPA"
+        scalar_value: {
+            int32_t: 512
+        }
+        enumerator: "HSUPA"
+        scalar_value: {
+            int32_t: 1024
+        }
+        enumerator: "HSPA"
+        scalar_value: {
+            int32_t: 2048
+        }
+        enumerator: "EVDO_B"
+        scalar_value: {
+            int32_t: 4096
+        }
+        enumerator: "EHRPD"
+        scalar_value: {
+            int32_t: 8192
+        }
+        enumerator: "LTE"
+        scalar_value: {
+            int32_t: 16384
+        }
+        enumerator: "HSPAP"
+        scalar_value: {
+            int32_t: 32768
+        }
+        enumerator: "GSM"
+        scalar_value: {
+            int32_t: 65536
+        }
+        enumerator: "TD_SCDMA"
+        scalar_value: {
+            int32_t: 131072
+        }
+        enumerator: "LTE_CA"
+        scalar_value: {
+            int32_t: 524288
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::UssdModeType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NOTIFY"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "REQUEST"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "NW_RELEASE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "LOCAL_CLIENT"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "NOT_SUPPORTED"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "NW_TIMEOUT"
+        scalar_value: {
+            int32_t: 5
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SimRefreshType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "SIM_FILE_UPDATE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "SIM_INIT"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "SIM_RESET"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SrvccState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "HANDOVER_STARTED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "HANDOVER_COMPLETED"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "HANDOVER_FAILED"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "HANDOVER_CANCELED"
+        scalar_value: {
+            int32_t: 3
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::UiccSubActStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "DEACTIVATE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "ACTIVATE"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SubscriptionType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "SUBSCRIPTION_1"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "SUBSCRIPTION_2"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "SUBSCRIPTION_3"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::DataProfileInfoType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "COMMON"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "THREE_GPP"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "THREE_GPP2"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::PhoneRestrictedState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NONE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "CS_EMERGENCY"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CS_NORMAL"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "CS_ALL"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "PS_ALL"
+        scalar_value: {
+            int32_t: 16
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaCallWaitingNumberPresentation"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "ALLOWED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "RESTRICTED"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 2
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaCallWaitingNumberType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "INTERNATIONAL"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "NATIONAL"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "NETWORK_SPECIFIC"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "SUBSCRIBER"
+        scalar_value: {
+            int32_t: 4
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaCallWaitingNumberPlan"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "ISDN"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "DATA"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "TELEX"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "NATIONAL"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "PRIVATE"
+        scalar_value: {
+            int32_t: 9
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaOtaProvisionStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "SPL_UNLOCKED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "SPC_RETRIES_EXCEEDED"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "A_KEY_EXCHANGED"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "SSD_UPDATED"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "NAM_DOWNLOADED"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "MDN_DOWNLOADED"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "IMSI_DOWNLOADED"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "PRL_DOWNLOADED"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "COMMITTED"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "OTAPA_STARTED"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "OTAPA_STOPPED"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "OTAPA_ABORTED"
+        scalar_value: {
+            int32_t: 11
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaInfoRecName"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "DISPLAY"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "CALLED_PARTY_NUMBER"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CALLING_PARTY_NUMBER"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "CONNECTED_NUMBER"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "SIGNAL"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "REDIRECTING_NUMBER"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "LINE_CONTROL"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "EXTENDED_DISPLAY"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "T53_CLIR"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "T53_RELEASE"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "T53_AUDIO_CONTROL"
+        scalar_value: {
+            int32_t: 10
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaRedirectingReason"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "CALL_FORWARDING_BUSY"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CALL_FORWARDING_NO_REPLY"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "CALLED_DTE_OUT_OF_ORDER"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "CALL_FORWARDING_BY_THE_CALLED_DTE"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "CALL_FORWARDING_UNCONDITIONAL"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "RESERVED"
+        scalar_value: {
+            int32_t: 16
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SsServiceType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "CFU"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "CF_BUSY"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CF_NO_REPLY"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "CF_NOT_REACHABLE"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "CF_ALL"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "CF_ALL_CONDITIONAL"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "CLIP"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "CLIR"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "COLP"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "COLR"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "WAIT"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "BAOC"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "BAOIC"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "BAOIC_EXC_HOME"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "BAIC"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "BAIC_ROAMING"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "ALL_BARRING"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "OUTGOING_BARRING"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "INCOMING_BARRING"
+        scalar_value: {
+            int32_t: 18
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SsRequestType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "ACTIVATION"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "DEACTIVATION"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "INTERROGATION"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "REGISTRATION"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "ERASURE"
+        scalar_value: {
+            int32_t: 4
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SsTeleserviceType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "ALL_TELE_AND_BEARER_SERVICES"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "ALL_TELESEVICES"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "TELEPHONY"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "ALL_DATA_TELESERVICES"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "SMS_SERVICES"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "ALL_TELESERVICES_EXCEPT_SMS"
+        scalar_value: {
+            int32_t: 5
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SuppServiceClass"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NONE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "VOICE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "DATA"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "FAX"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "SMS"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "DATA_SYNC"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "DATA_ASYNC"
+        scalar_value: {
+            int32_t: 32
+        }
+        enumerator: "PACKET"
+        scalar_value: {
+            int32_t: 64
+        }
+        enumerator: "PAD"
+        scalar_value: {
+            int32_t: 128
+        }
+        enumerator: "MAX"
+        scalar_value: {
+            int32_t: 128
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioResponseInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "type"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::RadioResponseType"
+    }
+    struct_value: {
+        name: "serial"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "error"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::RadioError"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::AppStatus"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "appType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::AppType"
+    }
+    struct_value: {
+        name: "appState"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::AppState"
+    }
+    struct_value: {
+        name: "persoSubstate"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::PersoSubstate"
+    }
+    struct_value: {
+        name: "aidPtr"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "appLabelPtr"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "pin1Replaced"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "pin1"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::PinState"
+    }
+    struct_value: {
+        name: "pin2"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::PinState"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CardStatus"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cardState"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CardState"
+    }
+    struct_value: {
+        name: "universalPinState"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::PinState"
+    }
+    struct_value: {
+        name: "gsmUmtsSubscriptionAppIndex"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cdmaSubscriptionAppIndex"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "imsSubscriptionAppIndex"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "applications"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::AppStatus"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::UusInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "uusType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::UusType"
+    }
+    struct_value: {
+        name: "uusDcs"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::UusDcs"
+    }
+    struct_value: {
+        name: "uusData"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::Call"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "state"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CallState"
+    }
+    struct_value: {
+        name: "index"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "toa"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "isMpty"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "isMT"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "als"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+    struct_value: {
+        name: "isVoice"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "isVoicePrivacy"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "number"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "numberPresentation"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CallPresentation"
+    }
+    struct_value: {
+        name: "name"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "namePresentation"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CallPresentation"
+    }
+    struct_value: {
+        name: "uusInfo"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::UusInfo"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::Dial"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "address"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "clir"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::Clir"
+    }
+    struct_value: {
+        name: "uusInfo"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::UusInfo"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::LastCallFailCauseInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "causeCode"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::LastCallFailCause"
+    }
+    struct_value: {
+        name: "vendorCause"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::GsmSignalStrength"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "signalStrength"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "bitErrorRate"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "timingAdvance"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::WcdmaSignalStrength"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "signalStrength"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "bitErrorRate"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSignalStrength"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "dbm"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "ecio"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::EvdoSignalStrength"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "dbm"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "ecio"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "signalNoiseRatio"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::LteSignalStrength"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "signalStrength"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "rsrp"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "rsrq"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "rssnr"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cqi"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "timingAdvance"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::TdScdmaSignalStrength"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "rscp"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SignalStrength"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "gw"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::GsmSignalStrength"
+    }
+    struct_value: {
+        name: "cdma"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSignalStrength"
+    }
+    struct_value: {
+        name: "evdo"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::EvdoSignalStrength"
+    }
+    struct_value: {
+        name: "lte"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::LteSignalStrength"
+    }
+    struct_value: {
+        name: "tdScdma"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::TdScdmaSignalStrength"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SendSmsResult"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "messageRef"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "ackPDU"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "errorCode"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SetupDataCallResult"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "status"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "suggestedRetryTime"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cid"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "active"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "type"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "ifname"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "addresses"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "dnses"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "gateways"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "pcscf"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "mtu"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::IccIo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "command"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "fileId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "path"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "p1"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "p2"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "p3"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "data"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "pin2"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "aid"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::IccIoResult"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "sw1"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "sw2"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "simResponse"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::VoiceRegStateResult"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "regState"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::RegState"
+    }
+    struct_value: {
+        name: "lac"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cid"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "rat"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "baseStationId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "baseStationLatitude"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "baseStationLongitude"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cssSupported"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "systemId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "networkId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "roamingIndicator"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "systemIsInPrl"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "defaultRoamingIndicator"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "reasonForDenial"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "psc"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::DataRegStateResult"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "regState"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::RegState"
+    }
+    struct_value: {
+        name: "lac"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cid"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "rat"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "reasonDataDenied"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "maxDataCalls"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "tac"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "phyCid"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "eci"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "csgid"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "tadv"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CallForwardInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "status"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CallForwardInfoStatus"
+    }
+    struct_value: {
+        name: "reason"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "serviceClass"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "toa"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "number"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "timeSeconds"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::OperatorInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "alphaLong"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "alphaShort"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "operatorNumeric"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "status"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::OperatorStatus"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SmsWriteArgs"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "status"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::SmsWriteArgsStatus"
+    }
+    struct_value: {
+        name: "pdu"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "smsc"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsAddress"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "digitMode"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSmsDigitMode"
+    }
+    struct_value: {
+        name: "numberMode"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSmsNumberMode"
+    }
+    struct_value: {
+        name: "numberType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSmsNumberType"
+    }
+    struct_value: {
+        name: "numberPlan"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSmsNumberPlan"
+    }
+    struct_value: {
+        name: "digits"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_SCALAR
+            scalar_type: "uint8_t"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsSubaddress"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "subaddressType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSmsSubaddressType"
+    }
+    struct_value: {
+        name: "odd"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "digits"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_SCALAR
+            scalar_type: "uint8_t"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsMessage"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "teleserviceId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "isServicePresent"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "serviceCategory"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "address"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSmsAddress"
+    }
+    struct_value: {
+        name: "subAddress"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSmsSubaddress"
+    }
+    struct_value: {
+        name: "bearerData"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_SCALAR
+            scalar_type: "uint8_t"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsAck"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "errorClass"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSmsErrorClass"
+    }
+    struct_value: {
+        name: "smsCauseCode"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaBroadcastSmsConfigInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "serviceCategory"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "language"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "selected"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSmsWriteArgs"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "status"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSmsWriteArgsStatus"
+    }
+    struct_value: {
+        name: "message"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSmsMessage"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::GsmBroadcastSmsConfigInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "fromServiceId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "toServiceId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "fromCodeScheme"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "toCodeScheme"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "selected"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellIdentityGsm"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "mcc"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "mnc"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "lac"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cid"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "arfcn"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "bsic"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellIdentityWcdma"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "mcc"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "mnc"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "lac"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cid"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "psc"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "uarfcn"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellIdentityCdma"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "networkId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "systemId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "basestationId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "longitude"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "latitude"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellIdentityLte"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "mcc"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "mnc"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "ci"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "pci"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "tac"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "earfcn"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellIdentityTdscdma"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "mcc"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "mnc"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "lac"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cid"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cpid"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellInfoGsm"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cellIdentityGsm"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CellIdentityGsm"
+    }
+    struct_value: {
+        name: "signalStrengthGsm"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::GsmSignalStrength"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellInfoWcdma"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cellIdentityWcdma"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CellIdentityWcdma"
+    }
+    struct_value: {
+        name: "signalStrengthWcdma"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::WcdmaSignalStrength"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellInfoCdma"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cellIdentityCdma"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CellIdentityCdma"
+    }
+    struct_value: {
+        name: "signalStrengthCdma"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSignalStrength"
+    }
+    struct_value: {
+        name: "signalStrengthEvdo"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::EvdoSignalStrength"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellInfoLte"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cellIdentityLte"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CellIdentityLte"
+    }
+    struct_value: {
+        name: "signalStrengthLte"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::LteSignalStrength"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellInfoTdscdma"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cellIdentityTdscdma"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CellIdentityTdscdma"
+    }
+    struct_value: {
+        name: "signalStrengthTdscdma"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::TdScdmaSignalStrength"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CellInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cellInfoType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CellInfoType"
+    }
+    struct_value: {
+        name: "registered"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "timeStampType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::TimeStampType"
+    }
+    struct_value: {
+        name: "timeStamp"
+        type: TYPE_SCALAR
+        scalar_type: "uint64_t"
+    }
+    struct_value: {
+        name: "gsm"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CellInfoGsm"
+        }
+    }
+    struct_value: {
+        name: "cdma"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CellInfoCdma"
+        }
+    }
+    struct_value: {
+        name: "lte"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CellInfoLte"
+        }
+    }
+    struct_value: {
+        name: "wcdma"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CellInfoWcdma"
+        }
+    }
+    struct_value: {
+        name: "tdscdma"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CellInfoTdscdma"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::GsmSmsMessage"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "smscPdu"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "pdu"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::ImsSmsMessage"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "tech"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::RadioTechnologyFamily"
+    }
+    struct_value: {
+        name: "retry"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "messageRef"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cdmaMessage"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaSmsMessage"
+        }
+    }
+    struct_value: {
+        name: "gsmMessage"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::GsmSmsMessage"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SimApdu"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "sessionId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "cla"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "instruction"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "p1"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "p2"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "p3"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "data"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::NvWriteItem"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "itemId"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::NvItem"
+    }
+    struct_value: {
+        name: "value"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SelectUiccSub"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "slot"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "appIndex"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "subType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::SubscriptionType"
+    }
+    struct_value: {
+        name: "actStatus"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::UiccSubActStatus"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::HardwareConfigModem"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "rilModel"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "rat"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "maxVoice"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "maxData"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "maxStandby"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::HardwareConfigSim"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "modemUuid"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::HardwareConfig"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "type"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::HardwareConfigType"
+    }
+    struct_value: {
+        name: "uuid"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "state"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::HardwareConfigState"
+    }
+    struct_value: {
+        name: "modem"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::HardwareConfigModem"
+        }
+    }
+    struct_value: {
+        name: "sim"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::HardwareConfigSim"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::DataProfileInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "profileId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "apn"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "protocol"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "authType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::ApnAuthType"
+    }
+    struct_value: {
+        name: "user"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "password"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "type"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::DataProfileInfoType"
+    }
+    struct_value: {
+        name: "maxConnsTime"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "maxConns"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "waitTime"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "enabled"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::RadioCapability"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "session"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "phase"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::RadioCapabilityPhase"
+    }
+    struct_value: {
+        name: "raf"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::RadioAccessFamily"
+    }
+    struct_value: {
+        name: "logicalModemUuid"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "status"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::RadioCapabilityStatus"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::LceStatusInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "lceStatus"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::LceStatus"
+    }
+    struct_value: {
+        name: "actualIntervalMs"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::LceDataInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "lastHopCapacityKbps"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "confidenceLevel"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+    struct_value: {
+        name: "lceSuspended"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::ActivityStatsInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "sleepModeTimeMs"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "idleModeTimeMs"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "txmModetimeMs"
+        type: TYPE_ARRAY
+        vector_value: {
+            vector_size: 5
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+    }
+    struct_value: {
+        name: "rxModeTimeMs"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::Carrier"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "mcc"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "mnc"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "matchType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CarrierMatchType"
+    }
+    struct_value: {
+        name: "matchData"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CarrierRestrictions"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "allowedCarriers"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::Carrier"
+        }
+    }
+    struct_value: {
+        name: "excludedCarriers"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::Carrier"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SuppSvcNotification"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "isMT"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "code"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "index"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "type"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "number"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SimRefreshResult"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "type"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::SimRefreshType"
+    }
+    struct_value: {
+        name: "efId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "aid"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaSignalInfoRecord"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "isPresent"
+        type: TYPE_SCALAR
+        scalar_type: "bool_t"
+    }
+    struct_value: {
+        name: "signalType"
+        type: TYPE_SCALAR
+        scalar_type: "int8_t"
+    }
+    struct_value: {
+        name: "alertPitch"
+        type: TYPE_SCALAR
+        scalar_type: "int8_t"
+    }
+    struct_value: {
+        name: "signal"
+        type: TYPE_SCALAR
+        scalar_type: "int8_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaCallWaiting"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "number"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "numberPresentation"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaCallWaitingNumberPresentation"
+    }
+    struct_value: {
+        name: "name"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "signalInfoRecord"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CdmaSignalInfoRecord"
+    }
+    struct_value: {
+        name: "numbertype"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaCallWaitingNumberType"
+    }
+    struct_value: {
+        name: "numberPlan"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaCallWaitingNumberPlan"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaDisplayInfoRecord"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "alphaBuf"
+        type: TYPE_STRING
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaNumberInfoRecord"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "number"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "numberType"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+    struct_value: {
+        name: "numberPlan"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+    struct_value: {
+        name: "pi"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+    struct_value: {
+        name: "si"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaRedirectingNumberInfoRecord"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "redirectingNumber"
+        type: TYPE_STRUCT
+        predefined_type: "::android::hardware::radio::V1_0::CdmaNumberInfoRecord"
+    }
+    struct_value: {
+        name: "redirectingReason"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaRedirectingReason"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaLineControlInfoRecord"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "lineCtrlPolarityIncluded"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+    struct_value: {
+        name: "lineCtrlToggle"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+    struct_value: {
+        name: "lineCtrlReverse"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+    struct_value: {
+        name: "lineCtrlPowerDenial"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaT53ClirInfoRecord"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cause"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaT53AudioControlInfoRecord"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "upLink"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+    struct_value: {
+        name: "downLink"
+        type: TYPE_SCALAR
+        scalar_type: "uint8_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaInformationRecord"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "name"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::CdmaInfoRecName"
+    }
+    struct_value: {
+        name: "display"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaDisplayInfoRecord"
+        }
+    }
+    struct_value: {
+        name: "number"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaNumberInfoRecord"
+        }
+    }
+    struct_value: {
+        name: "signal"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaSignalInfoRecord"
+        }
+    }
+    struct_value: {
+        name: "redir"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaRedirectingNumberInfoRecord"
+        }
+    }
+    struct_value: {
+        name: "lineCtrl"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaLineControlInfoRecord"
+        }
+    }
+    struct_value: {
+        name: "clir"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaT53ClirInfoRecord"
+        }
+    }
+    struct_value: {
+        name: "audioCtrl"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaT53AudioControlInfoRecord"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CdmaInformationRecords"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "infoRec"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CdmaInformationRecord"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::CfData"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cfInfo"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CallForwardInfo"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::SsInfoData"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "ssInfo"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::StkCcUnsolSsResult"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "serviceType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::SsServiceType"
+    }
+    struct_value: {
+        name: "requestType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::SsRequestType"
+    }
+    struct_value: {
+        name: "teleserviceType"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::SsTeleserviceType"
+    }
+    struct_value: {
+        name: "serviceClass"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::SuppServiceClass"
+    }
+    struct_value: {
+        name: "result"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::radio::V1_0::RadioError"
+    }
+    struct_value: {
+        name: "ssInfo"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::SsInfoData"
+        }
+    }
+    struct_value: {
+        name: "cfData"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::radio::V1_0::CfData"
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::radio::V1_0::PcoDataInfo"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "cid"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "bearerProto"
+        type: TYPE_STRING
+    }
+    struct_value: {
+        name: "pcoId"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "contents"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_SCALAR
+            scalar_type: "uint8_t"
+        }
+    }
+}
+
diff --git a/sensors/1.0/vts/functional/sensors_hidl_hal_test.cpp b/sensors/1.0/vts/functional/sensors_hidl_hal_test.cpp
index 8e85b23..17c439e 100644
--- a/sensors/1.0/vts/functional/sensors_hidl_hal_test.cpp
+++ b/sensors/1.0/vts/functional/sensors_hidl_hal_test.cpp
@@ -84,6 +84,10 @@
 
   collectionEnabled = false;
   startPollingThread();
+
+  // In case framework just stopped for test and there is sensor events in the pipe,
+  // wait some time for those events to be cleared to avoid them messing up the test.
+  std::this_thread::sleep_for(std::chrono::seconds(3));
 }
 
 void SensorsHidlEnvironment::TearDown() {
diff --git a/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host/SensorsHidlTest.py b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host/SensorsHidlTest.py
index 88fe675..de764af 100644
--- a/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host/SensorsHidlTest.py
+++ b/sensors/1.0/vts/functional/vts/testcases/hal/sensors/hidl/host/SensorsHidlTest.py
@@ -48,11 +48,11 @@
 
         self.dut.hal.InitHidlHal(
             target_type="sensors",
-            target_basepaths=["/system/lib64"],
+            target_basepaths=self.dut.libPaths,
             target_version=1.0,
             target_package="android.hardware.sensors",
             target_component_name="ISensors",
-            bits=64)
+            bits=64 if self.dut.is64Bit else 32)
 
     def tearDownClass(self):
         """ If profiling is enabled for the test, collect the profiling data
diff --git a/soundtrigger/2.0/vts/functional/soundtrigger_hidl_hal_test.cpp b/soundtrigger/2.0/vts/functional/soundtrigger_hidl_hal_test.cpp
index e5bf086..3379d93 100644
--- a/soundtrigger/2.0/vts/functional/soundtrigger_hidl_hal_test.cpp
+++ b/soundtrigger/2.0/vts/functional/soundtrigger_hidl_hal_test.cpp
@@ -104,7 +104,7 @@
       halProperties = res;
   });
 
-  EXPECT_EQ(Status::EX_NONE, hidlReturn.getStatus().exceptionCode());
+  EXPECT_TRUE(hidlReturn.isOk());
   EXPECT_EQ(0, ret);
   EXPECT_GT(halProperties.maxSoundModels, 0u);
   EXPECT_GT(halProperties.maxKeyPhrases, 0u);
@@ -136,7 +136,7 @@
       handle = res;
   });
 
-  EXPECT_EQ(Status::EX_NONE, hidlReturn.getStatus().exceptionCode());
+  EXPECT_TRUE(hidlReturn.isOk());
   EXPECT_NE(0, ret);
 }
 
@@ -154,7 +154,7 @@
 
   hidlReturn = mSoundTriggerHal->unloadSoundModel(halHandle);
 
-  EXPECT_EQ(Status::EX_NONE, hidlReturn.getStatus().exceptionCode());
+  EXPECT_TRUE(hidlReturn.isOk());
   EXPECT_NE(0, hidlReturn);
 }
 
@@ -184,7 +184,7 @@
 
     hidlReturn = mSoundTriggerHal->startRecognition(handle, config, mCallback, 0);
 
-    EXPECT_EQ(Status::EX_NONE, hidlReturn.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlReturn.isOk());
     EXPECT_NE(0, hidlReturn);
 }
 
@@ -202,7 +202,7 @@
 
     hidlReturn = mSoundTriggerHal->stopRecognition(handle);
 
-    EXPECT_EQ(Status::EX_NONE, hidlReturn.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlReturn.isOk());
     EXPECT_NE(0, hidlReturn);
 }
 
@@ -219,7 +219,7 @@
 
     hidlReturn = mSoundTriggerHal->stopAllRecognitions();
 
-    EXPECT_EQ(Status::EX_NONE, hidlReturn.getStatus().exceptionCode());
+    EXPECT_TRUE(hidlReturn.isOk());
     EXPECT_TRUE(hidlReturn == 0 || hidlReturn == -ENOSYS);
 }
 
diff --git a/soundtrigger/2.0/vts/functional/vts/testcases/hal/soundtrigger/hidl/target/AndroidTest.xml b/soundtrigger/2.0/vts/functional/vts/testcases/hal/soundtrigger/hidl/target/AndroidTest.xml
index b75d97e..ca8ecdb 100644
--- a/soundtrigger/2.0/vts/functional/vts/testcases/hal/soundtrigger/hidl/target/AndroidTest.xml
+++ b/soundtrigger/2.0/vts/functional/vts/testcases/hal/soundtrigger/hidl/target/AndroidTest.xml
@@ -24,6 +24,7 @@
             _32bit::DATA/nativetest/soundtrigger_hidl_hal_test/soundtrigger_hidl_hal_test,
             _64bit::DATA/nativetest64/soundtrigger_hidl_hal_test/soundtrigger_hidl_hal_test,
             "/>
+        <option name="test-config-path" value="vts/testcases/hal/soundtrigger/hidl/target/HalSoundTriggerHidlTargetBasicTest.config" />
         <option name="binary-test-type" value="gtest" />
         <option name="test-timeout" value="1m" />
     </test>
diff --git a/soundtrigger/2.0/vts/functional/vts/testcases/hal/soundtrigger/hidl/target/HalSoundTriggerHidlTargetBasicTest.config b/soundtrigger/2.0/vts/functional/vts/testcases/hal/soundtrigger/hidl/target/HalSoundTriggerHidlTargetBasicTest.config
new file mode 100644
index 0000000..7558911
--- /dev/null
+++ b/soundtrigger/2.0/vts/functional/vts/testcases/hal/soundtrigger/hidl/target/HalSoundTriggerHidlTargetBasicTest.config
@@ -0,0 +1,41 @@
+{
+    "use_gae_db": true,
+    "coverage": true,
+    "modules": [
+        {
+            "module_name": "system/lib/hw/sound_trigger.primary.bullhead",
+            "git_project": {
+                "name": "platform/vendor/lge/bullhead",
+                "path": "vendor/lge/bullhead"
+            },
+        },
+        {
+            "module_name": "system/lib/hw/sound_trigger.primary.angler",
+            "git_project": {
+                "name": "platform/vendor/huawei/angler",
+                "path": "vendor/huawei/angler"
+            },
+        },
+        {
+            "module_name": "system/lib/hw/sound_trigger.primary.marlin",
+            "git_project": {
+                "name": "platform/vendor/google_devices/marlin",
+                "path": "vendor/google_devices/marlin"
+            },
+        },
+        {
+            "module_name": "system/lib/hw/sound_trigger.primary.sailfish",
+            "git_project": {
+                "name": "platform/vendor/google_devices/marlin",
+                "path": "vendor/google_devices/marlin"
+            },
+        },
+        {
+            "module_name": "system/lib/hw/android.hardware.soundtrigger@2.0-impl",
+            "git_project": {
+                "name": "platform/hardware/interfaces",
+                "path": "hardware/interfaces"
+            },
+        },
+    ]
+}
diff --git a/tests/bar/1.0/default/Bar.cpp b/tests/bar/1.0/default/Bar.cpp
index 4152bb9..16c0235 100644
--- a/tests/bar/1.0/default/Bar.cpp
+++ b/tests/bar/1.0/default/Bar.cpp
@@ -165,10 +165,8 @@
     return Void();
 }
 
-Return<void> Bar::haveAInterface(const sp<ISimple> &in,
-            haveAInterface_cb _hidl_cb) {
-    _hidl_cb(in);
-    return Void();
+Return<sp<ISimple>> Bar::haveAInterface(const sp<ISimple> &in) {
+    return in;
 }
 
 
diff --git a/tests/bar/1.0/default/Bar.h b/tests/bar/1.0/default/Bar.h
index 70bffe7..b276823 100644
--- a/tests/bar/1.0/default/Bar.h
+++ b/tests/bar/1.0/default/Bar.h
@@ -71,8 +71,7 @@
 
     Return<void> takeAMask(BitField bf, uint8_t first, const MyMask& second, uint8_t third,
             takeAMask_cb _hidl_cb) override;
-    Return<void> haveAInterface(const sp<ISimple> &in,
-            haveAInterface_cb _hidl_cb) override;
+    Return<sp<ISimple>> haveAInterface(const sp<ISimple> &in);
 
 private:
     sp<IFoo> mFoo;
diff --git a/tests/foo/1.0/IFoo.hal b/tests/foo/1.0/IFoo.hal
index fc76c1c..76aefcf 100644
--- a/tests/foo/1.0/IFoo.hal
+++ b/tests/foo/1.0/IFoo.hal
@@ -98,6 +98,29 @@
 
     typedef bitfield<BitField> Mask;
 
+    struct Everything {
+        union U {
+            int8_t number;
+            int8_t[1][2] multidimArray;
+            pointer p;
+            Fumble anotherStruct;
+            bitfield<BitField> bf;
+        } u;
+
+        int8_t number;
+        handle h;
+        fmq_sync<uint8_t> descSync;
+        fmq_unsync<uint8_t> descUnsync;
+        memory mem;
+        pointer p;
+        string s;
+        vec<string> vs;
+        string[2][2] multidimArray;
+        string[3] sArray;
+        Quux anotherStruct;
+        bitfield<BitField> bf;
+    };
+
     doThis(float param);
     doThatAndReturnSomething(int64_t param) generates (int32_t result);
     doQuiteABit(int32_t a, int64_t b, float c, double d) generates (double something);
diff --git a/tests/foo/1.0/default/Android.bp b/tests/foo/1.0/default/Android.bp
index 76a4656..952f25d 100644
--- a/tests/foo/1.0/default/Android.bp
+++ b/tests/foo/1.0/default/Android.bp
@@ -5,7 +5,6 @@
     relative_install_path: "hw",
     srcs: [
         "Foo.cpp",
-        "FooCallback.cpp",
     ],
 
     shared_libs: [
diff --git a/tests/foo/1.0/default/Foo.cpp b/tests/foo/1.0/default/Foo.cpp
index cdfdecc..a860ce7 100644
--- a/tests/foo/1.0/default/Foo.cpp
+++ b/tests/foo/1.0/default/Foo.cpp
@@ -2,7 +2,6 @@
 #define LOG_TAG "hidl_test"
 
 #include "Foo.h"
-#include "FooCallback.h"
 #include <android-base/logging.h>
 #include <hidl-test/FooHelper.h>
 #include <inttypes.h>
diff --git a/tests/foo/1.0/default/FooCallback.cpp b/tests/foo/1.0/default/FooCallback.cpp
deleted file mode 100644
index ff3a545..0000000
--- a/tests/foo/1.0/default/FooCallback.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-
-#define LOG_TAG "hidl_test"
-
-#include "FooCallback.h"
-#include <android/log.h>
-#include <hidl-test/FooHelper.h>
-#include <inttypes.h>
-#include <utils/Timers.h>
-
-namespace android {
-namespace hardware {
-namespace tests {
-namespace foo {
-namespace V1_0 {
-namespace implementation {
-
-enum {
-    NOT_REPORTED = -1LL
-};
-
-FooCallback::FooCallback()
-        : mLock{}, mCond{} {
-    for (size_t i = 0; i < invokeInfo.size(); i++) {
-        invokeInfo[i].invoked = false;
-        invokeInfo[i].timeNs = NOT_REPORTED;
-        invokeInfo[i].callerBlockedNs = NOT_REPORTED;
-    }
-}
-
-Return<void> FooCallback::heyItsYou(
-        const sp<IFooCallback> &_cb) {
-    nsecs_t start = systemTime();
-    ALOGI("SERVER(FooCallback) 1: heyItsYou cb = %p", _cb.get());
-    nsecs_t end = systemTime();
-    {
-        Mutex::Autolock lock(mLock);
-        invokeInfo[0].invoked = true;
-        invokeInfo[0].timeNs = end - start;
-        mCond.signal();
-    }
-    ALOGI("SERVER(FooCallback) 2: heyItsYou returned");
-    return Void();
-}
-
-Return<bool> FooCallback::heyItsYouIsntIt(const sp<IFooCallback> &_cb) {
-    nsecs_t start = systemTime();
-    ALOGI("SERVER(FooCallback) 3: heyItsYouIsntIt cb = %p sleeping for %" PRId64 " seconds", _cb.get(), DELAY_S);
-    sleep(DELAY_S);
-    ALOGI("SERVER(FooCallback) 4: heyItsYouIsntIt cb = %p responding", _cb.get());
-    nsecs_t end = systemTime();
-    {
-        Mutex::Autolock lock(mLock);
-        invokeInfo[1].invoked = true;
-        invokeInfo[1].timeNs = end - start;
-        mCond.signal();
-    }
-    ALOGI("SERVER(FooCallback) 5: heyItsYouIsntIt cb = %p responding", _cb.get());
-    return true;
-}
-
-Return<void> FooCallback::heyItsTheMeaningOfLife(uint8_t tmol) {
-    nsecs_t start = systemTime();
-    ALOGI("SERVER(FooCallback) 6.1: heyItsTheMeaningOfLife = %d sleeping for %" PRId64 " seconds", tmol, DELAY_S);
-    sleep(DELAY_S);
-    ALOGI("SERVER(FooCallback) 6.2: heyItsTheMeaningOfLife = %d done sleeping", tmol);
-    nsecs_t end = systemTime();
-    {
-        Mutex::Autolock lock(mLock);
-        invokeInfo[2].invoked = true;
-        invokeInfo[2].timeNs = end - start;
-        mCond.signal();
-    }
-    ALOGI("SERVER(FooCallback) 6.3: heyItsTheMeaningOfLife returned");
-    return Void();
-}
-
-Return<void> FooCallback::reportResults(int64_t ns, reportResults_cb cb) {
-    ALOGI("SERVER(FooCallback) 8.1: reportResults(%" PRId64 " seconds)", nanoseconds_to_seconds(ns));
-    nsecs_t leftToWaitNs = ns;
-    bool cond;
-    {
-        Mutex::Autolock lock(mLock);
-        while ((cond = ((!invokeInfo[0].invoked ||
-                !invokeInfo[1].invoked ||
-                !invokeInfo[2].invoked ||
-                invokeInfo[0].callerBlockedNs == NOT_REPORTED ||
-                invokeInfo[1].callerBlockedNs == NOT_REPORTED ||
-                invokeInfo[2].callerBlockedNs == NOT_REPORTED)   &&
-               leftToWaitNs > 0))) {
-            nsecs_t start = systemTime();
-            ::android::status_t rc = mCond.waitRelative(mLock, leftToWaitNs);
-            if (rc != ::android::OK) {
-                ALOGW("SERVER(FooCallback)::reportResults(%" PRId64 " ns) Condition::waitRelative(%" PRId64 ") returned error (%d)", ns, leftToWaitNs, rc);
-                if (rc == -ETIMEDOUT) {
-                    // time's up
-                    leftToWaitNs = -1;
-                }
-                break;
-            }
-            ALOGI("SERVER(FooCallback)::reportResults(%" PRId64 " ns) Condition::waitRelative was signalled", ns);
-            leftToWaitNs -= systemTime() - start;
-        }
-    }
-    ALOGI("SERVER(FooCallback) 8.2: reportResults returned;"
-            "invoked? %d, %d, %d; leftToWaitNs = %" PRId64 "; cond = %d",
-            invokeInfo[0].invoked, invokeInfo[1].invoked, invokeInfo[2].invoked,
-            leftToWaitNs, cond);
-    cb(leftToWaitNs, invokeInfo);
-    return Void();
-}
-
-Return<void> FooCallback::youBlockedMeFor(const hidl_array<int64_t, 3> &ns) {
-    ALOGI("SERVER(FooCallback) 7.1: youBlockedMeFor");
-    {
-        Mutex::Autolock lock(mLock);
-        for (size_t i = 0; i < 3; i++) {
-            invokeInfo[i].callerBlockedNs = ns[i];
-        }
-        mCond.signal();
-    }
-    ALOGI("SERVER(FooCallback) 7.2: returned");
-    return Void();
-}
-
-IFooCallback* HIDL_FETCH_IFooCallback(const char* /* name */) {
-    return new FooCallback();
-}
-
-} // namespace implementation
-}  // namespace V1_0
-}  // namespace foo
-}  // namespace tests
-}  // namespace hardware
-}  // namespace android
diff --git a/tests/foo/1.0/default/FooCallback.h b/tests/foo/1.0/default/FooCallback.h
deleted file mode 100644
index 3164a9d..0000000
--- a/tests/foo/1.0/default/FooCallback.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef ANDROID_HARDWARE_TESTS_FOO_V1_0_FOOCALLBACK_H
-#define ANDROID_HARDWARE_TESTS_FOO_V1_0_FOOCALLBACK_H
-
-#include <android/hardware/tests/foo/1.0/IFooCallback.h>
-#include <hidl/Status.h>
-#include <hidl/MQDescriptor.h>
-
-#include <utils/Condition.h>
-namespace android {
-namespace hardware {
-namespace tests {
-namespace foo {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::hardware::tests::foo::V1_0::IFooCallback;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
-
-struct FooCallback : public IFooCallback {
-    FooCallback();
-    // Methods from ::android::hardware::tests::foo::V1_0::IFooCallback follow.
-    Return<void> heyItsYou(const sp<IFooCallback>& cb)  override;
-    Return<bool> heyItsYouIsntIt(const sp<IFooCallback>& cb)  override;
-    Return<void> heyItsTheMeaningOfLife(uint8_t tmol)  override;
-    Return<void> reportResults(int64_t ns, reportResults_cb _hidl_cb)  override;
-    Return<void> youBlockedMeFor(const hidl_array<int64_t, 3 /* 3 */>& callerBlockedInfo)  override;
-
-    hidl_array<InvokeInfo, 3> invokeInfo;
-    Mutex mLock;
-    Condition mCond;
-};
-
-extern "C" IFooCallback* HIDL_FETCH_IFooCallback(const char* name);
-
-}  // namespace implementation
-}  // namespace V1_0
-}  // namespace foo
-}  // namespace tests
-}  // namespace hardware
-}  // namespace android
-
-#endif  // ANDROID_HARDWARE_TESTS_FOO_V1_0_FOOCALLBACK_H
diff --git a/tests/inheritance/1.0/default/Fetcher.cpp b/tests/inheritance/1.0/default/Fetcher.cpp
index f3b576b..7094f07 100644
--- a/tests/inheritance/1.0/default/Fetcher.cpp
+++ b/tests/inheritance/1.0/default/Fetcher.cpp
@@ -17,8 +17,7 @@
     CHECK(!mPrecious->isRemote());
 }
 
-template <typename CB>
-Return<void> selectService(bool sendRemote, CB &_hidl_cb, sp<IChild> &local) {
+sp<IChild> selectService(bool sendRemote, sp<IChild> &local) {
     sp<IChild> toSend;
     if (sendRemote) {
         toSend = IChild::getService("child");
@@ -29,21 +28,20 @@
         toSend = local;
     }
     LOG(INFO) << "SERVER(Fetcher) selectService returning " << toSend.get();
-    _hidl_cb(toSend);
-    return Void();
+    return toSend;
 }
 
 // Methods from ::android::hardware::tests::inheritance::V1_0::IFetcher follow.
-Return<void> Fetcher::getGrandparent(bool sendRemote, getGrandparent_cb _hidl_cb)  {
-    return selectService(sendRemote, _hidl_cb, mPrecious);
+Return<sp<IGrandparent>> Fetcher::getGrandparent(bool sendRemote)  {
+    return selectService(sendRemote, mPrecious);
 }
 
-Return<void> Fetcher::getParent(bool sendRemote, getParent_cb _hidl_cb)  {
-    return selectService(sendRemote, _hidl_cb, mPrecious);
+Return<sp<IParent>> Fetcher::getParent(bool sendRemote)  {
+    return selectService(sendRemote, mPrecious);
 }
 
-Return<void> Fetcher::getChild(bool sendRemote, getChild_cb _hidl_cb)  {
-    return selectService(sendRemote, _hidl_cb, mPrecious);
+Return<sp<IChild>> Fetcher::getChild(bool sendRemote)  {
+    return selectService(sendRemote, mPrecious);
 }
 
 IFetcher* HIDL_FETCH_IFetcher(const char* /* name */) {
diff --git a/tests/inheritance/1.0/default/Fetcher.h b/tests/inheritance/1.0/default/Fetcher.h
index da9b153..979b47f 100644
--- a/tests/inheritance/1.0/default/Fetcher.h
+++ b/tests/inheritance/1.0/default/Fetcher.h
@@ -25,9 +25,9 @@
     Fetcher();
 
     // Methods from ::android::hardware::tests::inheritance::V1_0::IFetcher follow.
-    Return<void> getGrandparent(bool sendRemote, getGrandparent_cb _hidl_cb)  override;
-    Return<void> getParent(bool sendRemote, getParent_cb _hidl_cb)  override;
-    Return<void> getChild(bool sendRemote, getChild_cb _hidl_cb)  override;
+    Return<sp<IGrandparent>> getGrandparent(bool sendRemote)  override;
+    Return<sp<IParent>> getParent(bool sendRemote)  override;
+    Return<sp<IChild>> getChild(bool sendRemote)  override;
 
 private:
     sp<IChild> mPrecious;
diff --git a/tests/msgq/1.0/ITestMsgQ.hal b/tests/msgq/1.0/ITestMsgQ.hal
index 933e39b..e000f55 100644
--- a/tests/msgq/1.0/ITestMsgQ.hal
+++ b/tests/msgq/1.0/ITestMsgQ.hal
@@ -91,4 +91,14 @@
      *
      */
     oneway requestBlockingRead(int32_t count);
+
+    /*
+     * This method requests the service to repeatedly trigger blocking reads.
+     *
+     * @param count Number of messages to read in a single blocking read.
+     * @param numIter Number of blocking reads to trigger.
+     *
+     */
+    oneway requestBlockingReadRepeat(int32_t count, int32_t numIter);
+
 };
diff --git a/tv/cec/1.0/vts/functional/vts/testcases/hal/tv_cec/hidl/host/TvCecHidlTest.py b/tv/cec/1.0/vts/functional/vts/testcases/hal/tv_cec/hidl/host/TvCecHidlTest.py
index cd2374a..5f7aaf1 100644
--- a/tv/cec/1.0/vts/functional/vts/testcases/hal/tv_cec/hidl/host/TvCecHidlTest.py
+++ b/tv/cec/1.0/vts/functional/vts/testcases/hal/tv_cec/hidl/host/TvCecHidlTest.py
@@ -17,6 +17,7 @@
 
 import logging
 
+from vts.proto import ComponentSpecificationMessage_pb2 as CompSpecMsg
 from vts.runners.host import asserts
 from vts.runners.host import base_test_with_webdb
 from vts.runners.host import const
@@ -37,13 +38,14 @@
         self.dut.shell.one.Execute(
             "setprop vts.hal.vts.hidl.get_stub true")
 
-        self.dut.hal.InitHidlHal(target_type="tv_cec",
-                                 target_basepaths=["/system/lib64"],
-                                 target_version=1.0,
-                                 target_package="android.hardware.tv.cec",
-                                 target_component_name="IHdmiCec",
-                                 hw_binder_service_name="tv.cec",
-                                 bits=64)
+        self.dut.hal.InitHidlHal(
+            target_type="tv_cec",
+            target_basepaths=self.dut.libPaths,
+            target_version=1.0,
+            target_package="android.hardware.tv.cec",
+            target_component_name="IHdmiCec",
+            hw_binder_service_name="cec-hal-1-0",
+            bits=64 if self.dut.is64Bit else 32)
 
     def testGetCecVersion1(self):
         """A simple test case which queries the cec version."""
@@ -51,6 +53,20 @@
         version = self.dut.hal.tv_cec.getCecVersion()
         logging.info('Cec version: %s', version)
 
+    def testSendRandomMessage(self):
+        """A test case which sends a random message."""
+        self.vtypes = self.dut.hal.tv_cec.GetHidlTypeInterface("types")
+        logging.info("tv_cec types: %s", self.vtypes)
+
+        cec_message = {
+            "initiator": self.vtypes.TV,
+            "destination": self.vtypes.PLAYBACK_1,
+            "body": [1, 2, 3]
+        }
+        message = self.vtypes.Py2Pb("CecMessage", cec_message)
+        logging.info("message: %s", message)
+        result = self.dut.hal.tv_cec.sendMessage(message)
+        logging.info('sendMessage result: %s', result)
 
 if __name__ == "__main__":
     test_runner.main()
diff --git a/tv/input/1.0/Android.bp b/tv/input/1.0/Android.bp
index 94dcdc9..9504961 100644
--- a/tv/input/1.0/Android.bp
+++ b/tv/input/1.0/Android.bp
@@ -128,3 +128,95 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.tv.input@1.0-ITvInput-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tv.input@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/tv/input/1.0/ $(genDir)/android/hardware/tv/input/1.0/",
+    srcs: [
+        "ITvInput.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/tv/input/1.0/TvInput.vts.cpp",
+        "android/hardware/tv/input/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tv.input@1.0-ITvInput-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tv.input@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/tv/input/1.0/ $(genDir)/android/hardware/tv/input/1.0/",
+    srcs: [
+        "ITvInput.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/tv/input/1.0/TvInput.vts.h",
+        "android/hardware/tv/input/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.tv.input@1.0-ITvInput-vts.profiler",
+    generated_sources: ["android.hardware.tv.input@1.0-ITvInput-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.tv.input@1.0-ITvInput-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.tv.input@1.0-ITvInput-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hardware.audio.common@2.0",
+        "android.hidl.base@1.0",
+        "android.hardware.tv.input@1.0",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tv.input@1.0-ITvInputCallback-vts.profiler_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tv.input@1.0 && $(location vtsc) -mPROFILER -tSOURCE -b$(genDir) android/hardware/tv/input/1.0/ $(genDir)/android/hardware/tv/input/1.0/",
+    srcs: [
+        "ITvInputCallback.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/tv/input/1.0/TvInputCallback.vts.cpp",
+        "android/hardware/tv/input/1.0/types.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tv.input@1.0-ITvInputCallback-vts.profiler_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tv.input@1.0 && $(location vtsc) -mPROFILER -tHEADER -b$(genDir) android/hardware/tv/input/1.0/ $(genDir)/android/hardware/tv/input/1.0/",
+    srcs: [
+        "ITvInputCallback.hal",
+        "types.hal",
+    ],
+    out: [
+        "android/hardware/tv/input/1.0/TvInputCallback.vts.h",
+        "android/hardware/tv/input/1.0/types.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.tv.input@1.0-ITvInputCallback-vts.profiler",
+    generated_sources: ["android.hardware.tv.input@1.0-ITvInputCallback-vts.profiler_genc++"],
+    generated_headers: ["android.hardware.tv.input@1.0-ITvInputCallback-vts.profiler_genc++_headers"],
+    export_generated_headers: ["android.hardware.tv.input@1.0-ITvInputCallback-vts.profiler_genc++_headers"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "libvts_profiling",
+        "libvts_multidevice_proto",
+        "libprotobuf-cpp-full",
+        "android.hardware.audio.common@2.0",
+        "android.hidl.base@1.0",
+        "android.hardware.tv.input@1.0",
+    ],
+}
diff --git a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py
index c99c82c..9b49078 100644
--- a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py
+++ b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py
@@ -39,13 +39,14 @@
                                  target_version=1.0,
                                  target_package="android.hardware.tv.input",
                                  target_component_name="ITvInput",
-                                 bits=64)
+                                 hw_binder_service_name="tv-input-1-0",
+                                 bits=64 if self.dut.is64Bit else 32)
 
         self.dut.shell.InvokeTerminal("one")
 
     def testGetStreamConfigurations(self):
         configs = self.dut.hal.tv_input.getStreamConfigurations(0)
-        logging.info('tv input configs: %s', configs)
+        logging.info('return value of getStreamConfigurations(0): %s', configs)
 
 
 if __name__ == "__main__":
diff --git a/vehicle/2.0/IVehicle.hal b/vehicle/2.0/IVehicle.hal
index 5b0df67..cab6ce0 100644
--- a/vehicle/2.0/IVehicle.hal
+++ b/vehicle/2.0/IVehicle.hal
@@ -99,9 +99,6 @@
    * primitives used (such as mutex locks or semaphores) must be acquired
    * with a timeout.
    *
-   * TODO(pavelm): we cannot use handle here due to Java compatibility, it's
-   * better to pass file descriptor and write debug data directly in vehicle HAL
-   * rather than passing back a string.
    */
   debugDump() generates (string s);
 };
diff --git a/vehicle/2.0/types.hal b/vehicle/2.0/types.hal
index 62521cb..bb83c8a 100644
--- a/vehicle/2.0/types.hal
+++ b/vehicle/2.0/types.hal
@@ -332,7 +332,6 @@
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
      * @access VehiclePropertyAccess:READ_WRITE
-     * @data_enum TODO
      * @allow_out_of_range_value : OFF
      */
     HVAC_FAN_SPEED = (
@@ -346,7 +345,7 @@
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
      * @access VehiclePropertyAccess:READ_WRITE
-     * @data_enum TODO
+     * @data_enum VehicleHvacFanDirection
      * @allow_out_of_range_value : OFF
      */
     HVAC_FAN_DIRECTION = (
@@ -2746,7 +2745,7 @@
    * tests are available and whether they are complete. The semantics of the individual
    * bits in this value are given by, respectively, SparkIgnitionMonitors and
    * CompressionIgnitionMonitors depending on the value of IGNITION_MONITORS_SUPPORTED.
-  /*
+   */
   IGNITION_SPECIFIC_MONITORS = 3,
 
   INTAKE_AIR_TEMPERATURE = 4,
diff --git a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py
index 37f24c4..715cba8 100644
--- a/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py
+++ b/vehicle/2.0/vts/functional/vts/testcases/hal/vehicle/hidl/host/VehicleHidlTest.py
@@ -40,16 +40,22 @@
 
         self.dut.hal.InitHidlHal(
             target_type="vehicle",
-            target_basepaths=["/system/lib64"],
+            target_basepaths=self.dut.libPaths,
             target_version=2.0,
             target_package="android.hardware.vehicle",
             target_component_name="IVehicle",
             hw_binder_service_name="Vehicle",
-            bits=64)
+            bits=64 if self.dut.is64Bit else 32)
+
+        self.vehicle = self.dut.hal.vehicle  # shortcut
+        self.vtypes = self.dut.hal.vehicle.GetHidlTypeInterface("types")
+        logging.info("vehicle types: %s", self.vtypes)
 
     def tearDownClass(self):
-        """ If profiling is enabled for the test, collect the profiling data
-            and disable profiling after the test is done.
+        """Disables the profiling.
+
+        If profiling is enabled for the test, collect the profiling data
+        and disable profiling after the test is done.
         """
         if self.enable_profiling:
             profiling_trace_path = getattr(
@@ -58,12 +64,26 @@
             profiling_utils.DisableVTSProfiling(self.dut.shell.one)
 
     def testListProperties(self):
-        logging.info("vehicle_types")
-        vehicle_types = self.dut.hal.vehicle.GetHidlTypeInterface("types")
-        logging.info("vehicle_types: %s", vehicle_types)
+        """Checks whether some PropConfigs are returned.
 
-        allConfigs = self.dut.hal.vehicle.getAllPropConfigs()
+        Verifies that call to getAllPropConfigs is not failing and
+        it returns at least 1 vehicle property config.
+        """
+        allConfigs = self.vehicle.getAllPropConfigs()
         logging.info("all supported properties: %s", allConfigs)
+        asserts.assertLess(0, len(allConfigs))
+
+    def testMandatoryProperties(self):
+        """Verifies that all mandatory properties are supported."""
+        mandatoryProps = set([self.vtypes.DRIVING_STATUS])  # 1 property so far
+        logging.info(self.vtypes.DRIVING_STATUS)
+        allConfigs = self.dut.hal.vehicle.getAllPropConfigs()
+
+        for config in allConfigs:
+            mandatoryProps.discard(config['prop'])
+
+        asserts.assertEqual(0, len(mandatoryProps))
+
 
 if __name__ == "__main__":
     test_runner.main()
diff --git a/vehicle/2.0/vts/types.vts b/vehicle/2.0/vts/types.vts
index 99fa6e7..fa7d892 100644
--- a/vehicle/2.0/vts/types.vts
+++ b/vehicle/2.0/vts/types.vts
@@ -43,6 +43,10 @@
         scalar_value: {
             int32_t: 7340032
         }
+        enumerator: "COMPLEX"
+        scalar_value: {
+            int32_t: 14680064
+        }
         enumerator: "MASK"
         scalar_value: {
             int32_t: 16711680
@@ -186,6 +190,10 @@
         scalar_value: {
             int32_t: 289408008
         }
+        enumerator: "IGNITION_STATE"
+        scalar_value: {
+            int32_t: 289408009
+        }
         enumerator: "HVAC_FAN_SPEED"
         scalar_value: {
             int32_t: 306185472
@@ -486,6 +494,18 @@
         scalar_value: {
             int32_t: 287312836
         }
+        enumerator: "VEHICLE_MAPS_DATA_SERVICE"
+        scalar_value: {
+            int32_t: 299895808
+        }
+        enumerator: "OBD2_LIVE_FRAME"
+        scalar_value: {
+            int32_t: 299896064
+        }
+        enumerator: "OBD2_FREEZE_FRAME"
+        scalar_value: {
+            int32_t: 299896065
+        }
     }
 }
 
@@ -1686,6 +1706,39 @@
 }
 
 attribute: {
+    name: "::android::hardware::vehicle::V2_0::VehicleIgnitionState"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNDEFINED"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "LOCK"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "OFF"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "ACC"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "ON"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "START"
+        scalar_value: {
+            int32_t: 5
+        }
+    }
+}
+
+attribute: {
     name: "::android::hardware::vehicle::V2_0::VehiclePropertyOperation"
     type: TYPE_ENUM
     enum_value: {
@@ -1793,3 +1846,828 @@
     }
 }
 
+attribute: {
+    name: "::android::hardware::vehicle::V2_0::FuelSystemStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "OPEN_INSUFFICIENT_ENGINE_TEMPERATURE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CLOSED_LOOP"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "OPEN_ENGINE_LOAD_OR_DECELERATION"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "OPEN_SYSTEM_FAILURE"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "CLOSED_LOOP_BUT_FEEDBACK_FAULT"
+        scalar_value: {
+            int32_t: 16
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::vehicle::V2_0::IgnitionMonitorKind"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "SPARK"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "COMPRESSION"
+        scalar_value: {
+            int32_t: 1
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::vehicle::V2_0::CommonIgnitionMonitors"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "COMPONENTS_AVAILABLE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "COMPONENTS_INCOMPLETE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "FUEL_SYSTEM_AVAILABLE"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "FUEL_SYSTEM_INCOMPLETE"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "MISFIRE_AVAILABLE"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "MISFIRE_INCOMPLETE"
+        scalar_value: {
+            int32_t: 32
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::vehicle::V2_0::SparkIgnitionMonitors"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "COMPONENTS_AVAILABLE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "COMPONENTS_INCOMPLETE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "FUEL_SYSTEM_AVAILABLE"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "FUEL_SYSTEM_INCOMPLETE"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "MISFIRE_AVAILABLE"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "MISFIRE_INCOMPLETE"
+        scalar_value: {
+            int32_t: 32
+        }
+        enumerator: "EGR_AVAILABLE"
+        scalar_value: {
+            int32_t: 64
+        }
+        enumerator: "EGR_INCOMPLETE"
+        scalar_value: {
+            int32_t: 128
+        }
+        enumerator: "OXYGEN_SENSOR_HEATER_AVAILABLE"
+        scalar_value: {
+            int32_t: 256
+        }
+        enumerator: "OXYGEN_SENSOR_HEATER_INCOMPLETE"
+        scalar_value: {
+            int32_t: 512
+        }
+        enumerator: "OXYGEN_SENSOR_AVAILABLE"
+        scalar_value: {
+            int32_t: 1024
+        }
+        enumerator: "OXYGEN_SENSOR_INCOMPLETE"
+        scalar_value: {
+            int32_t: 2048
+        }
+        enumerator: "AC_REFRIGERANT_AVAILABLE"
+        scalar_value: {
+            int32_t: 4096
+        }
+        enumerator: "AC_REFRIGERANT_INCOMPLETE"
+        scalar_value: {
+            int32_t: 8192
+        }
+        enumerator: "SECONDARY_AIR_SYSTEM_AVAILABLE"
+        scalar_value: {
+            int32_t: 16384
+        }
+        enumerator: "SECONDARY_AIR_SYSTEM_INCOMPLETE"
+        scalar_value: {
+            int32_t: 32768
+        }
+        enumerator: "EVAPORATIVE_SYSTEM_AVAILABLE"
+        scalar_value: {
+            int32_t: 65536
+        }
+        enumerator: "EVAPORATIVE_SYSTEM_INCOMPLETE"
+        scalar_value: {
+            int32_t: 131072
+        }
+        enumerator: "HEATED_CATALYST_AVAILABLE"
+        scalar_value: {
+            int32_t: 262144
+        }
+        enumerator: "HEATED_CATALYST_INCOMPLETE"
+        scalar_value: {
+            int32_t: 524288
+        }
+        enumerator: "CATALYST_AVAILABLE"
+        scalar_value: {
+            int32_t: 1048576
+        }
+        enumerator: "CATALYST_INCOMPLETE"
+        scalar_value: {
+            int32_t: 2097152
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::vehicle::V2_0::CompressionIgnitionMonitors"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "COMPONENTS_AVAILABLE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "COMPONENTS_INCOMPLETE"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "FUEL_SYSTEM_AVAILABLE"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "FUEL_SYSTEM_INCOMPLETE"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "MISFIRE_AVAILABLE"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "MISFIRE_INCOMPLETE"
+        scalar_value: {
+            int32_t: 32
+        }
+        enumerator: "EGR_OR_VVT_AVAILABLE"
+        scalar_value: {
+            int32_t: 64
+        }
+        enumerator: "EGR_OR_VVT_INCOMPLETE"
+        scalar_value: {
+            int32_t: 128
+        }
+        enumerator: "PM_FILTER_AVAILABLE"
+        scalar_value: {
+            int32_t: 256
+        }
+        enumerator: "PM_FILTER_INCOMPLETE"
+        scalar_value: {
+            int32_t: 512
+        }
+        enumerator: "EXHAUST_GAS_SENSOR_AVAILABLE"
+        scalar_value: {
+            int32_t: 1024
+        }
+        enumerator: "EXHAUST_GAS_SENSOR_INCOMPLETE"
+        scalar_value: {
+            int32_t: 2048
+        }
+        enumerator: "BOOST_PRESSURE_AVAILABLE"
+        scalar_value: {
+            int32_t: 4096
+        }
+        enumerator: "BOOST_PRESSURE_INCOMPLETE"
+        scalar_value: {
+            int32_t: 8192
+        }
+        enumerator: "NOx_SCR__AVAILABLE"
+        scalar_value: {
+            int32_t: 16384
+        }
+        enumerator: "NOx_SCR_INCOMPLETE"
+        scalar_value: {
+            int32_t: 32768
+        }
+        enumerator: "NMHC_CATALYST_AVAILABLE"
+        scalar_value: {
+            int32_t: 65536
+        }
+        enumerator: "NMHC_CATALYST_INCOMPLETE"
+        scalar_value: {
+            int32_t: 131072
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::vehicle::V2_0::SecondaryAirStatus"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UPSTREAM"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "DOWNSTREAM_OF_CATALYCIC_CONVERTER"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "FROM_OUTSIDE_OR_OFF"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "PUMP_ON_FOR_DIAGNOSTICS"
+        scalar_value: {
+            int32_t: 8
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::vehicle::V2_0::FuelType"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "NOT_AVAILABLE"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "GASOLINE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "METHANOL"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "ETHANOL"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "DIESEL"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "LPG"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "CNG"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "PROPANE"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "ELECTRIC"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "BIFUEL_RUNNING_GASOLINE"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "BIFUEL_RUNNING_METHANOL"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "BIFUEL_RUNNING_ETHANOL"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "BIFUEL_RUNNING_LPG"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "BIFUEL_RUNNING_CNG"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "BIFUEL_RUNNING_PROPANE"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "BIFUEL_RUNNING_ELECTRIC"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "BIFUEL_RUNNING_ELECTRIC_AND_COMBUSTION"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "HYBRID_GASOLINE"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "HYBRID_ETHANOL"
+        scalar_value: {
+            int32_t: 18
+        }
+        enumerator: "HYBRID_DIESEL"
+        scalar_value: {
+            int32_t: 19
+        }
+        enumerator: "HYBRID_ELECTRIC"
+        scalar_value: {
+            int32_t: 20
+        }
+        enumerator: "HYBRID_RUNNING_ELECTRIC_AND_COMBUSTION"
+        scalar_value: {
+            int32_t: 21
+        }
+        enumerator: "HYBRID_REGENERATIVE"
+        scalar_value: {
+            int32_t: 22
+        }
+        enumerator: "BIFUEL_RUNNING_DIESEL"
+        scalar_value: {
+            int32_t: 23
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::vehicle::V2_0::Obd2IntegerSensorIndex"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "FUEL_SYSTEM_STATUS"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "MALFUNCTION_INDICATOR_LIGHT_ON"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "IGNITION_MONITORS_SUPPORTED"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "COMMANDED_SECONDARY_AIR_STATUS"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "NUM_OXYGEN_SENSORS_PRESENT"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "RUNTIME_SINCE_ENGINE_START"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "WARMUPS_SINCE_CODES_CLEARED"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "DISTANCE_TRAVELED_SINCE_CODES_CLEARED"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "ABSOLUTE_BAROMETRIC_PRESSURE"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "CONTROL_MODULE_VOLTAGE"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "AMBIENT_AIR_TEMPERATURE"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "TIME_WITH_MALFUNCTION_LIGHT_ON"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "TIME_SINCE_TROUBLE_CODES_CLEARED"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "MAX_FUEL_AIR_EQUIVALENCE_RATIO"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "MAX_OXYGEN_SENSOR_VOLTAGE"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "MAX_OXYGEN_SENSOR_CURRENT"
+        scalar_value: {
+            int32_t: 18
+        }
+        enumerator: "MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE"
+        scalar_value: {
+            int32_t: 19
+        }
+        enumerator: "MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR"
+        scalar_value: {
+            int32_t: 20
+        }
+        enumerator: "FUEL_TYPE"
+        scalar_value: {
+            int32_t: 21
+        }
+        enumerator: "FUEL_RAIL_ABSOLUTE_PRESSURE"
+        scalar_value: {
+            int32_t: 22
+        }
+        enumerator: "ENGINE_OIL_TEMPERATURE"
+        scalar_value: {
+            int32_t: 23
+        }
+        enumerator: "DRIVER_DEMAND_PERCENT_TORQUE"
+        scalar_value: {
+            int32_t: 24
+        }
+        enumerator: "ENGINE_ACTUAL_PERCENT_TORQUE"
+        scalar_value: {
+            int32_t: 25
+        }
+        enumerator: "ENGINE_REFERENCE_PERCENT_TORQUE"
+        scalar_value: {
+            int32_t: 26
+        }
+        enumerator: "ENGINE_PERCENT_TORQUE_DATA_IDLE"
+        scalar_value: {
+            int32_t: 27
+        }
+        enumerator: "ENGINE_PERCENT_TORQUE_DATA_POINT1"
+        scalar_value: {
+            int32_t: 28
+        }
+        enumerator: "ENGINE_PERCENT_TORQUE_DATA_POINT2"
+        scalar_value: {
+            int32_t: 29
+        }
+        enumerator: "ENGINE_PERCENT_TORQUE_DATA_POINT3"
+        scalar_value: {
+            int32_t: 30
+        }
+        enumerator: "ENGINE_PERCENT_TORQUE_DATA_POINT4"
+        scalar_value: {
+            int32_t: 31
+        }
+        enumerator: "LAST_SYSTEM_INDEX"
+        scalar_value: {
+            int32_t: 31
+        }
+        enumerator: "VENDOR_START_INDEX"
+        scalar_value: {
+            int32_t: 32
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::vehicle::V2_0::Obd2FloatSensorIndex"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "CALCULATED_ENGINE_LOAD"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "ENGINE_COOLANT_TEMPERATURE"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "SHORT_TERM_FUEL_TRIM_BANK1"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "LONG_TERM_FUEL_TRIM_BANK1"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "SHORT_TERM_FUEL_TRIM_BANK2"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "LONG_TERM_FUEL_TRIM_BANK2"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "FUEL_PRESSURE"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "INTAKE_MANIFOLD_ABSOLUTE_PRESSURE"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "ENGINE_RPM"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "VEHICLE_SPEED"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "TIMING_ADVANCE"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "MAF_AIR_FLOW_RATE"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "THROTTLE_POSITION"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "OXYGEN_SENSOR1_VOLTAGE"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "OXYGEN_SENSOR2_VOLTAGE"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM"
+        scalar_value: {
+            int32_t: 17
+        }
+        enumerator: "OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO"
+        scalar_value: {
+            int32_t: 18
+        }
+        enumerator: "OXYGEN_SENSOR3_VOLTAGE"
+        scalar_value: {
+            int32_t: 19
+        }
+        enumerator: "OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM"
+        scalar_value: {
+            int32_t: 20
+        }
+        enumerator: "OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO"
+        scalar_value: {
+            int32_t: 21
+        }
+        enumerator: "OXYGEN_SENSOR4_VOLTAGE"
+        scalar_value: {
+            int32_t: 22
+        }
+        enumerator: "OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM"
+        scalar_value: {
+            int32_t: 23
+        }
+        enumerator: "OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO"
+        scalar_value: {
+            int32_t: 24
+        }
+        enumerator: "OXYGEN_SENSOR5_VOLTAGE"
+        scalar_value: {
+            int32_t: 25
+        }
+        enumerator: "OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM"
+        scalar_value: {
+            int32_t: 26
+        }
+        enumerator: "OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO"
+        scalar_value: {
+            int32_t: 27
+        }
+        enumerator: "OXYGEN_SENSOR6_VOLTAGE"
+        scalar_value: {
+            int32_t: 28
+        }
+        enumerator: "OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM"
+        scalar_value: {
+            int32_t: 29
+        }
+        enumerator: "OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO"
+        scalar_value: {
+            int32_t: 30
+        }
+        enumerator: "OXYGEN_SENSOR7_VOLTAGE"
+        scalar_value: {
+            int32_t: 31
+        }
+        enumerator: "OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM"
+        scalar_value: {
+            int32_t: 32
+        }
+        enumerator: "OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO"
+        scalar_value: {
+            int32_t: 33
+        }
+        enumerator: "OXYGEN_SENSOR8_VOLTAGE"
+        scalar_value: {
+            int32_t: 34
+        }
+        enumerator: "OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM"
+        scalar_value: {
+            int32_t: 35
+        }
+        enumerator: "OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO"
+        scalar_value: {
+            int32_t: 36
+        }
+        enumerator: "FUEL_RAIL_PRESSURE"
+        scalar_value: {
+            int32_t: 37
+        }
+        enumerator: "FUEL_RAIL_GAUGE_PRESSURE"
+        scalar_value: {
+            int32_t: 38
+        }
+        enumerator: "COMMANDED_EXHAUST_GAS_RECIRCULATION"
+        scalar_value: {
+            int32_t: 39
+        }
+        enumerator: "EXHAUST_GAS_RECIRCULATION_ERROR"
+        scalar_value: {
+            int32_t: 40
+        }
+        enumerator: "COMMANDED_EVAPORATIVE_PURGE"
+        scalar_value: {
+            int32_t: 41
+        }
+        enumerator: "FUEL_TANK_LEVEL_INPUT"
+        scalar_value: {
+            int32_t: 42
+        }
+        enumerator: "EVAPORATION_SYSTEM_VAPOR_PRESSURE"
+        scalar_value: {
+            int32_t: 43
+        }
+        enumerator: "CATALYST_TEMPERATURE_BANK1_SENSOR1"
+        scalar_value: {
+            int32_t: 44
+        }
+        enumerator: "CATALYST_TEMPERATURE_BANK2_SENSOR1"
+        scalar_value: {
+            int32_t: 45
+        }
+        enumerator: "CATALYST_TEMPERATURE_BANK1_SENSOR2"
+        scalar_value: {
+            int32_t: 46
+        }
+        enumerator: "CATALYST_TEMPERATURE_BANK2_SENSOR2"
+        scalar_value: {
+            int32_t: 47
+        }
+        enumerator: "ABSOLUTE_LOAD_VALUE"
+        scalar_value: {
+            int32_t: 48
+        }
+        enumerator: "FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO"
+        scalar_value: {
+            int32_t: 49
+        }
+        enumerator: "RELATIVE_THROTTLE_POSITION"
+        scalar_value: {
+            int32_t: 50
+        }
+        enumerator: "ABSOLUTE_THROTTLE_POSITION_B"
+        scalar_value: {
+            int32_t: 51
+        }
+        enumerator: "ABSOLUTE_THROTTLE_POSITION_C"
+        scalar_value: {
+            int32_t: 52
+        }
+        enumerator: "ACCELERATOR_PEDAL_POSITION_D"
+        scalar_value: {
+            int32_t: 53
+        }
+        enumerator: "ACCELERATOR_PEDAL_POSITION_E"
+        scalar_value: {
+            int32_t: 54
+        }
+        enumerator: "ACCELERATOR_PEDAL_POSITION_F"
+        scalar_value: {
+            int32_t: 55
+        }
+        enumerator: "COMMANDED_THROTTLE_ACTUATOR"
+        scalar_value: {
+            int32_t: 56
+        }
+        enumerator: "ETHANOL_FUEL_PERCENTAGE"
+        scalar_value: {
+            int32_t: 57
+        }
+        enumerator: "ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE"
+        scalar_value: {
+            int32_t: 58
+        }
+        enumerator: "SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1"
+        scalar_value: {
+            int32_t: 59
+        }
+        enumerator: "SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2"
+        scalar_value: {
+            int32_t: 60
+        }
+        enumerator: "SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3"
+        scalar_value: {
+            int32_t: 61
+        }
+        enumerator: "SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4"
+        scalar_value: {
+            int32_t: 62
+        }
+        enumerator: "LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1"
+        scalar_value: {
+            int32_t: 63
+        }
+        enumerator: "LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2"
+        scalar_value: {
+            int32_t: 64
+        }
+        enumerator: "LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3"
+        scalar_value: {
+            int32_t: 65
+        }
+        enumerator: "LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4"
+        scalar_value: {
+            int32_t: 66
+        }
+        enumerator: "RELATIVE_ACCELERATOR_PEDAL_POSITION"
+        scalar_value: {
+            int32_t: 67
+        }
+        enumerator: "HYBRID_BATTERY_PACK_REMAINING_LIFE"
+        scalar_value: {
+            int32_t: 68
+        }
+        enumerator: "FUEL_INJECTION_TIMING"
+        scalar_value: {
+            int32_t: 69
+        }
+        enumerator: "ENGINE_FUEL_RATE"
+        scalar_value: {
+            int32_t: 70
+        }
+        enumerator: "LAST_SYSTEM_INDEX"
+        scalar_value: {
+            int32_t: 70
+        }
+        enumerator: "VENDOR_START_INDEX"
+        scalar_value: {
+            int32_t: 71
+        }
+    }
+}
+
diff --git a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host/VibratorHidlTest.py b/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host/VibratorHidlTest.py
index b36f47a..da70474 100644
--- a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host/VibratorHidlTest.py
+++ b/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host/VibratorHidlTest.py
@@ -44,12 +44,12 @@
 
         self.dut.hal.InitHidlHal(
             target_type="vibrator",
-            target_basepaths=["/system/lib64"],
+            target_basepaths=self.dut.libPaths,
             target_version=1.0,
             target_package="android.hardware.vibrator",
             target_component_name="IVibrator",
             hw_binder_service_name="vibrator",
-            bits=64)
+            bits=64 if self.dut.is64Bit else 32)
 
     def tearDownClass(self):
         """ If profiling is enabled for the test, collect the profiling data
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.cpp b/wifi/1.0/default/wifi.cpp
index 332363d..c06abe8 100644
--- a/wifi/1.0/default/wifi.cpp
+++ b/wifi/1.0/default/wifi.cpp
@@ -103,18 +103,18 @@
     chip_ = new WifiChip(kChipId, legacy_hal_, mode_controller_);
     run_state_ = RunState::STARTED;
     for (const auto& callback : event_callbacks_) {
-      if (!callback->onStart().getStatus().isOk()) {
+      if (!callback->onStart().isOk()) {
         LOG(ERROR) << "Failed to invoke onStart callback";
       };
     }
     for (const auto& callback : event_callbacks_) {
-      if (!callback->onFailure(wifi_status).getStatus().isOk()) {
+      if (!callback->onFailure(wifi_status).isOk()) {
         LOG(ERROR) << "Failed to invoke onFailure callback";
       }
     }
   } else {
     for (const auto& callback : event_callbacks_) {
-      if (!callback->onFailure(wifi_status).getStatus().isOk()) {
+      if (!callback->onFailure(wifi_status).isOk()) {
         LOG(ERROR) << "Failed to invoke onFailure callback";
       }
     }
@@ -132,13 +132,13 @@
   WifiStatus wifi_status = stopLegacyHalAndDeinitializeModeController();
   if (wifi_status.code == WifiStatusCode::SUCCESS) {
     for (const auto& callback : event_callbacks_) {
-      if (!callback->onStop().getStatus().isOk()) {
+      if (!callback->onStop().isOk()) {
         LOG(ERROR) << "Failed to invoke onStop callback";
       };
     }
   } else {
     for (const auto& callback : event_callbacks_) {
-      if (!callback->onFailure(wifi_status).getStatus().isOk()) {
+      if (!callback->onFailure(wifi_status).isOk()) {
         LOG(ERROR) << "Failed to invoke onFailure callback";
       }
     }
diff --git a/wifi/1.0/default/wifi_nan_iface.cpp b/wifi/1.0/default/wifi_nan_iface.cpp
index a897520..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).getStatus().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;
 };
 
 /**