Merge "Revert "Weaver HAL""
diff --git a/bluetooth/1.0/default/android.hardware.bluetooth@1.0-service.rc b/bluetooth/1.0/default/android.hardware.bluetooth@1.0-service.rc
index 8545d2f..0f76c39 100644
--- a/bluetooth/1.0/default/android.hardware.bluetooth@1.0-service.rc
+++ b/bluetooth/1.0/default/android.hardware.bluetooth@1.0-service.rc
@@ -2,3 +2,4 @@
     class hal
     user bluetooth
     group bluetooth
+    writepid /dev/stune/foreground/tasks
diff --git a/configstore/utils/Android.bp b/configstore/utils/Android.bp
index aa420d1..2c8aad6 100644
--- a/configstore/utils/Android.bp
+++ b/configstore/utils/Android.bp
@@ -14,14 +14,22 @@
 // limitations under the License.
 //
 
-cc_library_headers {
+cc_library_shared {
     name: "android.hardware.configstore-utils",
     defaults: ["hidl_defaults"],
+
+    srcs: [ "ConfigStoreUtils.cpp" ],
+
     export_include_dirs: ["include"],
+
     shared_libs: [
+        "android.hardware.configstore@1.0",
+        "libbase",
         "libhidlbase"
     ],
     export_shared_lib_headers: [
+        "android.hardware.configstore@1.0",
+        "libbase",
         "libhidlbase"
     ],
 }
diff --git a/configstore/utils/ConfigStoreUtils.cpp b/configstore/utils/ConfigStoreUtils.cpp
new file mode 100644
index 0000000..5a1fb42
--- /dev/null
+++ b/configstore/utils/ConfigStoreUtils.cpp
@@ -0,0 +1,40 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#define LOG_TAG "ConfigStore"
+
+#include <android-base/logging.h>
+#include <configstore/Utils.h>
+
+namespace android {
+namespace hardware {
+namespace details {
+
+bool wouldLogInfo() {
+    return WOULD_LOG(INFO);
+}
+
+void logAlwaysInfo(const std::string& message) {
+    LOG(INFO) << message;
+}
+
+void logAlwaysError(const std::string& message) {
+    LOG(ERROR) << message;
+}
+
+}  // namespace details
+}  // namespace hardware
+}  // namespace android
diff --git a/configstore/utils/include/configstore/Utils.h b/configstore/utils/include/configstore/Utils.h
index 98ccae9..b054534 100644
--- a/configstore/utils/include/configstore/Utils.h
+++ b/configstore/utils/include/configstore/Utils.h
@@ -17,20 +17,31 @@
 #ifndef ANDROID_HARDWARE_CONFIGSTORE_UTILS_H
 #define ANDROID_HARDWARE_CONFIGSTORE_UTILS_H
 
+#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
 #include <hidl/Status.h>
-#include <stdatomic.h>
+
+#include <sstream>
 
 namespace android {
 namespace hardware {
+
+namespace details {
+// Templated classes can use the below method
+// to avoid creating dependencies on liblog.
+bool wouldLogInfo();
+void logAlwaysInfo(const std::string& message);
+void logAlwaysError(const std::string& message);
+}  // namespace details
+
 namespace configstore {
+using namespace android::hardware::configstore::V1_0;
 // arguments V: type for the value (i.e., OptionalXXX)
 //           I: interface class name
 //           func: member function pointer
-using namespace V1_0;
-
 template<typename V, typename I, android::hardware::Return<void> (I::* func)
         (std::function<void(const V&)>)>
 decltype(V::value) get(const decltype(V::value) &defValue) {
+    using namespace android::hardware::details;
     auto getHelper = []()->V {
         V ret;
         sp<I> configs = I::getService();
@@ -39,15 +50,39 @@
             // fallback to the default value
             ret.specified = false;
         } else {
-            (*configs.*func)([&ret](V v) {
-                ret = v;
-            });
+            auto status = (*configs.*func)([&ret](V v) { ret = v; });
+            if (!status.isOk()) {
+                std::ostringstream oss;
+                oss << "HIDL call failed for retrieving a config item from "
+                       "configstore : "
+                    << status.description().c_str();
+                logAlwaysError(oss.str());
+                ret.specified = false;
+            }
         }
 
         return ret;
     };
     static V cachedValue = getHelper();
 
+    if (wouldLogInfo()) {
+        std::string iname = __PRETTY_FUNCTION__;
+        // func name starts with "func = " in __PRETTY_FUNCTION__
+        auto pos = iname.find("func = ");
+        if (pos != std::string::npos) {
+            iname = iname.substr(pos + sizeof("func = "));
+            iname.pop_back();  // remove trailing ']'
+        } else {
+            iname += " (unknown)";
+        }
+
+        std::ostringstream oss;
+        oss << iname << " retrieved: "
+            << (cachedValue.specified ? cachedValue.value : defValue)
+            << (cachedValue.specified ? "" : " (default)");
+        logAlwaysInfo(oss.str());
+    }
+
     return cachedValue.specified ? cachedValue.value : defValue;
 }
 
diff --git a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
index 9da58e2..cf9f66e 100644
--- a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
+++ b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
@@ -337,17 +337,16 @@
 TEST_F(NfcHidlTest, CoreInitialized) {
   NfcData data;
   data.resize(1);
-  NfcEvent last_event_;
-  for (int i = 0; i <= 6; i++) {
+  // These parameters might lead to device specific proprietary behavior
+  // Using > 10 values should result in predictable and common results for
+  // most devices.
+  for (int i = 10; i <= 16; i++) {
       data[0] = i;
       EXPECT_EQ(NfcStatus::OK, nfc_->coreInitialized(data));
       // Wait for NfcEvent.POST_INIT_CPLT
-      auto res = nfc_cb_->WaitForCallbackAny();
-      if (res.name.compare(kCallbackNameSendEvent) == 0) {
-          last_event_ = res.args->last_event_;
-      }
+      auto res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
       EXPECT_TRUE(res.no_timeout);
-      EXPECT_EQ(NfcEvent::POST_INIT_CPLT, last_event_);
+      EXPECT_EQ(NfcEvent::POST_INIT_CPLT, res.args->last_event_);
   }
 }
 
diff --git a/renderscript/1.0/vts/functional/VtsCopyTests.cpp b/renderscript/1.0/vts/functional/VtsCopyTests.cpp
index 168e681..f47253f 100644
--- a/renderscript/1.0/vts/functional/VtsCopyTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsCopyTests.cpp
@@ -30,12 +30,18 @@
 TEST_F(RenderscriptHidlTest, Simple1DCopyTest) {
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 128 x float1
     Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     // 128 x float1
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     std::vector<float> dataIn(128), dataOut(128);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
     hidl_vec<uint8_t> _data;
@@ -60,12 +66,18 @@
 TEST_F(RenderscriptHidlTest, Simple2DCopyTest) {
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 128 x 128 x float1
     Type type = context->typeCreate(element, 128, 128, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     // 128 x 128 x float1
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     std::vector<float> dataIn(128*128), dataOut(128*128);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
     hidl_vec<uint8_t> _data;
@@ -91,12 +103,18 @@
 TEST_F(RenderscriptHidlTest, Simple3DCopyTest) {
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 32 x 32 x 32 x float1
     Type type = context->typeCreate(element, 32, 32, 32, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     // 32 x 32 x 32 x float1
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     std::vector<float> dataIn(32*32*32), dataOut(32*32*32);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
     hidl_vec<uint8_t> _data;
@@ -122,8 +140,12 @@
 TEST_F(RenderscriptHidlTest, SimpleBitmapTest) {
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 512 x 512 x float1
     Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     std::vector<float> dataIn(512*512), dataOut1(512*512), dataOut2(512*512);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
     hidl_vec<uint8_t> _data;
@@ -133,7 +155,7 @@
                                                                 AllocationMipmapControl::NONE,
                                                                 _data,
                                                                 (int)AllocationUsageType::SCRIPT);
-    EXPECT_NE(Allocation(0), allocation);
+    ASSERT_NE(Allocation(0), allocation);
 
     context->allocationCopyToBitmap(allocation, (Ptr)dataOut1.data(),
                                     (Size)dataOut1.size()*sizeof(float));
@@ -158,10 +180,16 @@
 TEST_F(RenderscriptHidlTest, AllocationCopy2DRangeTest) {
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 512 x 512 x float1
     Type typeSrc = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), typeSrc);
+
     // 256 x 256 x float1
     Type typeDst = context->typeCreate(element, 256, 256, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), typeDst);
+
     std::vector<float> dataIn(512*512), dataOut(256*256), expected(256*256);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
     hidl_vec<uint8_t> _data;
@@ -170,10 +198,14 @@
     Allocation allocSrc = context->allocationCreateFromBitmap(typeSrc,
                                                               AllocationMipmapControl::NONE, _data,
                                                               (int)AllocationUsageType::SCRIPT);
+    ASSERT_NE(Allocation(0), allocSrc);
+
     // 256 x 256 x float1
     Allocation allocDst = context->allocationCreateTyped(typeDst, AllocationMipmapControl::NONE,
                                                          (int)AllocationUsageType::SCRIPT,
                                                          (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocDst);
+
     context->allocationCopy2DRange(allocDst, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256, 256,
                                    allocSrc, 128, 128, 0, AllocationCubemapFace::POSITIVE_X);
     context->allocationRead(allocDst, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float));
@@ -200,10 +232,16 @@
 TEST_F(RenderscriptHidlTest, AllocationCopy3DRangeTest) {
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 128 x 128 x 128 x float1
     Type typeSrc = context->typeCreate(element, 128, 128, 128, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), typeSrc);
+
     // 64 x 64 x 64 x float1
     Type typeDst = context->typeCreate(element, 64, 64, 64, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), typeDst);
+
     std::vector<float> dataIn(128*128*128), dataOut(64*64*64), expected(64*64*64);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
     hidl_vec<uint8_t> _data;
@@ -212,10 +250,14 @@
     Allocation allocSrc = context->allocationCreateTyped(typeSrc, AllocationMipmapControl::NONE,
                                                          (int)AllocationUsageType::SCRIPT,
                                                          (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocSrc);
+
     // 256 x 256 x float1
     Allocation allocDst = context->allocationCreateTyped(typeDst, AllocationMipmapControl::NONE,
                                                          (int)AllocationUsageType::SCRIPT,
                                                          (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocDst);
+
     context->allocation3DWrite(allocSrc, 0, 0, 0, 0, 128, 128, 128, _data, 128*sizeof(float));
     context->allocationCopy3DRange(allocDst, 0, 0, 0, 0, 64, 64, 64, allocSrc, 32, 32, 32, 0);
     context->allocationRead(allocDst, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float));
@@ -243,8 +285,12 @@
 TEST_F(RenderscriptHidlTest, SimpleAdapterTest) {
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 512 x 512 x float1
     Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     std::vector<float> dataIn(512*512), dataOut(256*256), expected;
     std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
     hidl_vec<uint8_t> _data;
@@ -254,11 +300,15 @@
                                                                 AllocationMipmapControl::NONE,
                                                                 _data,
                                                                 (int)AllocationUsageType::SCRIPT);
+    ASSERT_NE(Allocation(0), allocation);
+
     // 256 x 256 x float1
     Type subType = context->typeCreate(element, 256, 256, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), subType);
+
     // 256 x 256 x float1
     AllocationAdapter allocationAdapter = context->allocationAdapterCreate(subType, allocation);
-    EXPECT_NE(AllocationAdapter(0), allocationAdapter);
+    ASSERT_NE(AllocationAdapter(0), allocationAdapter);
 
     std::vector<uint32_t> offsets(9, 0);
     offsets[0] = 128;
@@ -292,8 +342,12 @@
 TEST_F(RenderscriptHidlTest, SimpleMipmapTest) {
     // uint8_t
     Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 64 x 64 x uint8_t
     Type type = context->typeCreate(element, 64, 64, 0, true, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     std::vector<uint8_t> dataIn(64*64), dataOut(32*32), expected(32*32);
     std::generate(dataIn.begin(), dataIn.end(),
                   [](){ static int val = 0; return (uint8_t)(0xFF & val++); });
@@ -303,6 +357,8 @@
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::FULL,
                                                          (int)AllocationUsageType::SCRIPT,
                                                          (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     context->allocation2DWrite(allocation, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 64, 64,
                                _data, 64*sizeof(uint8_t));
     context->allocationGenerateMipmaps(allocation);
@@ -333,8 +389,12 @@
 TEST_F(RenderscriptHidlTest, SimpleCubemapTest) {
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 128 x 128 x float1
     Type type = context->typeCreate(element, 128, 128, 0, false, true, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     std::vector<float> dataIn(128*128*6), dataOut(128*128), expected(128*128);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
     hidl_vec<uint8_t> _data;
@@ -342,7 +402,7 @@
     // 128 x 128 x float1 x 6
     Allocation allocation = context->allocationCubeCreateFromBitmap(
         type, AllocationMipmapControl::NONE, _data, (int)AllocationUsageType::SCRIPT);
-    EXPECT_NE(Allocation(0), allocation);
+    ASSERT_NE(Allocation(0), allocation);
 
     context->allocation2DRead(allocation, 0, 0, 0, AllocationCubemapFace::NEGATIVE_Z, 128,
                               128, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float),
@@ -367,13 +427,16 @@
  */
 TEST_F(RenderscriptHidlTest, ComplexElementTest) {
     Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element1);
+
     Element element2 = context->elementCreate(DataType::UNSIGNED_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element2);
 
     hidl_vec<Element> eins = {element1, element2};
     hidl_vec<hidl_string> names = {hidl_string("first"), hidl_string("second")};
     hidl_vec<Size> arraySizesPtr = {1, 1};
     Element element3 = context->elementComplexCreate(eins, names, arraySizesPtr);
-    EXPECT_NE(Element(0), element3);
+    ASSERT_NE(Element(0), element3);
 
     std::vector<Element> ids;
     std::vector<std::string> namesOut;
@@ -395,10 +458,14 @@
 
     // 1 x (uint8_t, uint32_t)
     Type type = context->typeCreate(element3, 1, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     // 1 x (uint8_t, uint32_t)
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     std::vector<uint32_t> dataIn(1), dataOut(1);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; });
     hidl_vec<uint8_t> _data;
diff --git a/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp b/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
index 39d63ca..23b09ac 100644
--- a/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
@@ -46,18 +46,18 @@
 TEST_F(RenderscriptHidlTest, ElementTypeAllocationCreate) {
     // Element create test
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
-    EXPECT_NE(Element(0), element);
+    ASSERT_NE(Element(0), element);
 
     // Type create test
     Type type = context->typeCreate(element, 1, 0, 0, false, false, YuvFormat::YUV_NONE);
-    EXPECT_NE(Type(0), type);
+    ASSERT_NE(Type(0), type);
 
     // Allocation create test
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)((uint32_t)AllocationUsageType::ALL
                                                            & ~(uint32_t)AllocationUsageType::OEM),
                                                            (Ptr)nullptr);
-    EXPECT_NE(Allocation(0), allocation);
+    ASSERT_NE(Allocation(0), allocation);
 
     // Allocation type test
     Type type2 = context->allocationGetType(allocation);
@@ -74,8 +74,11 @@
 TEST_F(RenderscriptHidlTest, MetadataTest) {
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 128 x float1
     Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
 
     std::vector<uint32_t> elementMetadata(5);
     context->elementGetNativeMetadata(element, [&](const hidl_vec<uint32_t>& _metadata){
@@ -107,24 +110,30 @@
 TEST_F(RenderscriptHidlTest, ResizeTest) {
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 128 x float1
     Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     // 128 x float1
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     Ptr dataPtr1, dataPtr2;
     Size stride;
     context->allocationGetPointer(allocation, 0, AllocationCubemapFace::POSITIVE_X, 0,
                                   [&](Ptr _dataPtr, Size _stride){
                                       dataPtr1 = _dataPtr; stride = _stride; });
-    EXPECT_EQ(0ul, stride);
+    EXPECT_EQ(Size(0), stride);
 
     context->allocationResize1D(allocation, 1024*1024);
     context->allocationGetPointer(allocation, 0, AllocationCubemapFace::POSITIVE_X, 0,
                                   [&](Ptr _dataPtr, Size _stride){
                                       dataPtr2 = _dataPtr; stride = _stride; });
-    EXPECT_EQ(0ul, stride);
+    EXPECT_EQ(Size(0), stride);
     EXPECT_NE(dataPtr1, dataPtr2);
 }
 
@@ -139,8 +148,12 @@
 TEST_F(RenderscriptHidlTest, NativeWindowIoTest) {
     // uint8x4
     Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4);
+    ASSERT_NE(Element(0), element);
+
     // 512 x 512 x uint8x4
     Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     std::vector<uint32_t> dataIn(512*512), dataOut(512*512);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; });
     hidl_vec<uint8_t> _data;
@@ -150,12 +163,16 @@
                                                                (int)(AllocationUsageType::SCRIPT
                                                                | AllocationUsageType::IO_INPUT),
                                                                (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocationRecv);
+
     Allocation allocationSend = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                                (int)(AllocationUsageType::SCRIPT
                                                                | AllocationUsageType::IO_OUTPUT),
                                                                (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocationSend);
+
     NativeWindow nativeWindow = context->allocationGetNativeWindow(allocationRecv);
-    EXPECT_NE(NativeWindow(0), nativeWindow);
+    ASSERT_NE(NativeWindow(0), nativeWindow);
 
     ((ANativeWindow *)nativeWindow)->incStrong(nullptr);
 
@@ -174,14 +191,20 @@
  * two allocations with IO_INPUT are made to share the same BufferQueue.
  *
  * Calls: elementCreate, typeCreate, allocationCreateTyped,
- * allocationCreateFromBitmap, allocationSetupBufferQueue,
- * allocationShareBufferQueue
+ * allocationSetupBufferQueue, allocationShareBufferQueue,
+ * allocationGetNativeWindow, allocationSetNativeWindow,
+ * allocation2DWrite, allocation2DRead, allocationIoSend,
+ * allocationIoReceive
  */
 TEST_F(RenderscriptHidlTest, BufferQueueTest) {
     // uint8x4
     Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4);
+    ASSERT_NE(Element(0), element);
+
     // 512 x 512 x uint8x4
     Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     std::vector<uint32_t> dataIn(512*512), dataOut1(512*512), dataOut2(512*512);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; });
     hidl_vec<uint8_t> _data;
@@ -191,20 +214,28 @@
                                                                 (int)(AllocationUsageType::SCRIPT
                                                                 | AllocationUsageType::IO_INPUT),
                                                                 (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocationRecv1);
+
     Allocation allocationRecv2 = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                                 (int)(AllocationUsageType::SCRIPT
                                                                 | AllocationUsageType::IO_INPUT),
                                                                 (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocationRecv2);
+
     Allocation allocationSend  = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                                 (int)(AllocationUsageType::SCRIPT
                                                                 | AllocationUsageType::IO_INPUT),
                                                                 (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocationSend);
+
     context->allocationSetupBufferQueue(allocationRecv1, 2);
     context->allocationShareBufferQueue(allocationRecv2, allocationRecv1);
 
     NativeWindow nativeWindow1 = context->allocationGetNativeWindow(allocationRecv1);
-    EXPECT_NE(NativeWindow(0), nativeWindow1);
+    ASSERT_NE(NativeWindow(0), nativeWindow1);
+
     NativeWindow nativeWindow2 = context->allocationGetNativeWindow(allocationRecv2);
+    ASSERT_NE(NativeWindow(0), nativeWindow2);
     EXPECT_EQ(nativeWindow2, nativeWindow1);
 
     ((ANativeWindow *)nativeWindow1)->incStrong(nullptr);
@@ -269,6 +300,8 @@
     context->contextSetCacheDir("/data/local/tmp/temp/");
 
     Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     std::string nameIn = "element_test_name";
     std::string nameOut = "not_name";
     hidl_string _nameIn;
diff --git a/renderscript/1.0/vts/functional/VtsScriptTests.cpp b/renderscript/1.0/vts/functional/VtsScriptTests.cpp
index 6bb375a..fed7c6e 100644
--- a/renderscript/1.0/vts/functional/VtsScriptTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsScriptTests.cpp
@@ -25,6 +25,8 @@
 TEST_F(RenderscriptHidlTest, IntrinsicTest) {
     // uint8
     Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+    EXPECT_NE(Element(0), element);
+
     Script script = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_BLUR, element);
     EXPECT_NE(Script(0), script);
 
@@ -43,7 +45,7 @@
     hidl_vec<uint8_t> bitcode;
     bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
     Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
-    EXPECT_NE(Script(0), script);
+    ASSERT_NE(Script(0), script);
 
     // arg tests
     context->scriptSetVarI(script, mExportVarIdx_var_int, 100);
@@ -75,12 +77,18 @@
 
     // float1
     Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 128 x float1
     Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     // 128 x float1
     Allocation allocationIn = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                              (int)AllocationUsageType::SCRIPT,
                                                              (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocationIn);
+
     Allocation allocationOut = Allocation(0);
     context->scriptSetVarObj(script, mExportVarIdx_var_allocation, (ObjectBase)allocationIn);
     context->scriptGetVarV(script, mExportVarIdx_var_allocation, sizeof(ObjectBase),
@@ -107,6 +115,8 @@
     _dimsVE.setToExternal((uint32_t*)dimsVE.data(), dimsVE.size());
     // intx2 to represent point2 which is {int, int}
     Element elementVE = context->elementCreate(DataType::SIGNED_32, DataKind::USER, false, 2);
+    ASSERT_NE(Element(0), elementVE);
+
     context->scriptSetVarVE(script, mExportVarIdx_var_point2, _dataVE, elementVE, _dimsVE);
     context->scriptGetVarV(script, mExportVarIdx_var_point2, 2*sizeof(int),
                            [&](const hidl_vec<uint8_t>& _data){
@@ -126,7 +136,7 @@
     hidl_vec<uint8_t> bitcode;
     bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
     Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
-    EXPECT_NE(Script(0), script);
+    ASSERT_NE(Script(0), script);
 
     // invoke test
     int resultI = 0;
@@ -185,12 +195,16 @@
     hidl_vec<uint8_t> bitcode;
     bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
     Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
-    EXPECT_NE(Script(0), script);
+    ASSERT_NE(Script(0), script);
 
     // uint8_t
     Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 64 x uint8_t
     Type type = context->typeCreate(element, 64, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     std::vector<uint8_t> dataIn(64), dataOut(64), expected(64);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static uint8_t val = 0; return val++; });
     std::generate(expected.begin(), expected.end(), [](){ static uint8_t val = 1; return val++; });
@@ -200,9 +214,13 @@
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     Allocation vout = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                      (int)AllocationUsageType::SCRIPT,
                                                      (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), vout);
+
     context->allocation1DWrite(allocation, 0, 0, (Size)dataIn.size(), _data);
     hidl_vec<Allocation> vains;
     vains.setToExternal(&allocation, 1);
@@ -223,13 +241,19 @@
     hidl_vec<uint8_t> bitcode;
     bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
     Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
-    EXPECT_NE(Script(0), script);
+    ASSERT_NE(Script(0), script);
 
     // uint8_t
     Element element = context->elementCreate(DataType::SIGNED_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 64 x uint8_t
     Type type = context->typeCreate(element, 64, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     Type type2 = context->typeCreate(element, 1, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type2);
+
     std::vector<int> dataIn(64), dataOut(1);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return val++; });
     hidl_vec<uint8_t> _data;
@@ -238,9 +262,13 @@
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     Allocation vaout = context->allocationCreateTyped(type2, AllocationMipmapControl::NONE,
                                                       (int)AllocationUsageType::SCRIPT,
                                                       (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), vaout);
+
     context->allocation1DWrite(allocation, 0, 0, (Size)dataIn.size(), _data);
     hidl_vec<Allocation> vains;
     vains.setToExternal(&allocation, 1);
@@ -257,22 +285,29 @@
  * RenderScript script, represented in the bitcode.
  *
  * Calls: scriptCCreate, elementCreate, typeCreate, allocationCreateTyped,
- * scriptSetVarV, scriptBindAllocation, allocationRead
+ * allocation1DWrite, scriptBindAllocation, scriptSetVarV, scriptBindAllocation,
+ * allocationRead, scriptInvokeV, allocationRead
  */
 TEST_F(RenderscriptHidlTest, ScriptBindTest) {
     hidl_vec<uint8_t> bitcode;
     bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
     Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
-    EXPECT_NE(Script(0), script);
+    ASSERT_NE(Script(0), script);
 
     // in32
     Element element = context->elementCreate(DataType::SIGNED_32, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     // 64 x int32
     Type type = context->typeCreate(element, 64, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     // 64 x int32
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     std::vector<int> dataIn(64), dataOut(64), expected(64, 5);
     hidl_vec<uint8_t> _data;
     _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(int));
@@ -295,7 +330,8 @@
  *
  * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation2DWrite,
  * scriptIntrinsicCreate, scriptKernelIDCreate, scriptFieldIDCreate,
- * scriptGroupCreate, scriptGroupSetOutput, scriptGroupExecute, allocation2DRead
+ * scriptGroupCreate, scriptSetVarObj, scriptGroupSetOutput, scriptGroupExecute,
+ * contextFinish, allocation2DRead
  */
 TEST_F(RenderscriptHidlTest, ScriptGroupTest) {
     std::vector<uint8_t> dataIn(256*256*1, 128), dataOut(256*256*4, 0), zeros(256*256*4, 0);
@@ -305,36 +341,49 @@
 
     // 256 x 256 YUV pixels
     Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::PIXEL_YUV, true, 1);
+    ASSERT_NE(Element(0), element1);
+
     Type type1 = context->typeCreate(element1, 256, 256, 0, false, false, YuvFormat::YUV_420_888);
+    ASSERT_NE(Type(0), type1);
+
     Allocation allocation1 = context->allocationCreateTyped(type1, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation1);
+
     context->allocation2DWrite(allocation1, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256, 256,
                                _dataIn, 0);
 
     // 256 x 256 RGBA pixels
     Element element2 = context->elementCreate(DataType::UNSIGNED_8, DataKind::PIXEL_RGBA, true, 4);
+    ASSERT_NE(Element(0), element2);
+
     Type type2 = context->typeCreate(element2, 256, 256, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type2);
+
     Allocation allocation2 = context->allocationCreateTyped(type2, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation2);
+
     context->allocation2DWrite(allocation2, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256, 256,
                                _dataOut, 0);
 
     // create scripts
     Script yuv2rgb = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_YUV_TO_RGB, element1);
-    EXPECT_NE(Script(0), yuv2rgb);
+    ASSERT_NE(Script(0), yuv2rgb);
 
     ScriptKernelID yuv2rgbKID = context->scriptKernelIDCreate(yuv2rgb, 0, 2);
-    EXPECT_NE(ScriptKernelID(0), yuv2rgbKID);
+    ASSERT_NE(ScriptKernelID(0), yuv2rgbKID);
 
     Script blur = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_BLUR, element2);
-    EXPECT_NE(Script(0), blur);
+    ASSERT_NE(Script(0), blur);
 
     ScriptKernelID blurKID = context->scriptKernelIDCreate(blur, 0, 2);
-    EXPECT_NE(ScriptKernelID(0), blurKID);
+    ASSERT_NE(ScriptKernelID(0), blurKID);
+
     ScriptFieldID blurFID = context->scriptFieldIDCreate(blur, 1);
-    EXPECT_NE(ScriptFieldID(0), blurFID);
+    ASSERT_NE(ScriptFieldID(0), blurFID);
 
     // ScriptGroup
     hidl_vec<ScriptKernelID> kernels = {yuv2rgbKID, blurKID};
@@ -343,7 +392,7 @@
     hidl_vec<ScriptFieldID> dstF = {blurFID};
     hidl_vec<Type> types = {type2};
     ScriptGroup scriptGroup = context->scriptGroupCreate(kernels, srcK, dstK, dstF, types);
-    EXPECT_NE(ScriptGroup(0), scriptGroup);
+    ASSERT_NE(ScriptGroup(0), scriptGroup);
 
     context->scriptSetVarObj(yuv2rgb, 0, (ObjectBase)allocation1);
     context->scriptGroupSetOutput(scriptGroup, blurKID, allocation2);
@@ -360,14 +409,16 @@
  * Similar to the ScriptGroup test, this test verifies the execution flow of
  * RenderScript kernels and invokables.
  *
- * Calls: scriptFieldIDCreate, closureCreate, scriptInvokeIDCreate,
- * invokeClosureCreate, closureSetGlobal, scriptGroup2Create, scriptGroupExecute
+ * Calls: scriptCCreate, elementCreate, typeCreate, allocationCreateTyped,
+ * allocation1DWrite, scriptFieldIDCreate, scriptInvokeIDCreate,
+ * invokeClosureCreate, closureCreate, closureSetGlobal, scriptGroup2Create,
+ * scriptGroupExecute, allocationRead
  */
 TEST_F(RenderscriptHidlTest, ScriptGroup2Test) {
     hidl_vec<uint8_t> bitcode;
     bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
     Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
-    EXPECT_NE(Script(0), script);
+    ASSERT_NE(Script(0), script);
 
     std::vector<uint8_t> dataIn(128, 128), dataOut(128, 0), expected(128, 7+1);
     hidl_vec<uint8_t> _dataIn, _dataOut;
@@ -375,19 +426,23 @@
 
     // 256 x 256 YUV pixels
     Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     context->allocation1DWrite(allocation, 0, 0, (Size)_dataIn.size(), _dataIn);
 
     ScriptFieldID fieldID = context->scriptFieldIDCreate(script, mExportVarIdx_var_allocation);
-    EXPECT_NE(ScriptFieldID(0), fieldID);
     ASSERT_NE(ScriptFieldID(0), fieldID);
 
     // invoke
     ScriptInvokeID invokeID = context->scriptInvokeIDCreate(script, mExportFuncIdx_setAllocation);
-    EXPECT_NE(ScriptInvokeID(0), invokeID);
     ASSERT_NE(ScriptInvokeID(0), invokeID);
 
     int dim = 128;
@@ -397,12 +452,10 @@
     hidl_vec<int64_t> values1 = {int64_t(0)};
     hidl_vec<int32_t> sizes1 = {int32_t(0)};
     Closure closure1 = context->invokeClosureCreate(invokeID, params, fieldIDS1, values1, sizes1);
-    EXPECT_NE(Closure(0), closure1);
     ASSERT_NE(Closure(0), closure1);
 
     // kernel
     ScriptKernelID kernelID = context->scriptKernelIDCreate(script, mExportForEachIdx_increment, 3);
-    EXPECT_NE(ScriptKernelID(0), kernelID);
     ASSERT_NE(ScriptKernelID(0), kernelID);
 
     hidl_vec<ScriptFieldID> fieldIDS2 = {ScriptFieldID(0)};
@@ -412,7 +465,6 @@
     hidl_vec<ScriptFieldID> depFieldIDS2 = {fieldID};
     Closure closure2 = context->closureCreate(kernelID, allocation /* returnValue */, fieldIDS2,
                                               values2, sizes2, depClosures2, depFieldIDS2);
-    EXPECT_NE(Closure(0), closure2);
     ASSERT_NE(Closure(0), closure2);
 
     // set argument
@@ -424,7 +476,6 @@
     hidl_string cacheDir = "/data/local/tmp";
     hidl_vec<Closure> closures = {closure1, closure2};
     ScriptGroup2 scriptGroup2 = context->scriptGroup2Create(name, cacheDir, closures);
-    EXPECT_NE(ScriptGroup2(0), scriptGroup2);
     ASSERT_NE(ScriptGroup2(0), scriptGroup2);
 
     context->scriptGroupExecute(scriptGroup2);
@@ -436,14 +487,15 @@
  * Similar to the ScriptGroup test, this test verifies a single kernel can be
  * called by ScriptGroup with an unbound allocation specified before launch
  *
- * Calls: scriptFieldIDCreate, closureCreate, scriptInvokeIDCreate,
- * invokeClosureCreate, closureSetArg, scriptGroup2Create, scriptGroupExecute
+ * Calls: scriptCCreate, elementCreate, typeCreate, allocationCreateTyped,
+ * allocation1DWrite, scriptKernelIDCreate, closureCreate, closureSetArg,
+ * scriptGroup2Create, scriptGroupExecute, allocationRead
  */
 TEST_F(RenderscriptHidlTest, ScriptGroup2KernelTest) {
     hidl_vec<uint8_t> bitcode;
     bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
     Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
-    EXPECT_NE(Script(0), script);
+    ASSERT_NE(Script(0), script);
 
     std::vector<uint8_t> dataIn(128, 128), dataOut(128, 0), expected(128, 128 + 1);
     hidl_vec<uint8_t> _dataIn, _dataOut;
@@ -451,15 +503,20 @@
 
     // 256 x 256 YUV pixels
     Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+    ASSERT_NE(Element(0), element);
+
     Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+    ASSERT_NE(Type(0), type);
+
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
+    ASSERT_NE(Allocation(0), allocation);
+
     context->allocation1DWrite(allocation, 0, 0, (Size)_dataIn.size(), _dataIn);
 
     // kernel
     ScriptKernelID kernelID = context->scriptKernelIDCreate(script, mExportForEachIdx_increment, 3);
-    EXPECT_NE(ScriptKernelID(0), kernelID);
     ASSERT_NE(ScriptKernelID(0), kernelID);
 
     hidl_vec<ScriptFieldID> fieldIDS = {ScriptFieldID(0)};
@@ -469,7 +526,6 @@
     hidl_vec<ScriptFieldID> depFieldIDS = {ScriptFieldID(0)};
     Closure closure = context->closureCreate(kernelID, allocation /* returnValue */, fieldIDS,
                                               values, sizes, depClosures, depFieldIDS);
-    EXPECT_NE(Closure(0), closure);
     ASSERT_NE(Closure(0), closure);
 
     // set argument
@@ -480,7 +536,6 @@
     hidl_string cacheDir = "/data/local/tmp";
     hidl_vec<Closure> closures = {closure};
     ScriptGroup2 scriptGroup2 = context->scriptGroup2Create(name, cacheDir, closures);
-    EXPECT_NE(ScriptGroup2(0), scriptGroup2);
     ASSERT_NE(ScriptGroup2(0), scriptGroup2);
 
     context->scriptGroupExecute(scriptGroup2);
diff --git a/tests/Android.bp b/tests/Android.bp
index 4467994..7276a0b 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -8,6 +8,8 @@
     "foo/1.0",
     "foo/1.0/default",
     "foo/1.0/default/lib",
+    "hash/1.0",
+    "hash/1.0/default",
     "inheritance/1.0",
     "inheritance/1.0/default",
     "libhwbinder/1.0",
diff --git a/tests/baz/1.0/Android.bp b/tests/baz/1.0/Android.bp
index 8f327e3..1d5013b 100644
--- a/tests/baz/1.0/Android.bp
+++ b/tests/baz/1.0/Android.bp
@@ -7,6 +7,7 @@
         "IBase.hal",
         "IBaz.hal",
         "IBazCallback.hal",
+        "IQuux.hal",
     ],
 }
 
@@ -22,6 +23,7 @@
         "android/hardware/tests/baz/1.0/BaseAll.cpp",
         "android/hardware/tests/baz/1.0/BazAll.cpp",
         "android/hardware/tests/baz/1.0/BazCallbackAll.cpp",
+        "android/hardware/tests/baz/1.0/QuuxAll.cpp",
     ],
 }
 
@@ -50,6 +52,11 @@
         "android/hardware/tests/baz/1.0/BnHwBazCallback.h",
         "android/hardware/tests/baz/1.0/BpHwBazCallback.h",
         "android/hardware/tests/baz/1.0/BsBazCallback.h",
+        "android/hardware/tests/baz/1.0/IQuux.h",
+        "android/hardware/tests/baz/1.0/IHwQuux.h",
+        "android/hardware/tests/baz/1.0/BnHwQuux.h",
+        "android/hardware/tests/baz/1.0/BpHwQuux.h",
+        "android/hardware/tests/baz/1.0/BsQuux.h",
     ],
 }
 
diff --git a/tests/baz/1.0/Android.mk b/tests/baz/1.0/Android.mk
index 40026ec..9d4d6b6 100644
--- a/tests/baz/1.0/Android.mk
+++ b/tests/baz/1.0/Android.mk
@@ -76,6 +76,25 @@
 $(GEN): $(LOCAL_PATH)/IBazCallback.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IQuux.hal
+#
+GEN := $(intermediates)/android/hardware/tests/baz/V1_0/IQuux.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IQuux.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.tests.baz@1.0::IQuux
+
+$(GEN): $(LOCAL_PATH)/IQuux.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
 include $(BUILD_JAVA_LIBRARY)
 
 
@@ -153,6 +172,25 @@
 $(GEN): $(LOCAL_PATH)/IBazCallback.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IQuux.hal
+#
+GEN := $(intermediates)/android/hardware/tests/baz/V1_0/IQuux.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IQuux.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.tests.baz@1.0::IQuux
+
+$(GEN): $(LOCAL_PATH)/IQuux.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
 include $(BUILD_STATIC_JAVA_LIBRARY)
 
 
diff --git a/tests/baz/1.0/IQuux.hal b/tests/baz/1.0/IQuux.hal
new file mode 100644
index 0000000..ccf3212
--- /dev/null
+++ b/tests/baz/1.0/IQuux.hal
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.tests.baz@1.0;
+
+interface IQuux {
+};
diff --git a/tests/hash/1.0/Android.bp b/tests/hash/1.0/Android.bp
new file mode 100644
index 0000000..c217e5c
--- /dev/null
+++ b/tests/hash/1.0/Android.bp
@@ -0,0 +1,59 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.tests.hash@1.0_hal",
+    srcs: [
+        "IHash.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tests.hash@1.0_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.hash@1.0",
+    srcs: [
+        ":android.hardware.tests.hash@1.0_hal",
+    ],
+    out: [
+        "android/hardware/tests/hash/1.0/HashAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tests.hash@1.0_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.hash@1.0",
+    srcs: [
+        ":android.hardware.tests.hash@1.0_hal",
+    ],
+    out: [
+        "android/hardware/tests/hash/1.0/IHash.h",
+        "android/hardware/tests/hash/1.0/IHwHash.h",
+        "android/hardware/tests/hash/1.0/BnHwHash.h",
+        "android/hardware/tests/hash/1.0/BpHwHash.h",
+        "android/hardware/tests/hash/1.0/BsHash.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.tests.hash@1.0",
+    generated_sources: ["android.hardware.tests.hash@1.0_genc++"],
+    generated_headers: ["android.hardware.tests.hash@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.tests.hash@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hidl.base@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hidl.base@1.0",
+    ],
+}
diff --git a/tests/hash/1.0/Android.mk b/tests/hash/1.0/Android.mk
new file mode 100644
index 0000000..15428b4
--- /dev/null
+++ b/tests/hash/1.0/Android.mk
@@ -0,0 +1,76 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.tests.hash@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_JAVA_LIBRARIES := \
+    android.hidl.base@1.0-java \
+
+
+#
+# Build IHash.hal
+#
+GEN := $(intermediates)/android/hardware/tests/hash/V1_0/IHash.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IHash.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.tests.hash@1.0::IHash
+
+$(GEN): $(LOCAL_PATH)/IHash.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.tests.hash@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    android.hidl.base@1.0-java-static \
+
+
+#
+# Build IHash.hal
+#
+GEN := $(intermediates)/android/hardware/tests/hash/V1_0/IHash.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IHash.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.tests.hash@1.0::IHash
+
+$(GEN): $(LOCAL_PATH)/IHash.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/hash/1.0/IHash.hal b/tests/hash/1.0/IHash.hal
new file mode 100644
index 0000000..ba48384
--- /dev/null
+++ b/tests/hash/1.0/IHash.hal
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.tests.hash@1.0;
+
+/**
+ * Test interface for hashing HAL files.
+ * This file is FREEZED to ensure its hash doesn't change.
+ */
+interface IHash {
+    /**
+     * Dummy.
+     */
+    dummy();
+    /**
+     * Dummy.
+     */
+    functions();
+};
diff --git a/tests/hash/1.0/default/Android.bp b/tests/hash/1.0/default/Android.bp
new file mode 100644
index 0000000..e798a66
--- /dev/null
+++ b/tests/hash/1.0/default/Android.bp
@@ -0,0 +1,15 @@
+cc_library_shared {
+    name: "android.hardware.tests.hash@1.0-impl",
+    relative_install_path: "hw",
+    proprietary: true,
+    srcs: [
+        "Hash.cpp",
+    ],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libutils",
+        "android.hardware.tests.hash@1.0",
+        "android.hidl.base@1.0",
+    ],
+}
diff --git a/tests/hash/1.0/default/Hash.cpp b/tests/hash/1.0/default/Hash.cpp
new file mode 100644
index 0000000..caed721
--- /dev/null
+++ b/tests/hash/1.0/default/Hash.cpp
@@ -0,0 +1,30 @@
+#include "Hash.h"
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace hash {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::tests::hash::V1_0::IHash follow.
+Return<void> Hash::dummy() {
+    return Void();
+}
+
+Return<void> Hash::functions() {
+    return Void();
+}
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+
+IHash* HIDL_FETCH_IHash(const char* /* name */) {
+    return new Hash();
+}
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace hash
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
diff --git a/tests/hash/1.0/default/Hash.h b/tests/hash/1.0/default/Hash.h
new file mode 100644
index 0000000..dd1678f
--- /dev/null
+++ b/tests/hash/1.0/default/Hash.h
@@ -0,0 +1,43 @@
+#ifndef ANDROID_HARDWARE_TESTS_HASH_V1_0_HASH_H
+#define ANDROID_HARDWARE_TESTS_HASH_V1_0_HASH_H
+
+#include <android/hardware/tests/hash/1.0/IHash.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace hash {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::hash::V1_0::IHash;
+using ::android::hidl::base::V1_0::DebugInfo;
+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 Hash : public IHash {
+    // Methods from ::android::hardware::tests::hash::V1_0::IHash follow.
+    Return<void> dummy() override;
+    Return<void> functions() override;
+
+    // Methods from ::android::hidl::base::V1_0::IBase follow.
+};
+
+extern "C" IHash* HIDL_FETCH_IHash(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace hash
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_TESTS_HASH_V1_0_HASH_H
diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.0/default/hidl_struct_util.cpp
index c005213..ae4f95d 100644
--- a/wifi/1.0/default/hidl_struct_util.cpp
+++ b/wifi/1.0/default/hidl_struct_util.cpp
@@ -774,10 +774,104 @@
   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::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::NanSubscribeType convertHidlNanSubscribeTypeToLegacy(NanSubscribeType type) {
+  switch (type) {
+    case NanSubscribeType::PASSIVE:
+      return legacy_hal::NAN_SUBSCRIBE_TYPE_PASSIVE;
+    case NanSubscribeType::ACTIVE:
+      return legacy_hal::NAN_SUBSCRIBE_TYPE_ACTIVE;
+  }
+  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::NanDataPathChannelCfg convertHidlNanDataPathChannelCfgToLegacy(
+    NanDataPathChannelCfg type) {
+  switch (type) {
+    case NanDataPathChannelCfg::CHANNEL_NOT_REQUESTED:
+      return legacy_hal::NAN_DP_CHANNEL_NOT_REQUESTED;
+    case NanDataPathChannelCfg::REQUEST_CHANNEL_SETUP:
+      return legacy_hal::NAN_DP_REQUEST_CHANNEL_SETUP;
+    case NanDataPathChannelCfg::FORCE_CHANNEL_SETUP:
+      return legacy_hal::NAN_DP_FORCE_CHANNEL_SETUP;
+  }
+  CHECK(false);
+}
+
 NanStatusType convertLegacyNanStatusTypeToHidl(
     legacy_hal::NanStatusType type) {
-  // values are identical - may need to do a mapping if they diverge in the future
-  return (NanStatusType) type;
+  switch (type) {
+    case legacy_hal::NAN_STATUS_SUCCESS:
+      return NanStatusType::SUCCESS;
+    case legacy_hal::NAN_STATUS_INTERNAL_FAILURE:
+      return NanStatusType::INTERNAL_FAILURE;
+    case legacy_hal::NAN_STATUS_PROTOCOL_FAILURE:
+      return NanStatusType::PROTOCOL_FAILURE;
+    case legacy_hal::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID:
+      return NanStatusType::INVALID_SESSION_ID;
+    case legacy_hal::NAN_STATUS_NO_RESOURCE_AVAILABLE:
+      return NanStatusType::NO_RESOURCES_AVAILABLE;
+    case legacy_hal::NAN_STATUS_INVALID_PARAM:
+      return NanStatusType::INVALID_ARGS;
+    case legacy_hal::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID:
+      return NanStatusType::INVALID_PEER_ID;
+    case legacy_hal::NAN_STATUS_INVALID_NDP_ID:
+      return NanStatusType::INVALID_NDP_ID;
+    case legacy_hal::NAN_STATUS_NAN_NOT_ALLOWED:
+      return NanStatusType::NAN_NOT_ALLOWED;
+    case legacy_hal::NAN_STATUS_NO_OTA_ACK:
+      return NanStatusType::NO_OTA_ACK;
+    case legacy_hal::NAN_STATUS_ALREADY_ENABLED:
+      return NanStatusType::ALREADY_ENABLED;
+    case legacy_hal::NAN_STATUS_FOLLOWUP_QUEUE_FULL:
+      return NanStatusType::FOLLOWUP_TX_QUEUE_FULL;
+    case legacy_hal::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED:
+      return NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED;
+  }
+  CHECK(false);
 }
 
 bool convertHidlNanEnableRequestToLegacy(
@@ -931,7 +1025,7 @@
   memcpy(legacy_request->service_name, hidl_request.baseConfigs.serviceName.data(),
         legacy_request->service_name_len);
   legacy_request->publish_match_indicator =
-        (legacy_hal::NanMatchAlg) hidl_request.baseConfigs.discoveryMatchIndicator;
+        convertHidlNanMatchAlgToLegacy(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) {
     LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: service_specific_info_len too large";
@@ -973,6 +1067,7 @@
         hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0;
   legacy_request->recv_indication_cfg |=
         hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0;
+  legacy_request->recv_indication_cfg |= 0x8;
   legacy_request->cipher_type = (unsigned int) hidl_request.baseConfigs.securityConfig.cipherType;
   if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) {
     legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
@@ -1018,8 +1113,8 @@
   legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired ?
         legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
   legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT;
-  legacy_request->publish_type = (legacy_hal::NanPublishType) hidl_request.publishType;
-  legacy_request->tx_type = (legacy_hal::NanTxType) hidl_request.txType;
+  legacy_request->publish_type = convertHidlNanPublishTypeToLegacy(hidl_request.publishType);
+  legacy_request->tx_type = convertHidlNanTxTypeToLegacy(hidl_request.txType);
   legacy_request->service_responder_policy = hidl_request.autoAcceptDataPathRequests ?
         legacy_hal::NAN_SERVICE_ACCEPT_POLICY_ALL : legacy_hal::NAN_SERVICE_ACCEPT_POLICY_NONE;
 
@@ -1047,7 +1142,7 @@
   memcpy(legacy_request->service_name, hidl_request.baseConfigs.serviceName.data(),
         legacy_request->service_name_len);
   legacy_request->subscribe_match_indicator =
-        (legacy_hal::NanMatchAlg) hidl_request.baseConfigs.discoveryMatchIndicator;
+        convertHidlNanMatchAlgToLegacy(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) {
     LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: service_specific_info_len too large";
@@ -1134,8 +1229,8 @@
   legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired ?
         legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
   legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT;
-  legacy_request->subscribe_type = (legacy_hal::NanSubscribeType) hidl_request.subscribeType;
-  legacy_request->serviceResponseFilter = (legacy_hal::NanSRFType) hidl_request.srfType;
+  legacy_request->subscribe_type = convertHidlNanSubscribeTypeToLegacy(hidl_request.subscribeType);
+  legacy_request->serviceResponseFilter = convertHidlNanSrfTypeToLegacy(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 ?
@@ -1295,7 +1390,7 @@
   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;
+        convertHidlNanDataPathChannelCfgToLegacy(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.securityConfig.securityType
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index ba57ba7..44acc04 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -180,6 +180,12 @@
   }
 }
 
+std::function<void(const NanPublishRepliedInd&)>
+    on_nan_event_publish_replied_user_callback;
+void onAysncNanEventPublishReplied(NanPublishRepliedInd* /* event */) {
+  LOG(ERROR) << "onAysncNanEventPublishReplied triggered";
+}
+
 std::function<void(const NanPublishTerminatedInd&)>
     on_nan_event_publish_terminated_user_callback;
 void onAysncNanEventPublishTerminated(NanPublishTerminatedInd* event) {
@@ -1054,6 +1060,7 @@
   return global_func_table_.wifi_nan_register_handler(
       wlan_interface_handle_,
       {onAysncNanNotifyResponse,
+       onAysncNanEventPublishReplied,
        onAysncNanEventPublishTerminated,
        onAysncNanEventMatch,
        onAysncNanEventMatchExpired,