Merge "Omx vts test."
diff --git a/audio/2.0/default/Stream.cpp b/audio/2.0/default/Stream.cpp
index 671f171..effdd28 100644
--- a/audio/2.0/default/Stream.cpp
+++ b/audio/2.0/default/Stream.cpp
@@ -44,8 +44,20 @@
 }
 
 // static
-Result Stream::analyzeStatus(const char* funcName, int status, int ignoreError, int ignoreError2) {
-    if (status != 0 && status != -ignoreError && status != -ignoreError2) {
+Result Stream::analyzeStatus(const char* funcName, int status) {
+    static const std::vector<int> empty;
+    return analyzeStatus(funcName, status, empty);
+}
+
+template <typename T>
+inline bool element_in(T e, const std::vector<T>& v) {
+    return std::find(v.begin(), v.end(), e) != v.end();
+}
+
+// static
+Result Stream::analyzeStatus(const char* funcName, int status,
+                             const std::vector<int>& ignoreErrors) {
+    if (status != 0 && (ignoreErrors.empty() || !element_in(-status, ignoreErrors))) {
         ALOGW("Error from HAL stream in function %s: %s", funcName, strerror(-status));
     }
     switch (status) {
diff --git a/audio/2.0/default/Stream.h b/audio/2.0/default/Stream.h
index b49e658..82f05a7 100644
--- a/audio/2.0/default/Stream.h
+++ b/audio/2.0/default/Stream.h
@@ -17,6 +17,8 @@
 #ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
 #define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
 
+#include <vector>
+
 #include <android/hardware/audio/2.0/IStream.h>
 #include <hardware/audio.h>
 #include <hidl/Status.h>
@@ -79,10 +81,11 @@
     Return<Result> close()  override;
 
     // Utility methods for extending interfaces.
-    static Result analyzeStatus(
-            const char* funcName, int status, int ignoreError = OK, int ignoreError2 = OK);
+    static Result analyzeStatus(const char* funcName, int status);
+    static Result analyzeStatus(const char* funcName, int status,
+                                const std::vector<int>& ignoreErrors);
 
-  private:
+   private:
     audio_stream_t *mStream;
 
     virtual ~Stream();
diff --git a/audio/2.0/default/StreamIn.cpp b/audio/2.0/default/StreamIn.cpp
index abd0497..b81cbb9 100644
--- a/audio/2.0/default/StreamIn.cpp
+++ b/audio/2.0/default/StreamIn.cpp
@@ -416,15 +416,15 @@
 // static
 Result StreamIn::getCapturePositionImpl(audio_stream_in_t* stream,
                                         uint64_t* frames, uint64_t* time) {
+    // HAL may have a stub function, always returning ENOSYS, don't
+    // spam the log in this case.
+    static const std::vector<int> ignoredErrors{ENOSYS};
     Result retval(Result::NOT_SUPPORTED);
     if (stream->get_capture_position != NULL) return retval;
     int64_t halFrames, halTime;
-    retval = Stream::analyzeStatus(
-        "get_capture_position",
-        stream->get_capture_position(stream, &halFrames, &halTime),
-        // HAL may have a stub function, always returning ENOSYS, don't
-        // spam the log in this case.
-        ENOSYS);
+    retval = Stream::analyzeStatus("get_capture_position",
+                                   stream->get_capture_position(stream, &halFrames, &halTime),
+                                   ignoredErrors);
     if (retval == Result::OK) {
         *frames = halFrames;
         *time = halTime;
diff --git a/audio/2.0/default/StreamOut.cpp b/audio/2.0/default/StreamOut.cpp
index e48497f..290d0b1 100644
--- a/audio/2.0/default/StreamOut.cpp
+++ b/audio/2.0/default/StreamOut.cpp
@@ -487,16 +487,17 @@
 Result StreamOut::getPresentationPositionImpl(audio_stream_out_t* stream,
                                               uint64_t* frames,
                                               TimeSpec* timeStamp) {
+    // Don't logspam on EINVAL--it's normal for get_presentation_position
+    // to return it sometimes. EAGAIN may be returned by A2DP audio HAL
+    // implementation. ENODATA can also be reported while the writer is
+    // continuously querying it, but the stream has been stopped.
+    static const std::vector<int> ignoredErrors{EINVAL, EAGAIN, ENODATA};
     Result retval(Result::NOT_SUPPORTED);
     if (stream->get_presentation_position == NULL) return retval;
     struct timespec halTimeStamp;
-    retval = Stream::analyzeStatus(
-        "get_presentation_position",
-        stream->get_presentation_position(stream, frames, &halTimeStamp),
-        // Don't logspam on EINVAL--it's normal for get_presentation_position
-        // to return it sometimes. EAGAIN may be returned by A2DP audio HAL
-        // implementation.
-        EINVAL, EAGAIN);
+    retval = Stream::analyzeStatus("get_presentation_position",
+                                   stream->get_presentation_position(stream, frames, &halTimeStamp),
+                                   ignoredErrors);
     if (retval == Result::OK) {
         timeStamp->tvSec = halTimeStamp.tv_sec;
         timeStamp->tvNSec = halTimeStamp.tv_nsec;
diff --git a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
index 8ddbad4..90fec01 100644
--- a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -746,12 +746,12 @@
 TEST_IO_STREAM(
     GetSampleRate,
     "Check that the stream sample rate == the one it was opened with",
-    ASSERT_EQ(audioConfig.sampleRateHz, extract(stream->getSampleRate())))
+    stream->getSampleRate())
 
 TEST_IO_STREAM(
     GetChannelMask,
     "Check that the stream channel mask == the one it was opened with",
-    ASSERT_EQ(audioConfig.channelMask, extract(stream->getChannelMask())))
+    stream->getChannelMask())
 
 TEST_IO_STREAM(GetFormat,
                "Check that the stream format == the one it was opened with",
@@ -853,25 +853,17 @@
     areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
                                : testSetDevice(stream.get(), address))
 
-static void testGetAudioProperties(IStream* stream,
-                                   AudioConfig expectedConfig) {
+static void testGetAudioProperties(IStream* stream) {
     uint32_t sampleRateHz;
     AudioChannelMask mask;
     AudioFormat format;
-
     stream->getAudioProperties(returnIn(sampleRateHz, mask, format));
-
-    // FIXME: the qcom hal it does not currently negotiate the sampleRate &
-    // channel mask
-    EXPECT_EQ(expectedConfig.sampleRateHz, sampleRateHz);
-    EXPECT_EQ(expectedConfig.channelMask, mask);
-    EXPECT_EQ(expectedConfig.format, format);
 }
 
 TEST_IO_STREAM(
     GetAudioProperties,
     "Check that the stream audio properties == the ones it was opened with",
-    testGetAudioProperties(stream.get(), audioConfig))
+    testGetAudioProperties(stream.get()))
 
 static void testConnectedState(IStream* stream) {
     DeviceAddress address = {};
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
new file mode 100644
index 0000000..64647de
--- /dev/null
+++ b/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           targetNamespace="http://schemas.android.com/audio/audio_effects_conf/v2_0"
+           xmlns:aec="http://schemas.android.com/audio/audio_effects_conf/v2_0"
+           elementFormDefault="qualified">
+
+  <!-- Simple types -->
+  <xs:simpleType name="versionType">
+    <xs:restriction base="xs:decimal">
+      <xs:enumeration value="2.0"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="uuidType">
+    <xs:restriction base="xs:string">
+      <xs:pattern value="[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="streamInputType">
+    <xs:restriction base="xs:string">
+      <xs:enumeration value="mic"/>
+      <xs:enumeration value="voice_uplink"/>
+      <xs:enumeration value="voice_downlink"/>
+      <xs:enumeration value="voice_call"/>
+      <xs:enumeration value="camcorder"/>
+      <xs:enumeration value="voice_recognition"/>
+      <xs:enumeration value="voice_communication"/>
+      <xs:enumeration value="unprocessed"/>
+    </xs:restriction>
+  </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"/>
+      <xs:enumeration value="music"/>
+      <xs:enumeration value="alarm"/>
+      <xs:enumeration value="notification"/>
+      <xs:enumeration value="bluetooth_sco"/>
+      <xs:enumeration value="enforced_audible"/>
+      <xs:enumeration value="dtmf"/>
+      <xs:enumeration value="tts"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <!-- Complex types -->
+  <xs:complexType name="libraryType">
+    <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.
+
+        Example:
+
+        <library name="name" path="/vendor/lib/soundfx/lib.so"/>
+
+      </xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <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:complexType>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="effectImplType">
+    <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: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:annotation>
+      <xs:documentation xml:lang="en">
+        List of effects to load. Each effect element must contain "name",
+        "library", and "uuid" attrs. The value of the "library" attr must
+        correspond to the name of a "library" element. The name of the effect
+        element is indicative, only the value of the "uuid" element designates
+        the effect for the audio framework.  The uuid is the implementation
+        specific UUID as specified by the effect vendor. This is not the generic
+        effect type UUID.
+
+        For effect proxy implementations, SW and HW implemetations of the effect
+        can be specified.
+
+        Example:
+
+        <effect name="name" library="lib" uuid="uuuu"/>
+        <effect name="proxied" library="proxy" uuid="xxxx">
+            <libsw library="sw_bundle" uuid="yyyy"/>
+            <libhw library="offload_bundle" uuid="zzzz"/>
+        </effect>
+
+      </xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="effect" type="aec:effectProxyType" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="streamProcessingType">
+    <xs:sequence>
+      <xs:element name="apply" minOccurs="0" maxOccurs="unbounded">
+        <xs:complexType>
+          <xs:attribute name="effect" type="xs:string" use="required"/>
+        </xs:complexType>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="streamPreprocessType">
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+        Audio preprocessing configuration. The processing configuration consists
+        of a list of elements each describing processing settings for a given
+        input stream. Valid input stream types are listed in "streamInputType".
+
+        Each stream element contains a list of "apply" elements. The value of the
+        "effect" attr must correspond to the name of an "effect" element.
+
+        Example:
+
+        <stream type="voice_communication">
+            <apply effect="effect1"/>
+            <apply effect="effect2"/>
+        </stream>
+
+      </xs:documentation>
+    </xs:annotation>
+    <xs:complexContent>
+      <xs:extension base="aec:streamProcessingType">
+        <xs:attribute name="type" type="aec:streamInputType" use="required"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="streamPostprocessType">
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+        Audio postprocessing configuration. The processing configuration consists
+        of a list of elements each describing processing settings for a given
+        output stream. Valid output stream types are listed in "streamOutputType".
+
+        Each stream element contains a list of "apply" elements. The value of the
+        "effect" attr must correspond to the name of an "effect" element.
+
+        Example:
+
+        <stream type="music">
+            <apply effect="effect1"/>
+        </stream>
+
+      </xs:documentation>
+    </xs:annotation>
+    <xs:complexContent>
+      <xs:extension base="aec:streamProcessingType">
+        <xs:attribute name="type" type="aec:streamOutputType" use="required"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <!-- Root element -->
+  <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="postprocess" minOccurs="0" maxOccurs="1">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="stream" type="aec:streamPostprocessType" minOccurs="0" maxOccurs="unbounded"/>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="preprocess" minOccurs="0" maxOccurs="1">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="stream" type="aec:streamPreprocessType" minOccurs="0" maxOccurs="unbounded"/>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+      <xs:attribute name="version" type="aec:versionType" use="required"/>
+    </xs:complexType>
+
+    <!-- Keys and references -->
+    <xs:key name="libraryName">
+      <xs:selector xpath="aec:libraries/aec:library"/>
+      <xs:field xpath="@name"/>
+    </xs:key>
+    <xs:keyref name="libraryNameRef1" refer="aec:libraryName">
+      <xs:selector xpath="aec:effects/aec:effect"/>
+      <xs:field xpath="@library"/>
+    </xs:keyref>
+    <xs:keyref name="libraryNameRef2" refer="aec:libraryName">
+      <xs:selector xpath="aec:effects/aec:effect/aec:libsw"/>
+      <xs:field xpath="@library"/>
+    </xs:keyref>
+    <xs:keyref name="libraryNameRef3" refer="aec:libraryName">
+      <xs:selector xpath="aec:effects/aec:effect/aec:libhw"/>
+      <xs:field xpath="@library"/>
+    </xs:keyref>
+    <xs:key name="effectName">
+      <xs:selector xpath="aec:effects/aec:effect"/>
+      <xs:field xpath="@name"/>
+    </xs:key>
+    <xs:keyref name="effectNamePreRef" refer="aec:effectName">
+      <xs:selector xpath="aec:preprocess/aec:stream/aec:apply"/>
+      <xs:field xpath="@effect"/>
+    </xs:keyref>
+    <xs:keyref name="effectNamePostRef" refer="aec:effectName">
+      <xs:selector xpath="aec:postprocess/aec:stream/aec:apply"/>
+      <xs:field xpath="@effect"/>
+    </xs:keyref>
+  </xs:element>
+</xs:schema>
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index 61be82d..bad406f 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -403,12 +403,14 @@
         if (result.inputBuffer.releaseFence.getNativeHandle() != nullptr) {
             native_handle_t* handle = const_cast<native_handle_t*>(
                     result.inputBuffer.releaseFence.getNativeHandle());
+            native_handle_close(handle);
             native_handle_delete(handle);
         }
         for (auto& buf : result.outputBuffers) {
             if (buf.releaseFence.getNativeHandle() != nullptr) {
                 native_handle_t* handle = const_cast<native_handle_t*>(
                         buf.releaseFence.getNativeHandle());
+                native_handle_close(handle);
                 native_handle_delete(handle);
             }
         }
diff --git a/compatibility_matrix.xml b/compatibility_matrix.xml
index 0f42a02..9603bd6 100644
--- a/compatibility_matrix.xml
+++ b/compatibility_matrix.xml
@@ -18,10 +18,18 @@
     <hal format="hidl" optional="true">
         <name>android.hardware.automotive.evs</name>
         <version>1.0</version>
+        <interface>
+            <name>IEvsEnumerator</name>
+            <instance>default</instance>
+        </interface>
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.automotive.vehicle</name>
-        <version>2.1</version>
+        <version>2.0</version>
+        <interface>
+            <name>IVehicle</name>
+            <instance>default</instance>
+        </interface>
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.biometrics.fingerprint</name>
@@ -48,6 +56,14 @@
         </interface>
     </hal>
     <hal format="hidl" optional="true">
+        <name>android.hardware.broadcastradio</name>
+        <version>1.0</version>
+        <interface>
+            <name>IBroadcastRadioFactory</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
         <name>android.hardware.camera.provider</name>
         <version>2.4</version>
         <interface>
@@ -132,6 +148,14 @@
         </interface>
     </hal>
     <hal format="hidl" optional="true">
+        <name>android.hardware.health</name>
+        <version>1.0</version>
+        <interface>
+            <name>IHealth</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
         <name>android.hardware.ir</name>
         <version>1.0</version>
     </hal>
@@ -158,6 +182,10 @@
             <name>IOmx</name>
             <instance>default</instance>
         </interface>
+        <interface>
+            <name>IOmxStore</name>
+            <instance>default</instance>
+        </interface>
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.memtrack</name>
@@ -240,6 +268,22 @@
         </interface>
     </hal>
     <hal format="hidl" optional="true">
+        <name>android.hardware.tv.cec</name>
+        <version>1.0</version>
+        <interface>
+            <name>IHdmiCec</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
+        <name>android.hardware.tv.input</name>
+        <version>1.0</version>
+        <interface>
+            <name>ITvInput</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
         <name>android.hardware.usb</name>
         <version>1.0</version>
         <interface>
@@ -275,4 +319,15 @@
             <instance>default</instance>
         </interface>
     </hal>
+    <hal format="hidl" optional="true">
+        <name>android.hardware.wifi.supplicant</name>
+        <version>1.0</version>
+        <interface>
+            <name>ISupplicant</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <kernel version="4.9.0" />
+    <kernel version="4.4.0" />
+    <kernel version="3.18.0" />
 </compatibility-matrix>
diff --git a/configstore/utils/include/configstore/Utils.h b/configstore/utils/include/configstore/Utils.h
index c9c830b..b107a20 100644
--- a/configstore/utils/include/configstore/Utils.h
+++ b/configstore/utils/include/configstore/Utils.h
@@ -42,6 +42,15 @@
 using ::android::hardware::configstore::V1_0::OptionalUInt64;
 using ::android::hardware::configstore::V1_0::OptionalString;
 
+// a function to retrieve and cache the service handle
+// for a particular interface
+template <typename I>
+sp<I> getService() {
+    // static initializer used for synchronizations
+    static sp<I> configs = I::getService();
+    return configs;
+}
+
 // arguments V: type for the value (i.e., OptionalXXX)
 //           I: interface class name
 //           func: member function pointer
@@ -49,9 +58,10 @@
         (std::function<void(const V&)>)>
 decltype(V::value) get(const decltype(V::value) &defValue) {
     using namespace android::hardware::details;
+    // static initializer used for synchronizations
     auto getHelper = []()->V {
         V ret;
-        sp<I> configs = I::getService();
+        sp<I> configs = getService<I>();
 
         if (!configs.get()) {
             // fallback to the default value
diff --git a/dumpstate/1.0/default/DumpstateDevice.cpp b/dumpstate/1.0/default/DumpstateDevice.cpp
index 213fc62..818a531 100644
--- a/dumpstate/1.0/default/DumpstateDevice.cpp
+++ b/dumpstate/1.0/default/DumpstateDevice.cpp
@@ -37,7 +37,7 @@
     // this interface - since HIDL_FETCH_IDumpstateDevice() is not defined, this function will never
     // be called by dumpstate.
 
-    if (handle->numFds < 1) {
+    if (handle == nullptr || handle->numFds < 1) {
         ALOGE("no FDs\n");
         return Void();
     }
diff --git a/graphics/allocator/2.0/default/service.cpp b/graphics/allocator/2.0/default/service.cpp
index a43740c..99f462c 100644
--- a/graphics/allocator/2.0/default/service.cpp
+++ b/graphics/allocator/2.0/default/service.cpp
@@ -24,5 +24,5 @@
 using android::hardware::defaultPassthroughServiceImplementation;
 
 int main() {
-    return defaultPassthroughServiceImplementation<IAllocator>();
+    return defaultPassthroughServiceImplementation<IAllocator>(4);
 }
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 65b055c..eac35f7 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -143,15 +143,17 @@
 
   radio->getAvailableNetworks(++serial);
   EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
   EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  ASSERT_TRUE(radioRsp->rspInfo.type == RadioResponseType::SOLICITED ||
+              radioRsp->rspInfo.type == RadioResponseType::SOLICITED_ACK_EXP);
 
   if (cardStatus.cardState == CardState::ABSENT) {
-      ASSERT_TRUE(CheckGeneralError() ||
-                  radioRsp->rspInfo.error == RadioError::NONE ||
-                  radioRsp->rspInfo.error == RadioError::DEVICE_IN_USE ||
-                  radioRsp->rspInfo.error == RadioError::CANCELLED ||
-                  radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED);
+      ASSERT_TRUE(
+          CheckGeneralError() || radioRsp->rspInfo.error == RadioError::NONE ||
+          radioRsp->rspInfo.error == RadioError::DEVICE_IN_USE ||
+          radioRsp->rspInfo.error == RadioError::CANCELLED ||
+          radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED ||
+          radioRsp->rspInfo.error == RadioError::MODEM_ERR);
   }
 }
 
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils.h b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
index 735e575..923e1e3 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
@@ -80,7 +80,7 @@
 using ::android::hardware::Void;
 using ::android::sp;
 
-#define TIMEOUT_PERIOD 40
+#define TIMEOUT_PERIOD 65
 #define RADIO_SERVICE_NAME "slot1"
 
 class RadioHidlTest;
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
index f505d01..2670b8d 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
@@ -28,6 +28,7 @@
 }
 
 void RenderscriptHidlTest::TearDown() {
+    context->contextFinish();
     context->contextDestroy();
 }
 
diff --git a/tests/Android.bp b/tests/Android.bp
index 6f99a36..8c9e5c9 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -15,6 +15,7 @@
     "inheritance/1.0/default",
     "libhwbinder/1.0",
     "libhwbinder/1.0/default",
+    "libhwbinder/aidl",
     "memory/1.0",
     "memory/1.0/default",
     "msgq/1.0",
diff --git a/tests/libhwbinder/aidl/Android.bp b/tests/libhwbinder/aidl/Android.bp
new file mode 100644
index 0000000..a662085
--- /dev/null
+++ b/tests/libhwbinder/aidl/Android.bp
@@ -0,0 +1,15 @@
+cc_library_shared {
+    name: "android.hardware.tests.libbinder",
+
+    srcs: ["android/tests/binder/IBenchmark.aidl"],
+
+    aidl: {
+        export_aidl_headers: true,
+    },
+
+    shared_libs: [
+        "libbinder",
+        "libutils",
+    ],
+
+}
diff --git a/tests/libhwbinder/aidl/Android.mk b/tests/libhwbinder/aidl/Android.mk
deleted file mode 100644
index 1c175d8..0000000
--- a/tests/libhwbinder/aidl/Android.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.libbinder
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-
-LOCAL_SRC_FILES := android/tests/binder/IBenchmark.aidl
-
-LOCAL_SHARED_LIBRARIES := \
-  libbinder \
-  libutils \
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
index fefbd79..e4382bc 100644
--- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
+++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
@@ -36,6 +36,9 @@
 using ::android::hardware::hidl_vec;
 
 namespace {
+constexpr uint32_t kHalStartRetryMaxCount = 5;
+constexpr uint32_t kHalStartRetryIntervalInMs = 2;
+
 bool findAnyModeSupportingIfaceType(
     IfaceType desired_type, const std::vector<IWifiChip::ChipMode>& modes,
     ChipModeId* mode_id) {
@@ -92,7 +95,15 @@
     if (!wifi.get()) {
         return nullptr;
     }
-    if (HIDL_INVOKE(wifi, start).code != WifiStatusCode::SUCCESS) {
+    uint32_t retry_count = 0;
+    auto status = HIDL_INVOKE(wifi, start);
+    while (retry_count < kHalStartRetryMaxCount &&
+           status.code == WifiStatusCode::ERROR_NOT_AVAILABLE) {
+        retry_count++;
+        usleep(kHalStartRetryIntervalInMs * 1000);
+        status = HIDL_INVOKE(wifi, start);
+    }
+    if (status.code != WifiStatusCode::SUCCESS) {
         return nullptr;
     }
     const auto& status_and_chip_ids = HIDL_INVOKE(wifi, getChipIds);