Merge "Fix WHEEL_TICK + and add friends"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 01b5e7b..91515ab 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -55,4 +55,8 @@
 $(call add-clean-step, rm -rf $(OUT)/soong/.intermediates/)
 $(call add-clean-step, rm -rf $(OUT_DIR)/soong/.intermediates/hardware/interfaces/)
 $(call add-clean-step, rm -rf $(OUT_DIR)/soong/.intermediates/hardware/interfaces/)
-$(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore*" -print0 | xargs -0 rm -f)
\ No newline at end of file
+$(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore*" -print0 | xargs -0 rm -f)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/hw/android.hardware.automotive*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/hw/android.hardware.automotive*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/hw/android.hardware.automotive*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/android.hardware.automotive*)
diff --git a/audio/2.0/default/Android.mk b/audio/2.0/default/Android.mk
index 621853c..8dec482 100644
--- a/audio/2.0/default/Android.mk
+++ b/audio/2.0/default/Android.mk
@@ -84,8 +84,4 @@
 LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
 endif
 
-ifeq ($(TARGET_USES_BCRADIO_FUTURE_FEATURES),true)
-LOCAL_CFLAGS += -DTARGET_USES_BCRADIO_FUTURE_FEATURES
-endif
-
 include $(BUILD_EXECUTABLE)
diff --git a/audio/2.0/default/OWNERS b/audio/2.0/default/OWNERS
new file mode 100644
index 0000000..6fdc97c
--- /dev/null
+++ b/audio/2.0/default/OWNERS
@@ -0,0 +1,3 @@
+elaurent@google.com
+krocard@google.com
+mnaganov@google.com
diff --git a/audio/2.0/default/service.cpp b/audio/2.0/default/service.cpp
index 7f28d7d..f71f1b4 100644
--- a/audio/2.0/default/service.cpp
+++ b/audio/2.0/default/service.cpp
@@ -32,13 +32,7 @@
 using android::hardware::audio::V2_0::IDevicesFactory;
 using android::hardware::soundtrigger::V2_0::ISoundTriggerHw;
 using android::hardware::registerPassthroughServiceImplementation;
-namespace broadcastradio = android::hardware::broadcastradio;
-
-#ifdef TARGET_USES_BCRADIO_FUTURE_FEATURES
-static const bool useBroadcastRadioFutureFeatures = true;
-#else
-static const bool useBroadcastRadioFutureFeatures = false;
-#endif
+using android::hardware::broadcastradio::V1_1::IBroadcastRadioFactory;
 
 using android::OK;
 
@@ -52,13 +46,7 @@
     // Soundtrigger and FM radio might be not present.
     status = registerPassthroughServiceImplementation<ISoundTriggerHw>();
     ALOGE_IF(status != OK, "Error while registering soundtrigger service: %d", status);
-    if (useBroadcastRadioFutureFeatures) {
-        status = registerPassthroughServiceImplementation<
-            broadcastradio::V1_1::IBroadcastRadioFactory>();
-    } else {
-        status = registerPassthroughServiceImplementation<
-            broadcastradio::V1_0::IBroadcastRadioFactory>();
-    }
+    status = registerPassthroughServiceImplementation<IBroadcastRadioFactory>();
     ALOGE_IF(status != OK, "Error while registering fm radio service: %d", status);
     joinRpcThreadpool();
     return status;
diff --git a/audio/common/2.0/default/OWNERS b/audio/common/2.0/default/OWNERS
new file mode 100644
index 0000000..6fdc97c
--- /dev/null
+++ b/audio/common/2.0/default/OWNERS
@@ -0,0 +1,3 @@
+elaurent@google.com
+krocard@google.com
+mnaganov@google.com
diff --git a/audio/common/test/utility/OWNERS b/audio/common/test/utility/OWNERS
new file mode 100644
index 0000000..6fdc97c
--- /dev/null
+++ b/audio/common/test/utility/OWNERS
@@ -0,0 +1,3 @@
+elaurent@google.com
+krocard@google.com
+mnaganov@google.com
diff --git a/audio/effect/2.0/default/OWNERS b/audio/effect/2.0/default/OWNERS
new file mode 100644
index 0000000..6fdc97c
--- /dev/null
+++ b/audio/effect/2.0/default/OWNERS
@@ -0,0 +1,3 @@
+elaurent@google.com
+krocard@google.com
+mnaganov@google.com
diff --git a/audio/effect/2.0/vts/functional/Android.bp b/audio/effect/2.0/vts/functional/Android.bp
index 8a370cd..b3002a4 100644
--- a/audio/effect/2.0/vts/functional/Android.bp
+++ b/audio/effect/2.0/vts/functional/Android.bp
@@ -17,7 +17,8 @@
 cc_test {
     name: "VtsHalAudioEffectV2_0TargetTest",
     defaults: ["hidl_defaults"],
-    srcs: ["VtsHalAudioEffectV2_0TargetTest.cpp"],
+    srcs: ["VtsHalAudioEffectV2_0TargetTest.cpp",
+           "ValidateAudioEffectsConfiguration.cpp"],
     shared_libs: [
         "libbase",
         "liblog",
@@ -26,7 +27,9 @@
         "libhidltransport",
         "libnativehelper",
         "libutils",
+        "libxml2",
         "android.hardware.audio.common@2.0",
+        "android.hardware.audio.common.test.utility",
         "android.hardware.audio.effect@2.0",
         "android.hidl.allocator@1.0",
         "android.hidl.memory@1.0",
@@ -35,5 +38,6 @@
     cflags: [
         "-O0",
         "-g",
+        "-Wextra",
     ],
 }
diff --git a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp b/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
new file mode 100644
index 0000000..fdc1347
--- /dev/null
+++ b/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
@@ -0,0 +1,30 @@
+/*
+ * 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 <unistd.h>
+
+#include "utility/ValidateXml.h"
+
+TEST(CheckConfig, audioEffectsConfigurationValidation) {
+    RecordProperty("description",
+                   "Verify that the effects configuration file is valid according to the schema");
+    const char* xmlConfigFile = "/vendor/etc/audio_effects.xml";
+    // Not every device uses XML configuration, so only validate
+    // if the XML configuration actually exists.
+    if (access(xmlConfigFile, F_OK) == 0) {
+        ASSERT_VALID_XML(xmlConfigFile, "/data/local/tmp/audio_effects_conf_V2_0.xsd");
+    }
+}
diff --git a/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd b/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd
index 64647de..ca6a7dc 100644
--- a/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd
+++ b/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd
@@ -43,7 +43,6 @@
   </xs:simpleType>
   <xs:simpleType name="streamOutputType">
     <xs:restriction base="xs:string">
-      <xs:enumeration value="default"/>
       <xs:enumeration value="voice_call"/>
       <xs:enumeration value="system"/>
       <xs:enumeration value="ring"/>
@@ -56,17 +55,22 @@
       <xs:enumeration value="tts"/>
     </xs:restriction>
   </xs:simpleType>
+  <xs:simpleType name="relativePathType">
+    <xs:restriction base="xs:string">
+      <xs:pattern value="[^/].*"/>
+    </xs:restriction>
+  </xs:simpleType>
 
   <!-- Complex types -->
-  <xs:complexType name="libraryType">
+  <xs:complexType name="librariesType">
     <xs:annotation>
       <xs:documentation xml:lang="en">
         List of effect libraries to load. Each library element must have "name" and
-        "path" attributes. The latter is giving the full path of the library .so file.
+        "path" attributes. The latter is giving the path of the library .so file
+        relative to the standard effect folders: /(vendor|odm|system)/lib(64)?/soundfx/
 
-        Example:
-
-        <library name="name" path="/vendor/lib/soundfx/lib.so"/>
+        Example for a library in "/vendor/lib/soundfx/lib.so":
+        <library name="name" path="lib.so"/>
 
       </xs:documentation>
     </xs:annotation>
@@ -74,7 +78,7 @@
       <xs:element name="library" minOccurs="0" maxOccurs="unbounded">
         <xs:complexType>
           <xs:attribute name="name" type="xs:string" use="required"/>
-          <xs:attribute name="path" type="xs:string" use="required"/>
+          <xs:attribute name="path" type="aec:relativePathType" use="required"/>
         </xs:complexType>
       </xs:element>
     </xs:sequence>
@@ -83,18 +87,24 @@
     <xs:attribute name="library" type="xs:string" use="required"/>
     <xs:attribute name="uuid" type="aec:uuidType" use="required"/>
   </xs:complexType>
-  <xs:complexType name="effectProxyType">
+  <xs:complexType name="effectType">
     <xs:complexContent>
       <xs:extension base="aec:effectImplType">
-        <xs:sequence>
-          <xs:element name="libsw" type="aec:effectImplType" minOccurs="0" maxOccurs="1"/>
-          <xs:element name="libhw" type="aec:effectImplType" minOccurs="0" maxOccurs="1"/>
-        </xs:sequence>
         <xs:attribute name="name" type="xs:string" use="required"/>
       </xs:extension>
     </xs:complexContent>
   </xs:complexType>
-  <xs:complexType name="effectType">
+  <xs:complexType name="effectProxyType">
+    <xs:complexContent>
+      <xs:extension base="aec:effectType">
+        <xs:sequence>
+          <xs:element name="libsw" type="aec:effectImplType"/>
+          <xs:element name="libhw" type="aec:effectImplType"/>
+        </xs:sequence>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="effectsType">
     <xs:annotation>
       <xs:documentation xml:lang="en">
         List of effects to load. Each effect element must contain "name",
@@ -111,16 +121,17 @@
         Example:
 
         <effect name="name" library="lib" uuid="uuuu"/>
-        <effect name="proxied" library="proxy" uuid="xxxx">
+        <effectProxy name="proxied" library="proxy" uuid="xxxx">
             <libsw library="sw_bundle" uuid="yyyy"/>
             <libhw library="offload_bundle" uuid="zzzz"/>
-        </effect>
+        </effectProxy>
 
       </xs:documentation>
     </xs:annotation>
-    <xs:sequence>
-      <xs:element name="effect" type="aec:effectProxyType" minOccurs="0" maxOccurs="unbounded"/>
-    </xs:sequence>
+    <xs:choice maxOccurs="unbounded">
+      <xs:element name="effect" type="aec:effectType" minOccurs="0" maxOccurs="unbounded"/>
+      <xs:element name="effectProxy" type="aec:effectProxyType" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:choice>
   </xs:complexType>
   <xs:complexType name="streamProcessingType">
     <xs:sequence>
@@ -185,8 +196,8 @@
   <xs:element name="audio_effects_conf">
     <xs:complexType>
       <xs:sequence>
-        <xs:element name="libraries" type="aec:libraryType"/>
-        <xs:element name="effects" type="aec:effectType"/>
+        <xs:element name="libraries" type="aec:librariesType"/>
+        <xs:element name="effects" type="aec:effectsType"/>
         <xs:element name="postprocess" minOccurs="0" maxOccurs="1">
           <xs:complexType>
             <xs:sequence>
diff --git a/automotive/Android.bp b/automotive/Android.bp
index aec8865..d9a6355 100644
--- a/automotive/Android.bp
+++ b/automotive/Android.bp
@@ -4,5 +4,8 @@
     "evs/1.0/default",
     "evs/1.0/vts/functional",
     "vehicle/2.0",
+    "vehicle/2.0/default",
+    "vehicle/2.0/default/impl/vhal_v2_0/proto",
     "vehicle/2.1",
+    "vehicle/2.1/default",
 ]
diff --git a/automotive/evs/1.0/vts/functional/Android.bp b/automotive/evs/1.0/vts/functional/Android.bp
index e86e9bc..555ff5b 100644
--- a/automotive/evs/1.0/vts/functional/Android.bp
+++ b/automotive/evs/1.0/vts/functional/Android.bp
@@ -15,10 +15,10 @@
 //
 
 cc_test {
-    name: "VtsEvsV1_0Target",
+    name: "VtsHalEvsV1_0Target",
 
     srcs: [
-        "VtsEvsV1_0TargetTest.cpp",
+        "VtsHalEvsV1_0TargetTest.cpp",
         "FrameHandler.cpp",
         "FormatConvert.cpp"
     ],
@@ -43,4 +43,3 @@
         "-g",
     ],
 }
-
diff --git a/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp b/automotive/evs/1.0/vts/functional/VtsHalEvsV1_0TargetTest.cpp
similarity index 100%
rename from automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp
rename to automotive/evs/1.0/vts/functional/VtsHalEvsV1_0TargetTest.cpp
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
new file mode 100644
index 0000000..3e3ff2c
--- /dev/null
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -0,0 +1,116 @@
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_defaults {
+    name: "vhal_v2_0_defaults",
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libutils",
+        "android.hardware.automotive.vehicle@2.0",
+    ],
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+}
+
+cc_library_headers {
+    name: "vhal_v2_0_common_headers",
+    vendor: true,
+    export_include_dirs: ["common/include/vhal_v2_0"],
+}
+
+// Vehicle reference implementation lib
+cc_library_static {
+    name: "android.hardware.automotive.vehicle@2.0-manager-lib",
+    vendor: true,
+    defaults: ["vhal_v2_0_defaults"],
+    srcs: [
+        "common/src/SubscriptionManager.cpp",
+        "common/src/VehicleHalManager.cpp",
+        "common/src/VehicleObjectPool.cpp",
+        "common/src/VehiclePropertyStore.cpp",
+        "common/src/VehicleUtils.cpp",
+    ],
+    local_include_dirs: ["common/include/vhal_v2_0"],
+    export_include_dirs: ["common/include"],
+}
+
+cc_library_shared {
+    name: "android.hardware.automotive.vehicle@2.0-manager-lib-shared",
+    vendor: true,
+    static_libs: ["android.hardware.automotive.vehicle@2.0-manager-lib"],
+    export_static_lib_headers: ["android.hardware.automotive.vehicle@2.0-manager-lib"],
+}
+
+// Vehicle default VehicleHAL implementation
+cc_library_static {
+    name: "android.hardware.automotive.vehicle@2.0-default-impl-lib",
+    vendor: true,
+    defaults: ["vhal_v2_0_defaults"],
+    srcs: [
+        "impl/vhal_v2_0/EmulatedVehicleHal.cpp",
+        "impl/vhal_v2_0/VehicleEmulator.cpp",
+        "impl/vhal_v2_0/PipeComm.cpp",
+        "impl/vhal_v2_0/SocketComm.cpp",
+    ],
+    local_include_dirs: ["common/include/vhal_v2_0"],
+    export_include_dirs: ["impl"],
+    whole_static_libs: ["android.hardware.automotive.vehicle@2.0-manager-lib"],
+    shared_libs: [
+        "libbase",
+        "libprotobuf-cpp-lite",
+    ],
+    static_libs: [
+        "libqemu_pipe",
+        "android.hardware.automotive.vehicle@2.0-libproto-native",
+    ],
+}
+
+cc_test {
+    name: "android.hardware.automotive.vehicle@2.0-manager-unit-tests",
+    vendor: true,
+    defaults: ["vhal_v2_0_defaults"],
+    whole_static_libs: ["android.hardware.automotive.vehicle@2.0-manager-lib"],
+    srcs: [
+        "tests/RecurrentTimer_test.cpp",
+        "tests/SubscriptionManager_test.cpp",
+        "tests/VehicleHalManager_test.cpp",
+        "tests/VehicleObjectPool_test.cpp",
+        "tests/VehiclePropConfigIndex_test.cpp",
+    ],
+    header_libs: ["libbase_headers"],
+}
+
+cc_binary {
+    name: "android.hardware.automotive.vehicle@2.0-service",
+    defaults: ["vhal_v2_0_defaults"],
+    init_rc: ["android.hardware.automotive.vehicle@2.0-service.rc"],
+    vendor: true,
+    relative_install_path: "hw",
+    srcs: ["VehicleService.cpp"],
+    shared_libs: [
+        "libbase",
+        "libprotobuf-cpp-lite",
+    ],
+    static_libs: [
+        "android.hardware.automotive.vehicle@2.0-manager-lib",
+        "android.hardware.automotive.vehicle@2.0-default-impl-lib",
+        "android.hardware.automotive.vehicle@2.0-libproto-native",
+        "libqemu_pipe",
+    ],
+}
diff --git a/automotive/vehicle/2.0/default/Android.mk b/automotive/vehicle/2.0/default/Android.mk
deleted file mode 100644
index 72e1364..0000000
--- a/automotive/vehicle/2.0/default/Android.mk
+++ /dev/null
@@ -1,194 +0,0 @@
-# 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)
-
-vhal_v2_0 = android.hardware.automotive.vehicle@2.0
-
-###############################################################################
-# Vehicle reference implementation lib
-###############################################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(vhal_v2_0)-manager-lib
-LOCAL_SRC_FILES := \
-    common/src/SubscriptionManager.cpp \
-    common/src/VehicleHalManager.cpp \
-    common/src/VehicleObjectPool.cpp \
-    common/src/VehiclePropertyStore.cpp \
-    common/src/VehicleUtils.cpp \
-
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/common/include/vhal_v2_0
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-    $(LOCAL_PATH)/common/include
-
-LOCAL_SHARED_LIBRARIES := \
-    libhidlbase \
-    libhidltransport \
-    liblog \
-    libutils \
-    $(vhal_v2_0) \
-
-include $(BUILD_STATIC_LIBRARY)
-
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(vhal_v2_0)-manager-lib-shared
-LOCAL_SRC_FILES := \
-    common/src/SubscriptionManager.cpp \
-    common/src/VehicleHalManager.cpp \
-    common/src/VehicleObjectPool.cpp \
-    common/src/VehiclePropertyStore.cpp \
-    common/src/VehicleUtils.cpp \
-
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/common/include/vhal_v2_0
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-    $(LOCAL_PATH)/common/include
-
-LOCAL_SHARED_LIBRARIES := \
-    libhidlbase \
-    libhidltransport \
-    liblog \
-    libutils \
-    $(vhal_v2_0) \
-
-include $(BUILD_SHARED_LIBRARY)
-
-###############################################################################
-# Vehicle HAL Protobuf library
-###############################################################################
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-proto-files-under, impl/vhal_v2_0/proto)
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := nano
-
-LOCAL_MODULE := $(vhal_v2_0)-libproto-native
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_STRIP_MODULE := keep_symbols
-
-generated_sources_dir := $(call local-generated-sources-dir)
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-    $(generated_sources_dir)/proto/$(LOCAL_PATH)/impl/vhal_v2_0/proto
-
-include $(BUILD_STATIC_LIBRARY)
-
-
-###############################################################################
-# Vehicle default VehicleHAL implementation
-###############################################################################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= $(vhal_v2_0)-default-impl-lib
-LOCAL_SRC_FILES:= \
-    impl/vhal_v2_0/EmulatedVehicleHal.cpp \
-    impl/vhal_v2_0/VehicleEmulator.cpp \
-    impl/vhal_v2_0/PipeComm.cpp \
-    impl/vhal_v2_0/SocketComm.cpp \
-
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/impl/vhal_v2_0
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-    $(LOCAL_PATH)/impl
-
-LOCAL_WHOLE_STATIC_LIBRARIES := \
-    $(vhal_v2_0)-manager-lib \
-
-LOCAL_SHARED_LIBRARIES := \
-    libbase \
-    libhidlbase \
-    libhidltransport \
-    liblog \
-    libprotobuf-cpp-lite \
-    libutils \
-    $(vhal_v2_0) \
-
-LOCAL_STATIC_LIBRARIES := \
-    libqemu_pipe \
-    $(vhal_v2_0)-libproto-native \
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-include $(BUILD_STATIC_LIBRARY)
-
-
-###############################################################################
-# Vehicle reference implementation unit tests
-###############################################################################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= $(vhal_v2_0)-manager-unit-tests
-
-LOCAL_WHOLE_STATIC_LIBRARIES := \
-    $(vhal_v2_0)-manager-lib \
-
-LOCAL_SRC_FILES:= \
-    tests/RecurrentTimer_test.cpp \
-    tests/SubscriptionManager_test.cpp \
-    tests/VehicleHalManager_test.cpp \
-    tests/VehicleObjectPool_test.cpp \
-    tests/VehiclePropConfigIndex_test.cpp \
-
-LOCAL_HEADER_LIBRARIES := \
-    libbase_headers
-
-LOCAL_SHARED_LIBRARIES := \
-    libhidlbase \
-    libhidltransport \
-    liblog \
-    libutils \
-    $(vhal_v2_0) \
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_NATIVE_TEST)
-
-
-###############################################################################
-# Vehicle HAL service
-###############################################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(vhal_v2_0)-service
-LOCAL_INIT_RC := $(vhal_v2_0)-service.rc
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-
-LOCAL_SRC_FILES := \
-    VehicleService.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    libbase \
-    libhidlbase \
-    libhidltransport \
-    liblog \
-    libprotobuf-cpp-lite \
-    libutils \
-    $(vhal_v2_0) \
-
-LOCAL_STATIC_LIBRARIES := \
-    $(vhal_v2_0)-manager-lib \
-    $(vhal_v2_0)-default-impl-lib \
-    $(vhal_v2_0)-libproto-native \
-    libqemu_pipe \
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-include $(BUILD_EXECUTABLE)
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp
new file mode 100644
index 0000000..ec35200
--- /dev/null
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Vehicle HAL Protobuf library
+cc_library_static {
+    name: "android.hardware.automotive.vehicle@2.0-libproto-native",
+    vendor: true,
+    proto: {
+        export_proto_headers: true,
+        type: "lite",
+    },
+    strip: {
+        keep_symbols: true,
+    },
+    srcs: ["VehicleHalProto.proto"]
+}
diff --git a/automotive/vehicle/2.1/default/Android.bp b/automotive/vehicle/2.1/default/Android.bp
new file mode 100644
index 0000000..f6743f2
--- /dev/null
+++ b/automotive/vehicle/2.1/default/Android.bp
@@ -0,0 +1,86 @@
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_defaults {
+    name: "vhal_v2_1_defaults",
+    defaults: ["vhal_v2_0_defaults"],
+    shared_libs: [
+        "libhwbinder",
+        "android.hardware.automotive.vehicle@2.1",
+    ],
+}
+
+// Vehicle reference implementation lib
+cc_library_static {
+    name: "android.hardware.automotive.vehicle@2.1-manager-lib",
+    vendor: true,
+    defaults: ["vhal_v2_1_defaults"],
+    srcs: [
+        "common/src/Obd2SensorStore.cpp",
+    ],
+    local_include_dirs: ["common/include/vhal_v2_1"],
+    header_libs: ["vhal_v2_0_common_headers"],
+    export_include_dirs: ["common/include"],
+}
+
+// Vehicle default VehicleHAL implementation
+cc_library_static {
+    name: "android.hardware.automotive.vehicle@2.1-default-impl-lib",
+    vendor: true,
+    defaults: ["vhal_v2_1_defaults"],
+    srcs: [
+        "impl/vhal_v2_1/EmulatedVehicleHal.cpp",
+    ],
+    local_include_dirs: [
+        "impl/vhal_v2_1",
+        "common/include",
+    ],
+    export_include_dirs: [
+        "impl",
+        "common/include",
+    ],
+    static_libs: [
+        "android.hardware.automotive.vehicle@2.0-default-impl-lib",
+        "android.hardware.automotive.vehicle@2.0-libproto-native",
+        "android.hardware.automotive.vehicle@2.0-manager-lib",
+        "android.hardware.automotive.vehicle@2.1-manager-lib",
+        "libqemu_pipe",
+    ],
+    shared_libs: [
+        "libbase",
+        "libprotobuf-cpp-lite",
+    ],
+}
+
+cc_binary {
+    name: "android.hardware.automotive.vehicle@2.1-service",
+    defaults: ["vhal_v2_1_defaults"],
+    init_rc: ["android.hardware.automotive.vehicle@2.1-service.rc"],
+    vendor: true,
+    relative_install_path: "hw",
+    srcs: ["service.cpp"],
+    whole_static_libs: ["android.hardware.automotive.vehicle@2.0-libproto-native"],
+    static_libs: [
+        "android.hardware.automotive.vehicle@2.0-default-impl-lib",
+        "android.hardware.automotive.vehicle@2.0-manager-lib",
+        "android.hardware.automotive.vehicle@2.1-default-impl-lib",
+        "android.hardware.automotive.vehicle@2.1-manager-lib",
+        "libqemu_pipe",
+    ],
+    shared_libs: [
+        "libbase",
+        "libhwbinder",
+        "libprotobuf-cpp-lite",
+    ],
+}
diff --git a/automotive/vehicle/2.1/default/Android.mk b/automotive/vehicle/2.1/default/Android.mk
deleted file mode 100644
index f19263c..0000000
--- a/automotive/vehicle/2.1/default/Android.mk
+++ /dev/null
@@ -1,121 +0,0 @@
-# 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)
-
-vhal_v2_0 = android.hardware.automotive.vehicle@2.0
-vhal_v2_1 = android.hardware.automotive.vehicle@2.1
-
-###############################################################################
-# Vehicle reference implementation lib
-###############################################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(vhal_v2_1)-manager-lib
-LOCAL_SRC_FILES := \
-    common/src/Obd2SensorStore.cpp
-
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/common/include/vhal_v2_1 \
-    $(LOCAL_PATH)/../../2.0/default/common/include/vhal_v2_0 \
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-    $(LOCAL_PATH)/common/include
-
-LOCAL_SHARED_LIBRARIES := \
-    libhidlbase \
-    libhidltransport \
-    libhwbinder \
-    liblog \
-    libutils \
-    $(vhal_v2_1) \
-
-include $(BUILD_STATIC_LIBRARY)
-
-###############################################################################
-# Vehicle default VehicleHAL implementation
-###############################################################################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= $(vhal_v2_1)-default-impl-lib
-LOCAL_SRC_FILES:= \
-    impl/vhal_v2_1/EmulatedVehicleHal.cpp \
-
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/impl/vhal_v2_1 \
-    $(LOCAL_PATH)/common/include
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-    $(LOCAL_PATH)/impl \
-    $(LOCAL_PATH)/common/include
-
-
-# LOCAL_WHOLE_STATIC_LIBRARIES := \
-
-LOCAL_STATIC_LIBRARIES := \
-    $(vhal_v2_0)-default-impl-lib \
-    $(vhal_v2_0)-manager-lib \
-    libqemu_pipe \
-    $(vhal_v2_1)-manager-lib \
-    $(vhal_v2_0)-libproto-native
-
-LOCAL_SHARED_LIBRARIES := \
-    libbase \
-    libhidlbase \
-    libhidltransport \
-    libhwbinder \
-    liblog \
-    libutils \
-    libprotobuf-cpp-lite \
-    $(vhal_v2_0) \
-    $(vhal_v2_1) \
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-include $(BUILD_STATIC_LIBRARY)
-
-###############################################################################
-# Vehicle HAL service
-###############################################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(vhal_v2_1)-service
-LOCAL_INIT_RC := $(vhal_v2_1)-service.rc
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_SRC_FILES := \
-    service.cpp
-
-LOCAL_WHOLE_STATIC_LIBRARIES := \
-    $(vhal_v2_0)-libproto-native \
-
-LOCAL_STATIC_LIBRARIES := \
-    $(vhal_v2_0)-manager-lib \
-    $(vhal_v2_0)-default-impl-lib \
-    $(vhal_v2_1)-default-impl-lib \
-    libqemu_pipe \
-    $(vhal_v2_1)-manager-lib \
-
-LOCAL_SHARED_LIBRARIES := \
-    libbase \
-    libhidlbase \
-    libhidltransport \
-    libhwbinder \
-    liblog \
-    libutils \
-    libprotobuf-cpp-lite \
-    $(vhal_v2_0) \
-    $(vhal_v2_1) \
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-include $(BUILD_EXECUTABLE)
diff --git a/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp b/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp
index 46e062b..4faccbd 100644
--- a/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp
+++ b/automotive/vehicle/2.1/default/impl/vhal_v2_1/EmulatedVehicleHal.cpp
@@ -189,6 +189,7 @@
         timestamps.push_back(freezeFrame.timestamp);
     }
     outValue->value.int64Values = timestamps;
+    outValue->prop = OBD2_FREEZE_FRAME_INFO;
     return V2_0::StatusCode::OK;
 }
 
diff --git a/bluetooth/1.0/default/async_fd_watcher.cc b/bluetooth/1.0/default/async_fd_watcher.cc
index bc0bc92..78676b2 100644
--- a/bluetooth/1.0/default/async_fd_watcher.cc
+++ b/bluetooth/1.0/default/async_fd_watcher.cc
@@ -24,7 +24,7 @@
 #include <map>
 #include <mutex>
 #include <thread>
-#include <utils/Log.h>
+#include <log/log.h>
 #include <vector>
 #include "fcntl.h"
 #include "sys/select.h"
diff --git a/bluetooth/1.0/default/bluetooth_address.cc b/bluetooth/1.0/default/bluetooth_address.cc
index 656d78d..fd53e78 100644
--- a/bluetooth/1.0/default/bluetooth_address.cc
+++ b/bluetooth/1.0/default/bluetooth_address.cc
@@ -16,9 +16,10 @@
 
 #include "bluetooth_address.h"
 
-#include <android-base/logging.h>
 #include <cutils/properties.h>
+#include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <utils/Log.h>
 
 namespace android {
@@ -54,19 +55,25 @@
 
     addr_fd = open(property, O_RDONLY);
     if (addr_fd != -1) {
-      int bytes_read = read(addr_fd, property, kStringLength);
-      CHECK(bytes_read == kStringLength);
+      char address[kStringLength + 1] = {0};
+      int bytes_read = read(addr_fd, address, kStringLength);
+      if (bytes_read == -1) {
+        ALOGE("%s: Error reading address from %s: %s", __func__, property,
+              strerror(errno));
+      }
       close(addr_fd);
 
       // Null terminate the string.
-      property[kStringLength] = '\0';
+      address[kStringLength] = '\0';
 
       // If the address is not all zeros, then use it.
       const uint8_t zero_bdaddr[kBytes] = {0, 0, 0, 0, 0, 0};
-      if ((string_to_bytes(property, local_addr)) &&
+      if ((string_to_bytes(address, local_addr)) &&
           (memcmp(local_addr, zero_bdaddr, kBytes) != 0)) {
         valid_bda = true;
-        ALOGD("%s: Got Factory BDA %s", __func__, property);
+        ALOGD("%s: Got Factory BDA %s", __func__, address);
+      } else {
+        ALOGE("%s: Got Invalid BDA '%s' from %s", __func__, address, property);
       }
     }
   }
diff --git a/bluetooth/1.0/default/h4_protocol.cc b/bluetooth/1.0/default/h4_protocol.cc
index 8f24b5e..054ed39 100644
--- a/bluetooth/1.0/default/h4_protocol.cc
+++ b/bluetooth/1.0/default/h4_protocol.cc
@@ -17,9 +17,12 @@
 #include "h4_protocol.h"
 
 #define LOG_TAG "android.hardware.bluetooth-hci-h4"
-#include <android-base/logging.h>
-#include <assert.h>
+
+#include <errno.h>
 #include <fcntl.h>
+#include <log/log.h>
+#include <sys/uio.h>
+#include <unistd.h>
 
 namespace android {
 namespace hardware {
@@ -27,11 +30,20 @@
 namespace hci {
 
 size_t H4Protocol::Send(uint8_t type, const uint8_t* data, size_t length) {
-  int rv = WriteSafely(uart_fd_, &type, sizeof(type));
-  if (rv == sizeof(type)) {
-    rv = WriteSafely(uart_fd_, data, length);
+  struct iovec iov[] = {{&type, sizeof(type)},
+                        {const_cast<uint8_t*>(data), length}};
+  ssize_t ret = 0;
+  do {
+    ret = TEMP_FAILURE_RETRY(writev(uart_fd_, iov, sizeof(iov) / sizeof(iov[0])));
+  } while (-1 == ret && EAGAIN == errno);
+
+  if (ret == -1) {
+    ALOGE("%s error writing to UART (%s)", __func__, strerror(errno));
+  } else if (ret < static_cast<ssize_t>(length + 1)) {
+    ALOGE("%s: %d / %d bytes written - something went wrong...", __func__,
+          static_cast<int>(ret), static_cast<int>(length + 1));
   }
-  return rv;
+  return ret;
 }
 
 void H4Protocol::OnPacketReady() {
@@ -45,10 +57,9 @@
     case HCI_PACKET_TYPE_SCO_DATA:
       sco_cb_(hci_packetizer_.GetPacket());
       break;
-    default: {
-      bool bad_packet_type = true;
-      CHECK(!bad_packet_type);
-    }
+    default:
+      LOG_ALWAYS_FATAL("%s: Unimplemented packet type %d", __func__,
+                       static_cast<int>(hci_packet_type_));
   }
   // Get ready for the next type byte.
   hci_packet_type_ = HCI_PACKET_TYPE_UNKNOWN;
@@ -57,8 +68,19 @@
 void H4Protocol::OnDataReady(int fd) {
   if (hci_packet_type_ == HCI_PACKET_TYPE_UNKNOWN) {
     uint8_t buffer[1] = {0};
-    size_t bytes_read = TEMP_FAILURE_RETRY(read(fd, buffer, 1));
-    CHECK(bytes_read == 1);
+    ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fd, buffer, 1));
+    if (bytes_read != 1) {
+      if (bytes_read == 0) {
+        LOG_ALWAYS_FATAL("%s: Unexpected EOF reading the packet type!",
+                         __func__);
+      } else if (bytes_read < 0) {
+        LOG_ALWAYS_FATAL("%s: Read packet type error: %s", __func__,
+                         strerror(errno));
+      } else {
+        LOG_ALWAYS_FATAL("%s: More bytes read than expected (%u)!", __func__,
+                         static_cast<unsigned int>(bytes_read));
+      }
+    }
     hci_packet_type_ = static_cast<HciPacketType>(buffer[0]);
   } else {
     hci_packetizer_.OnDataReady(fd, hci_packet_type_);
diff --git a/bluetooth/1.0/default/hci_packetizer.cc b/bluetooth/1.0/default/hci_packetizer.cc
index 9549858..fde08ac 100644
--- a/bluetooth/1.0/default/hci_packetizer.cc
+++ b/bluetooth/1.0/default/hci_packetizer.cc
@@ -17,11 +17,12 @@
 #include "hci_packetizer.h"
 
 #define LOG_TAG "android.hardware.bluetooth.hci_packetizer"
-#include <android-base/logging.h>
-#include <utils/Log.h>
 
 #include <dlfcn.h>
+#include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
+#include <utils/Log.h>
 
 namespace {
 
@@ -45,15 +46,22 @@
 namespace bluetooth {
 namespace hci {
 
-const hidl_vec<uint8_t>& HciPacketizer::GetPacket() const { return packet_; }
+const hidl_vec<uint8_t>& HciPacketizer::GetPacket() const {
+  return packet_;
+}
 
 void HciPacketizer::OnDataReady(int fd, HciPacketType packet_type) {
   switch (state_) {
     case HCI_PREAMBLE: {
-      size_t bytes_read = TEMP_FAILURE_RETRY(
+      ssize_t bytes_read = TEMP_FAILURE_RETRY(
           read(fd, preamble_ + bytes_read_,
                preamble_size_for_type[packet_type] - bytes_read_));
-      CHECK(bytes_read > 0);
+      if (bytes_read <= 0) {
+        LOG_ALWAYS_FATAL_IF((bytes_read == 0),
+                            "%s: Unexpected EOF reading the header!", __func__);
+        LOG_ALWAYS_FATAL("%s: Read header error: %s", __func__,
+                         strerror(errno));
+      }
       bytes_read_ += bytes_read;
       if (bytes_read_ == preamble_size_for_type[packet_type]) {
         size_t packet_length =
@@ -68,11 +76,17 @@
     }
 
     case HCI_PAYLOAD: {
-      size_t bytes_read = TEMP_FAILURE_RETRY(read(
+      ssize_t bytes_read = TEMP_FAILURE_RETRY(read(
           fd,
           packet_.data() + preamble_size_for_type[packet_type] + bytes_read_,
           bytes_remaining_));
-      CHECK(bytes_read > 0);
+      if (bytes_read <= 0) {
+        LOG_ALWAYS_FATAL_IF((bytes_read == 0),
+                            "%s: Unexpected EOF reading the payload!",
+                            __func__);
+        LOG_ALWAYS_FATAL("%s: Read payload error: %s", __func__,
+                         strerror(errno));
+      }
       bytes_remaining_ -= bytes_read;
       bytes_read_ += bytes_read;
       if (bytes_remaining_ == 0) {
diff --git a/bluetooth/1.0/default/hci_protocol.cc b/bluetooth/1.0/default/hci_protocol.cc
index 5d6f1d1..bf94dfe 100644
--- a/bluetooth/1.0/default/hci_protocol.cc
+++ b/bluetooth/1.0/default/hci_protocol.cc
@@ -20,6 +20,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <log/log.h>
 
 namespace android {
diff --git a/bluetooth/1.0/default/mct_protocol.cc b/bluetooth/1.0/default/mct_protocol.cc
index 813cebd..2a59187 100644
--- a/bluetooth/1.0/default/mct_protocol.cc
+++ b/bluetooth/1.0/default/mct_protocol.cc
@@ -19,7 +19,6 @@
 #include <assert.h>
 
 #define LOG_TAG "android.hardware.bluetooth-hci-mct"
-#include <android-base/logging.h>
 #include <utils/Log.h>
 
 #include <fcntl.h>
@@ -45,7 +44,7 @@
     return WriteSafely(uart_fds_[CH_CMD], data, length);
   if (type == HCI_PACKET_TYPE_ACL_DATA)
     return WriteSafely(uart_fds_[CH_ACL_OUT], data, length);
-  CHECK(type == HCI_PACKET_TYPE_COMMAND || type == HCI_PACKET_TYPE_ACL_DATA);
+  LOG_ALWAYS_FATAL("%s: Unimplemented packet type = %d", __func__, type);
   return 0;
 }
 
diff --git a/bluetooth/1.0/default/test/bluetooth_address_test.cc b/bluetooth/1.0/default/test/bluetooth_address_test.cc
index adcd9c1..e60729e 100644
--- a/bluetooth/1.0/default/test/bluetooth_address_test.cc
+++ b/bluetooth/1.0/default/test/bluetooth_address_test.cc
@@ -15,6 +15,7 @@
 //
 
 #include <cutils/properties.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <gtest/gtest.h>
 
diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc
index a291e14..ffc283e 100644
--- a/bluetooth/1.0/default/vendor_interface.cc
+++ b/bluetooth/1.0/default/vendor_interface.cc
@@ -17,7 +17,6 @@
 #include "vendor_interface.h"
 
 #define LOG_TAG "android.hardware.bluetooth@1.0-impl"
-#include <android-base/logging.h>
 #include <cutils/properties.h>
 #include <utils/Log.h>
 
@@ -163,14 +162,16 @@
     InitializeCompleteCallback initialize_complete_cb,
     PacketReadCallback event_cb, PacketReadCallback acl_cb,
     PacketReadCallback sco_cb) {
-  CHECK(!g_vendor_interface);
+  LOG_ALWAYS_FATAL_IF(g_vendor_interface, "%s: No previous Shutdown()?",
+                      __func__);
   g_vendor_interface = new VendorInterface();
   return g_vendor_interface->Open(initialize_complete_cb, event_cb, acl_cb,
                                   sco_cb);
 }
 
 void VendorInterface::Shutdown() {
-  CHECK(g_vendor_interface);
+  LOG_ALWAYS_FATAL_IF(!g_vendor_interface, "%s: No Vendor interface!",
+                      __func__);
   g_vendor_interface->Close();
   delete g_vendor_interface;
   g_vendor_interface = nullptr;
@@ -204,7 +205,9 @@
   // Get the local BD address
 
   uint8_t local_bda[BluetoothAddress::kBytes];
-  CHECK(BluetoothAddress::get_local_address(local_bda));
+  if (!BluetoothAddress::get_local_address(local_bda)) {
+    LOG_ALWAYS_FATAL("%s: No Bluetooth Address!", __func__);
+  }
   int status = lib_interface_->init(&lib_callbacks, (unsigned char*)local_bda);
   if (status) {
     ALOGE("%s unable to initialize vendor library: %d", __func__, status);
diff --git a/bluetooth/1.0/vts/functional/Android.bp b/bluetooth/1.0/vts/functional/Android.bp
index d2e6553..cd2be44 100644
--- a/bluetooth/1.0/vts/functional/Android.bp
+++ b/bluetooth/1.0/vts/functional/Android.bp
@@ -28,7 +28,10 @@
         "libutils",
         "android.hardware.bluetooth@1.0",
     ],
-    static_libs: ["VtsHalHidlTargetTestBase"],
+    static_libs: [
+        "VtsHalHidlTargetTestBase",
+        "libbluetooth-types",
+    ],
     cflags: [
         "-O0",
         "-g",
diff --git a/broadcastradio/1.0/default/OWNERS b/broadcastradio/1.0/default/OWNERS
new file mode 100644
index 0000000..b159083
--- /dev/null
+++ b/broadcastradio/1.0/default/OWNERS
@@ -0,0 +1,4 @@
+elaurent@google.com
+krocard@google.com
+mnaganov@google.com
+twasilczyk@google.com
diff --git a/broadcastradio/1.1/ITuner.hal b/broadcastradio/1.1/ITuner.hal
index 7511629..a5c569a 100644
--- a/broadcastradio/1.1/ITuner.hal
+++ b/broadcastradio/1.1/ITuner.hal
@@ -21,6 +21,45 @@
 interface ITuner extends @1.0::ITuner {
 
     /**
+     * Tune to a specified program.
+     *
+     * For AM/FM, it must be called when a valid configuration has been applied.
+     * Automatically cancels pending scan, step or tune.
+     *
+     * If method returns OK, ITunerCallback.tuneComplete_1_1() MUST be called:
+     * - once successfully tuned;
+     * - after a time out;
+     * - after a full band scan, if no station found.
+     *
+     * The tuned field of ProgramInfo should indicate if tuned to a valid
+     * station or not.
+     *
+     * @param program Program to tune to.
+     * @return result OK if successfully started tunning.
+     *                INVALID_ARGUMENTS if invalid arguments are passed.
+     *                NOT_INITIALIZED if another error occurs.
+     */
+    tune_1_1(ProgramSelector program) generates (Result result);
+
+    /**
+     * Cancels announcement.
+     *
+     * If it was traffic announcement, trafficAnnouncement(false) callback
+     * should be called (just like it was ended in a normal way). Similarly for
+     * emergency announcement. If there was no announcement, then no action
+     * should be taken.
+     *
+     * There is a race condition between calling cancelAnnouncement and the
+     * actual announcement being finished, so trafficAnnouncement /
+     * emergencyAnnouncement callback should be tracked with proper locking.
+     *
+     * @return result OK if successfully cancelled announcement or there was
+     *                no announcement.
+     *                NOT_INITIALIZED if another error occurs.
+     */
+    cancelAnnouncement() generates (Result result);
+
+    /**
      * Retrieve current station information.
      * @return result OK if scan successfully started
      *                NOT_INITIALIZED if another error occurs
diff --git a/broadcastradio/1.1/ITunerCallback.hal b/broadcastradio/1.1/ITunerCallback.hal
index 158e217..b1c5b01 100644
--- a/broadcastradio/1.1/ITunerCallback.hal
+++ b/broadcastradio/1.1/ITunerCallback.hal
@@ -28,16 +28,26 @@
     /**
      * Method called by the HAL when a tuning operation completes
      * following a step(), scan() or tune() command.
+     *
+     * This callback supersedes V1_0::tuneComplete. For performance reasons,
+     * the 1.0 callback may not be called when HAL implementation detects 1.1
+     * client (by casting V1_0::ITunerCallback to V1_1::ITunerCallback).
+     *
      * @param result OK if tune succeeded or TIMEOUT in case of time out.
-     * @param info A ProgramInfo structure describing the tuned station.
+     * @param selector A ProgramSelector structure describing the tuned station.
      */
-    oneway tuneComplete_1_1(Result result, ProgramInfo info);
+    oneway tuneComplete_1_1(Result result, ProgramSelector selector);
 
     /**
      * Method called by the HAL when a frequency switch occurs.
-     * @param info A ProgramInfo structure describing the new tuned station.
+     *
+     * This callback supersedes V1_0::afSwitch. For performance reasons,
+     * the 1.0 callback may not be called when HAL implementation detects 1.1
+     * client (by casting V1_0::ITunerCallback to V1_1::ITunerCallback).
+     *
+     * @param selector A ProgramSelector structure describing the tuned station.
      */
-    oneway afSwitch_1_1(ProgramInfo info);
+    oneway afSwitch_1_1(ProgramSelector selector);
 
     /**
      * Called by the HAL when background scan feature becomes available or not.
@@ -69,4 +79,20 @@
      * Client may retrieve the actual list with ITuner::getProgramList.
      */
     oneway programListChanged();
+
+    /**
+     * Method called by the HAL when current program information (including
+     * metadata) is updated.
+     *
+     * Client may retrieve the actual program info with
+     * ITuner::getProgramInformation_1_1.
+     *
+     * This may be called together with tuneComplete_1_1 or afSwitch_1_1.
+     *
+     * This callback supersedes V1_0::tuneComplete, V1_0::afSwitch and
+     * newMetadata. For performance reasons, these callbacks may not be called
+     * when HAL implementation detects 1.1 client (by casting
+     * V1_0::ITunerCallback to V1_1::ITunerCallback).
+     */
+    oneway programInfoChanged();
 };
diff --git a/broadcastradio/1.1/WARNING b/broadcastradio/1.1/WARNING
deleted file mode 100644
index e867cfa..0000000
--- a/broadcastradio/1.1/WARNING
+++ /dev/null
@@ -1 +0,0 @@
-This is experimental interface, do not use it yet.
diff --git a/broadcastradio/1.1/default/BroadcastRadio.cpp b/broadcastradio/1.1/default/BroadcastRadio.cpp
index 3aac127..297dcc1 100644
--- a/broadcastradio/1.1/default/BroadcastRadio.cpp
+++ b/broadcastradio/1.1/default/BroadcastRadio.cpp
@@ -89,6 +89,16 @@
     prop10.numAudioSources = 1;
     prop10.supportsCapture = false;
     prop11.supportsBackgroundScanning = false;
+    prop11.supportedProgramTypes = vector<uint32_t>({
+        static_cast<uint32_t>(ProgramType::AM), static_cast<uint32_t>(ProgramType::FM),
+        static_cast<uint32_t>(ProgramType::AM_HD), static_cast<uint32_t>(ProgramType::FM_HD),
+    });
+    prop11.supportedIdentifierTypes = vector<uint32_t>({
+        static_cast<uint32_t>(IdentifierType::AMFM_FREQUENCY),
+        static_cast<uint32_t>(IdentifierType::RDS_PI),
+        static_cast<uint32_t>(IdentifierType::HD_STATION_ID_EXT),
+        static_cast<uint32_t>(IdentifierType::HD_SUBCHANNEL),
+    });
     prop11.vendorExension = "dummy";
 
     prop10.bands.resize(mConfig.amFmBands.size());
@@ -121,7 +131,7 @@
 Return<void> BroadcastRadio::openTuner(const BandConfig& config, bool audio __unused,
                                        const sp<V1_0::ITunerCallback>& callback,
                                        openTuner_cb _hidl_cb) {
-    ALOGV("%s", __func__);
+    ALOGV("%s(%s)", __func__, toString(config.type).c_str());
     lock_guard<mutex> lk(mMut);
 
     auto oldTuner = mTuner.promote();
diff --git a/broadcastradio/1.1/default/BroadcastRadioFactory.cpp b/broadcastradio/1.1/default/BroadcastRadioFactory.cpp
index c2c1158..f57bc79 100644
--- a/broadcastradio/1.1/default/BroadcastRadioFactory.cpp
+++ b/broadcastradio/1.1/default/BroadcastRadioFactory.cpp
@@ -48,7 +48,7 @@
 }
 
 Return<void> BroadcastRadioFactory::connectModule(Class classId, connectModule_cb _hidl_cb) {
-    ALOGV("%s", __func__);
+    ALOGV("%s(%s)", __func__, toString(classId).c_str());
 
     auto moduleIt = mRadioModules.find(classId);
     if (moduleIt == mRadioModules.end()) {
diff --git a/broadcastradio/1.1/default/Tuner.cpp b/broadcastradio/1.1/default/Tuner.cpp
index 9b39d36..271f633 100644
--- a/broadcastradio/1.1/default/Tuner.cpp
+++ b/broadcastradio/1.1/default/Tuner.cpp
@@ -20,6 +20,7 @@
 #include "BroadcastRadio.h"
 #include "Tuner.h"
 
+#include <Utils.h>
 #include <log/log.h>
 
 namespace android {
@@ -70,6 +71,8 @@
 
         mAmfmConfig = move(config);
         mAmfmConfig.antennaConnected = true;
+        mCurrentProgram = utils::make_selector(mAmfmConfig.type, mAmfmConfig.lowerLimit);
+
         mIsAmfmConfigSet = true;
         mCallback->configChange(Result::OK, mAmfmConfig);
     };
@@ -90,34 +93,43 @@
     return Void();
 }
 
-// makes ProgramInfo that points to no channel
-static ProgramInfo makeDummyProgramInfo(uint32_t channel) {
+// makes ProgramInfo that points to no program
+static ProgramInfo makeDummyProgramInfo(const ProgramSelector& selector) {
     ProgramInfo info11 = {};
     auto& info10 = info11.base;
 
-    info10.channel = channel;
+    utils::getLegacyChannel(selector, &info10.channel, &info10.subChannel);
+    info11.selector = selector;
     info11.flags |= ProgramInfoFlags::MUTED;
 
     return info11;
 }
 
-void Tuner::tuneInternalLocked() {
+bool Tuner::isFmLocked() {
+    if (!utils::isAmFm(utils::getType(mCurrentProgram))) return false;
+    return mAmfmConfig.type == Band::FM_HD || mAmfmConfig.type == Band::FM;
+}
+
+void Tuner::tuneInternalLocked(const ProgramSelector& sel) {
     VirtualRadio* virtualRadio = nullptr;
-    if (mAmfmConfig.type == Band::FM_HD || mAmfmConfig.type == Band::FM) {
+    if (isFmLocked()) {
         virtualRadio = &mVirtualFm;
     }
 
     VirtualProgram virtualProgram;
-    if (virtualRadio != nullptr && virtualRadio->getProgram(mCurrentProgram, virtualProgram)) {
+    if (virtualRadio != nullptr && virtualRadio->getProgram(sel, virtualProgram)) {
+        mCurrentProgram = virtualProgram.selector;
         mCurrentProgramInfo = static_cast<ProgramInfo>(virtualProgram);
     } else {
-        mCurrentProgramInfo = makeDummyProgramInfo(mCurrentProgram);
+        mCurrentProgram = sel;
+        mCurrentProgramInfo = makeDummyProgramInfo(sel);
     }
     mIsTuneCompleted = true;
 
-    mCallback->tuneComplete(Result::OK, mCurrentProgramInfo.base);
-    if (mCallback1_1 != nullptr) {
-        mCallback1_1->tuneComplete_1_1(Result::OK, mCurrentProgramInfo);
+    if (mCallback1_1 == nullptr) {
+        mCallback->tuneComplete(Result::OK, mCurrentProgramInfo.base);
+    } else {
+        mCallback1_1->tuneComplete_1_1(Result::OK, mCurrentProgramInfo.selector);
     }
 }
 
@@ -126,17 +138,18 @@
     lock_guard<mutex> lk(mMut);
     vector<VirtualProgram> list;
 
-    if (mAmfmConfig.type == Band::FM_HD || mAmfmConfig.type == Band::FM) {
+    if (isFmLocked()) {
         list = mVirtualFm.getProgramList();
     }
 
-    if (list.size() == 0) {
+    if (list.empty()) {
         mIsTuneCompleted = false;
         auto task = [this, direction]() {
             ALOGI("Performing failed scan %s", toString(direction).c_str());
 
-            mCallback->tuneComplete(Result::TIMEOUT, {});
-            if (mCallback1_1 != nullptr) {
+            if (mCallback1_1 == nullptr) {
+                mCallback->tuneComplete(Result::TIMEOUT, {});
+            } else {
                 mCallback1_1->tuneComplete_1_1(Result::TIMEOUT, {});
             }
         };
@@ -152,7 +165,7 @@
     auto found = lower_bound(list.begin(), list.end(), VirtualProgram({current}));
     if (direction == Direction::UP) {
         if (found < list.end() - 1) {
-            if (found->channel == current) found++;
+            if (utils::tunesTo(current, found->selector)) found++;
         } else {
             found = list.begin();
         }
@@ -163,25 +176,31 @@
             found = list.end() - 1;
         }
     }
-    auto tuneTo = found->channel;
+    auto tuneTo = found->selector;
 
     mIsTuneCompleted = false;
     auto task = [this, tuneTo, direction]() {
         ALOGI("Performing scan %s", toString(direction).c_str());
 
         lock_guard<mutex> lk(mMut);
-        mCurrentProgram = tuneTo;
-        tuneInternalLocked();
+        tuneInternalLocked(tuneTo);
     };
     mThread.schedule(task, gDefaultDelay.scan);
 
     return Result::OK;
 }
 
-Return<Result> Tuner::step(Direction direction, bool skipSubChannel __unused) {
+Return<Result> Tuner::step(Direction direction, bool skipSubChannel) {
     ALOGV("%s", __func__);
+    ALOGW_IF(!skipSubChannel, "can't step to next frequency without ignoring subChannel");
 
     lock_guard<mutex> lk(mMut);
+
+    if (!utils::isAmFm(utils::getType(mCurrentProgram))) {
+        ALOGE("Can't step in anything else than AM/FM");
+        return Result::NOT_INITIALIZED;
+    }
+
     ALOGW_IF(!mIsAmfmConfigSet, "AM/FM config not set");
     if (!mIsAmfmConfigSet) return Result::INVALID_STATE;
     mIsTuneCompleted = false;
@@ -191,57 +210,78 @@
 
         lock_guard<mutex> lk(mMut);
 
+        auto current = utils::getId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY, 0);
+
         if (direction == Direction::UP) {
-            mCurrentProgram += mAmfmConfig.spacings[0];
+            current += mAmfmConfig.spacings[0];
         } else {
-            mCurrentProgram -= mAmfmConfig.spacings[0];
+            current -= mAmfmConfig.spacings[0];
         }
 
-        if (mCurrentProgram > mAmfmConfig.upperLimit) mCurrentProgram = mAmfmConfig.lowerLimit;
-        if (mCurrentProgram < mAmfmConfig.lowerLimit) mCurrentProgram = mAmfmConfig.upperLimit;
+        if (current > mAmfmConfig.upperLimit) current = mAmfmConfig.lowerLimit;
+        if (current < mAmfmConfig.lowerLimit) current = mAmfmConfig.upperLimit;
 
-        tuneInternalLocked();
+        tuneInternalLocked(utils::make_selector(mAmfmConfig.type, current));
     };
     mThread.schedule(task, gDefaultDelay.step);
 
     return Result::OK;
 }
 
-Return<Result> Tuner::tune(uint32_t channel, uint32_t subChannel)  {
+Return<Result> Tuner::tune(uint32_t channel, uint32_t subChannel) {
     ALOGV("%s(%d, %d)", __func__, channel, subChannel);
+    Band band;
+    {
+        lock_guard<mutex> lk(mMut);
+        band = mAmfmConfig.type;
+    }
+    return tune_1_1(utils::make_selector(band, channel, subChannel));
+}
+
+Return<Result> Tuner::tune_1_1(const ProgramSelector& sel) {
+    ALOGV("%s(%s)", __func__, toString(sel).c_str());
 
     lock_guard<mutex> lk(mMut);
-    ALOGW_IF(!mIsAmfmConfigSet, "AM/FM config not set");
-    if (!mIsAmfmConfigSet) return Result::INVALID_STATE;
-    if (channel < mAmfmConfig.lowerLimit || channel > mAmfmConfig.upperLimit) {
-        return Result::INVALID_ARGUMENTS;
-    }
-    mIsTuneCompleted = false;
 
-    auto task = [this, channel]() {
+    if (utils::isAmFm(utils::getType(mCurrentProgram))) {
+        ALOGW_IF(!mIsAmfmConfigSet, "AM/FM config not set");
+        if (!mIsAmfmConfigSet) return Result::INVALID_STATE;
+
+        auto freq = utils::getId(sel, IdentifierType::AMFM_FREQUENCY);
+        if (freq < mAmfmConfig.lowerLimit || freq > mAmfmConfig.upperLimit) {
+            return Result::INVALID_ARGUMENTS;
+        }
+    }
+
+    mIsTuneCompleted = false;
+    auto task = [this, sel]() {
         lock_guard<mutex> lk(mMut);
-        mCurrentProgram = channel;
-        tuneInternalLocked();
+        tuneInternalLocked(sel);
     };
     mThread.schedule(task, gDefaultDelay.tune);
 
     return Result::OK;
 }
 
-Return<Result> Tuner::cancel()  {
+Return<Result> Tuner::cancel() {
     ALOGV("%s", __func__);
     mThread.cancelAll();
     return Result::OK;
 }
 
-Return<void> Tuner::getProgramInformation(getProgramInformation_cb _hidl_cb)  {
+Return<Result> Tuner::cancelAnnouncement() {
+    ALOGV("%s", __func__);
+    return Result::OK;
+}
+
+Return<void> Tuner::getProgramInformation(getProgramInformation_cb _hidl_cb) {
     ALOGV("%s", __func__);
     return getProgramInformation_1_1([&](Result result, const ProgramInfo& info) {
         _hidl_cb(result, info.base);
     });
 }
 
-Return<void> Tuner::getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb)  {
+Return<void> Tuner::getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb) {
     ALOGV("%s", __func__);
 
     lock_guard<mutex> lk(mMut);
@@ -260,14 +300,17 @@
 
 Return<void> Tuner::getProgramList(const hidl_string& filter __unused, getProgramList_cb _hidl_cb) {
     ALOGV("%s", __func__);
+    lock_guard<mutex> lk(mMut);
 
     auto& virtualRadio = mVirtualFm;
-    if (mAmfmConfig.type != Band::FM_HD && mAmfmConfig.type != Band::FM) {
+    if (!isFmLocked()) {
+        ALOGI("bands other than FM are not supported yet");
         _hidl_cb(ProgramListResult::OK, {});
         return Void();
     }
 
     auto list = virtualRadio.getProgramList();
+    ALOGD("returning a list of %zu programs", list.size());
     _hidl_cb(ProgramListResult::OK, vector<ProgramInfo>(list.begin(), list.end()));
     return Void();
 }
diff --git a/broadcastradio/1.1/default/Tuner.h b/broadcastradio/1.1/default/Tuner.h
index 7719d4d..2ab4f40 100644
--- a/broadcastradio/1.1/default/Tuner.h
+++ b/broadcastradio/1.1/default/Tuner.h
@@ -34,18 +34,21 @@
     void forceClose();
 
     // V1_1::ITuner methods
-    Return<Result> setConfiguration(const V1_0::BandConfig& config) override;
-    Return<void> getConfiguration(getConfiguration_cb _hidl_cb) override;
-    Return<Result> scan(V1_0::Direction direction, bool skipSubChannel) override;
-    Return<Result> step(V1_0::Direction direction, bool skipSubChannel) override;
-    Return<Result> tune(uint32_t channel, uint32_t subChannel) override;
-    Return<Result> cancel() override;
-    Return<void> getProgramInformation(getProgramInformation_cb _hidl_cb) override;
-    Return<void> getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb) override;
-    Return<ProgramListResult> startBackgroundScan() override;
-    Return<void> getProgramList(const hidl_string& filter, getProgramList_cb _hidl_cb) override;
-    Return<void> isAnalogForced(isAnalogForced_cb _hidl_cb) override;
-    Return<Result> setAnalogForced(bool isForced) override;
+    virtual Return<Result> setConfiguration(const V1_0::BandConfig& config) override;
+    virtual Return<void> getConfiguration(getConfiguration_cb _hidl_cb) override;
+    virtual Return<Result> scan(V1_0::Direction direction, bool skipSubChannel) override;
+    virtual Return<Result> step(V1_0::Direction direction, bool skipSubChannel) override;
+    virtual Return<Result> tune(uint32_t channel, uint32_t subChannel) override;
+    virtual Return<Result> tune_1_1(const ProgramSelector& program) override;
+    virtual Return<Result> cancel() override;
+    virtual Return<Result> cancelAnnouncement() override;
+    virtual Return<void> getProgramInformation(getProgramInformation_cb _hidl_cb) override;
+    virtual Return<void> getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb) override;
+    virtual Return<ProgramListResult> startBackgroundScan() override;
+    virtual Return<void> getProgramList(const hidl_string& filter,
+                                        getProgramList_cb _hidl_cb) override;
+    virtual Return<void> isAnalogForced(isAnalogForced_cb _hidl_cb) override;
+    virtual Return<Result> setAnalogForced(bool isForced) override;
 
    private:
     std::mutex mMut;
@@ -60,10 +63,11 @@
     bool mIsAmfmConfigSet = false;
     V1_0::BandConfig mAmfmConfig;
     bool mIsTuneCompleted = false;
-    uint32_t mCurrentProgram;  // TODO(b/32621193): Station Selector
+    ProgramSelector mCurrentProgram = {};
     ProgramInfo mCurrentProgramInfo = {};
 
-    void tuneInternalLocked();
+    void tuneInternalLocked(const ProgramSelector& sel);
+    bool isFmLocked();  // TODO(b/36864090): make it generic, not FM only
 };
 
 }  // namespace implementation
diff --git a/broadcastradio/1.1/default/VirtualProgram.cpp b/broadcastradio/1.1/default/VirtualProgram.cpp
index df12a3e..babf0d8 100644
--- a/broadcastradio/1.1/default/VirtualProgram.cpp
+++ b/broadcastradio/1.1/default/VirtualProgram.cpp
@@ -15,6 +15,8 @@
  */
 #include "VirtualProgram.h"
 
+#include <Utils.h>
+
 namespace android {
 namespace hardware {
 namespace broadcastradio {
@@ -29,10 +31,12 @@
     ProgramInfo info11 = {};
     auto& info10 = info11.base;
 
-    info10.channel = channel;
+    utils::getLegacyChannel(selector, &info10.channel, &info10.subChannel);
+    info11.selector = selector;
     info10.tuned = true;
     info10.stereo = true;
-    info10.signalStrength = 100;
+    info10.digital = utils::isDigital(selector);
+    info10.signalStrength = info10.digital ? 100 : 80;
 
     info10.metadata = hidl_vec<MetaData>({
         {MetadataType::TEXT, MetadataKey::RDS_PS, {}, {}, programName, {}},
@@ -43,8 +47,25 @@
     return info11;
 }
 
+// Defining order on virtual programs, how they appear on band.
+// It's mostly for default implementation purposes, may not be complete or correct.
 bool operator<(const VirtualProgram& lhs, const VirtualProgram& rhs) {
-    return lhs.channel < rhs.channel;
+    auto& l = lhs.selector;
+    auto& r = rhs.selector;
+
+    // Two programs with the same primaryId is considered the same.
+    if (l.programType != r.programType) return l.programType < r.programType;
+    if (l.primaryId.type != r.primaryId.type) return l.primaryId.type < r.primaryId.type;
+    if (l.primaryId.value != r.primaryId.value) return l.primaryId.value < r.primaryId.value;
+
+    // A little exception for HD Radio subchannel - we check secondary ID too.
+    if (utils::hasId(l, IdentifierType::HD_SUBCHANNEL) &&
+        utils::hasId(r, IdentifierType::HD_SUBCHANNEL)) {
+        return utils::getId(l, IdentifierType::HD_SUBCHANNEL) <
+               utils::getId(r, IdentifierType::HD_SUBCHANNEL);
+    }
+
+    return false;
 }
 
 }  // namespace implementation
diff --git a/broadcastradio/1.1/default/VirtualProgram.h b/broadcastradio/1.1/default/VirtualProgram.h
index 303513f..a4fd72c 100644
--- a/broadcastradio/1.1/default/VirtualProgram.h
+++ b/broadcastradio/1.1/default/VirtualProgram.h
@@ -26,7 +26,7 @@
 namespace implementation {
 
 struct VirtualProgram {
-    uint32_t channel;  // TODO(b/32621193): Station Selector
+    ProgramSelector selector;
 
     std::string programName = "";
     std::string songArtist = "";
diff --git a/broadcastradio/1.1/default/VirtualRadio.cpp b/broadcastradio/1.1/default/VirtualRadio.cpp
index 0eab7ae..acf37a4 100644
--- a/broadcastradio/1.1/default/VirtualRadio.cpp
+++ b/broadcastradio/1.1/default/VirtualRadio.cpp
@@ -15,25 +15,31 @@
  */
 #include "VirtualRadio.h"
 
+#include <Utils.h>
+
 namespace android {
 namespace hardware {
 namespace broadcastradio {
 namespace V1_1 {
 namespace implementation {
 
+using V1_0::Band;
+
 using std::lock_guard;
 using std::move;
 using std::mutex;
 using std::vector;
 
+using utils::make_selector;
+
 vector<VirtualProgram> gInitialFmPrograms{
-    {94900, "Wild 94.9", "Drake ft. Rihanna", "Too Good"},
-    {96500, "KOIT", "Celine Dion", "All By Myself"},
-    {97300, "Alice@97.3", "Drops of Jupiter", "Train"},
-    {99700, "99.7 Now!", "The Chainsmokers", "Closer"},
-    {101300, "101-3 KISS-FM", "Justin Timberlake", "Rock Your Body"},
-    {103700, "iHeart80s @ 103.7", "Michael Jackson", "Billie Jean"},
-    {106100, "106 KMEL", "Drake", "Marvins Room"},
+    {make_selector(Band::FM, 94900), "Wild 94.9", "Drake ft. Rihanna", "Too Good"},
+    {make_selector(Band::FM, 96500), "KOIT", "Celine Dion", "All By Myself"},
+    {make_selector(Band::FM, 97300), "Alice@97.3", "Drops of Jupiter", "Train"},
+    {make_selector(Band::FM, 99700), "99.7 Now!", "The Chainsmokers", "Closer"},
+    {make_selector(Band::FM, 101300), "101-3 KISS-FM", "Justin Timberlake", "Rock Your Body"},
+    {make_selector(Band::FM, 103700), "iHeart80s @ 103.7", "Michael Jackson", "Billie Jean"},
+    {make_selector(Band::FM, 106100), "106 KMEL", "Drake", "Marvins Room"},
 };
 
 VirtualRadio::VirtualRadio(VirtualRadio&& o) : mPrograms(move(o.mPrograms)) {}
@@ -45,10 +51,10 @@
     return mPrograms;
 }
 
-bool VirtualRadio::getProgram(uint32_t channel, VirtualProgram& programOut) {
+bool VirtualRadio::getProgram(const ProgramSelector& selector, VirtualProgram& programOut) {
     lock_guard<mutex> lk(mMut);
     for (auto&& program : mPrograms) {
-        if (program.channel == channel) {
+        if (utils::tunesTo(selector, program.selector)) {
             programOut = program;
             return true;
         }
diff --git a/broadcastradio/1.1/default/VirtualRadio.h b/broadcastradio/1.1/default/VirtualRadio.h
index e1918a0..23cb06c 100644
--- a/broadcastradio/1.1/default/VirtualRadio.h
+++ b/broadcastradio/1.1/default/VirtualRadio.h
@@ -33,7 +33,7 @@
     VirtualRadio(std::vector<VirtualProgram> initialList);
 
     std::vector<VirtualProgram> getProgramList();
-    bool getProgram(uint32_t channel, VirtualProgram& program);
+    bool getProgram(const ProgramSelector& selector, VirtualProgram& program);
 
    private:
     std::mutex mMut;
diff --git a/broadcastradio/1.1/types.hal b/broadcastradio/1.1/types.hal
index 5577ea0..5b5d4f7 100644
--- a/broadcastradio/1.1/types.hal
+++ b/broadcastradio/1.1/types.hal
@@ -43,6 +43,17 @@
      * increasing volume too much.
      */
     MUTED = 1 << 1,
+
+    /**
+     * Station broadcasts traffic information regularly,
+     * but not necessarily right now.
+     */
+    TRAFFIC_PROGRAM = 1 << 2,
+
+    /**
+     * Station is broadcasting traffic information at the very moment.
+     */
+    TRAFFIC_ANNOUNCEMENT = 1 << 3,
 };
 
 struct Properties {
@@ -55,6 +66,29 @@
     bool supportsBackgroundScanning;
 
     /**
+     * A list of supported ProgramType values.
+     *
+     * If a program type is supported by radio module, it means it can tune
+     * to ProgramSelector of a given type.
+     *
+     * Support for VENDOR program type does not guarantee compatibility, as
+     * other module properties (implementor, product, version) must be checked.
+     */
+    vec<uint32_t> supportedProgramTypes;
+
+    /**
+     * A list of supported IdentifierType values.
+     *
+     * If an identifier is supported by radio module, it means it can use it for
+     * tuning to ProgramSelector with either primary or secondary Identifier of
+     * a given type.
+     *
+     * Support for VENDOR identifier type does not guarantee compatibility, as
+     * other module properties (implementor, product, version) must be checked.
+     */
+    vec<uint32_t> supportedIdentifierTypes;
+
+    /**
      * Opaque vendor-specific string, to be passed to front-end without changes.
      * Format of this string can vary across vendors.
      *
@@ -68,11 +102,177 @@
 };
 
 /**
+ * Type of modulation.
+ *
+ * Used as a value for DRMO_MODULATION IdentifierType.
+ */
+enum Modulation : uint32_t {
+    AM = 1,
+    FM,
+};
+
+/**
+ * Type of a radio technology.
+ *
+ * There are multiple VENDOR program types just to make vendor implementation
+ * easier with multiple properitary radio technologies. They are treated the
+ * same by the framework.
+ *
+ * All other values are reserved for future use.
+ */
+enum ProgramType : uint32_t {
+    AM = 1,  // analogue AM radio (with or without RDS)
+    FM,      // analogue FM radio (with or without RDS)
+    AM_HD,   // AM HD Radio
+    FM_HD,   // FM HD Radio
+    DAB,     // Digital audio broadcasting
+    DRMO,    // Digital Radio Mondiale
+    SXM,     // SiriusXM Satellite Radio
+    VENDOR1, // Vendor-specific, not synced across devices.
+    VENDOR2, // Vendor-specific, not synced across devices.
+    VENDOR3, // Vendor-specific, not synced across devices.
+    VENDOR4, // Vendor-specific, not synced across devices.
+};
+
+/**
+ * Type of program identifier component.
+ *
+ * It MUST match the radio technology for primary ID but does not have to match
+ * it for secondary IDs. For example, a satellite program may set AM/FM fallback
+ * frequency, if a station broadcasts both via satellite and AM/FM.
+ *
+ * The value format for each (but VENDOR_PRIMARY) identifier is strictly defined
+ * to maintain interoperability between devices made by different vendors.
+ *
+ * All other values are reserved for future use.
+ */
+enum IdentifierType : uint32_t {
+    AMFM_FREQUENCY = 1,  // kHz
+    RDS_PI,              // 16bit
+
+    /**
+     * 64bit compound primary identifier for HD Radio.
+     *
+     * Consists of (from the LSB):
+     * - 32bit: Station ID number;
+     * - 4bit: HD_SUBCHANNEL;
+     * - 18bit: AMFM_FREQUENCY.
+     * The remaining bits should be set to zeros when writing on the chip side
+     * and ignored when read.
+     */
+    HD_STATION_ID_EXT,
+
+    /**
+     * HD Radio subchannel - a value of range 0-7.
+     *
+     * The subchannel index is 0-based (where 0 is MPS and 1..7 are SPS),
+     * as opposed to HD Radio standard (where it's 1-based).
+     */
+    HD_SUBCHANNEL,
+
+    /**
+     * 24bit compound primary identifier for DAB.
+     *
+     * Consists of (from the LSB):
+     * - 16bit: SId;
+     * - 8bit: ECC code.
+     * The remaining bits should be set to zeros when writing on the chip side
+     * and ignored when read.
+     */
+    DAB_SIDECC,
+
+    DAB_ENSEMBLE,     // 16bit
+    DAB_SCID,         // 12bit
+    DAB_FREQUENCY,    // kHz
+    DRMO_SERVICE_ID,  // 24bit
+    DRMO_FREQUENCY,   // kHz
+    DRMO_MODULATION,  // Modulation enum
+    SXM_SERVICE_ID,   // 32bit
+    SXM_CHANNEL,      // 0-999 range
+
+    /**
+     * Primary identifier for vendor-specific radio technology.
+     * The value format is determined by a vendor.
+     *
+     * It must not be used in any other programType than VENDORx.
+     */
+    VENDOR1_PRIMARY,
+    VENDOR2_PRIMARY,
+    VENDOR3_PRIMARY,
+    VENDOR4_PRIMARY,
+};
+
+/**
+ * A single program identifier component, eg. frequency or channel ID.
+ *
+ * The uint32_t type field maps to IdentifierType enum. It's not straight,
+ * because the enum may be extended in future versions of the HAL. Values out of
+ * the enum range must not be used when writing and ignored when reading.
+ *
+ * The uint64_t value field holds the value in format described in comments for
+ * IdentifierType enum.
+ */
+struct ProgramIdentifier {
+    uint32_t type;  // IdentifierType
+    uint64_t value;
+};
+
+/**
+ * A set of identifiers necessary to tune to a given station.
+ *
+ * This can hold various identifiers, like
+ * - AM/FM frequency
+ * - HD Radio subchannel
+ * - DAB channel info
+ *
+ * The uint32_t programType field maps to ProgramType enum. It's not straight,
+ * because the enum may be extended in future versions of the HAL. Values out of
+ * the enum range must not be used when writing and ignored when reading.
+ *
+ * The primary ID uniquely identifies a station and can be used for equality
+ * check. The secondary IDs are supplementary and can speed up tuning process,
+ * but the primary ID is sufficient (ie. after a full band scan).
+ *
+ * Two selectors with different secondary IDs, but the same primary ID are
+ * considered equal. In particular, secondary IDs vector may get updated for
+ * an entry on the program list (ie. when a better frequency for a given
+ * station is found).
+ *
+ * The primaryId of a given programType MUST be of a specific type:
+ * - AM, FM: RDS_PI if the station broadcasts RDS, AMFM_FREQUENCY otherwise;
+ * - AM_HD, FM_HD: HD_STATION_ID_EXT;
+ * - DAB: DAB_SIDECC;
+ * - DRMO: DRMO_SERVICE_ID;
+ * - SXM: SXM_SERVICE_ID;
+ * - VENDOR: VENDOR_PRIMARY.
+ */
+struct ProgramSelector {
+    uint32_t programType;  // ProgramType
+    ProgramIdentifier primaryId;  // uniquely identifies a station
+    vec<ProgramIdentifier> secondaryIds;
+
+    /**
+     * Opaque vendor-specific identifiers, to be passed to front-end
+     * without changes.
+     *
+     * The order is meaningful, ie. the first element may be defined as
+     * frequency, second as the subchannel etc.
+     *
+     * The vector is not serialized (either locally or to the cloud),
+     * unless it's a VENDOR program type.
+     */
+    vec<uint64_t> vendorIds;
+};
+
+/**
  * Radio program information. Returned by the HAL with event RADIO_EVENT_TUNED.
  * Contains information on currently tuned channel.
  */
 struct ProgramInfo {
     @1.0::ProgramInfo base;
+
+    ProgramSelector selector;
+
     bitfield<ProgramInfoFlags> flags;
 
     /**
diff --git a/broadcastradio/1.1/utils/Android.bp b/broadcastradio/1.1/utils/Android.bp
index fab6517..73c6680 100644
--- a/broadcastradio/1.1/utils/Android.bp
+++ b/broadcastradio/1.1/utils/Android.bp
@@ -16,7 +16,7 @@
 
 cc_library_static {
     name: "android.hardware.broadcastradio@1.1-utils-lib",
-    vendor: true,
+    vendor_available: true,
     relative_install_path: "hw",
     cflags: [
         "-Wall",
@@ -24,7 +24,11 @@
         "-Werror",
     ],
     srcs: [
+        "Utils.cpp",
         "WorkerThread.cpp",
     ],
     export_include_dirs: ["."],
+    shared_libs: [
+        "android.hardware.broadcastradio@1.1",
+    ],
 }
diff --git a/broadcastradio/1.1/utils/Utils.cpp b/broadcastradio/1.1/utils/Utils.cpp
new file mode 100644
index 0000000..f8a4479
--- /dev/null
+++ b/broadcastradio/1.1/utils/Utils.cpp
@@ -0,0 +1,213 @@
+/*
+ * 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 "BroadcastRadioDefault.utils"
+//#define LOG_NDEBUG 0
+
+#include "Utils.h"
+
+#include <log/log.h>
+
+namespace android {
+namespace hardware {
+namespace broadcastradio {
+namespace V1_1 {
+namespace utils {
+
+using V1_0::Band;
+
+static bool isCompatibleProgramType(const uint32_t ia, const uint32_t ib) {
+    auto a = static_cast<ProgramType>(ia);
+    auto b = static_cast<ProgramType>(ib);
+
+    if (a == b) return true;
+    if (a == ProgramType::AM && b == ProgramType::AM_HD) return true;
+    if (a == ProgramType::AM_HD && b == ProgramType::AM) return true;
+    if (a == ProgramType::FM && b == ProgramType::FM_HD) return true;
+    if (a == ProgramType::FM_HD && b == ProgramType::FM) return true;
+    return false;
+}
+
+static bool bothHaveId(const ProgramSelector& a, const ProgramSelector& b,
+                       const IdentifierType type) {
+    return hasId(a, type) && hasId(b, type);
+}
+
+static bool anyHaveId(const ProgramSelector& a, const ProgramSelector& b,
+                      const IdentifierType type) {
+    return hasId(a, type) || hasId(b, type);
+}
+
+static bool haveEqualIds(const ProgramSelector& a, const ProgramSelector& b,
+                         const IdentifierType type) {
+    if (!bothHaveId(a, b, type)) return false;
+    // TODO(b/36864090): we should check all Ids of a given type (ie. other AF), not just one
+    auto aId = getId(a, type);
+    auto bId = getId(b, type);
+    return aId == bId;
+}
+
+bool tunesTo(const ProgramSelector& a, const ProgramSelector& b) {
+    if (!isCompatibleProgramType(a.programType, b.programType)) return false;
+
+    auto type = getType(a);
+
+    switch (type) {
+        case ProgramType::AM:
+        case ProgramType::AM_HD:
+        case ProgramType::FM:
+        case ProgramType::FM_HD:
+            if (haveEqualIds(a, b, IdentifierType::HD_STATION_ID_EXT)) return true;
+
+            // if HD Radio subchannel is specified, it must match
+            if (anyHaveId(a, b, IdentifierType::HD_SUBCHANNEL)) {
+                // missing subchannel (analog) is an equivalent of first subchannel (MPS)
+                auto aCh = getId(a, IdentifierType::HD_SUBCHANNEL, 0);
+                auto bCh = getId(b, IdentifierType::HD_SUBCHANNEL, 0);
+                if (aCh != bCh) return false;
+            }
+
+            if (haveEqualIds(a, b, IdentifierType::RDS_PI)) return true;
+
+            return haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY);
+        case ProgramType::DAB:
+            return haveEqualIds(a, b, IdentifierType::DAB_SIDECC);
+        case ProgramType::DRMO:
+            return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID);
+        case ProgramType::SXM:
+            if (anyHaveId(a, b, IdentifierType::SXM_SERVICE_ID)) {
+                return haveEqualIds(a, b, IdentifierType::SXM_SERVICE_ID);
+            }
+            return haveEqualIds(a, b, IdentifierType::SXM_CHANNEL);
+        case ProgramType::VENDOR1:
+        case ProgramType::VENDOR2:
+        case ProgramType::VENDOR3:
+        case ProgramType::VENDOR4:
+        default:
+            ALOGW("Unsupported program type: %s", toString(type).c_str());
+            return false;
+    }
+}
+
+ProgramType getType(const ProgramSelector& sel) {
+    return static_cast<ProgramType>(sel.programType);
+}
+
+bool isAmFm(const ProgramType type) {
+    switch (type) {
+        case ProgramType::AM:
+        case ProgramType::FM:
+        case ProgramType::AM_HD:
+        case ProgramType::FM_HD:
+            return true;
+        default:
+            return false;
+    }
+}
+
+bool hasId(const ProgramSelector& sel, const IdentifierType type) {
+    auto itype = static_cast<uint32_t>(type);
+    if (sel.primaryId.type == itype) return true;
+    // not optimal, but we don't care in default impl
+    for (auto&& id : sel.secondaryIds) {
+        if (id.type == itype) return true;
+    }
+    return false;
+}
+
+uint64_t getId(const ProgramSelector& sel, const IdentifierType type) {
+    auto itype = static_cast<uint32_t>(type);
+    if (sel.primaryId.type == itype) return sel.primaryId.value;
+    // not optimal, but we don't care in default impl
+    for (auto&& id : sel.secondaryIds) {
+        if (id.type == itype) return id.value;
+    }
+    ALOGW("Identifier %s not found", toString(type).c_str());
+    return 0;
+}
+
+uint64_t getId(const ProgramSelector& sel, const IdentifierType type, uint64_t defval) {
+    if (!hasId(sel, type)) return defval;
+    return getId(sel, type);
+}
+
+ProgramSelector make_selector(Band band, uint32_t channel, uint32_t subChannel) {
+    ProgramSelector sel = {};
+
+    ALOGW_IF((subChannel > 0) && (band == Band::AM || band == Band::FM),
+             "got subChannel for non-HD AM/FM");
+
+    // we can't use ProgramType::AM_HD or FM_HD, because we don't know HD station ID
+    ProgramType type;
+    switch (band) {
+        case Band::AM:
+        case Band::AM_HD:
+            type = ProgramType::AM;
+            break;
+        case Band::FM:
+        case Band::FM_HD:
+            type = ProgramType::FM;
+            break;
+        default:
+            LOG_ALWAYS_FATAL("Unsupported band: %s", toString(band).c_str());
+    }
+
+    sel.programType = static_cast<uint32_t>(type);
+    sel.primaryId.type = static_cast<uint32_t>(IdentifierType::AMFM_FREQUENCY);
+    sel.primaryId.value = channel;
+    if (subChannel > 0) {
+        /* stating sub channel for AM/FM channel does not give any guarantees,
+         * but we can't do much more without HD station ID
+         *
+         * The legacy APIs had 1-based subChannels, while ProgramSelector is 0-based.
+         */
+        sel.secondaryIds = hidl_vec<ProgramIdentifier>{
+            {static_cast<uint32_t>(IdentifierType::HD_SUBCHANNEL), subChannel - 1},
+        };
+    }
+
+    return sel;
+}
+
+bool getLegacyChannel(const ProgramSelector& sel, uint32_t* channelOut, uint32_t* subChannelOut) {
+    if (channelOut) *channelOut = 0;
+    if (subChannelOut) *subChannelOut = 0;
+    if (isAmFm(getType(sel))) {
+        if (channelOut) *channelOut = getId(sel, IdentifierType::AMFM_FREQUENCY);
+        if (subChannelOut && hasId(sel, IdentifierType::HD_SUBCHANNEL)) {
+            // The legacy APIs had 1-based subChannels, while ProgramSelector is 0-based.
+            *subChannelOut = getId(sel, IdentifierType::HD_SUBCHANNEL) + 1;
+        }
+        return true;
+    }
+    return false;
+}
+
+bool isDigital(const ProgramSelector& sel) {
+    switch (getType(sel)) {
+        case ProgramType::AM:
+        case ProgramType::FM:
+            return false;
+        default:
+            // VENDOR might not be digital, but it doesn't matter for default impl.
+            return true;
+    }
+}
+
+}  // namespace utils
+}  // namespace V1_1
+}  // namespace broadcastradio
+}  // namespace hardware
+}  // namespace android
diff --git a/broadcastradio/1.1/utils/Utils.h b/broadcastradio/1.1/utils/Utils.h
new file mode 100644
index 0000000..cd86ffa
--- /dev/null
+++ b/broadcastradio/1.1/utils/Utils.h
@@ -0,0 +1,73 @@
+/*
+ * 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_BROADCASTRADIO_V1_1_UTILS_H
+#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_UTILS_H
+
+#include <android/hardware/broadcastradio/1.1/types.h>
+#include <chrono>
+#include <queue>
+#include <thread>
+
+namespace android {
+namespace hardware {
+namespace broadcastradio {
+namespace V1_1 {
+namespace utils {
+
+/**
+ * Checks, if {@code pointer} tunes to {@channel}.
+ *
+ * For example, having a channel {AMFM_FREQUENCY = 103.3}:
+ * - selector {AMFM_FREQUENCY = 103.3, HD_SUBCHANNEL = 0} can tune to this channel;
+ * - selector {AMFM_FREQUENCY = 103.3, HD_SUBCHANNEL = 1} can't.
+ *
+ * @param pointer selector we're trying to match against channel.
+ * @param channel existing channel.
+ */
+bool tunesTo(const ProgramSelector& pointer, const ProgramSelector& channel);
+
+ProgramType getType(const ProgramSelector& sel);
+bool isAmFm(const ProgramType type);
+
+bool hasId(const ProgramSelector& sel, const IdentifierType type);
+
+/**
+ * Returns ID (either primary or secondary) for a given program selector.
+ *
+ * If the selector does not contain given type, returns 0 and emits a warning.
+ */
+uint64_t getId(const ProgramSelector& sel, const IdentifierType type);
+
+/**
+ * Returns ID (either primary or secondary) for a given program selector.
+ *
+ * If the selector does not contain given type, returns default value.
+ */
+uint64_t getId(const ProgramSelector& sel, const IdentifierType type, uint64_t defval);
+
+ProgramSelector make_selector(V1_0::Band band, uint32_t channel, uint32_t subChannel = 0);
+
+bool getLegacyChannel(const ProgramSelector& sel, uint32_t* channelOut, uint32_t* subChannelOut);
+
+bool isDigital(const ProgramSelector& sel);
+
+}  // namespace utils
+}  // namespace V1_1
+}  // namespace broadcastradio
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_UTILS_H
diff --git a/broadcastradio/1.1/vts/functional/Android.bp b/broadcastradio/1.1/vts/functional/Android.bp
index a4c0849..c136019 100644
--- a/broadcastradio/1.1/vts/functional/Android.bp
+++ b/broadcastradio/1.1/vts/functional/Android.bp
@@ -29,9 +29,27 @@
         "android.hardware.broadcastradio@1.0",
         "android.hardware.broadcastradio@1.1",
     ],
-    static_libs: ["VtsHalHidlTargetTestBase"],
+    static_libs: [
+        "VtsHalHidlTargetTestBase",
+        "broadcastradio-vts-call-barrier",
+        "libgmock",
+    ],
     cflags: [
+        "-Wextra",
         "-O0",
         "-g",
     ],
 }
+
+cc_library_static {
+    name: "broadcastradio-vts-call-barrier",
+    srcs: [
+        "call-barrier.cpp",
+    ],
+    export_include_dirs: ["."],
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+}
diff --git a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
index b45c8d5..9e7c00b 100644
--- a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
+++ b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
@@ -14,462 +14,298 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "BroadcastRadioHidlHalTest"
+#define LOG_TAG "broadcastradio.vts"
+
 #include <VtsHalHidlTargetTestBase.h>
 #include <android-base/logging.h>
+#include <call-barrier.h>
 #include <cutils/native_handle.h>
 #include <cutils/properties.h>
+#include <gmock/gmock.h>
 #include <hidl/HidlTransportSupport.h>
 #include <utils/threads.h>
 
+#include <chrono>
+
+#include <android/hardware/broadcastradio/1.1/IBroadcastRadio.h>
 #include <android/hardware/broadcastradio/1.1/IBroadcastRadioFactory.h>
-#include <android/hardware/broadcastradio/1.0/IBroadcastRadio.h>
 #include <android/hardware/broadcastradio/1.1/ITuner.h>
 #include <android/hardware/broadcastradio/1.1/ITunerCallback.h>
 #include <android/hardware/broadcastradio/1.1/types.h>
 
+#include "mock-timeout.h"
 
-namespace V1_0 = ::android::hardware::broadcastradio::V1_0;
+namespace android {
+namespace hardware {
+namespace broadcastradio {
+namespace V1_1 {
+namespace vts {
 
-using ::android::sp;
-using ::android::Mutex;
-using ::android::Condition;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::hardware::broadcastradio::V1_0::BandConfig;
-using ::android::hardware::broadcastradio::V1_0::Class;
-using ::android::hardware::broadcastradio::V1_0::Direction;
-using ::android::hardware::broadcastradio::V1_0::IBroadcastRadio;
-using ::android::hardware::broadcastradio::V1_0::MetaData;
-using ::android::hardware::broadcastradio::V1_0::Properties;
-using ::android::hardware::broadcastradio::V1_1::IBroadcastRadioFactory;
-using ::android::hardware::broadcastradio::V1_1::ITuner;
-using ::android::hardware::broadcastradio::V1_1::ITunerCallback;
-using ::android::hardware::broadcastradio::V1_1::ProgramInfo;
-using ::android::hardware::broadcastradio::V1_1::Result;
-using ::android::hardware::broadcastradio::V1_1::ProgramListResult;
+using namespace std::chrono_literals;
 
+using testing::_;
+using testing::AnyNumber;
+using testing::ByMove;
+using testing::DoAll;
+using testing::Invoke;
+using testing::SaveArg;
 
-// The main test class for Broadcast Radio HIDL HAL.
+using broadcastradio::vts::CallBarrier;
+using V1_0::BandConfig;
+using V1_0::Class;
+using V1_0::MetaData;
 
-class BroadcastRadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- protected:
-    virtual void SetUp() override {
-        auto factory = ::testing::VtsHalHidlTargetTestBase::getService<IBroadcastRadioFactory>();
-        ASSERT_NE(nullptr, factory.get());
-        Result halResult;
-        factory->connectModule(Class::AM_FM, [&](Result retval, const sp<IBroadcastRadio>& result) {
-            halResult = retval;
-            if (retval == Result::OK) {
-                mRadio = IBroadcastRadio::castFrom(result);
-            }
-        });
-        ASSERT_EQ(Result::OK, halResult);
-        mTunerCallback = new MyCallback(this);
-        ASSERT_NE(nullptr, mRadio.get());
-        ASSERT_NE(nullptr, mTunerCallback.get());
-    }
+static constexpr auto kConfigTimeout = 10s;
+static constexpr auto kConnectModuleTimeout = 1s;
+static constexpr auto kTuneTimeout = 30s;
+static constexpr auto kFullScanTimeout = 1min;
 
-    virtual void TearDown() override {
-        mTuner.clear();
-        mRadio.clear();
-    }
-
-    class MyCallback : public ITunerCallback {
-     public:
-
-        // ITunerCallback methods (see doc in ITunerCallback.hal)
-        virtual Return<void> hardwareFailure() {
-            ALOGI("%s", __FUNCTION__);
-            mParentTest->onHwFailureCallback();
-            return Void();
-        }
-
-        virtual Return<void> configChange(Result result, const BandConfig& config __unused) {
-            ALOGI("%s result %d", __FUNCTION__, result);
-            mParentTest->onResultCallback(result);
-            return Void();
-        }
-
-        virtual Return<void> tuneComplete(Result result __unused, const V1_0::ProgramInfo& info __unused) {
-            return Void();
-        }
-
-        virtual Return<void> tuneComplete_1_1(Result result, const ProgramInfo& info __unused) {
-            ALOGI("%s result %d", __FUNCTION__, result);
-            mParentTest->onResultCallback(result);
-            return Void();
-        }
-
-        virtual Return<void> afSwitch(const V1_0::ProgramInfo& info __unused) {
-            return Void();
-        }
-
-        virtual Return<void> afSwitch_1_1(const ProgramInfo& info __unused) {
-            return Void();
-        }
-
-        virtual Return<void> antennaStateChange(bool connected) {
-            ALOGI("%s connected %d", __FUNCTION__, connected);
-            return Void();
-        }
-
-        virtual Return<void> trafficAnnouncement(bool active) {
-            ALOGI("%s active %d", __FUNCTION__, active);
-            return Void();
-        }
-
-        virtual Return<void> emergencyAnnouncement(bool active) {
-            ALOGI("%s active %d", __FUNCTION__, active);
-            return Void();
-        }
-
-        virtual Return<void> newMetadata(uint32_t channel __unused, uint32_t subChannel __unused,
-                           const ::android::hardware::hidl_vec<MetaData>& metadata __unused) {
-            ALOGI("%s", __FUNCTION__);
-            return Void();
-        }
-
-        virtual Return<void> backgroundScanAvailable(bool isAvailable __unused) {
-            return Void();
-        }
-
-        virtual Return<void> backgroundScanComplete(ProgramListResult result __unused) {
-            return Void();
-        }
-
-        virtual Return<void> programListChanged() {
-            return Void();
-        }
-
-                MyCallback(BroadcastRadioHidlTest *parentTest) : mParentTest(parentTest) {}
-
-     private:
-        // BroadcastRadioHidlTest instance to which callbacks will be notified.
-        BroadcastRadioHidlTest *mParentTest;
-    };
-
-
-    /**
-     * Method called by MyCallback when a callback with no status or boolean value is received
-     */
-    void onCallback() {
-        Mutex::Autolock _l(mLock);
-        onCallback_l();
-    }
-
-    /**
-     * Method called by MyCallback when hardwareFailure() callback is received
-     */
-    void onHwFailureCallback() {
-        Mutex::Autolock _l(mLock);
-        mHwFailure = true;
-        onCallback_l();
-    }
-
-    /**
-     * Method called by MyCallback when a callback with status is received
-     */
-    void onResultCallback(Result result) {
-        Mutex::Autolock _l(mLock);
-        mResultCallbackData = result;
-        onCallback_l();
-    }
-
-    /**
-     * Method called by MyCallback when a boolean indication is received
-     */
-    void onBoolCallback(bool result) {
-        Mutex::Autolock _l(mLock);
-        mBoolCallbackData = result;
-        onCallback_l();
-    }
-
-
-        BroadcastRadioHidlTest() :
-            mCallbackCalled(false), mBoolCallbackData(false),
-            mResultCallbackData(Result::OK), mHwFailure(false) {}
-
-    void onCallback_l() {
-        if (!mCallbackCalled) {
-            mCallbackCalled = true;
-            mCallbackCond.broadcast();
-        }
-    }
-
-
-    bool waitForCallback(nsecs_t reltime = 0) {
-        Mutex::Autolock _l(mLock);
-        nsecs_t endTime = systemTime() + reltime;
-        while (!mCallbackCalled) {
-            if (reltime == 0) {
-                mCallbackCond.wait(mLock);
-            } else {
-                nsecs_t now = systemTime();
-                if (now > endTime) {
-                    return false;
-                }
-                mCallbackCond.waitRelative(mLock, endTime - now);
-            }
-        }
-        return true;
-    }
-
-    bool getProperties();
-    bool openTuner();
-    bool checkAntenna();
-
-    static const nsecs_t kConfigCallbacktimeoutNs = seconds_to_nanoseconds(10);
-    static const nsecs_t kTuneCallbacktimeoutNs = seconds_to_nanoseconds(30);
-
-    sp<IBroadcastRadio> mRadio;
-    Properties mHalProperties;
-    sp<ITuner> mTuner;
-    sp<MyCallback> mTunerCallback;
-    Mutex mLock;
-    Condition mCallbackCond;
-    bool mCallbackCalled;
-    bool mBoolCallbackData;
-    Result mResultCallbackData;
-    bool mHwFailure;
-};
-
-// A class for test environment setup (kept since this file is a template).
-class BroadcastRadioHidlEnvironment : public ::testing::Environment {
- public:
-    virtual void SetUp() {}
-    virtual void TearDown() {}
-};
-
-bool BroadcastRadioHidlTest::getProperties()
-{
-    if (mHalProperties.bands.size() == 0) {
-        Result halResult = Result::NOT_INITIALIZED;
-        Return<void> hidlReturn =
-                mRadio->getProperties([&](Result result, const Properties& properties) {
-                        halResult = result;
-                        if (result == Result::OK) {
-                            mHalProperties = properties;
-                        }
-                    });
-
-        EXPECT_TRUE(hidlReturn.isOk());
-        EXPECT_EQ(Result::OK, halResult);
-        EXPECT_EQ(Class::AM_FM, mHalProperties.classId);
-        EXPECT_GT(mHalProperties.numTuners, 0u);
-        EXPECT_GT(mHalProperties.bands.size(), 0u);
-    }
-    return mHalProperties.bands.size() > 0;
+static void printSkipped(std::string msg) {
+    std::cout << "[  SKIPPED ] " << msg << std::endl;
 }
 
-bool BroadcastRadioHidlTest::openTuner()
-{
-    if (!getProperties()) {
-        return false;
+struct TunerCallbackMock : public ITunerCallback {
+    TunerCallbackMock() { EXPECT_CALL(*this, hardwareFailure()).Times(0); }
+
+    MOCK_METHOD0(hardwareFailure, Return<void>());
+    MOCK_TIMEOUT_METHOD2(configChange, Return<void>(Result, const BandConfig&));
+    MOCK_METHOD2(tuneComplete, Return<void>(Result, const V1_0::ProgramInfo&));
+    MOCK_TIMEOUT_METHOD2(tuneComplete_1_1, Return<void>(Result, const ProgramSelector&));
+    MOCK_METHOD1(afSwitch, Return<void>(const V1_0::ProgramInfo&));
+    MOCK_METHOD1(afSwitch_1_1, Return<void>(const ProgramSelector&));
+    MOCK_METHOD1(antennaStateChange, Return<void>(bool connected));
+    MOCK_METHOD1(trafficAnnouncement, Return<void>(bool active));
+    MOCK_METHOD1(emergencyAnnouncement, Return<void>(bool active));
+    MOCK_METHOD3(newMetadata, Return<void>(uint32_t ch, uint32_t subCh, const hidl_vec<MetaData>&));
+    MOCK_METHOD1(backgroundScanAvailable, Return<void>(bool));
+    MOCK_TIMEOUT_METHOD1(backgroundScanComplete, Return<void>(ProgramListResult));
+    MOCK_METHOD0(programListChanged, Return<void>());
+    MOCK_METHOD0(programInfoChanged, Return<void>());
+};
+
+class BroadcastRadioHalTest : public ::testing::VtsHalHidlTargetTestBase,
+                              public ::testing::WithParamInterface<Class> {
+   protected:
+    virtual void SetUp() override;
+    virtual void TearDown() override;
+
+    // TODO(b/36864490): check all bands for good test conditions (ie. FM is more likely to have
+    // any stations on the list, so don't pick AM blindly).
+    bool openTuner(unsigned band);
+    const BandConfig& getBand(unsigned idx);
+
+    Class radioClass;
+    bool skipped = false;
+
+    sp<IBroadcastRadio> mRadioModule;
+    sp<ITuner> mTuner;
+    sp<TunerCallbackMock> mCallback = new TunerCallbackMock();
+
+   private:
+    hidl_vec<BandConfig> mBands;
+};
+
+void BroadcastRadioHalTest::SetUp() {
+    radioClass = GetParam();
+
+    // lookup HIDL service
+    auto factory = getService<IBroadcastRadioFactory>();
+    ASSERT_NE(nullptr, factory.get());
+
+    // connect radio module
+    Result connectResult;
+    CallBarrier onConnect;
+    factory->connectModule(radioClass, [&](Result ret, const sp<V1_0::IBroadcastRadio>& radio) {
+        connectResult = ret;
+        if (ret == Result::OK) mRadioModule = IBroadcastRadio::castFrom(radio);
+        onConnect.call();
+    });
+    ASSERT_TRUE(onConnect.waitForCall(kConnectModuleTimeout));
+
+    if (connectResult == Result::INVALID_ARGUMENTS) {
+        printSkipped("This device class is not supported.");
+        skipped = true;
+        return;
     }
-    if (mTuner.get() == nullptr) {
+    ASSERT_EQ(connectResult, Result::OK);
+    ASSERT_NE(nullptr, mRadioModule.get());
+
+    // get module properties
+    Properties prop11;
+    auto& prop10 = prop11.base;
+    auto propResult =
+        mRadioModule->getProperties_1_1([&](const Properties& properties) { prop11 = properties; });
+
+    ASSERT_TRUE(propResult.isOk());
+    EXPECT_EQ(radioClass, prop10.classId);
+    EXPECT_GT(prop10.numTuners, 0u);
+    EXPECT_GT(prop11.supportedProgramTypes.size(), 0u);
+    EXPECT_GT(prop11.supportedIdentifierTypes.size(), 0u);
+    if (radioClass == Class::AM_FM) {
+        EXPECT_GT(prop10.bands.size(), 0u);
+    }
+    mBands = prop10.bands;
+}
+
+void BroadcastRadioHalTest::TearDown() {
+    mTuner.clear();
+    mRadioModule.clear();
+    // TODO(b/36864490): wait (with timeout) until mCallback has only one reference
+}
+
+bool BroadcastRadioHalTest::openTuner(unsigned band) {
+    EXPECT_EQ(nullptr, mTuner.get());
+
+    if (radioClass == Class::AM_FM) {
+        EXPECT_TIMEOUT_CALL(*mCallback, configChange, Result::OK, _);
+    }
+
+    Result halResult = Result::NOT_INITIALIZED;
+    auto openCb = [&](Result result, const sp<V1_0::ITuner>& tuner) {
+        halResult = result;
+        if (result != Result::OK) return;
+        mTuner = ITuner::castFrom(tuner);
+    };
+    auto hidlResult = mRadioModule->openTuner(getBand(band), true, mCallback, openCb);
+
+    EXPECT_TRUE(hidlResult.isOk());
+    EXPECT_EQ(Result::OK, halResult);
+    EXPECT_NE(nullptr, mTuner.get());
+    if (radioClass == Class::AM_FM && mTuner != nullptr) {
+        EXPECT_TIMEOUT_CALL_WAIT(*mCallback, configChange, kConfigTimeout);
+
+        BandConfig halConfig;
         Result halResult = Result::NOT_INITIALIZED;
-        auto hidlReturn = mRadio->openTuner(mHalProperties.bands[0], true, mTunerCallback,
-                [&](Result result, const sp<V1_0::ITuner>& tuner) {
-                    halResult = result;
-                    if (result == Result::OK) {
-                        mTuner = ITuner::castFrom(tuner);
-                    }
-                });
-        EXPECT_TRUE(hidlReturn.isOk());
+        mTuner->getConfiguration([&](Result result, const BandConfig& config) {
+            halResult = result;
+            halConfig = config;
+        });
         EXPECT_EQ(Result::OK, halResult);
-        EXPECT_NE(nullptr, mTuner.get());
-        EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs));
+        EXPECT_TRUE(halConfig.antennaConnected);
     }
+
     EXPECT_NE(nullptr, mTuner.get());
     return nullptr != mTuner.get();
 }
 
-bool BroadcastRadioHidlTest::checkAntenna()
-{
-    BandConfig halConfig;
-    Result halResult = Result::NOT_INITIALIZED;
-    Return<void> hidlReturn =
-            mTuner->getConfiguration([&](Result result, const BandConfig& config) {
-                halResult = result;
-                if (result == Result::OK) {
-                    halConfig = config;
-                }
-            });
+const BandConfig& BroadcastRadioHalTest::getBand(unsigned idx) {
+    static const BandConfig dummyBandConfig = {};
 
-    return ((halResult == Result::OK) && (halConfig.antennaConnected == true));
-}
-
-
-/**
- * Test IBroadcastRadio::getProperties() method
- *
- * Verifies that:
- *  - the HAL implements the method
- *  - the method returns 0 (no error)
- *  - the implementation class is AM_FM
- *  - the implementation supports at least one tuner
- *  - the implementation supports at one band
- */
-TEST_F(BroadcastRadioHidlTest, GetProperties) {
-    EXPECT_TRUE(getProperties());
-}
-
-/**
- * Test IBroadcastRadio::openTuner() method
- *
- * Verifies that:
- *  - the HAL implements the method
- *  - the method returns 0 (no error) and a valid ITuner interface
- */
-TEST_F(BroadcastRadioHidlTest, OpenTuner) {
-    EXPECT_TRUE(openTuner());
-}
-
-/**
- * Test ITuner::setConfiguration() and getConfiguration methods
- *
- * Verifies that:
- *  - the HAL implements both methods
- *  - the methods return 0 (no error)
- *  - the configuration callback is received within kConfigCallbacktimeoutNs ns
- *  - the configuration read back from HAl has the same class Id
- */
-TEST_F(BroadcastRadioHidlTest, SetAndGetConfiguration) {
-    ASSERT_TRUE(openTuner());
-    // test setConfiguration
-    mCallbackCalled = false;
-    Return<Result> hidlResult = mTuner->setConfiguration(mHalProperties.bands[0]);
-    EXPECT_TRUE(hidlResult.isOk());
-    EXPECT_EQ(Result::OK, hidlResult);
-    EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs));
-    EXPECT_EQ(Result::OK, mResultCallbackData);
-
-    // test getConfiguration
-    BandConfig halConfig;
-    Result halResult;
-    Return<void> hidlReturn =
-            mTuner->getConfiguration([&](Result result, const BandConfig& config) {
-                halResult = result;
-                if (result == Result::OK) {
-                    halConfig = config;
-                }
-            });
-    EXPECT_TRUE(hidlReturn.isOk());
-    EXPECT_EQ(Result::OK, halResult);
-    EXPECT_EQ(mHalProperties.bands[0].type, halConfig.type);
-}
-
-/**
- * Test ITuner::scan
- *
- * Verifies that:
- *  - the HAL implements the method
- *  - the method returns 0 (no error)
- *  - the tuned callback is received within kTuneCallbacktimeoutNs ns
- */
-TEST_F(BroadcastRadioHidlTest, Scan) {
-    ASSERT_TRUE(openTuner());
-    ASSERT_TRUE(checkAntenna());
-    // test scan UP
-    mCallbackCalled = false;
-    Return<Result> hidlResult = mTuner->scan(Direction::UP, true);
-    EXPECT_TRUE(hidlResult.isOk());
-    EXPECT_EQ(Result::OK, hidlResult);
-    EXPECT_TRUE(waitForCallback(kTuneCallbacktimeoutNs));
-
-    // test scan DOWN
-    mCallbackCalled = false;
-    hidlResult = mTuner->scan(Direction::DOWN, true);
-    EXPECT_TRUE(hidlResult.isOk());
-    EXPECT_EQ(Result::OK, hidlResult);
-    EXPECT_TRUE(waitForCallback(kTuneCallbacktimeoutNs));
-}
-
-/**
- * Test ITuner::step
- *
- * Verifies that:
- *  - the HAL implements the method
- *  - the method returns 0 (no error)
- *  - the tuned callback is received within kTuneCallbacktimeoutNs ns
- */
-TEST_F(BroadcastRadioHidlTest, Step) {
-    ASSERT_TRUE(openTuner());
-    ASSERT_TRUE(checkAntenna());
-    // test step UP
-    mCallbackCalled = false;
-    Return<Result> hidlResult = mTuner->step(Direction::UP, true);
-    EXPECT_TRUE(hidlResult.isOk());
-    EXPECT_EQ(Result::OK, hidlResult);
-    EXPECT_TRUE(waitForCallback(kTuneCallbacktimeoutNs));
-
-    // test step DOWN
-    mCallbackCalled = false;
-    hidlResult = mTuner->step(Direction::DOWN, true);
-    EXPECT_TRUE(hidlResult.isOk());
-    EXPECT_EQ(Result::OK, hidlResult);
-    EXPECT_TRUE(waitForCallback(kTuneCallbacktimeoutNs));
-}
-
-/**
- * Test ITuner::tune,  getProgramInformation and cancel methods
- *
- * Verifies that:
- *  - the HAL implements the methods
- *  - the methods return 0 (no error)
- *  - the tuned callback is received within kTuneCallbacktimeoutNs ns after tune()
- */
-TEST_F(BroadcastRadioHidlTest, TuneAndGetProgramInformationAndCancel) {
-    ASSERT_TRUE(openTuner());
-    ASSERT_TRUE(checkAntenna());
-
-    // test tune
-    ASSERT_GT(mHalProperties.bands[0].spacings.size(), 0u);
-    ASSERT_GT(mHalProperties.bands[0].upperLimit, mHalProperties.bands[0].lowerLimit);
-
-    // test scan UP
-    uint32_t lowerLimit = mHalProperties.bands[0].lowerLimit;
-    uint32_t upperLimit = mHalProperties.bands[0].upperLimit;
-    uint32_t spacing = mHalProperties.bands[0].spacings[0];
-
-    uint32_t channel =
-            lowerLimit + (((upperLimit - lowerLimit) / 2 + spacing - 1) / spacing) * spacing;
-    mCallbackCalled = false;
-    mResultCallbackData = Result::NOT_INITIALIZED;
-    Return<Result> hidlResult = mTuner->tune(channel, 0);
-    EXPECT_TRUE(hidlResult.isOk());
-    EXPECT_EQ(Result::OK, hidlResult);
-    EXPECT_TRUE(waitForCallback(kTuneCallbacktimeoutNs));
-
-    // test getProgramInformation
-    ProgramInfo halInfo;
-    Result halResult = Result::NOT_INITIALIZED;
-    Return<void> hidlReturn = mTuner->getProgramInformation_1_1(
-        [&](Result result, const ProgramInfo& info) {
-            halResult = result;
-            if (result == Result::OK) {
-                halInfo = info;
-            }
-        });
-    EXPECT_TRUE(hidlReturn.isOk());
-    EXPECT_EQ(Result::OK, halResult);
-    auto &halInfo_1_1 = halInfo.base;
-    if (mResultCallbackData == Result::OK) {
-        EXPECT_LE(halInfo_1_1.channel, upperLimit);
-        EXPECT_GE(halInfo_1_1.channel, lowerLimit);
+    if (radioClass != Class::AM_FM) {
+        ALOGD("Not AM/FM radio, returning dummy band config");
+        return dummyBandConfig;
     }
 
-    // test cancel
-    mTuner->tune(lowerLimit, 0);
-    hidlResult = mTuner->cancel();
-    EXPECT_TRUE(hidlResult.isOk());
+    EXPECT_GT(mBands.size(), idx);
+    if (mBands.size() <= idx) {
+        ALOGD("Band index out of bound, returning dummy band config");
+        return dummyBandConfig;
+    }
+
+    auto& band = mBands[idx];
+    ALOGD("Returning %s band", toString(band.type).c_str());
+    return band;
+}
+
+/**
+ * Test IBroadcastRadio::openTuner() method called twice.
+ *
+ * Verifies that:
+ *  - the openTuner method succeeds when called for the second time without
+ *    deleting previous ITuner instance.
+ *
+ * This is a more strict requirement than in 1.0, where a second openTuner
+ * might fail.
+ */
+TEST_P(BroadcastRadioHalTest, OpenTunerTwice) {
+    if (skipped) return;
+    ASSERT_TRUE(openTuner(0));
+
+    Result halResult = Result::NOT_INITIALIZED;
+    auto openCb = [&](Result result, const sp<V1_0::ITuner>&) { halResult = result; };
+    auto hidlResult = mRadioModule->openTuner(getBand(0), true, mCallback, openCb);
+    ASSERT_TRUE(hidlResult.isOk());
+    ASSERT_EQ(Result::OK, halResult);
+}
+
+/**
+ * Test tuning to program list entry.
+ *
+ * Verifies that:
+ *  - getProgramList either succeeds or returns NOT_STARTED/NOT_READY status;
+ *  - if the program list is NOT_STARTED, startBackgroundScan makes it completed
+ *    within a full scan timeout and the next getProgramList call succeeds;
+ *  - if the program list is not empty, tune_1_1 call succeeds.
+ */
+TEST_P(BroadcastRadioHalTest, TuneFromProgramList) {
+    if (skipped) return;
+    ASSERT_TRUE(openTuner(0));
+
+    ProgramInfo firstProgram;
+    bool isListEmpty;
+    ProgramListResult getListResult = ProgramListResult::NOT_INITIALIZED;
+    auto getListCb = [&](ProgramListResult result, const hidl_vec<ProgramInfo>& list) {
+        ALOGD("getListCb(%s, ProgramInfo[%zu])", toString(result).c_str(), list.size());
+        getListResult = result;
+        if (result != ProgramListResult::OK) return;
+        isListEmpty = (list.size() == 0);
+        // don't copy the whole list out, it might be heavy
+        if (!isListEmpty) firstProgram = list[0];
+    };
+
+    // first try...
+    EXPECT_TIMEOUT_CALL(*mCallback, backgroundScanComplete, ProgramListResult::OK)
+        .Times(AnyNumber());
+    auto hidlResult = mTuner->getProgramList("", getListCb);
+    ASSERT_TRUE(hidlResult.isOk());
+
+    if (getListResult == ProgramListResult::NOT_STARTED) {
+        auto result = mTuner->startBackgroundScan();
+        ASSERT_EQ(ProgramListResult::OK, result);
+        getListResult = ProgramListResult::NOT_READY;  // continue as in NOT_READY case
+    }
+    if (getListResult == ProgramListResult::NOT_READY) {
+        EXPECT_TIMEOUT_CALL_WAIT(*mCallback, backgroundScanComplete, kFullScanTimeout);
+
+        // second (last) try...
+        hidlResult = mTuner->getProgramList("", getListCb);
+        ASSERT_TRUE(hidlResult.isOk());
+        ASSERT_EQ(ProgramListResult::OK, getListResult);
+    }
+
+    if (isListEmpty) {
+        printSkipped("Program list is empty.");
+        return;
+    }
+
+    ProgramSelector selCb;
+    EXPECT_CALL(*mCallback, tuneComplete(_, _));
+    EXPECT_TIMEOUT_CALL(*mCallback, tuneComplete_1_1, Result::OK, _)
+        .WillOnce(DoAll(SaveArg<1>(&selCb), testing::Return(ByMove(Void()))));
+    auto tuneResult = mTuner->tune_1_1(firstProgram.selector);
+    ASSERT_EQ(Result::OK, tuneResult);
+    EXPECT_TIMEOUT_CALL_WAIT(*mCallback, tuneComplete_1_1, kTuneTimeout);
+    EXPECT_EQ(firstProgram.selector.primaryId, selCb.primaryId);
+}
+
+TEST_P(BroadcastRadioHalTest, CancelAnnouncement) {
+    if (skipped) return;
+    ASSERT_TRUE(openTuner(0));
+
+    auto hidlResult = mTuner->cancelAnnouncement();
     EXPECT_EQ(Result::OK, hidlResult);
 }
 
+INSTANTIATE_TEST_CASE_P(BroadcastRadioHalTestCases, BroadcastRadioHalTest,
+                        ::testing::Values(Class::AM_FM, Class::SAT, Class::DT));
+
+}  // namespace vts
+}  // namespace V1_1
+}  // namespace broadcastradio
+}  // namespace hardware
+}  // namespace android
 
 int main(int argc, char** argv) {
-  ::testing::AddGlobalTestEnvironment(new BroadcastRadioHidlEnvironment);
   ::testing::InitGoogleTest(&argc, argv);
   int status = RUN_ALL_TESTS();
   ALOGI("Test result = %d", status);
diff --git a/broadcastradio/1.1/vts/functional/call-barrier.cpp b/broadcastradio/1.1/vts/functional/call-barrier.cpp
new file mode 100644
index 0000000..fede297
--- /dev/null
+++ b/broadcastradio/1.1/vts/functional/call-barrier.cpp
@@ -0,0 +1,45 @@
+/*
+ * 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 "call-barrier.h"
+
+namespace android {
+namespace hardware {
+namespace broadcastradio {
+namespace vts {
+
+using std::lock_guard;
+using std::mutex;
+using std::unique_lock;
+
+void CallBarrier::call() {
+    lock_guard<mutex> lk(mMut);
+    mWasCalled = true;
+    mCond.notify_all();
+}
+
+bool CallBarrier::waitForCall(std::chrono::milliseconds timeout) {
+    unique_lock<mutex> lk(mMut);
+
+    if (mWasCalled) return true;
+
+    auto status = mCond.wait_for(lk, timeout);
+    return status == std::cv_status::no_timeout;
+}
+
+}  // namespace vts
+}  // namespace broadcastradio
+}  // namespace hardware
+}  // namespace android
diff --git a/broadcastradio/1.1/vts/functional/call-barrier.h b/broadcastradio/1.1/vts/functional/call-barrier.h
new file mode 100644
index 0000000..462396a
--- /dev/null
+++ b/broadcastradio/1.1/vts/functional/call-barrier.h
@@ -0,0 +1,59 @@
+/*
+ * 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_BROADCASTRADIO_V1_1_CALL_BARRIER
+#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_CALL_BARRIER
+
+#include <chrono>
+#include <thread>
+
+namespace android {
+namespace hardware {
+namespace broadcastradio {
+namespace vts {
+
+/**
+ * A barrier for thread synchronization, where one should wait for another to
+ * reach a specific point in execution.
+ */
+class CallBarrier {
+   public:
+    /**
+     * Notify the other thread it may continue execution.
+     *
+     * This may be called before the other thread starts waiting on the barrier.
+     */
+    void call();
+
+    /**
+     * Wait for the other thread to reach call() execution point.
+     *
+     * @param timeout a maximum time to wait.
+     * @returns {@code false} if timed out, {@code true} otherwise.
+     */
+    bool waitForCall(std::chrono::milliseconds timeout);
+
+   private:
+    bool mWasCalled = false;
+    std::mutex mMut;
+    std::condition_variable mCond;
+};
+
+}  // namespace vts
+}  // namespace broadcastradio
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_CALL_BARRIER
diff --git a/broadcastradio/1.1/vts/functional/mock-timeout.h b/broadcastradio/1.1/vts/functional/mock-timeout.h
new file mode 100644
index 0000000..fa1114f
--- /dev/null
+++ b/broadcastradio/1.1/vts/functional/mock-timeout.h
@@ -0,0 +1,103 @@
+/*
+ * 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_BROADCASTRADIO_V1_1_MOCK_TIMEOUT
+#define ANDROID_HARDWARE_BROADCASTRADIO_V1_1_MOCK_TIMEOUT
+
+#include <gmock/gmock.h>
+#include <thread>
+
+/**
+ * Common helper objects for gmock timeout extension.
+ *
+ * INTERNAL IMPLEMENTATION - don't use in user code.
+ */
+#define EGMOCK_TIMEOUT_METHOD_DEF_(Method, ...) \
+    std::atomic<bool> egmock_called_##Method;   \
+    std::mutex egmock_mut_##Method;             \
+    std::condition_variable egmock_cond_##Method;
+
+/**
+ * Common method body for gmock timeout extension.
+ *
+ * INTERNAL IMPLEMENTATION - don't use in user code.
+ */
+#define EGMOCK_TIMEOUT_METHOD_BODY_(Method, ...)             \
+    auto ret = egmock_##Method(__VA_ARGS__);                 \
+    {                                                        \
+        std::lock_guard<std::mutex> lk(egmock_mut_##Method); \
+        egmock_called_##Method = true;                       \
+        egmock_cond_##Method.notify_all();                   \
+    }                                                        \
+    return ret;
+
+/**
+ * Gmock MOCK_METHOD1 timeout-capable extension.
+ */
+#define MOCK_TIMEOUT_METHOD1(Method, ...)                                                 \
+    MOCK_METHOD1(egmock_##Method, __VA_ARGS__);                                           \
+    EGMOCK_TIMEOUT_METHOD_DEF_(Method);                                                   \
+    virtual GMOCK_RESULT_(, __VA_ARGS__) Method(GMOCK_ARG_(, 1, __VA_ARGS__) egmock_a1) { \
+        EGMOCK_TIMEOUT_METHOD_BODY_(Method, egmock_a1);                                   \
+    }
+
+/**
+ * Gmock MOCK_METHOD2 timeout-capable extension.
+ */
+#define MOCK_TIMEOUT_METHOD2(Method, ...)                                                        \
+    MOCK_METHOD2(egmock_##Method, __VA_ARGS__);                                                  \
+    EGMOCK_TIMEOUT_METHOD_DEF_(Method);                                                          \
+    virtual GMOCK_RESULT_(, __VA_ARGS__)                                                         \
+        Method(GMOCK_ARG_(, 1, __VA_ARGS__) egmock_a1, GMOCK_ARG_(, 2, __VA_ARGS__) egmock_a2) { \
+        EGMOCK_TIMEOUT_METHOD_BODY_(Method, egmock_a1, egmock_a2);                               \
+    }
+
+/**
+ * Gmock EXPECT_CALL timeout-capable extension.
+ *
+ * It has slightly different syntax from the original macro, to make method name accessible.
+ * So, instead of typing
+ *     EXPECT_CALL(account, charge(100, Currency::USD));
+ * you need to inline arguments
+ *     EXPECT_TIMEOUT_CALL(account, charge, 100, Currency::USD);
+ */
+#define EXPECT_TIMEOUT_CALL(obj, Method, ...) \
+    (obj).egmock_called_##Method = false;     \
+    EXPECT_CALL(obj, egmock_##Method(__VA_ARGS__))
+
+/**
+ * Waits for an earlier EXPECT_TIMEOUT_CALL to execute.
+ *
+ * It does not fully support special constraints of the EXPECT_CALL clause, just proceeds when the
+ * first call to a given method comes. For example, in the following code:
+ *     EXPECT_TIMEOUT_CALL(account, charge, 100, _);
+ *     account.charge(50, Currency::USD);
+ *     EXPECT_TIMEOUT_CALL_WAIT(account, charge, 500ms);
+ * the wait clause will just continue, as the charge method was called.
+ *
+ * @param obj object for a call
+ * @param Method the method to wait for
+ * @param timeout the maximum time for waiting
+ */
+#define EXPECT_TIMEOUT_CALL_WAIT(obj, Method, timeout)                      \
+    {                                                                       \
+        std::unique_lock<std::mutex> lk((obj).egmock_mut_##Method);         \
+        if (!(obj).egmock_called_##Method) {                                \
+            auto status = (obj).egmock_cond_##Method.wait_for(lk, timeout); \
+            EXPECT_EQ(std::cv_status::no_timeout, status);                  \
+        }                                                                   \
+    }
+
+#endif  // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_MOCK_TIMEOUT
diff --git a/camera/device/1.0/default/Android.bp b/camera/device/1.0/default/Android.bp
index 1a349d6..e0b31f0 100644
--- a/camera/device/1.0/default/Android.bp
+++ b/camera/device/1.0/default/Android.bp
@@ -26,6 +26,9 @@
     static_libs: [
         "android.hardware.camera.common@1.0-helper"
     ],
+    header_libs: [
+        "media_plugin_headers",
+    ],
     include_dirs: [
         "frameworks/native/include/media/openmax"
     ],
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 2ae4853..1eea640 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -43,6 +43,7 @@
 #include <ui/GraphicBuffer.h>
 
 #include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
 
 using ::android::hardware::Return;
 using ::android::hardware::Void;
@@ -100,7 +101,6 @@
 using ResultMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>;
 using ::android::hidl::manager::V1_0::IServiceManager;
 
-const char kCameraPassthroughServiceName[] = "legacy/0";
 const char *kProviderFQName = "android.hardware.camera.provider@2.4::ICameraProvider";
 const uint32_t kMaxPreviewWidth = 1920;
 const uint32_t kMaxPreviewHeight = 1080;
@@ -219,66 +219,28 @@
 }
 
 // Test environment for camera
-class CameraHidlEnvironment : public ::testing::Environment {
-public:
+class CameraHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+   public:
     // get the test environment singleton
     static CameraHidlEnvironment* Instance() {
         static CameraHidlEnvironment* instance = new CameraHidlEnvironment;
         return instance;
     }
 
-    virtual void SetUp() override;
-    virtual void TearDown() override;
+    virtual void HidlSetUp() override { ALOGI("SetUp CameraHidlEnvironment"); }
 
-    std::unordered_map<std::string, sp<ICameraProvider> > mProviders;
+    virtual void HidlTearDown() override { ALOGI("TearDown CameraHidlEnvironment"); }
 
-private:
+    virtual void registerTestServices() override {
+        registerTestService("android.hardware.camera.provider", "2.4", "ICameraProvider");
+    }
+
+   private:
     CameraHidlEnvironment() {}
 
     GTEST_DISALLOW_COPY_AND_ASSIGN_(CameraHidlEnvironment);
 };
 
-void CameraHidlEnvironment::SetUp() {
-    sp<IServiceManager> manager = IServiceManager::getService();
-    ASSERT_NE(manager, nullptr);
-
-    manager->listByInterface(kProviderFQName,
-                             [this](const hidl_vec<hidl_string> &registered) {
-        std::string name;
-        uint32_t id;
-        sp<ICameraProvider> provider = nullptr;
-        for (size_t i = 0; i < registered.size(); i++) {
-            ASSERT_TRUE(parseProviderName(registered[i],
-                    &name /*out*/, &id /*out*/));
-            provider = ICameraProvider::tryGetService(registered[i]);
-            ALOGI_IF(provider, "provider is not nullptr, %p", provider.get());
-            if (nullptr != provider.get()) {
-                mProviders.emplace(name, provider);
-            }
-        }
-    });
-
-    std::string legacyName;
-    uint32_t legacyId;
-    ASSERT_TRUE(parseProviderName(kCameraPassthroughServiceName,
-            &legacyName /*out*/, &legacyId /*out*/));
-    auto legacyIt = mProviders.find(legacyName);
-    //Add any legacy passthrough implementations
-    if (legacyIt == mProviders.end()) {
-        sp<ICameraProvider> provider = ICameraProvider::tryGetService(
-                kCameraPassthroughServiceName);
-        if (nullptr != provider.get()) {
-            mProviders.emplace(legacyName, provider);
-        }
-    }
-
-    ASSERT_FALSE(mProviders.empty());
-}
-
-void CameraHidlEnvironment::TearDown() {
-    ALOGI("TearDown CameraHidlEnvironment");
-}
-
 struct BufferItemHander: public BufferItemConsumer::FrameAvailableListener {
     BufferItemHander(wp<BufferItemConsumer> consumer) : mConsumer(consumer) {}
 
@@ -521,23 +483,32 @@
 // The main test class for camera HIDL HAL.
 class CameraHidlTest : public ::testing::VtsHalHidlTargetTestBase {
 public:
-    virtual void SetUp() override {}
-    virtual void TearDown() override {}
+ virtual void SetUp() override {
+     string service_name = CameraHidlEnvironment::Instance()->getServiceName(kProviderFQName);
+     ALOGI("get service with name: %s", service_name.c_str());
+     mProvider = ::testing::VtsHalHidlTargetTestBase::getService<ICameraProvider>(service_name);
+     ASSERT_NE(mProvider, nullptr);
 
-    hidl_vec<hidl_string> getCameraDeviceNames(sp<ICameraProvider> provider);
+     uint32_t id;
+     ASSERT_TRUE(parseProviderName(service_name, &mProviderType, &id));
+ }
+ virtual void TearDown() override {}
 
-    struct EmptyDeviceCb : public ICameraDeviceCallback {
-        virtual Return<void> processCaptureResult(const hidl_vec<CaptureResult>& /*results*/) override {
-            ALOGI("processCaptureResult callback");
-            ADD_FAILURE(); // Empty callback should not reach here
-            return Void();
-        }
+ hidl_vec<hidl_string> getCameraDeviceNames(sp<ICameraProvider> provider);
 
-        virtual Return<void> notify(const hidl_vec<NotifyMsg>& /*msgs*/) override {
-            ALOGI("notify callback");
-            ADD_FAILURE(); // Empty callback should not reach here
-            return Void();
-        }
+ struct EmptyDeviceCb : public ICameraDeviceCallback {
+     virtual Return<void> processCaptureResult(
+         const hidl_vec<CaptureResult>& /*results*/) override {
+         ALOGI("processCaptureResult callback");
+         ADD_FAILURE();  // Empty callback should not reach here
+         return Void();
+     }
+
+     virtual Return<void> notify(const hidl_vec<NotifyMsg>& /*msgs*/) override {
+         ALOGI("notify callback");
+         ADD_FAILURE();  // Empty callback should not reach here
+         return Void();
+     }
     };
 
     struct DeviceCb : public ICameraDeviceCallback {
@@ -731,6 +702,11 @@
 
     // Holds camera registered buffers
     std::unordered_map<uint32_t, sp<::android::MemoryHeapBase> > mMemoryPool;
+
+    // Camera provider service
+    sp<ICameraProvider> mProvider;
+    // Camera provider type.
+    std::string mProviderType;
 };
 
 Return<void> CameraHidlTest::Camera1DeviceCb::notifyCallback(
@@ -1032,59 +1008,45 @@
 // Test if ICameraProvider::isTorchModeSupported returns Status::OK
 TEST_F(CameraHidlTest, isTorchModeSupported) {
     Return<void> ret;
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        ret = provider.second->isSetTorchModeSupported(
-            [&](auto status, bool support) {
-                ALOGI("isSetTorchModeSupported returns status:%d supported:%d",
-                        (int)status, support);
-                ASSERT_EQ(Status::OK, status);
-            });
-        ASSERT_TRUE(ret.isOk());
-    }
+    ret = mProvider->isSetTorchModeSupported([&](auto status, bool support) {
+        ALOGI("isSetTorchModeSupported returns status:%d supported:%d", (int)status, support);
+        ASSERT_EQ(Status::OK, status);
+    });
+    ASSERT_TRUE(ret.isOk());
 }
 
 // TODO: consider removing this test if getCameraDeviceNames() has the same coverage
 TEST_F(CameraHidlTest, getCameraIdList) {
     Return<void> ret;
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        ret = provider.second->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);
-            });
-        ASSERT_TRUE(ret.isOk());
-    }
+    ret = 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);
+    });
+    ASSERT_TRUE(ret.isOk());
 }
 
 // Test if ICameraProvider::getVendorTags returns Status::OK
 TEST_F(CameraHidlTest, getVendorTags) {
     Return<void> ret;
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        ret = provider.second->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);
-            });
-        ASSERT_TRUE(ret.isOk());
-    }
+    ret = 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);
+    });
+    ASSERT_TRUE(ret.isOk());
 }
 
 // Test if ICameraProvider::setCallback returns Status::OK
@@ -1107,45 +1069,34 @@
         }
     };
     sp<ProviderCb> cb = new ProviderCb;
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        auto status = provider.second->setCallback(cb);
-        ASSERT_TRUE(status.isOk());
-        ASSERT_EQ(Status::OK, status);
-    }
+    auto status = mProvider->setCallback(cb);
+    ASSERT_TRUE(status.isOk());
+    ASSERT_EQ(Status::OK, status);
 }
 
 // Test if ICameraProvider::getCameraDeviceInterface returns Status::OK and non-null device
 TEST_F(CameraHidlTest, getCameraDeviceInterface) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                Return<void> ret;
-                ret = provider.second->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);
-                    });
-                ASSERT_TRUE(ret.isOk());
-            } else if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                Return<void> ret;
-                ret = provider.second->getCameraDeviceInterface_V1_x(
-                    name,
-                    [&](auto status, const auto& device1) {
-                        ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
-                              (int)status);
-                        ASSERT_EQ(Status::OK, status);
-                        ASSERT_NE(device1, nullptr);
-                    });
-                ASSERT_TRUE(ret.isOk());
-            }
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            Return<void> ret;
+            ret = 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);
+                });
+            ASSERT_TRUE(ret.isOk());
+        } else if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            Return<void> ret;
+            ret = mProvider->getCameraDeviceInterface_V1_x(
+                name, [&](auto status, const auto& device1) {
+                    ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device1, nullptr);
+                });
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -1153,66 +1104,55 @@
 // Verify that the device resource cost can be retrieved and the values are
 // sane.
 TEST_F(CameraHidlTest, getResourceCost) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    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());
-                Return<void> ret;
-                ret = provider.second->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;
-                    });
-                ASSERT_TRUE(ret.isOk());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == 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());
+            Return<void> ret;
+            ret = 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;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-                ret = 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());
-                        }
-                    });
-                ASSERT_TRUE(ret.isOk());
-            } else {
-                ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                ALOGI("getResourceCost: Testing camera device %s", name.c_str());
-                Return<void> ret;
-                ret = provider.second->getCameraDeviceInterface_V1_x(
-                    name,
-                    [&](auto status, const auto& device) {
-                        ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
-                              (int)status);
-                        ASSERT_EQ(Status::OK, status);
-                        ASSERT_NE(device, nullptr);
-                        device1 = device;
-                    });
-                ASSERT_TRUE(ret.isOk());
+            ret = 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());
+                }
+            });
+            ASSERT_TRUE(ret.isOk());
+        } else {
+            ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            ALOGI("getResourceCost: Testing camera device %s", name.c_str());
+            Return<void> ret;
+            ret = mProvider->getCameraDeviceInterface_V1_x(
+                name, [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device1 = device;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-                ret = device1->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());
-                        }
-                    });
-                ASSERT_TRUE(ret.isOk());
-            }
+            ret = device1->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());
+                }
+            });
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -1220,143 +1160,117 @@
 // Verify that the static camera info can be retrieved
 // successfully.
 TEST_F(CameraHidlTest, getCameraInfo) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                ALOGI("getCameraCharacteristics: Testing camera device %s",
-                      name.c_str());
-                Return<void> ret;
-                ret = provider.second->getCameraDeviceInterface_V1_x(
-                    name,
-                    [&](auto status, const auto& device) {
-                        ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
-                              (int)status);
-                        ASSERT_EQ(Status::OK, status);
-                        ASSERT_NE(device, nullptr);
-                        device1 = device;
-                    });
-                ASSERT_TRUE(ret.isOk());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            ALOGI("getCameraCharacteristics: Testing camera device %s", name.c_str());
+            Return<void> ret;
+            ret = mProvider->getCameraDeviceInterface_V1_x(
+                name, [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device1 = device;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-                ret = device1->getCameraInfo(
-                    [&](auto status, const auto& info) {
-                        ALOGI("getCameraInfo returns status:%d", (int)status);
-                        ASSERT_EQ(Status::OK, status);
-                        switch(info.orientation) {
-                            case 0:
-                            case 90:
-                            case 180:
-                            case 270:
-                                //Expected cases
-                                ALOGI("camera orientation: %d", info.orientation);
-                                break;
-                            default:
-                                FAIL() << "Unexpected camera orientation:" << info.orientation;
-                        }
-                        switch(info.facing) {
-                            case CameraFacing::BACK:
-                            case CameraFacing::FRONT:
-                            case CameraFacing::EXTERNAL:
-                                //Expected cases
-                                ALOGI("camera facing: %d", info.facing);
-                                break;
-                            default:
-                                FAIL() << "Unexpected camera facing:" << static_cast<uint32_t> (
-                                        info.facing);
-                        }
-                    });
-                ASSERT_TRUE(ret.isOk());
-            }
+            ret = device1->getCameraInfo([&](auto status, const auto& info) {
+                ALOGI("getCameraInfo returns status:%d", (int)status);
+                ASSERT_EQ(Status::OK, status);
+                switch (info.orientation) {
+                    case 0:
+                    case 90:
+                    case 180:
+                    case 270:
+                        // Expected cases
+                        ALOGI("camera orientation: %d", info.orientation);
+                        break;
+                    default:
+                        FAIL() << "Unexpected camera orientation:" << info.orientation;
+                }
+                switch (info.facing) {
+                    case CameraFacing::BACK:
+                    case CameraFacing::FRONT:
+                    case CameraFacing::EXTERNAL:
+                        // Expected cases
+                        ALOGI("camera facing: %d", info.facing);
+                        break;
+                    default:
+                        FAIL() << "Unexpected camera facing:" << static_cast<uint32_t>(info.facing);
+                }
+            });
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
 
 // Check whether preview window can be configured
 TEST_F(CameraHidlTest, setPreviewWindow) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1,
-                        &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
 
-                Return<void> ret;
-                ret = device1->close();
-                ASSERT_TRUE(ret.isOk());
-            }
+            Return<void> ret;
+            ret = device1->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
 
 // Verify that setting preview window fails in case device is not open
 TEST_F(CameraHidlTest, setPreviewWindowInvalid) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                ALOGI("getCameraCharacteristics: Testing camera device %s",
-                      name.c_str());
-                Return<void> ret;
-                ret = provider.second->getCameraDeviceInterface_V1_x(
-                    name,
-                    [&](auto status, const auto& device) {
-                        ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
-                              (int)status);
-                        ASSERT_EQ(Status::OK, status);
-                        ASSERT_NE(device, nullptr);
-                        device1 = device;
-                    });
-                ASSERT_TRUE(ret.isOk());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            ALOGI("getCameraCharacteristics: Testing camera device %s", name.c_str());
+            Return<void> ret;
+            ret = mProvider->getCameraDeviceInterface_V1_x(
+                name, [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device1 = device;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-                Return<Status> returnStatus = device1->setPreviewWindow(nullptr);
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OPERATION_NOT_SUPPORTED, returnStatus);
-            }
+            Return<Status> returnStatus = device1->setPreviewWindow(nullptr);
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OPERATION_NOT_SUPPORTED, returnStatus);
         }
     }
 }
 
 // Start and stop preview checking whether it gets enabled in between.
 TEST_F(CameraHidlTest, startStopPreview) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1,
-                        &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
 
-                startPreview(device1);
+            startPreview(device1);
 
-                Return<bool> returnBoolStatus = device1->previewEnabled();
-                ASSERT_TRUE(returnBoolStatus.isOk());
-                ASSERT_TRUE(returnBoolStatus);
+            Return<bool> returnBoolStatus = device1->previewEnabled();
+            ASSERT_TRUE(returnBoolStatus.isOk());
+            ASSERT_TRUE(returnBoolStatus);
 
-                stopPreviewAndClose(device1);
-            }
+            stopPreviewAndClose(device1);
         }
     }
 }
@@ -1364,646 +1278,552 @@
 // Start preview without active preview window. Preview should start as soon
 // as a valid active window gets configured.
 TEST_F(CameraHidlTest, startStopPreviewDelayed) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
 
-                Return<Status> returnStatus = device1->setPreviewWindow(nullptr);
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
+            Return<Status> returnStatus = device1->setPreviewWindow(nullptr);
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
 
-                startPreview(device1);
+            startPreview(device1);
 
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
-                        &bufferHandler /*out*/);
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
 
-                //Preview should get enabled now
-                Return<bool> returnBoolStatus = device1->previewEnabled();
-                ASSERT_TRUE(returnBoolStatus.isOk());
-                ASSERT_TRUE(returnBoolStatus);
+            // Preview should get enabled now
+            Return<bool> returnBoolStatus = device1->previewEnabled();
+            ASSERT_TRUE(returnBoolStatus.isOk());
+            ASSERT_TRUE(returnBoolStatus);
 
-                stopPreviewAndClose(device1);
-            }
+            stopPreviewAndClose(device1);
         }
     }
 }
 
 // Verify that image capture behaves as expected along with preview callbacks.
 TEST_F(CameraHidlTest, takePicture) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
-                        &bufferHandler /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
 
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
-                }
-
-                enableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME,
-                              device1);
-                startPreview(device1);
-
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    waitForFrameLocked(DataCallbackMsg::PREVIEW_FRAME, l);
-                }
-
-                disableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME,
-                                device1);
-                enableMsgType((unsigned int)DataCallbackMsg::COMPRESSED_IMAGE,
-                        device1);
-
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
-                }
-
-                Return<Status> returnStatus = device1->takePicture();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
-
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    waitForFrameLocked(DataCallbackMsg::COMPRESSED_IMAGE, l);
-                }
-
-                disableMsgType((unsigned int)DataCallbackMsg::COMPRESSED_IMAGE,
-                        device1);
-                stopPreviewAndClose(device1);
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
             }
+
+            enableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME, device1);
+            startPreview(device1);
+
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                waitForFrameLocked(DataCallbackMsg::PREVIEW_FRAME, l);
+            }
+
+            disableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME, device1);
+            enableMsgType((unsigned int)DataCallbackMsg::COMPRESSED_IMAGE, device1);
+
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
+            }
+
+            Return<Status> returnStatus = device1->takePicture();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
+
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                waitForFrameLocked(DataCallbackMsg::COMPRESSED_IMAGE, l);
+            }
+
+            disableMsgType((unsigned int)DataCallbackMsg::COMPRESSED_IMAGE, device1);
+            stopPreviewAndClose(device1);
         }
     }
 }
 
 // Image capture should fail in case preview didn't get enabled first.
 TEST_F(CameraHidlTest, takePictureFail) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
 
-                Return<Status> returnStatus = device1->takePicture();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_NE(Status::OK, returnStatus);
+            Return<Status> returnStatus = device1->takePicture();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_NE(Status::OK, returnStatus);
 
-                Return<void> ret = device1->close();
-                ASSERT_TRUE(ret.isOk());
-            }
+            Return<void> ret = device1->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
 
 // Verify that image capture can be cancelled.
 TEST_F(CameraHidlTest, cancelPicture) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
-                        &bufferHandler /*out*/);
-                startPreview(device1);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
+            startPreview(device1);
 
-                Return<Status> returnStatus = device1->takePicture();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
+            Return<Status> returnStatus = device1->takePicture();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
 
-                returnStatus = device1->cancelPicture();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
+            returnStatus = device1->cancelPicture();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
 
-                stopPreviewAndClose(device1);
-            }
+            stopPreviewAndClose(device1);
         }
     }
 }
 
 // Image capture cancel should fail when image capture is not running.
 TEST_F(CameraHidlTest, cancelPictureFail) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
-                        &bufferHandler /*out*/);
-                startPreview(device1);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
+            startPreview(device1);
 
-                Return<Status> returnStatus = device1->cancelPicture();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_NE(Status::OK, returnStatus);
+            Return<Status> returnStatus = device1->cancelPicture();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_NE(Status::OK, returnStatus);
 
-                stopPreviewAndClose(device1);
-            }
+            stopPreviewAndClose(device1);
         }
     }
 }
 
 // Test basic video recording.
 TEST_F(CameraHidlTest, startStopRecording) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
-                        &bufferHandler /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
 
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
-                }
-
-                enableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME,
-                        device1);
-                startPreview(device1);
-
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    waitForFrameLocked(DataCallbackMsg::PREVIEW_FRAME, l);
-                    mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
-                    mVideoBufferIndex = UINT32_MAX;
-                }
-
-                disableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME,
-                        device1);
-
-                bool videoMetaEnabled = false;
-                Return<Status> returnStatus = device1->storeMetaDataInBuffers(
-                        true);
-                ASSERT_TRUE(returnStatus.isOk());
-                // It is allowed for devices to not support this feature
-                ASSERT_TRUE((Status::OK == returnStatus) ||
-                        (Status::OPERATION_NOT_SUPPORTED == returnStatus));
-                if (Status::OK == returnStatus) {
-                    videoMetaEnabled = true;
-                }
-
-                enableMsgType((unsigned int)DataCallbackMsg::VIDEO_FRAME,
-                        device1);
-                Return<bool> returnBoolStatus = device1->recordingEnabled();
-                ASSERT_TRUE(returnBoolStatus.isOk());
-                ASSERT_FALSE(returnBoolStatus);
-
-                returnStatus = device1->startRecording();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
-
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    waitForFrameLocked(DataCallbackMsg::VIDEO_FRAME, l);
-                    ASSERT_NE(UINT32_MAX, mVideoBufferIndex);
-                    disableMsgType((unsigned int)DataCallbackMsg::VIDEO_FRAME,
-                            device1);
-                }
-
-                returnBoolStatus = device1->recordingEnabled();
-                ASSERT_TRUE(returnBoolStatus.isOk());
-                ASSERT_TRUE(returnBoolStatus);
-
-                Return<void> ret;
-                if (videoMetaEnabled) {
-                    ret = device1->releaseRecordingFrameHandle(mVideoData,
-                            mVideoBufferIndex, mVideoNativeHandle);
-                    ASSERT_TRUE(ret.isOk());
-                } else {
-                    ret = device1->releaseRecordingFrame(mVideoData,
-                            mVideoBufferIndex);
-                    ASSERT_TRUE(ret.isOk());
-                }
-
-                ret = device1->stopRecording();
-                ASSERT_TRUE(ret.isOk());
-
-                stopPreviewAndClose(device1);
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
             }
+
+            enableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME, device1);
+            startPreview(device1);
+
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                waitForFrameLocked(DataCallbackMsg::PREVIEW_FRAME, l);
+                mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
+                mVideoBufferIndex = UINT32_MAX;
+            }
+
+            disableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME, device1);
+
+            bool videoMetaEnabled = false;
+            Return<Status> returnStatus = device1->storeMetaDataInBuffers(true);
+            ASSERT_TRUE(returnStatus.isOk());
+            // It is allowed for devices to not support this feature
+            ASSERT_TRUE((Status::OK == returnStatus) ||
+                        (Status::OPERATION_NOT_SUPPORTED == returnStatus));
+            if (Status::OK == returnStatus) {
+                videoMetaEnabled = true;
+            }
+
+            enableMsgType((unsigned int)DataCallbackMsg::VIDEO_FRAME, device1);
+            Return<bool> returnBoolStatus = device1->recordingEnabled();
+            ASSERT_TRUE(returnBoolStatus.isOk());
+            ASSERT_FALSE(returnBoolStatus);
+
+            returnStatus = device1->startRecording();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
+
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                waitForFrameLocked(DataCallbackMsg::VIDEO_FRAME, l);
+                ASSERT_NE(UINT32_MAX, mVideoBufferIndex);
+                disableMsgType((unsigned int)DataCallbackMsg::VIDEO_FRAME, device1);
+            }
+
+            returnBoolStatus = device1->recordingEnabled();
+            ASSERT_TRUE(returnBoolStatus.isOk());
+            ASSERT_TRUE(returnBoolStatus);
+
+            Return<void> ret;
+            if (videoMetaEnabled) {
+                ret = device1->releaseRecordingFrameHandle(mVideoData, mVideoBufferIndex,
+                                                           mVideoNativeHandle);
+                ASSERT_TRUE(ret.isOk());
+            } else {
+                ret = device1->releaseRecordingFrame(mVideoData, mVideoBufferIndex);
+                ASSERT_TRUE(ret.isOk());
+            }
+
+            ret = device1->stopRecording();
+            ASSERT_TRUE(ret.isOk());
+
+            stopPreviewAndClose(device1);
         }
     }
 }
 
 // It shouldn't be possible to start recording without enabling preview first.
 TEST_F(CameraHidlTest, startRecordingFail) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
 
-                Return<bool> returnBoolStatus = device1->recordingEnabled();
-                ASSERT_TRUE(returnBoolStatus.isOk());
-                ASSERT_FALSE(returnBoolStatus);
+            Return<bool> returnBoolStatus = device1->recordingEnabled();
+            ASSERT_TRUE(returnBoolStatus.isOk());
+            ASSERT_FALSE(returnBoolStatus);
 
-                Return<Status> returnStatus = device1->startRecording();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_NE(Status::OK, returnStatus);
+            Return<Status> returnStatus = device1->startRecording();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_NE(Status::OK, returnStatus);
 
-                Return<void> ret = device1->close();
-                ASSERT_TRUE(ret.isOk());
-            }
+            Return<void> ret = device1->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
 
 // Check autofocus support if available.
 TEST_F(CameraHidlTest, autoFocus) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        std::vector<const char *> focusModes = {CameraParameters::FOCUS_MODE_AUTO,
-                CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE,
-                CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO};
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    std::vector<const char*> focusModes = {CameraParameters::FOCUS_MODE_AUTO,
+                                           CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE,
+                                           CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO};
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
 
-                CameraParameters cameraParams;
-                getParameters(device1, &cameraParams /*out*/);
+            CameraParameters cameraParams;
+            getParameters(device1, &cameraParams /*out*/);
 
-                if (Status::OK != isAutoFocusModeAvailable(cameraParams,
-                        CameraParameters::FOCUS_MODE_AUTO)) {
-                    Return<void> ret = device1->close();
-                    ASSERT_TRUE(ret.isOk());
+            if (Status::OK !=
+                isAutoFocusModeAvailable(cameraParams, CameraParameters::FOCUS_MODE_AUTO)) {
+                Return<void> ret = device1->close();
+                ASSERT_TRUE(ret.isOk());
+                continue;
+            }
+
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
+            startPreview(device1);
+            enableMsgType((unsigned int)NotifyCallbackMsg::FOCUS, device1);
+
+            for (auto& iter : focusModes) {
+                if (Status::OK != isAutoFocusModeAvailable(cameraParams, iter)) {
                     continue;
                 }
 
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
-                        &bufferHandler /*out*/);
-                startPreview(device1);
-                enableMsgType((unsigned int)NotifyCallbackMsg::FOCUS, device1);
-
-                for (auto &iter : focusModes) {
-                    if (Status::OK != isAutoFocusModeAvailable(cameraParams,
-                            iter)) {
-                        continue;
-                    }
-
-                    cameraParams.set(CameraParameters::KEY_FOCUS_MODE, iter);
-                    setParameters(device1, cameraParams);
-                    {
-                        std::unique_lock<std::mutex> l(mLock);
-                        mNotifyMessage = NotifyCallbackMsg::ERROR;
-                    }
-
-                    Return<Status> returnStatus = device1->autoFocus();
-                    ASSERT_TRUE(returnStatus.isOk());
-                    ASSERT_EQ(Status::OK, returnStatus);
-
-                    {
-                        std::unique_lock<std::mutex> l(mLock);
-                        while (NotifyCallbackMsg::FOCUS != mNotifyMessage) {
-                            auto timeout = std::chrono::system_clock::now() +
-                                    std::chrono::seconds(kAutoFocusTimeoutSec);
-                            ASSERT_NE(std::cv_status::timeout,
-                                    mResultCondition.wait_until(l, timeout));
-                        }
-                    }
+                cameraParams.set(CameraParameters::KEY_FOCUS_MODE, iter);
+                setParameters(device1, cameraParams);
+                {
+                    std::unique_lock<std::mutex> l(mLock);
+                    mNotifyMessage = NotifyCallbackMsg::ERROR;
                 }
 
-                disableMsgType((unsigned int)NotifyCallbackMsg::FOCUS, device1);
-                stopPreviewAndClose(device1);
+                Return<Status> returnStatus = device1->autoFocus();
+                ASSERT_TRUE(returnStatus.isOk());
+                ASSERT_EQ(Status::OK, returnStatus);
+
+                {
+                    std::unique_lock<std::mutex> l(mLock);
+                    while (NotifyCallbackMsg::FOCUS != mNotifyMessage) {
+                        auto timeout = std::chrono::system_clock::now() +
+                                       std::chrono::seconds(kAutoFocusTimeoutSec);
+                        ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
+                    }
+                }
             }
+
+            disableMsgType((unsigned int)NotifyCallbackMsg::FOCUS, device1);
+            stopPreviewAndClose(device1);
         }
     }
 }
 
 // In case autofocus is supported verify that it can be cancelled.
 TEST_F(CameraHidlTest, cancelAutoFocus) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
 
-                CameraParameters cameraParams;
-                getParameters(device1, &cameraParams /*out*/);
+            CameraParameters cameraParams;
+            getParameters(device1, &cameraParams /*out*/);
 
-                if (Status::OK != isAutoFocusModeAvailable(cameraParams,
-                        CameraParameters::FOCUS_MODE_AUTO)) {
-                    Return<void> ret = device1->close();
-                    ASSERT_TRUE(ret.isOk());
-                    continue;
-                }
-
-                // It should be fine to call before preview starts.
-                ASSERT_EQ(Status::OK, device1->cancelAutoFocus());
-
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
-                        &bufferHandler /*out*/);
-                startPreview(device1);
-
-                // It should be fine to call after preview starts too.
-                Return<Status> returnStatus = device1->cancelAutoFocus();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
-
-                returnStatus = device1->autoFocus();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
-
-                returnStatus = device1->cancelAutoFocus();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
-
-                stopPreviewAndClose(device1);
+            if (Status::OK !=
+                isAutoFocusModeAvailable(cameraParams, CameraParameters::FOCUS_MODE_AUTO)) {
+                Return<void> ret = device1->close();
+                ASSERT_TRUE(ret.isOk());
+                continue;
             }
+
+            // It should be fine to call before preview starts.
+            ASSERT_EQ(Status::OK, device1->cancelAutoFocus());
+
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
+            startPreview(device1);
+
+            // It should be fine to call after preview starts too.
+            Return<Status> returnStatus = device1->cancelAutoFocus();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
+
+            returnStatus = device1->autoFocus();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
+
+            returnStatus = device1->cancelAutoFocus();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
+
+            stopPreviewAndClose(device1);
         }
     }
 }
 
 // Check whether face detection is available and try to enable&disable.
 TEST_F(CameraHidlTest, sendCommandFaceDetection) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
 
-                CameraParameters cameraParams;
-                getParameters(device1, &cameraParams /*out*/);
+            CameraParameters cameraParams;
+            getParameters(device1, &cameraParams /*out*/);
 
-                int32_t hwFaces = cameraParams.getInt(
-                        CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW);
-                int32_t swFaces = cameraParams.getInt(
-                        CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW);
-                if ((0 >= hwFaces) && (0 >= swFaces)) {
-                    Return<void> ret = device1->close();
-                    ASSERT_TRUE(ret.isOk());
-                    continue;
-                }
-
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
-                        &bufferHandler /*out*/);
-                startPreview(device1);
-
-                if (0 < hwFaces) {
-                    Return<Status> returnStatus = device1->sendCommand(
-                            CommandType::START_FACE_DETECTION,
-                            CAMERA_FACE_DETECTION_HW, 0);
-                    ASSERT_TRUE(returnStatus.isOk());
-                    ASSERT_EQ(Status::OK, returnStatus);
-                    // TODO(epeev) : Enable and check for face notifications
-                    returnStatus = device1->sendCommand(
-                            CommandType::STOP_FACE_DETECTION,
-                            CAMERA_FACE_DETECTION_HW, 0);
-                    ASSERT_TRUE(returnStatus.isOk());
-                    ASSERT_EQ(Status::OK, returnStatus);
-                }
-
-                if (0 < swFaces) {
-                    Return<Status> returnStatus = device1->sendCommand(
-                            CommandType::START_FACE_DETECTION,
-                            CAMERA_FACE_DETECTION_SW, 0);
-                    ASSERT_TRUE(returnStatus.isOk());
-                    ASSERT_EQ(Status::OK, returnStatus);
-                    // TODO(epeev) : Enable and check for face notifications
-                    returnStatus = device1->sendCommand(
-                            CommandType::STOP_FACE_DETECTION,
-                            CAMERA_FACE_DETECTION_SW, 0);
-                    ASSERT_TRUE(returnStatus.isOk());
-                    ASSERT_EQ(Status::OK, returnStatus);
-                }
-
-                stopPreviewAndClose(device1);
+            int32_t hwFaces = cameraParams.getInt(CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW);
+            int32_t swFaces = cameraParams.getInt(CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW);
+            if ((0 >= hwFaces) && (0 >= swFaces)) {
+                Return<void> ret = device1->close();
+                ASSERT_TRUE(ret.isOk());
+                continue;
             }
+
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
+            startPreview(device1);
+
+            if (0 < hwFaces) {
+                Return<Status> returnStatus = device1->sendCommand(
+                    CommandType::START_FACE_DETECTION, CAMERA_FACE_DETECTION_HW, 0);
+                ASSERT_TRUE(returnStatus.isOk());
+                ASSERT_EQ(Status::OK, returnStatus);
+                // TODO(epeev) : Enable and check for face notifications
+                returnStatus = device1->sendCommand(CommandType::STOP_FACE_DETECTION,
+                                                    CAMERA_FACE_DETECTION_HW, 0);
+                ASSERT_TRUE(returnStatus.isOk());
+                ASSERT_EQ(Status::OK, returnStatus);
+            }
+
+            if (0 < swFaces) {
+                Return<Status> returnStatus = device1->sendCommand(
+                    CommandType::START_FACE_DETECTION, CAMERA_FACE_DETECTION_SW, 0);
+                ASSERT_TRUE(returnStatus.isOk());
+                ASSERT_EQ(Status::OK, returnStatus);
+                // TODO(epeev) : Enable and check for face notifications
+                returnStatus = device1->sendCommand(CommandType::STOP_FACE_DETECTION,
+                                                    CAMERA_FACE_DETECTION_SW, 0);
+                ASSERT_TRUE(returnStatus.isOk());
+                ASSERT_EQ(Status::OK, returnStatus);
+            }
+
+            stopPreviewAndClose(device1);
         }
     }
 }
 
 // Check whether smooth zoom is available and try to enable&disable.
 TEST_F(CameraHidlTest, sendCommandSmoothZoom) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
 
-                CameraParameters cameraParams;
-                getParameters(device1, &cameraParams /*out*/);
+            CameraParameters cameraParams;
+            getParameters(device1, &cameraParams /*out*/);
 
-                const char *smoothZoomStr = cameraParams.get(
-                        CameraParameters::KEY_SMOOTH_ZOOM_SUPPORTED);
-                bool smoothZoomSupported = ((nullptr != smoothZoomStr) &&
-                        (strcmp(smoothZoomStr, CameraParameters::TRUE) == 0)) ?
-                                true : false;
-                if (!smoothZoomSupported) {
-                    Return<void> ret = device1->close();
-                    ASSERT_TRUE(ret.isOk());
-                    continue;
-                }
-
-                int32_t maxZoom = cameraParams.getInt(
-                        CameraParameters::KEY_MAX_ZOOM);
-                ASSERT_TRUE(0 < maxZoom);
-
-                sp<BufferItemConsumer> bufferItemConsumer;
-                sp<BufferItemHander> bufferHandler;
-                setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
-                        &bufferHandler /*out*/);
-                startPreview(device1);
-                setParameters(device1, cameraParams);
-
-                Return<Status> returnStatus = device1->sendCommand(
-                        CommandType::START_SMOOTH_ZOOM, maxZoom, 0);
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
-                // TODO(epeev) : Enable and check for face notifications
-                returnStatus = device1->sendCommand(
-                        CommandType::STOP_SMOOTH_ZOOM, 0, 0);
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
-
-                stopPreviewAndClose(device1);
+            const char* smoothZoomStr =
+                cameraParams.get(CameraParameters::KEY_SMOOTH_ZOOM_SUPPORTED);
+            bool smoothZoomSupported =
+                ((nullptr != smoothZoomStr) && (strcmp(smoothZoomStr, CameraParameters::TRUE) == 0))
+                    ? true
+                    : false;
+            if (!smoothZoomSupported) {
+                Return<void> ret = device1->close();
+                ASSERT_TRUE(ret.isOk());
+                continue;
             }
+
+            int32_t maxZoom = cameraParams.getInt(CameraParameters::KEY_MAX_ZOOM);
+            ASSERT_TRUE(0 < maxZoom);
+
+            sp<BufferItemConsumer> bufferItemConsumer;
+            sp<BufferItemHander> bufferHandler;
+            setupPreviewWindow(device1, &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
+            startPreview(device1);
+            setParameters(device1, cameraParams);
+
+            Return<Status> returnStatus =
+                device1->sendCommand(CommandType::START_SMOOTH_ZOOM, maxZoom, 0);
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
+            // TODO(epeev) : Enable and check for face notifications
+            returnStatus = device1->sendCommand(CommandType::STOP_SMOOTH_ZOOM, 0, 0);
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
+
+            stopPreviewAndClose(device1);
         }
     }
 }
 
 // Basic sanity tests related to camera parameters.
 TEST_F(CameraHidlTest, getSetParameters) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
 
-                CameraParameters cameraParams;
-                getParameters(device1, &cameraParams /*out*/);
+            CameraParameters cameraParams;
+            getParameters(device1, &cameraParams /*out*/);
 
-                int32_t width, height;
-                cameraParams.getPictureSize(&width, &height);
-                ASSERT_TRUE((0 < width) && (0 < height));
-                cameraParams.getPreviewSize(&width, &height);
-                ASSERT_TRUE((0 < width) && (0 < height));
-                int32_t minFps, maxFps;
-                cameraParams.getPreviewFpsRange(&minFps, &maxFps);
-                ASSERT_TRUE((0 < minFps) && (0 < maxFps));
-                ASSERT_NE(nullptr, cameraParams.getPreviewFormat());
-                ASSERT_NE(nullptr, cameraParams.getPictureFormat());
-                ASSERT_TRUE(strcmp(CameraParameters::PIXEL_FORMAT_JPEG,
-                        cameraParams.getPictureFormat()) == 0);
+            int32_t width, height;
+            cameraParams.getPictureSize(&width, &height);
+            ASSERT_TRUE((0 < width) && (0 < height));
+            cameraParams.getPreviewSize(&width, &height);
+            ASSERT_TRUE((0 < width) && (0 < height));
+            int32_t minFps, maxFps;
+            cameraParams.getPreviewFpsRange(&minFps, &maxFps);
+            ASSERT_TRUE((0 < minFps) && (0 < maxFps));
+            ASSERT_NE(nullptr, cameraParams.getPreviewFormat());
+            ASSERT_NE(nullptr, cameraParams.getPictureFormat());
+            ASSERT_TRUE(
+                strcmp(CameraParameters::PIXEL_FORMAT_JPEG, cameraParams.getPictureFormat()) == 0);
 
-                const char *flashMode = cameraParams.get(
-                        CameraParameters::KEY_FLASH_MODE);
-                ASSERT_TRUE((nullptr == flashMode) || (strcmp(
-                        CameraParameters::FLASH_MODE_OFF, flashMode) == 0));
+            const char* flashMode = cameraParams.get(CameraParameters::KEY_FLASH_MODE);
+            ASSERT_TRUE((nullptr == flashMode) ||
+                        (strcmp(CameraParameters::FLASH_MODE_OFF, flashMode) == 0));
 
-                const char *wbMode = cameraParams.get(
-                        CameraParameters::KEY_WHITE_BALANCE);
-                ASSERT_TRUE((nullptr == wbMode) || (strcmp(
-                        CameraParameters::WHITE_BALANCE_AUTO, wbMode) == 0));
+            const char* wbMode = cameraParams.get(CameraParameters::KEY_WHITE_BALANCE);
+            ASSERT_TRUE((nullptr == wbMode) ||
+                        (strcmp(CameraParameters::WHITE_BALANCE_AUTO, wbMode) == 0));
 
-                const char *effect = cameraParams.get(
-                        CameraParameters::KEY_EFFECT);
-                ASSERT_TRUE((nullptr == effect) || (strcmp(
-                        CameraParameters::EFFECT_NONE, effect) == 0));
+            const char* effect = cameraParams.get(CameraParameters::KEY_EFFECT);
+            ASSERT_TRUE((nullptr == effect) ||
+                        (strcmp(CameraParameters::EFFECT_NONE, effect) == 0));
 
-                ::android::Vector<Size> previewSizes;
-                cameraParams.getSupportedPreviewSizes(previewSizes);
-                ASSERT_FALSE(previewSizes.empty());
-                ::android::Vector<Size> pictureSizes;
-                cameraParams.getSupportedPictureSizes(pictureSizes);
-                ASSERT_FALSE(pictureSizes.empty());
-                const char *previewFormats = cameraParams.get(
-                        CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS);
-                ASSERT_NE(nullptr, previewFormats);
-                ::android::String8 previewFormatsString(previewFormats);
-                ASSERT_TRUE(previewFormatsString.contains(
-                        CameraParameters::PIXEL_FORMAT_YUV420SP));
-                ASSERT_NE(nullptr, cameraParams.get(
-                        CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS));
-                ASSERT_NE(nullptr, cameraParams.get(
-                        CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES));
-                const char *focusModes = cameraParams.get(
-                        CameraParameters::KEY_SUPPORTED_FOCUS_MODES);
-                ASSERT_NE(nullptr, focusModes);
-                ::android::String8 focusModesString(focusModes);
-                const char *focusMode = cameraParams.get(
-                        CameraParameters::KEY_FOCUS_MODE);
-                ASSERT_NE(nullptr, focusMode);
-                // Auto focus mode should be default
-                if (focusModesString.contains(
-                        CameraParameters::FOCUS_MODE_AUTO)) {
-                    ASSERT_TRUE(strcmp(
-                            CameraParameters::FOCUS_MODE_AUTO, focusMode) == 0);
-                }
-                ASSERT_TRUE(0 < cameraParams.getInt(
-                        CameraParameters::KEY_FOCAL_LENGTH));
-                int32_t horizontalViewAngle = cameraParams.getInt(
-                        CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE);
-                ASSERT_TRUE((0 < horizontalViewAngle) &&
-                            (360 >= horizontalViewAngle));
-                int32_t verticalViewAngle = cameraParams.getInt(
-                        CameraParameters::KEY_VERTICAL_VIEW_ANGLE);
-                ASSERT_TRUE((0 < verticalViewAngle) &&
-                            (360 >= verticalViewAngle));
-                int32_t jpegQuality = cameraParams.getInt(
-                        CameraParameters::KEY_JPEG_QUALITY);
-                ASSERT_TRUE((1 <= jpegQuality) && (100 >= jpegQuality));
-                int32_t jpegThumbQuality = cameraParams.getInt(
-                        CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY);
-                ASSERT_TRUE((1 <= jpegThumbQuality) &&
-                            (100 >= jpegThumbQuality));
-
-                cameraParams.setPictureSize(pictureSizes[0].width,
-                        pictureSizes[0].height);
-                cameraParams.setPreviewSize(previewSizes[0].width,
-                        previewSizes[0].height);
-
-                setParameters(device1, cameraParams);
-                getParameters(device1, &cameraParams /*out*/);
-
-                cameraParams.getPictureSize(&width, &height);
-                ASSERT_TRUE((pictureSizes[0].width == width) &&
-                        (pictureSizes[0].height == height));
-                cameraParams.getPreviewSize(&width, &height);
-                ASSERT_TRUE((previewSizes[0].width == width) &&
-                        (previewSizes[0].height == height));
-
-                Return<void> ret = device1->close();
-                ASSERT_TRUE(ret.isOk());
+            ::android::Vector<Size> previewSizes;
+            cameraParams.getSupportedPreviewSizes(previewSizes);
+            ASSERT_FALSE(previewSizes.empty());
+            ::android::Vector<Size> pictureSizes;
+            cameraParams.getSupportedPictureSizes(pictureSizes);
+            ASSERT_FALSE(pictureSizes.empty());
+            const char* previewFormats =
+                cameraParams.get(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS);
+            ASSERT_NE(nullptr, previewFormats);
+            ::android::String8 previewFormatsString(previewFormats);
+            ASSERT_TRUE(previewFormatsString.contains(CameraParameters::PIXEL_FORMAT_YUV420SP));
+            ASSERT_NE(nullptr, cameraParams.get(CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS));
+            ASSERT_NE(nullptr,
+                      cameraParams.get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES));
+            const char* focusModes = cameraParams.get(CameraParameters::KEY_SUPPORTED_FOCUS_MODES);
+            ASSERT_NE(nullptr, focusModes);
+            ::android::String8 focusModesString(focusModes);
+            const char* focusMode = cameraParams.get(CameraParameters::KEY_FOCUS_MODE);
+            ASSERT_NE(nullptr, focusMode);
+            // Auto focus mode should be default
+            if (focusModesString.contains(CameraParameters::FOCUS_MODE_AUTO)) {
+                ASSERT_TRUE(strcmp(CameraParameters::FOCUS_MODE_AUTO, focusMode) == 0);
             }
+            ASSERT_TRUE(0 < cameraParams.getInt(CameraParameters::KEY_FOCAL_LENGTH));
+            int32_t horizontalViewAngle =
+                cameraParams.getInt(CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE);
+            ASSERT_TRUE((0 < horizontalViewAngle) && (360 >= horizontalViewAngle));
+            int32_t verticalViewAngle =
+                cameraParams.getInt(CameraParameters::KEY_VERTICAL_VIEW_ANGLE);
+            ASSERT_TRUE((0 < verticalViewAngle) && (360 >= verticalViewAngle));
+            int32_t jpegQuality = cameraParams.getInt(CameraParameters::KEY_JPEG_QUALITY);
+            ASSERT_TRUE((1 <= jpegQuality) && (100 >= jpegQuality));
+            int32_t jpegThumbQuality =
+                cameraParams.getInt(CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY);
+            ASSERT_TRUE((1 <= jpegThumbQuality) && (100 >= jpegThumbQuality));
+
+            cameraParams.setPictureSize(pictureSizes[0].width, pictureSizes[0].height);
+            cameraParams.setPreviewSize(previewSizes[0].width, previewSizes[0].height);
+
+            setParameters(device1, cameraParams);
+            getParameters(device1, &cameraParams /*out*/);
+
+            cameraParams.getPictureSize(&width, &height);
+            ASSERT_TRUE((pictureSizes[0].width == width) && (pictureSizes[0].height == height));
+            cameraParams.getPreviewSize(&width, &height);
+            ASSERT_TRUE((previewSizes[0].width == width) && (previewSizes[0].height == height));
+
+            Return<void> ret = device1->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -2011,50 +1831,36 @@
 // Verify that the static camera characteristics can be retrieved
 // successfully.
 TEST_F(CameraHidlTest, getCameraCharacteristics) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    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());
-                Return<void> ret;
-                ret = provider.second->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;
-                    });
-                ASSERT_TRUE(ret.isOk());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == 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());
+            Return<void> ret;
+            ret = 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;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-                ret = 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();
-                        int result = validate_camera_metadata_structure(
-                                metadata, &expectedSize);
-                        ASSERT_TRUE((result == 0) ||
-                                (result == CAMERA_METADATA_VALIDATION_SHIFTED));
-                        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);
-                    });
-                ASSERT_TRUE(ret.isOk());
-            }
+            ret = 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();
+                int result = validate_camera_metadata_structure(metadata, &expectedSize);
+                ASSERT_TRUE((result == 0) || (result == CAMERA_METADATA_VALIDATION_SHIFTED));
+                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);
+            });
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -2062,273 +1868,235 @@
 //In case it is supported verify that torch can be enabled.
 //Check for corresponding toch callbacks as well.
 TEST_F(CameraHidlTest, setTorchMode) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        bool torchControlSupported = false;
-        Return<void> ret;
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    bool torchControlSupported = false;
+    Return<void> ret;
 
-        ret = provider.second->isSetTorchModeSupported(
-            [&](auto status, bool support) {
-                ALOGI("isSetTorchModeSupported returns status:%d supported:%d",
-                        (int)status, support);
-                ASSERT_EQ(Status::OK, status);
-                torchControlSupported = support;
-            });
+    ret = mProvider->isSetTorchModeSupported([&](auto status, bool support) {
+        ALOGI("isSetTorchModeSupported returns status:%d supported:%d", (int)status, support);
+        ASSERT_EQ(Status::OK, status);
+        torchControlSupported = support;
+    });
 
+    sp<TorchProviderCb> cb = new TorchProviderCb(this);
+    Return<Status> returnStatus = mProvider->setCallback(cb);
+    ASSERT_TRUE(returnStatus.isOk());
+    ASSERT_EQ(Status::OK, returnStatus);
 
-        sp<TorchProviderCb> cb = new TorchProviderCb(this);
-        Return<Status> returnStatus = provider.second->setCallback(cb);
-        ASSERT_TRUE(returnStatus.isOk());
-        ASSERT_EQ(Status::OK, returnStatus);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == 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());
+            ret = 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;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    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());
-                ret = provider.second->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;
-                    });
-                ASSERT_TRUE(ret.isOk());
-
-                mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
-                returnStatus = device3_2->setTorchMode(TorchMode::ON);
-                ASSERT_TRUE(returnStatus.isOk());
-                if (!torchControlSupported) {
-                    ASSERT_EQ(Status::METHOD_NOT_SUPPORTED, returnStatus);
-                } else {
-                    ASSERT_TRUE(returnStatus == Status::OK ||
-                                returnStatus == Status::OPERATION_NOT_SUPPORTED);
-                    if (returnStatus == Status::OK) {
-                        {
-                            std::unique_lock<std::mutex> l(mTorchLock);
-                            while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
-                                auto timeout = std::chrono::system_clock::now() +
-                                        std::chrono::seconds(kTorchTimeoutSec);
-                                ASSERT_NE(std::cv_status::timeout,
-                                        mTorchCond.wait_until(l, timeout));
-                            }
-                            ASSERT_EQ(TorchModeStatus::AVAILABLE_ON,
-                                    mTorchStatus);
-                            mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
+            mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
+            returnStatus = device3_2->setTorchMode(TorchMode::ON);
+            ASSERT_TRUE(returnStatus.isOk());
+            if (!torchControlSupported) {
+                ASSERT_EQ(Status::METHOD_NOT_SUPPORTED, returnStatus);
+            } else {
+                ASSERT_TRUE(returnStatus == Status::OK ||
+                            returnStatus == Status::OPERATION_NOT_SUPPORTED);
+                if (returnStatus == Status::OK) {
+                    {
+                        std::unique_lock<std::mutex> l(mTorchLock);
+                        while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
+                            auto timeout = std::chrono::system_clock::now() +
+                                           std::chrono::seconds(kTorchTimeoutSec);
+                            ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout));
                         }
+                        ASSERT_EQ(TorchModeStatus::AVAILABLE_ON, mTorchStatus);
+                        mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
+                    }
 
-                        returnStatus = device3_2->setTorchMode(TorchMode::OFF);
-                        ASSERT_TRUE(returnStatus.isOk());
-                        ASSERT_EQ(Status::OK, returnStatus);
+                    returnStatus = device3_2->setTorchMode(TorchMode::OFF);
+                    ASSERT_TRUE(returnStatus.isOk());
+                    ASSERT_EQ(Status::OK, returnStatus);
 
-                        {
-                            std::unique_lock<std::mutex> l(mTorchLock);
-                            while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
-                                auto timeout = std::chrono::system_clock::now() +
-                                        std::chrono::seconds(kTorchTimeoutSec);
-                                ASSERT_NE(std::cv_status::timeout,
-                                        mTorchCond.wait_until(l, timeout));
-                            }
-                            ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF,
-                                    mTorchStatus);
+                    {
+                        std::unique_lock<std::mutex> l(mTorchLock);
+                        while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
+                            auto timeout = std::chrono::system_clock::now() +
+                                           std::chrono::seconds(kTorchTimeoutSec);
+                            ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout));
                         }
+                        ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF, mTorchStatus);
                     }
                 }
-            } else if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                ALOGI("dumpState: Testing camera device %s", name.c_str());
-                ret = provider.second->getCameraDeviceInterface_V1_x(
-                    name,
-                    [&](auto status, const auto& device) {
-                        ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
-                              (int)status);
-                        ASSERT_EQ(Status::OK, status);
-                        ASSERT_NE(device, nullptr);
-                        device1 = device;
-                    });
-                ASSERT_TRUE(ret.isOk());
-
-                mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
-                returnStatus = device1->setTorchMode(TorchMode::ON);
-                ASSERT_TRUE(returnStatus.isOk());
-                if (!torchControlSupported) {
-                    ASSERT_EQ(Status::METHOD_NOT_SUPPORTED, returnStatus);
-                } else {
-                    ASSERT_TRUE(returnStatus == Status::OK ||
-                                returnStatus == Status::OPERATION_NOT_SUPPORTED);
-                    if (returnStatus == Status::OK) {
-                        {
-                            std::unique_lock<std::mutex> l(mTorchLock);
-                            while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
-                                auto timeout = std::chrono::system_clock::now() +
-                                        std::chrono::seconds(kTorchTimeoutSec);
-                                ASSERT_NE(std::cv_status::timeout,
-                                        mTorchCond.wait_until(l, timeout));
-                            }
-                            ASSERT_EQ(TorchModeStatus::AVAILABLE_ON,
-                                    mTorchStatus);
-                            mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
-                        }
-
-                        returnStatus = device1->setTorchMode(TorchMode::OFF);
-                        ASSERT_TRUE(returnStatus.isOk());
-                        ASSERT_EQ(Status::OK, returnStatus);
-
-                        {
-                            std::unique_lock<std::mutex> l(mTorchLock);
-                            while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
-                                auto timeout = std::chrono::system_clock::now() +
-                                        std::chrono::seconds(kTorchTimeoutSec);
-                                ASSERT_NE(std::cv_status::timeout,
-                                        mTorchCond.wait_until(l, timeout));
-                            }
-                            ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF,
-                                    mTorchStatus);
-                        }
-                    }
-                }
-                ret = device1->close();
-                ASSERT_TRUE(ret.isOk());
             }
-        }
+        } else if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            ALOGI("dumpState: Testing camera device %s", name.c_str());
+            ret = mProvider->getCameraDeviceInterface_V1_x(
+                name, [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device1 = device;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-        returnStatus = provider.second->setCallback(nullptr);
-        ASSERT_TRUE(returnStatus.isOk());
-        ASSERT_EQ(Status::OK, returnStatus);
+            mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
+            returnStatus = device1->setTorchMode(TorchMode::ON);
+            ASSERT_TRUE(returnStatus.isOk());
+            if (!torchControlSupported) {
+                ASSERT_EQ(Status::METHOD_NOT_SUPPORTED, returnStatus);
+            } else {
+                ASSERT_TRUE(returnStatus == Status::OK ||
+                            returnStatus == Status::OPERATION_NOT_SUPPORTED);
+                if (returnStatus == Status::OK) {
+                    {
+                        std::unique_lock<std::mutex> l(mTorchLock);
+                        while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
+                            auto timeout = std::chrono::system_clock::now() +
+                                           std::chrono::seconds(kTorchTimeoutSec);
+                            ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout));
+                        }
+                        ASSERT_EQ(TorchModeStatus::AVAILABLE_ON, mTorchStatus);
+                        mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
+                    }
+
+                    returnStatus = device1->setTorchMode(TorchMode::OFF);
+                    ASSERT_TRUE(returnStatus.isOk());
+                    ASSERT_EQ(Status::OK, returnStatus);
+
+                    {
+                        std::unique_lock<std::mutex> l(mTorchLock);
+                        while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
+                            auto timeout = std::chrono::system_clock::now() +
+                                           std::chrono::seconds(kTorchTimeoutSec);
+                            ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout));
+                        }
+                        ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF, mTorchStatus);
+                    }
+                }
+            }
+            ret = device1->close();
+            ASSERT_TRUE(ret.isOk());
+        }
     }
+
+    returnStatus = mProvider->setCallback(nullptr);
+    ASSERT_TRUE(returnStatus.isOk());
+    ASSERT_EQ(Status::OK, returnStatus);
 }
 
 // Check dump functionality.
 TEST_F(CameraHidlTest, dumpState) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        Return<void> ret;
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    Return<void> ret;
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                ::android::sp<ICameraDevice> device3_2;
-                ALOGI("dumpState: Testing camera device %s", name.c_str());
-                ret = provider.second->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;
-                    });
-                ASSERT_TRUE(ret.isOk());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            ::android::sp<ICameraDevice> device3_2;
+            ALOGI("dumpState: Testing camera device %s", name.c_str());
+            ret = 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;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-                native_handle_t* raw_handle = native_handle_create(1, 0);
-                raw_handle->data[0] = open(kDumpOutput, O_RDWR);
-                ASSERT_GE(raw_handle->data[0], 0);
-                hidl_handle handle = raw_handle;
-                ret= device3_2->dumpState(handle);
-                ASSERT_TRUE(ret.isOk());
-                close(raw_handle->data[0]);
-                native_handle_delete(raw_handle);
-            } else if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                ALOGI("dumpState: Testing camera device %s", name.c_str());
-                ret = provider.second->getCameraDeviceInterface_V1_x(
-                    name,
-                    [&](auto status, const auto& device) {
-                        ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
-                              (int)status);
-                        ASSERT_EQ(Status::OK, status);
-                        ASSERT_NE(device, nullptr);
-                        device1 = device;
-                    });
-                ASSERT_TRUE(ret.isOk());
+            native_handle_t* raw_handle = native_handle_create(1, 0);
+            raw_handle->data[0] = open(kDumpOutput, O_RDWR);
+            ASSERT_GE(raw_handle->data[0], 0);
+            hidl_handle handle = raw_handle;
+            ret = device3_2->dumpState(handle);
+            ASSERT_TRUE(ret.isOk());
+            close(raw_handle->data[0]);
+            native_handle_delete(raw_handle);
+        } else if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            ALOGI("dumpState: Testing camera device %s", name.c_str());
+            ret = mProvider->getCameraDeviceInterface_V1_x(
+                name, [&](auto status, const auto& device) {
+                    ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
+                    ASSERT_EQ(Status::OK, status);
+                    ASSERT_NE(device, nullptr);
+                    device1 = device;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-                native_handle_t* raw_handle = native_handle_create(1, 0);
-                raw_handle->data[0] = open(kDumpOutput, O_RDWR);
-                ASSERT_GE(raw_handle->data[0], 0);
-                hidl_handle handle = raw_handle;
-                Return<Status> returnStatus = device1->dumpState(handle);
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
-                close(raw_handle->data[0]);
-                native_handle_delete(raw_handle);
-            }
+            native_handle_t* raw_handle = native_handle_create(1, 0);
+            raw_handle->data[0] = open(kDumpOutput, O_RDWR);
+            ASSERT_GE(raw_handle->data[0], 0);
+            hidl_handle handle = raw_handle;
+            Return<Status> returnStatus = device1->dumpState(handle);
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
+            close(raw_handle->data[0]);
+            native_handle_delete(raw_handle);
         }
     }
 }
 
 // Open, dumpStates, then close
 TEST_F(CameraHidlTest, openClose) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        Return<void> ret;
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    Return<void> ret;
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    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());
-                ret = provider.second->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;
-                    });
-                ASSERT_TRUE(ret.isOk());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == 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());
+            ret = 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;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-                sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
-                sp<ICameraDeviceSession> session;
-                ret = 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;
-                    });
-                ASSERT_TRUE(ret.isOk());
+            sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
+            sp<ICameraDeviceSession> session;
+            ret = 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;
+            });
+            ASSERT_TRUE(ret.isOk());
 
-                native_handle_t* raw_handle = native_handle_create(1, 0);
-                raw_handle->data[0] = open(kDumpOutput, O_RDWR);
-                ASSERT_GE(raw_handle->data[0], 0);
-                hidl_handle handle = raw_handle;
-                ret = device3_2->dumpState(handle);
-                ASSERT_TRUE(ret.isOk());
-                close(raw_handle->data[0]);
-                native_handle_delete(raw_handle);
+            native_handle_t* raw_handle = native_handle_create(1, 0);
+            raw_handle->data[0] = open(kDumpOutput, O_RDWR);
+            ASSERT_GE(raw_handle->data[0], 0);
+            hidl_handle handle = raw_handle;
+            ret = device3_2->dumpState(handle);
+            ASSERT_TRUE(ret.isOk());
+            close(raw_handle->data[0]);
+            native_handle_delete(raw_handle);
 
-                ret = session->close();
-                ASSERT_TRUE(ret.isOk());
-                // 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
-            } else if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_1_0) {
-                sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
-                openCameraDevice(name, provider.second, &device1 /*out*/);
-                ASSERT_NE(nullptr, device1.get());
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
+            // 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
+        } else if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_1_0) {
+            sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+            openCameraDevice(name, mProvider, &device1 /*out*/);
+            ASSERT_NE(nullptr, device1.get());
 
-                native_handle_t* raw_handle = native_handle_create(1, 0);
-                raw_handle->data[0] = open(kDumpOutput, O_RDWR);
-                ASSERT_GE(raw_handle->data[0], 0);
-                hidl_handle handle = raw_handle;
-                Return<Status> returnStatus = device1->dumpState(handle);
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
-                close(raw_handle->data[0]);
-                native_handle_delete(raw_handle);
+            native_handle_t* raw_handle = native_handle_create(1, 0);
+            raw_handle->data[0] = open(kDumpOutput, O_RDWR);
+            ASSERT_GE(raw_handle->data[0], 0);
+            hidl_handle handle = raw_handle;
+            Return<Status> returnStatus = device1->dumpState(handle);
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
+            close(raw_handle->data[0]);
+            native_handle_delete(raw_handle);
 
-                ret = device1->close();
-                ASSERT_TRUE(ret.isOk());
-            }
+            ret = device1->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -2336,46 +2104,38 @@
 // Check whether all common default request settings can be sucessfully
 // constructed.
 TEST_F(CameraHidlTest, constructDefaultRequestSettings) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
-                Return<void> ret;
-                ALOGI("constructDefaultRequestSettings: Testing camera device %s",
-                      name.c_str());
-                ret = provider.second->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;
-                    });
-                ASSERT_TRUE(ret.isOk());
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+            Return<void> ret;
+            ALOGI("constructDefaultRequestSettings: Testing camera device %s", name.c_str());
+            ret = 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;
+                });
+            ASSERT_TRUE(ret.isOk());
 
-                sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
-                sp<ICameraDeviceSession> session;
-                ret = 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;
-                    });
-                ASSERT_TRUE(ret.isOk());
+            sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
+            sp<ICameraDeviceSession> session;
+            ret = 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;
+            });
+            ASSERT_TRUE(ret.isOk());
 
-                for (uint32_t t = (uint32_t) RequestTemplate::PREVIEW;
-                        t <= (uint32_t) RequestTemplate::MANUAL; t++) {
-                    RequestTemplate reqTemplate = (RequestTemplate) t;
-                    ret = session->constructDefaultRequestSettings(
-                        reqTemplate,
-                        [&](auto status, const auto& req) {
+            for (uint32_t t = (uint32_t)RequestTemplate::PREVIEW;
+                 t <= (uint32_t)RequestTemplate::MANUAL; t++) {
+                RequestTemplate reqTemplate = (RequestTemplate)t;
+                ret =
+                    session->constructDefaultRequestSettings(
+                        reqTemplate, [&](auto status, const auto& req) {
                             ALOGI("constructDefaultRequestSettings returns status:%d",
                                   (int)status);
                             if (reqTemplate == RequestTemplate::ZERO_SHUTTER_LAG ||
@@ -2406,11 +2166,10 @@
                                 ASSERT_EQ(0u, req.size());
                             }
                         });
-                    ASSERT_TRUE(ret.isOk());
-                }
-                ret = session->close();
                 ASSERT_TRUE(ret.isOk());
             }
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -2418,138 +2177,131 @@
 // Verify that all supported stream formats and sizes can be configured
 // successfully.
 TEST_F(CameraHidlTest, configureStreamsAvailableOutputs) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        std::vector<AvailableStream> outputStreams;
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    std::vector<AvailableStream> outputStreams;
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                camera_metadata_t *staticMeta;
-                Return<void> ret;
-                sp<ICameraDeviceSession> session;
-                openEmptyDeviceSession(name, provider.second, &session /*out*/,
-                        &staticMeta /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            camera_metadata_t* staticMeta;
+            Return<void> ret;
+            sp<ICameraDeviceSession> session;
+            openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
 
-                outputStreams.clear();
-                ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
-                        outputStreams));
-                ASSERT_NE(0u, outputStreams.size());
+            outputStreams.clear();
+            ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
+            ASSERT_NE(0u, outputStreams.size());
 
-                int32_t streamId = 0;
-                for (auto &it : outputStreams) {
-                    Stream stream = {streamId, StreamType::OUTPUT,
-                            static_cast<uint32_t> (it.width),
-                            static_cast<uint32_t> (it.height),
-                            static_cast<PixelFormat> (it.format), 0, 0,
-                            StreamRotation::ROTATION_0};
-                    ::android::hardware::hidl_vec<Stream> streams = {stream};
-                    StreamConfiguration config = {streams,
-                            StreamConfigurationMode::NORMAL_MODE};
-                    ret = session->configureStreams(config, [streamId] (Status s,
-                            HalStreamConfiguration halConfig) {
+            int32_t streamId = 0;
+            for (auto& it : outputStreams) {
+                Stream stream = {streamId,
+                                 StreamType::OUTPUT,
+                                 static_cast<uint32_t>(it.width),
+                                 static_cast<uint32_t>(it.height),
+                                 static_cast<PixelFormat>(it.format),
+                                 0,
+                                 0,
+                                 StreamRotation::ROTATION_0};
+                ::android::hardware::hidl_vec<Stream> streams = {stream};
+                StreamConfiguration config = {streams, StreamConfigurationMode::NORMAL_MODE};
+                ret = session->configureStreams(
+                    config, [streamId](Status s, HalStreamConfiguration halConfig) {
                         ASSERT_EQ(Status::OK, s);
                         ASSERT_EQ(1u, halConfig.streams.size());
                         ASSERT_EQ(halConfig.streams[0].id, streamId);
                     });
-                    ASSERT_TRUE(ret.isOk());
-                    streamId++;
-                }
-
-                free_camera_metadata(staticMeta);
-                ret = session->close();
                 ASSERT_TRUE(ret.isOk());
+                streamId++;
             }
+
+            free_camera_metadata(staticMeta);
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
 
 // Check for correct handling of invalid/incorrect configuration parameters.
 TEST_F(CameraHidlTest, configureStreamsInvalidOutputs) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        std::vector<AvailableStream> outputStreams;
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    std::vector<AvailableStream> outputStreams;
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                camera_metadata_t *staticMeta;
-                Return<void> ret;
-                sp<ICameraDeviceSession> session;
-                openEmptyDeviceSession(name, provider.second, &session /*out*/,
-                        &staticMeta /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            camera_metadata_t* staticMeta;
+            Return<void> ret;
+            sp<ICameraDeviceSession> session;
+            openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
 
-                outputStreams.clear();
-                ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
-                        outputStreams));
-                ASSERT_NE(0u, outputStreams.size());
+            outputStreams.clear();
+            ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
+            ASSERT_NE(0u, outputStreams.size());
 
-                int32_t streamId = 0;
-                Stream stream = {streamId++, StreamType::OUTPUT,
-                        static_cast<uint32_t> (0),
-                        static_cast<uint32_t> (0),
-                        static_cast<PixelFormat> (outputStreams[0].format),
-                        0, 0, StreamRotation::ROTATION_0};
-                ::android::hardware::hidl_vec<Stream> streams = {stream};
-                StreamConfiguration config = {streams,
-                        StreamConfigurationMode::NORMAL_MODE};
-                ret = session->configureStreams(config, [] (Status s,
-                        HalStreamConfiguration) {
-                    ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
-                                (Status::INTERNAL_ERROR == s));
-                });
-                ASSERT_TRUE(ret.isOk());
+            int32_t streamId = 0;
+            Stream stream = {streamId++,
+                             StreamType::OUTPUT,
+                             static_cast<uint32_t>(0),
+                             static_cast<uint32_t>(0),
+                             static_cast<PixelFormat>(outputStreams[0].format),
+                             0,
+                             0,
+                             StreamRotation::ROTATION_0};
+            ::android::hardware::hidl_vec<Stream> streams = {stream};
+            StreamConfiguration config = {streams, StreamConfigurationMode::NORMAL_MODE};
+            ret = session->configureStreams(config, [](Status s, HalStreamConfiguration) {
+                ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) || (Status::INTERNAL_ERROR == s));
+            });
+            ASSERT_TRUE(ret.isOk());
 
-                stream = {streamId++, StreamType::OUTPUT,
-                        static_cast<uint32_t> (UINT32_MAX),
-                        static_cast<uint32_t> (UINT32_MAX),
-                        static_cast<PixelFormat> (outputStreams[0].format),
-                        0, 0, StreamRotation::ROTATION_0};
+            stream = {streamId++,
+                      StreamType::OUTPUT,
+                      static_cast<uint32_t>(UINT32_MAX),
+                      static_cast<uint32_t>(UINT32_MAX),
+                      static_cast<PixelFormat>(outputStreams[0].format),
+                      0,
+                      0,
+                      StreamRotation::ROTATION_0};
+            streams[0] = stream;
+            config = {streams, StreamConfigurationMode::NORMAL_MODE};
+            ret = session->configureStreams(config, [](Status s, HalStreamConfiguration) {
+                ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+            });
+            ASSERT_TRUE(ret.isOk());
+
+            for (auto& it : outputStreams) {
+                stream = {streamId++,
+                          StreamType::OUTPUT,
+                          static_cast<uint32_t>(it.width),
+                          static_cast<uint32_t>(it.height),
+                          static_cast<PixelFormat>(UINT32_MAX),
+                          0,
+                          0,
+                          StreamRotation::ROTATION_0};
                 streams[0] = stream;
-                config = {streams,
-                        StreamConfigurationMode::NORMAL_MODE};
-                ret = session->configureStreams(config, [] (Status s,
-                        HalStreamConfiguration) {
+                config = {streams, StreamConfigurationMode::NORMAL_MODE};
+                ret = session->configureStreams(config, [](Status s, HalStreamConfiguration) {
                     ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
                 });
                 ASSERT_TRUE(ret.isOk());
 
-                for (auto &it : outputStreams) {
-                    stream = {streamId++, StreamType::OUTPUT,
-                            static_cast<uint32_t> (it.width),
-                            static_cast<uint32_t> (it.height),
-                            static_cast<PixelFormat> (UINT32_MAX),
-                            0, 0, StreamRotation::ROTATION_0};
-                    streams[0] = stream;
-                    config = {streams,
-                            StreamConfigurationMode::NORMAL_MODE};
-                    ret = session->configureStreams(config, [] (Status s,
-                            HalStreamConfiguration) {
-                        ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
-                    });
-                    ASSERT_TRUE(ret.isOk());
-
-                    stream = {streamId++, StreamType::OUTPUT,
-                            static_cast<uint32_t> (it.width),
-                            static_cast<uint32_t> (it.height),
-                            static_cast<PixelFormat> (it.format),
-                            0, 0, static_cast<StreamRotation> (UINT32_MAX)};
-                    streams[0] = stream;
-                    config = {streams,
-                            StreamConfigurationMode::NORMAL_MODE};
-                    ret = session->configureStreams(config, [] (Status s,
-                            HalStreamConfiguration) {
-                        ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
-                    });
-                    ASSERT_TRUE(ret.isOk());
-                }
-
-                free_camera_metadata(staticMeta);
-                ret = session->close();
+                stream = {streamId++,
+                          StreamType::OUTPUT,
+                          static_cast<uint32_t>(it.width),
+                          static_cast<uint32_t>(it.height),
+                          static_cast<PixelFormat>(it.format),
+                          0,
+                          0,
+                          static_cast<StreamRotation>(UINT32_MAX)};
+                streams[0] = stream;
+                config = {streams, StreamConfigurationMode::NORMAL_MODE};
+                ret = session->configureStreams(config, [](Status s, HalStreamConfiguration) {
+                    ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+                });
                 ASSERT_TRUE(ret.isOk());
             }
+
+            free_camera_metadata(staticMeta);
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -2557,86 +2309,84 @@
 // Check whether all supported ZSL output stream combinations can be
 // configured successfully.
 TEST_F(CameraHidlTest, configureStreamsZSLInputOutputs) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        std::vector<AvailableStream> inputStreams;
-        std::vector<AvailableZSLInputOutput> inputOutputMap;
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    std::vector<AvailableStream> inputStreams;
+    std::vector<AvailableZSLInputOutput> inputOutputMap;
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                camera_metadata_t *staticMeta;
-                Return<void> ret;
-                sp<ICameraDeviceSession> session;
-                openEmptyDeviceSession(name, provider.second, &session /*out*/,
-                        &staticMeta /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            camera_metadata_t* staticMeta;
+            Return<void> ret;
+            sp<ICameraDeviceSession> session;
+            openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
 
-                Status rc = isZSLModeAvailable(staticMeta);
-                if (Status::METHOD_NOT_SUPPORTED == rc) {
-                    ret = session->close();
-                    ASSERT_TRUE(ret.isOk());
-                    continue;
-                }
-                ASSERT_EQ(Status::OK, rc);
+            Status rc = isZSLModeAvailable(staticMeta);
+            if (Status::METHOD_NOT_SUPPORTED == rc) {
+                ret = session->close();
+                ASSERT_TRUE(ret.isOk());
+                continue;
+            }
+            ASSERT_EQ(Status::OK, rc);
 
-                inputStreams.clear();
-                ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
-                        inputStreams));
+            inputStreams.clear();
+            ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, inputStreams));
+            ASSERT_NE(0u, inputStreams.size());
+
+            inputOutputMap.clear();
+            ASSERT_EQ(Status::OK, getZSLInputOutputMap(staticMeta, inputOutputMap));
+            ASSERT_NE(0u, inputOutputMap.size());
+
+            int32_t streamId = 0;
+            for (auto& inputIter : inputOutputMap) {
+                AvailableStream input;
+                ASSERT_EQ(Status::OK, findLargestSize(inputStreams, inputIter.inputFormat, input));
                 ASSERT_NE(0u, inputStreams.size());
 
-                inputOutputMap.clear();
-                ASSERT_EQ(Status::OK, getZSLInputOutputMap(staticMeta,
-                        inputOutputMap));
-                ASSERT_NE(0u, inputOutputMap.size());
+                AvailableStream outputThreshold = {INT32_MAX, INT32_MAX, inputIter.outputFormat};
+                std::vector<AvailableStream> outputStreams;
+                ASSERT_EQ(Status::OK,
+                          getAvailableOutputStreams(staticMeta, outputStreams, &outputThreshold));
+                for (auto& outputIter : outputStreams) {
+                    Stream zslStream = {streamId++,
+                                        StreamType::OUTPUT,
+                                        static_cast<uint32_t>(input.width),
+                                        static_cast<uint32_t>(input.height),
+                                        static_cast<PixelFormat>(input.format),
+                                        GRALLOC_USAGE_HW_CAMERA_ZSL,
+                                        0,
+                                        StreamRotation::ROTATION_0};
+                    Stream inputStream = {streamId++,
+                                          StreamType::INPUT,
+                                          static_cast<uint32_t>(input.width),
+                                          static_cast<uint32_t>(input.height),
+                                          static_cast<PixelFormat>(input.format),
+                                          0,
+                                          0,
+                                          StreamRotation::ROTATION_0};
+                    Stream outputStream = {streamId++,
+                                           StreamType::OUTPUT,
+                                           static_cast<uint32_t>(outputIter.width),
+                                           static_cast<uint32_t>(outputIter.height),
+                                           static_cast<PixelFormat>(outputIter.format),
+                                           0,
+                                           0,
+                                           StreamRotation::ROTATION_0};
 
-                int32_t streamId = 0;
-                for (auto &inputIter : inputOutputMap) {
-                    AvailableStream input;
-                    ASSERT_EQ(Status::OK,
-                            findLargestSize(inputStreams, inputIter.inputFormat, input));
-                    ASSERT_NE(0u, inputStreams.size());
-
-                    AvailableStream outputThreshold = {INT32_MAX, INT32_MAX,
-                            inputIter.outputFormat};
-                    std::vector<AvailableStream> outputStreams;
-                    ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
-                            outputStreams, &outputThreshold));
-                    for (auto &outputIter : outputStreams) {
-                        Stream zslStream = {streamId++, StreamType::OUTPUT,
-                                static_cast<uint32_t> (input.width),
-                                static_cast<uint32_t> (input.height),
-                                static_cast<PixelFormat> (input.format),
-                                GRALLOC_USAGE_HW_CAMERA_ZSL, 0,
-                                StreamRotation::ROTATION_0};
-                        Stream inputStream = {streamId++, StreamType::INPUT,
-                                static_cast<uint32_t> (input.width),
-                                static_cast<uint32_t> (input.height),
-                                static_cast<PixelFormat> (input.format), 0, 0,
-                                StreamRotation::ROTATION_0};
-                        Stream outputStream = {streamId++, StreamType::OUTPUT,
-                                static_cast<uint32_t> (outputIter.width),
-                                static_cast<uint32_t> (outputIter.height),
-                                static_cast<PixelFormat> (outputIter.format), 0, 0,
-                                StreamRotation::ROTATION_0};
-
-                        ::android::hardware::hidl_vec<Stream> streams = {
-                                inputStream, zslStream, outputStream};
-                        StreamConfiguration config = {streams,
-                                StreamConfigurationMode::NORMAL_MODE};
-                        ret = session->configureStreams(config,
+                    ::android::hardware::hidl_vec<Stream> streams = {inputStream, zslStream,
+                                                                     outputStream};
+                    StreamConfiguration config = {streams, StreamConfigurationMode::NORMAL_MODE};
+                    ret = session->configureStreams(config,
                                                     [](Status s, HalStreamConfiguration halConfig) {
                                                         ASSERT_EQ(Status::OK, s);
                                                         ASSERT_EQ(3u, halConfig.streams.size());
                                                     });
-                        ASSERT_TRUE(ret.isOk());
-                    }
+                    ASSERT_TRUE(ret.isOk());
                 }
-
-                free_camera_metadata(staticMeta);
-                ret = session->close();
-                ASSERT_TRUE(ret.isOk());
             }
+
+            free_camera_metadata(staticMeta);
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -2644,65 +2394,63 @@
 // Verify that all supported preview + still capture stream combinations
 // can be configured successfully.
 TEST_F(CameraHidlTest, configureStreamsPreviewStillOutputs) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        std::vector<AvailableStream> outputBlobStreams;
-        std::vector<AvailableStream> outputPreviewStreams;
-        AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
-                static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
-        AvailableStream blobThreshold = {INT32_MAX, INT32_MAX,
-                static_cast<int32_t>(PixelFormat::BLOB)};
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    std::vector<AvailableStream> outputBlobStreams;
+    std::vector<AvailableStream> outputPreviewStreams;
+    AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+                                        static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+    AvailableStream blobThreshold = {INT32_MAX, INT32_MAX, static_cast<int32_t>(PixelFormat::BLOB)};
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                camera_metadata_t *staticMeta;
-                Return<void> ret;
-                sp<ICameraDeviceSession> session;
-                openEmptyDeviceSession(name, provider.second, &session /*out*/,
-                        &staticMeta /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            camera_metadata_t* staticMeta;
+            Return<void> ret;
+            sp<ICameraDeviceSession> session;
+            openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
 
-                outputBlobStreams.clear();
-                ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
-                        outputBlobStreams, &blobThreshold));
-                ASSERT_NE(0u, outputBlobStreams.size());
+            outputBlobStreams.clear();
+            ASSERT_EQ(Status::OK,
+                      getAvailableOutputStreams(staticMeta, outputBlobStreams, &blobThreshold));
+            ASSERT_NE(0u, outputBlobStreams.size());
 
-                outputPreviewStreams.clear();
-                ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
-                        outputPreviewStreams, &previewThreshold));
-                ASSERT_NE(0u, outputPreviewStreams.size());
+            outputPreviewStreams.clear();
+            ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputPreviewStreams,
+                                                            &previewThreshold));
+            ASSERT_NE(0u, outputPreviewStreams.size());
 
-                int32_t streamId = 0;
-                for (auto &blobIter : outputBlobStreams) {
-                    for (auto &previewIter : outputPreviewStreams) {
-                        Stream previewStream = {streamId++, StreamType::OUTPUT,
-                                static_cast<uint32_t> (previewIter.width),
-                                static_cast<uint32_t> (previewIter.height),
-                                static_cast<PixelFormat> (previewIter.format), 0, 0,
-                                StreamRotation::ROTATION_0};
-                        Stream blobStream = {streamId++, StreamType::OUTPUT,
-                                static_cast<uint32_t> (blobIter.width),
-                                static_cast<uint32_t> (blobIter.height),
-                                static_cast<PixelFormat> (blobIter.format), 0, 0,
-                                StreamRotation::ROTATION_0};
-                        ::android::hardware::hidl_vec<Stream> streams = {
-                                previewStream, blobStream};
-                        StreamConfiguration config = {streams,
-                                StreamConfigurationMode::NORMAL_MODE};
-                        ret = session->configureStreams(config,
+            int32_t streamId = 0;
+            for (auto& blobIter : outputBlobStreams) {
+                for (auto& previewIter : outputPreviewStreams) {
+                    Stream previewStream = {streamId++,
+                                            StreamType::OUTPUT,
+                                            static_cast<uint32_t>(previewIter.width),
+                                            static_cast<uint32_t>(previewIter.height),
+                                            static_cast<PixelFormat>(previewIter.format),
+                                            0,
+                                            0,
+                                            StreamRotation::ROTATION_0};
+                    Stream blobStream = {streamId++,
+                                         StreamType::OUTPUT,
+                                         static_cast<uint32_t>(blobIter.width),
+                                         static_cast<uint32_t>(blobIter.height),
+                                         static_cast<PixelFormat>(blobIter.format),
+                                         0,
+                                         0,
+                                         StreamRotation::ROTATION_0};
+                    ::android::hardware::hidl_vec<Stream> streams = {previewStream, blobStream};
+                    StreamConfiguration config = {streams, StreamConfigurationMode::NORMAL_MODE};
+                    ret = session->configureStreams(config,
                                                     [](Status s, HalStreamConfiguration halConfig) {
                                                         ASSERT_EQ(Status::OK, s);
                                                         ASSERT_EQ(2u, halConfig.streams.size());
                                                     });
-                        ASSERT_TRUE(ret.isOk());
-                    }
+                    ASSERT_TRUE(ret.isOk());
                 }
-
-                free_camera_metadata(staticMeta);
-                ret = session->close();
-                ASSERT_TRUE(ret.isOk());
             }
+
+            free_camera_metadata(staticMeta);
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -2711,95 +2459,95 @@
 // configured. Additionally check for common invalid inputs when
 // using this mode.
 TEST_F(CameraHidlTest, configureStreamsConstrainedOutputs) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                camera_metadata_t *staticMeta;
-                Return<void> ret;
-                sp<ICameraDeviceSession> session;
-                openEmptyDeviceSession(name, provider.second, &session /*out*/,
-                        &staticMeta /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            camera_metadata_t* staticMeta;
+            Return<void> ret;
+            sp<ICameraDeviceSession> session;
+            openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
 
-                Status rc = isConstrainedModeAvailable(staticMeta);
-                if (Status::METHOD_NOT_SUPPORTED == rc) {
-                    ret = session->close();
-                    ASSERT_TRUE(ret.isOk());
-                    continue;
-                }
-                ASSERT_EQ(Status::OK, rc);
-
-                AvailableStream hfrStream;
-                rc = pickConstrainedModeSize(staticMeta, hfrStream);
-                ASSERT_EQ(Status::OK, rc);
-
-                int32_t streamId = 0;
-                Stream stream = {streamId, StreamType::OUTPUT,
-                        static_cast<uint32_t> (hfrStream.width),
-                        static_cast<uint32_t> (hfrStream.height),
-                        static_cast<PixelFormat> (hfrStream.format), 0, 0,
-                        StreamRotation::ROTATION_0};
-                ::android::hardware::hidl_vec<Stream> streams = {stream};
-                StreamConfiguration config = {streams,
-                        StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
-                ret = session->configureStreams(config, [streamId] (Status s,
-                        HalStreamConfiguration halConfig) {
-                    ASSERT_EQ(Status::OK, s);
-                    ASSERT_EQ(1u, halConfig.streams.size());
-                    ASSERT_EQ(halConfig.streams[0].id, streamId);
-                });
-                ASSERT_TRUE(ret.isOk());
-
-                stream = {streamId++, StreamType::OUTPUT,
-                        static_cast<uint32_t> (0),
-                        static_cast<uint32_t> (0),
-                        static_cast<PixelFormat> (hfrStream.format), 0, 0,
-                        StreamRotation::ROTATION_0};
-                streams[0] = stream;
-                config = {streams,
-                        StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
-                ret = session->configureStreams(config, [] (Status s,
-                        HalStreamConfiguration) {
-                    ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
-                                (Status::INTERNAL_ERROR == s));
-                });
-                ASSERT_TRUE(ret.isOk());
-
-                stream = {streamId++, StreamType::OUTPUT,
-                        static_cast<uint32_t> (UINT32_MAX),
-                        static_cast<uint32_t> (UINT32_MAX),
-                        static_cast<PixelFormat> (hfrStream.format), 0, 0,
-                        StreamRotation::ROTATION_0};
-                streams[0] = stream;
-                config = {streams,
-                        StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
-                ret = session->configureStreams(config, [] (Status s,
-                        HalStreamConfiguration) {
-                    ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
-                });
-                ASSERT_TRUE(ret.isOk());
-
-                stream = {streamId++, StreamType::OUTPUT,
-                        static_cast<uint32_t> (hfrStream.width),
-                        static_cast<uint32_t> (hfrStream.height),
-                        static_cast<PixelFormat> (UINT32_MAX), 0, 0,
-                        StreamRotation::ROTATION_0};
-                streams[0] = stream;
-                config = {streams,
-                        StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
-                ret = session->configureStreams(config, [] (Status s,
-                        HalStreamConfiguration) {
-                    ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
-                });
-                ASSERT_TRUE(ret.isOk());
-
-                free_camera_metadata(staticMeta);
+            Status rc = isConstrainedModeAvailable(staticMeta);
+            if (Status::METHOD_NOT_SUPPORTED == rc) {
                 ret = session->close();
                 ASSERT_TRUE(ret.isOk());
+                continue;
             }
+            ASSERT_EQ(Status::OK, rc);
+
+            AvailableStream hfrStream;
+            rc = pickConstrainedModeSize(staticMeta, hfrStream);
+            ASSERT_EQ(Status::OK, rc);
+
+            int32_t streamId = 0;
+            Stream stream = {streamId,
+                             StreamType::OUTPUT,
+                             static_cast<uint32_t>(hfrStream.width),
+                             static_cast<uint32_t>(hfrStream.height),
+                             static_cast<PixelFormat>(hfrStream.format),
+                             0,
+                             0,
+                             StreamRotation::ROTATION_0};
+            ::android::hardware::hidl_vec<Stream> streams = {stream};
+            StreamConfiguration config = {streams,
+                                          StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
+            ret = session->configureStreams(config,
+                                            [streamId](Status s, HalStreamConfiguration halConfig) {
+                                                ASSERT_EQ(Status::OK, s);
+                                                ASSERT_EQ(1u, halConfig.streams.size());
+                                                ASSERT_EQ(halConfig.streams[0].id, streamId);
+                                            });
+            ASSERT_TRUE(ret.isOk());
+
+            stream = {streamId++,
+                      StreamType::OUTPUT,
+                      static_cast<uint32_t>(0),
+                      static_cast<uint32_t>(0),
+                      static_cast<PixelFormat>(hfrStream.format),
+                      0,
+                      0,
+                      StreamRotation::ROTATION_0};
+            streams[0] = stream;
+            config = {streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
+            ret = session->configureStreams(config, [](Status s, HalStreamConfiguration) {
+                ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) || (Status::INTERNAL_ERROR == s));
+            });
+            ASSERT_TRUE(ret.isOk());
+
+            stream = {streamId++,
+                      StreamType::OUTPUT,
+                      static_cast<uint32_t>(UINT32_MAX),
+                      static_cast<uint32_t>(UINT32_MAX),
+                      static_cast<PixelFormat>(hfrStream.format),
+                      0,
+                      0,
+                      StreamRotation::ROTATION_0};
+            streams[0] = stream;
+            config = {streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
+            ret = session->configureStreams(config, [](Status s, HalStreamConfiguration) {
+                ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+            });
+            ASSERT_TRUE(ret.isOk());
+
+            stream = {streamId++,
+                      StreamType::OUTPUT,
+                      static_cast<uint32_t>(hfrStream.width),
+                      static_cast<uint32_t>(hfrStream.height),
+                      static_cast<PixelFormat>(UINT32_MAX),
+                      0,
+                      0,
+                      StreamRotation::ROTATION_0};
+            streams[0] = stream;
+            config = {streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
+            ret = session->configureStreams(config, [](Status s, HalStreamConfiguration) {
+                ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+            });
+            ASSERT_TRUE(ret.isOk());
+
+            free_camera_metadata(staticMeta);
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -2807,96 +2555,91 @@
 // Verify that all supported video + snapshot stream combinations can
 // be configured successfully.
 TEST_F(CameraHidlTest, configureStreamsVideoStillOutputs) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        std::vector<AvailableStream> outputBlobStreams;
-        std::vector<AvailableStream> outputVideoStreams;
-        AvailableStream videoThreshold = {kMaxVideoWidth, kMaxVideoHeight,
-                static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
-        AvailableStream blobThreshold = {kMaxVideoWidth, kMaxVideoHeight,
-                static_cast<int32_t>(PixelFormat::BLOB)};
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    std::vector<AvailableStream> outputBlobStreams;
+    std::vector<AvailableStream> outputVideoStreams;
+    AvailableStream videoThreshold = {kMaxVideoWidth, kMaxVideoHeight,
+                                      static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+    AvailableStream blobThreshold = {kMaxVideoWidth, kMaxVideoHeight,
+                                     static_cast<int32_t>(PixelFormat::BLOB)};
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                camera_metadata_t *staticMeta;
-                Return<void> ret;
-                sp<ICameraDeviceSession> session;
-                openEmptyDeviceSession(name, provider.second, &session /*out*/,
-                        &staticMeta /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            camera_metadata_t* staticMeta;
+            Return<void> ret;
+            sp<ICameraDeviceSession> session;
+            openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
 
-                outputBlobStreams.clear();
-                ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
-                        outputBlobStreams, &blobThreshold));
-                ASSERT_NE(0u, outputBlobStreams.size());
+            outputBlobStreams.clear();
+            ASSERT_EQ(Status::OK,
+                      getAvailableOutputStreams(staticMeta, outputBlobStreams, &blobThreshold));
+            ASSERT_NE(0u, outputBlobStreams.size());
 
-                outputVideoStreams.clear();
-                ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
-                        outputVideoStreams, &videoThreshold));
-                ASSERT_NE(0u, outputVideoStreams.size());
+            outputVideoStreams.clear();
+            ASSERT_EQ(Status::OK,
+                      getAvailableOutputStreams(staticMeta, outputVideoStreams, &videoThreshold));
+            ASSERT_NE(0u, outputVideoStreams.size());
 
-                int32_t streamId = 0;
-                for (auto &blobIter : outputBlobStreams) {
-                    for (auto &videoIter : outputVideoStreams) {
-                        Stream videoStream = {streamId++, StreamType::OUTPUT,
-                                static_cast<uint32_t> (videoIter.width),
-                                static_cast<uint32_t> (videoIter.height),
-                                static_cast<PixelFormat> (videoIter.format),
-                                0, 0, StreamRotation::ROTATION_0};
-                        Stream blobStream = {streamId++, StreamType::OUTPUT,
-                                static_cast<uint32_t> (blobIter.width),
-                                static_cast<uint32_t> (blobIter.height),
-                                static_cast<PixelFormat> (blobIter.format),
-                                GRALLOC_USAGE_HW_VIDEO_ENCODER, 0,
-                                StreamRotation::ROTATION_0};
-                        ::android::hardware::hidl_vec<Stream> streams = {
-                                videoStream, blobStream};
-                        StreamConfiguration config = {streams,
-                                StreamConfigurationMode::NORMAL_MODE};
-                        ret = session->configureStreams(config,
+            int32_t streamId = 0;
+            for (auto& blobIter : outputBlobStreams) {
+                for (auto& videoIter : outputVideoStreams) {
+                    Stream videoStream = {streamId++,
+                                          StreamType::OUTPUT,
+                                          static_cast<uint32_t>(videoIter.width),
+                                          static_cast<uint32_t>(videoIter.height),
+                                          static_cast<PixelFormat>(videoIter.format),
+                                          0,
+                                          0,
+                                          StreamRotation::ROTATION_0};
+                    Stream blobStream = {streamId++,
+                                         StreamType::OUTPUT,
+                                         static_cast<uint32_t>(blobIter.width),
+                                         static_cast<uint32_t>(blobIter.height),
+                                         static_cast<PixelFormat>(blobIter.format),
+                                         GRALLOC_USAGE_HW_VIDEO_ENCODER,
+                                         0,
+                                         StreamRotation::ROTATION_0};
+                    ::android::hardware::hidl_vec<Stream> streams = {videoStream, blobStream};
+                    StreamConfiguration config = {streams, StreamConfigurationMode::NORMAL_MODE};
+                    ret = session->configureStreams(config,
                                                     [](Status s, HalStreamConfiguration halConfig) {
                                                         ASSERT_EQ(Status::OK, s);
                                                         ASSERT_EQ(2u, halConfig.streams.size());
                                                     });
-                        ASSERT_TRUE(ret.isOk());
-                    }
+                    ASSERT_TRUE(ret.isOk());
                 }
-
-                free_camera_metadata(staticMeta);
-                ret = session->close();
-                ASSERT_TRUE(ret.isOk());
             }
+
+            free_camera_metadata(staticMeta);
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
 
 // Generate and verify a camera capture request
 TEST_F(CameraHidlTest, processCaptureRequestPreview) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
-                static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
-        uint64_t bufferId = 1;
-        uint32_t frameNumber = 1;
-        ::android::hardware::hidl_vec<uint8_t> settings;
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+                                        static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+    uint64_t bufferId = 1;
+    uint32_t frameNumber = 1;
+    ::android::hardware::hidl_vec<uint8_t> settings;
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                Stream previewStream;
-                HalStreamConfiguration halStreamConfig;
-                sp<ICameraDeviceSession> session;
-                bool supportsPartialResults = false;
-                uint32_t partialResultCount = 0;
-                configurePreviewStream(name, provider.second, &previewThreshold,
-                        &session /*out*/, &previewStream /*out*/,
-                        &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
-                        &partialResultCount/*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            Stream previewStream;
+            HalStreamConfiguration halStreamConfig;
+            sp<ICameraDeviceSession> session;
+            bool supportsPartialResults = false;
+            uint32_t partialResultCount = 0;
+            configurePreviewStream(name, mProvider, &previewThreshold, &session /*out*/,
+                                   &previewStream /*out*/, &halStreamConfig /*out*/,
+                                   &supportsPartialResults /*out*/, &partialResultCount /*out*/);
 
-                std::shared_ptr<ResultMetadataQueue> resultQueue;
-                auto resultQueueRet = session->getCaptureResultMetadataQueue(
+            std::shared_ptr<ResultMetadataQueue> resultQueue;
+            auto resultQueueRet =
+                session->getCaptureResultMetadataQueue(
                     [&resultQueue](const auto& descriptor) {
                         resultQueue = std::make_shared<ResultMetadataQueue>(
                                 descriptor);
@@ -2908,114 +2651,103 @@
                             // Don't use the queue onwards.
                         }
                     });
-                ASSERT_TRUE(resultQueueRet.isOk());
-                ASSERT_NE(nullptr, resultQueue);
+            ASSERT_TRUE(resultQueueRet.isOk());
+            ASSERT_NE(nullptr, resultQueue);
 
-                InFlightRequest inflightReq = {1, false, supportsPartialResults,
-                        partialResultCount, resultQueue};
+            InFlightRequest inflightReq = {1, false, supportsPartialResults, partialResultCount,
+                                           resultQueue};
 
-                RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
-                Return<void> ret;
-                ret = session->constructDefaultRequestSettings(reqTemplate,
-                    [&](auto status, const auto& req) {
-                        ASSERT_EQ(Status::OK, status);
-                        settings = req; });
-                ASSERT_TRUE(ret.isOk());
+            RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
+            Return<void> ret;
+            ret = session->constructDefaultRequestSettings(reqTemplate,
+                                                           [&](auto status, const auto& req) {
+                                                               ASSERT_EQ(Status::OK, status);
+                                                               settings = req;
+                                                           });
+            ASSERT_TRUE(ret.isOk());
 
-                sp<GraphicBuffer> gb = new GraphicBuffer(
-                    previewStream.width, previewStream.height,
-                    static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
-                    1, android_convertGralloc1To0Usage(
-                           halStreamConfig.streams[0].producerUsage,
-                           halStreamConfig.streams[0].consumerUsage));
-                ASSERT_NE(nullptr, gb.get());
-                StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
-                        bufferId, hidl_handle(gb->getNativeBuffer()->handle),
-                        BufferStatus::OK, nullptr, nullptr};
-                ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {
-                        outputBuffer};
-                StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
-                        BufferStatus::ERROR, nullptr, nullptr};
-                CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */,
-                        settings, emptyInputBuffer, outputBuffers};
+            sp<GraphicBuffer> gb = new GraphicBuffer(
+                previewStream.width, previewStream.height,
+                static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat), 1,
+                android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+                                                halStreamConfig.streams[0].consumerUsage));
+            ASSERT_NE(nullptr, gb.get());
+            StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
+                                         bufferId,
+                                         hidl_handle(gb->getNativeBuffer()->handle),
+                                         BufferStatus::OK,
+                                         nullptr,
+                                         nullptr};
+            ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {outputBuffer};
+            StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr, nullptr};
+            CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
+                                      emptyInputBuffer, outputBuffers};
 
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    mInflightMap.clear();
-                    mInflightMap.add(frameNumber, &inflightReq);
-                }
-
-                Status status = Status::INTERNAL_ERROR;
-                uint32_t numRequestProcessed = 0;
-                hidl_vec<BufferCache> cachesToRemove;
-                Return<void> returnStatus = session->processCaptureRequest(
-                        {request},
-                        cachesToRemove,
-                        [&status, &numRequestProcessed] (auto s, uint32_t n) {
-                            status = s;
-                            numRequestProcessed = n;
-                        });
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, status);
-                ASSERT_EQ(numRequestProcessed, 1u);
-
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    while (!inflightReq.errorCodeValid &&
-                            ((0 < inflightReq.numBuffersLeft) ||
-                                    (!inflightReq.haveResultMetadata))) {
-                        auto timeout = std::chrono::system_clock::now() +
-                                std::chrono::seconds(kStreamBufferTimeoutSec);
-                        ASSERT_NE(std::cv_status::timeout,
-                                mResultCondition.wait_until(l, timeout));
-                    }
-
-                    ASSERT_FALSE(inflightReq.errorCodeValid);
-                    ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
-                    ASSERT_EQ(previewStream.id,
-                              inflightReq.resultOutputBuffers[0].streamId);
-
-                    request.frameNumber++;
-                    //Empty settings should be supported after the first call
-                    //for repeating requests.
-                    request.settings.setToExternal(nullptr, 0, true);
-                    mInflightMap.clear();
-                    inflightReq = {1, false, supportsPartialResults,
-                                        partialResultCount, resultQueue};
-                    mInflightMap.add(request.frameNumber, &inflightReq);
-                }
-
-                returnStatus = session->processCaptureRequest(
-                        {request},
-                        cachesToRemove,
-                        [&status, &numRequestProcessed] (auto s, uint32_t n) {
-                            status = s;
-                            numRequestProcessed = n;
-                        });
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, status);
-                ASSERT_EQ(numRequestProcessed, 1u);
-
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    while (!inflightReq.errorCodeValid &&
-                            ((0 < inflightReq.numBuffersLeft) ||
-                                    (!inflightReq.haveResultMetadata))) {
-                        auto timeout = std::chrono::system_clock::now() +
-                                std::chrono::seconds(kStreamBufferTimeoutSec);
-                        ASSERT_NE(std::cv_status::timeout,
-                                mResultCondition.wait_until(l, timeout));
-                    }
-
-                    ASSERT_FALSE(inflightReq.errorCodeValid);
-                    ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
-                    ASSERT_EQ(previewStream.id,
-                              inflightReq.resultOutputBuffers[0].streamId);
-                }
-
-                ret = session->close();
-                ASSERT_TRUE(ret.isOk());
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                mInflightMap.clear();
+                mInflightMap.add(frameNumber, &inflightReq);
             }
+
+            Status status = Status::INTERNAL_ERROR;
+            uint32_t numRequestProcessed = 0;
+            hidl_vec<BufferCache> cachesToRemove;
+            Return<void> returnStatus = session->processCaptureRequest(
+                {request}, cachesToRemove, [&status, &numRequestProcessed](auto s, uint32_t n) {
+                    status = s;
+                    numRequestProcessed = n;
+                });
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, status);
+            ASSERT_EQ(numRequestProcessed, 1u);
+
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                while (!inflightReq.errorCodeValid &&
+                       ((0 < inflightReq.numBuffersLeft) || (!inflightReq.haveResultMetadata))) {
+                    auto timeout = std::chrono::system_clock::now() +
+                                   std::chrono::seconds(kStreamBufferTimeoutSec);
+                    ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
+                }
+
+                ASSERT_FALSE(inflightReq.errorCodeValid);
+                ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
+                ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].streamId);
+
+                request.frameNumber++;
+                // Empty settings should be supported after the first call
+                // for repeating requests.
+                request.settings.setToExternal(nullptr, 0, true);
+                mInflightMap.clear();
+                inflightReq = {1, false, supportsPartialResults, partialResultCount, resultQueue};
+                mInflightMap.add(request.frameNumber, &inflightReq);
+            }
+
+            returnStatus = session->processCaptureRequest(
+                {request}, cachesToRemove, [&status, &numRequestProcessed](auto s, uint32_t n) {
+                    status = s;
+                    numRequestProcessed = n;
+                });
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, status);
+            ASSERT_EQ(numRequestProcessed, 1u);
+
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                while (!inflightReq.errorCodeValid &&
+                       ((0 < inflightReq.numBuffersLeft) || (!inflightReq.haveResultMetadata))) {
+                    auto timeout = std::chrono::system_clock::now() +
+                                   std::chrono::seconds(kStreamBufferTimeoutSec);
+                    ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
+                }
+
+                ASSERT_FALSE(inflightReq.errorCodeValid);
+                ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
+                ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].streamId);
+            }
+
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -3023,64 +2755,57 @@
 // Test whether an incorrect capture request with missing settings will
 // be reported correctly.
 TEST_F(CameraHidlTest, processCaptureRequestInvalidSinglePreview) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        std::vector<AvailableStream> outputPreviewStreams;
-        AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
-                static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
-        uint64_t bufferId = 1;
-        uint32_t frameNumber = 1;
-        ::android::hardware::hidl_vec<uint8_t> settings;
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    std::vector<AvailableStream> outputPreviewStreams;
+    AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+                                        static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+    uint64_t bufferId = 1;
+    uint32_t frameNumber = 1;
+    ::android::hardware::hidl_vec<uint8_t> settings;
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                Stream previewStream;
-                HalStreamConfiguration halStreamConfig;
-                sp<ICameraDeviceSession> session;
-                bool supportsPartialResults = false;
-                uint32_t partialResultCount = 0;
-                configurePreviewStream(name, provider.second, &previewThreshold,
-                        &session /*out*/, &previewStream /*out*/,
-                        &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
-                        &partialResultCount /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            Stream previewStream;
+            HalStreamConfiguration halStreamConfig;
+            sp<ICameraDeviceSession> session;
+            bool supportsPartialResults = false;
+            uint32_t partialResultCount = 0;
+            configurePreviewStream(name, mProvider, &previewThreshold, &session /*out*/,
+                                   &previewStream /*out*/, &halStreamConfig /*out*/,
+                                   &supportsPartialResults /*out*/, &partialResultCount /*out*/);
 
-                sp<GraphicBuffer> gb = new GraphicBuffer(
-                    previewStream.width, previewStream.height,
-                    static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
-                    1, android_convertGralloc1To0Usage(
-                           halStreamConfig.streams[0].producerUsage,
-                           halStreamConfig.streams[0].consumerUsage));
+            sp<GraphicBuffer> gb = new GraphicBuffer(
+                previewStream.width, previewStream.height,
+                static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat), 1,
+                android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+                                                halStreamConfig.streams[0].consumerUsage));
 
-                StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
-                        bufferId, hidl_handle(gb->getNativeBuffer()->handle),
-                        BufferStatus::OK, nullptr, nullptr};
-                ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {
-                        outputBuffer};
-                StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
-                        BufferStatus::ERROR, nullptr, nullptr};
-                CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
-                        emptyInputBuffer, outputBuffers};
+            StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
+                                         bufferId,
+                                         hidl_handle(gb->getNativeBuffer()->handle),
+                                         BufferStatus::OK,
+                                         nullptr,
+                                         nullptr};
+            ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {outputBuffer};
+            StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr, nullptr};
+            CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
+                                      emptyInputBuffer, outputBuffers};
 
-                //Settings were not correctly initialized, we should fail here
-                Status status = Status::OK;
-                uint32_t numRequestProcessed = 0;
-                hidl_vec<BufferCache> cachesToRemove;
-                Return<void> ret = session->processCaptureRequest(
-                        {request},
-                        cachesToRemove,
-                        [&status, &numRequestProcessed] (auto s, uint32_t n) {
-                            status = s;
-                            numRequestProcessed = n;
-                        });
-                ASSERT_TRUE(ret.isOk());
-                ASSERT_EQ(Status::INTERNAL_ERROR, status);
-                ASSERT_EQ(numRequestProcessed, 0u);
+            // Settings were not correctly initialized, we should fail here
+            Status status = Status::OK;
+            uint32_t numRequestProcessed = 0;
+            hidl_vec<BufferCache> cachesToRemove;
+            Return<void> ret = session->processCaptureRequest(
+                {request}, cachesToRemove, [&status, &numRequestProcessed](auto s, uint32_t n) {
+                    status = s;
+                    numRequestProcessed = n;
+                });
+            ASSERT_TRUE(ret.isOk());
+            ASSERT_EQ(Status::INTERNAL_ERROR, status);
+            ASSERT_EQ(numRequestProcessed, 0u);
 
-                ret = session->close();
-                ASSERT_TRUE(ret.isOk());
-            }
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -3088,91 +2813,81 @@
 // Check whether an invalid capture request with missing output buffers
 // will be reported correctly.
 TEST_F(CameraHidlTest, processCaptureRequestInvalidBuffer) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        std::vector<AvailableStream> outputBlobStreams;
-        AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
-                static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
-        uint32_t frameNumber = 1;
-        ::android::hardware::hidl_vec<uint8_t> settings;
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    std::vector<AvailableStream> outputBlobStreams;
+    AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+                                        static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+    uint32_t frameNumber = 1;
+    ::android::hardware::hidl_vec<uint8_t> settings;
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                Stream previewStream;
-                HalStreamConfiguration halStreamConfig;
-                sp<ICameraDeviceSession> session;
-                bool supportsPartialResults = false;
-                uint32_t partialResultCount = 0;
-                configurePreviewStream(name, provider.second, &previewThreshold,
-                        &session /*out*/, &previewStream /*out*/,
-                        &halStreamConfig /*out*/, &supportsPartialResults/*out*/,
-                        &partialResultCount /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            Stream previewStream;
+            HalStreamConfiguration halStreamConfig;
+            sp<ICameraDeviceSession> session;
+            bool supportsPartialResults = false;
+            uint32_t partialResultCount = 0;
+            configurePreviewStream(name, mProvider, &previewThreshold, &session /*out*/,
+                                   &previewStream /*out*/, &halStreamConfig /*out*/,
+                                   &supportsPartialResults /*out*/, &partialResultCount /*out*/);
 
-                RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
-                Return<void> ret;
-                ret = session->constructDefaultRequestSettings(reqTemplate,
-                    [&](auto status, const auto& req) {
-                        ASSERT_EQ(Status::OK, status);
-                        settings = req; });
-                ASSERT_TRUE(ret.isOk());
+            RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
+            Return<void> ret;
+            ret = session->constructDefaultRequestSettings(reqTemplate,
+                                                           [&](auto status, const auto& req) {
+                                                               ASSERT_EQ(Status::OK, status);
+                                                               settings = req;
+                                                           });
+            ASSERT_TRUE(ret.isOk());
 
-                ::android::hardware::hidl_vec<StreamBuffer> emptyOutputBuffers;
-                StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
-                        BufferStatus::ERROR, nullptr, nullptr};
-                CaptureRequest request = {frameNumber, 0/* fmqSettingsSize */,
-                        settings, emptyInputBuffer, emptyOutputBuffers};
+            ::android::hardware::hidl_vec<StreamBuffer> emptyOutputBuffers;
+            StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr, nullptr};
+            CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
+                                      emptyInputBuffer, emptyOutputBuffers};
 
-                //Output buffers are missing, we should fail here
-                Status status = Status::OK;
-                uint32_t numRequestProcessed = 0;
-                hidl_vec<BufferCache> cachesToRemove;
-                ret = session->processCaptureRequest(
-                        {request},
-                        cachesToRemove,
-                        [&status, &numRequestProcessed] (auto s, uint32_t n) {
-                            status = s;
-                            numRequestProcessed = n;
-                        });
-                ASSERT_TRUE(ret.isOk());
-                ASSERT_EQ(Status::INTERNAL_ERROR, status);
-                ASSERT_EQ(numRequestProcessed, 0u);
+            // Output buffers are missing, we should fail here
+            Status status = Status::OK;
+            uint32_t numRequestProcessed = 0;
+            hidl_vec<BufferCache> cachesToRemove;
+            ret = session->processCaptureRequest(
+                {request}, cachesToRemove, [&status, &numRequestProcessed](auto s, uint32_t n) {
+                    status = s;
+                    numRequestProcessed = n;
+                });
+            ASSERT_TRUE(ret.isOk());
+            ASSERT_EQ(Status::INTERNAL_ERROR, status);
+            ASSERT_EQ(numRequestProcessed, 0u);
 
-                ret = session->close();
-                ASSERT_TRUE(ret.isOk());
-            }
+            ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
 
 // Generate, trigger and flush a preview request
 TEST_F(CameraHidlTest, flushPreviewRequest) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        std::vector<AvailableStream> outputPreviewStreams;
-        AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
-                static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
-        uint64_t bufferId = 1;
-        uint32_t frameNumber = 1;
-        ::android::hardware::hidl_vec<uint8_t> settings;
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    std::vector<AvailableStream> outputPreviewStreams;
+    AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+                                        static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+    uint64_t bufferId = 1;
+    uint32_t frameNumber = 1;
+    ::android::hardware::hidl_vec<uint8_t> settings;
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                Stream previewStream;
-                HalStreamConfiguration halStreamConfig;
-                sp<ICameraDeviceSession> session;
-                bool supportsPartialResults = false;
-                uint32_t partialResultCount = 0;
-                configurePreviewStream(name, provider.second, &previewThreshold,
-                        &session /*out*/, &previewStream /*out*/,
-                        &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
-                        &partialResultCount /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            Stream previewStream;
+            HalStreamConfiguration halStreamConfig;
+            sp<ICameraDeviceSession> session;
+            bool supportsPartialResults = false;
+            uint32_t partialResultCount = 0;
+            configurePreviewStream(name, mProvider, &previewThreshold, &session /*out*/,
+                                   &previewStream /*out*/, &halStreamConfig /*out*/,
+                                   &supportsPartialResults /*out*/, &partialResultCount /*out*/);
 
-                std::shared_ptr<ResultMetadataQueue> resultQueue;
-                auto resultQueueRet = session->getCaptureResultMetadataQueue(
+            std::shared_ptr<ResultMetadataQueue> resultQueue;
+            auto resultQueueRet =
+                session->getCaptureResultMetadataQueue(
                     [&resultQueue](const auto& descriptor) {
                         resultQueue = std::make_shared<ResultMetadataQueue>(
                                 descriptor);
@@ -3184,93 +2899,89 @@
                             // Don't use the queue onwards.
                         }
                     });
-                ASSERT_TRUE(resultQueueRet.isOk());
-                ASSERT_NE(nullptr, resultQueue);
+            ASSERT_TRUE(resultQueueRet.isOk());
+            ASSERT_NE(nullptr, resultQueue);
 
-                InFlightRequest inflightReq = {1, false, supportsPartialResults,
-                        partialResultCount, resultQueue};
-                RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
-                Return<void> ret;
-                ret = session->constructDefaultRequestSettings(reqTemplate,
-                    [&](auto status, const auto& req) {
-                        ASSERT_EQ(Status::OK, status);
-                        settings = req; });
-                ASSERT_TRUE(ret.isOk());
+            InFlightRequest inflightReq = {1, false, supportsPartialResults, partialResultCount,
+                                           resultQueue};
+            RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
+            Return<void> ret;
+            ret = session->constructDefaultRequestSettings(reqTemplate,
+                                                           [&](auto status, const auto& req) {
+                                                               ASSERT_EQ(Status::OK, status);
+                                                               settings = req;
+                                                           });
+            ASSERT_TRUE(ret.isOk());
 
-                sp<GraphicBuffer> gb = new GraphicBuffer(
-                    previewStream.width, previewStream.height,
-                    static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
-                    1, android_convertGralloc1To0Usage(
-                           halStreamConfig.streams[0].producerUsage,
-                           halStreamConfig.streams[0].consumerUsage));
-                ASSERT_NE(nullptr, gb.get());
-                StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
-                        bufferId, hidl_handle(gb->getNativeBuffer()->handle),
-                        BufferStatus::OK, nullptr, nullptr};
-                ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {
-                        outputBuffer};
-                const StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
-                        BufferStatus::ERROR, nullptr, nullptr};
-                CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */,
-                        settings, emptyInputBuffer, outputBuffers};
+            sp<GraphicBuffer> gb = new GraphicBuffer(
+                previewStream.width, previewStream.height,
+                static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat), 1,
+                android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+                                                halStreamConfig.streams[0].consumerUsage));
+            ASSERT_NE(nullptr, gb.get());
+            StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
+                                         bufferId,
+                                         hidl_handle(gb->getNativeBuffer()->handle),
+                                         BufferStatus::OK,
+                                         nullptr,
+                                         nullptr};
+            ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {outputBuffer};
+            const StreamBuffer emptyInputBuffer = {-1,      0,      nullptr, BufferStatus::ERROR,
+                                                   nullptr, nullptr};
+            CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
+                                      emptyInputBuffer, outputBuffers};
 
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    mInflightMap.clear();
-                    mInflightMap.add(frameNumber, &inflightReq);
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                mInflightMap.clear();
+                mInflightMap.add(frameNumber, &inflightReq);
+            }
+
+            Status status = Status::INTERNAL_ERROR;
+            uint32_t numRequestProcessed = 0;
+            hidl_vec<BufferCache> cachesToRemove;
+            ret = session->processCaptureRequest(
+                {request}, cachesToRemove, [&status, &numRequestProcessed](auto s, uint32_t n) {
+                    status = s;
+                    numRequestProcessed = n;
+                });
+
+            ASSERT_TRUE(ret.isOk());
+            ASSERT_EQ(Status::OK, status);
+            ASSERT_EQ(numRequestProcessed, 1u);
+            // Flush before waiting for request to complete.
+            Return<Status> returnStatus = session->flush();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
+
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                while (!inflightReq.errorCodeValid &&
+                       ((0 < inflightReq.numBuffersLeft) || (!inflightReq.haveResultMetadata))) {
+                    auto timeout = std::chrono::system_clock::now() +
+                                   std::chrono::seconds(kStreamBufferTimeoutSec);
+                    ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
                 }
 
-                Status status = Status::INTERNAL_ERROR;
-                uint32_t numRequestProcessed = 0;
-                hidl_vec<BufferCache> cachesToRemove;
-                ret = session->processCaptureRequest(
-                        {request},
-                        cachesToRemove,
-                        [&status, &numRequestProcessed] (auto s, uint32_t n) {
-                            status = s;
-                            numRequestProcessed = n;
-                        });
-
-                ASSERT_TRUE(ret.isOk());
-                ASSERT_EQ(Status::OK, status);
-                ASSERT_EQ(numRequestProcessed, 1u);
-                //Flush before waiting for request to complete.
-                Return<Status> returnStatus = session->flush();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
-
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    while (!inflightReq.errorCodeValid &&
-                            ((0 < inflightReq.numBuffersLeft) ||
-                                    (!inflightReq.haveResultMetadata))) {
-                        auto timeout = std::chrono::system_clock::now() +
-                                std::chrono::seconds(kStreamBufferTimeoutSec);
-                        ASSERT_NE(std::cv_status::timeout,
-                                mResultCondition.wait_until(l, timeout));
+                if (!inflightReq.errorCodeValid) {
+                    ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
+                    ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].streamId);
+                } else {
+                    switch (inflightReq.errorCode) {
+                        case ErrorCode::ERROR_REQUEST:
+                        case ErrorCode::ERROR_RESULT:
+                        case ErrorCode::ERROR_BUFFER:
+                            // Expected
+                            break;
+                        case ErrorCode::ERROR_DEVICE:
+                        default:
+                            FAIL() << "Unexpected error:"
+                                   << static_cast<uint32_t>(inflightReq.errorCode);
                     }
-
-                    if (!inflightReq.errorCodeValid) {
-                        ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
-                        ASSERT_EQ(previewStream.id,
-                                  inflightReq.resultOutputBuffers[0].streamId);
-                    } else {
-                        switch (inflightReq.errorCode) {
-                            case ErrorCode::ERROR_REQUEST:
-                            case ErrorCode::ERROR_RESULT:
-                            case ErrorCode::ERROR_BUFFER:
-                                //Expected
-                                break;
-                            case ErrorCode::ERROR_DEVICE:
-                            default:
-                                FAIL() << "Unexpected error:" << static_cast<uint32_t> (
-                                        inflightReq.errorCode);
-                        }
-                    }
-
-                    ret = session->close();
-                    ASSERT_TRUE(ret.isOk());
                 }
+
+                ret = session->close();
+                ASSERT_TRUE(ret.isOk());
             }
         }
     }
@@ -3278,41 +2989,35 @@
 
 // Verify that camera flushes correctly without any pending requests.
 TEST_F(CameraHidlTest, flushEmpty) {
-    for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
-        hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
-                provider.second);
-        std::vector<AvailableStream> outputPreviewStreams;
-        AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
-                static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+    hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+    std::vector<AvailableStream> outputPreviewStreams;
+    AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+                                        static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
 
-        for (const auto& name : cameraDeviceNames) {
-            if (getCameraDeviceVersion(name, provider.first) ==
-                    CAMERA_DEVICE_API_VERSION_3_2) {
-                Stream previewStream;
-                HalStreamConfiguration halStreamConfig;
-                sp<ICameraDeviceSession> session;
-                bool supportsPartialResults = false;
-                uint32_t partialResultCount = 0;
-                configurePreviewStream(name, provider.second, &previewThreshold,
-                        &session /*out*/, &previewStream /*out*/,
-                        &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
-                        &partialResultCount /*out*/);
+    for (const auto& name : cameraDeviceNames) {
+        if (getCameraDeviceVersion(name, mProviderType) == CAMERA_DEVICE_API_VERSION_3_2) {
+            Stream previewStream;
+            HalStreamConfiguration halStreamConfig;
+            sp<ICameraDeviceSession> session;
+            bool supportsPartialResults = false;
+            uint32_t partialResultCount = 0;
+            configurePreviewStream(name, mProvider, &previewThreshold, &session /*out*/,
+                                   &previewStream /*out*/, &halStreamConfig /*out*/,
+                                   &supportsPartialResults /*out*/, &partialResultCount /*out*/);
 
-                Return<Status> returnStatus = session->flush();
-                ASSERT_TRUE(returnStatus.isOk());
-                ASSERT_EQ(Status::OK, returnStatus);
+            Return<Status> returnStatus = session->flush();
+            ASSERT_TRUE(returnStatus.isOk());
+            ASSERT_EQ(Status::OK, returnStatus);
 
-                {
-                    std::unique_lock<std::mutex> l(mLock);
-                    auto timeout = std::chrono::system_clock::now() +
-                            std::chrono::milliseconds(kEmptyFlushTimeoutMSec);
-                    ASSERT_EQ(std::cv_status::timeout,
-                            mResultCondition.wait_until(l, timeout));
-                }
-
-                Return<void> ret = session->close();
-                ASSERT_TRUE(ret.isOk());
+            {
+                std::unique_lock<std::mutex> l(mLock);
+                auto timeout = std::chrono::system_clock::now() +
+                               std::chrono::milliseconds(kEmptyFlushTimeoutMSec);
+                ASSERT_EQ(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
             }
+
+            Return<void> ret = session->close();
+            ASSERT_TRUE(ret.isOk());
         }
     }
 }
@@ -3753,6 +3458,7 @@
 int main(int argc, char **argv) {
   ::testing::AddGlobalTestEnvironment(CameraHidlEnvironment::Instance());
   ::testing::InitGoogleTest(&argc, argv);
+  CameraHidlEnvironment::Instance()->init(&argc, argv);
   int status = RUN_ALL_TESTS();
   ALOGI("Test result = %d", status);
   return status;
diff --git a/cas/1.0/default/Android.bp b/cas/1.0/default/Android.bp
index 953aa37..6da5cc4 100644
--- a/cas/1.0/default/Android.bp
+++ b/cas/1.0/default/Android.bp
@@ -32,4 +32,8 @@
       "liblog",
       "libutils",
     ],
+    header_libs: [
+      "libstagefright_foundation_headers",
+      "media_plugin_headers",
+    ],
 }
diff --git a/configstore/1.1/default/service.cpp b/configstore/1.1/default/service.cpp
index 3a4cd3f..52db025 100644
--- a/configstore/1.1/default/service.cpp
+++ b/configstore/1.1/default/service.cpp
@@ -30,7 +30,6 @@
 using android::OK;
 
 int main() {
-    // TODO(b/34857894): tune the max thread count.
     configureRpcThreadpool(10, true);
 
     sp<ISurfaceFlingerConfigs> surfaceFlingerConfigs = new SurfaceFlingerConfigs;
diff --git a/configstore/1.1/vts/functional/Android.bp b/configstore/1.1/vts/functional/Android.bp
new file mode 100644
index 0000000..5cfa483
--- /dev/null
+++ b/configstore/1.1/vts/functional/Android.bp
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+    name: "VtsHalConfigstoreV1_1TargetTest",
+    defaults: ["hidl_defaults"],
+    srcs: ["VtsHalConfigstoreV1_1TargetTest.cpp"],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "liblog",
+        "libutils",
+        "android.hardware.configstore@1.1",
+    ],
+    static_libs: ["VtsHalHidlTargetTestBase"],
+    cflags: [
+        "-O0",
+        "-g",
+    ]
+}
+
diff --git a/configstore/1.1/vts/functional/VtsHalConfigstoreV1_1TargetTest.cpp b/configstore/1.1/vts/functional/VtsHalConfigstoreV1_1TargetTest.cpp
new file mode 100644
index 0000000..bd3da4c
--- /dev/null
+++ b/configstore/1.1/vts/functional/VtsHalConfigstoreV1_1TargetTest.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "ConfigstoreHidlHalTest"
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <android-base/logging.h>
+#include <android/hardware/configstore/1.0/types.h>
+#include <android/hardware/configstore/1.1/ISurfaceFlingerConfigs.h>
+#include <unistd.h>
+
+using ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs;
+using ::android::sp;
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
+
+class ConfigstoreHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    sp<ISurfaceFlingerConfigs> sfConfigs;
+
+    virtual void SetUp() override {
+        sfConfigs = ::testing::VtsHalHidlTargetTestBase::getService<ISurfaceFlingerConfigs>();
+        ASSERT_NE(sfConfigs, nullptr);
+    }
+
+    virtual void TearDown() override {}
+};
+
+/**
+ * Placeholder testcase.
+ */
+TEST_F(ConfigstoreHidlTest, Test) {
+    ASSERT_TRUE(true);
+}
+
+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/configstore/Android.bp b/configstore/Android.bp
index 21dc2b4..4a783c3 100644
--- a/configstore/Android.bp
+++ b/configstore/Android.bp
@@ -3,5 +3,6 @@
     "1.0",
     "1.0/vts/functional",
     "1.1",
+    "1.1/vts/functional",
     "utils",
 ]
diff --git a/current.txt b/current.txt
index 1904db8..5a2b90a 100644
--- a/current.txt
+++ b/current.txt
@@ -191,19 +191,19 @@
 
 8a4082dbc7f5eef585dca841b2656ba62d6c7e10e25dd05507ead15d96224f4c android.hardware.broadcastradio@1.0::types
 760485232f6cce07f8bb05e3475509956996b702f77415ee5bff05e2ec5a5bcc android.hardware.dumpstate@1.0::IDumpstateDevice
-1fecfa1609ff9d27ebf761a84b4336efa9d5dac5b241f19a6663f70d8db2c4b1 android.hardware.radio@1.0::IRadioResponse
+e822cb7f4a1bdd45689c5e92ccd19a2201c20b771bd4b2ec1ae627e324591f9d android.hardware.radio@1.0::IRadioResponse
 28e929b453df3d9f5060af2764e6cdb123ddb893e3e86923c877f6ff7e5f02c9 android.hardware.wifi@1.0::types
 
 # HALs released in Android O MR1
 
-37a00ee36a2e38f9ff87cf71a37a49c13fe194fbed123c6b05c69fc76071f5c9 android.hardware.configstore@1.1::ISurfaceFlingerConfigs
 4b65763663a94a3920134011691f8fbb42ccb7b7795589efddc049a9106047d6 android.hardware.oemlock@1.0::IOemLock
 e02cd3722cb5e8fa51179f5defacb4f7866f903c9c7c51dc01a3148473a71525 android.hardware.oemlock@1.0::types
-9f69e783fa2c482d90b2f799ddd33378a92d22a261983df6b492358e01f4d791 android.hardware.power@1.1::IPower
+224f9d22a367a0016f09b6dc676f53f1446697d9dc747163032329e5da552de5 android.hardware.power@1.1::IPower
 574fd9758b7cab4922c72cc5a9f36d1cd48ffd3425fdd776426653280d3d4138 android.hardware.power@1.1::types
 f79edf50a378a9c9bb737f93f205dab91b4c63ea49723afc6f856c138203ea81 android.hardware.radio@1.1::IRadio
 fcc5c8c88b85a9f63fba67d9e674da466c72a98ca287f343fb5721d098713f86 android.hardware.radio@1.1::IRadioIndication
 50f27e8c7ec009d5d4418b2ce8392b940bbf052ecc1d7251285f332485a5ba4e android.hardware.radio@1.1::IRadioResponse
+be981148c95c0089f3ae92854f0e7ae999d308e927db3e065f12a4fabe07852f android.hardware.radio@1.1::ISap
 d8d6bf7b4d36c04ce587df75953c3f723cfbe71c896c1aa8ab6478eae126723d android.hardware.radio@1.1::types
 d8aae01606bfd34bf2fb9a59cadc016f46f318e56cddb8f15a945c5b3c1222bc android.hardware.tetheroffload.config@1.0::IOffloadConfig
 447b00306bc95a7aafec1d660f6f3e9f76ac8bc0353193435e5579ab833da619 android.hardware.tetheroffload.control@1.0::IOffloadControl
@@ -219,3 +219,5 @@
 bb7c96762d0aa3ddb874c8815bacdd3cbc8fb87ea2f82b928bc29e24a3593055 android.hardware.wifi.offload@1.0::IOffload
 c3354ab0d381a236c12dc486ad4b6bec28c979d26748b4661f12ede36f392808 android.hardware.wifi.offload@1.0::IOffloadCallback
 b18caefefcc765092412285d776234fcf213b73bdf07ae1b67a5f71b2d2464e3 android.hardware.wifi.offload@1.0::types
+c26473e2e4a00af43e28a0ddf9002e5062a7d0940429e5efb6e5513a8abcb75c android.hardware.wifi@1.1::IWifi
+bfcf4856c7b6c66ebc56785ed3e5d181b7be859c2add672497a843b024518737 android.hardware.wifi@1.1::IWifiChip
diff --git a/drm/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp
index 591861a..fd75dbd 100644
--- a/drm/1.0/default/CryptoPlugin.cpp
+++ b/drm/1.0/default/CryptoPlugin.cpp
@@ -51,7 +51,11 @@
 
     Return<void> CryptoPlugin::setSharedBufferBase(const hidl_memory& base,
             uint32_t bufferId) {
-        mSharedBufferMap[bufferId] = mapMemory(base);
+        sp<IMemory> hidlMemory = mapMemory(base);
+        ALOGE_IF(hidlMemory == nullptr, "mapMemory returns nullptr");
+
+        // allow mapMemory to return nullptr
+        mSharedBufferMap[bufferId] = hidlMemory;
         return Void();
     }
 
@@ -107,6 +111,10 @@
 
         AString detailMessage;
         sp<IMemory> sourceBase = mSharedBufferMap[source.bufferId];
+        if (sourceBase == nullptr) {
+            _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "source is a nullptr");
+            return Void();
+        }
 
         if (source.offset + offset + source.size > sourceBase->getSize()) {
             _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size");
@@ -121,6 +129,11 @@
         if (destination.type == BufferType::SHARED_MEMORY) {
             const SharedBuffer& destBuffer = destination.nonsecureMemory;
             sp<IMemory> destBase = mSharedBufferMap[destBuffer.bufferId];
+            if (destBase == nullptr) {
+                _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "destination is a nullptr");
+                return Void();
+            }
+
             if (destBuffer.offset + destBuffer.size > destBase->getSize()) {
                 _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size");
                 return Void();
diff --git a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
index 26641e8..eeee3c0 100644
--- a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
@@ -94,10 +94,10 @@
 
         drmFactory =
                 ::testing::VtsHalHidlTargetTestBase::getService<IDrmFactory>();
-        ASSERT_NE(drmFactory, nullptr);
+        ASSERT_NE(nullptr, drmFactory.get());
         cryptoFactory =
                 ::testing::VtsHalHidlTargetTestBase::getService<ICryptoFactory>();
-        ASSERT_NE(cryptoFactory, nullptr);
+        ASSERT_NE(nullptr, cryptoFactory.get());
     }
 
     virtual void TearDown() override {}
@@ -166,7 +166,7 @@
             kClearKeyUUID, packageName,
             [&](Status status, const sp<IDrmPlugin>& plugin) {
                 EXPECT_EQ(Status::OK, status);
-                EXPECT_NE(plugin, nullptr);
+                EXPECT_NE(nullptr, plugin.get());
             });
     EXPECT_OK(res);
 }
@@ -180,7 +180,7 @@
             kClearKeyUUID, initVec,
             [&](Status status, const sp<ICryptoPlugin>& plugin) {
                 EXPECT_EQ(Status::OK, status);
-                EXPECT_NE(plugin, nullptr);
+                EXPECT_NE(nullptr, plugin.get());
             });
     EXPECT_OK(res);
 }
@@ -194,7 +194,7 @@
             kInvalidUUID, packageName,
             [&](Status status, const sp<IDrmPlugin>& plugin) {
                 EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
-                EXPECT_EQ(plugin, nullptr);
+                EXPECT_EQ(nullptr, plugin.get());
             });
     EXPECT_OK(res);
 }
@@ -208,7 +208,7 @@
             kInvalidUUID, initVec,
             [&](Status status, const sp<ICryptoPlugin>& plugin) {
                 EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
-                EXPECT_EQ(plugin, nullptr);
+                EXPECT_EQ(nullptr, plugin.get());
             });
     EXPECT_OK(res);
 }
@@ -219,13 +219,13 @@
         // Create factories
         DrmHalClearkeyFactoryTest::SetUp();
 
-        ASSERT_NE(drmFactory, nullptr);
+        ASSERT_NE(nullptr, drmFactory.get());
         hidl_string packageName("android.hardware.drm.test");
         auto res = drmFactory->createPlugin(
                 kClearKeyUUID, packageName,
                 [this](Status status, const sp<IDrmPlugin>& plugin) {
                     EXPECT_EQ(Status::OK, status);
-                    ASSERT_NE(plugin, nullptr);
+                    ASSERT_NE(nullptr, plugin.get());
                     drmPlugin = plugin;
                 });
         ASSERT_OK(res);
@@ -235,7 +235,7 @@
                 kClearKeyUUID, initVec,
                 [this](Status status, const sp<ICryptoPlugin>& plugin) {
                     EXPECT_EQ(Status::OK, status);
-                    ASSERT_NE(plugin, nullptr);
+                    ASSERT_NE(nullptr, plugin.get());
                     cryptoPlugin = plugin;
                 });
         ASSERT_OK(res);
@@ -866,7 +866,7 @@
 sp<IMemory> DrmHalClearkeyPluginTest::getDecryptMemory(size_t size,
                                                        size_t index) {
     sp<IAllocator> ashmemAllocator = IAllocator::getService("ashmem");
-    EXPECT_NE(ashmemAllocator, nullptr);
+    EXPECT_NE(nullptr, ashmemAllocator.get());
 
     hidl_memory hidlMemory;
     auto res = ashmemAllocator->allocate(
@@ -878,6 +878,7 @@
     EXPECT_OK(res);
 
     sp<IMemory> mappedMemory = mapMemory(hidlMemory);
+    EXPECT_NE(nullptr, mappedMemory.get());
     EXPECT_OK(cryptoPlugin->setSharedBufferBase(hidlMemory, index));
     return mappedMemory;
 }
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
index 67b2c7d..6ce465f 100644
--- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
@@ -113,7 +113,7 @@
               test_info->test_case_name(), test_info->name(),
               GetParam().c_str());
 
-        ASSERT_NE(vendorModule, nullptr);
+        ASSERT_NE(nullptr, vendorModule.get());
 
         // First try the binderized service name provided by the vendor module.
         // If that fails, which it can on non-binderized devices, try the default
@@ -123,14 +123,14 @@
         if (drmFactory == nullptr) {
             drmFactory = VtsTestBase::getService<IDrmFactory>();
         }
-        ASSERT_NE(drmFactory, nullptr);
+        ASSERT_NE(nullptr, drmFactory.get());
 
         // Do the same for the crypto factory
         cryptoFactory = VtsTestBase::getService<ICryptoFactory>(name);
         if (cryptoFactory == nullptr) {
             cryptoFactory = VtsTestBase::getService<ICryptoFactory>();
         }
-        ASSERT_NE(cryptoFactory, nullptr);
+        ASSERT_NE(nullptr, cryptoFactory.get());
 
         // If drm scheme not installed skip subsequent tests
         if (!drmFactory->isCryptoSchemeSupported(getVendorUUID())) {
@@ -239,7 +239,7 @@
             getVendorUUID(), packageName,
             [&](Status status, const sp<IDrmPlugin>& plugin) {
                 EXPECT_EQ(Status::OK, status);
-                EXPECT_NE(plugin, nullptr);
+                EXPECT_NE(nullptr, plugin.get());
             });
     EXPECT_OK(res);
 }
@@ -254,7 +254,7 @@
             getVendorUUID(), initVec,
             [&](Status status, const sp<ICryptoPlugin>& plugin) {
                 EXPECT_EQ(Status::OK, status);
-                EXPECT_NE(plugin, nullptr);
+                EXPECT_NE(nullptr, plugin.get());
             });
     EXPECT_OK(res);
 }
@@ -269,7 +269,7 @@
             kInvalidUUID, packageName,
             [&](Status status, const sp<IDrmPlugin>& plugin) {
                 EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
-                EXPECT_EQ(plugin, nullptr);
+                EXPECT_EQ(nullptr, plugin.get());
             });
     EXPECT_OK(res);
 }
@@ -284,7 +284,7 @@
             kInvalidUUID, initVec,
             [&](Status status, const sp<ICryptoPlugin>& plugin) {
                 EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
-                EXPECT_EQ(plugin, nullptr);
+                EXPECT_EQ(nullptr, plugin.get());
             });
     EXPECT_OK(res);
 }
@@ -302,7 +302,7 @@
                 getVendorUUID(), packageName,
                 [this](Status status, const sp<IDrmPlugin>& plugin) {
                     EXPECT_EQ(Status::OK, status);
-                    ASSERT_NE(plugin, nullptr);
+                    ASSERT_NE(nullptr, plugin.get());
                     drmPlugin = plugin;
                 });
         ASSERT_OK(res);
@@ -312,7 +312,7 @@
                 getVendorUUID(), initVec,
                 [this](Status status, const sp<ICryptoPlugin>& plugin) {
                     EXPECT_EQ(Status::OK, status);
-                    ASSERT_NE(plugin, nullptr);
+                    ASSERT_NE(nullptr, plugin.get());
                     cryptoPlugin = plugin;
                 });
         ASSERT_OK(res);
@@ -1185,7 +1185,7 @@
 sp<IMemory> DrmHalVendorPluginTest::getDecryptMemory(size_t size,
                                                      size_t index) {
     sp<IAllocator> ashmemAllocator = IAllocator::getService("ashmem");
-    EXPECT_NE(ashmemAllocator, nullptr);
+    EXPECT_NE(nullptr, ashmemAllocator.get());
 
     hidl_memory hidlMemory;
     auto res = ashmemAllocator->allocate(
@@ -1198,7 +1198,7 @@
     EXPECT_OK(res);
 
     sp<IMemory> mappedMemory = mapMemory(hidlMemory);
-    EXPECT_NE(mappedMemory, nullptr);
+    EXPECT_NE(nullptr, mappedMemory.get());
     res = cryptoPlugin->setSharedBufferBase(hidlMemory, index);
     EXPECT_OK(res);
     return mappedMemory;
diff --git a/health/1.0/default/Android.bp b/health/1.0/default/Android.bp
new file mode 100644
index 0000000..c57152f
--- /dev/null
+++ b/health/1.0/default/Android.bp
@@ -0,0 +1,24 @@
+subdirs = [
+    "libhealthd",
+]
+
+cc_library_static {
+    name: "android.hardware.health@1.0-convert",
+    vendor_available: true,
+    srcs: ["convert.cpp"],
+    include_dirs: [
+        "system/core/base/include",
+    ],
+    header_libs: ["libhealthd_headers"],
+    export_header_lib_headers: ["libhealthd_headers"],
+    export_include_dirs: ["include"],
+    shared_libs: [
+        "libcutils",
+        "libhidlbase",
+        "libhidltransport",
+        "libutils",
+        "android.hardware.health@1.0",
+    ],
+
+}
+
diff --git a/health/1.0/default/Android.mk b/health/1.0/default/Android.mk
index 96ff91f..199ab41 100644
--- a/health/1.0/default/Android.mk
+++ b/health/1.0/default/Android.mk
@@ -4,10 +4,12 @@
 LOCAL_MODULE := android.hardware.health@1.0-impl
 LOCAL_PROPRIETARY_MODULE := true
 LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_C_INCLUDES := system/core/healthd/include system/core/base/include
+LOCAL_C_INCLUDES := system/core/base/include
 LOCAL_SRC_FILES := \
     Health.cpp \
 
+LOCAL_HEADER_LIBRARIES := libhealthd_headers
+
 LOCAL_SHARED_LIBRARIES := \
     libcutils \
     libhidlbase \
@@ -23,20 +25,6 @@
 include $(BUILD_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.health@1.0-convert
-LOCAL_SRC_FILES := convert.cpp
-LOCAL_C_INCLUDES := system/core/healthd/include system/core/base/include
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-LOCAL_SHARED_LIBRARIES := \
-    libcutils \
-    libhidlbase \
-    libhidltransport \
-    libutils \
-    android.hardware.health@1.0 \
-
-include $(BUILD_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
 LOCAL_PROPRIETARY_MODULE := true
 LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_MODULE := android.hardware.health@1.0-service
diff --git a/health/1.0/default/libhealthd/Android.bp b/health/1.0/default/libhealthd/Android.bp
new file mode 100644
index 0000000..ce02e28
--- /dev/null
+++ b/health/1.0/default/libhealthd/Android.bp
@@ -0,0 +1,10 @@
+// Copyright 2016 The Android Open Source Project
+
+cc_library_static {
+    srcs: ["healthd_board_default.cpp"],
+    name: "libhealthd.default",
+    vendor_available: true,
+    cflags: ["-Werror"],
+    include_dirs: ["system/core/base/include"],
+    header_libs: ["libhealthd_headers"],
+}
diff --git a/health/1.0/default/libhealthd/Android.mk b/health/1.0/default/libhealthd/Android.mk
deleted file mode 100644
index a5f4445..0000000
--- a/health/1.0/default/libhealthd/Android.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright 2016 The Android Open Source Project
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := healthd_board_default.cpp
-LOCAL_MODULE := libhealthd.default
-LOCAL_CFLAGS := -Werror
-LOCAL_C_INCLUDES := system/core/healthd/include system/core/base/include
-include $(BUILD_STATIC_LIBRARY)
diff --git a/health/Android.bp b/health/Android.bp
index 33f70eb..ed19a37 100644
--- a/health/Android.bp
+++ b/health/Android.bp
@@ -1,5 +1,6 @@
 // This is an autogenerated file, do not edit.
 subdirs = [
     "1.0",
+    "1.0/default",
     "1.0/vts/functional",
 ]
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
index 031584b..6790ebf 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
@@ -129,12 +129,22 @@
 
 // audio decoder test fixture class
 class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   private:
+    typedef ::testing::VtsHalHidlTargetTestBase Super;
    public:
+    ::std::string getTestCaseInfo() const override {
+        return ::std::string() +
+                "Component: " + gEnv->getComponent().c_str() + " | " +
+                "Role: " + gEnv->getRole().c_str() + " | " +
+                "Instance: " + gEnv->getInstance().c_str() + " | " +
+                "Res: " + gEnv->getRes().c_str();
+    }
+
     virtual void SetUp() override {
+        Super::SetUp();
         disableTest = false;
         android::hardware::media::omx::V1_0::Status status;
-        omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
-            gEnv->getInstance());
+        omx = Super::getService<IOmx>(gEnv->getInstance());
         ASSERT_NE(omx, nullptr);
         observer =
             new CodecObserver([this](Message msg, const BufferInfo* buffer) {
@@ -217,6 +227,7 @@
             EXPECT_TRUE((omxNode->freeNode()).isOk());
             omxNode = nullptr;
         }
+        Super::TearDown();
     }
 
     // callback function to process messages received by onMessages() from IL
@@ -474,15 +485,20 @@
 
 // port settings reconfiguration during runtime. reconfigures sample rate and
 // number
+typedef struct {
+    OMX_AUDIO_CODINGTYPE eEncoding;
+    AudioDecHidlTest::standardComp comp;
+} packedArgs;
 void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
                          android::Vector<BufferInfo>* iBuffer,
                          android::Vector<BufferInfo>* oBuffer,
-                         OMX_AUDIO_CODINGTYPE eEncoding,
                          OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput,
-                         Message msg,
-                         AudioDecHidlTest::standardComp comp =
-                             AudioDecHidlTest::standardComp::unknown_comp) {
+                         Message msg, PortMode oPortMode, void* args) {
     android::hardware::media::omx::V1_0::Status status;
+    packedArgs* audioArgs = static_cast<packedArgs*>(args);
+    OMX_AUDIO_CODINGTYPE eEncoding = audioArgs->eEncoding;
+    AudioDecHidlTest::standardComp comp = audioArgs->comp;
+    (void)oPortMode;
 
     if (msg.data.eventData.event == OMX_EventPortSettingsChanged) {
         ASSERT_EQ(msg.data.eventData.data1, kPortIndexOutput);
@@ -572,16 +588,18 @@
                             AudioDecHidlTest::standardComp comp) {
     android::hardware::media::omx::V1_0::Status status;
     Message msg;
-    int timeOut = TIMEOUT_COUNTER;
+    int timeOut = TIMEOUT_COUNTER_Q;
 
     while (timeOut--) {
         size_t i = 0;
         status =
-            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
         if (status == android::hardware::media::omx::V1_0::Status::OK) {
             EXPECT_EQ(msg.type, Message::Type::EVENT);
-            portReconfiguration(omxNode, observer, iBuffer, oBuffer, eEncoding,
-                                kPortIndexInput, kPortIndexOutput, msg, comp);
+            packedArgs audioArgs = {eEncoding, comp};
+            portReconfiguration(omxNode, observer, iBuffer, oBuffer,
+                                kPortIndexInput, kPortIndexOutput, msg,
+                                PortMode::PRESET_BYTE_BUFFER, &audioArgs);
         }
         // status == TIMED_OUT, it could be due to process time being large
         // than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -595,8 +613,8 @@
         size_t index;
         if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
             dispatchOutputBuffer(omxNode, oBuffer, index);
+            timeOut = TIMEOUT_COUNTER_Q;
         }
-        timeOut--;
     }
 }
 
@@ -636,17 +654,20 @@
         frameID++;
     }
 
-    int timeOut = TIMEOUT_COUNTER;
-    bool stall = false;
+    int timeOut = TIMEOUT_COUNTER_Q;
+    bool iQueued, oQueued;
     while (1) {
+        iQueued = oQueued = false;
         status =
-            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
 
         // Port Reconfiguration
         if (status == android::hardware::media::omx::V1_0::Status::OK &&
             msg.type == Message::Type::EVENT) {
-            portReconfiguration(omxNode, observer, iBuffer, oBuffer, eEncoding,
-                                kPortIndexInput, kPortIndexOutput, msg, comp);
+            packedArgs audioArgs = {eEncoding, comp};
+            portReconfiguration(omxNode, observer, iBuffer, oBuffer,
+                                kPortIndexInput, kPortIndexOutput, msg,
+                                PortMode::PRESET_BYTE_BUFFER, &audioArgs);
         }
 
         if (frameID == (int)Info->size() || frameID == (offset + range)) break;
@@ -668,18 +689,16 @@
                                 (*Info)[frameID].bytesCount, flags,
                                 (*Info)[frameID].timestamp);
             frameID++;
-            stall = false;
-        } else
-            stall = true;
+            iQueued = true;
+        }
         if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
             dispatchOutputBuffer(omxNode, oBuffer, index);
-            stall = false;
-        } else
-            stall = true;
-        if (stall)
-            timeOut--;
+            oQueued = true;
+        }
+        if (iQueued || oQueued)
+            timeOut = TIMEOUT_COUNTER_Q;
         else
-            timeOut = TIMEOUT_COUNTER;
+            timeOut--;
         if (timeOut == 0) {
             EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
             break;
@@ -791,7 +810,9 @@
     eleStream.close();
     waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
                            kPortIndexInput, kPortIndexOutput, compName);
-    testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
+    packedArgs audioArgs = {eEncoding, compName};
+    testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
+            portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
     EXPECT_EQ(timestampUslist.empty(), true);
     // set state to idle
     changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
@@ -847,7 +868,9 @@
     changeStateIdletoExecute(omxNode, observer);
 
     // request EOS at the start
-    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag);
+    packedArgs audioArgs = {eEncoding, compName};
+    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
+            portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
                kPortIndexOutput);
     EXPECT_GE(framesReceived, 0U);
@@ -935,7 +958,9 @@
     eleStream.close();
     waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
                            kPortIndexInput, kPortIndexOutput, compName);
-    testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
+    packedArgs audioArgs = {eEncoding, compName};
+    testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
+            portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
                kPortIndexOutput);
     EXPECT_GE(framesReceived, 1U);
@@ -951,7 +976,8 @@
     eleStream.close();
     waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
                            kPortIndexInput, kPortIndexOutput, compName);
-    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag);
+    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
+            portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
                kPortIndexOutput);
     EXPECT_GE(framesReceived, 1U);
@@ -1036,7 +1062,9 @@
     eleStream.close();
     waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
                            kPortIndexInput, kPortIndexOutput, compName);
-    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag);
+    packedArgs audioArgs = {eEncoding, compName};
+    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
+            portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs);
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
                kPortIndexOutput);
     framesReceived = 0;
@@ -1120,9 +1148,8 @@
     decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
                   kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0,
                   nFrames, compName, false);
-    // Note: Assumes 200 ms is enough to end any decode call that started
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
-               kPortIndexOutput, 200000);
+               kPortIndexOutput);
     framesReceived = 0;
 
     // Seek to next key frame and start decoding till the end
@@ -1143,9 +1170,8 @@
                       kPortIndexInput, kPortIndexOutput, eleStream, &Info,
                       index, Info.size() - index, compName, false);
     }
-    // Note: Assumes 200 ms is enough to end any decode call that started
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
-               kPortIndexOutput, 200000);
+               kPortIndexOutput);
     framesReceived = 0;
 
     // set state to idle
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
index 7a5dcec..038830d 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
@@ -129,12 +129,22 @@
 
 // audio encoder test fixture class
 class AudioEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   private:
+    typedef ::testing::VtsHalHidlTargetTestBase Super;
    public:
+    ::std::string getTestCaseInfo() const override {
+        return ::std::string() +
+                "Component: " + gEnv->getComponent().c_str() + " | " +
+                "Role: " + gEnv->getRole().c_str() + " | " +
+                "Instance: " + gEnv->getInstance().c_str() + " | " +
+                "Res: " + gEnv->getRes().c_str();
+    }
+
     virtual void SetUp() override {
+        Super::SetUp();
         disableTest = false;
         android::hardware::media::omx::V1_0::Status status;
-        omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
-            gEnv->getInstance());
+        omx = Super::getService<IOmx>(gEnv->getInstance());
         ASSERT_NE(omx, nullptr);
         observer =
             new CodecObserver([this](Message msg, const BufferInfo* buffer) {
@@ -204,6 +214,7 @@
             EXPECT_TRUE((omxNode->freeNode()).isOk());
             omxNode = nullptr;
         }
+        Super::TearDown();
     }
 
     // callback function to process messages received by onMessages() from IL
@@ -331,12 +342,12 @@
                             android::Vector<BufferInfo>* oBuffer) {
     android::hardware::media::omx::V1_0::Status status;
     Message msg;
-    int timeOut = TIMEOUT_COUNTER;
+    int timeOut = TIMEOUT_COUNTER_Q;
 
     while (timeOut--) {
         size_t i = 0;
         status =
-            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
         EXPECT_EQ(status,
                   android::hardware::media::omx::V1_0::Status::TIMED_OUT);
         // status == TIMED_OUT, it could be due to process time being large
@@ -351,8 +362,8 @@
         size_t index;
         if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
             dispatchOutputBuffer(omxNode, oBuffer, index);
+            timeOut = TIMEOUT_COUNTER_Q;
         }
-        timeOut--;
     }
 }
 
@@ -389,11 +400,12 @@
         nFrames--;
     }
 
-    int timeOut = TIMEOUT_COUNTER;
-    bool stall = false;
+    int timeOut = TIMEOUT_COUNTER_Q;
+    bool iQueued, oQueued;
     while (1) {
+        iQueued = oQueued = false;
         status =
-            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
 
         if (status == android::hardware::media::omx::V1_0::Status::OK)
             ASSERT_TRUE(false);
@@ -414,19 +426,17 @@
                                 timestamp);
             timestamp += timestampIncr;
             nFrames--;
-            stall = false;
-        } else
-            stall = true;
+            iQueued = true;
+        }
         // Dispatch output buffer
         if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
             dispatchOutputBuffer(omxNode, oBuffer, index);
-            stall = false;
-        } else
-            stall = true;
-        if (stall)
-            timeOut--;
+            oQueued = true;
+        }
+        if (iQueued || oQueued)
+            timeOut = TIMEOUT_COUNTER_Q;
         else
-            timeOut = TIMEOUT_COUNTER;
+            timeOut--;
         if (timeOut == 0) {
             EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
             break;
diff --git a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
index 7240964..4c68219 100644
--- a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
+++ b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.cpp
@@ -46,47 +46,6 @@
 #include <media_hidl_test_common.h>
 #include <memory>
 
-Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
-    sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding) {
-    OMX_U32 index = 0;
-    OMX_AUDIO_PARAM_PORTFORMATTYPE portFormat;
-    std::vector<OMX_AUDIO_CODINGTYPE> arrEncoding;
-    android::hardware::media::omx::V1_0::Status status;
-
-    while (1) {
-        portFormat.nIndex = index;
-        status = getPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
-                              &portFormat);
-        if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
-        arrEncoding.push_back(portFormat.eEncoding);
-        index++;
-        if (index == 512) {
-            // enumerated way too many formats, highly unusual for this to
-            // happen.
-            EXPECT_LE(index, 512U)
-                << "Expecting OMX_ErrorNoMore but not received";
-            break;
-        }
-    }
-    if (!index) return status;
-    for (index = 0; index < arrEncoding.size(); index++) {
-        if (arrEncoding[index] == eEncoding) {
-            portFormat.eEncoding = arrEncoding[index];
-            break;
-        }
-    }
-    if (index == arrEncoding.size()) {
-        ALOGE("setting default Port format %x", (int)arrEncoding[0]);
-        portFormat.eEncoding = arrEncoding[0];
-    }
-    // In setParam call nIndex shall be ignored as per omx-il specification.
-    // see how this holds up by corrupting nIndex
-    portFormat.nIndex = RANDOM_INDEX;
-    status = setPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
-                          &portFormat);
-    return status;
-}
-
 void enumerateProfile(sp<IOmxNode> omxNode, OMX_U32 portIndex,
                       std::vector<int32_t>* arrProfile) {
     android::hardware::media::omx::V1_0::Status status;
diff --git a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h
index 70142f2..b187d28 100644
--- a/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/audio/media_audio_hidl_test_common.h
@@ -20,16 +20,8 @@
 #include <media_hidl_test_common.h>
 
 /*
- * Random Index used for monkey testing while get/set parameters
- */
-#define RANDOM_INDEX 1729
-
-/*
  * Common audio utils
  */
-Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
-    sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding);
-
 void enumerateProfile(sp<IOmxNode> omxNode, OMX_U32 portIndex,
                       std::vector<int32_t>* arrProfile);
 
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
index e81e6dd..a890c4f 100755
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
@@ -60,6 +60,113 @@
     return setParam(omxNode, OMX_IndexParamStandardComponentRole, &params);
 }
 
+// get/set video component port format
+Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
+    sp<IOmxNode> omxNode, OMX_U32 portIndex,
+    OMX_VIDEO_CODINGTYPE eCompressionFormat, OMX_COLOR_FORMATTYPE eColorFormat,
+    OMX_U32 xFramerate) {
+    OMX_U32 index = 0;
+    OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat;
+    std::vector<OMX_COLOR_FORMATTYPE> arrColorFormat;
+    std::vector<OMX_VIDEO_CODINGTYPE> arrCompressionFormat;
+    android::hardware::media::omx::V1_0::Status status;
+
+    while (1) {
+        portFormat.nIndex = index;
+        status = getPortParam(omxNode, OMX_IndexParamVideoPortFormat, portIndex,
+                              &portFormat);
+        if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
+        if (eCompressionFormat == OMX_VIDEO_CodingUnused)
+            arrColorFormat.push_back(portFormat.eColorFormat);
+        else
+            arrCompressionFormat.push_back(portFormat.eCompressionFormat);
+        index++;
+        if (index == 512) {
+            // enumerated way too many formats, highly unusual for this to
+            // happen.
+            EXPECT_LE(index, 512U)
+                << "Expecting OMX_ErrorNoMore but not received";
+            break;
+        }
+    }
+    if (!index) return status;
+    if (eCompressionFormat == OMX_VIDEO_CodingUnused) {
+        for (index = 0; index < arrColorFormat.size(); index++) {
+            if (arrColorFormat[index] == eColorFormat) {
+                portFormat.eColorFormat = arrColorFormat[index];
+                break;
+            }
+        }
+        if (index == arrColorFormat.size()) {
+            ALOGE("setting default color format %x", (int)arrColorFormat[0]);
+            portFormat.eColorFormat = arrColorFormat[0];
+        }
+        portFormat.eCompressionFormat = OMX_VIDEO_CodingUnused;
+    } else {
+        for (index = 0; index < arrCompressionFormat.size(); index++) {
+            if (arrCompressionFormat[index] == eCompressionFormat) {
+                portFormat.eCompressionFormat = arrCompressionFormat[index];
+                break;
+            }
+        }
+        if (index == arrCompressionFormat.size()) {
+            ALOGE("setting default compression format %x",
+                  (int)arrCompressionFormat[0]);
+            portFormat.eCompressionFormat = arrCompressionFormat[0];
+        }
+        portFormat.eColorFormat = OMX_COLOR_FormatUnused;
+    }
+    // In setParam call nIndex shall be ignored as per omx-il specification.
+    // see how this holds up by corrupting nIndex
+    portFormat.nIndex = RANDOM_INDEX;
+    portFormat.xFramerate = xFramerate;
+    status = setPortParam(omxNode, OMX_IndexParamVideoPortFormat, portIndex,
+                          &portFormat);
+    return status;
+}
+
+// get/set audio component port format
+Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
+    sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding) {
+    OMX_U32 index = 0;
+    OMX_AUDIO_PARAM_PORTFORMATTYPE portFormat;
+    std::vector<OMX_AUDIO_CODINGTYPE> arrEncoding;
+    android::hardware::media::omx::V1_0::Status status;
+
+    while (1) {
+        portFormat.nIndex = index;
+        status = getPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
+                              &portFormat);
+        if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
+        arrEncoding.push_back(portFormat.eEncoding);
+        index++;
+        if (index == 512) {
+            // enumerated way too many formats, highly unusual for this to
+            // happen.
+            EXPECT_LE(index, 512U)
+                << "Expecting OMX_ErrorNoMore but not received";
+            break;
+        }
+    }
+    if (!index) return status;
+    for (index = 0; index < arrEncoding.size(); index++) {
+        if (arrEncoding[index] == eEncoding) {
+            portFormat.eEncoding = arrEncoding[index];
+            break;
+        }
+    }
+    if (index == arrEncoding.size()) {
+        ALOGE("setting default Port format %x", (int)arrEncoding[0]);
+        portFormat.eEncoding = arrEncoding[0];
+    }
+    // In setParam call nIndex shall be ignored as per omx-il specification.
+    // see how this holds up by corrupting nIndex
+    portFormat.nIndex = RANDOM_INDEX;
+    status = setPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
+                          &portFormat);
+    return status;
+}
+
 // allocate buffers needed on a component port
 void allocatePortBuffers(sp<IOmxNode> omxNode,
                          android::Vector<BufferInfo>* buffArray,
@@ -406,7 +513,8 @@
 void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
              android::Vector<BufferInfo>* iBuffer,
              android::Vector<BufferInfo>* oBuffer, bool signalEOS,
-             bool& eosFlag, PortMode* portMode) {
+             bool& eosFlag, PortMode* portMode, portreconfig fptr,
+             OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput, void* args) {
     android::hardware::media::omx::V1_0::Status status;
     PortMode defaultPortMode[2], *pm;
 
@@ -424,7 +532,7 @@
         }
     }
 
-    int timeOut = TIMEOUT_COUNTER;
+    int timeOut = TIMEOUT_COUNTER_PE;
     while (timeOut--) {
         // Dispatch all client owned output buffers to recover remaining frames
         while (1) {
@@ -433,17 +541,26 @@
                 // if dispatch is successful, perhaps there is a latency
                 // in the component. Dont be in a haste to leave. reset timeout
                 // counter
-                timeOut = TIMEOUT_COUNTER;
+                timeOut = TIMEOUT_COUNTER_PE;
             } else {
                 break;
             }
         }
 
         Message msg;
-        status =
-            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+        status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_PE, iBuffer,
+                                          oBuffer);
         if (status == android::hardware::media::omx::V1_0::Status::OK) {
-            if (msg.data.eventData.event == OMX_EventBufferFlag) {
+            if (msg.data.eventData.event == OMX_EventPortSettingsChanged) {
+                if (fptr) {
+                    (*fptr)(omxNode, observer, iBuffer, oBuffer,
+                            kPortIndexInput, kPortIndexOutput, msg, pm[1],
+                            args);
+                } else {
+                    // something unexpected happened
+                    EXPECT_TRUE(false);
+                }
+            } else if (msg.data.eventData.event == OMX_EventBufferFlag) {
                 // soft omx components donot send this, we will just ignore it
                 // for now
             } else {
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
index d617e45..802f4d6 100644
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
@@ -33,8 +33,26 @@
 #include <media/openmax/OMX_AudioExt.h>
 #include <media/openmax/OMX_VideoExt.h>
 
+/* TIME OUTS (Wait time in dequeueMessage()) */
+
+/* As component is switching states (loaded<->idle<->execute), dequeueMessage()
+ * expects the events to be received within this duration */
 #define DEFAULT_TIMEOUT 100000
-#define TIMEOUT_COUNTER (10000000 / DEFAULT_TIMEOUT)
+/* Time interval between successive Input/Output enqueues */
+#define DEFAULT_TIMEOUT_Q 2000
+/* While the component is amidst a process call, asynchronous commands like
+ * flush, change states can get delayed (at max by process call time). Instead
+ * of waiting on DEFAULT_TIMEOUT, we give an additional leeway. */
+#define DEFAULT_TIMEOUT_PE 500000
+
+/* Breakout Timeout :: 5 sec*/
+#define TIMEOUT_COUNTER_Q (5000000 / DEFAULT_TIMEOUT_Q)
+#define TIMEOUT_COUNTER_PE (5000000 / DEFAULT_TIMEOUT_PE)
+
+/*
+ * Random Index used for monkey testing while get/set parameters
+ */
+#define RANDOM_INDEX 1729
 
 enum bufferOwner {
     client,
@@ -259,6 +277,14 @@
 Return<android::hardware::media::omx::V1_0::Status> setRole(
     sp<IOmxNode> omxNode, const char* role);
 
+Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
+    sp<IOmxNode> omxNode, OMX_U32 portIndex,
+    OMX_VIDEO_CODINGTYPE eCompressionFormat, OMX_COLOR_FORMATTYPE eColorFormat,
+    OMX_U32 xFramerate);
+
+Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
+    sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding);
+
 void allocatePortBuffers(sp<IOmxNode> omxNode,
                          android::Vector<BufferInfo>* buffArray,
                          OMX_U32 portIndex,
@@ -297,11 +323,19 @@
 void flushPorts(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
                 android::Vector<BufferInfo>* iBuffer,
                 android::Vector<BufferInfo>* oBuffer, OMX_U32 kPortIndexInput,
-                OMX_U32 kPortIndexOutput, int64_t timeoutUs = DEFAULT_TIMEOUT);
+                OMX_U32 kPortIndexOutput,
+                int64_t timeoutUs = DEFAULT_TIMEOUT_PE);
 
+typedef void (*portreconfig)(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
+                             android::Vector<BufferInfo>* iBuffer,
+                             android::Vector<BufferInfo>* oBuffer,
+                             OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput,
+                             Message msg, PortMode oPortMode, void* args);
 void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
              android::Vector<BufferInfo>* iBuffer,
              android::Vector<BufferInfo>* oBuffer, bool signalEOS,
-             bool& eosFlag, PortMode* portMode = nullptr);
+             bool& eosFlag, PortMode* portMode = nullptr,
+             portreconfig fptr = nullptr, OMX_U32 kPortIndexInput = 0,
+             OMX_U32 kPortIndexOutput = 1, void* args = nullptr);
 
 #endif  // MEDIA_HIDL_TEST_COMMON_H
diff --git a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
index 357c11e..200b6cb 100644
--- a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
+++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
@@ -117,12 +117,21 @@
 
 // generic component test fixture class
 class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   private:
+    typedef ::testing::VtsHalHidlTargetTestBase Super;
    public:
+    ::std::string getTestCaseInfo() const override {
+        return ::std::string() +
+                "Component: " + gEnv->getComponent().c_str() + " | " +
+                "Role: " + gEnv->getRole().c_str() + " | " +
+                "Instance: " + gEnv->getInstance().c_str();
+    }
+
     virtual void SetUp() override {
+        Super::SetUp();
         disableTest = false;
         android::hardware::media::omx::V1_0::Status status;
-        omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
-            gEnv->getInstance());
+        omx = Super::getService<IOmx>(gEnv->getInstance());
         ASSERT_NE(omx, nullptr);
         observer = new CodecObserver(nullptr);
         ASSERT_NE(observer, nullptr);
@@ -180,6 +189,7 @@
             EXPECT_TRUE((omxNode->freeNode()).isOk());
             omxNode = nullptr;
         }
+        Super::TearDown();
     }
 
     enum standardCompClass {
@@ -203,9 +213,6 @@
     }
 };
 
-// Random Index used for monkey testing while get/set parameters
-#define RANDOM_INDEX 1729
-
 void initPortMode(PortMode* pm, bool isSecure,
                   ComponentHidlTest::standardCompClass compClass) {
     pm[0] = PortMode::PRESET_BYTE_BUFFER;
@@ -225,113 +232,6 @@
     return;
 }
 
-// get/set video component port format
-Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
-    sp<IOmxNode> omxNode, OMX_U32 portIndex,
-    OMX_VIDEO_CODINGTYPE eCompressionFormat, OMX_COLOR_FORMATTYPE eColorFormat,
-    OMX_U32 xFramerate) {
-    OMX_U32 index = 0;
-    OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat;
-    std::vector<OMX_COLOR_FORMATTYPE> arrColorFormat;
-    std::vector<OMX_VIDEO_CODINGTYPE> arrCompressionFormat;
-    android::hardware::media::omx::V1_0::Status status;
-
-    while (1) {
-        portFormat.nIndex = index;
-        status = getPortParam(omxNode, OMX_IndexParamVideoPortFormat, portIndex,
-                              &portFormat);
-        if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
-        if (eCompressionFormat == OMX_VIDEO_CodingUnused)
-            arrColorFormat.push_back(portFormat.eColorFormat);
-        else
-            arrCompressionFormat.push_back(portFormat.eCompressionFormat);
-        index++;
-        if (index == 512) {
-            // enumerated way too many formats, highly unusual for this to
-            // happen.
-            EXPECT_LE(index, 512U)
-                << "Expecting OMX_ErrorNoMore but not received";
-            break;
-        }
-    }
-    if (!index) return status;
-    if (eCompressionFormat == OMX_VIDEO_CodingUnused) {
-        for (index = 0; index < arrColorFormat.size(); index++) {
-            if (arrColorFormat[index] == eColorFormat) {
-                portFormat.eColorFormat = arrColorFormat[index];
-                break;
-            }
-        }
-        if (index == arrColorFormat.size()) {
-            ALOGE("setting default color format %x", (int)arrColorFormat[0]);
-            portFormat.eColorFormat = arrColorFormat[0];
-        }
-        portFormat.eCompressionFormat = OMX_VIDEO_CodingUnused;
-    } else {
-        for (index = 0; index < arrCompressionFormat.size(); index++) {
-            if (arrCompressionFormat[index] == eCompressionFormat) {
-                portFormat.eCompressionFormat = arrCompressionFormat[index];
-                break;
-            }
-        }
-        if (index == arrCompressionFormat.size()) {
-            ALOGE("setting default compression format %x",
-                  (int)arrCompressionFormat[0]);
-            portFormat.eCompressionFormat = arrCompressionFormat[0];
-        }
-        portFormat.eColorFormat = OMX_COLOR_FormatUnused;
-    }
-    // In setParam call nIndex shall be ignored as per omx-il specification.
-    // see how this holds up by corrupting nIndex
-    portFormat.nIndex = RANDOM_INDEX;
-    portFormat.xFramerate = xFramerate;
-    status = setPortParam(omxNode, OMX_IndexParamVideoPortFormat, portIndex,
-                          &portFormat);
-    return status;
-}
-
-// get/set audio component port format
-Return<android::hardware::media::omx::V1_0::Status> setAudioPortFormat(
-    sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE eEncoding) {
-    OMX_U32 index = 0;
-    OMX_AUDIO_PARAM_PORTFORMATTYPE portFormat;
-    std::vector<OMX_AUDIO_CODINGTYPE> arrEncoding;
-    android::hardware::media::omx::V1_0::Status status;
-
-    while (1) {
-        portFormat.nIndex = index;
-        status = getPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
-                              &portFormat);
-        if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
-        arrEncoding.push_back(portFormat.eEncoding);
-        index++;
-        if (index == 512) {
-            // enumerated way too many formats, highly unusual for this to
-            // happen.
-            EXPECT_LE(index, 512U)
-                << "Expecting OMX_ErrorNoMore but not received";
-            break;
-        }
-    }
-    if (!index) return status;
-    for (index = 0; index < arrEncoding.size(); index++) {
-        if (arrEncoding[index] == eEncoding) {
-            portFormat.eEncoding = arrEncoding[index];
-            break;
-        }
-    }
-    if (index == arrEncoding.size()) {
-        ALOGE("setting default Port format %x", (int)arrEncoding[0]);
-        portFormat.eEncoding = arrEncoding[0];
-    }
-    // In setParam call nIndex shall be ignored as per omx-il specification.
-    // see how this holds up by corrupting nIndex
-    portFormat.nIndex = RANDOM_INDEX;
-    status = setPortParam(omxNode, OMX_IndexParamAudioPortFormat, portIndex,
-                          &portFormat);
-    return status;
-}
-
 // test dispatch message API call
 TEST_F(ComponentHidlTest, dispatchMsg) {
     description("test dispatch message API call");
diff --git a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
index 9958869..e8f5f77 100644
--- a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
+++ b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
@@ -97,17 +97,22 @@
 static ComponentTestEnvironment* gEnv = nullptr;
 
 class MasterHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   private:
+    typedef ::testing::VtsHalHidlTargetTestBase Super;
    public:
     virtual void SetUp() override {
+        Super::SetUp();
         omxStore = nullptr;
-        omxStore = ::testing::VtsHalHidlTargetTestBase::getService<IOmxStore>();
+        omxStore = Super::getService<IOmxStore>();
         ASSERT_NE(omxStore, nullptr);
         omx = nullptr;
         omx = omxStore->getOmx(gEnv->getInstance());
         ASSERT_NE(omx, nullptr);
     }
 
-    virtual void TearDown() override {}
+    virtual void TearDown() override {
+        Super::TearDown();
+    }
 
     sp<IOmxStore> omxStore;
     sp<IOmx> omx;
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
index 2ff8ed3..a9c29c7 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
@@ -134,12 +134,22 @@
 
 // video decoder test fixture class
 class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   private:
+    typedef ::testing::VtsHalHidlTargetTestBase Super;
    public:
+    ::std::string getTestCaseInfo() const override {
+        return ::std::string() +
+                "Component: " + gEnv->getComponent().c_str() + " | " +
+                "Role: " + gEnv->getRole().c_str() + " | " +
+                "Instance: " + gEnv->getInstance().c_str() + " | " +
+                "Res: " + gEnv->getRes().c_str();
+    }
+
     virtual void SetUp() override {
+        Super::SetUp();
         disableTest = false;
         android::hardware::media::omx::V1_0::Status status;
-        omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
-            gEnv->getInstance());
+        omx = Super::getService<IOmx>(gEnv->getInstance());
         ASSERT_NE(omx, nullptr);
         observer =
             new CodecObserver([this](Message msg, const BufferInfo* buffer) {
@@ -223,6 +233,7 @@
             EXPECT_TRUE((omxNode->freeNode()).isOk());
             omxNode = nullptr;
         }
+        Super::TearDown();
     }
 
     // callback function to process messages received by onMessages() from IL
@@ -474,8 +485,9 @@
                          android::Vector<BufferInfo>* iBuffer,
                          android::Vector<BufferInfo>* oBuffer,
                          OMX_U32 kPortIndexInput, OMX_U32 kPortIndexOutput,
-                         Message msg, PortMode oPortMode) {
+                         Message msg, PortMode oPortMode, void* args) {
     android::hardware::media::omx::V1_0::Status status;
+    (void)args;
 
     if (msg.data.eventData.event == OMX_EventPortSettingsChanged) {
         ASSERT_EQ(msg.data.eventData.data1, kPortIndexOutput);
@@ -592,17 +604,17 @@
                             PortMode oPortMode) {
     android::hardware::media::omx::V1_0::Status status;
     Message msg;
-    int timeOut = TIMEOUT_COUNTER;
+    int timeOut = TIMEOUT_COUNTER_Q;
 
     while (timeOut--) {
         size_t i = 0;
         status =
-            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
         if (status == android::hardware::media::omx::V1_0::Status::OK) {
             EXPECT_EQ(msg.type, Message::Type::EVENT);
             portReconfiguration(omxNode, observer, iBuffer, oBuffer,
                                 kPortIndexInput, kPortIndexOutput, msg,
-                                oPortMode);
+                                oPortMode, nullptr);
         }
         // status == TIMED_OUT, it could be due to process time being large
         // than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -616,8 +628,8 @@
         size_t index;
         if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
             dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode);
+            timeOut = TIMEOUT_COUNTER_Q;
         }
-        timeOut--;
     }
 }
 
@@ -657,18 +669,19 @@
         frameID++;
     }
 
-    int timeOut = TIMEOUT_COUNTER;
-    bool stall = false;
+    int timeOut = TIMEOUT_COUNTER_Q;
+    bool iQueued, oQueued;
     while (1) {
+        iQueued = oQueued = false;
         status =
-            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
 
         // Port Reconfiguration
         if (status == android::hardware::media::omx::V1_0::Status::OK &&
             msg.type == Message::Type::EVENT) {
             portReconfiguration(omxNode, observer, iBuffer, oBuffer,
                                 kPortIndexInput, kPortIndexOutput, msg,
-                                oPortMode);
+                                oPortMode, nullptr);
         }
 
         if (frameID == (int)Info->size() || frameID == (offset + range)) break;
@@ -690,18 +703,16 @@
                                 (*Info)[frameID].bytesCount, flags,
                                 (*Info)[frameID].timestamp);
             frameID++;
-            stall = false;
-        } else
-            stall = true;
+            iQueued = true;
+        }
         if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
             dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode);
-            stall = false;
-        } else
-            stall = true;
-        if (stall)
-            timeOut--;
+            oQueued = true;
+        }
+        if (iQueued || oQueued)
+            timeOut = TIMEOUT_COUNTER_Q;
         else
-            timeOut = TIMEOUT_COUNTER;
+            timeOut--;
         if (timeOut == 0) {
             EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
             break;
@@ -834,7 +845,8 @@
     eleStream.close();
     waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
                            kPortIndexInput, kPortIndexOutput, portMode[1]);
-    testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode);
+    testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
+            portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
     EXPECT_EQ(timestampUslist.empty(), true);
     // set state to idle
     changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer);
@@ -884,7 +896,8 @@
     changeStateIdletoExecute(omxNode, observer);
 
     // request EOS at the start
-    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode);
+    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
+            portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
                kPortIndexOutput);
     EXPECT_GE(framesReceived, 0U);
@@ -968,7 +981,8 @@
     eleStream.close();
     waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
                            kPortIndexInput, kPortIndexOutput, portMode[1]);
-    testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode);
+    testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
+            portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
                kPortIndexOutput);
     EXPECT_GE(framesReceived, 1U);
@@ -983,7 +997,8 @@
     eleStream.close();
     waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
                            kPortIndexInput, kPortIndexOutput, portMode[1]);
-    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode);
+    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
+            portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
                kPortIndexOutput);
     EXPECT_GE(framesReceived, 1U);
@@ -1066,7 +1081,8 @@
     eleStream.close();
     waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
                            kPortIndexInput, kPortIndexOutput, portMode[1]);
-    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode);
+    testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
+            portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr);
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
                kPortIndexOutput);
     framesReceived = 0;
@@ -1148,9 +1164,8 @@
     decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
                   kPortIndexOutput, eleStream, &Info, 0, nFrames, portMode[1],
                   false);
-    // Note: Assumes 200 ms is enough to end any decode call that started
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
-               kPortIndexOutput, 200000);
+               kPortIndexOutput);
     framesReceived = 0;
 
     // Seek to next key frame and start decoding till the end
@@ -1171,9 +1186,8 @@
                       kPortIndexOutput, eleStream, &Info, index,
                       Info.size() - index, portMode[1], false);
     }
-    // Note: Assumes 200 ms is enough to end any decode call that started
     flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
-               kPortIndexOutput, 200000);
+               kPortIndexOutput);
     framesReceived = 0;
 
     // set state to idle
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
index f6bc93a..f4a4e9b 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
@@ -147,12 +147,22 @@
 
 // video encoder test fixture class
 class VideoEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   private:
+    typedef ::testing::VtsHalHidlTargetTestBase Super;
    public:
+    ::std::string getTestCaseInfo() const override {
+        return ::std::string() +
+                "Component: " + gEnv->getComponent().c_str() + " | " +
+                "Role: " + gEnv->getRole().c_str() + " | " +
+                "Instance: " + gEnv->getInstance().c_str() + " | " +
+                "Res: " + gEnv->getRes().c_str();
+    }
+
     virtual void SetUp() override {
+        Super::SetUp();
         disableTest = false;
         android::hardware::media::omx::V1_0::Status status;
-        omx = ::testing::VtsHalHidlTargetTestBase::getService<IOmx>(
-            gEnv->getInstance());
+        omx = Super::getService<IOmx>(gEnv->getInstance());
         ASSERT_NE(omx, nullptr);
         observer =
             new CodecObserver([this](Message msg, const BufferInfo* buffer) {
@@ -235,6 +245,7 @@
             EXPECT_TRUE((omxNode->freeNode()).isOk());
             omxNode = nullptr;
         }
+        Super::TearDown();
     }
 
     // callback function to process messages received by onMessages() from IL
@@ -601,12 +612,12 @@
                             sp<CodecProducerListener> listener = nullptr) {
     android::hardware::media::omx::V1_0::Status status;
     Message msg;
-    int timeOut = TIMEOUT_COUNTER;
+    int timeOut = TIMEOUT_COUNTER_Q;
 
     while (timeOut--) {
         size_t i = 0;
         status =
-            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
         EXPECT_EQ(status,
                   android::hardware::media::omx::V1_0::Status::TIMED_OUT);
         // status == TIMED_OUT, it could be due to process time being large
@@ -625,6 +636,7 @@
         size_t index;
         if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
             dispatchOutputBuffer(omxNode, oBuffer, index);
+            timeOut = TIMEOUT_COUNTER_Q;
         }
     }
 }
@@ -1016,11 +1028,12 @@
         }
     }
 
-    int timeOut = TIMEOUT_COUNTER;
-    bool stall = false;
+    int timeOut = TIMEOUT_COUNTER_Q;
+    bool iQueued, oQueued;
     while (1) {
+        iQueued = oQueued = false;
         status =
-            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
+            observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
 
         if (status == android::hardware::media::omx::V1_0::Status::OK) {
             ASSERT_EQ(msg.type, Message::Type::EVENT);
@@ -1051,9 +1064,7 @@
                 timestamp += timestampIncr;
                 nFrames--;
                 ipCount++;
-                stall = false;
-            } else {
-                stall = true;
+                iQueued = true;
             }
         } else {
             if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) {
@@ -1072,20 +1083,17 @@
                 timestamp += timestampIncr;
                 nFrames--;
                 ipCount++;
-                stall = false;
-            } else {
-                stall = true;
+                iQueued = true;
             }
         }
         if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
             dispatchOutputBuffer(omxNode, oBuffer, index);
-            stall = false;
-        } else
-            stall = true;
-        if (stall)
-            timeOut--;
+            oQueued = true;
+        }
+        if (iQueued || oQueued)
+            timeOut = TIMEOUT_COUNTER_Q;
         else
-            timeOut = TIMEOUT_COUNTER;
+            timeOut--;
         if (timeOut == 0) {
             EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite";
             break;
diff --git a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp
index 77763d1..91aecf2 100644
--- a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp
+++ b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp
@@ -52,68 +52,6 @@
 #include <media_video_hidl_test_common.h>
 #include <memory>
 
-Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
-    sp<IOmxNode> omxNode, OMX_U32 portIndex,
-    OMX_VIDEO_CODINGTYPE eCompressionFormat, OMX_COLOR_FORMATTYPE eColorFormat,
-    OMX_U32 xFramerate) {
-    OMX_U32 index = 0;
-    OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat;
-    std::vector<OMX_COLOR_FORMATTYPE> arrColorFormat;
-    std::vector<OMX_VIDEO_CODINGTYPE> arrCompressionFormat;
-    android::hardware::media::omx::V1_0::Status status;
-
-    while (1) {
-        portFormat.nIndex = index;
-        status = getPortParam(omxNode, OMX_IndexParamVideoPortFormat, portIndex,
-                              &portFormat);
-        if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
-        if (eCompressionFormat == OMX_VIDEO_CodingUnused)
-            arrColorFormat.push_back(portFormat.eColorFormat);
-        else
-            arrCompressionFormat.push_back(portFormat.eCompressionFormat);
-        index++;
-        if (index == 512) {
-            // enumerated way too many formats, highly unusual for this to
-            // happen.
-            EXPECT_LE(index, 512U)
-                << "Expecting OMX_ErrorNoMore but not received";
-            break;
-        }
-    }
-    if (!index) return status;
-    if (eCompressionFormat == OMX_VIDEO_CodingUnused) {
-        for (index = 0; index < arrColorFormat.size(); index++) {
-            if (arrColorFormat[index] == eColorFormat) {
-                portFormat.eColorFormat = arrColorFormat[index];
-                break;
-            }
-        }
-        if (index == arrColorFormat.size()) {
-            ALOGE("setting default color format %x", (int)arrColorFormat[0]);
-            portFormat.eColorFormat = arrColorFormat[0];
-        }
-        portFormat.eCompressionFormat = OMX_VIDEO_CodingUnused;
-    } else {
-        for (index = 0; index < arrCompressionFormat.size(); index++) {
-            if (arrCompressionFormat[index] == eCompressionFormat) {
-                portFormat.eCompressionFormat = arrCompressionFormat[index];
-                break;
-            }
-        }
-        if (index == arrCompressionFormat.size()) {
-            ALOGE("setting default compression format %x",
-                  (int)arrCompressionFormat[0]);
-            portFormat.eCompressionFormat = arrCompressionFormat[0];
-        }
-        portFormat.eColorFormat = OMX_COLOR_FormatUnused;
-    }
-    portFormat.nIndex = 0;
-    portFormat.xFramerate = xFramerate;
-    status = setPortParam(omxNode, OMX_IndexParamVideoPortFormat, portIndex,
-                          &portFormat);
-    return status;
-}
-
 void enumerateProfileAndLevel(sp<IOmxNode> omxNode, OMX_U32 portIndex,
                               std::vector<int32_t>* arrProfile,
                               std::vector<int32_t>* arrLevel) {
diff --git a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h
index e492779..55de125 100644
--- a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.h
@@ -18,19 +18,8 @@
 #define MEDIA_VIDEO_HIDL_TEST_COMMON_H
 
 /*
- * Random Index used for monkey testing while get/set parameters
- */
-#define RANDOM_INDEX 1729
-
-/*
  * Common video utils
  */
-
-Return<android::hardware::media::omx::V1_0::Status> setVideoPortFormat(
-    sp<IOmxNode> omxNode, OMX_U32 portIndex,
-    OMX_VIDEO_CODINGTYPE eCompressionFormat, OMX_COLOR_FORMATTYPE eColorFormat,
-    OMX_U32 xFramerate);
-
 void enumerateProfileAndLevel(sp<IOmxNode> omxNode, OMX_U32 portIndex,
                               std::vector<int32_t>* arrProfile,
                               std::vector<int32_t>* arrLevel);
diff --git a/power/1.1/IPower.hal b/power/1.1/IPower.hal
index 0c0f211..086904e 100644
--- a/power/1.1/IPower.hal
+++ b/power/1.1/IPower.hal
@@ -33,4 +33,18 @@
      */
     getSubsystemLowPowerStats()
             generates (vec<PowerStateSubsystem> subsystems, Status retval);
+
+    /**
+     * powerHintAsync() is called to pass hints on power requirements which
+     * may result in adjustment of power/performance parameters of the
+     * cpufreq governor and other controls.
+     *
+     * A particular platform may choose to ignore any hint.
+     *
+     * @param hint PowerHint which is passed
+     * @param data contains additional information about the hint
+     * and is described along with the comments for each of the hints.
+     */
+    oneway powerHintAsync(PowerHint hint, int32_t data);
+
 };
diff --git a/power/1.1/default/Power.cpp b/power/1.1/default/Power.cpp
index bf7c1fc..b5d0c84 100644
--- a/power/1.1/default/Power.cpp
+++ b/power/1.1/default/Power.cpp
@@ -165,6 +165,11 @@
     return Void();
 }
 
+Return<void> Power::powerHintAsync(PowerHint hint, int32_t data) {
+    // just call the normal power hint in this oneway function
+    return powerHint(hint, data);
+}
+
 } // namespace implementation
 }  // namespace V1_1
 }  // namespace power
diff --git a/power/1.1/default/Power.h b/power/1.1/default/Power.h
index ea9e8c3..e779d64 100644
--- a/power/1.1/default/Power.h
+++ b/power/1.1/default/Power.h
@@ -46,6 +46,7 @@
 
     // Methods from ::android::hardware::power::V1_1::IPower follow.
     Return<void> getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) override;
+    Return<void> powerHintAsync(PowerHint hint, int32_t data) override;
 
     // Methods from ::android::hidl::base::V1_0::IBase follow.
 
diff --git a/power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp b/power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp
index 1d0d50f..dc843f4 100644
--- a/power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp
+++ b/power/1.1/vts/functional/VtsHalPowerV1_1TargetTest.cpp
@@ -23,6 +23,7 @@
 using ::android::hardware::power::V1_1::IPower;
 using ::android::hardware::power::V1_1::PowerStateSubsystem;
 using ::android::hardware::power::V1_0::Status;
+using ::android::hardware::power::V1_0::PowerHint;
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::sp;
@@ -54,6 +55,41 @@
   ASSERT_TRUE(s == Status::SUCCESS || s == Status::FILESYSTEM_ERROR);
 }
 
+// Sanity check Power::powerHintAsync on good and bad inputs.
+TEST_F(PowerHidlTest, PowerHintAsync) {
+    PowerHint badHint = static_cast<PowerHint>(0xA);
+    auto hints = {PowerHint::VSYNC,        PowerHint::INTERACTION, PowerHint::VIDEO_ENCODE,
+                  PowerHint::VIDEO_DECODE, PowerHint::LOW_POWER,   PowerHint::SUSTAINED_PERFORMANCE,
+                  PowerHint::VR_MODE,      PowerHint::LAUNCH,      badHint};
+    Return<void> ret;
+    for (auto hint : hints) {
+        ret = power->powerHintAsync(hint, 30000);
+        ASSERT_TRUE(ret.isOk());
+
+        ret = power->powerHintAsync(hint, 0);
+        ASSERT_TRUE(ret.isOk());
+    }
+
+    // Turning these hints on in different orders triggers different code paths,
+    // so iterate over possible orderings.
+    std::vector<PowerHint> hints2 = {PowerHint::LAUNCH, PowerHint::VR_MODE,
+                                     PowerHint::SUSTAINED_PERFORMANCE, PowerHint::INTERACTION};
+    auto compareHints = [](PowerHint l, PowerHint r) {
+        return static_cast<uint32_t>(l) < static_cast<uint32_t>(r);
+    };
+    std::sort(hints2.begin(), hints2.end(), compareHints);
+    do {
+        for (auto iter = hints2.begin(); iter != hints2.end(); iter++) {
+            ret = power->powerHintAsync(*iter, 0);
+            ASSERT_TRUE(ret.isOk());
+        }
+        for (auto iter = hints2.begin(); iter != hints2.end(); iter++) {
+            ret = power->powerHintAsync(*iter, 30000);
+            ASSERT_TRUE(ret.isOk());
+        }
+    } while (std::next_permutation(hints2.begin(), hints2.end(), compareHints));
+}
+
 int main(int argc, char **argv) {
   ::testing::InitGoogleTest(&argc, argv);
   int status = RUN_ALL_TESTS();
diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal
index 9f19169..a94aac3 100644
--- a/radio/1.0/IRadioResponse.hal
+++ b/radio/1.0/IRadioResponse.hal
@@ -201,7 +201,7 @@
      *   RadioError:NO_NETWORK_FOUND
      *   RadioError:INVALID_CALL_ID
      *   RadioError:DEVICE_IN_USE
-     *   RadioError:MODE_NOT_SUPPORTED
+     *   RadioError:OPERATION_NOT_ALLOWED
      *   RadioError:ABORTED
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
@@ -537,7 +537,6 @@
      *   RadioError:INVALID_SMSC_ADDRESS
      *   RadioError:MODEM_ERR
      *   RadioError:NETWORK_ERR
-     *   RadioError:MODE_NOT_SUPPORTED
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
@@ -568,7 +567,6 @@
      *   RadioError:INVALID_SMSC_ADDRESS
      *   RadioError:MODEM_ERR
      *   RadioError:NETWORK_ERR
-     *   RadioError:MODE_NOT_SUPPORTED
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
@@ -1205,7 +1203,7 @@
      *   RadioError:NO_MEMORY
      *   RadioError:NO_RESOURCES
      *   RadioError:INVALID_MODEM_STATE
-     *   RadioError:MODE_NOT_SUPPORTED
+     *   RadioError:OPERATION_NOT_ALLOWED
      *   RadioError:INVALID_SMSC_ADDRESS
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:SYSTEM_ERR
@@ -1565,7 +1563,7 @@
      *   RadioError:INVALID_MODEM_STATE
      *   RadioError:NO_RESOURCES
      *   RadioError:CANCELLED
-     *   RadioError:MODE_NOT_SUPPORTED
+     *   RadioError:OPERATION_NOT_ALLOWED
      */
     oneway sendCDMAFeatureCodeResponse(RadioResponseInfo info);
 
@@ -1586,7 +1584,7 @@
      *   RadioError:NO_RESOURCES
      *   RadioError:CANCELLED
      *   RadioError:INVALID_MODEM_STATE
-     *   RadioError:MODE_NOT_SUPPORTED
+     *   RadioError:OPERATION_NOT_ALLOWED
      */
     oneway sendBurstDtmfResponse(RadioResponseInfo info);
 
@@ -1610,7 +1608,6 @@
      *   RadioError:NETWORK_ERR
      *   RadioError:ENCODING_ERR
      *   RadioError:INVALID_SMSC_ADDRESS
-     *   RadioError:MODE_NOT_SUPPORTED
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
@@ -1634,7 +1631,6 @@
      *   RadioError:REQUEST_RATE_LIMITED
      *   RadioError:SYSTEM_ERR
      *   RadioError:MODEM_ERR
-     *   RadioError:MODE_NOT_SUPPORTED
      *   RadioError:NETWORK_NOT_READY
      *   RadioError:INVALID_MODEM_STATE
      *   RadioError:INTERNAL_ERR
@@ -1816,7 +1812,6 @@
      *   RadioError:NO_MEMORY
      *   RadioError:NO_RESOURCES
      *   RadioError:INVALID_MODEM_STATE
-     *   RadioError:MODE_NOT_SUPPORTED
      *   RadioError:INVALID_SMSC_ADDRESS
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
@@ -2138,7 +2133,7 @@
      *   RadioError:MODEM_ERR
      *   RadioError:NETWORK_ERR
      *   RadioError:ENCODING_ERR
-     *   RadioError:MODE_NOT_SUPPORTED
+     *   RadioError:OPERATION_NOT_ALLOWED
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:NETWORK_NOT_READY
diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp
index 8cd823e..eb11b54 100644
--- a/radio/1.0/vts/functional/Android.bp
+++ b/radio/1.0/vts/functional/Android.bp
@@ -26,6 +26,7 @@
            "radio_hidl_hal_stk.cpp",
            "radio_hidl_hal_test.cpp",
            "radio_hidl_hal_voice.cpp",
+           "radio_indication.cpp",
            "radio_response.cpp",
            "VtsHalRadioV1_0TargetTest.cpp",
            "vts_test_util.cpp"],
@@ -72,29 +73,6 @@
 }
 
 cc_library_static {
-    name: "RadioHidlHalUtilsBase",
-    srcs : [
-        "radio_hidl_hal_test.cpp",
-        "radio_response.cpp"
-    ],
-    shared_libs: [
-        "libbase",
-        "liblog",
-        "libcutils",
-        "libhidlbase",
-        "libhidltransport",
-        "libnativehelper",
-        "libutils",
-        "android.hardware.radio@1.0",
-    ],
-    static_libs: ["VtsHalHidlTargetTestBase"],
-    cflags: [
-        "-O0",
-        "-g",
-    ],
-}
-
-cc_library_static {
     name: "RadioVtsTestUtilBase",
     srcs : [
         "vts_test_util.cpp"
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index 13c23a8..864f844 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -248,7 +248,8 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
@@ -280,7 +281,8 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
 }
 
@@ -345,7 +347,8 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
 }
 
@@ -361,7 +364,8 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
 }
 
@@ -494,7 +498,8 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
 }
 
@@ -562,7 +567,8 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
 }
 
@@ -651,7 +657,6 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
         ASSERT_TRUE(CheckGeneralError() ||
                     radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
                     radioRsp->rspInfo.error == RadioError::INVALID_STATE);
@@ -670,7 +675,6 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
         ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
                     radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED ||
                     radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
@@ -690,7 +694,8 @@
 
     if (cardStatus.cardState == CardState::ABSENT) {
         ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
-                    radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED);
+                    radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
 }
 
@@ -724,7 +729,8 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
 }
 
@@ -778,7 +784,8 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(radioRsp->rspInfo.error, RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
 }
 
@@ -793,9 +800,11 @@
     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
+    std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
+
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(CheckGeneralError() ||
-                    radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
 }
 
@@ -810,9 +819,11 @@
     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
+    std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
+
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(CheckGeneralError() ||
-                    radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
 }
 
@@ -828,7 +839,6 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
         ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
                     radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
index 2fa2827..5f28155 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
@@ -19,14 +19,16 @@
 void RadioHidlTest::SetUp() {
     radio =
         ::testing::VtsHalHidlTargetTestBase::getService<IRadio>(hidl_string(RADIO_SERVICE_NAME));
-    ASSERT_NE(radio, nullptr);
+    ASSERT_NE(nullptr, radio.get());
 
-    radioRsp = new RadioResponse(*this);
-    ASSERT_NE(radioRsp, nullptr);
+    radioRsp = new (std::nothrow) RadioResponse(*this);
+    ASSERT_NE(nullptr, radioRsp.get());
 
     count = 0;
 
-    radioInd = NULL;
+    radioInd = new (std::nothrow) RadioIndication(*this);
+    ASSERT_NE(nullptr, radioInd.get());
+
     radio->setResponseFunctions(radioRsp, radioInd);
 
     int serial = GetRandomSerialNumber();
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
index c126da4..b0d67da 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
@@ -28,53 +28,7 @@
 
 #include "vts_test_util.h"
 
-using ::android::hardware::radio::V1_0::ActivityStatsInfo;
-using ::android::hardware::radio::V1_0::AppType;
-using ::android::hardware::radio::V1_0::CardStatus;
-using ::android::hardware::radio::V1_0::CardState;
-using ::android::hardware::radio::V1_0::Call;
-using ::android::hardware::radio::V1_0::CallForwardInfo;
-using ::android::hardware::radio::V1_0::CarrierMatchType;
-using ::android::hardware::radio::V1_0::CarrierRestrictions;
-using ::android::hardware::radio::V1_0::CdmaRoamingType;
-using ::android::hardware::radio::V1_0::CdmaBroadcastSmsConfigInfo;
-using ::android::hardware::radio::V1_0::CdmaSubscriptionSource;
-using ::android::hardware::radio::V1_0::CellInfo;
-using ::android::hardware::radio::V1_0::ClipStatus;
-using ::android::hardware::radio::V1_0::DataRegStateResult;
-using ::android::hardware::radio::V1_0::DeviceStateType;
-using ::android::hardware::radio::V1_0::Dial;
-using ::android::hardware::radio::V1_0::GsmBroadcastSmsConfigInfo;
-using ::android::hardware::radio::V1_0::HardwareConfig;
-using ::android::hardware::radio::V1_0::IccIo;
-using ::android::hardware::radio::V1_0::IccIoResult;
-using ::android::hardware::radio::V1_0::IRadio;
-using ::android::hardware::radio::V1_0::IRadioResponse;
-using ::android::hardware::radio::V1_0::IRadioIndication;
-using ::android::hardware::radio::V1_0::RadioConst;
-using ::android::hardware::radio::V1_0::RadioError;
-using ::android::hardware::radio::V1_0::RadioResponseInfo;
-using ::android::hardware::radio::V1_0::LastCallFailCauseInfo;
-using ::android::hardware::radio::V1_0::LceDataInfo;
-using ::android::hardware::radio::V1_0::LceStatusInfo;
-using ::android::hardware::radio::V1_0::NeighboringCell;
-using ::android::hardware::radio::V1_0::NvItem;
-using ::android::hardware::radio::V1_0::NvWriteItem;
-using ::android::hardware::radio::V1_0::OperatorInfo;
-using ::android::hardware::radio::V1_0::PreferredNetworkType;
-using ::android::hardware::radio::V1_0::RadioBandMode;
-using ::android::hardware::radio::V1_0::RadioCapability;
-using ::android::hardware::radio::V1_0::RadioResponseType;
-using ::android::hardware::radio::V1_0::RadioTechnology;
-using ::android::hardware::radio::V1_0::RadioTechnologyFamily;
-using ::android::hardware::radio::V1_0::ResetNvType;
-using ::android::hardware::radio::V1_0::SelectUiccSub;
-using ::android::hardware::radio::V1_0::SendSmsResult;
-using ::android::hardware::radio::V1_0::SetupDataCallResult;
-using ::android::hardware::radio::V1_0::SignalStrength;
-using ::android::hardware::radio::V1_0::SimApdu;
-using ::android::hardware::radio::V1_0::TtyMode;
-using ::android::hardware::radio::V1_0::VoiceRegStateResult;
+using namespace ::android::hardware::radio::V1_0;
 
 using ::android::hardware::hidl_string;
 using ::android::hardware::hidl_vec;
@@ -440,6 +394,123 @@
     Return<void> acknowledgeRequest(int32_t serial);
 };
 
+/* Callback class for radio indication */
+class RadioIndication : public IRadioIndication {
+   protected:
+    RadioHidlTest& parent;
+
+   public:
+    RadioIndication(RadioHidlTest& parent);
+    virtual ~RadioIndication() = default;
+
+    Return<void> radioStateChanged(RadioIndicationType type, RadioState radioState);
+
+    Return<void> callStateChanged(RadioIndicationType type);
+
+    Return<void> networkStateChanged(RadioIndicationType type);
+
+    Return<void> newSms(RadioIndicationType type,
+                        const ::android::hardware::hidl_vec<uint8_t>& pdu);
+
+    Return<void> newSmsStatusReport(RadioIndicationType type,
+                                    const ::android::hardware::hidl_vec<uint8_t>& pdu);
+
+    Return<void> newSmsOnSim(RadioIndicationType type, int32_t recordNumber);
+
+    Return<void> onUssd(RadioIndicationType type, UssdModeType modeType,
+                        const ::android::hardware::hidl_string& msg);
+
+    Return<void> nitzTimeReceived(RadioIndicationType type,
+                                  const ::android::hardware::hidl_string& nitzTime,
+                                  uint64_t receivedTime);
+
+    Return<void> currentSignalStrength(RadioIndicationType type,
+                                       const SignalStrength& signalStrength);
+
+    Return<void> dataCallListChanged(
+        RadioIndicationType type, const ::android::hardware::hidl_vec<SetupDataCallResult>& dcList);
+
+    Return<void> suppSvcNotify(RadioIndicationType type, const SuppSvcNotification& suppSvc);
+
+    Return<void> stkSessionEnd(RadioIndicationType type);
+
+    Return<void> stkProactiveCommand(RadioIndicationType type,
+                                     const ::android::hardware::hidl_string& cmd);
+
+    Return<void> stkEventNotify(RadioIndicationType type,
+                                const ::android::hardware::hidl_string& cmd);
+
+    Return<void> stkCallSetup(RadioIndicationType type, int64_t timeout);
+
+    Return<void> simSmsStorageFull(RadioIndicationType type);
+
+    Return<void> simRefresh(RadioIndicationType type, const SimRefreshResult& refreshResult);
+
+    Return<void> callRing(RadioIndicationType type, bool isGsm, const CdmaSignalInfoRecord& record);
+
+    Return<void> simStatusChanged(RadioIndicationType type);
+
+    Return<void> cdmaNewSms(RadioIndicationType type, const CdmaSmsMessage& msg);
+
+    Return<void> newBroadcastSms(RadioIndicationType type,
+                                 const ::android::hardware::hidl_vec<uint8_t>& data);
+
+    Return<void> cdmaRuimSmsStorageFull(RadioIndicationType type);
+
+    Return<void> restrictedStateChanged(RadioIndicationType type, PhoneRestrictedState state);
+
+    Return<void> enterEmergencyCallbackMode(RadioIndicationType type);
+
+    Return<void> cdmaCallWaiting(RadioIndicationType type,
+                                 const CdmaCallWaiting& callWaitingRecord);
+
+    Return<void> cdmaOtaProvisionStatus(RadioIndicationType type, CdmaOtaProvisionStatus status);
+
+    Return<void> cdmaInfoRec(RadioIndicationType type, const CdmaInformationRecords& records);
+
+    Return<void> indicateRingbackTone(RadioIndicationType type, bool start);
+
+    Return<void> resendIncallMute(RadioIndicationType type);
+
+    Return<void> cdmaSubscriptionSourceChanged(RadioIndicationType type,
+                                               CdmaSubscriptionSource cdmaSource);
+
+    Return<void> cdmaPrlChanged(RadioIndicationType type, int32_t version);
+
+    Return<void> exitEmergencyCallbackMode(RadioIndicationType type);
+
+    Return<void> rilConnected(RadioIndicationType type);
+
+    Return<void> voiceRadioTechChanged(RadioIndicationType type, RadioTechnology rat);
+
+    Return<void> cellInfoList(RadioIndicationType type,
+                              const ::android::hardware::hidl_vec<CellInfo>& records);
+
+    Return<void> imsNetworkStateChanged(RadioIndicationType type);
+
+    Return<void> subscriptionStatusChanged(RadioIndicationType type, bool activate);
+
+    Return<void> srvccStateNotify(RadioIndicationType type, SrvccState state);
+
+    Return<void> hardwareConfigChanged(
+        RadioIndicationType type, const ::android::hardware::hidl_vec<HardwareConfig>& configs);
+
+    Return<void> radioCapabilityIndication(RadioIndicationType type, const RadioCapability& rc);
+
+    Return<void> onSupplementaryServiceIndication(RadioIndicationType type,
+                                                  const StkCcUnsolSsResult& ss);
+
+    Return<void> stkCallControlAlphaNotify(RadioIndicationType type,
+                                           const ::android::hardware::hidl_string& alpha);
+
+    Return<void> lceData(RadioIndicationType type, const LceDataInfo& lce);
+
+    Return<void> pcoData(RadioIndicationType type, const PcoDataInfo& pco);
+
+    Return<void> modemReset(RadioIndicationType type,
+                            const ::android::hardware::hidl_string& reason);
+};
+
 // The main test class for Radio HIDL.
 class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
    protected:
@@ -466,7 +537,7 @@
 
     sp<IRadio> radio;
     sp<RadioResponse> radioRsp;
-    sp<IRadioIndication> radioInd;
+    sp<RadioIndication> radioInd;
 };
 
 // A class for test environment setup
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
index f5be572..1d2f199 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
@@ -57,7 +57,7 @@
                     radioRsp->rspInfo.error == RadioError::NO_NETWORK_FOUND ||
                     radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
                     radioRsp->rspInfo.error == RadioError::DEVICE_IN_USE ||
-                    radioRsp->rspInfo.error == RadioError::MODE_NOT_SUPPORTED ||
+                    radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED ||
                     radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
                     radioRsp->rspInfo.error == RadioError::CANCELLED);
     }
@@ -373,7 +373,7 @@
                     radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
                     radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
                     radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
-                    radioRsp->rspInfo.error == RadioError::MODE_NOT_SUPPORTED);
+                    radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED);
     }
 }
 
@@ -488,6 +488,6 @@
                     radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
                     radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
                     radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
-                    radioRsp->rspInfo.error == RadioError::MODE_NOT_SUPPORTED);
+                    radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED);
     }
 }
\ No newline at end of file
diff --git a/radio/1.0/vts/functional/radio_indication.cpp b/radio/1.0/vts/functional/radio_indication.cpp
new file mode 100644
index 0000000..97b0d26
--- /dev/null
+++ b/radio/1.0/vts/functional/radio_indication.cpp
@@ -0,0 +1,229 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_hidl_hal_utils_v1_0.h>
+
+RadioIndication::RadioIndication(RadioHidlTest& parent) : parent(parent) {}
+
+Return<void> RadioIndication::radioStateChanged(RadioIndicationType /*type*/,
+                                                RadioState /*radioState*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::callStateChanged(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::networkStateChanged(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::newSms(RadioIndicationType /*type*/,
+                                     const ::android::hardware::hidl_vec<uint8_t>& /*pdu*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::newSmsStatusReport(
+    RadioIndicationType /*type*/, const ::android::hardware::hidl_vec<uint8_t>& /*pdu*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::newSmsOnSim(RadioIndicationType /*type*/, int32_t /*recordNumber*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::onUssd(RadioIndicationType /*type*/, UssdModeType /*modeType*/,
+                                     const ::android::hardware::hidl_string& /*msg*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::nitzTimeReceived(RadioIndicationType /*type*/,
+                                               const ::android::hardware::hidl_string& /*nitzTime*/,
+                                               uint64_t /*receivedTime*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::currentSignalStrength(RadioIndicationType /*type*/,
+                                                    const SignalStrength& /*signalStrength*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::dataCallListChanged(
+    RadioIndicationType /*type*/,
+    const ::android::hardware::hidl_vec<SetupDataCallResult>& /*dcList*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::suppSvcNotify(RadioIndicationType /*type*/,
+                                            const SuppSvcNotification& /*suppSvc*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::stkSessionEnd(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::stkProactiveCommand(RadioIndicationType /*type*/,
+                                                  const ::android::hardware::hidl_string& /*cmd*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::stkEventNotify(RadioIndicationType /*type*/,
+                                             const ::android::hardware::hidl_string& /*cmd*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::stkCallSetup(RadioIndicationType /*type*/, int64_t /*timeout*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::simSmsStorageFull(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::simRefresh(RadioIndicationType /*type*/,
+                                         const SimRefreshResult& /*refreshResult*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::callRing(RadioIndicationType /*type*/, bool /*isGsm*/,
+                                       const CdmaSignalInfoRecord& /*record*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::simStatusChanged(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::cdmaNewSms(RadioIndicationType /*type*/,
+                                         const CdmaSmsMessage& /*msg*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::newBroadcastSms(
+    RadioIndicationType /*type*/, const ::android::hardware::hidl_vec<uint8_t>& /*data*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::cdmaRuimSmsStorageFull(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::restrictedStateChanged(RadioIndicationType /*type*/,
+                                                     PhoneRestrictedState /*state*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::enterEmergencyCallbackMode(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::cdmaCallWaiting(RadioIndicationType /*type*/,
+                                              const CdmaCallWaiting& /*callWaitingRecord*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::cdmaOtaProvisionStatus(RadioIndicationType /*type*/,
+                                                     CdmaOtaProvisionStatus /*status*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::cdmaInfoRec(RadioIndicationType /*type*/,
+                                          const CdmaInformationRecords& /*records*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::indicateRingbackTone(RadioIndicationType /*type*/, bool /*start*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::resendIncallMute(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::cdmaSubscriptionSourceChanged(RadioIndicationType /*type*/,
+                                                            CdmaSubscriptionSource /*cdmaSource*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::cdmaPrlChanged(RadioIndicationType /*type*/, int32_t /*version*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::exitEmergencyCallbackMode(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::rilConnected(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::voiceRadioTechChanged(RadioIndicationType /*type*/,
+                                                    RadioTechnology /*rat*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::cellInfoList(
+    RadioIndicationType /*type*/, const ::android::hardware::hidl_vec<CellInfo>& /*records*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::imsNetworkStateChanged(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::subscriptionStatusChanged(RadioIndicationType /*type*/,
+                                                        bool /*activate*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::srvccStateNotify(RadioIndicationType /*type*/, SrvccState /*state*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::hardwareConfigChanged(
+    RadioIndicationType /*type*/,
+    const ::android::hardware::hidl_vec<HardwareConfig>& /*configs*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::radioCapabilityIndication(RadioIndicationType /*type*/,
+                                                        const RadioCapability& /*rc*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::onSupplementaryServiceIndication(RadioIndicationType /*type*/,
+                                                               const StkCcUnsolSsResult& /*ss*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::stkCallControlAlphaNotify(
+    RadioIndicationType /*type*/, const ::android::hardware::hidl_string& /*alpha*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::lceData(RadioIndicationType /*type*/, const LceDataInfo& /*lce*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::pcoData(RadioIndicationType /*type*/, const PcoDataInfo& /*pco*/) {
+    return Void();
+}
+
+Return<void> RadioIndication::modemReset(RadioIndicationType /*type*/,
+                                         const ::android::hardware::hidl_string& /*reason*/) {
+    return Void();
+}
\ No newline at end of file
diff --git a/radio/1.1/Android.bp b/radio/1.1/Android.bp
index 3583159..3a3f639 100644
--- a/radio/1.1/Android.bp
+++ b/radio/1.1/Android.bp
@@ -7,6 +7,7 @@
         "IRadio.hal",
         "IRadioIndication.hal",
         "IRadioResponse.hal",
+        "ISap.hal",
     ],
 }
 
@@ -22,6 +23,7 @@
         "android/hardware/radio/1.1/RadioAll.cpp",
         "android/hardware/radio/1.1/RadioIndicationAll.cpp",
         "android/hardware/radio/1.1/RadioResponseAll.cpp",
+        "android/hardware/radio/1.1/SapAll.cpp",
     ],
 }
 
@@ -50,6 +52,11 @@
         "android/hardware/radio/1.1/BnHwRadioResponse.h",
         "android/hardware/radio/1.1/BpHwRadioResponse.h",
         "android/hardware/radio/1.1/BsRadioResponse.h",
+        "android/hardware/radio/1.1/ISap.h",
+        "android/hardware/radio/1.1/IHwSap.h",
+        "android/hardware/radio/1.1/BnHwSap.h",
+        "android/hardware/radio/1.1/BpHwSap.h",
+        "android/hardware/radio/1.1/BsSap.h",
     ],
 }
 
diff --git a/radio/1.1/Android.mk b/radio/1.1/Android.mk
index b83ac80..b8aeb4f 100644
--- a/radio/1.1/Android.mk
+++ b/radio/1.1/Android.mk
@@ -364,6 +364,25 @@
 $(GEN): $(LOCAL_PATH)/IRadioResponse.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build ISap.hal
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/ISap.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/ISap.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio@1.1::ISap
+
+$(GEN): $(LOCAL_PATH)/ISap.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
 include $(BUILD_JAVA_LIBRARY)
 
 
@@ -729,6 +748,25 @@
 $(GEN): $(LOCAL_PATH)/IRadioResponse.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build ISap.hal
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/ISap.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/ISap.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio@1.1::ISap
+
+$(GEN): $(LOCAL_PATH)/ISap.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
 include $(BUILD_STATIC_JAVA_LIBRARY)
 
 
diff --git a/radio/1.1/ISap.hal b/radio/1.1/ISap.hal
new file mode 100644
index 0000000..edcf176
--- /dev/null
+++ b/radio/1.1/ISap.hal
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio@1.1;
+
+import @1.0::ISap;
+
+interface ISap extends @1.0::ISap {
+    /**
+     * Empty top level interface.
+     */
+};
diff --git a/radio/1.1/vts/functional/Android.bp b/radio/1.1/vts/functional/Android.bp
index 14a2544..9000eb2 100644
--- a/radio/1.1/vts/functional/Android.bp
+++ b/radio/1.1/vts/functional/Android.bp
@@ -19,6 +19,7 @@
     defaults: ["hidl_defaults"],
     srcs: ["radio_hidl_hal_api.cpp",
            "radio_hidl_hal_test.cpp",
+           "radio_indication.cpp",
            "radio_response.cpp",
            "VtsHalRadioV1_1TargetTest.cpp"],
     shared_libs: [
@@ -33,7 +34,6 @@
         "android.hardware.radio@1.0",
     ],
     static_libs: ["VtsHalHidlTargetTestBase",
-                  "RadioHidlHalUtilsBase",
                   "RadioVtsTestUtilBase"],
     header_libs: [
         "radio.util.header@1.0",
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
index 164128b..770b599 100644
--- a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
@@ -20,14 +20,16 @@
     radio_v1_1 =
         ::testing::VtsHalHidlTargetTestBase::getService<::android::hardware::radio::V1_1::IRadio>(
             hidl_string(RADIO_SERVICE_NAME));
-    ASSERT_NE(radio_v1_1, nullptr);
+    ASSERT_NE(nullptr, radio_v1_1.get());
 
-    radioRsp_v1_1 = new RadioResponse_v1_1(*this);
-    ASSERT_NE(radioRsp_v1_1, nullptr);
+    radioRsp_v1_1 = new (std::nothrow) RadioResponse_v1_1(*this);
+    ASSERT_NE(nullptr, radioRsp_v1_1.get());
 
     count = 0;
 
-    radioInd_v1_1 = NULL;
+    radioInd_v1_1 = new (std::nothrow) RadioIndication_v1_1(*this);
+    ASSERT_NE(nullptr, radioInd_v1_1.get());
+
     radio_v1_1->setResponseFunctions(radioRsp_v1_1, radioInd_v1_1);
 
     int serial = GetRandomSerialNumber();
@@ -36,4 +38,41 @@
     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
     EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
     EXPECT_EQ(RadioError::NONE, radioRsp_v1_1->rspInfo.error);
-}
\ No newline at end of file
+}
+
+void RadioHidlTest_v1_1::TearDown() {}
+
+void RadioHidlTest_v1_1::notify() {
+    std::unique_lock<std::mutex> lock(mtx);
+    count++;
+    cv.notify_one();
+}
+
+std::cv_status RadioHidlTest_v1_1::wait() {
+    std::unique_lock<std::mutex> lock(mtx);
+
+    std::cv_status status = std::cv_status::no_timeout;
+    auto now = std::chrono::system_clock::now();
+    while (count == 0) {
+        status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
+        if (status == std::cv_status::timeout) {
+            return status;
+        }
+    }
+    count--;
+    return status;
+}
+
+bool RadioHidlTest_v1_1::CheckGeneralError() {
+    return (radioRsp_v1_1->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
+            radioRsp_v1_1->rspInfo.error == RadioError::NO_MEMORY ||
+            radioRsp_v1_1->rspInfo.error == RadioError::INTERNAL_ERR ||
+            radioRsp_v1_1->rspInfo.error == RadioError::SYSTEM_ERR ||
+            radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED ||
+            radioRsp_v1_1->rspInfo.error == RadioError::CANCELLED);
+}
+
+bool RadioHidlTest_v1_1::CheckOEMError() {
+    return (radioRsp_v1_1->rspInfo.error >= RadioError::OEM_ERROR_1 &&
+            radioRsp_v1_1->rspInfo.error <= RadioError::OEM_ERROR_25);
+}
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
index ae72d8f..dd4f1ef 100644
--- a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
+++ b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
@@ -14,26 +14,385 @@
  * limitations under the License.
  */
 
+#include <android-base/logging.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
 #include <android/hardware/radio/1.1/IRadio.h>
 #include <android/hardware/radio/1.1/IRadioIndication.h>
 #include <android/hardware/radio/1.1/IRadioResponse.h>
 #include <android/hardware/radio/1.1/types.h>
 
-#include "radio_hidl_hal_utils_v1_0.h"
+#include "vts_test_util.h"
 
+using namespace ::android::hardware::radio::V1_0;
 using namespace ::android::hardware::radio::V1_1;
 
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+#define TIMEOUT_PERIOD 75
+#define RADIO_SERVICE_NAME "slot1"
+
 class RadioHidlTest_v1_1;
+extern CardStatus cardStatus;
 
 /* Callback class for radio response v1_1*/
-class RadioResponse_v1_1 : public RadioResponse {
+class RadioResponse_v1_1 : public ::android::hardware::radio::V1_1::IRadioResponse {
    protected:
     RadioHidlTest_v1_1& parent_v1_1;
 
    public:
+    RadioResponseInfo rspInfo;
+    hidl_string imsi;
+    IccIoResult iccIoResult;
+    int channelId;
+
+    // Sms
+    SendSmsResult sendSmsResult;
+    hidl_string smscAddress;
+    uint32_t writeSmsToSimIndex;
+    uint32_t writeSmsToRuimIndex;
+
     RadioResponse_v1_1(RadioHidlTest_v1_1& parent_v1_1);
     virtual ~RadioResponse_v1_1() = default;
 
+    Return<void> getIccCardStatusResponse(const RadioResponseInfo& info,
+                                          const CardStatus& cardStatus);
+
+    Return<void> supplyIccPinForAppResponse(const RadioResponseInfo& info,
+                                            int32_t remainingRetries);
+
+    Return<void> supplyIccPukForAppResponse(const RadioResponseInfo& info,
+                                            int32_t remainingRetries);
+
+    Return<void> supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
+                                             int32_t remainingRetries);
+
+    Return<void> supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
+                                             int32_t remainingRetries);
+
+    Return<void> changeIccPinForAppResponse(const RadioResponseInfo& info,
+                                            int32_t remainingRetries);
+
+    Return<void> changeIccPin2ForAppResponse(const RadioResponseInfo& info,
+                                             int32_t remainingRetries);
+
+    Return<void> supplyNetworkDepersonalizationResponse(const RadioResponseInfo& info,
+                                                        int32_t remainingRetries);
+
+    Return<void> getCurrentCallsResponse(const RadioResponseInfo& info,
+                                         const ::android::hardware::hidl_vec<Call>& calls);
+
+    Return<void> dialResponse(const RadioResponseInfo& info);
+
+    Return<void> getIMSIForAppResponse(const RadioResponseInfo& info,
+                                       const ::android::hardware::hidl_string& imsi);
+
+    Return<void> hangupConnectionResponse(const RadioResponseInfo& info);
+
+    Return<void> hangupWaitingOrBackgroundResponse(const RadioResponseInfo& info);
+
+    Return<void> hangupForegroundResumeBackgroundResponse(const RadioResponseInfo& info);
+
+    Return<void> switchWaitingOrHoldingAndActiveResponse(const RadioResponseInfo& info);
+
+    Return<void> conferenceResponse(const RadioResponseInfo& info);
+
+    Return<void> rejectCallResponse(const RadioResponseInfo& info);
+
+    Return<void> getLastCallFailCauseResponse(const RadioResponseInfo& info,
+                                              const LastCallFailCauseInfo& failCauseInfo);
+
+    Return<void> getSignalStrengthResponse(const RadioResponseInfo& info,
+                                           const SignalStrength& sigStrength);
+
+    Return<void> getVoiceRegistrationStateResponse(const RadioResponseInfo& info,
+                                                   const VoiceRegStateResult& voiceRegResponse);
+
+    Return<void> getDataRegistrationStateResponse(const RadioResponseInfo& info,
+                                                  const DataRegStateResult& dataRegResponse);
+
+    Return<void> getOperatorResponse(const RadioResponseInfo& info,
+                                     const ::android::hardware::hidl_string& longName,
+                                     const ::android::hardware::hidl_string& shortName,
+                                     const ::android::hardware::hidl_string& numeric);
+
+    Return<void> setRadioPowerResponse(const RadioResponseInfo& info);
+
+    Return<void> sendDtmfResponse(const RadioResponseInfo& info);
+
+    Return<void> sendSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+
+    Return<void> sendSMSExpectMoreResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+
+    Return<void> setupDataCallResponse(const RadioResponseInfo& info,
+                                       const SetupDataCallResult& dcResponse);
+
+    Return<void> iccIOForAppResponse(const RadioResponseInfo& info, const IccIoResult& iccIo);
+
+    Return<void> sendUssdResponse(const RadioResponseInfo& info);
+
+    Return<void> cancelPendingUssdResponse(const RadioResponseInfo& info);
+
+    Return<void> getClirResponse(const RadioResponseInfo& info, int32_t n, int32_t m);
+
+    Return<void> setClirResponse(const RadioResponseInfo& info);
+
+    Return<void> getCallForwardStatusResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<CallForwardInfo>& call_forwardInfos);
+
+    Return<void> setCallForwardResponse(const RadioResponseInfo& info);
+
+    Return<void> getCallWaitingResponse(const RadioResponseInfo& info, bool enable,
+                                        int32_t serviceClass);
+
+    Return<void> setCallWaitingResponse(const RadioResponseInfo& info);
+
+    Return<void> acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info);
+
+    Return<void> acceptCallResponse(const RadioResponseInfo& info);
+
+    Return<void> deactivateDataCallResponse(const RadioResponseInfo& info);
+
+    Return<void> getFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t response);
+
+    Return<void> setFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t retry);
+
+    Return<void> setBarringPasswordResponse(const RadioResponseInfo& info);
+
+    Return<void> getNetworkSelectionModeResponse(const RadioResponseInfo& info, bool manual);
+
+    Return<void> setNetworkSelectionModeAutomaticResponse(const RadioResponseInfo& info);
+
+    Return<void> setNetworkSelectionModeManualResponse(const RadioResponseInfo& info);
+
+    Return<void> getAvailableNetworksResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos);
+
+    Return<void> startDtmfResponse(const RadioResponseInfo& info);
+
+    Return<void> stopDtmfResponse(const RadioResponseInfo& info);
+
+    Return<void> getBasebandVersionResponse(const RadioResponseInfo& info,
+                                            const ::android::hardware::hidl_string& version);
+
+    Return<void> separateConnectionResponse(const RadioResponseInfo& info);
+
+    Return<void> setMuteResponse(const RadioResponseInfo& info);
+
+    Return<void> getMuteResponse(const RadioResponseInfo& info, bool enable);
+
+    Return<void> getClipResponse(const RadioResponseInfo& info, ClipStatus status);
+
+    Return<void> getDataCallListResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<SetupDataCallResult>& dcResponse);
+
+    Return<void> sendOemRilRequestRawResponse(const RadioResponseInfo& info,
+                                              const ::android::hardware::hidl_vec<uint8_t>& data);
+
+    Return<void> sendOemRilRequestStringsResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data);
+
+    Return<void> setSuppServiceNotificationsResponse(const RadioResponseInfo& info);
+
+    Return<void> writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index);
+
+    Return<void> deleteSmsOnSimResponse(const RadioResponseInfo& info);
+
+    Return<void> setBandModeResponse(const RadioResponseInfo& info);
+
+    Return<void> getAvailableBandModesResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<RadioBandMode>& bandModes);
+
+    Return<void> sendEnvelopeResponse(const RadioResponseInfo& info,
+                                      const ::android::hardware::hidl_string& commandResponse);
+
+    Return<void> sendTerminalResponseToSimResponse(const RadioResponseInfo& info);
+
+    Return<void> handleStkCallSetupRequestFromSimResponse(const RadioResponseInfo& info);
+
+    Return<void> explicitCallTransferResponse(const RadioResponseInfo& info);
+
+    Return<void> setPreferredNetworkTypeResponse(const RadioResponseInfo& info);
+
+    Return<void> getPreferredNetworkTypeResponse(const RadioResponseInfo& info,
+                                                 PreferredNetworkType nwType);
+
+    Return<void> getNeighboringCidsResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_vec<NeighboringCell>& cells);
+
+    Return<void> setLocationUpdatesResponse(const RadioResponseInfo& info);
+
+    Return<void> setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info);
+
+    Return<void> setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info);
+
+    Return<void> getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
+                                                  CdmaRoamingType type);
+
+    Return<void> setTTYModeResponse(const RadioResponseInfo& info);
+
+    Return<void> getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode);
+
+    Return<void> setPreferredVoicePrivacyResponse(const RadioResponseInfo& info);
+
+    Return<void> getPreferredVoicePrivacyResponse(const RadioResponseInfo& info, bool enable);
+
+    Return<void> sendCDMAFeatureCodeResponse(const RadioResponseInfo& info);
+
+    Return<void> sendBurstDtmfResponse(const RadioResponseInfo& info);
+
+    Return<void> sendCdmaSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+
+    Return<void> acknowledgeLastIncomingCdmaSmsResponse(const RadioResponseInfo& info);
+
+    Return<void> getGsmBroadcastConfigResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs);
+
+    Return<void> setGsmBroadcastConfigResponse(const RadioResponseInfo& info);
+
+    Return<void> setGsmBroadcastActivationResponse(const RadioResponseInfo& info);
+
+    Return<void> getCdmaBroadcastConfigResponse(
+        const RadioResponseInfo& info,
+        const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs);
+
+    Return<void> setCdmaBroadcastConfigResponse(const RadioResponseInfo& info);
+
+    Return<void> setCdmaBroadcastActivationResponse(const RadioResponseInfo& info);
+
+    Return<void> getCDMASubscriptionResponse(const RadioResponseInfo& info,
+                                             const ::android::hardware::hidl_string& mdn,
+                                             const ::android::hardware::hidl_string& hSid,
+                                             const ::android::hardware::hidl_string& hNid,
+                                             const ::android::hardware::hidl_string& min,
+                                             const ::android::hardware::hidl_string& prl);
+
+    Return<void> writeSmsToRuimResponse(const RadioResponseInfo& info, uint32_t index);
+
+    Return<void> deleteSmsOnRuimResponse(const RadioResponseInfo& info);
+
+    Return<void> getDeviceIdentityResponse(const RadioResponseInfo& info,
+                                           const ::android::hardware::hidl_string& imei,
+                                           const ::android::hardware::hidl_string& imeisv,
+                                           const ::android::hardware::hidl_string& esn,
+                                           const ::android::hardware::hidl_string& meid);
+
+    Return<void> exitEmergencyCallbackModeResponse(const RadioResponseInfo& info);
+
+    Return<void> getSmscAddressResponse(const RadioResponseInfo& info,
+                                        const ::android::hardware::hidl_string& smsc);
+
+    Return<void> setSmscAddressResponse(const RadioResponseInfo& info);
+
+    Return<void> reportSmsMemoryStatusResponse(const RadioResponseInfo& info);
+
+    Return<void> reportStkServiceIsRunningResponse(const RadioResponseInfo& info);
+
+    Return<void> getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info,
+                                                   CdmaSubscriptionSource source);
+
+    Return<void> requestIsimAuthenticationResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_string& response);
+
+    Return<void> acknowledgeIncomingGsmSmsWithPduResponse(const RadioResponseInfo& info);
+
+    Return<void> sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
+                                                const IccIoResult& iccIo);
+
+    Return<void> getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
+                                                 RadioTechnology rat);
+
+    Return<void> getCellInfoListResponse(const RadioResponseInfo& info,
+                                         const ::android::hardware::hidl_vec<CellInfo>& cellInfo);
+
+    Return<void> setCellInfoListRateResponse(const RadioResponseInfo& info);
+
+    Return<void> setInitialAttachApnResponse(const RadioResponseInfo& info);
+
+    Return<void> getImsRegistrationStateResponse(const RadioResponseInfo& info, bool isRegistered,
+                                                 RadioTechnologyFamily ratFamily);
+
+    Return<void> sendImsSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+
+    Return<void> iccTransmitApduBasicChannelResponse(const RadioResponseInfo& info,
+                                                     const IccIoResult& result);
+
+    Return<void> iccOpenLogicalChannelResponse(
+        const RadioResponseInfo& info, int32_t channelId,
+        const ::android::hardware::hidl_vec<int8_t>& selectResponse);
+
+    Return<void> iccCloseLogicalChannelResponse(const RadioResponseInfo& info);
+
+    Return<void> iccTransmitApduLogicalChannelResponse(const RadioResponseInfo& info,
+                                                       const IccIoResult& result);
+
+    Return<void> nvReadItemResponse(const RadioResponseInfo& info,
+                                    const ::android::hardware::hidl_string& result);
+
+    Return<void> nvWriteItemResponse(const RadioResponseInfo& info);
+
+    Return<void> nvWriteCdmaPrlResponse(const RadioResponseInfo& info);
+
+    Return<void> nvResetConfigResponse(const RadioResponseInfo& info);
+
+    Return<void> setUiccSubscriptionResponse(const RadioResponseInfo& info);
+
+    Return<void> setDataAllowedResponse(const RadioResponseInfo& info);
+
+    Return<void> getHardwareConfigResponse(
+        const RadioResponseInfo& info, const ::android::hardware::hidl_vec<HardwareConfig>& config);
+
+    Return<void> requestIccSimAuthenticationResponse(const RadioResponseInfo& info,
+                                                     const IccIoResult& result);
+
+    Return<void> setDataProfileResponse(const RadioResponseInfo& info);
+
+    Return<void> requestShutdownResponse(const RadioResponseInfo& info);
+
+    Return<void> getRadioCapabilityResponse(const RadioResponseInfo& info,
+                                            const RadioCapability& rc);
+
+    Return<void> setRadioCapabilityResponse(const RadioResponseInfo& info,
+                                            const RadioCapability& rc);
+
+    Return<void> startLceServiceResponse(const RadioResponseInfo& info,
+                                         const LceStatusInfo& statusInfo);
+
+    Return<void> stopLceServiceResponse(const RadioResponseInfo& info,
+                                        const LceStatusInfo& statusInfo);
+
+    Return<void> pullLceDataResponse(const RadioResponseInfo& info, const LceDataInfo& lceInfo);
+
+    Return<void> getModemActivityInfoResponse(const RadioResponseInfo& info,
+                                              const ActivityStatsInfo& activityInfo);
+
+    Return<void> setAllowedCarriersResponse(const RadioResponseInfo& info, int32_t numAllowed);
+
+    Return<void> getAllowedCarriersResponse(const RadioResponseInfo& info, bool allAllowed,
+                                            const CarrierRestrictions& carriers);
+
+    Return<void> sendDeviceStateResponse(const RadioResponseInfo& info);
+
+    Return<void> setIndicationFilterResponse(const RadioResponseInfo& info);
+
+    Return<void> setSimCardPowerResponse(const RadioResponseInfo& info);
+
+    Return<void> acknowledgeRequest(int32_t serial);
+
     /* 1.1 Api */
     Return<void> setCarrierInfoForImsiEncryptionResponse(const RadioResponseInfo& info);
 
@@ -42,13 +401,170 @@
     Return<void> startNetworkScanResponse(const RadioResponseInfo& info);
 
     Return<void> stopNetworkScanResponse(const RadioResponseInfo& info);
+
+    Return<void> startKeepaliveResponse(const RadioResponseInfo& info,
+                                        const KeepaliveStatus& status);
+
+    Return<void> stopKeepaliveResponse(const RadioResponseInfo& info);
+};
+
+/* Callback class for radio indication */
+class RadioIndication_v1_1 : public ::android::hardware::radio::V1_1::IRadioIndication {
+   protected:
+    RadioHidlTest_v1_1& parent_v1_1;
+
+   public:
+    RadioIndication_v1_1(RadioHidlTest_v1_1& parent_v1_1);
+    virtual ~RadioIndication_v1_1() = default;
+
+    /* 1.1 Api */
+    Return<void> carrierInfoForImsiEncryption(RadioIndicationType info);
+
+    Return<void> networkScanResult(RadioIndicationType type, const NetworkScanResult& result);
+
+    Return<void> keepaliveStatus(RadioIndicationType type, const KeepaliveStatus& status);
+
+    /* 1.0 Api */
+    Return<void> radioStateChanged(RadioIndicationType type, RadioState radioState);
+
+    Return<void> callStateChanged(RadioIndicationType type);
+
+    Return<void> networkStateChanged(RadioIndicationType type);
+
+    Return<void> newSms(RadioIndicationType type,
+                        const ::android::hardware::hidl_vec<uint8_t>& pdu);
+
+    Return<void> newSmsStatusReport(RadioIndicationType type,
+                                    const ::android::hardware::hidl_vec<uint8_t>& pdu);
+
+    Return<void> newSmsOnSim(RadioIndicationType type, int32_t recordNumber);
+
+    Return<void> onUssd(RadioIndicationType type, UssdModeType modeType,
+                        const ::android::hardware::hidl_string& msg);
+
+    Return<void> nitzTimeReceived(RadioIndicationType type,
+                                  const ::android::hardware::hidl_string& nitzTime,
+                                  uint64_t receivedTime);
+
+    Return<void> currentSignalStrength(RadioIndicationType type,
+                                       const SignalStrength& signalStrength);
+
+    Return<void> dataCallListChanged(
+        RadioIndicationType type, const ::android::hardware::hidl_vec<SetupDataCallResult>& dcList);
+
+    Return<void> suppSvcNotify(RadioIndicationType type, const SuppSvcNotification& suppSvc);
+
+    Return<void> stkSessionEnd(RadioIndicationType type);
+
+    Return<void> stkProactiveCommand(RadioIndicationType type,
+                                     const ::android::hardware::hidl_string& cmd);
+
+    Return<void> stkEventNotify(RadioIndicationType type,
+                                const ::android::hardware::hidl_string& cmd);
+
+    Return<void> stkCallSetup(RadioIndicationType type, int64_t timeout);
+
+    Return<void> simSmsStorageFull(RadioIndicationType type);
+
+    Return<void> simRefresh(RadioIndicationType type, const SimRefreshResult& refreshResult);
+
+    Return<void> callRing(RadioIndicationType type, bool isGsm, const CdmaSignalInfoRecord& record);
+
+    Return<void> simStatusChanged(RadioIndicationType type);
+
+    Return<void> cdmaNewSms(RadioIndicationType type, const CdmaSmsMessage& msg);
+
+    Return<void> newBroadcastSms(RadioIndicationType type,
+                                 const ::android::hardware::hidl_vec<uint8_t>& data);
+
+    Return<void> cdmaRuimSmsStorageFull(RadioIndicationType type);
+
+    Return<void> restrictedStateChanged(RadioIndicationType type, PhoneRestrictedState state);
+
+    Return<void> enterEmergencyCallbackMode(RadioIndicationType type);
+
+    Return<void> cdmaCallWaiting(RadioIndicationType type,
+                                 const CdmaCallWaiting& callWaitingRecord);
+
+    Return<void> cdmaOtaProvisionStatus(RadioIndicationType type, CdmaOtaProvisionStatus status);
+
+    Return<void> cdmaInfoRec(RadioIndicationType type, const CdmaInformationRecords& records);
+
+    Return<void> indicateRingbackTone(RadioIndicationType type, bool start);
+
+    Return<void> resendIncallMute(RadioIndicationType type);
+
+    Return<void> cdmaSubscriptionSourceChanged(RadioIndicationType type,
+                                               CdmaSubscriptionSource cdmaSource);
+
+    Return<void> cdmaPrlChanged(RadioIndicationType type, int32_t version);
+
+    Return<void> exitEmergencyCallbackMode(RadioIndicationType type);
+
+    Return<void> rilConnected(RadioIndicationType type);
+
+    Return<void> voiceRadioTechChanged(RadioIndicationType type, RadioTechnology rat);
+
+    Return<void> cellInfoList(RadioIndicationType type,
+                              const ::android::hardware::hidl_vec<CellInfo>& records);
+
+    Return<void> imsNetworkStateChanged(RadioIndicationType type);
+
+    Return<void> subscriptionStatusChanged(RadioIndicationType type, bool activate);
+
+    Return<void> srvccStateNotify(RadioIndicationType type, SrvccState state);
+
+    Return<void> hardwareConfigChanged(
+        RadioIndicationType type, const ::android::hardware::hidl_vec<HardwareConfig>& configs);
+
+    Return<void> radioCapabilityIndication(RadioIndicationType type, const RadioCapability& rc);
+
+    Return<void> onSupplementaryServiceIndication(RadioIndicationType type,
+                                                  const StkCcUnsolSsResult& ss);
+
+    Return<void> stkCallControlAlphaNotify(RadioIndicationType type,
+                                           const ::android::hardware::hidl_string& alpha);
+
+    Return<void> lceData(RadioIndicationType type, const LceDataInfo& lce);
+
+    Return<void> pcoData(RadioIndicationType type, const PcoDataInfo& pco);
+
+    Return<void> modemReset(RadioIndicationType type,
+                            const ::android::hardware::hidl_string& reason);
 };
 
 // The main test class for Radio HIDL.
-class RadioHidlTest_v1_1 : public RadioHidlTest {
+class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase {
+   protected:
+    std::mutex mtx;
+    std::condition_variable cv;
+    int count;
+
    public:
     virtual void SetUp() override;
+
+    virtual void TearDown() override;
+
+    /* Used as a mechanism to inform the test about data/event callback */
+    void notify();
+
+    /* Test code calls this function to wait for response */
+    std::cv_status wait();
+
+    /* Used for checking General Errors */
+    bool CheckGeneralError();
+
+    /* Used for checking OEM Errors */
+    bool CheckOEMError();
+
     sp<::android::hardware::radio::V1_1::IRadio> radio_v1_1;
     sp<RadioResponse_v1_1> radioRsp_v1_1;
-    sp<::android::hardware::radio::V1_1::IRadioIndication> radioInd_v1_1;
+    sp<RadioIndication_v1_1> radioInd_v1_1;
+};
+
+// A class for test environment setup
+class RadioHidlEnvironment : public ::testing::Environment {
+   public:
+    virtual void SetUp() {}
+    virtual void TearDown() {}
 };
\ No newline at end of file
diff --git a/radio/1.1/vts/functional/radio_indication.cpp b/radio/1.1/vts/functional/radio_indication.cpp
new file mode 100644
index 0000000..652e555
--- /dev/null
+++ b/radio/1.1/vts/functional/radio_indication.cpp
@@ -0,0 +1,251 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <radio_hidl_hal_utils_v1_1.h>
+
+RadioIndication_v1_1::RadioIndication_v1_1(RadioHidlTest_v1_1& parent) : parent_v1_1(parent) {}
+
+/* 1.1 Apis */
+Return<void> RadioIndication_v1_1::carrierInfoForImsiEncryption(RadioIndicationType /*info*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::networkScanResult(RadioIndicationType /*type*/,
+                                                     const NetworkScanResult& /*result*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::keepaliveStatus(RadioIndicationType /*type*/,
+                                                   const KeepaliveStatus& /*status*/) {
+    return Void();
+}
+
+/* 1.0 Apis */
+Return<void> RadioIndication_v1_1::radioStateChanged(RadioIndicationType /*type*/,
+                                                     RadioState /*radioState*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::callStateChanged(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::networkStateChanged(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::newSms(RadioIndicationType /*type*/,
+                                          const ::android::hardware::hidl_vec<uint8_t>& /*pdu*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::newSmsStatusReport(
+    RadioIndicationType /*type*/, const ::android::hardware::hidl_vec<uint8_t>& /*pdu*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::newSmsOnSim(RadioIndicationType /*type*/,
+                                               int32_t /*recordNumber*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::onUssd(RadioIndicationType /*type*/, UssdModeType /*modeType*/,
+                                          const ::android::hardware::hidl_string& /*msg*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::nitzTimeReceived(
+    RadioIndicationType /*type*/, const ::android::hardware::hidl_string& /*nitzTime*/,
+    uint64_t /*receivedTime*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::currentSignalStrength(RadioIndicationType /*type*/,
+                                                         const SignalStrength& /*signalStrength*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::dataCallListChanged(
+    RadioIndicationType /*type*/,
+    const ::android::hardware::hidl_vec<SetupDataCallResult>& /*dcList*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::suppSvcNotify(RadioIndicationType /*type*/,
+                                                 const SuppSvcNotification& /*suppSvc*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::stkSessionEnd(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::stkProactiveCommand(
+    RadioIndicationType /*type*/, const ::android::hardware::hidl_string& /*cmd*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::stkEventNotify(RadioIndicationType /*type*/,
+                                                  const ::android::hardware::hidl_string& /*cmd*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::stkCallSetup(RadioIndicationType /*type*/, int64_t /*timeout*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::simSmsStorageFull(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::simRefresh(RadioIndicationType /*type*/,
+                                              const SimRefreshResult& /*refreshResult*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::callRing(RadioIndicationType /*type*/, bool /*isGsm*/,
+                                            const CdmaSignalInfoRecord& /*record*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::simStatusChanged(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::cdmaNewSms(RadioIndicationType /*type*/,
+                                              const CdmaSmsMessage& /*msg*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::newBroadcastSms(
+    RadioIndicationType /*type*/, const ::android::hardware::hidl_vec<uint8_t>& /*data*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::cdmaRuimSmsStorageFull(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::restrictedStateChanged(RadioIndicationType /*type*/,
+                                                          PhoneRestrictedState /*state*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::enterEmergencyCallbackMode(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::cdmaCallWaiting(RadioIndicationType /*type*/,
+                                                   const CdmaCallWaiting& /*callWaitingRecord*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::cdmaOtaProvisionStatus(RadioIndicationType /*type*/,
+                                                          CdmaOtaProvisionStatus /*status*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::cdmaInfoRec(RadioIndicationType /*type*/,
+                                               const CdmaInformationRecords& /*records*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::indicateRingbackTone(RadioIndicationType /*type*/,
+                                                        bool /*start*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::resendIncallMute(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::cdmaSubscriptionSourceChanged(
+    RadioIndicationType /*type*/, CdmaSubscriptionSource /*cdmaSource*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::cdmaPrlChanged(RadioIndicationType /*type*/,
+                                                  int32_t /*version*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::exitEmergencyCallbackMode(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::rilConnected(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::voiceRadioTechChanged(RadioIndicationType /*type*/,
+                                                         RadioTechnology /*rat*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::cellInfoList(
+    RadioIndicationType /*type*/, const ::android::hardware::hidl_vec<CellInfo>& /*records*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::imsNetworkStateChanged(RadioIndicationType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::subscriptionStatusChanged(RadioIndicationType /*type*/,
+                                                             bool /*activate*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::srvccStateNotify(RadioIndicationType /*type*/,
+                                                    SrvccState /*state*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::hardwareConfigChanged(
+    RadioIndicationType /*type*/,
+    const ::android::hardware::hidl_vec<HardwareConfig>& /*configs*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::radioCapabilityIndication(RadioIndicationType /*type*/,
+                                                             const RadioCapability& /*rc*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::onSupplementaryServiceIndication(
+    RadioIndicationType /*type*/, const StkCcUnsolSsResult& /*ss*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::stkCallControlAlphaNotify(
+    RadioIndicationType /*type*/, const ::android::hardware::hidl_string& /*alpha*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::lceData(RadioIndicationType /*type*/,
+                                           const LceDataInfo& /*lce*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::pcoData(RadioIndicationType /*type*/,
+                                           const PcoDataInfo& /*pco*/) {
+    return Void();
+}
+
+Return<void> RadioIndication_v1_1::modemReset(RadioIndicationType /*type*/,
+                                              const ::android::hardware::hidl_string& /*reason*/) {
+    return Void();
+}
\ No newline at end of file
diff --git a/radio/1.1/vts/functional/radio_response.cpp b/radio/1.1/vts/functional/radio_response.cpp
index c5c8fd7..98cab98 100644
--- a/radio/1.1/vts/functional/radio_response.cpp
+++ b/radio/1.1/vts/functional/radio_response.cpp
@@ -16,8 +16,646 @@
 
 #include <radio_hidl_hal_utils_v1_1.h>
 
-RadioResponse_v1_1::RadioResponse_v1_1(RadioHidlTest_v1_1& parent)
-    : RadioResponse(parent), parent_v1_1(parent) {}
+CardStatus cardStatus;
+
+RadioResponse_v1_1::RadioResponse_v1_1(RadioHidlTest_v1_1& parent) : parent_v1_1(parent) {}
+
+/* 1.0 Apis */
+Return<void> RadioResponse_v1_1::getIccCardStatusResponse(const RadioResponseInfo& info,
+                                                          const CardStatus& card_status) {
+    rspInfo = info;
+    cardStatus = card_status;
+    parent_v1_1.notify();
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::supplyIccPinForAppResponse(const RadioResponseInfo& /*info*/,
+                                                            int32_t /*remainingRetries*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::supplyIccPukForAppResponse(const RadioResponseInfo& /*info*/,
+                                                            int32_t /*remainingRetries*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::supplyIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
+                                                             int32_t /*remainingRetries*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::supplyIccPuk2ForAppResponse(const RadioResponseInfo& /*info*/,
+                                                             int32_t /*remainingRetries*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::changeIccPinForAppResponse(const RadioResponseInfo& /*info*/,
+                                                            int32_t /*remainingRetries*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::changeIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
+                                                             int32_t /*remainingRetries*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::supplyNetworkDepersonalizationResponse(
+    const RadioResponseInfo& /*info*/, int32_t /*remainingRetries*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getCurrentCallsResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_vec<Call>& /*calls*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::dialResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getIMSIForAppResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*imsi*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::hangupConnectionResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::hangupWaitingOrBackgroundResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::hangupForegroundResumeBackgroundResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::switchWaitingOrHoldingAndActiveResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::conferenceResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::rejectCallResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getLastCallFailCauseResponse(
+    const RadioResponseInfo& /*info*/, const LastCallFailCauseInfo& /*failCauseInfo*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getSignalStrengthResponse(const RadioResponseInfo& /*info*/,
+                                                           const SignalStrength& /*sig_strength*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getVoiceRegistrationStateResponse(
+    const RadioResponseInfo& /*info*/, const VoiceRegStateResult& /*voiceRegResponse*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getDataRegistrationStateResponse(
+    const RadioResponseInfo& /*info*/, const DataRegStateResult& /*dataRegResponse*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getOperatorResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*longName*/,
+    const ::android::hardware::hidl_string& /*shortName*/,
+    const ::android::hardware::hidl_string& /*numeric*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setRadioPowerResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendDtmfResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendSmsResponse(const RadioResponseInfo& /*info*/,
+                                                 const SendSmsResult& /*sms*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendSMSExpectMoreResponse(const RadioResponseInfo& /*info*/,
+                                                           const SendSmsResult& /*sms*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setupDataCallResponse(const RadioResponseInfo& /*info*/,
+                                                       const SetupDataCallResult& /*dcResponse*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::iccIOForAppResponse(const RadioResponseInfo& /*info*/,
+                                                     const IccIoResult& /*iccIo*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendUssdResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::cancelPendingUssdResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getClirResponse(const RadioResponseInfo& /*info*/, int32_t /*n*/,
+                                                 int32_t /*m*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setClirResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getCallForwardStatusResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_vec<CallForwardInfo>&
+    /*callForwardInfos*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setCallForwardResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getCallWaitingResponse(const RadioResponseInfo& /*info*/,
+                                                        bool /*enable*/, int32_t /*serviceClass*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setCallWaitingResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::acknowledgeLastIncomingGsmSmsResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::acceptCallResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::deactivateDataCallResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getFacilityLockForAppResponse(const RadioResponseInfo& /*info*/,
+                                                               int32_t /*response*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setFacilityLockForAppResponse(const RadioResponseInfo& /*info*/,
+                                                               int32_t /*retry*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setBarringPasswordResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getNetworkSelectionModeResponse(const RadioResponseInfo& /*info*/,
+                                                                 bool /*manual*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setNetworkSelectionModeAutomaticResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setNetworkSelectionModeManualResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getAvailableNetworksResponse(
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec<OperatorInfo>& /*networkInfos*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::startDtmfResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::stopDtmfResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getBasebandVersionResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*version*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::separateConnectionResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setMuteResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getMuteResponse(const RadioResponseInfo& /*info*/,
+                                                 bool /*enable*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getClipResponse(const RadioResponseInfo& /*info*/,
+                                                 ClipStatus /*status*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getDataCallListResponse(
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec<SetupDataCallResult>& /*dcResponse*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendOemRilRequestRawResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_vec<uint8_t>& /*data*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendOemRilRequestStringsResponse(
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec< ::android::hardware::hidl_string>& /*data*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setSuppServiceNotificationsResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::writeSmsToSimResponse(const RadioResponseInfo& /*info*/,
+                                                       int32_t /*index*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::deleteSmsOnSimResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setBandModeResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getAvailableBandModesResponse(
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec<RadioBandMode>& /*bandModes*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendEnvelopeResponse(
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_string& /*commandResponse*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendTerminalResponseToSimResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::handleStkCallSetupRequestFromSimResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::explicitCallTransferResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setPreferredNetworkTypeResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getPreferredNetworkTypeResponse(const RadioResponseInfo& /*info*/,
+                                                                 PreferredNetworkType /*nw_type*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getNeighboringCidsResponse(
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec<NeighboringCell>& /*cells*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setLocationUpdatesResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setCdmaSubscriptionSourceResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setCdmaRoamingPreferenceResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getCdmaRoamingPreferenceResponse(const RadioResponseInfo& /*info*/,
+                                                                  CdmaRoamingType /*type*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setTTYModeResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getTTYModeResponse(const RadioResponseInfo& /*info*/,
+                                                    TtyMode /*mode*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setPreferredVoicePrivacyResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getPreferredVoicePrivacyResponse(const RadioResponseInfo& /*info*/,
+                                                                  bool /*enable*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendCDMAFeatureCodeResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendBurstDtmfResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendCdmaSmsResponse(const RadioResponseInfo& /*info*/,
+                                                     const SendSmsResult& /*sms*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::acknowledgeLastIncomingCdmaSmsResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getGsmBroadcastConfigResponse(
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& /*configs*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setGsmBroadcastConfigResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setGsmBroadcastActivationResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getCdmaBroadcastConfigResponse(
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setCdmaBroadcastConfigResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setCdmaBroadcastActivationResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getCDMASubscriptionResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*mdn*/,
+    const ::android::hardware::hidl_string& /*hSid*/,
+    const ::android::hardware::hidl_string& /*hNid*/,
+    const ::android::hardware::hidl_string& /*min*/,
+    const ::android::hardware::hidl_string& /*prl*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::writeSmsToRuimResponse(const RadioResponseInfo& /*info*/,
+                                                        uint32_t /*index*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::deleteSmsOnRuimResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getDeviceIdentityResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*imei*/,
+    const ::android::hardware::hidl_string& /*imeisv*/,
+    const ::android::hardware::hidl_string& /*esn*/,
+    const ::android::hardware::hidl_string& /*meid*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::exitEmergencyCallbackModeResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getSmscAddressResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*smsc*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setSmscAddressResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::reportSmsMemoryStatusResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::reportStkServiceIsRunningResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getCdmaSubscriptionSourceResponse(
+    const RadioResponseInfo& /*info*/, CdmaSubscriptionSource /*source*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::requestIsimAuthenticationResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*response*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::acknowledgeIncomingGsmSmsWithPduResponse(
+    const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendEnvelopeWithStatusResponse(const RadioResponseInfo& /*info*/,
+                                                                const IccIoResult& /*iccIo*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getVoiceRadioTechnologyResponse(const RadioResponseInfo& /*info*/,
+                                                                 RadioTechnology /*rat*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getCellInfoListResponse(
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec<CellInfo>& /*cellInfo*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setCellInfoListRateResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setInitialAttachApnResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getImsRegistrationStateResponse(
+    const RadioResponseInfo& /*info*/, bool /*isRegistered*/, RadioTechnologyFamily /*ratFamily*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendImsSmsResponse(const RadioResponseInfo& /*info*/,
+                                                    const SendSmsResult& /*sms*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::iccTransmitApduBasicChannelResponse(
+    const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::iccOpenLogicalChannelResponse(
+    const RadioResponseInfo& /*info*/, int32_t /*channelId*/,
+    const ::android::hardware::hidl_vec<int8_t>& /*selectResponse*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::iccCloseLogicalChannelResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::iccTransmitApduLogicalChannelResponse(
+    const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::nvReadItemResponse(
+    const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*result*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::nvWriteItemResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::nvWriteCdmaPrlResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::nvResetConfigResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setUiccSubscriptionResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setDataAllowedResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getHardwareConfigResponse(
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec<HardwareConfig>& /*config*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::requestIccSimAuthenticationResponse(
+    const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setDataProfileResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::requestShutdownResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
+                                                            const RadioCapability& /*rc*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
+                                                            const RadioCapability& /*rc*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::startLceServiceResponse(const RadioResponseInfo& /*info*/,
+                                                         const LceStatusInfo& /*statusInfo*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::stopLceServiceResponse(const RadioResponseInfo& /*info*/,
+                                                        const LceStatusInfo& /*statusInfo*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::pullLceDataResponse(const RadioResponseInfo& /*info*/,
+                                                     const LceDataInfo& /*lceInfo*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getModemActivityInfoResponse(
+    const RadioResponseInfo& /*info*/, const ActivityStatsInfo& /*activityInfo*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setAllowedCarriersResponse(const RadioResponseInfo& /*info*/,
+                                                            int32_t /*numAllowed*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::getAllowedCarriersResponse(
+    const RadioResponseInfo& /*info*/, bool /*allAllowed*/,
+    const CarrierRestrictions& /*carriers*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::sendDeviceStateResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setIndicationFilterResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::setSimCardPowerResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::acknowledgeRequest(int32_t /*serial*/) {
+    return Void();
+}
 
 /* 1.1 Apis */
 Return<void> RadioResponse_v1_1::setCarrierInfoForImsiEncryptionResponse(
@@ -37,4 +675,13 @@
 
 Return<void> RadioResponse_v1_1::stopNetworkScanResponse(const RadioResponseInfo& /*info*/) {
     return Void();
+}
+
+Return<void> RadioResponse_v1_1::startKeepaliveResponse(const RadioResponseInfo& /*info*/,
+                                                        const KeepaliveStatus& /*status*/) {
+    return Void();
+}
+
+Return<void> RadioResponse_v1_1::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) {
+    return Void();
 }
\ No newline at end of file
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
index 2670b8d..c6eecd6 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
@@ -28,8 +28,10 @@
 }
 
 void RenderscriptHidlTest::TearDown() {
-    context->contextFinish();
-    context->contextDestroy();
+    if (context.get() != nullptr) {
+        context->contextFinish();
+        context->contextDestroy();
+    }
 }
 
 // A class for test environment setup (kept since this file is a template).
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
index 4842946..3006508 100644
--- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
+++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
@@ -543,7 +543,7 @@
 };
 
 const Vec3NormChecker SensorsHidlTest::sAccelNormChecker(
-        Vec3NormChecker::byNominal(GRAVITY_EARTH, 0.5f/*m/s^2*/));
+        Vec3NormChecker::byNominal(GRAVITY_EARTH, 1.0f/*m/s^2*/));
 const Vec3NormChecker SensorsHidlTest::sGyroNormChecker(
         Vec3NormChecker::byNominal(0.f, 0.1f/*rad/s*/));
 
diff --git a/soundtrigger/2.0/default/OWNERS b/soundtrigger/2.0/default/OWNERS
new file mode 100644
index 0000000..6fdc97c
--- /dev/null
+++ b/soundtrigger/2.0/default/OWNERS
@@ -0,0 +1,3 @@
+elaurent@google.com
+krocard@google.com
+mnaganov@google.com
diff --git a/tests/Android.bp b/tests/Android.bp
index ddf300b..9583bfd 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -20,6 +20,8 @@
     "memory/1.0/default",
     "msgq/1.0",
     "msgq/1.0/default",
+    "multithread/1.0",
+    "multithread/1.0/default",
     "pointer/1.0",
     "pointer/1.0/default",
     "pointer/1.0/default/lib",
diff --git a/tests/bar/1.0/default/Android.bp b/tests/bar/1.0/default/Android.bp
index 2a9607b..82d34a9 100644
--- a/tests/bar/1.0/default/Android.bp
+++ b/tests/bar/1.0/default/Android.bp
@@ -4,7 +4,6 @@
     name: "android.hardware.tests.bar@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
-    proprietary: true,
     srcs: [
         "Bar.cpp",
         "ImportTypes.cpp",
diff --git a/tests/baz/1.0/default/Android.bp b/tests/baz/1.0/default/Android.bp
index ef1c28e..f247b83 100644
--- a/tests/baz/1.0/default/Android.bp
+++ b/tests/baz/1.0/default/Android.bp
@@ -2,7 +2,6 @@
     name: "android.hardware.tests.baz@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
-    proprietary: true,
     srcs: [
         "Baz.cpp",
     ],
diff --git a/tests/foo/1.0/default/Android.bp b/tests/foo/1.0/default/Android.bp
index f8acf9d..0e1d34d 100644
--- a/tests/foo/1.0/default/Android.bp
+++ b/tests/foo/1.0/default/Android.bp
@@ -4,7 +4,6 @@
     name: "android.hardware.tests.foo@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
-    proprietary: true,
     srcs: [
         "Foo.cpp",
     ],
diff --git a/tests/foo/1.0/default/lib/Android.bp b/tests/foo/1.0/default/lib/Android.bp
index b512311..895582c 100644
--- a/tests/foo/1.0/default/lib/Android.bp
+++ b/tests/foo/1.0/default/lib/Android.bp
@@ -1,6 +1,5 @@
 cc_library_shared {
     name: "libfootest",
-    vendor: true,
     defaults: ["hidl_defaults"],
     srcs: [
         "FooHelper.cpp"
diff --git a/tests/hash/1.0/default/Android.bp b/tests/hash/1.0/default/Android.bp
index d6e9630..ae44876 100644
--- a/tests/hash/1.0/default/Android.bp
+++ b/tests/hash/1.0/default/Android.bp
@@ -1,7 +1,6 @@
 cc_library_shared {
     name: "android.hardware.tests.hash@1.0-impl",
     relative_install_path: "hw",
-    proprietary: true,
     srcs: [
         "Hash.cpp",
     ],
diff --git a/tests/inheritance/1.0/default/Android.bp b/tests/inheritance/1.0/default/Android.bp
index f6ca88a..158da4b 100644
--- a/tests/inheritance/1.0/default/Android.bp
+++ b/tests/inheritance/1.0/default/Android.bp
@@ -4,7 +4,6 @@
     name: "android.hardware.tests.inheritance@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
-    proprietary: true,
     srcs: [
         "Fetcher.cpp",
         "Parent.cpp",
diff --git a/tests/memory/1.0/default/Android.bp b/tests/memory/1.0/default/Android.bp
index e889bd8..efd4165 100644
--- a/tests/memory/1.0/default/Android.bp
+++ b/tests/memory/1.0/default/Android.bp
@@ -15,7 +15,6 @@
 cc_library_shared {
     name: "android.hardware.tests.memory@1.0-impl",
     defaults: ["hidl_defaults"],
-    proprietary: true,
     relative_install_path: "hw",
     srcs: [
         "MemoryTest.cpp",
diff --git a/tests/multithread/1.0/Android.bp b/tests/multithread/1.0/Android.bp
new file mode 100644
index 0000000..c3782a0
--- /dev/null
+++ b/tests/multithread/1.0/Android.bp
@@ -0,0 +1,59 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.tests.multithread@1.0_hal",
+    srcs: [
+        "IMultithread.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tests.multithread@1.0_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.multithread@1.0",
+    srcs: [
+        ":android.hardware.tests.multithread@1.0_hal",
+    ],
+    out: [
+        "android/hardware/tests/multithread/1.0/MultithreadAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tests.multithread@1.0_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.multithread@1.0",
+    srcs: [
+        ":android.hardware.tests.multithread@1.0_hal",
+    ],
+    out: [
+        "android/hardware/tests/multithread/1.0/IMultithread.h",
+        "android/hardware/tests/multithread/1.0/IHwMultithread.h",
+        "android/hardware/tests/multithread/1.0/BnHwMultithread.h",
+        "android/hardware/tests/multithread/1.0/BpHwMultithread.h",
+        "android/hardware/tests/multithread/1.0/BsMultithread.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.tests.multithread@1.0",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["android.hardware.tests.multithread@1.0_genc++"],
+    generated_headers: ["android.hardware.tests.multithread@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.tests.multithread@1.0_genc++_headers"],
+    vendor_available: true,
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+    ],
+}
diff --git a/tests/multithread/1.0/Android.mk b/tests/multithread/1.0/Android.mk
new file mode 100644
index 0000000..f63381d
--- /dev/null
+++ b/tests/multithread/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.multithread-V1.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-V1.0-java \
+
+
+#
+# Build IMultithread.hal
+#
+GEN := $(intermediates)/android/hardware/tests/multithread/V1_0/IMultithread.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IMultithread.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.multithread@1.0::IMultithread
+
+$(GEN): $(LOCAL_PATH)/IMultithread.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.tests.multithread-V1.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-V1.0-java-static \
+
+
+#
+# Build IMultithread.hal
+#
+GEN := $(intermediates)/android/hardware/tests/multithread/V1_0/IMultithread.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IMultithread.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.multithread@1.0::IMultithread
+
+$(GEN): $(LOCAL_PATH)/IMultithread.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/multithread/1.0/IMultithread.hal b/tests/multithread/1.0/IMultithread.hal
new file mode 100644
index 0000000..19dc4f6
--- /dev/null
+++ b/tests/multithread/1.0/IMultithread.hal
@@ -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.
+ */
+
+package android.hardware.tests.multithread@1.0;
+
+/**
+ * IMultithread tests configureRpcThreadpool
+ *
+ * Makes calls finish only when specific number of them are running in parallel
+ */
+interface IMultithread {
+    /**
+     * Sets up controller
+     * Must be called for each test
+     * @param maxThreads arg passed to configureRpcThreadpool
+     * Could not be decremented by future calls
+     * @param numThreads number of calls in parallel to finish
+     */
+    setNumThreads(int32_t maxThreads, int32_t numThreads);
+
+    /**
+     * Makes a new call
+     * @return noTimeout numThreads appeared in parallel before timeout
+     * Shall return the same value for one setNumThreads call
+     */
+    runNewThread() generates (bool noTimeout);
+};
diff --git a/tests/multithread/1.0/default/Android.bp b/tests/multithread/1.0/default/Android.bp
new file mode 100644
index 0000000..72b9e91
--- /dev/null
+++ b/tests/multithread/1.0/default/Android.bp
@@ -0,0 +1,17 @@
+cc_library_shared {
+    name: "android.hardware.tests.multithread@1.0-impl",
+    defaults: ["hidl_defaults"],
+    relative_install_path: "hw",
+    proprietary: true,
+    srcs: [
+        "Multithread.cpp",
+    ],
+    shared_libs: [
+        "libbase",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libutils",
+        "android.hardware.tests.multithread@1.0",
+    ],
+}
diff --git a/tests/multithread/1.0/default/Multithread.cpp b/tests/multithread/1.0/default/Multithread.cpp
new file mode 100644
index 0000000..1fb267c
--- /dev/null
+++ b/tests/multithread/1.0/default/Multithread.cpp
@@ -0,0 +1,63 @@
+#define LOG_TAG "hidl_test"
+
+#include <android-base/logging.h>
+#include "Multithread.h"
+#include <inttypes.h>
+#include <thread>
+
+#include <hidl/HidlTransportSupport.h>
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace multithread {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::tests::multithread::V1_0::IMultithread follow.
+Return<void> Multithread::setNumThreads(int32_t maxThreads, int32_t numThreads) {
+    LOG(INFO) << "SERVER(Multithread) setNumThreads("
+              << maxThreads << ", " << numThreads << ")";
+
+    LOG(INFO) << "SERVER(Multithread) call configureRpcThreadpool("
+              << maxThreads << ")";
+    ::android::hardware::configureRpcThreadpool(maxThreads, /*willjoin*/ false);
+
+    mNumThreads = numThreads;
+    mNoTimeout = true;
+
+    return Void();
+}
+
+Return<bool> Multithread::runNewThread() {
+    LOG(INFO) << "SERVER(Multithread) runNewThread()";
+
+    std::unique_lock<std::mutex> lk(mCvMutex);
+    --mNumThreads;
+
+    LOG(INFO) << "SERVER(Multithread) runNewThread()";
+    LOG(INFO) << mNumThreads << "threads left";
+
+    mCv.notify_all();
+    bool noTimeout = mCv.wait_for(lk, kTimeoutDuration,
+        [&] { return mNumThreads <= 0 || !mNoTimeout; });
+
+    if (!noTimeout) {
+        mNoTimeout = false;
+        mCv.notify_all();
+    }
+    return mNoTimeout;
+}
+
+IMultithread* HIDL_FETCH_IMultithread(const char* /* name */) {
+    return new Multithread();
+}
+
+decltype(Multithread::kTimeoutDuration) Multithread::kTimeoutDuration;
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace multithread
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
diff --git a/tests/multithread/1.0/default/Multithread.h b/tests/multithread/1.0/default/Multithread.h
new file mode 100644
index 0000000..0d4a007
--- /dev/null
+++ b/tests/multithread/1.0/default/Multithread.h
@@ -0,0 +1,48 @@
+#ifndef ANDROID_HARDWARE_TESTS_MULTITHREAD_V1_0_MULTITHREAD_H
+#define ANDROID_HARDWARE_TESTS_MULTITHREAD_V1_0_MULTITHREAD_H
+
+#include <android/hardware/tests/multithread/1.0/IMultithread.h>
+#include <hidl/Status.h>
+
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace multithread {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::multithread::V1_0::IMultithread;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+using namespace std::chrono_literals;
+
+struct Multithread : public IMultithread {
+    // Methods from ::android::hardware::tests::multithread::V1_0::IMultithread follow.
+    virtual Return<void> setNumThreads(int32_t maxThreads, int32_t numThreads) override;
+    virtual Return<bool> runNewThread() override;
+
+   private:
+    int32_t mNumThreads;
+    bool mNoTimeout;
+
+    std::condition_variable mCv;
+    std::mutex mCvMutex;
+
+    static constexpr auto kTimeoutDuration = 100ms;
+};
+
+extern "C" IMultithread* HIDL_FETCH_IMultithread(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace multithread
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_TESTS_MULTITHREAD_V1_0_MULTITHREAD_H
diff --git a/tests/pointer/1.0/default/Android.bp b/tests/pointer/1.0/default/Android.bp
index 4615463..0c91edb 100644
--- a/tests/pointer/1.0/default/Android.bp
+++ b/tests/pointer/1.0/default/Android.bp
@@ -4,7 +4,6 @@
     name: "android.hardware.tests.pointer@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
-    proprietary: true,
     srcs: [
         "Graph.cpp",
         "Pointer.cpp",
diff --git a/tests/pointer/1.0/default/lib/Android.bp b/tests/pointer/1.0/default/lib/Android.bp
index 1fe0896..ae07b04 100644
--- a/tests/pointer/1.0/default/lib/Android.bp
+++ b/tests/pointer/1.0/default/lib/Android.bp
@@ -1,6 +1,5 @@
 cc_library_shared {
     name: "libpointertest",
-    vendor: true,
     defaults: ["hidl_defaults"],
     srcs: [
         "PointerHelper.cpp"
diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp
index b454a06..2d6679f 100644
--- a/wifi/1.0/vts/functional/Android.bp
+++ b/wifi/1.0/vts/functional/Android.bp
@@ -17,10 +17,12 @@
 cc_library_static {
     name: "VtsHalWifiV1_0TargetTestUtil",
     srcs: [
-
         "wifi_hidl_call_util_selftest.cpp",
         "wifi_hidl_test.cpp",
         "wifi_hidl_test_utils.cpp"],
+    export_include_dirs: [
+        "."
+    ],
     shared_libs: [
         "libbase",
         "liblog",
diff --git a/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp b/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
index 160fcd2..beac039 100644
--- a/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
+++ b/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
@@ -20,10 +20,16 @@
 
 #include "wifi_hidl_test_utils.h"
 
+WifiHidlEnvironment* gEnv;
+
 int main(int argc, char** argv) {
-    ::testing::AddGlobalTestEnvironment(new WifiHidlEnvironment);
+    gEnv = new WifiHidlEnvironment();
+    ::testing::AddGlobalTestEnvironment(gEnv);
     ::testing::InitGoogleTest(&argc, argv);
-    int status = RUN_ALL_TESTS();
-    LOG(INFO) << "Test result = " << status;
+    int status = gEnv->initFromOptions(argc, argv);
+    if (status == 0) {
+        status = RUN_ALL_TESTS();
+        LOG(INFO) << "Test result = " << status;
+    }
     return status;
 }
diff --git a/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp
index 6c2372f..06e21ff 100644
--- a/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp
+++ b/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp
@@ -42,6 +42,8 @@
 using ::android::hardware::wifi::V1_0::IWifiRttController;
 using ::android::hardware::wifi::V1_0::IWifiStaIface;
 
+extern WifiHidlEnvironment* gEnv;
+
 namespace {
 constexpr WifiDebugRingBufferVerboseLevel kDebugRingBufferVerboseLvl =
     WifiDebugRingBufferVerboseLevel::VERBOSE;
@@ -78,7 +80,8 @@
     // to be first configured.
     ChipModeId configureChipForIfaceType(IfaceType type, bool expectSuccess) {
         ChipModeId mode_id;
-        EXPECT_EQ(expectSuccess, configureChipToSupportIfaceType(wifi_chip_, type, &mode_id));
+        EXPECT_EQ(expectSuccess,
+            configureChipToSupportIfaceType(wifi_chip_, type, &mode_id));
         return mode_id;
     }
 
@@ -436,10 +439,14 @@
  * succeeds. The 2nd iface creation should be rejected.
  */
 TEST_F(WifiChipHidlTest, CreateNanIface) {
-    configureChipForIfaceType(IfaceType::NAN, false);
+    configureChipForIfaceType(IfaceType::NAN, gEnv->isNanOn);
+    if (!gEnv->isNanOn) return;
 
     sp<IWifiNanIface> iface;
-    ASSERT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createNanIface(&iface));
+    ASSERT_EQ(WifiStatusCode::SUCCESS, createNanIface(&iface));
+    EXPECT_NE(nullptr, iface.get());
+
+    EXPECT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createNanIface(&iface));
 }
 
 /*
@@ -449,12 +456,30 @@
  * iface name is returned via the list.
  */
 TEST_F(WifiChipHidlTest, GetNanIfaceNames) {
-    configureChipForIfaceType(IfaceType::NAN, false);
+    configureChipForIfaceType(IfaceType::NAN, gEnv->isNanOn);
+    if (!gEnv->isNanOn) return;
 
     const auto& status_and_iface_names1 =
         HIDL_INVOKE(wifi_chip_, getNanIfaceNames);
     ASSERT_EQ(WifiStatusCode::SUCCESS, status_and_iface_names1.first.code);
     EXPECT_EQ(0u, status_and_iface_names1.second.size());
+
+    sp<IWifiNanIface> iface;
+    EXPECT_EQ(WifiStatusCode::SUCCESS, createNanIface(&iface));
+    EXPECT_NE(nullptr, iface.get());
+
+    std::string iface_name = getIfaceName(iface);
+    const auto& status_and_iface_names2 =
+        HIDL_INVOKE(wifi_chip_, getNanIfaceNames);
+    EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_iface_names2.first.code);
+    EXPECT_EQ(1u, status_and_iface_names2.second.size());
+    EXPECT_EQ(iface_name, status_and_iface_names2.second[0]);
+
+    EXPECT_EQ(WifiStatusCode::SUCCESS, removeNanIface(iface_name));
+    const auto& status_and_iface_names3 =
+        HIDL_INVOKE(wifi_chip_, getNanIfaceNames);
+    EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_iface_names3.first.code);
+    EXPECT_EQ(0u, status_and_iface_names3.second.size());
 }
 
 /*
@@ -464,10 +489,24 @@
  * doesn't retrieve an iface object.
  */
 TEST_F(WifiChipHidlTest, GetNanIface) {
-    configureChipForIfaceType(IfaceType::NAN, false);
+    configureChipForIfaceType(IfaceType::NAN, gEnv->isNanOn);
+    if (!gEnv->isNanOn) return;
 
     sp<IWifiNanIface> nan_iface;
-    ASSERT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createNanIface(&nan_iface));
+    EXPECT_EQ(WifiStatusCode::SUCCESS, createNanIface(&nan_iface));
+    EXPECT_NE(nullptr, nan_iface.get());
+
+    std::string iface_name = getIfaceName(nan_iface);
+    const auto& status_and_iface1 =
+        HIDL_INVOKE(wifi_chip_, getNanIface, iface_name);
+    EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_iface1.first.code);
+    EXPECT_NE(nullptr, status_and_iface1.second.get());
+
+    std::string invalid_name = iface_name + "0";
+    const auto& status_and_iface2 =
+        HIDL_INVOKE(wifi_chip_, getNanIface, invalid_name);
+    EXPECT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, status_and_iface2.first.code);
+    EXPECT_EQ(nullptr, status_and_iface2.second.get());
 }
 
 /*
@@ -477,10 +516,21 @@
  * doesn't remove the iface.
  */
 TEST_F(WifiChipHidlTest, RemoveNanIface) {
-    configureChipForIfaceType(IfaceType::NAN, false);
+    configureChipForIfaceType(IfaceType::NAN, gEnv->isNanOn);
+    if (!gEnv->isNanOn) return;
 
     sp<IWifiNanIface> nan_iface;
-    ASSERT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createNanIface(&nan_iface));
+    EXPECT_EQ(WifiStatusCode::SUCCESS, createNanIface(&nan_iface));
+    EXPECT_NE(nullptr, nan_iface.get());
+
+    std::string iface_name = getIfaceName(nan_iface);
+    std::string invalid_name = iface_name + "0";
+    EXPECT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, removeNanIface(invalid_name));
+
+    EXPECT_EQ(WifiStatusCode::SUCCESS, removeNanIface(iface_name));
+
+    // No such iface exists now. So, this should return failure.
+    EXPECT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, removeNanIface(iface_name));
 }
 
 /*
diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
index 39a0eba..c4a19dd 100644
--- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
+++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
@@ -24,6 +24,8 @@
 #include <android/hardware/wifi/1.0/IWifiRttController.h>
 #include <android/hardware/wifi/1.0/IWifiStaIface.h>
 
+#include <getopt.h>
+
 // Helper functions to obtain references to the various HIDL interface objects.
 // Note: We only have a single instance of each of these objects currently.
 // These helper functions should be modified to return vectors if we support
@@ -46,10 +48,46 @@
 void stopWifi();
 
 class WifiHidlEnvironment : public ::testing::Environment {
- public:
-  virtual void SetUp() override {
-      stopWifi();
-      sleep(5);
-  }
-  virtual void TearDown() override {}
-};
\ No newline at end of file
+   protected:
+    virtual void SetUp() override {
+        stopWifi();
+        sleep(5);
+    }
+
+   public:
+    // Whether NaN feature is supported on the device.
+    bool isNanOn = false;
+
+    void usage(char* me, char* arg) {
+        fprintf(stderr,
+                "unrecognized option: %s\n\n"
+                "usage: %s <gtest options> <test options>\n\n"
+                "test options are:\n\n"
+                "-N, --nan_on: Whether NAN feature is supported\n",
+                arg, me);
+    }
+
+    int initFromOptions(int argc, char** argv) {
+        static struct option options[] = {{"nan_on", no_argument, 0, 'N'},
+                                          {0, 0, 0, 0}};
+
+        int c;
+        while ((c = getopt_long(argc, argv, "N", options, NULL)) >= 0) {
+            switch (c) {
+                case 'N':
+                    isNanOn = true;
+                    break;
+                default:
+                    usage(argv[0], argv[optind]);
+                    return 2;
+            }
+        }
+
+        if (optind < argc) {
+            usage(argv[0], argv[optind]);
+            return 2;
+        }
+
+        return 0;
+    }
+};
diff --git a/wifi/1.1/Android.bp b/wifi/1.1/Android.bp
new file mode 100644
index 0000000..f991fa5
--- /dev/null
+++ b/wifi/1.1/Android.bp
@@ -0,0 +1,68 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.wifi@1.1_hal",
+    srcs: [
+        "IWifi.hal",
+        "IWifiChip.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.wifi@1.1_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.1",
+    srcs: [
+        ":android.hardware.wifi@1.1_hal",
+    ],
+    out: [
+        "android/hardware/wifi/1.1/WifiAll.cpp",
+        "android/hardware/wifi/1.1/WifiChipAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.wifi@1.1_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.1",
+    srcs: [
+        ":android.hardware.wifi@1.1_hal",
+    ],
+    out: [
+        "android/hardware/wifi/1.1/IWifi.h",
+        "android/hardware/wifi/1.1/IHwWifi.h",
+        "android/hardware/wifi/1.1/BnHwWifi.h",
+        "android/hardware/wifi/1.1/BpHwWifi.h",
+        "android/hardware/wifi/1.1/BsWifi.h",
+        "android/hardware/wifi/1.1/IWifiChip.h",
+        "android/hardware/wifi/1.1/IHwWifiChip.h",
+        "android/hardware/wifi/1.1/BnHwWifiChip.h",
+        "android/hardware/wifi/1.1/BpHwWifiChip.h",
+        "android/hardware/wifi/1.1/BsWifiChip.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.wifi@1.1",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["android.hardware.wifi@1.1_genc++"],
+    generated_headers: ["android.hardware.wifi@1.1_genc++_headers"],
+    export_generated_headers: ["android.hardware.wifi@1.1_genc++_headers"],
+    vendor_available: true,
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hardware.wifi@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hardware.wifi@1.0",
+    ],
+}
diff --git a/wifi/1.1/Android.mk b/wifi/1.1/Android.mk
new file mode 100644
index 0000000..fbc79ca
--- /dev/null
+++ b/wifi/1.1/Android.mk
@@ -0,0 +1,116 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.wifi-V1.1-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_JAVA_LIBRARIES := \
+    android.hardware.wifi-V1.0-java \
+    android.hidl.base-V1.0-java \
+
+
+#
+# Build IWifi.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_1/IWifi.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifi.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.1::IWifi
+
+$(GEN): $(LOCAL_PATH)/IWifi.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiChip.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_1/IWifiChip.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.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.1::IWifiChip
+
+$(GEN): $(LOCAL_PATH)/IWifiChip.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.wifi-V1.1-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    android.hardware.wifi-V1.0-java-static \
+    android.hidl.base-V1.0-java-static \
+
+
+#
+# Build IWifi.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_1/IWifi.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifi.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.1::IWifi
+
+$(GEN): $(LOCAL_PATH)/IWifi.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiChip.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_1/IWifiChip.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.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.1::IWifiChip
+
+$(GEN): $(LOCAL_PATH)/IWifiChip.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/wifi/1.1/IWifi.hal b/wifi/1.1/IWifi.hal
new file mode 100644
index 0000000..bd48f57
--- /dev/null
+++ b/wifi/1.1/IWifi.hal
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package android.hardware.wifi@1.1;
+
+import @1.0::IWifi;
+
+/**
+ * This is the root of the HAL module and is the interface returned when
+ * loading an implementation of the Wi-Fi HAL. There must be at most one
+ * module loaded in the system.
+ * IWifi.getChip() may return either a @1.0::IWifiChip or @1.1::IWifiChip.
+ */
+interface IWifi extends @1.0::IWifi {
+};
diff --git a/wifi/1.1/IWifiChip.hal b/wifi/1.1/IWifiChip.hal
new file mode 100644
index 0000000..50cd02d
--- /dev/null
+++ b/wifi/1.1/IWifiChip.hal
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+package android.hardware.wifi@1.1;
+
+import @1.0::IWifiChip;
+import @1.0::WifiStatus;
+
+/**
+ * Interface that represents a chip that must be configured as a single unit.
+ * The HAL/driver/firmware will be responsible for determining which phy is used
+ * to perform operations like NAN, RTT, etc.
+ */
+interface IWifiChip extends @1.0::IWifiChip {
+  /**
+   * Capabilities exposed by this chip.
+   */
+  enum ChipCapabilityMask : @1.0::IWifiChip.ChipCapabilityMask {
+    /**
+     * Set/Reset Tx Power limits.
+     */
+    SET_TX_POWER_LIMIT = 1 << 8,
+    /**
+     * Device to Device RTT.
+     */
+    D2D_RTT            = 1 << 9,
+    /**
+     * Device to AP RTT.
+     */
+    D2AP_RTT           = 1 << 10
+  };
+
+  /**
+   * API to set TX power limit.
+   * This is used for meeting SAR requirements while making VOIP calls for
+   * example.
+   *
+   * @param powerInDbm Power level in dBm.
+   * @return status WifiStatus of the operation.
+   *         Possible status codes:
+   *         |WifiStatusCode.SUCCESS|,
+   *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
+   *         |WifiStatusCode.NOT_AVAILABLE|,
+   *         |WifiStatusCode.UNKNOWN|
+   */
+  setTxPowerLimit(int32_t powerInDbm) generates (WifiStatus status);
+
+  /**
+   * API to reset TX power limit.
+   * This is used to set the power back to default values.
+   *
+   * @return status WifiStatus of the operation.
+   *         Possible status codes:
+   *         |WifiStatusCode.SUCCESS|,
+   *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
+   *         |WifiStatusCode.NOT_AVAILABLE|,
+   *         |WifiStatusCode.UNKNOWN|
+   */
+  resetTxPowerLimit() generates (WifiStatus status);
+};
diff --git a/wifi/1.0/default/Android.mk b/wifi/1.1/default/Android.mk
similarity index 97%
rename from wifi/1.0/default/Android.mk
rename to wifi/1.1/default/Android.mk
index fe33e08..5758422 100644
--- a/wifi/1.0/default/Android.mk
+++ b/wifi/1.1/default/Android.mk
@@ -38,6 +38,7 @@
     wifi_status_util.cpp
 LOCAL_SHARED_LIBRARIES := \
     android.hardware.wifi@1.0 \
+    android.hardware.wifi@1.1 \
     libbase \
     libcutils \
     libhidlbase \
diff --git a/wifi/1.0/default/THREADING.README b/wifi/1.1/default/THREADING.README
similarity index 100%
rename from wifi/1.0/default/THREADING.README
rename to wifi/1.1/default/THREADING.README
diff --git a/wifi/1.0/default/android.hardware.wifi@1.0-service.rc b/wifi/1.1/default/android.hardware.wifi@1.0-service.rc
similarity index 100%
rename from wifi/1.0/default/android.hardware.wifi@1.0-service.rc
rename to wifi/1.1/default/android.hardware.wifi@1.0-service.rc
diff --git a/wifi/1.0/default/hidl_callback_util.h b/wifi/1.1/default/hidl_callback_util.h
similarity index 98%
rename from wifi/1.0/default/hidl_callback_util.h
rename to wifi/1.1/default/hidl_callback_util.h
index b7100c8..fb13622 100644
--- a/wifi/1.0/default/hidl_callback_util.h
+++ b/wifi/1.1/default/hidl_callback_util.h
@@ -51,7 +51,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace hidl_callback_util {
 template <typename CallbackType>
@@ -114,7 +114,7 @@
 
 }  // namespace hidl_callback_util
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/hidl_return_util.h b/wifi/1.1/default/hidl_return_util.h
similarity index 97%
rename from wifi/1.0/default/hidl_return_util.h
rename to wifi/1.1/default/hidl_return_util.h
index 3f6364b..2f95c23 100644
--- a/wifi/1.0/default/hidl_return_util.h
+++ b/wifi/1.1/default/hidl_return_util.h
@@ -23,9 +23,10 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace hidl_return_util {
+using namespace android::hardware::wifi::V1_0;
 
 /**
  * These utility functions are used to invoke a method on the provided
@@ -106,7 +107,7 @@
 
 }  // namespace hidl_util
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.1/default/hidl_struct_util.cpp
similarity index 98%
rename from wifi/1.0/default/hidl_struct_util.cpp
rename to wifi/1.1/default/hidl_struct_util.cpp
index fa0279b..6b93b9e 100644
--- a/wifi/1.0/default/hidl_struct_util.cpp
+++ b/wifi/1.1/default/hidl_struct_util.cpp
@@ -17,12 +17,15 @@
 #include <android-base/logging.h>
 #include <utils/SystemClock.h>
 
+#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include <android/hardware/wifi/1.1/IWifiChip.h>
+
 #include "hidl_struct_util.h"
 
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace hidl_struct_util {
 
@@ -66,6 +69,21 @@
   return {};
 }
 
+V1_1::IWifiChip::ChipCapabilityMask convertLegacyFeatureToHidlChipCapability(
+    uint32_t feature) {
+  using HidlChipCaps = V1_1::IWifiChip::ChipCapabilityMask;
+  switch (feature) {
+    case WIFI_FEATURE_SET_TX_POWER_LIMIT:
+      return HidlChipCaps::SET_TX_POWER_LIMIT;
+    case WIFI_FEATURE_D2D_RTT:
+      return HidlChipCaps::D2D_RTT;
+    case WIFI_FEATURE_D2AP_RTT:
+      return HidlChipCaps::D2AP_RTT;
+  };
+  CHECK(false) << "Unknown legacy feature: " << feature;
+  return {};
+}
+
 IWifiStaIface::StaIfaceCapabilityMask
 convertLegacyFeatureToHidlStaIfaceCapability(uint32_t feature) {
   using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask;
@@ -102,7 +120,9 @@
 }
 
 bool convertLegacyFeaturesToHidlChipCapabilities(
-    uint32_t legacy_logger_feature_set, uint32_t* hidl_caps) {
+    uint32_t legacy_feature_set,
+    uint32_t legacy_logger_feature_set,
+    uint32_t* hidl_caps) {
   if (!hidl_caps) {
     return false;
   }
@@ -117,6 +137,13 @@
       *hidl_caps |= convertLegacyLoggerFeatureToHidlChipCapability(feature);
     }
   }
+  for (const auto feature : {WIFI_FEATURE_SET_TX_POWER_LIMIT,
+                             WIFI_FEATURE_D2D_RTT,
+                             WIFI_FEATURE_D2AP_RTT}) {
+    if (feature & legacy_feature_set) {
+      *hidl_caps |= convertLegacyFeatureToHidlChipCapability(feature);
+    }
+  }
   // There are no flags for these 3 in the legacy feature set. Adding them to
   // the set because all the current devices support it.
   *hidl_caps |= HidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA;
@@ -241,7 +268,6 @@
     return false;
   }
   *hidl_caps = {};
-  *hidl_caps = 0;
   using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask;
   for (const auto feature : {legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED}) {
     if (feature & legacy_logger_feature_set) {
@@ -2177,7 +2203,7 @@
 }
 }  // namespace hidl_struct_util
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/hidl_struct_util.h b/wifi/1.1/default/hidl_struct_util.h
similarity index 96%
rename from wifi/1.0/default/hidl_struct_util.h
rename to wifi/1.1/default/hidl_struct_util.h
index c04d92f..7a840f9 100644
--- a/wifi/1.0/default/hidl_struct_util.h
+++ b/wifi/1.1/default/hidl_struct_util.h
@@ -19,7 +19,7 @@
 
 #include <vector>
 
-#include <android/hardware/wifi/1.0/IWifi.h>
+#include <android/hardware/wifi/1.0/types.h>
 
 #include "wifi_legacy_hal.h"
 
@@ -32,13 +32,16 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace hidl_struct_util {
+using namespace android::hardware::wifi::V1_0;
 
 // Chip conversion methods.
 bool convertLegacyFeaturesToHidlChipCapabilities(
-    uint32_t legacy_logger_feature_set, uint32_t* hidl_caps);
+    uint32_t legacy_feature_set,
+    uint32_t legacy_logger_feature_set,
+    uint32_t* hidl_caps);
 bool convertLegacyDebugRingBufferStatusToHidl(
     const legacy_hal::wifi_ring_buffer_status& legacy_status,
     WifiDebugRingBufferStatus* hidl_status);
@@ -161,7 +164,7 @@
     std::vector<RttResult>* hidl_results);
 }  // namespace hidl_struct_util
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/hidl_sync_util.cpp b/wifi/1.1/default/hidl_sync_util.cpp
similarity index 96%
rename from wifi/1.0/default/hidl_sync_util.cpp
rename to wifi/1.1/default/hidl_sync_util.cpp
index 7d47f2f..ba18e34 100644
--- a/wifi/1.0/default/hidl_sync_util.cpp
+++ b/wifi/1.1/default/hidl_sync_util.cpp
@@ -23,7 +23,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace hidl_sync_util {
 
@@ -33,7 +33,7 @@
 
 }  // namespace hidl_sync_util
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/hidl_sync_util.h b/wifi/1.1/default/hidl_sync_util.h
similarity index 96%
rename from wifi/1.0/default/hidl_sync_util.h
rename to wifi/1.1/default/hidl_sync_util.h
index 6631e55..0e882df 100644
--- a/wifi/1.0/default/hidl_sync_util.h
+++ b/wifi/1.1/default/hidl_sync_util.h
@@ -24,13 +24,13 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace hidl_sync_util {
 std::unique_lock<std::recursive_mutex> acquireGlobalLock();
 }  // namespace hidl_sync_util
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/service.cpp b/wifi/1.1/default/service.cpp
similarity index 91%
rename from wifi/1.0/default/service.cpp
rename to wifi/1.1/default/service.cpp
index 059304e..b3fcd50 100644
--- a/wifi/1.0/default/service.cpp
+++ b/wifi/1.1/default/service.cpp
@@ -32,8 +32,8 @@
   configureRpcThreadpool(1, true /* callerWillJoin */);
 
   // Setup hwbinder service
-  android::sp<android::hardware::wifi::V1_0::IWifi> service =
-      new android::hardware::wifi::V1_0::implementation::Wifi();
+  android::sp<android::hardware::wifi::V1_1::IWifi> service =
+      new android::hardware::wifi::V1_1::implementation::Wifi();
   CHECK_EQ(service->registerAsService(), android::NO_ERROR)
       << "Failed to register wifi HAL";
 
diff --git a/wifi/1.0/default/wifi.cpp b/wifi/1.1/default/wifi.cpp
similarity index 99%
rename from wifi/1.0/default/wifi.cpp
rename to wifi/1.1/default/wifi.cpp
index b48844e..4ed1f55 100644
--- a/wifi/1.0/default/wifi.cpp
+++ b/wifi/1.1/default/wifi.cpp
@@ -28,7 +28,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 using hidl_return_util::validateAndCall;
 
@@ -195,7 +195,7 @@
   return createWifiStatus(WifiStatusCode::SUCCESS);
 }
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi.h b/wifi/1.1/default/wifi.h
similarity index 93%
rename from wifi/1.0/default/wifi.h
rename to wifi/1.1/default/wifi.h
index c6fa84c..1ade2d8 100644
--- a/wifi/1.0/default/wifi.h
+++ b/wifi/1.1/default/wifi.h
@@ -20,7 +20,7 @@
 #include <functional>
 
 #include <android-base/macros.h>
-#include <android/hardware/wifi/1.0/IWifi.h>
+#include <android/hardware/wifi/1.1/IWifi.h>
 #include <utils/Looper.h>
 
 #include "hidl_callback_util.h"
@@ -31,13 +31,14 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
+using namespace android::hardware::wifi::V1_0;
 
 /**
  * Root HIDL interface object used to control the Wifi HAL.
  */
-class Wifi : public IWifi {
+class Wifi : public V1_1::IWifi {
  public:
   Wifi();
 
@@ -79,7 +80,7 @@
 };
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_ap_iface.cpp b/wifi/1.1/default/wifi_ap_iface.cpp
similarity index 98%
rename from wifi/1.0/default/wifi_ap_iface.cpp
rename to wifi/1.1/default/wifi_ap_iface.cpp
index e2beec2..150a6cc 100644
--- a/wifi/1.0/default/wifi_ap_iface.cpp
+++ b/wifi/1.1/default/wifi_ap_iface.cpp
@@ -24,7 +24,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 using hidl_return_util::validateAndCall;
 
@@ -100,7 +100,7 @@
   return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies};
 }
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_ap_iface.h b/wifi/1.1/default/wifi_ap_iface.h
similarity index 94%
rename from wifi/1.0/default/wifi_ap_iface.h
rename to wifi/1.1/default/wifi_ap_iface.h
index efc168a..608fe6b 100644
--- a/wifi/1.0/default/wifi_ap_iface.h
+++ b/wifi/1.1/default/wifi_ap_iface.h
@@ -25,13 +25,14 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
+using namespace android::hardware::wifi::V1_0;
 
 /**
  * HIDL interface object used to control a AP Iface instance.
  */
-class WifiApIface : public IWifiApIface {
+class WifiApIface : public V1_0::IWifiApIface {
  public:
   WifiApIface(const std::string& ifname,
               const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
@@ -63,7 +64,7 @@
 };
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.1/default/wifi_chip.cpp
similarity index 95%
rename from wifi/1.0/default/wifi_chip.cpp
rename to wifi/1.1/default/wifi_chip.cpp
index 770c83f..2beac26 100644
--- a/wifi/1.0/default/wifi_chip.cpp
+++ b/wifi/1.1/default/wifi_chip.cpp
@@ -46,7 +46,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 using hidl_return_util::validateAndCall;
 
@@ -343,6 +343,23 @@
                          enable);
 }
 
+Return<void> WifiChip::setTxPowerLimit(
+    int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
+                         &WifiChip::setTxPowerLimitInternal,
+                         hidl_status_cb,
+                         powerInDbm);
+}
+
+Return<void> WifiChip::resetTxPowerLimit(
+    resetTxPowerLimit_cb hidl_status_cb) {
+  return validateAndCall(this,
+                         WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
+                         &WifiChip::resetTxPowerLimitInternal,
+                         hidl_status_cb);
+}
+
 void WifiChip::invalidateAndRemoveAllIfaces() {
   invalidateAndClear(ap_iface_);
   invalidateAndClear(nan_iface_);
@@ -370,7 +387,13 @@
 
 std::pair<WifiStatus, uint32_t> WifiChip::getCapabilitiesInternal() {
   legacy_hal::wifi_error legacy_status;
+  uint32_t legacy_feature_set;
   uint32_t legacy_logger_feature_set;
+  std::tie(legacy_status, legacy_feature_set) =
+      legacy_hal_.lock()->getSupportedFeatureSet();
+  if (legacy_status != legacy_hal::WIFI_SUCCESS) {
+    return {createWifiStatusFromLegacyError(legacy_status), 0};
+  }
   std::tie(legacy_status, legacy_logger_feature_set) =
       legacy_hal_.lock()->getLoggerSupportedFeatureSet();
   if (legacy_status != legacy_hal::WIFI_SUCCESS) {
@@ -378,7 +401,7 @@
   }
   uint32_t hidl_caps;
   if (!hidl_struct_util::convertLegacyFeaturesToHidlChipCapabilities(
-          legacy_logger_feature_set, &hidl_caps)) {
+          legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) {
     return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0};
   }
   return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
@@ -801,6 +824,16 @@
   return createWifiStatusFromLegacyError(legacy_status);
 }
 
+WifiStatus WifiChip::setTxPowerLimitInternal(int32_t powerInDbm) {
+  auto legacy_status = legacy_hal_.lock()->setTxPowerLimit(powerInDbm);
+  return createWifiStatusFromLegacyError(legacy_status);
+}
+
+WifiStatus WifiChip::resetTxPowerLimitInternal() {
+  auto legacy_status = legacy_hal_.lock()->resetTxPowerLimit();
+  return createWifiStatusFromLegacyError(legacy_status);
+}
+
 WifiStatus WifiChip::handleChipConfiguration(ChipModeId mode_id) {
   // If the chip is already configured in a different mode, stop
   // the legacy HAL and then start it after firmware mode change.
@@ -869,7 +902,7 @@
 }
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_chip.h b/wifi/1.1/default/wifi_chip.h
similarity index 95%
rename from wifi/1.0/default/wifi_chip.h
rename to wifi/1.1/default/wifi_chip.h
index 406938c..b7dde50 100644
--- a/wifi/1.0/default/wifi_chip.h
+++ b/wifi/1.1/default/wifi_chip.h
@@ -20,7 +20,7 @@
 #include <map>
 
 #include <android-base/macros.h>
-#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include <android/hardware/wifi/1.1/IWifiChip.h>
 
 #include "hidl_callback_util.h"
 #include "wifi_ap_iface.h"
@@ -34,15 +34,16 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
+using namespace android::hardware::wifi::V1_0;
 
 /**
  * HIDL interface object used to control a Wifi HAL chip instance.
  * Since there is only a single chip instance used today, there is no
  * identifying handle information stored here.
  */
-class WifiChip : public IWifiChip {
+class WifiChip : public V1_1::IWifiChip {
  public:
   WifiChip(
       ChipId chip_id,
@@ -125,6 +126,9 @@
       getDebugHostWakeReasonStats_cb hidl_status_cb) override;
   Return<void> enableDebugErrorAlerts(
       bool enable, enableDebugErrorAlerts_cb hidl_status_cb) override;
+  Return<void> setTxPowerLimit(
+      int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) override;
+  Return<void> resetTxPowerLimit(resetTxPowerLimit_cb hidl_status_cb) override;
 
  private:
   void invalidateAndRemoveAllIfaces();
@@ -176,6 +180,8 @@
   std::pair<WifiStatus, WifiDebugHostWakeReasonStats>
   getDebugHostWakeReasonStatsInternal();
   WifiStatus enableDebugErrorAlertsInternal(bool enable);
+  WifiStatus setTxPowerLimitInternal(int32_t powerInDbm);
+  WifiStatus resetTxPowerLimitInternal();
 
   WifiStatus handleChipConfiguration(ChipModeId mode_id);
   WifiStatus registerDebugRingBufferCallback();
@@ -201,7 +207,7 @@
 };
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_feature_flags.h b/wifi/1.1/default/wifi_feature_flags.h
similarity index 96%
rename from wifi/1.0/default/wifi_feature_flags.h
rename to wifi/1.1/default/wifi_feature_flags.h
index 3502fbd..5939ffb 100644
--- a/wifi/1.0/default/wifi_feature_flags.h
+++ b/wifi/1.1/default/wifi_feature_flags.h
@@ -20,7 +20,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 
 class WifiFeatureFlags {
@@ -33,7 +33,7 @@
 };
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.1/default/wifi_legacy_hal.cpp
similarity index 98%
rename from wifi/1.0/default/wifi_legacy_hal.cpp
rename to wifi/1.1/default/wifi_legacy_hal.cpp
index b6a7550..052aafb 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.1/default/wifi_legacy_hal.cpp
@@ -47,7 +47,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace legacy_hal {
 // Legacy HAL functions accept "C" style function pointers, so use global
@@ -752,6 +752,15 @@
                                                       oui_internal.data());
 }
 
+wifi_error WifiLegacyHal::setTxPowerLimit(int32_t tx_level_dbm) {
+  return global_func_table_.wifi_set_tx_power_limit(wlan_interface_handle_,
+                                                    tx_level_dbm);
+}
+
+wifi_error WifiLegacyHal::resetTxPowerLimit() {
+  return global_func_table_.wifi_reset_tx_power_limit(wlan_interface_handle_);
+}
+
 std::pair<wifi_error, uint32_t> WifiLegacyHal::getLoggerSupportedFeatureSet() {
   uint32_t supported_features;
   wifi_error status = global_func_table_.wifi_get_logger_supported_feature_set(
@@ -1197,11 +1206,19 @@
       id, wlan_interface_handle_, &msg_internal);
 }
 
+typedef struct {
+    u8 num_ndp_instances;
+    NanDataPathId ndp_instance_id;
+} NanDataPathEndSingleNdpIdRequest;
+
 wifi_error WifiLegacyHal::nanDataEnd(transaction_id id,
-                                     const NanDataPathEndRequest& msg) {
-  NanDataPathEndRequest msg_internal(msg);
-  return global_func_table_.wifi_nan_data_end(
-      id, wlan_interface_handle_, &msg_internal);
+                                     uint32_t ndpInstanceId) {
+  NanDataPathEndSingleNdpIdRequest msg;
+  msg.num_ndp_instances = 1;
+  msg.ndp_instance_id = ndpInstanceId;
+  wifi_error status = global_func_table_.wifi_nan_data_end(
+      id, wlan_interface_handle_, (NanDataPathEndRequest*)&msg);
+  return status;
 }
 
 wifi_error WifiLegacyHal::setCountryCode(std::array<int8_t, 2> code) {
@@ -1308,7 +1325,7 @@
 
 }  // namespace legacy_hal
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.1/default/wifi_legacy_hal.h
similarity index 98%
rename from wifi/1.0/default/wifi_legacy_hal.h
rename to wifi/1.1/default/wifi_legacy_hal.h
index 1656f68..8d9144d 100644
--- a/wifi/1.0/default/wifi_legacy_hal.h
+++ b/wifi/1.1/default/wifi_legacy_hal.h
@@ -26,7 +26,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 // This is in a separate namespace to prevent typename conflicts between
 // the legacy HAL types and the HIDL interface types.
@@ -205,6 +205,8 @@
       uint32_t period_in_ms);
   wifi_error stopSendingOffloadedPacket(uint32_t cmd_id);
   wifi_error setScanningMacOui(const std::array<uint8_t, 3>& oui);
+  wifi_error setTxPowerLimit(int32_t tx_level_dbm);
+  wifi_error resetTxPowerLimit();
   // Logger/debug functions.
   std::pair<wifi_error, uint32_t> getLoggerSupportedFeatureSet();
   wifi_error startPktFateMonitoring();
@@ -268,7 +270,7 @@
                                      const NanDataPathInitiatorRequest& msg);
   wifi_error nanDataIndicationResponse(
       transaction_id id, const NanDataPathIndicationResponse& msg);
-  wifi_error nanDataEnd(transaction_id id, const NanDataPathEndRequest& msg);
+  wifi_error nanDataEnd(transaction_id id, uint32_t ndpInstanceId);
   // AP functions.
   wifi_error setCountryCode(std::array<int8_t, 2> code);
 
@@ -298,7 +300,7 @@
 
 }  // namespace legacy_hal
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_legacy_hal_stubs.cpp b/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
similarity index 97%
rename from wifi/1.0/default/wifi_legacy_hal_stubs.cpp
rename to wifi/1.1/default/wifi_legacy_hal_stubs.cpp
index 2973430..24ed548 100644
--- a/wifi/1.0/default/wifi_legacy_hal_stubs.cpp
+++ b/wifi/1.1/default/wifi_legacy_hal_stubs.cpp
@@ -20,7 +20,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace legacy_hal {
 template <typename>
@@ -132,11 +132,13 @@
   populateStubFor(&hal_fn->wifi_get_roaming_capabilities);
   populateStubFor(&hal_fn->wifi_enable_firmware_roaming);
   populateStubFor(&hal_fn->wifi_configure_roaming);
+  populateStubFor(&hal_fn->wifi_set_tx_power_limit);
+  populateStubFor(&hal_fn->wifi_reset_tx_power_limit);
   return true;
 }
 }  // namespace legacy_hal
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_legacy_hal_stubs.h b/wifi/1.1/default/wifi_legacy_hal_stubs.h
similarity index 96%
rename from wifi/1.0/default/wifi_legacy_hal_stubs.h
rename to wifi/1.1/default/wifi_legacy_hal_stubs.h
index 1cb5f9d..bfc4c9b 100644
--- a/wifi/1.0/default/wifi_legacy_hal_stubs.h
+++ b/wifi/1.1/default/wifi_legacy_hal_stubs.h
@@ -20,7 +20,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace legacy_hal {
 #include <hardware_legacy/wifi_hal.h>
@@ -28,7 +28,7 @@
 bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn);
 }  // namespace legacy_hal
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_mode_controller.cpp b/wifi/1.1/default/wifi_mode_controller.cpp
similarity index 98%
rename from wifi/1.0/default/wifi_mode_controller.cpp
rename to wifi/1.1/default/wifi_mode_controller.cpp
index 7e82d4c..b8a44c2 100644
--- a/wifi/1.0/default/wifi_mode_controller.cpp
+++ b/wifi/1.1/default/wifi_mode_controller.cpp
@@ -48,7 +48,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace mode_controller {
 
@@ -80,7 +80,7 @@
 }
 }  // namespace mode_controller
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_mode_controller.h b/wifi/1.1/default/wifi_mode_controller.h
similarity index 95%
rename from wifi/1.0/default/wifi_mode_controller.h
rename to wifi/1.1/default/wifi_mode_controller.h
index a4147a9..6984509 100644
--- a/wifi/1.0/default/wifi_mode_controller.h
+++ b/wifi/1.1/default/wifi_mode_controller.h
@@ -24,9 +24,11 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 namespace mode_controller {
+using namespace android::hardware::wifi::V1_0;
+
 /**
  * Class that encapsulates all firmware mode configuration.
  * This class will perform the necessary firmware reloads to put the chip in the
@@ -51,7 +53,7 @@
 
 }  // namespace mode_controller
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_nan_iface.cpp b/wifi/1.1/default/wifi_nan_iface.cpp
similarity index 98%
rename from wifi/1.0/default/wifi_nan_iface.cpp
rename to wifi/1.1/default/wifi_nan_iface.cpp
index 88fb5b2..a111d06 100644
--- a/wifi/1.0/default/wifi_nan_iface.cpp
+++ b/wifi/1.1/default/wifi_nan_iface.cpp
@@ -24,7 +24,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 using hidl_return_util::validateAndCall;
 
@@ -757,19 +757,13 @@
 }
 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);
+      legacy_hal_.lock()->nanDataEnd(cmd_id, ndpInstanceId);
   return createWifiStatusFromLegacyError(legacy_status);
 }
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_nan_iface.h b/wifi/1.1/default/wifi_nan_iface.h
similarity index 97%
rename from wifi/1.0/default/wifi_nan_iface.h
rename to wifi/1.1/default/wifi_nan_iface.h
index e1edd29..260d8ab 100644
--- a/wifi/1.0/default/wifi_nan_iface.h
+++ b/wifi/1.1/default/wifi_nan_iface.h
@@ -27,13 +27,14 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
+using namespace android::hardware::wifi::V1_0;
 
 /**
  * HIDL interface object used to control a NAN Iface instance.
  */
-class WifiNanIface : public IWifiNanIface {
+class WifiNanIface : public V1_0::IWifiNanIface {
  public:
   WifiNanIface(const std::string& ifname,
                const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
@@ -132,7 +133,7 @@
 };
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_p2p_iface.cpp b/wifi/1.1/default/wifi_p2p_iface.cpp
similarity index 97%
rename from wifi/1.0/default/wifi_p2p_iface.cpp
rename to wifi/1.1/default/wifi_p2p_iface.cpp
index 0d055f1..78e08db 100644
--- a/wifi/1.0/default/wifi_p2p_iface.cpp
+++ b/wifi/1.1/default/wifi_p2p_iface.cpp
@@ -23,7 +23,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 using hidl_return_util::validateAndCall;
 
@@ -64,7 +64,7 @@
 }
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_p2p_iface.h b/wifi/1.1/default/wifi_p2p_iface.h
similarity index 92%
rename from wifi/1.0/default/wifi_p2p_iface.h
rename to wifi/1.1/default/wifi_p2p_iface.h
index d2982db..f563a3d 100644
--- a/wifi/1.0/default/wifi_p2p_iface.h
+++ b/wifi/1.1/default/wifi_p2p_iface.h
@@ -25,13 +25,14 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
+using namespace android::hardware::wifi::V1_0;
 
 /**
  * HIDL interface object used to control a P2P Iface instance.
  */
-class WifiP2pIface : public IWifiP2pIface {
+class WifiP2pIface : public V1_0::IWifiP2pIface {
  public:
   WifiP2pIface(const std::string& ifname,
                const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
@@ -56,7 +57,7 @@
 };
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_rtt_controller.cpp b/wifi/1.1/default/wifi_rtt_controller.cpp
similarity index 99%
rename from wifi/1.0/default/wifi_rtt_controller.cpp
rename to wifi/1.1/default/wifi_rtt_controller.cpp
index f18feae..9ef702d 100644
--- a/wifi/1.0/default/wifi_rtt_controller.cpp
+++ b/wifi/1.1/default/wifi_rtt_controller.cpp
@@ -24,7 +24,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 using hidl_return_util::validateAndCall;
 
@@ -291,7 +291,7 @@
   return createWifiStatusFromLegacyError(legacy_status);
 }
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_rtt_controller.h b/wifi/1.1/default/wifi_rtt_controller.h
similarity index 97%
rename from wifi/1.0/default/wifi_rtt_controller.h
rename to wifi/1.1/default/wifi_rtt_controller.h
index 7c0abca..5437885 100644
--- a/wifi/1.0/default/wifi_rtt_controller.h
+++ b/wifi/1.1/default/wifi_rtt_controller.h
@@ -27,13 +27,13 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 
 /**
  * HIDL interface object used to control all RTT operations.
  */
-class WifiRttController : public IWifiRttController {
+class WifiRttController : public V1_0::IWifiRttController {
  public:
   WifiRttController(const sp<IWifiIface>& bound_iface,
                     const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
@@ -97,7 +97,7 @@
 };
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.1/default/wifi_sta_iface.cpp
similarity index 99%
rename from wifi/1.0/default/wifi_sta_iface.cpp
rename to wifi/1.1/default/wifi_sta_iface.cpp
index 3c52048..28f3f02 100644
--- a/wifi/1.0/default/wifi_sta_iface.cpp
+++ b/wifi/1.1/default/wifi_sta_iface.cpp
@@ -24,7 +24,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 using hidl_return_util::validateAndCall;
 
@@ -623,7 +623,7 @@
 }
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_sta_iface.h b/wifi/1.1/default/wifi_sta_iface.h
similarity index 97%
rename from wifi/1.0/default/wifi_sta_iface.h
rename to wifi/1.1/default/wifi_sta_iface.h
index 08faa2f..587a5de 100644
--- a/wifi/1.0/default/wifi_sta_iface.h
+++ b/wifi/1.1/default/wifi_sta_iface.h
@@ -27,13 +27,14 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
+using namespace android::hardware::wifi::V1_0;
 
 /**
  * HIDL interface object used to control a STA Iface instance.
  */
-class WifiStaIface : public IWifiStaIface {
+class WifiStaIface : public V1_0::IWifiStaIface {
  public:
   WifiStaIface(const std::string& ifname,
                const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
@@ -159,7 +160,7 @@
 };
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_status_util.cpp b/wifi/1.1/default/wifi_status_util.cpp
similarity index 98%
rename from wifi/1.0/default/wifi_status_util.cpp
rename to wifi/1.1/default/wifi_status_util.cpp
index c2d0758..3a85e09 100644
--- a/wifi/1.0/default/wifi_status_util.cpp
+++ b/wifi/1.1/default/wifi_status_util.cpp
@@ -19,7 +19,7 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
 
 std::string legacyErrorToString(legacy_hal::wifi_error error) {
@@ -100,7 +100,7 @@
 }
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.0/default/wifi_status_util.h b/wifi/1.1/default/wifi_status_util.h
similarity index 94%
rename from wifi/1.0/default/wifi_status_util.h
rename to wifi/1.1/default/wifi_status_util.h
index 7f557e0..cc93d66 100644
--- a/wifi/1.0/default/wifi_status_util.h
+++ b/wifi/1.1/default/wifi_status_util.h
@@ -24,8 +24,9 @@
 namespace android {
 namespace hardware {
 namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
 namespace implementation {
+using namespace android::hardware::wifi::V1_0;
 
 std::string legacyErrorToString(legacy_hal::wifi_error error);
 WifiStatus createWifiStatus(WifiStatusCode code,
@@ -36,7 +37,7 @@
 WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error);
 
 }  // namespace implementation
-}  // namespace V1_0
+}  // namespace V1_1
 }  // namespace wifi
 }  // namespace hardware
 }  // namespace android
diff --git a/wifi/1.1/vts/functional/Android.bp b/wifi/1.1/vts/functional/Android.bp
new file mode 100644
index 0000000..6b0baf7
--- /dev/null
+++ b/wifi/1.1/vts/functional/Android.bp
@@ -0,0 +1,39 @@
+//
+// 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: "VtsHalWifiV1_1TargetTest",
+    defaults: ["hidl_defaults"],
+    srcs: [
+        "VtsHalWifiV1_1TargetTest.cpp",
+        "wifi_chip_hidl_test.cpp"],
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libcutils",
+        "libhidlbase",
+        "libhidltransport",
+        "libnativehelper",
+        "libutils",
+        "android.hardware.wifi@1.0",
+        "android.hardware.wifi@1.1",
+    ],
+    static_libs: ["VtsHalWifiV1_0TargetTestUtil", "VtsHalHidlTargetTestBase"],
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
diff --git a/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp b/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp
new file mode 100644
index 0000000..9b92b57
--- /dev/null
+++ b/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+#include <android-base/logging.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include "wifi_hidl_test_utils.h"
+
+WifiHidlEnvironment* gEnv;
+
+int main(int argc, char** argv) {
+    gEnv = new WifiHidlEnvironment();
+    ::testing::AddGlobalTestEnvironment(gEnv);
+    ::testing::InitGoogleTest(&argc, argv);
+    int status = gEnv->initFromOptions(argc, argv);
+    if (status == 0) {
+        int status = RUN_ALL_TESTS();
+        LOG(INFO) << "Test result = " << status;
+    }
+    return status;
+}
diff --git a/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
new file mode 100644
index 0000000..839b6c4
--- /dev/null
+++ b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+#include <android-base/logging.h>
+
+#include <android/hardware/wifi/1.1/IWifi.h>
+#include <android/hardware/wifi/1.1/IWifiChip.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include "wifi_hidl_call_util.h"
+#include "wifi_hidl_test_utils.h"
+
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::wifi::V1_0::IfaceType;
+using ::android::hardware::wifi::V1_0::ChipId;
+using ::android::hardware::wifi::V1_0::ChipModeId;
+using ::android::hardware::wifi::V1_0::WifiStatus;
+using ::android::hardware::wifi::V1_0::WifiStatusCode;
+using ::android::hardware::wifi::V1_1::IWifi;
+using ::android::hardware::wifi::V1_1::IWifiChip;
+using ::android::hardware::wifi::V1_0::IWifiStaIface;
+
+namespace {
+constexpr int32_t kFakePowerInDbm = -56;
+}; //namespace
+
+/**
+ * Fixture to use for all Wifi chip HIDL interface tests.
+ */
+class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    virtual void SetUp() override {
+        wifi_chip_ = IWifiChip::castFrom(getWifiChip());
+        ASSERT_NE(nullptr, wifi_chip_.get());
+    }
+
+    virtual void TearDown() override { stopWifi(); }
+
+   protected:
+    uint32_t configureChipForStaIfaceAndGetCapabilities() {
+        ChipModeId mode_id;
+        EXPECT_TRUE(configureChipToSupportIfaceType(
+            wifi_chip_, IfaceType::STA, &mode_id));
+        const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities);
+        EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code);
+        return status_and_caps.second;
+    }
+
+    sp<IWifiChip> wifi_chip_;
+};
+
+/*
+ * SetTxPowerLimit
+ */
+TEST_F(WifiChipHidlTest, SetTxPowerLimit) {
+    uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
+    const auto& status =
+        HIDL_INVOKE(wifi_chip_, setTxPowerLimit, kFakePowerInDbm);
+    if (caps & IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) {
+        EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
+    } else {
+        EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, status.code);
+    }
+}
+
+/*
+ * SetTxPowerLimit
+ */
+TEST_F(WifiChipHidlTest, ResetTxPowerLimit) {
+    uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
+    const auto& status =
+        HIDL_INVOKE(wifi_chip_, resetTxPowerLimit);
+    if (caps & IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) {
+        EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
+    } else {
+        EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, status.code);
+    }
+}
diff --git a/wifi/Android.bp b/wifi/Android.bp
index 523014f..b4ab98f 100644
--- a/wifi/Android.bp
+++ b/wifi/Android.bp
@@ -2,6 +2,8 @@
 subdirs = [
     "1.0",
     "1.0/vts/functional",
+    "1.1",
+    "1.1/vts/functional",
     "offload/1.0",
     "offload/1.0/vts/functional",
     "supplicant/1.0",
diff --git a/wifi/supplicant/1.0/vts/functional/Android.mk b/wifi/supplicant/1.0/vts/functional/Android.mk
index d87d7ef..c6e3950 100644
--- a/wifi/supplicant/1.0/vts/functional/Android.mk
+++ b/wifi/supplicant/1.0/vts/functional/Android.mk
@@ -27,17 +27,18 @@
     supplicant_sta_network_hidl_test.cpp
 LOCAL_SHARED_LIBRARIES := \
     android.hardware.wifi.supplicant@1.0 \
+    android.hardware.wifi@1.0 \
     libbase \
     libcutils \
     libhidlbase \
     libhidltransport \
     liblog \
     libutils \
-    libwifi-hal \
     libwifi-system \
     libwifi-system-iface
 LOCAL_STATIC_LIBRARIES := \
     libgmock \
-    VtsHalHidlTargetTestBase
+    VtsHalHidlTargetTestBase \
+    VtsHalWifiV1_0TargetTestUtil
 include $(BUILD_NATIVE_TEST)
 
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
index df4bfa9..0afab2f 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
@@ -21,11 +21,11 @@
 #include <android/hidl/manager/1.0/IServiceNotification.h>
 #include <hidl/HidlTransportSupport.h>
 
-#include <wifi_hal/driver_tool.h>
 #include <wifi_system/interface_tool.h>
 #include <wifi_system/supplicant_manager.h>
 
 #include "supplicant_hidl_test_utils.h"
+#include "wifi_hidl_test_utils.h"
 
 using ::android::sp;
 using ::android::hardware::configureRpcThreadpool;
@@ -34,6 +34,8 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
+using ::android::hardware::wifi::V1_0::ChipModeId;
+using ::android::hardware::wifi::V1_0::IWifiChip;
 using ::android::hardware::wifi::supplicant::V1_0::ISupplicant;
 using ::android::hardware::wifi::supplicant::V1_0::ISupplicantIface;
 using ::android::hardware::wifi::supplicant::V1_0::ISupplicantNetwork;
@@ -44,22 +46,25 @@
 using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
 using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
 using ::android::hidl::manager::V1_0::IServiceNotification;
-using ::android::wifi_hal::DriverTool;
 using ::android::wifi_system::InterfaceTool;
 using ::android::wifi_system::SupplicantManager;
 
 namespace {
 const char kSupplicantServiceName[] = "default";
 
-// Helper function to initialize the driver and firmware to STA mode.
+// Helper function to initialize the driver and firmware to STA mode
+// using the vendor HAL HIDL interface.
 void initilializeDriverAndFirmware() {
-    DriverTool driver_tool;
-    InterfaceTool iface_tool;
-    EXPECT_TRUE(driver_tool.LoadDriver());
-    EXPECT_TRUE(driver_tool.ChangeFirmwareMode(DriverTool::kFirmwareModeSta));
-    EXPECT_TRUE(iface_tool.SetWifiUpState(true));
+    sp<IWifiChip> wifi_chip = getWifiChip();
+    ChipModeId mode_id;
+    EXPECT_TRUE(configureChipToSupportIfaceType(
+        wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::STA, &mode_id));
 }
 
+// Helper function to deinitialize the driver and firmware
+// using the vendor HAL HIDL interface.
+void deInitilializeDriverAndFirmware() { stopWifi(); }
+
 // Helper function to find any iface of the desired type exposed.
 bool findIfaceOfType(sp<ISupplicant> supplicant, IfaceType desired_type,
                      ISupplicant::IfaceInfo* out_info) {
@@ -149,11 +154,10 @@
 }
 
 void stopSupplicant() {
-    DriverTool driver_tool;
     SupplicantManager supplicant_manager;
 
     ASSERT_TRUE(supplicant_manager.StopSupplicant());
-    ASSERT_TRUE(driver_tool.UnloadDriver());
+    deInitilializeDriverAndFirmware();
     ASSERT_FALSE(supplicant_manager.IsSupplicantRunning());
 }